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

bip32: validate master key seed length

Public commit record

What the developer wrote

Authored by satsfy (Renato Britto)

68/100 · Adequate
bip32: validate master key seed length

BIP-32 requires the master seed to be between 16 and 64 bytes, but
new_master accepted any length. bitcoinfuzz flagged this as a
inconsistency on seeds out of range.

Introduce a Bip32Seed type that validates on construction.
new_master now takes a ref to Bip32Seed (a transparent newtype of
&[u8]). Fixed-size arrays go through infallible From<[u8; N]>. Slices
go through TryFrom<&[u8]> returning InvalidSeedLengthError.
`Debug` shows first 4 bytes of seed's sha256. `PartialEq` fixed
time equality comparison based on hashes.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit tightens input checking for Bitcoin wallet master-key creation. Previously, the library would accept any seed length when creating a BIP-32 master key, even though the standard only allows seeds between 16 and 64 bytes. Now it validates the length and rejects out-of-range seeds. It also changes how seed bytes are printed in debug logs so the full secret is no longer exposed, and compares seeds in constant time to reduce timing side-channel risk.

Recommended action

Review downstream callers of `Xpriv::new_master` for compile errors due to the changed signature, and ensure any dynamic seed input handles the new `InvalidSeedLengthError`. Consider whether the `PartialEq` implementation should also require equal lengths before fixed-time comparison, as currently it returns false for mismatched lengths.

Security signals we found

01

Input validation added for BIP-32 master seed length (16-64 bytes)

02

Debug output redacted to avoid leaking full seed material

03

Constant-time equality comparison added for seed values

04

Fuzzing-detected inconsistency (bitcoinfuzz) noted in commit message

Risk score

Why this scored 35/100

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