Skip to content

fix(zcash): correct seed_fingerprint formula in proto comments#28

Merged
BitHighlander merged 1 commit into
masterfrom
fix/zcash-seed-fingerprint-formula-doc
Apr 29, 2026
Merged

fix(zcash): correct seed_fingerprint formula in proto comments#28
BitHighlander merged 1 commit into
masterfrom
fix/zcash-seed-fingerprint-formula-doc

Conversation

@BitHighlander
Copy link
Copy Markdown
Owner

Summary

Comment-only fix — wire format unchanged.

The `seed_fingerprint` and `expected_seed_fingerprint` field comments documented the formula as

BLAKE2b-256(\"Zcash_HD_Seed_FP\", seed)

but the correct ZIP-32 §6.1 formula prepends a 1-byte length:

BLAKE2b-256(\"Zcash_HD_Seed_FP\", I2LEBSP_8(len(seed)) || seed)

This matches the upstream `zip32` Rust crate, keystone3-firmware, and our own firmware C / python-keepkey implementations. A host implementer following the previous proto comments would compute the wrong fingerprint and have the device reject every signing/display request with "seed fingerprint mismatch."

Why this slipped through PR #27

I copied the formula from a draft and didn't catch the missing length prefix until validating the Python helper against keystone3-firmware's reference vector during the python-keepkey work — both impls produced the wrong output, then I fixed both. The proto comments stayed stale.

Reference vector (keystone3-firmware cross-check):

seed = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
fp   = deff604c246710f7176dead02aa746f2fd8d5389f7072556dcb555fdbe5e3ae3

Test plan

  • No wire change — existing serialized messages continue to work
  • Comment matches what `zip32::fingerprint::SeedFingerprint::from_seed` actually computes

Field comments documented the formula as

  BLAKE2b-256("Zcash_HD_Seed_FP", seed)

but ZIP-32 §6.1 (and the actual conforming implementations in the
upstream zip32 Rust crate, keystone3-firmware, and our own firmware)
prepend a 1-byte length:

  BLAKE2b-256("Zcash_HD_Seed_FP", I2LEBSP_8(len(seed)) || seed)

A host implementer following the proto comments would compute the
wrong fingerprint and have the device reject every signing/display
request with "seed fingerprint mismatch."

Comment-only change. No wire-format impact.
@BitHighlander BitHighlander merged commit 2352346 into master Apr 29, 2026
@BitHighlander BitHighlander deleted the fix/zcash-seed-fingerprint-formula-doc branch April 29, 2026 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant