21 #ifndef __ESP32_CRYPT_H__ 23 #define __ESP32_CRYPT_H__ 25 #include "esp_idf_version.h" 26 #include "esp_types.h" 29 #ifdef WOLFSSL_ESP32WROOM32_CRYPT_DEBUG 30 #undef LOG_LOCAL_LEVEL 31 #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG 33 #undef LOG_LOCAL_LEVEL 34 #define LOG_LOCAL_LEVEL ESP_LOG_ERROR 37 #include <freertos/FreeRTOS.h> 38 #include "soc/dport_reg.h" 39 #include "soc/hwcrypto_reg.h" 41 #include "driver/periph_ctrl.h" 42 #if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1 43 #include <esp32/rom/ets_sys.h> 45 #include <rom/ets_sys.h> 52 int esp_CryptHwMutexInit(wolfSSL_Mutex* mutex);
53 int esp_CryptHwMutexLock(wolfSSL_Mutex* mutex, TickType_t xBloxkTime);
54 int esp_CryptHwMutexUnLock(wolfSSL_Mutex* mutex);
58 #if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1 59 #include "esp32/rom/aes.h" 64 typedef enum tagES32_AES_PROCESS {
66 ESP32_AES_UPDATEKEY_ENCRYPT = 2,
67 ESP32_AES_UPDATEKEY_DECRYPT = 3,
68 ESP32_AES_UNLOCKHW = 4
72 int wc_esp32AesCbcEncrypt(
struct Aes* aes, byte* out,
const byte* in, word32 sz);
73 int wc_esp32AesCbcDecrypt(
struct Aes* aes, byte* out,
const byte* in, word32 sz);
74 int wc_esp32AesEncrypt(
struct Aes *aes,
const byte* in, byte* out);
75 int wc_esp32AesDecrypt(
struct Aes *aes,
const byte* in, byte* out);
79 #ifdef WOLFSSL_ESP32WROOM32_CRYPT_DEBUG 81 void wc_esp32TimerStart();
82 uint64_t wc_esp32elapsedTime();
86 #if (!defined(NO_SHA) || !defined(NO_SHA256) || defined(WOLFSSL_SHA384) || \ 87 defined(WOLFSSL_SHA512)) && \ 88 !defined(NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH) 91 #define WOLFSSL_NO_HASH_RAW 92 #if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1 93 #include "esp32/rom/sha.h" 109 enum SHA_TYPE sha_type;
113 void esp_sha_hw_unlock(
void );
116 int esp_sha_digest_process(
struct wc_Sha* sha, byte bockprocess);
117 int esp_sha_process(
struct wc_Sha* sha,
const byte* data);
121 int esp_sha256_digest_process(
struct wc_Sha256* sha, byte bockprocess);
122 int esp_sha256_process(
struct wc_Sha256* sha,
const byte* data);
125 #if defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384) 127 int esp_sha512_process(
struct wc_Sha512* sha);
128 int esp_sha512_digest_process(
struct wc_Sha512* sha, byte blockproc);
133 #if !defined(NO_RSA) || defined(HAVE_ECC) 135 #ifndef ESP_RSA_TIMEOUT 136 #define ESP_RSA_TIMEOUT 0xFFFFF 141 int esp_mp_exptmod(
struct fp_int* G,
struct fp_int* X, word32 Xbits,
struct fp_int* P,
Definition: esp32-crypt.h:104
Definition: wolfcaam_sha.h:68