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

Promote BLOCK_SIZE assertion to hard assert

Public commit record

What the developer wrote

Authored by Jamil Lambert, PhD

68/100 · Adequate
Promote BLOCK_SIZE assertion to hard assert

The debug_assert only fires in debug builds; a downstream HashEngine
implementation with BLOCK_SIZE > 128 would silently produce wrong
outputs in release builds by indexing into fixed-size 128-byte ipad/opad
buffers beyond their length.

Change to assert! so the check is unconditional.

Assisted-by: claude-sonnet-4.6
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a safety check in the HMAC code. Previously, the code only verified in debug builds that a hash engine's block size did not exceed 128 bytes. In release builds, an oversized block size would cause the code to write past the end of fixed 128-byte internal buffers, leading to incorrect HMAC results or memory corruption. The fix makes this check run unconditionally by changing a debug-only assertion into a regular assertion.

Recommended action

Upgrade to a version containing this commit. If you maintain a custom HashEngine, ensure BLOCK_SIZE remains <= 128. No immediate active exploitation is indicated, but treat this as a hardening fix for a latent safety bug.

Security signals we found

01

Buffer overflow / out-of-bounds write potential from unchecked block size

02

Debug-only invariant relied upon for memory safety

03

Incorrect cryptographic output possible in release builds

04

Defense-in-depth hardening of HMAC implementation

Risk score

Why this scored 60/100

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