From 108770f3b653973cfdbb424d5a9f596977b1c1a0 Mon Sep 17 00:00:00 2001 From: driftluo Date: Fri, 29 Jul 2022 15:10:17 +0800 Subject: [PATCH] chore: replace hmac oneshot to update and sign --- secio/src/codec/hmac_compat/openssl_impl.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/secio/src/codec/hmac_compat/openssl_impl.rs b/secio/src/codec/hmac_compat/openssl_impl.rs index 34125d52..9d6f900e 100644 --- a/secio/src/codec/hmac_compat/openssl_impl.rs +++ b/secio/src/codec/hmac_compat/openssl_impl.rs @@ -33,10 +33,9 @@ impl Hmac { /// Signs the data. pub fn sign(&mut self, crypted_data: &[u8]) -> Vec { - 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.