Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/secp256k1.c
Show First 20 Lines • Show All 462 Lines • ▼ Show 20 Lines | static int nonce_function_rfc6979(unsigned char *nonce32, const unsigned char *msg32, const unsigned char *key32, const unsigned char *algo16, void *data, unsigned int counter) { | ||||
secp256k1_rfc6979_hmac_sha256_finalize(&rng); | secp256k1_rfc6979_hmac_sha256_finalize(&rng); | ||||
return 1; | return 1; | ||||
} | } | ||||
const secp256k1_nonce_function secp256k1_nonce_function_rfc6979 = nonce_function_rfc6979; | const secp256k1_nonce_function secp256k1_nonce_function_rfc6979 = nonce_function_rfc6979; | ||||
const secp256k1_nonce_function secp256k1_nonce_function_default = nonce_function_rfc6979; | const secp256k1_nonce_function secp256k1_nonce_function_default = nonce_function_rfc6979; | ||||
int secp256k1_ecdsa_sign(const secp256k1_context* ctx, secp256k1_ecdsa_signature *signature, const unsigned char *msg32, const unsigned char *seckey, secp256k1_nonce_function noncefp, const void* noncedata) { | int secp256k1_ecdsa_sign(const secp256k1_context* ctx, secp256k1_ecdsa_signature *signature, const unsigned char *msg32, const unsigned char *seckey, secp256k1_nonce_function noncefp, const void* noncedata) { | ||||
secp256k1_scalar r, s; | /* Default initialization here is important so we won't pass uninit values to the cmov in the end */ | ||||
secp256k1_scalar r = secp256k1_scalar_zero, s = secp256k1_scalar_zero; | |||||
secp256k1_scalar sec, non, msg; | secp256k1_scalar sec, non, msg; | ||||
int ret = 0; | int ret = 0; | ||||
int overflow = 0; | int overflow = 0; | ||||
unsigned char nonce32[32]; | unsigned char nonce32[32]; | ||||
unsigned int count = 0; | unsigned int count = 0; | ||||
const unsigned char secp256k1_ecdsa_der_algo16[17] = "ECDSA+DER "; | const unsigned char secp256k1_ecdsa_der_algo16[17] = "ECDSA+DER "; | ||||
VERIFY_CHECK(ctx != NULL); | VERIFY_CHECK(ctx != NULL); | ||||
ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx)); | ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx)); | ||||
▲ Show 20 Lines • Show All 244 Lines • Show Last 20 Lines |