diff --git a/IDE/STM32Cube/wolfSSL.wolfSSL_conf.h b/IDE/STM32Cube/wolfSSL.wolfSSL_conf.h index 063db0b5d..9112c8b8f 100644 --- a/IDE/STM32Cube/wolfSSL.wolfSSL_conf.h +++ b/IDE/STM32Cube/wolfSSL.wolfSSL_conf.h @@ -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 diff --git a/tests/api.c b/tests/api.c index 565b8ae8a..c09f48a08 100644 --- a/tests/api.c +++ b/tests/api.c @@ -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 diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index b0001f198..6b94f44ae 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -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(); @@ -4147,7 +4149,11 @@ int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len) #if !defined(FREESCALE_LTC_AES_GCM) if (ret == 0) { - wc_AesEncrypt(aes, iv, aes->H); + ret = wolfSSL_CryptHwMutexLock(); + if (ret == 0) { + wc_AesEncrypt(aes, iv, aes->H); + wolfSSL_CryptHwMutexUnLock(); + } #ifdef GCM_TABLE GenerateM0(aes); #endif /* GCM_TABLE */