Set rand_key equal to selected sh2 blocksize to avoid key padding on Sha2 384 and 512
@@ -137,7 +137,8 @@ impl Hmac {
pub fn hmac_compare(&self, received_hmac: &[u8]) -> Result<bool, errors::UnknownCryptoError> {
let own_hmac = self.hmac_compute();
- let rand_key = util::gen_rand_key(64).unwrap();
+
+ let rand_key = util::gen_rand_key(self.sha2.blocksize()).unwrap();
let nd_round_own = Hmac {
secret_key: rand_key.clone(),
