* Make the wc_Stm32_Aes_Init API always available for STM32. ZD 9503

* Fix for SHA256 hash context to only be included for `STM32_HASH_SHA2`. ZD 9503
This commit is contained in:
David Garske
2019-11-15 12:07:08 -08:00
parent 4282346eef
commit 2a9449182c
3 changed files with 9 additions and 13 deletions

View File

@ -263,7 +263,6 @@ int wc_Stm32_Hash_Final(STM32_HASH_Context* stmCtx, word32 algo,
#ifdef STM32_CRYPTO #ifdef STM32_CRYPTO
#ifndef NO_AES #ifndef NO_AES
#if defined(WOLFSSL_AES_DIRECT) || defined(HAVE_AESGCM) || defined(HAVE_AESCCM)
#ifdef WOLFSSL_STM32_CUBEMX #ifdef WOLFSSL_STM32_CUBEMX
int wc_Stm32_Aes_Init(Aes* aes, CRYP_HandleTypeDef* hcryp) int wc_Stm32_Aes_Init(Aes* aes, CRYP_HandleTypeDef* hcryp)
{ {
@ -359,7 +358,6 @@ int wc_Stm32_Aes_Init(Aes* aes, CRYP_InitTypeDef* cryptInit,
return 0; return 0;
} }
#endif /* WOLFSSL_STM32_CUBEMX */ #endif /* WOLFSSL_STM32_CUBEMX */
#endif /* WOLFSSL_AES_DIRECT || HAVE_AESGCM || HAVE_AESCCM */
#endif /* !NO_AES */ #endif /* !NO_AES */
#endif /* STM32_CRYPTO */ #endif /* STM32_CRYPTO */

View File

@ -108,7 +108,7 @@ int wc_Stm32_Hash_Final(STM32_HASH_Context* stmCtx, word32 algo,
#define STM32_HAL_V2 #define STM32_HAL_V2
#endif #endif
/* Thee datatype for STM32 CubeMX HAL Crypt calls */ /* The datatype for STM32 CubeMX HAL Crypt calls */
#ifdef STM32_HAL_V2 #ifdef STM32_HAL_V2
#define STM_CRYPT_TYPE uint32_t #define STM_CRYPT_TYPE uint32_t
#else #else
@ -118,15 +118,13 @@ int wc_Stm32_Hash_Final(STM32_HASH_Context* stmCtx, word32 algo,
/* CRYPT_AES_GCM starts the IV with 2 */ /* CRYPT_AES_GCM starts the IV with 2 */
#define STM32_GCM_IV_START 2 #define STM32_GCM_IV_START 2
#if defined(WOLFSSL_AES_DIRECT) || defined(HAVE_AESGCM) || defined(HAVE_AESCCM) struct Aes;
struct Aes; #ifdef WOLFSSL_STM32_CUBEMX
#ifdef WOLFSSL_STM32_CUBEMX int wc_Stm32_Aes_Init(struct Aes* aes, CRYP_HandleTypeDef* hcryp);
int wc_Stm32_Aes_Init(struct Aes* aes, CRYP_HandleTypeDef* hcryp); #else /* STD_PERI_LIB */
#else /* STD_PERI_LIB */ int wc_Stm32_Aes_Init(struct Aes* aes, CRYP_InitTypeDef* cryptInit,
int wc_Stm32_Aes_Init(struct Aes* aes, CRYP_InitTypeDef* cryptInit, CRYP_KeyInitTypeDef* keyInit);
CRYP_KeyInitTypeDef* keyInit); #endif /* WOLFSSL_STM32_CUBEMX */
#endif /* WOLFSSL_STM32_CUBEMX */
#endif /* WOLFSSL_AES_DIRECT || HAVE_AESGCM || HAVE_AESCCM */
#endif /* !NO_AES */ #endif /* !NO_AES */
#endif /* STM32_CRYPTO */ #endif /* STM32_CRYPTO */

View File

@ -132,7 +132,7 @@ enum {
struct wc_Sha256 { struct wc_Sha256 {
#ifdef FREESCALE_LTC_SHA #ifdef FREESCALE_LTC_SHA
ltc_hash_ctx_t ctx; ltc_hash_ctx_t ctx;
#elif defined(STM32_HASH) #elif defined(STM32_HASH_SHA2)
STM32_HASH_Context stmCtx; STM32_HASH_Context stmCtx;
#else #else
/* alignment on digest and buffer speeds up ARMv8 crypto operations */ /* alignment on digest and buffer speeds up ARMv8 crypto operations */