Proper fix for STM32 hashing. FIFO is always 32 bytes. The original U5/H7 proper fix is to make sure the hash is "done" before saving state.
This commit is contained in:
parent
c055740e6a
commit
39e72630ce
@ -306,15 +306,8 @@ int wc_Stm32_Hash_Update(STM32_HASH_Context* stmCtx, word32 algo,
|
||||
}
|
||||
|
||||
if (wroteToFifo) {
|
||||
#if defined(STM32_HASH_FIFO_SIZE) && STM32_HASH_FIFO_SIZE > 1
|
||||
/* If FIFO depth > 1 and we wrote a block send one more 32-bit to
|
||||
* FIFO to trigger start. We cannot leave 16 deep FIFO filled before
|
||||
* saving off context */
|
||||
wc_Stm32_Hash_Data(stmCtx, 4);
|
||||
stmCtx->fifoBytes += 4;
|
||||
|
||||
(void)wc_Stm32_Hash_WaitDone(stmCtx);
|
||||
#endif
|
||||
/* make sure hash operation is done */
|
||||
ret = wc_Stm32_Hash_WaitDone(stmCtx);
|
||||
|
||||
/* save hash state for next operation */
|
||||
wc_Stm32_Hash_SaveContext(stmCtx);
|
||||
|
@ -60,14 +60,8 @@
|
||||
|
||||
/* STM32 register size in bytes */
|
||||
#define STM32_HASH_REG_SIZE 4
|
||||
#if defined(WOLFSSL_STM32F4) || defined(WOLFSSL_STM32F7) || \
|
||||
defined(WOLFSSL_STM32L4) || defined(WOLFSSL_STM32L5) || \
|
||||
defined(WOLFSSL_STM32H7) || defined(WOLFSSL_STM32U5) || \
|
||||
defined(WOLFSSL_STM32WB)
|
||||
#define STM32_HASH_FIFO_SIZE 16 /* FIFO is 16 deep 32-bits wide */
|
||||
#else
|
||||
#define STM32_HASH_FIFO_SIZE 1
|
||||
#endif
|
||||
|
||||
|
||||
/* STM32 Hash Context */
|
||||
typedef struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user