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

field: correct fe_equal's b magnitude bound

Public commit record

What the developer wrote

Authored by Lőrinc

83/100 · Strong
field: correct fe_equal's b magnitude bound

`secp256k1_fe_equal` negates `a` before adding `b`.
That gives the temporary value magnitude 2, and the following field addition requires the input magnitudes to sum to at most 32.
So the largest `b` magnitude the implementation can accept is 30, not 31.

Lower the documented and checked bound for `b` to 30.
Adjust the focused test to use random field elements with randomized magnitudes within the accepted `a <= 1` and `b <= 30` bounds.

Co-authored-by: Sebastian Falbesoner <sebastian.falbesoner@gmail.com>
Co-authored-by: Tim Ruffing <me@real-or-random.org>
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This commit fixes an off-by-one error in the documented and runtime-checked input limit for a low-level math helper called secp256k1_fe_equal. The function compares two finite-field values for equality. It first negates one input (which temporarily raises its internal 'magnitude' by 1) and then adds the other input. Because the addition can only safely accept inputs whose magnitudes sum to 32, the second input's magnitude must be at most 30, not 31. The previous bound of 31 was therefore one too high and could have allowed an internal overflow in the magnitude bookkeeping. The patch lowers the documented bound and the VERIFY_MAGNITUDE check from 31 to 30, and adds a focused test exercising the corrected boundary. This is a correctness/reliability fix in cryptographic arithmetic, not a directly exploitable remote vulnerability.

Recommended action

Treat as a low-severity correctness fix. Review callers of secp256k1_fe_equal to confirm none relied on passing b with magnitude 31; if any did, they need separate adjustment. Ensure the new test passes under all build configurations, especially those with VERIFY enabled. No urgent deployment is required beyond normal update cadence.

Security signals we found

01

Off-by-one in cryptographic field-element magnitude bound

02

Internal invariant violation in secp256k1_fe_equal

03

Addition-after-negation magnitude accounting error

04

Defensive fix with new boundary test

Risk score

Why this scored 27/100

Our methodology →
Potential impact 5/30
Exploitability 3/25
Stealth signal 4/15
Affected reach 4/15
Confidence 7/10
Evidence quality 4/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.