From dcaedc278c7f9db0c21958451944e3e20eb74bdc Mon Sep 17 00:00:00 2001 From: dAxpeDDa Date: Fri, 30 Jul 2021 02:13:27 +0200 Subject: [PATCH] Fix `randomized_pwd` --- src/opaque.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/opaque.rs b/src/opaque.rs index 4985acb..3704fae 100644 --- a/src/opaque.rs +++ b/src/opaque.rs @@ -280,7 +280,7 @@ pub struct ClientRegistrationFinishResult { pub state: ClientRegistration, /// Password derived key, only used in tests #[cfg(test)] - pub randomized_pwd: Vec, + pub randomized_pwd: GenericArray::OutputSize>, } // Cannot be derived because it would require for CS to be Clone. @@ -320,7 +320,8 @@ impl ClientRegistration { let password_derived_key = get_password_derived_key::(&self.token, r2.beta)?; - let h = Hkdf::::new(None, &password_derived_key); + #[cfg_attr(not(test), allow(unused_variables))] + let (randomized_pwd, h) = Hkdf::::extract(None, &password_derived_key); let mut masking_key = vec![0u8; ::OutputSize::to_usize()]; h.expand(STR_MASKING_KEY, &mut masking_key) .map_err(|_| InternalPakeError::HkdfError)?; @@ -339,7 +340,7 @@ impl ClientRegistration { #[cfg(test)] state: self, #[cfg(test)] - randomized_pwd: password_derived_key, + randomized_pwd, }) } }