diff --git a/src/digest.rs b/src/digest.rs index 23145ebdc1..9922a37c47 100644 --- a/src/digest.rs +++ b/src/digest.rs @@ -324,6 +324,16 @@ impl Digest { ctx.try_finish(cpu) } + #[cold] + #[inline(never)] + pub(crate) fn compute_from_cold( + algorithm: &'static Algorithm, + data: &[u8], + cpu: cpu::Features, + ) -> Result { + Self::compute_from(algorithm, data, cpu) + } + /// The algorithm that was used to calculate the digest value. #[inline(always)] pub fn algorithm(&self) -> &'static Algorithm { diff --git a/src/hmac.rs b/src/hmac.rs index c7d0d62c4c..086cfc12be 100644 --- a/src/hmac.rs +++ b/src/hmac.rs @@ -238,7 +238,7 @@ impl Key { let key_value = if key_value.len() <= block_len { key_value } else { - key_hash = Digest::compute_from(digest_alg, key_value, cpu_features)?; + key_hash = Digest::compute_from_cold(digest_alg, key_value, cpu_features)?; key_hash.as_ref() };