What changed, and why it matters
This commit swaps one internal cryptographic library for another when computing a special fingerprint used in a backup/recovery feature (BIP-85). The change is described by the developer as a cleanup to use a single, consistent library. There is no direct evidence in the commit that it fixes a security bug or that any vulnerability exists.
Treat as a routine refactoring/cleanup. Review for functional equivalence and regression-test BIP-85 mnemonic derivation. No urgent security response is indicated by the commit itself.
Security signals we found
Cryptographic implementation change (HMAC library swap)
No change to HMAC key, message, or output length
No mention of vulnerability, CVE, bug bounty, or security fix in commit message
No explicit vendor security disclosure supplied
Evidence from the diff
The patch replaces RustCrypto’s hmac::{SimpleHmac, FixedOutput} with bitcoin::hashes::{HmacEngine, Hmac, sha512::Hash} in keystore.rs for the BIP-85 entropy derivation (bip85_entropy). The HMAC key and message are unchanged: key is the literal bip-entropy-from-k and the message is the secp256k1 private key. Output length remains 64 bytes (SHA-512). The change reduces dependency duplication but does not alter the cryptographic algorithm or its parameters.
Changed components
src/rust/bitbox02-rust/src/keystore.rsBIP-85 entropy derivation functionInspect captured patch +7 / −8
diff --git a/src/rust/bitbox02-rust/src/keystore.rs b/src/rust/bitbox02-rust/src/keystore.rs
index 8792967..016cde7 100644
--- a/src/rust/bitbox02-rust/src/keystore.rs
+++ b/src/rust/bitbox02-rust/src/keystore.rs
@@ -23,10 +23,9 @@ use bitbox02::keystore;
use util::bip32::HARDENED;
-use crate::hash::Sha512;
use crate::secp256k1::SECP256K1;
-use hmac::{Mac, SimpleHmac, digest::FixedOutput};
+use bitcoin::hashes::{Hash, HashEngine, Hmac, HmacEngine, sha512};
/// Returns the keystore's seed encoded as a BIP-39 mnemonic.
pub fn get_bip39_mnemonic() -> Result<zeroize::Zeroizing<String>, ()> {
@@ -98,12 +97,12 @@ pub fn root_fingerprint() -> Result<Vec<u8>, ()> {
fn bip85_entropy(keypath: &[u32]) -> Result<zeroize::Zeroizing<Vec<u8>>, ()> {
let priv_key = secp256k1_get_private_key_twice(keypath)?;
- let mut mac = SimpleHmac::<Sha512>::new_from_slice(b"bip-entropy-from-k").unwrap();
- mac.update(&priv_key);
- let mut out = zeroize::Zeroizing::new(vec![0u8; 64]);
- let fixed_out: &mut [u8; 64] = out.as_mut_slice().try_into().unwrap();
- mac.finalize_into(fixed_out.into());
- Ok(out)
+
+ let mut engine = HmacEngine::<sha512::Hash>::new(b"bip-entropy-from-k");
+ engine.input(&priv_key);
+ Ok(zeroize::Zeroizing::new(
+ Hmac::from_engine(engine).to_byte_array().to_vec(),
+ ))
}
/// Computes a BIP39 mnemonic according to BIP-85:
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.