What changed, and why it matters
This commit fixes two broken type aliases (shortcut names) for HKDF, a cryptographic key-derivation helper, in the rust-bitcoin hashes library. The aliases were pointing at the wrong underlying type after a previous refactor, so any code trying to use them would fail to compile. There is no runtime security vulnerability; it is a compile-time API repair.
No immediate security action required. Users relying on `HkdfSha256` or `HkdfSha512` should update to a release containing this fix. Developers should add a compile-test or CI check that exercises these aliases to prevent future regressions.
Security signals we found
Cryptographic API type alias mismatch causing compile-time breakage
No runtime memory-safety or cryptographic flaw in the diff itself
Fixes usability of HKDF-SHA-256 and HKDF-SHA-512 public aliases
Evidence from the diff
In PR #4085, Hkdf was reparameterized from GeneralHash to HashEngine, but the public type aliases HkdfSha256 and HkdfSha512 in hashes/src/lib.rs were not updated. They remained Hkdf<sha256::Hash> and Hkdf<sha512::Hash>, which no longer satisfy the new Hkdf bound and therefore produce compiler errors for consumers. The patch changes both aliases to use sha256::HashEngine and sha512::HashEngine respectively, restoring the intended API.
Changed components
hashes/src/lib.rsPublic type aliases HkdfSha256 and HkdfSha512Inspect captured patch +4 / −4
diff --git a/hashes/src/lib.rs b/hashes/src/lib.rs
index 5bc7dc08..6b2fad86 100644
--- a/hashes/src/lib.rs
+++ b/hashes/src/lib.rs
@@ -158,11 +158,11 @@ pub type HmacSha256 = Hmac<sha256::Hash>;
/// HMAC-SHA-512: Type alias for the [`Hmac<Sha512>`] type.
pub type HmacSha512 = Hmac<sha512::Hash>;
-/// HKDF-HMAC-SHA-256: Type alias for the [`Hkdf<Sha256>`] type.
-pub type HkdfSha256 = Hkdf<sha256::Hash>;
+/// HKDF-HMAC-SHA-256: Type alias for the [`Hkdf<sha256::HashEngine>`] type.
+pub type HkdfSha256 = Hkdf<sha256::HashEngine>;
-/// HKDF-HMAC-SHA-512: Type alias for the [`Hkdf<Sha512>`] type.
-pub type HkdfSha512 = Hkdf<sha512::Hash>;
+/// HKDF-HMAC-SHA-512: Type alias for the [`Hkdf<sha512::HashEngine>`] type.
+pub type HkdfSha512 = Hkdf<sha512::HashEngine>;
/// A hashing engine which bytes can be serialized into.
pub trait HashEngine: Clone {
Why this scored 19/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.