Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/tests.c
Show First 20 Lines • Show All 2,963 Lines • ▼ Show 20 Lines | /* Run through s0*(t0*P) + s1*(t1*P) exhaustively for many small values of s0, s1, t0, t1 */ | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
void test_ecmult_multi_batch_single(secp256k1_ecmult_multi_func ecmult_multi) { | void test_ecmult_multi_batch_single(secp256k1_ecmult_multi_func ecmult_multi) { | ||||
secp256k1_scalar szero; | secp256k1_scalar szero; | ||||
secp256k1_scalar sc[32]; | secp256k1_scalar sc; | ||||
secp256k1_ge pt[32]; | secp256k1_ge pt; | ||||
secp256k1_gej r; | secp256k1_gej r; | ||||
ecmult_multi_data data; | ecmult_multi_data data; | ||||
secp256k1_scratch *scratch_empty; | secp256k1_scratch *scratch_empty; | ||||
data.sc = sc; | random_group_element_test(&pt); | ||||
data.pt = pt; | random_scalar_order(&sc); | ||||
data.sc = ≻ | |||||
data.pt = &pt; | |||||
secp256k1_scalar_set_int(&szero, 0); | secp256k1_scalar_set_int(&szero, 0); | ||||
/* Try to multiply 1 point, but scratch space is empty.*/ | /* Try to multiply 1 point, but scratch space is empty.*/ | ||||
scratch_empty = secp256k1_scratch_create(&ctx->error_callback, 0); | scratch_empty = secp256k1_scratch_create(&ctx->error_callback, 0); | ||||
CHECK(!ecmult_multi(&ctx->error_callback, &ctx->ecmult_ctx, scratch_empty, &r, &szero, ecmult_multi_callback, &data, 1)); | CHECK(!ecmult_multi(&ctx->error_callback, &ctx->ecmult_ctx, scratch_empty, &r, &szero, ecmult_multi_callback, &data, 1)); | ||||
secp256k1_scratch_destroy(&ctx->error_callback, scratch_empty); | secp256k1_scratch_destroy(&ctx->error_callback, scratch_empty); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,652 Lines • Show Last 20 Lines |