33 static const unsigned char init[4][32] = {
37 0x02, 0x03, 0x05, 0x07, 0x0b, 0x0d, 0x11, 0x13,
38 0x17, 0x1d, 0x1f, 0x25, 0x29, 0x2b, 0x2f, 0x35,
39 0x3b, 0x3d, 0x43, 0x47, 0x49, 0x4f, 0x53, 0x59,
40 0x61, 0x65, 0x67, 0x6b, 0x6d, 0x71, 0x7f, 0x83
45 0x82, 0x83, 0x85, 0x87, 0x8b, 0x8d, 0x81, 0x83,
46 0x97, 0xad, 0xaf, 0xb5, 0xb9, 0xbb, 0xbf, 0xc5,
47 0xdb, 0xdd, 0xe3, 0xe7, 0xe9, 0xef, 0xf3, 0xf9,
48 0x11, 0x15, 0x17, 0x1b, 0x1d, 0xb1, 0xbf, 0xd3
52 0x3d, 0x2d, 0xef, 0xf4, 0x25, 0x98, 0x4f, 0x5d,
53 0xe2, 0xca, 0x5f, 0x41, 0x3f, 0x3f, 0xce, 0x44,
54 0xaa, 0x2c, 0x53, 0x8a, 0xc6, 0x59, 0x1f, 0x38,
55 0x38, 0x23, 0xe4, 0x11, 0x27, 0xc6, 0xa0, 0xe7
59 0xbd, 0x21, 0xa5, 0xe1, 0x13, 0x50, 0x73, 0x2e,
60 0x52, 0x98, 0xc8, 0x9e, 0xab, 0x00, 0xa2, 0x68,
61 0x43, 0xf5, 0xd7, 0x49, 0x80, 0x72, 0xa7, 0xf3,
62 0xd7, 0x60, 0xe6, 0xab, 0x90, 0x92, 0xdf, 0xc5
66 secp256k1_scalar_set_b32(&data->scalar[0],
init[0], NULL);
67 secp256k1_scalar_set_b32(&data->scalar[1],
init[1], NULL);
68 secp256k1_fe_set_b32(&data->fe[0],
init[0]);
69 secp256k1_fe_set_b32(&data->fe[1],
init[1]);
70 secp256k1_fe_set_b32(&data->fe[2],
init[2]);
71 secp256k1_fe_set_b32(&data->fe[3],
init[3]);
72 CHECK(secp256k1_ge_set_xo_var(&data->ge[0], &data->fe[0], 0));
73 CHECK(secp256k1_ge_set_xo_var(&data->ge[1], &data->fe[1], 1));
74 secp256k1_gej_set_ge(&data->gej[0], &data->ge[0]);
75 secp256k1_gej_rescale(&data->gej[0], &data->fe[2]);
76 secp256k1_gej_set_ge(&data->gej[1], &data->ge[1]);
77 secp256k1_gej_rescale(&data->gej[1], &data->fe[3]);
368 if (
d ||
have_flag(argc,
argv,
"scalar") ||
have_flag(argc,
argv,
"add"))
run_benchmark(
"scalar_add",
bench_scalar_add,
bench_setup, NULL, &data, 10, iters*100);
369 if (
d ||
have_flag(argc,
argv,
"scalar") ||
have_flag(argc,
argv,
"negate"))
run_benchmark(
"scalar_negate",
bench_scalar_negate,
bench_setup, NULL, &data, 10, iters*100);
370 if (
d ||
have_flag(argc,
argv,
"scalar") ||
have_flag(argc,
argv,
"mul"))
run_benchmark(
"scalar_mul",
bench_scalar_mul,
bench_setup, NULL, &data, 10, iters*10);
371 if (
d ||
have_flag(argc,
argv,
"scalar") ||
have_flag(argc,
argv,
"split"))
run_benchmark(
"scalar_split",
bench_scalar_split,
bench_setup, NULL, &data, 10, iters);
372 if (
d ||
have_flag(argc,
argv,
"scalar") ||
have_flag(argc,
argv,
"inverse"))
run_benchmark(
"scalar_inverse",
bench_scalar_inverse,
bench_setup, NULL, &data, 10, iters);
373 if (
d ||
have_flag(argc,
argv,
"scalar") ||
have_flag(argc,
argv,
"inverse"))
run_benchmark(
"scalar_inverse_var",
bench_scalar_inverse_var,
bench_setup, NULL, &data, 10, iters);
375 if (
d ||
have_flag(argc,
argv,
"field") ||
have_flag(argc,
argv,
"half"))
run_benchmark(
"field_half",
bench_field_half,
bench_setup, NULL, &data, 10, iters*100);
376 if (
d ||
have_flag(argc,
argv,
"field") ||
have_flag(argc,
argv,
"normalize"))
run_benchmark(
"field_normalize",
bench_field_normalize,
bench_setup, NULL, &data, 10, iters*100);
377 if (
d ||
have_flag(argc,
argv,
"field") ||
have_flag(argc,
argv,
"normalize"))
run_benchmark(
"field_normalize_weak",
bench_field_normalize_weak,
bench_setup, NULL, &data, 10, iters*100);
378 if (
d ||
have_flag(argc,
argv,
"field") ||
have_flag(argc,
argv,
"sqr"))
run_benchmark(
"field_sqr",
bench_field_sqr,
bench_setup, NULL, &data, 10, iters*10);
379 if (
d ||
have_flag(argc,
argv,
"field") ||
have_flag(argc,
argv,
"mul"))
run_benchmark(
"field_mul",
bench_field_mul,
bench_setup, NULL, &data, 10, iters*10);
380 if (
d ||
have_flag(argc,
argv,
"field") ||
have_flag(argc,
argv,
"inverse"))
run_benchmark(
"field_inverse",
bench_field_inverse,
bench_setup, NULL, &data, 10, iters);
381 if (
d ||
have_flag(argc,
argv,
"field") ||
have_flag(argc,
argv,
"inverse"))
run_benchmark(
"field_inverse_var",
bench_field_inverse_var,
bench_setup, NULL, &data, 10, iters);
382 if (
d ||
have_flag(argc,
argv,
"field") ||
have_flag(argc,
argv,
"sqrt"))
run_benchmark(
"field_sqrt",
bench_field_sqrt,
bench_setup, NULL, &data, 10, iters);
384 if (
d ||
have_flag(argc,
argv,
"group") ||
have_flag(argc,
argv,
"double"))
run_benchmark(
"group_double_var",
bench_group_double_var,
bench_setup, NULL, &data, 10, iters*10);
385 if (
d ||
have_flag(argc,
argv,
"group") ||
have_flag(argc,
argv,
"add"))
run_benchmark(
"group_add_var",
bench_group_add_var,
bench_setup, NULL, &data, 10, iters*10);
386 if (
d ||
have_flag(argc,
argv,
"group") ||
have_flag(argc,
argv,
"add"))
run_benchmark(
"group_add_affine",
bench_group_add_affine,
bench_setup, NULL, &data, 10, iters*10);
387 if (
d ||
have_flag(argc,
argv,
"group") ||
have_flag(argc,
argv,
"add"))
run_benchmark(
"group_add_affine_var",
bench_group_add_affine_var,
bench_setup, NULL, &data, 10, iters*10);
388 if (
d ||
have_flag(argc,
argv,
"group") ||
have_flag(argc,
argv,
"add"))
run_benchmark(
"group_add_zinv_var",
bench_group_add_zinv_var,
bench_setup, NULL, &data, 10, iters*10);
389 if (
d ||
have_flag(argc,
argv,
"group") ||
have_flag(argc,
argv,
"to_affine"))
run_benchmark(
"group_to_affine_var",
bench_group_to_affine_var,
bench_setup, NULL, &data, 10, iters);
391 if (
d ||
have_flag(argc,
argv,
"ecmult") ||
have_flag(argc,
argv,
"wnaf"))
run_benchmark(
"wnaf_const",
bench_wnaf_const,
bench_setup, NULL, &data, 10, iters);
392 if (
d ||
have_flag(argc,
argv,
"ecmult") ||
have_flag(argc,
argv,
"wnaf"))
run_benchmark(
"ecmult_wnaf",
bench_ecmult_wnaf,
bench_setup, NULL, &data, 10, iters);
394 if (
d ||
have_flag(argc,
argv,
"hash") ||
have_flag(argc,
argv,
"sha256"))
run_benchmark(
"hash_sha256",
bench_sha256,
bench_setup, NULL, &data, 10, iters);
395 if (
d ||
have_flag(argc,
argv,
"hash") ||
have_flag(argc,
argv,
"hmac"))
run_benchmark(
"hash_hmac_sha256",
bench_hmac_sha256,
bench_setup, NULL, &data, 10, iters);
396 if (
d ||
have_flag(argc,
argv,
"hash") ||
have_flag(argc,
argv,
"rng6979"))
run_benchmark(
"hash_rfc6979_hmac_sha256",
bench_rfc6979_hmac_sha256,
bench_setup, NULL, &data, 10, iters);
398 if (
d ||
have_flag(argc,
argv,
"context") ||
have_flag(argc,
argv,
"verify"))
run_benchmark(
"context_verify",
bench_context_verify,
bench_setup, NULL, &data, 10, 1 + iters/1000);
399 if (
d ||
have_flag(argc,
argv,
"context") ||
have_flag(argc,
argv,
"sign"))
run_benchmark(
"context_sign",
bench_context_sign,
bench_setup, NULL, &data, 10, 1 + iters/100);