forked from wolfSSL/wolfssl
Fix PKA build error with SP sign. Fix U5/H5/H7 hashing, which require a workaround to write an extra 32-bit to flush FIFO before save/restore.
This commit is contained in:
@@ -312,6 +312,13 @@ int wc_Stm32_Hash_Update(STM32_HASH_Context* stmCtx, word32 algo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (wroteToFifo) {
|
if (wroteToFifo) {
|
||||||
|
#ifdef STM32_HASH_FIFO_WORKAROUND
|
||||||
|
/* If we wrote a block send one more 32-bit to FIFO to trigger start.
|
||||||
|
* The save/restore feature cannot leave 16 deep FIFO filled. */
|
||||||
|
wc_Stm32_Hash_Data(stmCtx, 4);
|
||||||
|
stmCtx->fifoBytes += 4;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* make sure hash operation is done */
|
/* make sure hash operation is done */
|
||||||
ret = wc_Stm32_Hash_WaitDone(stmCtx);
|
ret = wc_Stm32_Hash_WaitDone(stmCtx);
|
||||||
|
|
||||||
@@ -868,7 +875,10 @@ int wc_ecc_mulmod_ex(const mp_int *k, ecc_point *G, ecc_point *R, mp_int* a,
|
|||||||
res = mp_read_unsigned_bin(R->x, Gxbin, size);
|
res = mp_read_unsigned_bin(R->x, Gxbin, size);
|
||||||
if (res == MP_OKAY) {
|
if (res == MP_OKAY) {
|
||||||
res = mp_read_unsigned_bin(R->y, Gybin, size);
|
res = mp_read_unsigned_bin(R->y, Gybin, size);
|
||||||
#ifndef WOLFSSL_SP_MATH
|
|
||||||
|
#if defined(USE_FAST_MATH) || defined(USE_INTEGER_HEAP_MATH) || \
|
||||||
|
((defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_SP_MATH_ALL)) && \
|
||||||
|
defined(WOLFSSL_SP_INT_NEGATIVE))
|
||||||
/* if k is negative, we compute the multiplication with abs(-k)
|
/* if k is negative, we compute the multiplication with abs(-k)
|
||||||
* with result (x, y) and modify the result to (x, -y)
|
* with result (x, y) and modify the result to (x, -y)
|
||||||
*/
|
*/
|
||||||
|
@@ -71,6 +71,13 @@
|
|||||||
#define STM32_HASH_REG_SIZE 4
|
#define STM32_HASH_REG_SIZE 4
|
||||||
#define STM32_HASH_FIFO_SIZE 16 /* FIFO is 16 deep 32-bits wide */
|
#define STM32_HASH_FIFO_SIZE 16 /* FIFO is 16 deep 32-bits wide */
|
||||||
|
|
||||||
|
#if (defined(WOLFSSL_STM32U5) || defined(WOLFSSL_STM32H5) || \
|
||||||
|
defined(WOLFSSL_STM32H7)) && !defined(NO_STM32_HASH_FIFO_WORKAROUND)
|
||||||
|
/* workaround for hash FIFO to write one extra to finalize */
|
||||||
|
#undef STM32_HASH_FIFO_WORKAROUND
|
||||||
|
#define STM32_HASH_FIFO_WORKAROUND
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* STM32 Hash Context */
|
/* STM32 Hash Context */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Reference in New Issue
Block a user