21#ifndef __ESP32_CRYPT_H__
23#define __ESP32_CRYPT_H__
25#include "esp_idf_version.h"
29#ifdef WOLFSSL_ESP32WROOM32_CRYPT_DEBUG
31#define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
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>
52int esp_CryptHwMutexInit(wolfSSL_Mutex* mutex);
53int esp_CryptHwMutexLock(wolfSSL_Mutex* mutex, TickType_t xBloxkTime);
54int esp_CryptHwMutexUnLock(wolfSSL_Mutex* mutex);
58#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
59#include "esp32/rom/aes.h"
64typedef enum tagES32_AES_PROCESS {
66 ESP32_AES_UPDATEKEY_ENCRYPT = 2,
67 ESP32_AES_UPDATEKEY_DECRYPT = 3,
68 ESP32_AES_UNLOCKHW = 4
72int wc_esp32AesCbcEncrypt(
struct Aes* aes,
byte* out,
const byte* in, word32 sz);
73int wc_esp32AesCbcDecrypt(
struct Aes* aes,
byte* out,
const byte* in, word32 sz);
74int wc_esp32AesEncrypt(
struct Aes *aes,
const byte* in,
byte* out);
75int wc_esp32AesDecrypt(
struct Aes *aes,
const byte* in,
byte* out);
79#ifdef WOLFSSL_ESP32WROOM32_CRYPT_DEBUG
81void wc_esp32TimerStart();
82uint64_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;
113void esp_sha_hw_unlock(
void );
116int esp_sha_digest_process(
struct wc_Sha* sha,
byte bockprocess);
117int 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
Definition esp32-crypt.h:104
Definition wolfcaam_sha.h:68