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.
This commit is contained in:
Tobin C. Harding 2025-02-12 03:30:31 +11:00
parent 20e970d7f6
commit 85652359e8
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 1 additions and 0 deletions

View File

@ -32,6 +32,7 @@ impl fmt::Display for MaxLengthError {
impl std::error::Error for MaxLengthError {} impl std::error::Error for MaxLengthError {}
/// HMAC-based Extract-and-Expand Key Derivation Function (HKDF). /// HMAC-based Extract-and-Expand Key Derivation Function (HKDF).
#[derive(Copy, Clone)]
pub struct Hkdf<T: GeneralHash> { pub struct Hkdf<T: GeneralHash> {
/// Pseudorandom key based on the extract step. /// Pseudorandom key based on the extract step.
prk: Hmac<T>, prk: Hmac<T>,