Skip to content

Commit 14a678f

Browse files
committed
Fixed HMAC blocking mode.
1 parent f0f1f2d commit 14a678f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

embassy-stm32/src/hash/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<'d, T: Instance, D> Hash<'d, T, D> {
215215
self.accumulate_blocking(key);
216216
T::regs().str().write(|w| w.set_dcal(true));
217217
// Block waiting for digest.
218-
while !T::regs().sr().read().dcis() {}
218+
while !T::regs().sr().read().dinis() {}
219219
}
220220
ctx.key_sent = true;
221221
}
@@ -365,16 +365,16 @@ impl<'d, T: Instance, D> Hash<'d, T, D> {
365365
//Start the digest calculation.
366366
T::regs().str().write(|w| w.set_dcal(true));
367367

368-
// Block waiting for digest.
369-
while !T::regs().sr().read().dcis() {}
370-
371368
// Load the HMAC key if provided.
372369
if let Some(key) = ctx.key {
370+
while !T::regs().sr().read().dinis() {}
373371
self.accumulate_blocking(key);
374372
T::regs().str().write(|w| w.set_dcal(true));
375-
while !T::regs().sr().read().dcis() {}
376373
}
377374

375+
// Block until digest computation is complete.
376+
while !T::regs().sr().read().dcis() {}
377+
378378
// Return the digest.
379379
let digest_words = match ctx.algo {
380380
Algorithm::SHA1 => 5,

0 commit comments

Comments
 (0)