Fix omission of nonce in hmac computation for envelope (#44)

This commit is contained in:
Kevin Lewi
2020-09-01 11:23:00 -07:00
committed by GitHub
parent cdf0c7bf72
commit 195a698ad8
3 changed files with 52 additions and 50 deletions
+2
View File
@@ -119,6 +119,7 @@ impl<D: Hash> Envelope<D> {
let mut hmac =
Hmac::<D>::new_varkey(&hmac_key).map_err(|_| InternalPakeError::HmacError)?;
hmac.update(&nonce);
hmac.update(&ciphertext);
hmac.update(&aad);
@@ -142,6 +143,7 @@ impl<D: Hash> Envelope<D> {
let mut hmac =
Hmac::<D>::new_varkey(&hmac_key).map_err(|_| InternalPakeError::HmacError)?;
hmac.update(&self.nonce);
hmac.update(&self.ciphertext);
hmac.update(aad);
if hmac.verify(&self.hmac).is_err() {