From 6075b44e7e628bdf831075d581f799ec291afaf7 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Mon, 6 Jan 2025 13:26:53 -0700 Subject: [PATCH] Module v5.2.3 STM32 PAA --- wolfcrypt/src/aes.c | 2 +- wolfcrypt/src/random.c | 5 ++++- wolfcrypt/src/sha.c | 2 +- wolfcrypt/src/sha256.c | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 10c6ed646..1a186d93e 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -4395,7 +4395,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv) return BAD_FUNC_ARG; } - return wc_AesSetKeyLocal(aes, key, len, iv, dir, 0); + return wc_AesSetKey(aes, key, len, iv, dir); } #endif /* NEED_AES_CTR_SOFT */ diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 253528b98..c6ee0fd08 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -1972,6 +1972,7 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) { int ret; + word32 retVal; RNG_HandleTypeDef hrng; word32 i = 0; (void)os; @@ -2004,7 +2005,9 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) } else { /* Use native 32 instruction */ - if (HAL_RNG_GenerateRandomNumber(&hrng, (uint32_t*)&output[i]) != HAL_OK) { + retVal = HAL_RNG_GenerateRandomNumber(&hrng, + (uint32_t*)&output[i]); + if (retVal != HAL_OK) { wolfSSL_CryptHwMutexUnLock(); return RAN_BLOCK_E; } diff --git a/wolfcrypt/src/sha.c b/wolfcrypt/src/sha.c index e0e2b1531..a90857da3 100644 --- a/wolfcrypt/src/sha.c +++ b/wolfcrypt/src/sha.c @@ -137,7 +137,7 @@ ret = wolfSSL_CryptHwMutexLock(); if (ret == 0) { ret = wc_Stm32_Hash_Update(&sha->stmCtx, HASH_AlgoSelection_SHA1, - data, len); + data, len, WC_SHA_BLOCK_SIZE); wolfSSL_CryptHwMutexUnLock(); } return ret; diff --git a/wolfcrypt/src/sha256.c b/wolfcrypt/src/sha256.c index 60684f59d..d891d647d 100644 --- a/wolfcrypt/src/sha256.c +++ b/wolfcrypt/src/sha256.c @@ -553,7 +553,7 @@ static int InitSha256(wc_Sha256* sha256) ret = wolfSSL_CryptHwMutexLock(); if (ret == 0) { ret = wc_Stm32_Hash_Update(&sha256->stmCtx, - HASH_AlgoSelection_SHA256, data, len); + HASH_AlgoSelection_SHA256, data, len, WC_SHA256_BLOCK_SIZE); wolfSSL_CryptHwMutexUnLock(); } return ret; @@ -1384,7 +1384,7 @@ static int InitSha256(wc_Sha256* sha256) ret = wolfSSL_CryptHwMutexLock(); if (ret == 0) { ret = wc_Stm32_Hash_Update(&sha224->stmCtx, - HASH_AlgoSelection_SHA224, data, len); + HASH_AlgoSelection_SHA224, data, len, WC_SHA224_BLOCK_SIZE); wolfSSL_CryptHwMutexUnLock(); } return ret;