doc/bench: added help text for SECP256K1_BENCH_ITERS env var for bench_ecmult
What changed, and why it matters
This commit only updates the help text and a printed message in a benchmark program. It does not change any cryptographic code, library behavior, or security-sensitive logic. There is no security issue here.
No action needed; this is a documentation/usability improvement in a benchmark tool.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is confined to src/bench_ecmult.c, a benchmarking utility. It adds documentation for the SECP256K1_BENCH_ITERS environment variable, passes the default iteration count into the help() function, and prints a message when benchmarks are skipped. No cryptographic or production code is modified.
Changed components
src/bench_ecmult.cInspect captured patch +10 / −4
diff --git a/src/bench_ecmult.c b/src/bench_ecmult.c
index c9a1d90..e8fab14 100644
--- a/src/bench_ecmult.c
+++ b/src/bench_ecmult.c
@@ -19,9 +19,12 @@
#define POINTS 32768
-static void help(char **argv) {
+static void help(char **argv, int default_iters) {
printf("Benchmark EC multiplication algorithms\n");
printf("\n");
+ printf("The default number of iterations for each benchmark is %d. This can be\n", default_iters);
+ printf("customized using the SECP256K1_BENCH_ITERS environment variable.\n");
+ printf("\n");
printf("Usage: %s <help|pippenger_wnaf|strauss_wnaf|simple>\n", argv[0]);
printf("The output shows the number of multiplied and summed points right after the\n");
printf("function name. The letter 'g' indicates that one of the points is the generator.\n");
@@ -308,7 +311,8 @@ int main(int argc, char **argv) {
int i, p;
size_t scratch_size;
- int iters = get_iters(10000);
+ int default_iters = 10000;
+ int iters = get_iters(default_iters);
data.ecmult_multi = secp256k1_ecmult_multi_var;
@@ -316,7 +320,7 @@ int main(int argc, char **argv) {
if(have_flag(argc, argv, "-h")
|| have_flag(argc, argv, "--help")
|| have_flag(argc, argv, "help")) {
- help(argv);
+ help(argv, default_iters);
return EXIT_SUCCESS;
} else if(have_flag(argc, argv, "pippenger_wnaf")) {
printf("Using pippenger_wnaf:\n");
@@ -328,7 +332,7 @@ int main(int argc, char **argv) {
printf("Using simple algorithm:\n");
} else {
fprintf(stderr, "%s: unrecognized argument '%s'.\n\n", argv[0], argv[1]);
- help(argv);
+ help(argv, default_iters);
return EXIT_FAILURE;
}
}
@@ -381,6 +385,8 @@ int main(int argc, char **argv) {
run_ecmult_multi_bench(&data, i << p, 1, iters);
}
}
+ } else {
+ printf("Skipping some benchmarks due to SECP256K1_BENCH_ITERS <= 2\n");
}
if (data.scratch != NULL) {
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.