Skip to content

Commit

Permalink
chore: replace hmac oneshot to update and sign
Browse files Browse the repository at this point in the history
  • Loading branch information
driftluo committed Jul 29, 2022
1 parent 9c666d4 commit 108770f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions secio/src/codec/hmac_compat/openssl_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ impl Hmac {

/// Signs the data.
pub fn sign(&mut self, crypted_data: &[u8]) -> Vec<u8> {
Signer::new(self.digest, &self.key)
.expect("init openssl signer ctx fail")
.sign_oneshot_to_vec(crypted_data)
.expect("hmac sign oneshot fail")
let mut sign = Signer::new(self.digest, &self.key).expect("init openssl signer ctx fail");
sign.update(crypted_data).expect("openssl hmac update fail");
sign.sign_to_vec().expect("hmac sign oneshot fail")
}

/// Verifies that the data matches the expected hash.
Expand Down

0 comments on commit 108770f

Please sign in to comment.