AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 20 Bitcoin

Merge bitcoin-core/secp256k1#1897: tests: check results before using outputs

Public commit record

What the developer wrote

Authored by merge-script

96/100 · Strong
Merge bitcoin-core/secp256k1#1897: tests: check results before using outputs

a2ad68cd81787ba70b2caff0a57998ae8a5b4834 ec: check pubkey sort test results (Lőrinc)
93280c22917c018f4e99d76e4398e66405c887bd silentpayments: check test serialization (Lőrinc)
b8de1bc30f917c0ab9f05aeaeb494834e81513e2 musig: check infinity test setup (Lőrinc)
0618af81317307466e9968592880a54229885edc extrakeys: check test pubkey loads (Lőrinc)
1d3f72d3fa8e476cdc3344dbb5aebeaf7a6efe89 recovery: check exhaustive API results (Lőrinc)
564afb0b06e6124092fd6fa1239b1b397f742e41 ellswift: check test operation results (Lőrinc)
658c7edc24832592969ccbd1bdbc5c59e1ccc5d5 tests: check exhaustive ecmult success (Lőrinc)

Pull request description:

**Problem:** Several tests inspect outputs from deterministic operations without checking the result.
The later output comparisons usually still exercise behavior, but a failed setup call can leave an output that accidentally satisfies a later assertion.
In `pubnonce_summing_to_inf`, `secp256k1_musig_sum_pubnonces` initializes both sums to infinity before a pubnonce load can fail, so the test could pass without constructing a valid opposing-nonce pair.

**Fix:** Check the result of each deterministic operation before reading its output in the affected exhaustive, EllSwift, recovery, extrakeys, MuSig, silent-payments, and public-key sort tests.
Leave deliberately ignored results alone when the test permits either result or validates a mutated value rather than an auxiliary carry, overflow, or sign flag.

ACKs for top commit:
151henry151:
Tested ACK a2ad68cd81787ba70b2caff0a57998ae8a5b4834
real-or-random:
utACK a2ad68cd81787ba70b2caff0a57998ae8a5b4834
theStack:
ACK a2ad68cd81787ba70b2caff0a57998ae8a5b4834

Tree-SHA512: 9955e9170c53d87cd851351234133660d5d4a26190bd9054b5bef75ed11c785a0168f92ca9ec634d9599da019dad473dc30e4f635eeef699abc39407a5e28c5c
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes test-suite bugs, not the cryptographic library itself. Several test cases were using outputs from functions without first checking whether those functions succeeded. In rare cases a failed setup step could leave a value that accidentally passed a later check, making the test look successful when it shouldn't. The patch adds result checks so tests fail loudly if a setup step fails. There is no direct security risk to users of the library.

Recommended action

No urgent action for downstream users. Developers should ensure CI runs the updated tests. The change is safe to include in normal updates.

Security signals we found

01

Test-only hardening

02

Missing return-value checks in test code

03

Potential false-positive test passes on setup failure

04

No production code changes

Risk score

Why this scored 20/100

Our methodology →
Potential impact 2/30
Exploitability 0/25
Stealth signal 2/15
Affected reach 2/15
Confidence 9/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.