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.

This commit is contained in:
David Garske
2025-05-02 13:51:46 -07:00
parent c402d7bd94
commit e487685d7d

View File

@@ -258,14 +258,14 @@ static int wc_Stm32_Hash_WaitDone(STM32_HASH_Context* stmCtx)
(void)stmCtx;
/* wait until not busy and hash digest / input block are complete */
while ((HASH->SR & HASH_SR_BUSY) &&
while (((HASH->SR & HASH_SR_BUSY)
#ifdef HASH_IMR_DCIE
(HASH->SR & HASH_SR_DCIS) == 0 &&
|| (HASH->SR & HASH_SR_DCIS) == 0
#endif
#ifdef HASH_IMR_DINIE
(HASH->SR & HASH_SR_DINIS) == 0 &&
|| (HASH->SR & HASH_SR_DINIS) == 0
#endif
++timeout < STM32_HASH_TIMEOUT) {
) && ++timeout < STM32_HASH_TIMEOUT) {
};
#ifdef DEBUG_STM32_HASH