tests: check exhaustive ecmult success
What changed, and why it matters
This is a one-line change to a test file in the secp256k1 cryptographic library. It makes an existing exhaustive test stricter by requiring a function to report success before checking its output. It does not change any production code and is not a security fix for a vulnerability.
No action required; treat as normal test improvement. If backporting, include only for test completeness, not as a production security patch.
Security signals we found
Test-only change (src/tests_exhaustive.c)
Hardens assertion to require success return code before consuming cryptographic output
Prevents accidental false pass if ecmult_multi_var fails and returns point at infinity
Evidence from the diff
In src/tests_exhaustive.c, the test_exhaustive_ecmult_multi function now wraps the call to secp256k1_ecmult_multi_var with CHECK(… == 1), ensuring the function returns success before the test compares the Jacobian result against the expected group element. Previously the return value was ignored, so a failed computation could coincidentally match an infinity/identity case and hide a bug. This is purely a test-hardening change.
Changed components
src/tests_exhaustive.ctest_exhaustive_ecmult_multiInspect captured patch +1 / −1
diff --git a/src/tests_exhaustive.c b/src/tests_exhaustive.c
index 99d7b24..d7300f7 100644
--- a/src/tests_exhaustive.c
+++ b/src/tests_exhaustive.c
@@ -220,7 +220,7 @@ static void test_exhaustive_ecmult_multi(const secp256k1_context *ctx, const sec
data.pt[0] = group[x];
data.pt[1] = group[y];
- secp256k1_ecmult_multi_var(&ctx->error_callback, scratch, &tmp, &g_sc, ecmult_multi_callback, &data, 2);
+ CHECK(secp256k1_ecmult_multi_var(&ctx->error_callback, scratch, &tmp, &g_sc, ecmult_multi_callback, &data, 2) == 1);
CHECK(secp256k1_gej_eq_ge_var(&tmp, &group[(i * x + j * y + k) % EXHAUSTIVE_TEST_ORDER]));
}
}
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.