What changed, and why it matters
This change is inside the library's test code, not the actual cryptographic code used by applications. It makes two test setup steps verify they succeeded before using their results. Previously the test could have continued with invalid data if a load failed, which would make the test less reliable but does not create a vulnerability in the library itself.
No production action required. Ensure the project's continuous integration runs the updated extrakeys tests. Consider auditing other tests for unchecked secp256k1_pubkey_load return values as a code-quality exercise.
Security signals we found
Return value of cryptographic load function previously unchecked in test code
Test now asserts success before using loaded public-key field elements
Evidence from the diff
In src/modules/extrakeys/tests_impl.h, the x-only pubkey parity test now wraps two secp256k1_pubkey_load calls with CHECK(… == 1). Previously the return values were discarded, so the test proceeded to compare field elements even if a load failed. This is a test-hardening fix: it prevents a test from passing or behaving misleadingly on a failed deserialization, but it does not change production behavior or fix a runtime security bug in the library.
Changed components
src/modules/extrakeys/tests_impl.hx-only pubkey parity unit testInspect captured patch +2 / −2
diff --git a/src/modules/extrakeys/tests_impl.h b/src/modules/extrakeys/tests_impl.h
index abebd11..a9c10ea 100644
--- a/src/modules/extrakeys/tests_impl.h
+++ b/src/modules/extrakeys/tests_impl.h
@@ -53,8 +53,8 @@ static void test_xonly_pubkey(void) {
CHECK(secp256k1_xonly_pubkey_from_pubkey(CTX, &xonly_pk, &pk_parity, &pk) == 1);
CHECK(secp256k1_memcmp_var(&xonly_pk, &pk, sizeof(xonly_pk)) != 0);
CHECK(pk_parity == 1);
- secp256k1_pubkey_load(CTX, &pk1, &pk);
- secp256k1_pubkey_load(CTX, &pk2, (secp256k1_pubkey *) &xonly_pk);
+ CHECK(secp256k1_pubkey_load(CTX, &pk1, &pk) == 1);
+ CHECK(secp256k1_pubkey_load(CTX, &pk2, (secp256k1_pubkey *) &xonly_pk) == 1);
CHECK(secp256k1_fe_equal(&pk1.x, &pk2.x) == 1);
secp256k1_fe_negate(&y, &pk2.y, 1);
CHECK(secp256k1_fe_equal(&pk1.y, &y) == 1);
Why this scored 17/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.