From 14a678fe4542d7c400d0d68b2859c54f2246abe4 Mon Sep 17 00:00:00 2001 From: Caleb Garrett <47389035+caleb-garrett@users.noreply.github.com> Date: Mon, 12 Feb 2024 20:33:04 -0500 Subject: [PATCH] Fixed HMAC blocking mode. --- embassy-stm32/src/hash/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/embassy-stm32/src/hash/mod.rs b/embassy-stm32/src/hash/mod.rs index bae538b5f..b47814f8b 100644 --- a/embassy-stm32/src/hash/mod.rs +++ b/embassy-stm32/src/hash/mod.rs @@ -215,7 +215,7 @@ impl<'d, T: Instance, D> Hash<'d, T, D> { self.accumulate_blocking(key); T::regs().str().write(|w| w.set_dcal(true)); // Block waiting for digest. - while !T::regs().sr().read().dcis() {} + while !T::regs().sr().read().dinis() {} } ctx.key_sent = true; } @@ -365,16 +365,16 @@ impl<'d, T: Instance, D> Hash<'d, T, D> { //Start the digest calculation. T::regs().str().write(|w| w.set_dcal(true)); - // Block waiting for digest. - while !T::regs().sr().read().dcis() {} - // Load the HMAC key if provided. if let Some(key) = ctx.key { + while !T::regs().sr().read().dinis() {} self.accumulate_blocking(key); T::regs().str().write(|w| w.set_dcal(true)); - while !T::regs().sr().read().dcis() {} } + // Block until digest computation is complete. + while !T::regs().sr().read().dcis() {} + // Return the digest. let digest_words = match ctx.algo { Algorithm::SHA1 => 5,