mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Fixes for STM32 Crypto hardware acceleration locking to work with multiple threads. Fix for api.c missing devId
in new RNG test. Added STM32F207 to configuration template.
This commit is contained in:
@ -155,11 +155,16 @@ extern "C" {
|
||||
#elif defined(STM32L562xx)
|
||||
#define WOLFSSL_STM32L5
|
||||
#define WOLFSSL_STM32_PKA
|
||||
#undef NO_STM32_HASH
|
||||
#undef NO_STM32_CRYPTO
|
||||
#define HAL_CONSOLE_UART huart1
|
||||
#elif defined(STM32L552xx)
|
||||
#define WOLFSSL_STM32L5
|
||||
#undef NO_STM32_HASH
|
||||
#define HAL_CONSOLE_UART hlpuart1
|
||||
#elif defined(STM32F207xx)
|
||||
#define WOLFSSL_STM32F2
|
||||
#define HAL_CONSOLE_UART huart3
|
||||
#else
|
||||
#warning Please define a hardware platform!
|
||||
#define WOLFSSL_STM32F4 /* default */
|
||||
@ -325,8 +330,8 @@ extern "C" {
|
||||
#ifdef USE_FAST_MATH
|
||||
#ifdef NO_RSA
|
||||
/* Custom fastmath size if not using RSA */
|
||||
/* MAX = ROUND32(ECC BITS 256) + SIZE_OF_MP_DIGIT(32) */
|
||||
#define FP_MAX_BITS (256 + 32)
|
||||
/* MAX = ROUND32(ECC BITS) * 2 */
|
||||
#define FP_MAX_BITS (256 * 2)
|
||||
#else
|
||||
#define ALT_ECC_SIZE
|
||||
#endif
|
||||
@ -334,7 +339,7 @@ extern "C" {
|
||||
/* Enable TFM optimizations for ECC */
|
||||
//#define TFM_ECC192
|
||||
//#define TFM_ECC224
|
||||
#define TFM_ECC256
|
||||
//#define TFM_ECC256
|
||||
//#define TFM_ECC384
|
||||
//#define TFM_ECC521
|
||||
#endif
|
||||
@ -370,6 +375,8 @@ extern "C" {
|
||||
//#define WOLFSSL_AES_XTS
|
||||
//#define WOLFSSL_AES_DIRECT
|
||||
//#define HAVE_AES_ECB
|
||||
//#define HAVE_AES_KEYWRAP
|
||||
//#define AES_MAX_KEY_SIZE 256
|
||||
|
||||
/* ChaCha20 / Poly1305 */
|
||||
#undef HAVE_CHACHA
|
||||
|
@ -253,7 +253,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_SHA3) || defined(HAVE_PKCS7) || (!defined(NO_RSA) && \
|
||||
!defined(NO_SIG_WRAPPER))
|
||||
!defined(NO_SIG_WRAPPER)) || !defined(WC_NO_RNG)
|
||||
static int devId = INVALID_DEVID;
|
||||
#endif
|
||||
#ifndef NO_DSA
|
||||
|
@ -3730,15 +3730,14 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||
CRYP_IVInitTypeDef ivInit;
|
||||
#endif
|
||||
|
||||
ret = wolfSSL_CryptHwMutexLock();
|
||||
#ifdef WOLFSSL_STM32_CUBEMX
|
||||
ret = wc_Stm32_Aes_Init(aes, &hcryp);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_STM32_CUBEMX
|
||||
ret = wc_Stm32_Aes_Init(aes, &hcryp);
|
||||
ret = wolfSSL_CryptHwMutexLock();
|
||||
if (ret != 0) {
|
||||
wolfSSL_CryptHwMutexUnLock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3774,7 +3773,11 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||
#else /* Standard Peripheral Library */
|
||||
ret = wc_Stm32_Aes_Init(aes, &cryptInit, &keyInit);
|
||||
if (ret != 0) {
|
||||
wolfSSL_CryptHwMutexUnLock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = wolfSSL_CryptHwMutexLock();
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -3819,7 +3822,6 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
|
||||
|
||||
/* disable crypto processor */
|
||||
CRYP_Cmd(DISABLE);
|
||||
|
||||
#endif /* WOLFSSL_STM32_CUBEMX */
|
||||
|
||||
wolfSSL_CryptHwMutexUnLock();
|
||||
@ -4146,8 +4148,12 @@ int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len)
|
||||
#endif /* WOLFSSL_AESNI */
|
||||
|
||||
#if !defined(FREESCALE_LTC_AES_GCM)
|
||||
if (ret == 0) {
|
||||
ret = wolfSSL_CryptHwMutexLock();
|
||||
if (ret == 0) {
|
||||
wc_AesEncrypt(aes, iv, aes->H);
|
||||
wolfSSL_CryptHwMutexUnLock();
|
||||
}
|
||||
#ifdef GCM_TABLE
|
||||
GenerateM0(aes);
|
||||
#endif /* GCM_TABLE */
|
||||
|
Reference in New Issue
Block a user