22#ifndef _WOLFPORT_STM32_H_
23#define _WOLFPORT_STM32_H_
28#include <wolfssl/wolfcrypt/settings.h>
31#if defined(WOLFSSL_STM32_PKA) && defined(HAVE_ECC)
32 #include <wolfssl/wolfcrypt/integer.h>
38#define WOLFSSL_NO_HASH_RAW
42 #define STM32_HASH_SHA2
43 #define HASH_CR_SIZE 54
44 #define HASH_MAX_DIGEST 32
46 #define HASH_CR_SIZE 50
47 #define HASH_MAX_DIGEST 20
51#if !defined(HASH_ALGOMODE_HASH) && defined(HASH_AlgoMode_HASH)
52 #define HASH_ALGOMODE_HASH HASH_AlgoMode_HASH
54#if !defined(HASH_DATATYPE_8B) && defined(HASH_DataType_8b)
55 #define HASH_DATATYPE_8B HASH_DataType_8b
58#ifndef STM32_HASH_TIMEOUT
59 #define STM32_HASH_TIMEOUT 0xFFFF
64#define STM32_HASH_REG_SIZE 4
72 uint32_t HASH_CSR[HASH_CR_SIZE];
75 word32 buffer[STM32_HASH_REG_SIZE /
sizeof(word32)];
85 const byte* data,
int len);
87 byte* hash,
int digestSize);
95 #if !defined(STM32_CRYPTO_AES_GCM) && (defined(WOLFSSL_STM32F4) || \
96 defined(WOLFSSL_STM32F7) || defined(WOLFSSL_STM32L4))
98 #define STM32_CRYPTO_AES_GCM
101 #ifdef WOLFSSL_STM32L4
102 #define STM32_CRYPTO_AES_ONLY
107 #if !defined(STM32_HAL_V2) && \
108 defined(WOLFSSL_STM32F7) && defined(CRYP_AES_GCM)
114 #define STM_CRYPT_TYPE uint32_t
116 #define STM_CRYPT_TYPE uint8_t
120 #define STM32_GCM_IV_START 2
123 #ifdef WOLFSSL_STM32_CUBEMX
124 int wc_Stm32_Aes_Init(
struct Aes* aes, CRYP_HandleTypeDef* hcryp);
126 int wc_Stm32_Aes_Init(
struct Aes* aes, CRYP_InitTypeDef* cryptInit,
127 CRYP_KeyInitTypeDef* keyInit);
133#if defined(WOLFSSL_STM32_PKA) && defined(HAVE_ECC)
134int stm32_ecc_verify_hash_ex(
mp_int *r,
mp_int *s,
const byte* hash,
135 word32 hashlen,
int* res,
ecc_key* key);
137int stm32_ecc_sign_hash_ex(
const byte* hash, word32 hashlen,
WC_RNG* rng,