From 85652359e89b4ead08fd8cb1a5e398cc2347e90d Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 12 Feb 2025 03:30:31 +1100 Subject: [PATCH] hashes: Derive Copy and Clone for Hkdf Currently the `Hkdf` type does not derive any traits. We would like to derive the common set of traits but there are a bunch reasons we can't; - Don't want to leak secrets in `Debug`. - Don't want to enable timing attacks with Eq/Ord and friends. For now just derive `Copy` and `Clone`. We will then implement `Debug` manually. --- hashes/src/hkdf/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/hashes/src/hkdf/mod.rs b/hashes/src/hkdf/mod.rs index f9f027857..b2cba0838 100644 --- a/hashes/src/hkdf/mod.rs +++ b/hashes/src/hkdf/mod.rs @@ -32,6 +32,7 @@ impl fmt::Display for MaxLengthError { impl std::error::Error for MaxLengthError {} /// HMAC-based Extract-and-Expand Key Derivation Function (HKDF). +#[derive(Copy, Clone)] pub struct Hkdf { /// Pseudorandom key based on the extract step. prk: Hmac,