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

Add VERIFY_CHECKs that flags are 0 or 1

Public commit record

What the developer wrote

Authored by John Moffett

78/100 · Adequate
Add VERIFY_CHECKs that flags are 0 or 1

Flags for constant-time masking rely
on the values being exactly 0 or 1 rather
than 0 or true. Add VERIFY_CHECKs to enforce
in VERIFY builds as a preventative
measure and add documentation where relevant.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
The short version

What changed, and why it matters

This commit adds safety checks and documentation to ensure that 'flag' values used in secret-handling code are exactly 0 or 1, not just any 'true' value. These flags control constant-time selection and memory wiping. If a caller passed a different non-zero value, the masking math could behave incorrectly and potentially leak secret information through timing or produce wrong results. The new checks only fire in special VERIFY builds, so they are a defensive hardening measure rather than a fix for an active bug.

Recommended action

Treat as a defensive hardening commit. Review all callers of the modified cmov/cadd_bit/cond_negate/memczero functions to confirm they already pass only 0 or 1. Consider whether any production path could pass a truthy non-1 flag; if so, a runtime fix is needed beyond these VERIFY checks. Otherwise, include in normal release testing and note as hardening in release notes.

Security signals we found

01

constant-time masking invariant enforcement

02

VERIFY_CHECK hardening for secret-dependent flag values

03

documentation update clarifying 0/1 flag contract

04

potential timing-side-channel risk if non-{0,1} flag reaches production

Risk score

Why this scored 36/100

Our methodology →
Potential impact 8/30
Exploitability 4/25
Stealth signal 6/15
Affected reach 7/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.