Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/secp256k1.c
Show First 20 Lines • Show All 304 Lines • ▼ Show 20 Lines | int secp256k1_ecdsa_verify(const secp256k1_context* ctx, const secp256k1_ecdsa_signature *sig, const unsigned char *msg32, const secp256k1_pubkey *pubkey) { | ||||
return (!secp256k1_scalar_is_high(&s) && | return (!secp256k1_scalar_is_high(&s) && | ||||
secp256k1_pubkey_load(ctx, &q, pubkey) && | secp256k1_pubkey_load(ctx, &q, pubkey) && | ||||
secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &r, &s, &q, &m)); | secp256k1_ecdsa_sig_verify(&ctx->ecmult_ctx, &r, &s, &q, &m)); | ||||
} | } | ||||
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) { | 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) { | ||||
unsigned char keydata[112]; | unsigned char keydata[112]; | ||||
int keylen = 64; | int keylen = 64; | ||||
secp256k1_rfc6979_hmac_sha256_t rng; | secp256k1_rfc6979_hmac_sha256 rng; | ||||
unsigned int i; | unsigned int i; | ||||
/* We feed a byte array to the PRNG as input, consisting of: | /* We feed a byte array to the PRNG as input, consisting of: | ||||
* - the private key (32 bytes) and message (32 bytes), see RFC 6979 3.2d. | * - the private key (32 bytes) and message (32 bytes), see RFC 6979 3.2d. | ||||
* - optionally 32 extra bytes of data, see RFC 6979 3.6 Additional Data. | * - optionally 32 extra bytes of data, see RFC 6979 3.6 Additional Data. | ||||
* - optionally 16 extra bytes with the algorithm name. | * - optionally 16 extra bytes with the algorithm name. | ||||
* Because the arguments have distinct fixed lengths it is not possible for | * Because the arguments have distinct fixed lengths it is not possible for | ||||
* different argument mixtures to emulate each other and result in the same | * different argument mixtures to emulate each other and result in the same | ||||
* nonces. | * nonces. | ||||
▲ Show 20 Lines • Show All 263 Lines • Show Last 20 Lines |