forked from wolfSSL/wolfssl
Espressif examples: polish & misc updates
This commit is contained in:
@@ -92,14 +92,16 @@
|
|||||||
/* when you want to use SHA3 */
|
/* when you want to use SHA3 */
|
||||||
#define WOLFSSL_SHA3
|
#define WOLFSSL_SHA3
|
||||||
|
|
||||||
#define HAVE_ED25519 /* ED25519 requires SHA512 */
|
/* Reminder: ED25519 requires SHA512 */
|
||||||
|
#define HAVE_ED25519
|
||||||
|
|
||||||
#define HAVE_ECC
|
#define HAVE_ECC
|
||||||
#define HAVE_CURVE25519
|
#define HAVE_CURVE25519
|
||||||
#define CURVE25519_SMALL
|
#define CURVE25519_SMALL
|
||||||
#define HAVE_ED25519
|
#define HAVE_ED25519
|
||||||
|
|
||||||
#define OPENSSL_EXTRA
|
/* Optional OPENSSL compatibility */
|
||||||
|
#define OPENSSL_EXTRA
|
||||||
/* when you want to use pkcs7 */
|
/* when you want to use pkcs7 */
|
||||||
/* #define HAVE_PKCS7 */
|
/* #define HAVE_PKCS7 */
|
||||||
|
|
||||||
@@ -111,7 +113,7 @@
|
|||||||
#define WOLFSSL_AES_DIRECT
|
#define WOLFSSL_AES_DIRECT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* when you want to use aes counter mode */
|
/* when you want to use AES counter mode */
|
||||||
/* #define WOLFSSL_AES_DIRECT */
|
/* #define WOLFSSL_AES_DIRECT */
|
||||||
/* #define WOLFSSL_AES_COUNTER */
|
/* #define WOLFSSL_AES_COUNTER */
|
||||||
|
|
||||||
@@ -125,7 +127,7 @@
|
|||||||
/* #define CUSTOM_SLOT_ALLOCATION */
|
/* #define CUSTOM_SLOT_ALLOCATION */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* rsa primitive specific definition */
|
/* RSA primitive specific definition */
|
||||||
#if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE)
|
#if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE)
|
||||||
/* Define USE_FAST_MATH and SMALL_STACK */
|
/* Define USE_FAST_MATH and SMALL_STACK */
|
||||||
#define ESP32_USE_RSA_PRIMITIVE
|
#define ESP32_USE_RSA_PRIMITIVE
|
||||||
@@ -255,8 +257,34 @@
|
|||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||||
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
||||||
|
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
|
||||||
|
defined(CONFIG_IDF_TARGET_ESP8684)
|
||||||
|
/* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
|
||||||
|
* single QFN 4x4 mm package. Out of released documentation, Technical
|
||||||
|
* Reference Manual as well as ESP-IDF Programming Guide is applicable
|
||||||
|
* to both ESP32-C2 and ESP8684.
|
||||||
|
*
|
||||||
|
* See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
|
||||||
|
|
||||||
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
||||||
|
/* #define NO_ESP32_CRYPT */
|
||||||
|
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||||
|
|
||||||
|
/* These are defined automatically in esp32-crypt.h, here for clarity */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
|
||||||
|
|
||||||
|
/* There's no AES or RSA/Math accelerator on the ESP32-C2
|
||||||
|
* Auto defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
|
||||||
|
/***** END CONFIG_IDF_TARGET_ESP32C2 *****/
|
||||||
|
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||||
|
/* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
|
||||||
|
|
||||||
/* #define NO_ESP32_CRYPT */
|
/* #define NO_ESP32_CRYPT */
|
||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||||
@@ -303,15 +331,6 @@
|
|||||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||||
/***** END CONFIG_IDF_TARGET_ESP266 *****/
|
/***** END CONFIG_IDF_TARGET_ESP266 *****/
|
||||||
|
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP8684)
|
|
||||||
/* There's no Hardware Acceleration available on ESP8684 */
|
|
||||||
#define NO_ESP32_CRYPT
|
|
||||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
|
||||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
|
||||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
|
||||||
/***** END CONFIG_IDF_TARGET_ESP8684 *****/
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* Anything else encountered, disable HW accleration */
|
/* Anything else encountered, disable HW accleration */
|
||||||
#define NO_ESP32_CRYPT
|
#define NO_ESP32_CRYPT
|
||||||
@@ -327,6 +346,7 @@
|
|||||||
#define DEBUG_WOLFSSL_VERBOSE
|
#define DEBUG_WOLFSSL_VERBOSE
|
||||||
#define DEBUG_WOLFSSL_SHA_MUTEX
|
#define DEBUG_WOLFSSL_SHA_MUTEX
|
||||||
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
||||||
|
#define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
|
||||||
#define NO_RECOVER_SOFTWARE_CALC
|
#define NO_RECOVER_SOFTWARE_CALC
|
||||||
#define WOLFSSL_TEST_STRAY 1
|
#define WOLFSSL_TEST_STRAY 1
|
||||||
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
||||||
|
@@ -38,7 +38,7 @@ void app_main(void)
|
|||||||
esp_ShowExtendedSystemInfo();
|
esp_ShowExtendedSystemInfo();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WOLFSSL_HW_METRICS_DISABLED /* Remove _DISABLED upon #6990 Merge */
|
#if defined(WOLFSSL_HW_METRICS) && defined(WOLFSSL_HAS_METRICS)
|
||||||
esp_hw_show_metrics();
|
esp_hw_show_metrics();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -19,54 +19,9 @@ cmake_minimum_required(VERSION 3.16)
|
|||||||
# Linux: ~/workspace
|
# Linux: ~/workspace
|
||||||
# Windows: C:\workspace
|
# Windows: C:\workspace
|
||||||
#
|
#
|
||||||
if(WIN32)
|
|
||||||
# Windows-specific configuration here
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WINDOWS")
|
|
||||||
message("Detected Windows")
|
|
||||||
endif()
|
|
||||||
if(CMAKE_HOST_UNIX)
|
|
||||||
message("Detected UNIX")
|
|
||||||
endif()
|
|
||||||
if(APPLE)
|
|
||||||
message("Detected APPLE")
|
|
||||||
endif()
|
|
||||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND EXISTS "/proc/sys/fs/binfmt_misc/WSLInterop")
|
|
||||||
# Windows-specific configuration here
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_WSL")
|
|
||||||
message("Detected WSL")
|
|
||||||
endif()
|
|
||||||
if(CMAKE_HOST_UNIX AND (NOT APPLE) AND (NOT WIN32))
|
|
||||||
# Windows-specific configuration here
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_LINUX")
|
|
||||||
message("Detected Linux")
|
|
||||||
endif()
|
|
||||||
if(APPLE)
|
|
||||||
# Windows-specific configuration here
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_CMAKE_SYSTEM_NAME_APPLE")
|
|
||||||
message("Detected Apple")
|
|
||||||
endif()
|
|
||||||
# End optional WOLFSSL_CMAKE_SYSTEM_NAME
|
|
||||||
|
|
||||||
# Check that there are not conflicting wolfSSL components
|
# Optionally specify a location for wolfSSL component source code
|
||||||
# The ESP Registry Component will be in ./managed_components/wolfssl__wolfssl
|
# set(WOLFSSL_ROOT "c:/test/blogtest/wolfssl" )
|
||||||
# The local component wolfSSL directory will be in ./components/wolfssl
|
|
||||||
if( EXISTS "${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" AND EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl" )
|
|
||||||
# These exclude statements don't seem to be honored by the $ENV{IDF_PATH}/tools/cmake/project.cmake'
|
|
||||||
# add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl" EXCLUDE_FROM_ALL)
|
|
||||||
# add_subdirectory("${CMAKE_HOME_DIRECTORY}/managed_components/wolfssl__wolfssl/include" EXCLUDE_FROM_ALL)
|
|
||||||
# So we'll error out and let the user decide how to proceed:
|
|
||||||
message(WARNING "\nFound wolfSSL components in\n"
|
|
||||||
"./managed_components/wolfssl__wolfssl\n"
|
|
||||||
"and\n"
|
|
||||||
"./components/wolfssl\n"
|
|
||||||
"in project directory: \n"
|
|
||||||
"${CMAKE_HOME_DIRECTORY}")
|
|
||||||
message(FATAL_ERROR "\nPlease use either the ESP Registry Managed Component or the wolfSSL component directory but not both.\n"
|
|
||||||
"If removing the ./managed_components/wolfssl__wolfssl directory, remember to also remove "
|
|
||||||
"or rename the idf_component.yml file typically found in ./main/")
|
|
||||||
else()
|
|
||||||
message(STATUS "No conflicting wolfSSL components found.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
|
||||||
|
@@ -92,14 +92,15 @@
|
|||||||
/* when you want to use SHA3 */
|
/* when you want to use SHA3 */
|
||||||
#define WOLFSSL_SHA3
|
#define WOLFSSL_SHA3
|
||||||
|
|
||||||
#define HAVE_ED25519 /* ED25519 requires SHA512 */
|
/* ED25519 requires SHA512 */
|
||||||
|
#define HAVE_ED25519
|
||||||
|
|
||||||
#define HAVE_ECC
|
#define HAVE_ECC
|
||||||
#define HAVE_CURVE25519
|
#define HAVE_CURVE25519
|
||||||
#define CURVE25519_SMALL
|
#define CURVE25519_SMALL
|
||||||
#define HAVE_ED25519
|
#define HAVE_ED25519
|
||||||
|
|
||||||
#define OPENSSL_EXTRA
|
#define OPENSSL_EXTRA
|
||||||
/* when you want to use pkcs7 */
|
/* when you want to use pkcs7 */
|
||||||
/* #define HAVE_PKCS7 */
|
/* #define HAVE_PKCS7 */
|
||||||
|
|
||||||
@@ -157,9 +158,10 @@
|
|||||||
|
|
||||||
|
|
||||||
/* adjust wait-timeout count if you see timeout in RSA HW acceleration */
|
/* adjust wait-timeout count if you see timeout in RSA HW acceleration */
|
||||||
#define ESP_RSA_TIMEOUT_CNT 0x249F00
|
#define ESP_RSA_TIMEOUT_CNT 0x349F00
|
||||||
|
|
||||||
#define HASH_SIZE_LIMIT /* for test.c */
|
/* hash limit for test.c */
|
||||||
|
#define HASH_SIZE_LIMIT
|
||||||
|
|
||||||
/* USE_FAST_MATH is default */
|
/* USE_FAST_MATH is default */
|
||||||
#define USE_FAST_MATH
|
#define USE_FAST_MATH
|
||||||
@@ -168,6 +170,7 @@
|
|||||||
/* #undef USE_FAST_MATH */
|
/* #undef USE_FAST_MATH */
|
||||||
/* #define SP_MATH */
|
/* #define SP_MATH */
|
||||||
/* #define WOLFSSL_SP_MATH_ALL */
|
/* #define WOLFSSL_SP_MATH_ALL */
|
||||||
|
/* #define WOLFSSL_SP_RISCV32 */
|
||||||
|
|
||||||
/***** Use Integer Heap Math *****/
|
/***** Use Integer Heap Math *****/
|
||||||
/* #undef USE_FAST_MATH */
|
/* #undef USE_FAST_MATH */
|
||||||
@@ -255,8 +258,34 @@
|
|||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||||
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
||||||
|
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
|
||||||
|
defined(CONFIG_IDF_TARGET_ESP8684)
|
||||||
|
/* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
|
||||||
|
* single QFN 4x4 mm package. Out of released documentation, Technical
|
||||||
|
* Reference Manual as well as ESP-IDF Programming Guide is applicable
|
||||||
|
* to both ESP32-C2 and ESP8684.
|
||||||
|
*
|
||||||
|
* See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
|
||||||
|
|
||||||
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
||||||
|
/* #define NO_ESP32_CRYPT */
|
||||||
|
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||||
|
|
||||||
|
/* These are defined automatically in esp32-crypt.h, here for clarity */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
|
||||||
|
|
||||||
|
/* There's no AES or RSA/Math accelerator on the ESP32-C2
|
||||||
|
* Auto defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
|
||||||
|
/***** END CONFIG_IDF_TARGET_ESP32C2 *****/
|
||||||
|
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||||
|
/* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
|
||||||
|
|
||||||
/* #define NO_ESP32_CRYPT */
|
/* #define NO_ESP32_CRYPT */
|
||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||||
@@ -327,6 +356,7 @@
|
|||||||
#define DEBUG_WOLFSSL_VERBOSE
|
#define DEBUG_WOLFSSL_VERBOSE
|
||||||
#define DEBUG_WOLFSSL_SHA_MUTEX
|
#define DEBUG_WOLFSSL_SHA_MUTEX
|
||||||
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
||||||
|
#define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
|
||||||
#define NO_RECOVER_SOFTWARE_CALC
|
#define NO_RECOVER_SOFTWARE_CALC
|
||||||
#define WOLFSSL_TEST_STRAY 1
|
#define WOLFSSL_TEST_STRAY 1
|
||||||
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
||||||
@@ -335,12 +365,16 @@
|
|||||||
#define ESP_DISABLE_HW_TASK_LOCK
|
#define ESP_DISABLE_HW_TASK_LOCK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WOLFSSL_ESPIDF_ERROR_PAUSE /* Pause in a loop rather than exit. */
|
/* Pause in a loop rather than exit. */
|
||||||
|
#define WOLFSSL_ESPIDF_ERROR_PAUSE
|
||||||
|
|
||||||
#define WOLFSSL_HW_METRICS
|
#define WOLFSSL_HW_METRICS
|
||||||
|
|
||||||
/* #define HASH_SIZE_LIMIT */ /* for test.c */
|
/* for test.c */
|
||||||
|
/* #define HASH_SIZE_LIMIT */
|
||||||
|
|
||||||
/* #define NO_HW_MATH_TEST */ /* Optionall turn off HW math checks */
|
/* Optionally turn off HW math checks */
|
||||||
|
/* #define NO_HW_MATH_TEST */
|
||||||
|
|
||||||
/* Optionally include alternate HW test library: alt_hw_test.h */
|
/* Optionally include alternate HW test library: alt_hw_test.h */
|
||||||
/* When enabling, the ./components/wolfssl/CMakeLists.txt file
|
/* When enabling, the ./components/wolfssl/CMakeLists.txt file
|
||||||
@@ -362,7 +396,6 @@
|
|||||||
** [Z = X * Y mod M] in esp_mp_mulmod() */
|
** [Z = X * Y mod M] in esp_mp_mulmod() */
|
||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||||
|
|
||||||
|
|
||||||
#define WOLFSSL_PUBLIC_MP /* used by benchmark */
|
#define WOLFSSL_PUBLIC_MP /* used by benchmark */
|
||||||
#define USE_CERT_BUFFERS_2048
|
#define USE_CERT_BUFFERS_2048
|
||||||
|
|
||||||
@@ -406,3 +439,12 @@
|
|||||||
#define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
|
#define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
|
||||||
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
|
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* See settings.h for some of the possible hardening options:
|
||||||
|
*
|
||||||
|
* #define NO_ESPIDF_DEFAULT
|
||||||
|
* #define WC_NO_CACHE_RESISTANT
|
||||||
|
* #define WC_AES_BITSLICED
|
||||||
|
* #define HAVE_AES_ECB
|
||||||
|
* #define HAVE_AES_DIRECT
|
||||||
|
*/
|
||||||
|
@@ -29,7 +29,8 @@
|
|||||||
#include <wolfssl/version.h>
|
#include <wolfssl/version.h>
|
||||||
#include "wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h"
|
#include "wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h"
|
||||||
#ifndef WOLFSSL_ESPIDF
|
#ifndef WOLFSSL_ESPIDF
|
||||||
#warning "problem with wolfSSL user_settings. Check components/wolfssl/include"
|
#warning "Problem with wolfSSL user_settings."
|
||||||
|
#warning "Check components/wolfssl/include"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <wolfssl/wolfcrypt/types.h>
|
#include <wolfssl/wolfcrypt/types.h>
|
||||||
|
@@ -255,8 +255,34 @@
|
|||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||||
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
||||||
|
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
|
||||||
|
defined(CONFIG_IDF_TARGET_ESP8684)
|
||||||
|
/* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
|
||||||
|
* single QFN 4x4 mm package. Out of released documentation, Technical
|
||||||
|
* Reference Manual as well as ESP-IDF Programming Guide is applicable
|
||||||
|
* to both ESP32-C2 and ESP8684.
|
||||||
|
*
|
||||||
|
* See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
|
||||||
|
|
||||||
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
||||||
|
/* #define NO_ESP32_CRYPT */
|
||||||
|
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||||
|
|
||||||
|
/* These are defined automatically in esp32-crypt.h, here for clarity */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
|
||||||
|
|
||||||
|
/* There's no AES or RSA/Math accelerator on the ESP32-C2
|
||||||
|
* Auto defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
|
||||||
|
/***** END CONFIG_IDF_TARGET_ESP32C2 *****/
|
||||||
|
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||||
|
/* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
|
||||||
|
|
||||||
/* #define NO_ESP32_CRYPT */
|
/* #define NO_ESP32_CRYPT */
|
||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||||
@@ -304,14 +330,6 @@
|
|||||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||||
/***** END CONFIG_IDF_TARGET_ESP266 *****/
|
/***** END CONFIG_IDF_TARGET_ESP266 *****/
|
||||||
|
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP8684)
|
|
||||||
/* There's no Hardware Acceleration available on ESP8684 */
|
|
||||||
#define NO_ESP32_CRYPT
|
|
||||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
|
||||||
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
|
||||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
|
||||||
/***** END CONFIG_IDF_TARGET_ESP8684 *****/
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* Anything else encountered, disable HW accleration */
|
/* Anything else encountered, disable HW accleration */
|
||||||
#define NO_ESP32_CRYPT
|
#define NO_ESP32_CRYPT
|
||||||
@@ -327,6 +345,7 @@
|
|||||||
#define DEBUG_WOLFSSL_VERBOSE
|
#define DEBUG_WOLFSSL_VERBOSE
|
||||||
#define DEBUG_WOLFSSL_SHA_MUTEX
|
#define DEBUG_WOLFSSL_SHA_MUTEX
|
||||||
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
||||||
|
#define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
|
||||||
#define NO_RECOVER_SOFTWARE_CALC
|
#define NO_RECOVER_SOFTWARE_CALC
|
||||||
#define WOLFSSL_TEST_STRAY 1
|
#define WOLFSSL_TEST_STRAY 1
|
||||||
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
||||||
|
@@ -1,9 +1,15 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config TARGET_HOST
|
config WOLFSSL_TARGET_HOST
|
||||||
string "Target host"
|
string "Target host"
|
||||||
default "127.0.01.1"
|
default "127.0.0.1"
|
||||||
help
|
help
|
||||||
host address for the example to connect
|
host address for the example to connect
|
||||||
|
|
||||||
|
config WOLFSSL_TARGET_PORT
|
||||||
|
int "Target port"
|
||||||
|
default 11111
|
||||||
|
help
|
||||||
|
host port for the example to connect
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@@ -356,7 +356,7 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
|
|||||||
|
|
||||||
/* Fill in the server address */
|
/* Fill in the server address */
|
||||||
servAddr.sin_family = AF_INET; /* using IPv4 */
|
servAddr.sin_family = AF_INET; /* using IPv4 */
|
||||||
servAddr.sin_port = htons(DEFAULT_PORT); /* on DEFAULT_PORT */
|
servAddr.sin_port = htons(TLS_SMP_DEFAULT_PORT); /* on DEFAULT_PORT */
|
||||||
|
|
||||||
if (*ch >= '1' && *ch <= '9') {
|
if (*ch >= '1' && *ch <= '9') {
|
||||||
/* Get the server IPv4 address from the command line call */
|
/* Get the server IPv4 address from the command line call */
|
||||||
@@ -375,7 +375,7 @@ WOLFSSL_ESP_TASK tls_smp_client_task(void* args)
|
|||||||
sprintf(buff,
|
sprintf(buff,
|
||||||
"Connecting to server....%s(port:%d)",
|
"Connecting to server....%s(port:%d)",
|
||||||
TLS_SMP_TARGET_HOST,
|
TLS_SMP_TARGET_HOST,
|
||||||
DEFAULT_PORT);
|
TLS_SMP_DEFAULT_PORT);
|
||||||
WOLFSSL_MSG(buff);
|
WOLFSSL_MSG(buff);
|
||||||
printf("%s\n", buff);
|
printf("%s\n", buff);
|
||||||
|
|
||||||
|
@@ -23,10 +23,20 @@
|
|||||||
|
|
||||||
#include <wolfssl/wolfcrypt/settings.h>
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
#include <wolfssl/ssl.h>
|
#include <wolfssl/ssl.h>
|
||||||
#include "user_settings.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
#define TLS_SMP_TARGET_HOST "192.168.1.125"
|
/* See main/Kconfig.projbuild for default configuration settings */
|
||||||
#define DEFAULT_PORT 11111
|
#ifdef CONFIG_WOLFSSL_TARGET_HOST
|
||||||
|
#define TLS_SMP_TARGET_HOST CONFIG_WOLFSSL_TARGET_HOST
|
||||||
|
#else
|
||||||
|
#define TLS_SMP_TARGET_HOST "192.168.1.38"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_WOLFSSL_TARGET_PORT
|
||||||
|
#define TLS_SMP_DEFAULT_PORT CONFIG_WOLFSSL_TARGET_PORT
|
||||||
|
#else
|
||||||
|
#define TLS_SMP_DEFAULT_PORT 11111
|
||||||
|
#endif
|
||||||
|
|
||||||
#define TLS_SMP_CLIENT_TASK_NAME "tls_client_example"
|
#define TLS_SMP_CLIENT_TASK_NAME "tls_client_example"
|
||||||
#define TLS_SMP_CLIENT_TASK_WORDS 22240
|
#define TLS_SMP_CLIENT_TASK_WORDS 22240
|
||||||
|
@@ -31,7 +31,8 @@
|
|||||||
#include <user_settings.h>
|
#include <user_settings.h>
|
||||||
#include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
|
#include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
|
||||||
#ifndef WOLFSSL_ESPIDF
|
#ifndef WOLFSSL_ESPIDF
|
||||||
#warning "problem with wolfSSL user_settings. Check components/wolfssl/include"
|
#warning "Problem with wolfSSL user_settings."
|
||||||
|
#warning "Check components/wolfssl/include"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* this project */
|
/* this project */
|
||||||
@@ -162,8 +163,18 @@ void app_main(void)
|
|||||||
ESP_ERROR_CHECK(nvs_flash_init());
|
ESP_ERROR_CHECK(nvs_flash_init());
|
||||||
|
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32H2)
|
#if defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||||
ESP_LOGE(TAG, "There's no WiFi on ESP32-H2. ");
|
ESP_LOGE(TAG, "There's no WiFi on ESP32-H2.");
|
||||||
#else
|
#else
|
||||||
|
#ifdef CONFIG_EXAMPLE_WIFI_SSID
|
||||||
|
if (XSTRCMP(CONFIG_EXAMPLE_WIFI_SSID, "myssid") == 0) {
|
||||||
|
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID is myssid.");
|
||||||
|
ESP_LOGW(TAG, " Do you have a WiFi AP called myssid, or ");
|
||||||
|
ESP_LOGW(TAG, " did you forget the ESP-IDF configuration?");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define CONFIG_EXAMPLE_WIFI_SSID "myssid"
|
||||||
|
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID not defined.");
|
||||||
|
#endif
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
ESP_ERROR_CHECK(esp_netif_init());
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
ESP_ERROR_CHECK(example_connect());
|
ESP_ERROR_CHECK(example_connect());
|
||||||
|
@@ -20,18 +20,20 @@
|
|||||||
*/
|
*/
|
||||||
#include "wifi_connect.h"
|
#include "wifi_connect.h"
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include <freertos/FreeRTOS.h>
|
||||||
#include "freertos/task.h"
|
#include <freertos/task.h>
|
||||||
#include "freertos/event_groups.h"
|
#include <freertos/event_groups.h>
|
||||||
#include <esp_wifi.h>
|
#include <esp_wifi.h>
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
|
|
||||||
/* wolfSSL */
|
/* wolfSSL */
|
||||||
#include <wolfssl/wolfcrypt/settings.h>
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
#include <user_settings.h>
|
#include "user_settings.h"
|
||||||
#include <wolfssl/version.h>
|
#include <wolfssl/version.h>
|
||||||
|
#include <wolfssl/wolfcrypt/types.h>
|
||||||
#ifndef WOLFSSL_ESPIDF
|
#ifndef WOLFSSL_ESPIDF
|
||||||
#warning "problem with wolfSSL user_settings. Check components/wolfssl/include"
|
#warning "Problem with wolfSSL user_settings."
|
||||||
|
#warning "Check components/wolfssl/include"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 5
|
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||||
@@ -166,7 +168,8 @@ static void event_handler(void* arg,
|
|||||||
|
|
||||||
int wifi_init_sta(void)
|
int wifi_init_sta(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = ESP_OK;
|
||||||
|
|
||||||
s_wifi_event_group = xEventGroupCreate();
|
s_wifi_event_group = xEventGroupCreate();
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
ESP_ERROR_CHECK(esp_netif_init());
|
||||||
@@ -208,6 +211,17 @@ int wifi_init_sta(void)
|
|||||||
};
|
};
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
|
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
|
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLE_WIFI_SSID
|
||||||
|
if (XSTRCMP(CONFIG_EXAMPLE_WIFI_SSID, "myssid") == 0) {
|
||||||
|
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID is \"myssid\".");
|
||||||
|
ESP_LOGW(TAG, " Do you have a WiFi AP called \"myssid\", ");
|
||||||
|
ESP_LOGW(TAG, " or did you forget the ESP-IDF configuration?");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID not defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_start() );
|
ESP_ERROR_CHECK(esp_wifi_start() );
|
||||||
|
|
||||||
ESP_LOGI(TAG, "wifi_init_sta finished.");
|
ESP_LOGI(TAG, "wifi_init_sta finished.");
|
||||||
|
@@ -255,8 +255,34 @@
|
|||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||||
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
||||||
|
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
|
||||||
|
defined(CONFIG_IDF_TARGET_ESP8684)
|
||||||
|
/* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
|
||||||
|
* single QFN 4x4 mm package. Out of released documentation, Technical
|
||||||
|
* Reference Manual as well as ESP-IDF Programming Guide is applicable
|
||||||
|
* to both ESP32-C2 and ESP8684.
|
||||||
|
*
|
||||||
|
* See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
|
||||||
|
|
||||||
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
||||||
|
/* #define NO_ESP32_CRYPT */
|
||||||
|
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||||
|
|
||||||
|
/* These are defined automatically in esp32-crypt.h, here for clarity */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
|
||||||
|
|
||||||
|
/* There's no AES or RSA/Math accelerator on the ESP32-C2
|
||||||
|
* Auto defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
|
||||||
|
/***** END CONFIG_IDF_TARGET_ESP32C2 *****/
|
||||||
|
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||||
|
/* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
|
||||||
|
|
||||||
/* #define NO_ESP32_CRYPT */
|
/* #define NO_ESP32_CRYPT */
|
||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||||
@@ -327,6 +353,7 @@
|
|||||||
#define DEBUG_WOLFSSL_VERBOSE
|
#define DEBUG_WOLFSSL_VERBOSE
|
||||||
#define DEBUG_WOLFSSL_SHA_MUTEX
|
#define DEBUG_WOLFSSL_SHA_MUTEX
|
||||||
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
||||||
|
#define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
|
||||||
#define NO_RECOVER_SOFTWARE_CALC
|
#define NO_RECOVER_SOFTWARE_CALC
|
||||||
#define WOLFSSL_TEST_STRAY 1
|
#define WOLFSSL_TEST_STRAY 1
|
||||||
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
||||||
|
@@ -48,7 +48,7 @@ idf_component_register(SRCS main.c
|
|||||||
wifi_connect.c
|
wifi_connect.c
|
||||||
time_helper.c
|
time_helper.c
|
||||||
server-tls.c
|
server-tls.c
|
||||||
INCLUDE_DIRS "."
|
INCLUDE_DIRS "."
|
||||||
"./include")
|
"./include")
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@@ -1,29 +1,9 @@
|
|||||||
menu "Example Configuration"
|
menu "Example Configuration"
|
||||||
|
|
||||||
config BENCH_ARGV
|
config WOLFSSL_TARGET_PORT
|
||||||
string "Arguments for benchmark test"
|
int "Target port"
|
||||||
default "-lng 0"
|
default 11111
|
||||||
help
|
help
|
||||||
-? <num> Help, print this usage
|
Host listening port for the example to connect.
|
||||||
0: English, 1: Japanese
|
|
||||||
-csv Print terminal output in csv format
|
|
||||||
-base10 Display bytes as power of 10 (eg 1 kB = 1000 Bytes)
|
|
||||||
-no_aad No additional authentication data passed.
|
|
||||||
-dgst_full Full digest operation performed.
|
|
||||||
-rsa_sign Measure RSA sign/verify instead of encrypt/decrypt.
|
|
||||||
-<alg> Algorithm to benchmark. Available algorithms include:
|
|
||||||
cipher aes-cbc aes-gcm chacha20 chacha20-poly1305
|
|
||||||
digest md5 poly1305 sha sha2 sha224 sha256 sha384 sha512 sha3
|
|
||||||
sha3-224 sha3-256 sha3-384 sha3-512
|
|
||||||
mac hmac hmac-md5 hmac-sha hmac-sha224 hmac-sha256 hmac-sha384
|
|
||||||
hmac-sha512
|
|
||||||
asym rsa rsa-sz dh ecc-kg ecc
|
|
||||||
other rng
|
|
||||||
-lng <num> Display benchmark result by specified language.
|
|
||||||
0: English, 1: Japanese
|
|
||||||
<num> Size of block in bytes
|
|
||||||
|
|
||||||
e.g -lng 1
|
|
||||||
e.g sha
|
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
@@ -21,17 +21,9 @@
|
|||||||
#ifndef _SERVER_TLS_
|
#ifndef _SERVER_TLS_
|
||||||
#define _SERVER_TLS_
|
#define _SERVER_TLS_
|
||||||
|
|
||||||
#define DEFAULT_PORT 11111
|
#include <wolfssl/wolfcrypt/settings.h> /* includes wolfSSL user-settings.h */
|
||||||
|
|
||||||
#define TLS_SMP_CLIENT_TASK_NAME "tls_client_example"
|
|
||||||
#define TLS_SMP_CLIENT_TASK_WORDS 10240
|
|
||||||
#define TLS_SMP_CLIENT_TASK_PRIORITY 8
|
|
||||||
|
|
||||||
#define TLS_SMP_TARGET_HOST "192.168.25.109"
|
|
||||||
|
|
||||||
#include <wolfssl/wolfcrypt/settings.h>
|
|
||||||
#include <wolfssl/ssl.h>
|
#include <wolfssl/ssl.h>
|
||||||
#include "user_settings.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
#if defined(SINGLE_THREADED)
|
#if defined(SINGLE_THREADED)
|
||||||
#define WOLFSSL_ESP_TASK int
|
#define WOLFSSL_ESP_TASK int
|
||||||
@@ -40,6 +32,12 @@
|
|||||||
#define WOLFSSL_ESP_TASK void
|
#define WOLFSSL_ESP_TASK void
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_WOLFSSL_TARGET_PORT
|
||||||
|
#define TLS_SMP_DEFAULT_PORT CONFIG_WOLFSSL_TARGET_PORT
|
||||||
|
#else
|
||||||
|
#define TLS_SMP_DEFAULT_PORT 11111
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int port;
|
int port;
|
||||||
int loops;
|
int loops;
|
||||||
|
@@ -27,8 +27,6 @@
|
|||||||
/* ESP lwip */
|
/* ESP lwip */
|
||||||
#define EXAMPLE_ESP_MAXIMUM_RETRY CONFIG_ESP_MAXIMUM_RETRY
|
#define EXAMPLE_ESP_MAXIMUM_RETRY CONFIG_ESP_MAXIMUM_RETRY
|
||||||
|
|
||||||
#define DEFAULT_PORT 11111
|
|
||||||
|
|
||||||
#define TLS_SMP_SERVER_TASK_NAME "tls_sever_example"
|
#define TLS_SMP_SERVER_TASK_NAME "tls_sever_example"
|
||||||
#define TLS_SMP_SERVER_TASK_WORDS 22240
|
#define TLS_SMP_SERVER_TASK_WORDS 22240
|
||||||
#define TLS_SMP_SERVER_TASK_PRIORITY 8
|
#define TLS_SMP_SERVER_TASK_PRIORITY 8
|
||||||
@@ -66,7 +64,7 @@
|
|||||||
#else
|
#else
|
||||||
#warning "did not detect environment. using ~/my_private_config.h"
|
#warning "did not detect environment. using ~/my_private_config.h"
|
||||||
#include "~/my_private_config.h"
|
#include "~/my_private_config.h"
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -27,11 +27,11 @@
|
|||||||
#include <esp_event.h>
|
#include <esp_event.h>
|
||||||
|
|
||||||
/* wolfSSL */
|
/* wolfSSL */
|
||||||
#include <wolfssl/wolfcrypt/settings.h>
|
#include <wolfssl/wolfcrypt/settings.h> /* includes wolfSSL user-settings.h */
|
||||||
#include <user_settings.h>
|
|
||||||
#include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
|
#include <wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h>
|
||||||
#ifndef WOLFSSL_ESPIDF
|
#ifndef WOLFSSL_ESPIDF
|
||||||
#warning "problem with wolfSSL user_settings. Check components/wolfssl/include"
|
#warning "Problem with wolfSSL user_settings."
|
||||||
|
#warning "Check components/wolfssl/include"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* this project */
|
/* this project */
|
||||||
@@ -162,8 +162,18 @@ void app_main(void)
|
|||||||
ESP_ERROR_CHECK(nvs_flash_init());
|
ESP_ERROR_CHECK(nvs_flash_init());
|
||||||
|
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32H2)
|
#if defined(CONFIG_IDF_TARGET_ESP32H2)
|
||||||
ESP_LOGE(TAG, "There's no WiFi on ESP32-H2. ");
|
ESP_LOGE(TAG, "There's no WiFi on ESP32-H2.");
|
||||||
#else
|
#else
|
||||||
|
#ifdef CONFIG_EXAMPLE_WIFI_SSID
|
||||||
|
if (XSTRCMP(CONFIG_EXAMPLE_WIFI_SSID, "myssid") == 0) {
|
||||||
|
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID is myssid.");
|
||||||
|
ESP_LOGW(TAG, " Do you have a WiFi AP called myssid, or ");
|
||||||
|
ESP_LOGW(TAG, " did you forget the ESP-IDF configuration?");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#define CONFIG_EXAMPLE_WIFI_SSID "myssid"
|
||||||
|
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID not defined.");
|
||||||
|
#endif
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
ESP_ERROR_CHECK(esp_netif_init());
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
ESP_ERROR_CHECK(example_connect());
|
ESP_ERROR_CHECK(example_connect());
|
||||||
|
@@ -279,7 +279,7 @@ WOLFSSL_ESP_TASK tls_smp_server_task(void *args)
|
|||||||
memset(&servAddr, 0, sizeof(servAddr));
|
memset(&servAddr, 0, sizeof(servAddr));
|
||||||
/* Fill in the server address */
|
/* Fill in the server address */
|
||||||
servAddr.sin_family = AF_INET; /* using IPv4 */
|
servAddr.sin_family = AF_INET; /* using IPv4 */
|
||||||
servAddr.sin_port = htons(DEFAULT_PORT); /* on DEFAULT_PORT */
|
servAddr.sin_port = htons(TLS_SMP_DEFAULT_PORT); /* on port */
|
||||||
servAddr.sin_addr.s_addr = INADDR_ANY; /* from anywhere */
|
servAddr.sin_addr.s_addr = INADDR_ANY; /* from anywhere */
|
||||||
|
|
||||||
/* Bind the server socket to our port */
|
/* Bind the server socket to our port */
|
||||||
@@ -372,7 +372,7 @@ WOLFSSL_ESP_TASK tls_smp_server_task(void *args)
|
|||||||
|
|
||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
|
|
||||||
return TLS_SMP_SERVER_TASK_RET;
|
return TLS_SMP_SERVER_TASK_RET;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SINGLE_THREADED)
|
#if defined(SINGLE_THREADED)
|
||||||
@@ -389,7 +389,7 @@ WOLFSSL_ESP_TASK tls_smp_server_init(void* args)
|
|||||||
int thisPort = 0;
|
int thisPort = 0;
|
||||||
int ret_i = 0; /* interim return result */
|
int ret_i = 0; /* interim return result */
|
||||||
if (thisPort == 0) {
|
if (thisPort == 0) {
|
||||||
thisPort = DEFAULT_PORT;
|
thisPort = TLS_SMP_DEFAULT_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4
|
#if ESP_IDF_VERSION_MAJOR >= 4
|
||||||
|
@@ -20,11 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* common Espressif time_helper v5.6.3.002 */
|
/* common Espressif time_helper v5.6.3.002 */
|
||||||
#include "esp_idf_version.h"
|
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "time_helper.h"
|
#include "time_helper.h"
|
||||||
|
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
|
#include <esp_idf_version.h>
|
||||||
|
|
||||||
#if defined(ESP_IDF_VERSION_MAJOR) && defined(ESP_IDF_VERSION_MINOR)
|
#if defined(ESP_IDF_VERSION_MAJOR) && defined(ESP_IDF_VERSION_MINOR)
|
||||||
#if (ESP_IDF_VERSION_MAJOR == 5) && (ESP_IDF_VERSION_MINOR >= 1)
|
#if (ESP_IDF_VERSION_MAJOR == 5) && (ESP_IDF_VERSION_MINOR >= 1)
|
||||||
|
@@ -20,18 +20,19 @@
|
|||||||
*/
|
*/
|
||||||
#include "wifi_connect.h"
|
#include "wifi_connect.h"
|
||||||
|
|
||||||
#include "freertos/FreeRTOS.h"
|
#include <freertos/FreeRTOS.h>
|
||||||
#include "freertos/task.h"
|
#include <freertos/task.h>
|
||||||
#include "freertos/event_groups.h"
|
#include <freertos/event_groups.h>
|
||||||
#include <esp_wifi.h>
|
#include <esp_wifi.h>
|
||||||
#include <esp_log.h>
|
#include <esp_log.h>
|
||||||
|
|
||||||
/* wolfSSL */
|
/* wolfSSL */
|
||||||
#include <wolfssl/wolfcrypt/settings.h>
|
#include <wolfssl/wolfcrypt/settings.h>
|
||||||
#include <user_settings.h>
|
|
||||||
#include <wolfssl/version.h>
|
#include <wolfssl/version.h>
|
||||||
|
#include <wolfssl/wolfcrypt/types.h>
|
||||||
#ifndef WOLFSSL_ESPIDF
|
#ifndef WOLFSSL_ESPIDF
|
||||||
#warning "problem with wolfSSL user_settings. Check components/wolfssl/include"
|
#warning "Problem with wolfSSL user_settings."
|
||||||
|
#warning "Check components/wolfssl/include"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 5
|
#if ESP_IDF_VERSION_MAJOR >= 5
|
||||||
@@ -166,7 +167,8 @@ static void event_handler(void* arg,
|
|||||||
|
|
||||||
int wifi_init_sta(void)
|
int wifi_init_sta(void)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = ESP_OK;
|
||||||
|
|
||||||
s_wifi_event_group = xEventGroupCreate();
|
s_wifi_event_group = xEventGroupCreate();
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
ESP_ERROR_CHECK(esp_netif_init());
|
||||||
@@ -208,6 +210,17 @@ int wifi_init_sta(void)
|
|||||||
};
|
};
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
|
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
|
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
|
||||||
|
|
||||||
|
#ifdef CONFIG_EXAMPLE_WIFI_SSID
|
||||||
|
if (XSTRCMP(CONFIG_EXAMPLE_WIFI_SSID, "myssid") == 0) {
|
||||||
|
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID is \"myssid\".");
|
||||||
|
ESP_LOGW(TAG, " Do you have a WiFi AP called \"myssid\", ");
|
||||||
|
ESP_LOGW(TAG, " or did you forget the ESP-IDF configuration?");
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
ESP_LOGW(TAG, "WARNING: CONFIG_EXAMPLE_WIFI_SSID not defined.");
|
||||||
|
#endif
|
||||||
|
|
||||||
ESP_ERROR_CHECK(esp_wifi_start() );
|
ESP_ERROR_CHECK(esp_wifi_start() );
|
||||||
|
|
||||||
ESP_LOGI(TAG, "wifi_init_sta finished.");
|
ESP_LOGI(TAG, "wifi_init_sta finished.");
|
||||||
|
@@ -92,14 +92,15 @@
|
|||||||
/* when you want to use SHA3 */
|
/* when you want to use SHA3 */
|
||||||
#define WOLFSSL_SHA3
|
#define WOLFSSL_SHA3
|
||||||
|
|
||||||
#define HAVE_ED25519 /* ED25519 requires SHA512 */
|
/* ED25519 requires SHA512 */
|
||||||
|
#define HAVE_ED25519
|
||||||
|
|
||||||
#define HAVE_ECC
|
#define HAVE_ECC
|
||||||
#define HAVE_CURVE25519
|
#define HAVE_CURVE25519
|
||||||
#define CURVE25519_SMALL
|
#define CURVE25519_SMALL
|
||||||
#define HAVE_ED25519
|
#define HAVE_ED25519
|
||||||
|
|
||||||
#define OPENSSL_EXTRA
|
#define OPENSSL_EXTRA
|
||||||
/* when you want to use pkcs7 */
|
/* when you want to use pkcs7 */
|
||||||
/* #define HAVE_PKCS7 */
|
/* #define HAVE_PKCS7 */
|
||||||
|
|
||||||
@@ -159,7 +160,8 @@
|
|||||||
/* adjust wait-timeout count if you see timeout in RSA HW acceleration */
|
/* adjust wait-timeout count if you see timeout in RSA HW acceleration */
|
||||||
#define ESP_RSA_TIMEOUT_CNT 0x249F00
|
#define ESP_RSA_TIMEOUT_CNT 0x249F00
|
||||||
|
|
||||||
#define HASH_SIZE_LIMIT /* for test.c */
|
/* hash limit for test.c */
|
||||||
|
#define HASH_SIZE_LIMIT
|
||||||
|
|
||||||
/* USE_FAST_MATH is default */
|
/* USE_FAST_MATH is default */
|
||||||
#define USE_FAST_MATH
|
#define USE_FAST_MATH
|
||||||
@@ -168,6 +170,7 @@
|
|||||||
/* #undef USE_FAST_MATH */
|
/* #undef USE_FAST_MATH */
|
||||||
/* #define SP_MATH */
|
/* #define SP_MATH */
|
||||||
/* #define WOLFSSL_SP_MATH_ALL */
|
/* #define WOLFSSL_SP_MATH_ALL */
|
||||||
|
/* #define WOLFSSL_SP_RISCV32 */
|
||||||
|
|
||||||
/***** Use Integer Heap Math *****/
|
/***** Use Integer Heap Math *****/
|
||||||
/* #undef USE_FAST_MATH */
|
/* #undef USE_FAST_MATH */
|
||||||
@@ -255,8 +258,34 @@
|
|||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||||
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
||||||
|
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
|
||||||
|
defined(CONFIG_IDF_TARGET_ESP8684)
|
||||||
|
/* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
|
||||||
|
* single QFN 4x4 mm package. Out of released documentation, Technical
|
||||||
|
* Reference Manual as well as ESP-IDF Programming Guide is applicable
|
||||||
|
* to both ESP32-C2 and ESP8684.
|
||||||
|
*
|
||||||
|
* See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
|
||||||
|
|
||||||
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
||||||
|
/* #define NO_ESP32_CRYPT */
|
||||||
|
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||||
|
|
||||||
|
/* These are defined automatically in esp32-crypt.h, here for clarity */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
|
||||||
|
|
||||||
|
/* There's no AES or RSA/Math accelerator on the ESP32-C2
|
||||||
|
* Auto defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
|
||||||
|
/***** END CONFIG_IDF_TARGET_ESP32C2 *****/
|
||||||
|
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||||
|
/* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
|
||||||
|
|
||||||
/* #define NO_ESP32_CRYPT */
|
/* #define NO_ESP32_CRYPT */
|
||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||||
@@ -327,6 +356,7 @@
|
|||||||
#define DEBUG_WOLFSSL_VERBOSE
|
#define DEBUG_WOLFSSL_VERBOSE
|
||||||
#define DEBUG_WOLFSSL_SHA_MUTEX
|
#define DEBUG_WOLFSSL_SHA_MUTEX
|
||||||
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
||||||
|
#define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
|
||||||
#define NO_RECOVER_SOFTWARE_CALC
|
#define NO_RECOVER_SOFTWARE_CALC
|
||||||
#define WOLFSSL_TEST_STRAY 1
|
#define WOLFSSL_TEST_STRAY 1
|
||||||
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
||||||
@@ -335,12 +365,16 @@
|
|||||||
#define ESP_DISABLE_HW_TASK_LOCK
|
#define ESP_DISABLE_HW_TASK_LOCK
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WOLFSSL_ESPIDF_ERROR_PAUSE /* Pause in a loop rather than exit. */
|
/* Pause in a loop rather than exit. */
|
||||||
|
#define WOLFSSL_ESPIDF_ERROR_PAUSE
|
||||||
|
|
||||||
#define WOLFSSL_HW_METRICS
|
#define WOLFSSL_HW_METRICS
|
||||||
|
|
||||||
/* #define HASH_SIZE_LIMIT */ /* for test.c */
|
/* for test.c */
|
||||||
|
/* #define HASH_SIZE_LIMIT */
|
||||||
|
|
||||||
/* #define NO_HW_MATH_TEST */ /* Optionall turn off HW math checks */
|
/* Optionally turn off HW math checks */
|
||||||
|
/* #define NO_HW_MATH_TEST */
|
||||||
|
|
||||||
/* Optionally include alternate HW test library: alt_hw_test.h */
|
/* Optionally include alternate HW test library: alt_hw_test.h */
|
||||||
/* When enabling, the ./components/wolfssl/CMakeLists.txt file
|
/* When enabling, the ./components/wolfssl/CMakeLists.txt file
|
||||||
@@ -362,7 +396,6 @@
|
|||||||
** [Z = X * Y mod M] in esp_mp_mulmod() */
|
** [Z = X * Y mod M] in esp_mp_mulmod() */
|
||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||||
|
|
||||||
|
|
||||||
#define WOLFSSL_PUBLIC_MP /* used by benchmark */
|
#define WOLFSSL_PUBLIC_MP /* used by benchmark */
|
||||||
#define USE_CERT_BUFFERS_2048
|
#define USE_CERT_BUFFERS_2048
|
||||||
|
|
||||||
@@ -406,3 +439,12 @@
|
|||||||
#define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
|
#define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
|
||||||
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
|
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* See settings.h for some of the possible hardening options:
|
||||||
|
*
|
||||||
|
* #define NO_ESPIDF_DEFAULT
|
||||||
|
* #define WC_NO_CACHE_RESISTANT
|
||||||
|
* #define WC_AES_BITSLICED
|
||||||
|
* #define HAVE_AES_ECB
|
||||||
|
* #define HAVE_AES_DIRECT
|
||||||
|
*/
|
||||||
|
@@ -230,8 +230,7 @@ void app_main(void)
|
|||||||
*/
|
*/
|
||||||
int loops = 0;
|
int loops = 0;
|
||||||
do {
|
do {
|
||||||
/* Remove _DISABLED upon #6990 Merge: */
|
#if defined(WOLFSSL_HW_METRICS) && defined(WOLFSSL_HAS_METRICS)
|
||||||
#if defined(WOLFSSL_HW_METRICS_DISABLED)
|
|
||||||
esp_hw_show_metrics();
|
esp_hw_show_metrics();
|
||||||
#endif
|
#endif
|
||||||
ret = wolf_test_task();
|
ret = wolf_test_task();
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
# This tag is used to include this file in the ESP Component Registry:
|
||||||
|
|
||||||
#
|
#
|
||||||
# Default main stack size
|
# Default main stack size
|
||||||
#
|
#
|
||||||
|
@@ -19,23 +19,21 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#undef WOLFSSL_ESPIDF
|
/* This user_settings.h is for Espressif ESP-IDF */
|
||||||
#undef WOLFSSL_ESP32
|
#include <sdkconfig.h>
|
||||||
#undef WOLFSSL_ESPWROOM32SE
|
|
||||||
#undef WOLFSSL_ESP32
|
|
||||||
#undef WOLFSSL_ESP8266
|
|
||||||
|
|
||||||
/* The Espressif sdkconfig will have chipset info.
|
/* The Espressif sdkconfig will have chipset info.
|
||||||
**
|
**
|
||||||
** Possible values:
|
** Possible values:
|
||||||
**
|
**
|
||||||
** CONFIG_IDF_TARGET_ESP32
|
** CONFIG_IDF_TARGET_ESP32
|
||||||
|
** CONFIG_IDF_TARGET_ESP32S2
|
||||||
** CONFIG_IDF_TARGET_ESP32S3
|
** CONFIG_IDF_TARGET_ESP32S3
|
||||||
** CONFIG_IDF_TARGET_ESP32C3
|
** CONFIG_IDF_TARGET_ESP32C3
|
||||||
** CONFIG_IDF_TARGET_ESP32C6
|
** CONFIG_IDF_TARGET_ESP32C6
|
||||||
*/
|
*/
|
||||||
#include <sdkconfig.h>
|
|
||||||
|
|
||||||
|
#undef WOLFSSL_ESPIDF
|
||||||
#define WOLFSSL_ESPIDF
|
#define WOLFSSL_ESPIDF
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -45,10 +43,22 @@
|
|||||||
* WOLFSSL_ESPWROOM32SE
|
* WOLFSSL_ESPWROOM32SE
|
||||||
* WOLFSSL_ESP8266
|
* WOLFSSL_ESP8266
|
||||||
*/
|
*/
|
||||||
|
#undef WOLFSSL_ESPWROOM32SE
|
||||||
|
#undef WOLFSSL_ESP8266
|
||||||
|
#undef WOLFSSL_ESP32
|
||||||
|
|
||||||
#define WOLFSSL_ESP32
|
#define WOLFSSL_ESP32
|
||||||
|
|
||||||
/* #define DEBUG_WOLFSSL_VERBOSE */
|
/* optionally turn off SHA512/224 SHA512/256 */
|
||||||
|
/* #define WOLFSSL_NOSHA512_224 */
|
||||||
|
/* #define WOLFSSL_NOSHA512_256 */
|
||||||
|
|
||||||
|
/* when you want to use SINGLE THREAD. Note Default ESP-IDF is FreeRTOS */
|
||||||
|
/* #define SINGLE_THREADED */
|
||||||
|
|
||||||
|
/* When you don't want to use the old SHA */
|
||||||
|
/* #define NO_SHA */
|
||||||
|
/* #define NO_OLD_TLS */
|
||||||
|
|
||||||
#define BENCH_EMBEDDED
|
#define BENCH_EMBEDDED
|
||||||
#define USE_CERT_BUFFERS_2048
|
#define USE_CERT_BUFFERS_2048
|
||||||
@@ -61,22 +71,41 @@
|
|||||||
#define HAVE_AEAD
|
#define HAVE_AEAD
|
||||||
#define HAVE_SUPPORTED_CURVES
|
#define HAVE_SUPPORTED_CURVES
|
||||||
|
|
||||||
/* when you want to use SINGLE THREAD */
|
#define WOLFSSL_BENCHMARK_FIXED_UNITS_KB
|
||||||
/* #define SINGLE_THREADED */
|
|
||||||
#define NO_FILESYSTEM
|
#define NO_FILESYSTEM
|
||||||
|
|
||||||
|
#define NO_OLD_TLS
|
||||||
|
|
||||||
#define HAVE_AESGCM
|
#define HAVE_AESGCM
|
||||||
|
|
||||||
|
#define WOLFSSL_RIPEMD
|
||||||
|
/* when you want to use SHA224 */
|
||||||
|
#define WOLFSSL_SHA224
|
||||||
|
|
||||||
/* when you want to use SHA384 */
|
/* when you want to use SHA384 */
|
||||||
/* #define WOLFSSL_SHA384 */
|
#define WOLFSSL_SHA384
|
||||||
|
|
||||||
|
/* when you want to use SHA512 */
|
||||||
#define WOLFSSL_SHA512
|
#define WOLFSSL_SHA512
|
||||||
|
|
||||||
|
/* when you want to use SHA3 */
|
||||||
|
#define WOLFSSL_SHA3
|
||||||
|
|
||||||
|
#define HAVE_ED25519 /* ED25519 requires SHA512 */
|
||||||
|
|
||||||
#define HAVE_ECC
|
#define HAVE_ECC
|
||||||
#define HAVE_CURVE25519
|
#define HAVE_CURVE25519
|
||||||
#define CURVE25519_SMALL
|
#define CURVE25519_SMALL
|
||||||
#define HAVE_ED25519
|
#define HAVE_ED25519
|
||||||
|
|
||||||
|
/* Optional OPENSSL compatibility *
|
||||||
|
#define OPENSSL_EXTRA
|
||||||
/* when you want to use pkcs7 */
|
/* when you want to use pkcs7 */
|
||||||
/* #define HAVE_PKCS7 */
|
/* #define HAVE_PKCS7 */
|
||||||
|
|
||||||
|
#define HAVE_PKCS7
|
||||||
|
|
||||||
#if defined(HAVE_PKCS7)
|
#if defined(HAVE_PKCS7)
|
||||||
#define HAVE_AES_KEYWRAP
|
#define HAVE_AES_KEYWRAP
|
||||||
#define HAVE_X963_KDF
|
#define HAVE_X963_KDF
|
||||||
@@ -101,24 +130,25 @@
|
|||||||
#if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE)
|
#if defined(WOLFSSL_ESP32) || defined(WOLFSSL_ESPWROOM32SE)
|
||||||
/* Define USE_FAST_MATH and SMALL_STACK */
|
/* Define USE_FAST_MATH and SMALL_STACK */
|
||||||
#define ESP32_USE_RSA_PRIMITIVE
|
#define ESP32_USE_RSA_PRIMITIVE
|
||||||
/* threshold for performance adjustment for HW primitive use */
|
|
||||||
|
|
||||||
/* NOTE HW unreliable for small values on older original ESP32!*/
|
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||||
/* threshold for performance adjustment for HW primitive use */
|
|
||||||
/* X bits of G^X mod P greater than */
|
|
||||||
#undef ESP_RSA_EXPT_XBITS
|
|
||||||
#define ESP_RSA_EXPT_XBITS 32
|
|
||||||
|
|
||||||
/* X and Y of X * Y mod P greater than */
|
/* NOTE HW unreliable for small values! */
|
||||||
#undef ESP_RSA_MULM_BITS
|
/* threshold for performance adjustment for HW primitive use */
|
||||||
#define ESP_RSA_MULM_BITS 16
|
/* X bits of G^X mod P greater than */
|
||||||
|
#undef ESP_RSA_EXPT_XBITS
|
||||||
|
#define ESP_RSA_EXPT_XBITS 32
|
||||||
|
|
||||||
|
/* X and Y of X * Y mod P greater than */
|
||||||
|
#undef ESP_RSA_MULM_BITS
|
||||||
|
#define ESP_RSA_MULM_BITS 16
|
||||||
|
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* debug options */
|
#define RSA_LOW_MEM
|
||||||
/* #define DEBUG_WOLFSSL */
|
|
||||||
/* #define WOLFSSL_ESP32_CRYPT_DEBUG */
|
/* #define WOLFSSL_ATECC508A_DEBUG */
|
||||||
/* #define WOLFSSL_ATECC508A_DEBUG */
|
|
||||||
|
|
||||||
/* date/time */
|
/* date/time */
|
||||||
/* if it cannot adjust time in the device, */
|
/* if it cannot adjust time in the device, */
|
||||||
@@ -130,6 +160,58 @@
|
|||||||
/* adjust wait-timeout count if you see timeout in RSA HW acceleration */
|
/* adjust wait-timeout count if you see timeout in RSA HW acceleration */
|
||||||
#define ESP_RSA_TIMEOUT_CNT 0x249F00
|
#define ESP_RSA_TIMEOUT_CNT 0x249F00
|
||||||
|
|
||||||
|
#define HASH_SIZE_LIMIT /* for test.c */
|
||||||
|
|
||||||
|
/* USE_FAST_MATH is default */
|
||||||
|
#define USE_FAST_MATH
|
||||||
|
|
||||||
|
/***** Use SP_MATH *****/
|
||||||
|
/* #undef USE_FAST_MATH */
|
||||||
|
/* #define SP_MATH */
|
||||||
|
/* #define WOLFSSL_SP_MATH_ALL */
|
||||||
|
|
||||||
|
/***** Use Integer Heap Math *****/
|
||||||
|
/* #undef USE_FAST_MATH */
|
||||||
|
/* #define USE_INTEGER_HEAP_MATH */
|
||||||
|
|
||||||
|
|
||||||
|
#define WOLFSSL_SMALL_STACK
|
||||||
|
|
||||||
|
|
||||||
|
#define HAVE_VERSION_EXTENDED_INFO
|
||||||
|
/* #define HAVE_WC_INTROSPECTION */
|
||||||
|
|
||||||
|
#define HAVE_SESSION_TICKET
|
||||||
|
|
||||||
|
/* #define HAVE_HASHDRBG */
|
||||||
|
|
||||||
|
#define WOLFSSL_KEY_GEN
|
||||||
|
#define WOLFSSL_CERT_REQ
|
||||||
|
#define WOLFSSL_CERT_GEN
|
||||||
|
#define WOLFSSL_CERT_EXT
|
||||||
|
#define WOLFSSL_SYS_CA_CERTS
|
||||||
|
|
||||||
|
|
||||||
|
#define WOLFSSL_CERT_TEXT
|
||||||
|
|
||||||
|
#define WOLFSSL_ASN_TEMPLATE
|
||||||
|
|
||||||
|
/*
|
||||||
|
#undef WOLFSSL_KEY_GEN
|
||||||
|
#undef WOLFSSL_CERT_REQ
|
||||||
|
#undef WOLFSSL_CERT_GEN
|
||||||
|
#undef WOLFSSL_CERT_EXT
|
||||||
|
#undef WOLFSSL_SYS_CA_CERTS
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
--enable-keygen
|
||||||
|
--enable-certgen
|
||||||
|
--enable-certreq
|
||||||
|
--enable-certext
|
||||||
|
--enable-asn-template
|
||||||
|
*/
|
||||||
|
|
||||||
/* Default is HW enabled unless turned off.
|
/* Default is HW enabled unless turned off.
|
||||||
** Uncomment these lines to force SW instead of HW acceleration */
|
** Uncomment these lines to force SW instead of HW acceleration */
|
||||||
|
|
||||||
@@ -145,7 +227,7 @@
|
|||||||
|
|
||||||
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
/* These are defined automatically in esp32-crypt.h, here for clarity: */
|
||||||
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA224 /* no SHA224 HW on ESP32 */
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA224 /* no SHA224 HW on ESP32 */
|
||||||
/* end CONFIG_IDF_TARGET_ESP32 */
|
|
||||||
#undef ESP_RSA_MULM_BITS
|
#undef ESP_RSA_MULM_BITS
|
||||||
#define ESP_RSA_MULM_BITS 16 /* TODO add compile-time warning */
|
#define ESP_RSA_MULM_BITS 16 /* TODO add compile-time warning */
|
||||||
/***** END CONFIG_IDF_TARGET_ESP32 *****/
|
/***** END CONFIG_IDF_TARGET_ESP32 *****/
|
||||||
@@ -174,8 +256,34 @@
|
|||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||||
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
/***** END CONFIG_IDF_TARGET_ESP32S3 *****/
|
||||||
|
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
#elif defined(CONFIG_IDF_TARGET_ESP32C2) || \
|
||||||
|
defined(CONFIG_IDF_TARGET_ESP8684)
|
||||||
|
/* ESP8684 is essentially ESP32-C2 chip + flash embedded together in a
|
||||||
|
* single QFN 4x4 mm package. Out of released documentation, Technical
|
||||||
|
* Reference Manual as well as ESP-IDF Programming Guide is applicable
|
||||||
|
* to both ESP32-C2 and ESP8684.
|
||||||
|
*
|
||||||
|
* See: https://www.esp32.com/viewtopic.php?f=5&t=27926#:~:text=ESP8684%20is%20essentially%20ESP32%2DC2,both%20ESP32%2DC2%20and%20ESP8684. */
|
||||||
|
|
||||||
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
/* wolfSSL HW Acceleration supported on ESP32-C2. Uncomment to disable: */
|
||||||
|
/* #define NO_ESP32_CRYPT */
|
||||||
|
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||||
|
|
||||||
|
/* These are defined automatically in esp32-crypt.h, here for clarity */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA384 /* no SHA384 HW on C2 */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH_SHA512 /* no SHA512 HW on C2 */
|
||||||
|
|
||||||
|
/* There's no AES or RSA/Math accelerator on the ESP32-C2
|
||||||
|
* Auto defined with NO_WOLFSSL_ESP32_CRYPT_RSA_PRI, for clarity: */
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD
|
||||||
|
/***** END CONFIG_IDF_TARGET_ESP32C2 *****/
|
||||||
|
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||||
|
/* wolfSSL HW Acceleration supported on ESP32-C3. Uncomment to disable: */
|
||||||
|
|
||||||
/* #define NO_ESP32_CRYPT */
|
/* #define NO_ESP32_CRYPT */
|
||||||
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
/* #define NO_WOLFSSL_ESP32_CRYPT_HASH */ /* to disable all SHA HW */
|
||||||
@@ -215,6 +323,13 @@
|
|||||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||||
/***** END CONFIG_IDF_TARGET_ESP32H2 *****/
|
/***** END CONFIG_IDF_TARGET_ESP32H2 *****/
|
||||||
|
|
||||||
|
#elif defined(CONFIG_IDF_TARGET_ESP8266)
|
||||||
|
/* TODO: Revisit ESP8266 */
|
||||||
|
#define NO_ESP32_CRYPT
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_HASH
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_AES
|
||||||
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||||
|
/***** END CONFIG_IDF_TARGET_ESP266 *****/
|
||||||
#else
|
#else
|
||||||
/* Anything else encountered, disable HW accleration */
|
/* Anything else encountered, disable HW accleration */
|
||||||
#define NO_ESP32_CRYPT
|
#define NO_ESP32_CRYPT
|
||||||
@@ -223,6 +338,60 @@
|
|||||||
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
#define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI
|
||||||
#endif /* CONFIG_IDF_TARGET Check */
|
#endif /* CONFIG_IDF_TARGET Check */
|
||||||
|
|
||||||
|
/* Debug options:
|
||||||
|
|
||||||
|
#define ESP_VERIFY_MEMBLOCK
|
||||||
|
#define DEBUG_WOLFSSL
|
||||||
|
#define DEBUG_WOLFSSL_VERBOSE
|
||||||
|
#define DEBUG_WOLFSSL_SHA_MUTEX
|
||||||
|
#define WOLFSSL_ESP32_CRYPT_DEBUG
|
||||||
|
#define WOLFSSL_ESP32_CRYPT_HASH_SHA224_DEBUG
|
||||||
|
#define NO_RECOVER_SOFTWARE_CALC
|
||||||
|
#define WOLFSSL_TEST_STRAY 1
|
||||||
|
#define USE_ESP_DPORT_ACCESS_READ_BUFFER
|
||||||
|
#define WOLFSSL_ESP32_HW_LOCK_DEBUG
|
||||||
|
#define WOLFSSL_DEBUG_ESP_RSA_MULM_BITS
|
||||||
|
#define ESP_DISABLE_HW_TASK_LOCK
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define WOLFSSL_ESPIDF_ERROR_PAUSE /* Pause in a loop rather than exit. */
|
||||||
|
#define WOLFSSL_HW_METRICS
|
||||||
|
|
||||||
|
/* #define HASH_SIZE_LIMIT */ /* for test.c */
|
||||||
|
|
||||||
|
/* #define NO_HW_MATH_TEST */ /* Optionall turn off HW math checks */
|
||||||
|
|
||||||
|
/* Optionally include alternate HW test library: alt_hw_test.h */
|
||||||
|
/* When enabling, the ./components/wolfssl/CMakeLists.txt file
|
||||||
|
* will need the name of the library in the idf_component_register
|
||||||
|
* for the PRIV_REQUIRES list. */
|
||||||
|
/* #define INCLUDE_ALT_HW_TEST */
|
||||||
|
|
||||||
|
/* optionally turn off individual math HW acceleration features */
|
||||||
|
|
||||||
|
/* Turn off Large Number ESP32 HW Multiplication:
|
||||||
|
** [Z = X * Y] in esp_mp_mul() */
|
||||||
|
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MP_MUL */
|
||||||
|
|
||||||
|
/* Turn off Large Number ESP32 HW Modular Exponentiation:
|
||||||
|
** [Z = X^Y mod M] in esp_mp_exptmod() */
|
||||||
|
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_EXPTMOD */
|
||||||
|
|
||||||
|
/* Turn off Large Number ESP32 HW Modular Multiplication
|
||||||
|
** [Z = X * Y mod M] in esp_mp_mulmod() */
|
||||||
|
/* #define NO_WOLFSSL_ESP32_CRYPT_RSA_PRI_MULMOD */
|
||||||
|
|
||||||
|
|
||||||
|
#define WOLFSSL_PUBLIC_MP /* used by benchmark */
|
||||||
|
#define USE_CERT_BUFFERS_2048
|
||||||
|
|
||||||
|
/* when turning on ECC508 / ECC608 support
|
||||||
|
#define WOLFSSL_ESPWROOM32SE
|
||||||
|
#define HAVE_PK_CALLBACKS
|
||||||
|
#define WOLFSSL_ATECC508A
|
||||||
|
#define ATCA_WOLFSSL
|
||||||
|
*/
|
||||||
|
|
||||||
/* optional SM4 Ciphers. See https://github.com/wolfSSL/wolfsm
|
/* optional SM4 Ciphers. See https://github.com/wolfSSL/wolfsm
|
||||||
#define WOLFSSL_SM2
|
#define WOLFSSL_SM2
|
||||||
#define WOLFSSL_SM3
|
#define WOLFSSL_SM3
|
||||||
@@ -256,4 +425,3 @@
|
|||||||
#define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
|
#define CTX_SERVER_KEY_SIZE sizeof_server_key_der_2048
|
||||||
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
|
#define CTX_SERVER_KEY_TYPE WOLFSSL_FILETYPE_ASN1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user