forked from wolfSSL/wolfssl
@@ -29,19 +29,17 @@
|
|||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
#include "protocol_examples_common.h"
|
#include "protocol_examples_common.h"
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
const static int CONNECTED_BIT = BIT0;
|
const static int CONNECTED_BIT = BIT0;
|
||||||
static EventGroupHandle_t wifi_event_group;
|
static EventGroupHandle_t wifi_event_group;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* proto-type */
|
/* proto-type */
|
||||||
extern void tls_smp_client_task();
|
extern void tls_smp_client_task();
|
||||||
static void tls_smp_client_init();
|
static void tls_smp_client_init();
|
||||||
|
|
||||||
const static char *TAG = "tls_client";
|
const static char *TAG = "tls_client";
|
||||||
|
|
||||||
static EventGroupHandle_t wifi_event_group;
|
|
||||||
extern void tls_smp_client_task();
|
|
||||||
|
|
||||||
static void set_time()
|
static void set_time()
|
||||||
{
|
{
|
||||||
/* set dummy wallclock time. */
|
/* set dummy wallclock time. */
|
||||||
@@ -80,7 +78,11 @@ static void set_time()
|
|||||||
static void tls_smp_client_init(void)
|
static void tls_smp_client_init(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
|
TaskHandle_t _handle;
|
||||||
|
#else
|
||||||
xTaskHandle _handle;
|
xTaskHandle _handle;
|
||||||
|
#endif
|
||||||
/* http://esp32.info/docs/esp_idf/html/dd/d3c/group__xTaskCreate.html */
|
/* http://esp32.info/docs/esp_idf/html/dd/d3c/group__xTaskCreate.html */
|
||||||
ret = xTaskCreate(tls_smp_client_task,
|
ret = xTaskCreate(tls_smp_client_task,
|
||||||
TLS_SMP_CLIENT_TASK_NAME,
|
TLS_SMP_CLIENT_TASK_NAME,
|
||||||
@@ -93,6 +95,7 @@ static void tls_smp_client_init(void)
|
|||||||
ESP_LOGI(TAG, "create thread %s failed", TLS_SMP_CLIENT_TASK_NAME);
|
ESP_LOGI(TAG, "create thread %s failed", TLS_SMP_CLIENT_TASK_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if ESP_IDF_VERSION_MAJOR < 4
|
||||||
/* event handler for wifi events */
|
/* event handler for wifi events */
|
||||||
static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
|
static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
|
||||||
{
|
{
|
||||||
@@ -121,6 +124,7 @@ static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
|
|||||||
}
|
}
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/* entry point */
|
/* entry point */
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
@@ -137,7 +141,6 @@ void app_main(void)
|
|||||||
|
|
||||||
/* */
|
/* */
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
(void) wifi_event_handler;
|
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
|
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
|
||||||
* Read "Establishing Wi-Fi or Ethernet Connection" section in
|
* Read "Establishing Wi-Fi or Ethernet Connection" section in
|
||||||
|
@@ -29,10 +29,11 @@
|
|||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
#include "protocol_examples_common.h"
|
#include "protocol_examples_common.h"
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
const static int CONNECTED_BIT = BIT0;
|
const static int CONNECTED_BIT = BIT0;
|
||||||
static EventGroupHandle_t wifi_event_group;
|
static EventGroupHandle_t wifi_event_group;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* prefix for logging */
|
/* prefix for logging */
|
||||||
const static char *TAG = "tls_server";
|
const static char *TAG = "tls_server";
|
||||||
/* proto-type definition */
|
/* proto-type definition */
|
||||||
@@ -77,7 +78,11 @@ static void set_time()
|
|||||||
static void tls_smp_server_init(void)
|
static void tls_smp_server_init(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
|
TaskHandle_t _handle;
|
||||||
|
#else
|
||||||
xTaskHandle _handle;
|
xTaskHandle _handle;
|
||||||
|
#endif
|
||||||
/* http://esp32.info/docs/esp_idf/html/dd/d3c/group__xTaskCreate.html */
|
/* http://esp32.info/docs/esp_idf/html/dd/d3c/group__xTaskCreate.html */
|
||||||
ret = xTaskCreate(tls_smp_server_task,
|
ret = xTaskCreate(tls_smp_server_task,
|
||||||
TLS_SMP_SERVER_TASK_NAME,
|
TLS_SMP_SERVER_TASK_NAME,
|
||||||
@@ -90,6 +95,7 @@ static void tls_smp_server_init(void)
|
|||||||
ESP_LOGI(TAG, "create thread %s failed", TLS_SMP_SERVER_TASK_NAME);
|
ESP_LOGI(TAG, "create thread %s failed", TLS_SMP_SERVER_TASK_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if ESP_IDF_VERSION_MAJOR < 4
|
||||||
/* event handler for wifi events */
|
/* event handler for wifi events */
|
||||||
static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
|
static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
|
||||||
{
|
{
|
||||||
@@ -118,6 +124,7 @@ static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
|
|||||||
}
|
}
|
||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/* entry point */
|
/* entry point */
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
@@ -134,7 +141,6 @@ void app_main(void)
|
|||||||
#endif
|
#endif
|
||||||
/* */
|
/* */
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
(void) wifi_event_handler;
|
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
|
/* This helper function configures Wi-Fi or Ethernet, as selected in menuconfig.
|
||||||
* Read "Establishing Wi-Fi or Ethernet Connection" section in
|
* Read "Establishing Wi-Fi or Ethernet Connection" section in
|
||||||
|
@@ -8216,7 +8216,11 @@ void bench_sphincsKeySign(byte level, byte optim)
|
|||||||
#endif
|
#endif
|
||||||
double current_time(int reset)
|
double current_time(int reset)
|
||||||
{
|
{
|
||||||
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
|
TickType_t tickCount;
|
||||||
|
#else
|
||||||
portTickType tickCount;
|
portTickType tickCount;
|
||||||
|
#endif
|
||||||
|
|
||||||
(void) reset;
|
(void) reset;
|
||||||
|
|
||||||
|
@@ -157,7 +157,11 @@ static void esp_aes_hw_Set_KeyMode(Aes *ctx, ESP32_AESPROCESS mode)
|
|||||||
static void esp_aes_bk(const byte* in, byte* out)
|
static void esp_aes_bk(const byte* in, byte* out)
|
||||||
{
|
{
|
||||||
const word32 *inwords = (const word32 *)in;
|
const word32 *inwords = (const word32 *)in;
|
||||||
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
|
uint32_t *outwords = (uint32_t *)out;
|
||||||
|
#else
|
||||||
word32 *outwords = (word32 *)out;
|
word32 *outwords = (word32 *)out;
|
||||||
|
#endif
|
||||||
|
|
||||||
ESP_LOGV(TAG, "enter esp_aes_bk");
|
ESP_LOGV(TAG, "enter esp_aes_bk");
|
||||||
|
|
||||||
|
@@ -551,7 +551,11 @@ int wc_esp_digest_state(WC_ESP32SHA* ctx, byte* hash)
|
|||||||
* DPORT_SEQUENCE_REG_READ(address + i * 4);
|
* DPORT_SEQUENCE_REG_READ(address + i * 4);
|
||||||
*/
|
*/
|
||||||
esp_dport_access_read_buffer(
|
esp_dport_access_read_buffer(
|
||||||
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
|
(uint32_t*)(hash), /* the result will be found in hash upon exit */
|
||||||
|
#else
|
||||||
(word32*)(hash), /* the result will be found in hash upon exit */
|
(word32*)(hash), /* the result will be found in hash upon exit */
|
||||||
|
#endif
|
||||||
SHA_TEXT_BASE, /* there's a fixed reg addy for all SHA */
|
SHA_TEXT_BASE, /* there's a fixed reg addy for all SHA */
|
||||||
wc_esp_sha_digest_size(ctx->sha_type) / sizeof(word32) /* # 4-byte */
|
wc_esp_sha_digest_size(ctx->sha_type) / sizeof(word32) /* # 4-byte */
|
||||||
);
|
);
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include "esp_idf_version.h"
|
#include "esp_idf_version.h"
|
||||||
#include "esp_types.h"
|
#include "esp_types.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
#include "esp_random.h"
|
||||||
|
|
||||||
#ifdef WOLFSSL_ESP32WROOM32_CRYPT_DEBUG
|
#ifdef WOLFSSL_ESP32WROOM32_CRYPT_DEBUG
|
||||||
#undef LOG_LOCAL_LEVEL
|
#undef LOG_LOCAL_LEVEL
|
||||||
|
@@ -202,7 +202,11 @@
|
|||||||
#else /* MULTI_THREADED */
|
#else /* MULTI_THREADED */
|
||||||
/* FREERTOS comes first to enable use of FreeRTOS Windows simulator only */
|
/* FREERTOS comes first to enable use of FreeRTOS Windows simulator only */
|
||||||
#if defined(FREERTOS)
|
#if defined(FREERTOS)
|
||||||
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
|
typedef SemaphoreHandle_t wolfSSL_Mutex;
|
||||||
|
#else
|
||||||
typedef xSemaphoreHandle wolfSSL_Mutex;
|
typedef xSemaphoreHandle wolfSSL_Mutex;
|
||||||
|
#endif
|
||||||
#elif defined(FREERTOS_TCP)
|
#elif defined(FREERTOS_TCP)
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "semphr.h"
|
#include "semphr.h"
|
||||||
|
Reference in New Issue
Block a user