Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/tests.c
Show First 20 Lines • Show All 4,366 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void test_ecdsa_sign_verify(void) { | void test_ecdsa_sign_verify(void) { | ||||
secp256k1_gej pubj; | secp256k1_gej pubj; | ||||
secp256k1_ge pub; | secp256k1_ge pub; | ||||
secp256k1_scalar one; | secp256k1_scalar one; | ||||
secp256k1_scalar msg, key; | secp256k1_scalar msg, key; | ||||
secp256k1_scalar sigr, sigs; | secp256k1_scalar sigr, sigs; | ||||
int recid; | |||||
int getrec; | int getrec; | ||||
/* Initialize recid to suppress a false positive -Wconditional-uninitialized in clang. | |||||
VG_UNDEF ensures that valgrind will still treat the variable as uninitialized. */ | |||||
int recid = -1; VG_UNDEF(&recid, sizeof(recid)); | |||||
random_scalar_order_test(&msg); | random_scalar_order_test(&msg); | ||||
random_scalar_order_test(&key); | random_scalar_order_test(&key); | ||||
secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pubj, &key); | secp256k1_ecmult_gen(&ctx->ecmult_gen_ctx, &pubj, &key); | ||||
secp256k1_ge_set_gej(&pub, &pubj); | secp256k1_ge_set_gej(&pub, &pubj); | ||||
getrec = secp256k1_testrand_bits(1); | getrec = secp256k1_testrand_bits(1); | ||||
random_sign(&sigr, &sigs, &key, &msg, getrec?&recid:NULL); | random_sign(&sigr, &sigs, &key, &msg, getrec?&recid:NULL); | ||||
if (getrec) { | if (getrec) { | ||||
CHECK(recid >= 0 && recid < 4); | CHECK(recid >= 0 && recid < 4); | ||||
▲ Show 20 Lines • Show All 1,369 Lines • Show Last 20 Lines |