From ad3f7e1de27748e08ad0cde1d0321d289fdff40a Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 9 Jun 2022 13:22:22 -0700 Subject: [PATCH] The STM32U5 does not support DES3 or AES 192-bit (only 128/256 bit) --- wolfcrypt/src/des3.c | 2 +- wolfssl/wolfcrypt/des3.h | 3 +++ wolfssl/wolfcrypt/port/st/stm32.h | 2 +- wolfssl/wolfcrypt/settings.h | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wolfcrypt/src/des3.c b/wolfcrypt/src/des3.c index 4d571db9e..dbdce6f3a 100644 --- a/wolfcrypt/src/des3.c +++ b/wolfcrypt/src/des3.c @@ -142,7 +142,7 @@ /* Hardware Acceleration */ -#if defined(STM32_CRYPTO) +#if defined(STM32_CRYPTO) && !defined(STM32_CRYPTO_AES_ONLY) /* * STM32F2/F4 hardware DES/3DES support through the standard diff --git a/wolfssl/wolfcrypt/des3.h b/wolfssl/wolfcrypt/des3.h index cb5b84181..5cb94a093 100644 --- a/wolfssl/wolfcrypt/des3.h +++ b/wolfssl/wolfcrypt/des3.h @@ -79,6 +79,9 @@ enum { #if defined(STM32_CRYPTO) + +#include + enum { DES_CBC = 0, DES_ECB = 1 diff --git a/wolfssl/wolfcrypt/port/st/stm32.h b/wolfssl/wolfcrypt/port/st/stm32.h index 3c3738e1d..2ccd153cf 100644 --- a/wolfssl/wolfcrypt/port/st/stm32.h +++ b/wolfssl/wolfcrypt/port/st/stm32.h @@ -111,7 +111,7 @@ int wc_Stm32_Hash_Final(STM32_HASH_Context* stmCtx, word32 algo, #endif #if defined(WOLFSSL_STM32L4) || defined(WOLFSSL_STM32L5) || \ defined(WOLFSSL_STM32U5) - #ifdef WOLFSSL_STM32L4 + #if defined(WOLFSSL_STM32L4) || defined(WOLFSSL_STM32U5) #define STM32_CRYPTO_AES_ONLY /* crypto engine only supports AES */ #endif #define CRYP AES diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 744206f12..cc3e1b204 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -1342,7 +1342,7 @@ extern void uITRON4_free(void *p) ; #define STM32_CRYPTO #if defined(WOLFSSL_STM32L4) || defined(WOLFSSL_STM32L5) || \ - defined(WOLFSSL_STM32WB) + defined(WOLFSSL_STM32WB) || defined(WOLFSSL_STM32U5) #define NO_AES_192 /* hardware does not support 192-bit */ #endif #endif