Skip to content

Commit 2b55041

Browse files
committed
Fix for STM32 Hashing status bit checking logic. ZD 19783. The digest calculation was indicating "not busy" before digest result (DCIS) was finished. This did not show up on most systems because the computation is usually done by the time it reads.
1 parent 1075ce8 commit 2b55041

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

wolfcrypt/src/port/st/stm32.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,14 @@ static int wc_Stm32_Hash_WaitDone(STM32_HASH_Context* stmCtx)
258258
(void)stmCtx;
259259

260260
/* wait until not busy and hash digest / input block are complete */
261-
while ((HASH->SR & HASH_SR_BUSY) &&
261+
while (((HASH->SR & HASH_SR_BUSY)
262262
#ifdef HASH_IMR_DCIE
263-
(HASH->SR & HASH_SR_DCIS) == 0 &&
263+
|| (HASH->SR & HASH_SR_DCIS) == 0
264264
#endif
265265
#ifdef HASH_IMR_DINIE
266-
(HASH->SR & HASH_SR_DINIS) == 0 &&
266+
|| (HASH->SR & HASH_SR_DINIS) == 0
267267
#endif
268-
++timeout < STM32_HASH_TIMEOUT) {
268+
) && ++timeout < STM32_HASH_TIMEOUT) {
269269
};
270270

271271
#ifdef DEBUG_STM32_HASH

0 commit comments

Comments
 (0)