From ed2a6f00e71bc4fe5a15e6b515dcf27483eef8e4 Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Thu, 26 Jan 2023 21:53:36 -0800 Subject: [PATCH 01/11] Espressif examples run with local wolfSSL (no setup!) --- .../components/wolfssl/CMakeLists.txt | 209 ++++++++++++++++++ .../components/wolfssl/component.mk | 40 ++++ .../wolfssl_benchmark/main/CMakeLists.txt | 53 +++++ .../examples/wolfssl_benchmark/main/main.c | 51 ++++- .../components/wolfssl/CMakeLists.txt | 207 +++++++++++++++++ .../components/wolfssl/component.mk | 40 ++++ .../wolfssl_client/main/CMakeLists.txt | 53 +++++ .../main/include/wifi_connect.h | 4 +- .../wolfssl_client/main/wifi_connect.c | 62 +++++- .../components/wolfssl/CMakeLists.txt | 207 +++++++++++++++++ .../components/wolfssl/component.mk | 40 ++++ .../wolfssl_server/main/CMakeLists.txt | 55 +++++ .../wolfssl_server/main/wifi_connect.c | 68 +++++- .../components/wolfssl/CMakeLists.txt | 207 +++++++++++++++++ .../components/wolfssl/component.mk | 40 ++++ .../examples/wolfssl_test/main/CMakeLists.txt | 53 +++++ .../ESP-IDF/examples/wolfssl_test/main/main.c | 2 +- 17 files changed, 1376 insertions(+), 15 deletions(-) create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/component.mk create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/component.mk create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/component.mk create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/component.mk diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt new file mode 100644 index 0000000000..f923bfa589 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt @@ -0,0 +1,209 @@ +# +# Copyright (C) 2006-2023 wolfSSL Inc. +# +# This file is part of wolfSSL. +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# +# cmake for wolfssl +# +cmake_minimum_required(VERSION 3.5) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") +set(CMAKE_CURRENT_SOURCE_DIR ".") + +# We are currently in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl +# The root of wolfSSL is 7 directories up from here: +get_filename_component(WOLFSSL_ROOT "../../../../../../../" ABSOLUTE) + +# Espressif may take several passes through this makefile. Check to see if we found IDF +string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF) + +if($WOLFSSL_FOUND_IDF) + message(STATUS "IDF_PATH = $ENV{IDF_PATH}") + message(STATUS "WOLFSSL_ROOT = ${WOLFSSL_ROOT}") + message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}") +endif() + +# get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa +FILE(GLOB EXCLUDE_ASM *.S) +file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S") + +message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}") + +set(INCLUDE_PATH ${WOLFSSL_ROOT}) + +set(COMPONENT_SRCDIRS "${WOLFSSL_ROOT}/src/" + "${WOLFSSL_ROOT}/wolfcrypt/src/" + "${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif/" + "${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel/" + "${WOLFSSL_ROOT}/wolfcrypt/benchmark/" + "${WOLFSSL_ROOT}/wolfcrypt/test/" + ) + +set(COMPONENT_REQUIRES lwip) + + +# check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user + # + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") + +else() + if(EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup. + # + message(STATUS "") + message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}") + message(STATUS "") + else() + # + # wolfSSL is not an ESP-IDF component. We need to now determine if it is local and if so if it is part of the wolfSSL repo + # or if wolfSSL is simply installed as a local component. + # + if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" ) + # + # wolfSSL found in local project. + # + if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/include/" ) + message(STATUS "") + message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}") + message(STATUS "") + # + # Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components. + # + # We won't do anything else here, as it will be assumed the original install completed successfully. + # + else() + # + # This is the developer repo mode. wolfSSL will be assume to be not installed to ESP-IDF nor local project + # In this configuration, we are likely running a wolfSSL example found directly in the repo. + # + message(STATUS "") + message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}") + message(STATUS "") + + message(STATUS "************************************************************************************************") + # When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories. + # However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed. + # + # first check if there's a [root]/include/user_settings.h + if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" ) + message(STATUS "Found wolfSSL user_settings.h in ${WOLFSSL_ROOT}/include/user_settings.h") + else() + message(STATUS "Installing wolfSSL user_settings.h to ${WOLFSSL_ROOT}/include/user_settings.h") + file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h" DESTINATION "${WOLFSSL_ROOT}/include/") + endif() # user_settings.h + + # next check if there's a [root]/include/config.h + if( EXISTS "${WOLFSSL_ROOT}/include/config.h" ) + message(STATUS "Found wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h") + else() + message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_ROOT}/include/config.h") + file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_ROOT}/include/") + file(RENAME "${WOLFSSL_ROOT}/include/dummy_config_h" "${WOLFSSL_ROOT}/include/config.h") + endif() # config.h + message(STATUS "************************************************************************************************") + message(STATUS "") + endif() + + else() + # we did not find a ./components/wolfssl/include/ directory froim this pass of cmake. + if($WOLFSSL_FOUND_IDF) + message(STATUS "") + message(STATUS "WARNING: wolfSSL not found.") + message(STATUS "") + else() + # probably needs to be reparsed by Espressif + endif() # else we have not found ESP-IDF yet + endif() # else not a local wolfSSL component + + endif() #else not an ESP-IDF component +endif() # else not local copy and EDP-IDF wolfSSL + + +# RTOS_IDF_PATH is typically: +# "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos" +# depending on the environment, we may need to swap backslashes with forward slashes +string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos") + +# ESP-IDF after version 4.4x has a different RTOS directory structure +string(REPLACE "\\" "/" RTOS_IDF_PATH5 "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos") + +if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/) + set(COMPONENT_ADD_INCLUDEDIRS + "." + "${WOLFSSL_ROOT}/include" + "${RTOS_IDF_PATH5}" + "${WOLFSSL_ROOT}" + ) +else() + + set(COMPONENT_ADD_INCLUDEDIRS + "." + "${WOLFSSL_ROOT}/include" + "${RTOS_IDF_PATH}" + "${WOLFSSL_ROOT}" + ) +endif() + +if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib) + list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib") +endif() + +set(COMPONENT_SRCEXCLUDE + "${WOLFSSL_ROOT}/src/bio.c" + "${WOLFSSL_ROOT}/src/conf.c" + "${WOLFSSL_ROOT}/src/misc.c" + "${WOLFSSL_ROOT}/src/pk.c" + "${WOLFSSL_ROOT}/src/ssl_misc.c" # included by ssl.c + "${WOLFSSL_ROOT}/src/x509.c" + "${WOLFSSL_ROOT}/src/x509_str.c" + "${WOLFSSL_ROOT}/wolfcrypt/src/evp.c" + "${WOLFSSL_ROOT}/wolfcrypt/src/misc.c" + "${EXCLUDE_ASM}" + ) + +register_component() + +# some optional diagnostics +if (0) + get_cmake_property(_variableNames VARIABLES) + list (SORT _variableNames) + message(STATUS "") + message(STATUS "ALL VARIABLES BEGIN") + message(STATUS "") + foreach (_variableName ${_variableNames}) + message(STATUS "${_variableName}=${${_variableName}}") + endforeach() + message(STATUS "") + message(STATUS "ALL VARIABLES END") + message(STATUS "") +endif() + +# check to see if there's both a local copy and EDP-IDF copy of the wolfssl components +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") +endif() +# end multiple component check + + diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/component.mk b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/component.mk new file mode 100644 index 0000000000..5234a007e1 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/component.mk @@ -0,0 +1,40 @@ +# +# Copyright (C) 2006-2023 wolfSSL Inc. +# +# This file is part of wolfSSL. +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# +# +# Component Makefile +# + +COMPONENT_ADD_INCLUDEDIRS := . ./include + +COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/components/freertos/include/freertos" +# COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/soc/esp32s3/include/soc" + +COMPONENT_SRCDIRS := src wolfcrypt/src +COMPONENT_SRCDIRS += wolfcrypt/src/port/Espressif +COMPONENT_SRCDIRS += wolfcrypt/src/port/atmel +COMPONENT_SRCDIRS += wolfcrypt/benchmark +COMPONENT_SRCDIRS += wolfcrypt/test + +CFLAGS +=-DWOLFSSL_USER_SETTINGS + +COMPONENT_OBJEXCLUDE := wolfcrypt/src/aes_asm.o +COMPONENT_OBJEXCLUDE += wolfcrypt/src/evp.o +COMPONENT_OBJEXCLUDE += wolfcrypt/src/misc.o +COMPONENT_OBJEXCLUDE += src/bio.o diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt index 630a42ba3e..1b3fd0ae3f 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt @@ -7,4 +7,57 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") set(COMPONENT_SRCS main.c) set(COMPONENT_ADD_INCLUDEDIRS ".") +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user + # + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") +endif() + register_component() + +set (git_cmd "git") +set (git_rev_parse "rev-parse") +set (git_short "--short") +set (git_HEAD "HEAD") +set (git_show "show") +set (git_no_patch "--no-patch") +set (git_no_notes "--no-notes") +set (git_pretty "--pretty=\'\%cd\'" ) + +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + # LIBWOLFSSL_VERSION_GIT_HASH + execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) + string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH ${LIBWOLFSSL_VERSION_GIT_HASH_VAR}) + string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) + if(${WOLFSSL_FOUND_GIT_VALUE}) + message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH=${LIBWOLFSSL_VERSION_GIT_HASH}") + #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR1}\"" APPEND) + #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR}\"" APPEND) + add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH}\") + endif() + + # LIBWOLFSSL_VERSION_GIT_SHORT_HASH + execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_short} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) + string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_SHORT_HASH ${LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR}) + string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) + if(${WOLFSSL_FOUND_GIT_VALUE}) + message(STATUS "Found LIBWOLFSSL_VERSION_GIT_SHORT_HASH=${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}") + add_definitions(-DLIBWOLFSSL_VERSION_GIT_SHORT_HASH=\"${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}\") + endif() + + # LIBWOLFSSL_VERSION_GIT_SHORT_HASH + execute_process(COMMAND ${git_cmd} ${git_show} ${git_no_patch} ${git_no_notes} ${git_pretty} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ) + string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH_DATE ${LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR}) + string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) + if(${WOLFSSL_FOUND_GIT_VALUE}) + message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH_DATE=${LIBWOLFSSL_VERSION_GIT_HASH_DATE}") + add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH_DATE=\"${LIBWOLFSSL_VERSION_GIT_HASH_DATE}\") + endif() +endif() + +message(STATUS "") + diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/main.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/main.c index d4d2f70d41..dc14bf2376 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/main.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/main.c @@ -23,12 +23,13 @@ #include "sdkconfig.h" /* wolfSSL */ +#include #include +#include #ifndef WOLFSSL_ESPIDF -#warning "problem with wolfSSL user_settings. Check components/wolfssl/include" + #warning "problem with wolfSSL user_settings. Check components/wolfssl/include" #endif -#include #include #include @@ -182,6 +183,51 @@ int construct_argv() /* entry point */ void app_main(void) { + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "CONFIG_IDF_TARGET = %s", CONFIG_IDF_TARGET); + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_STRING = %s", LIBWOLFSSL_VERSION_STRING); + +#if defined(WOLFSSL_MULTI_INSTALL_WARNING) + ESP_LOGI(TAG, ""); + ESP_LOGI(TAG, "WARNING: Multiple wolfSSL installs found."); + ESP_LOGI(TAG, "Check ESP-IDF and local project [components] directory."); + ESP_LOGI(TAG, ""); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_HASH) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH = %s", LIBWOLFSSL_VERSION_GIT_HASH); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_SHORT_HASH ) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_SHORT_HASH = %s", LIBWOLFSSL_VERSION_GIT_SHORT_HASH); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_HASH_DATE) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH_DATE = %s", LIBWOLFSSL_VERSION_GIT_HASH_DATE); +#endif + + + /* some interesting settings are target specific (ESP32, -C3, -S3, etc */ +#if defined(CONFIG_IDF_TARGET_ESP32C3) + /* not available for C3 at this time */ +#elif defined(CONFIG_IDF_TARGET_ESP32S3) + ESP_LOGI(TAG, "CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ = %u MHz", + CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ + ); + ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount); +#else + ESP_LOGI(TAG, "CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ = %u MHz", + CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ + ); + ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount); +#endif + + /* all platforms: stack high water mark check */ + ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL)); ESP_LOGI(TAG, "app_main CONFIG_BENCH_ARGV = %s", WOLFSSL_BENCH_ARGV); /* when using atecc608a on esp32-wroom-32se */ @@ -209,6 +255,7 @@ void app_main(void) /* wolfCrypt_Cleanup should always be called at completion, ** and is called in wolf_benchmark_task(). */ + ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL)); /* after the test, we'll just wait */ while (1) { diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt new file mode 100644 index 0000000000..77de27ee58 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt @@ -0,0 +1,207 @@ +# +# Copyright (C) 2006-2023 wolfSSL Inc. +# +# This file is part of wolfSSL. +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# +# cmake for wolfssl +# +cmake_minimum_required(VERSION 3.5) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") +set(CMAKE_CURRENT_SOURCE_DIR ".") + +# We are currently in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl +# The root of wolfSSL is 7 directories up from here: +get_filename_component(WOLFSSL_ROOT "../../../../../../../" ABSOLUTE) + +# Espressif may take several passes through this makefile. Check to see if we found IDF +string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF) + +if($WOLFSSL_FOUND_IDF) + message(STATUS "IDF_PATH = $ENV{IDF_PATH}") + message(STATUS "WOLFSSL_ROOT = ${WOLFSSL_ROOT}") + message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}") +endif() + +# get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa +FILE(GLOB EXCLUDE_ASM *.S) +file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S") + +message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}") + +set(INCLUDE_PATH ${WOLFSSL_ROOT}) + +set(COMPONENT_SRCDIRS "${WOLFSSL_ROOT}/src/" + "${WOLFSSL_ROOT}/wolfcrypt/src/" + "${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif/" + "${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel/" + "${WOLFSSL_ROOT}/wolfcrypt/benchmark/" + "${WOLFSSL_ROOT}/wolfcrypt/test/" + ) + +set(COMPONENT_REQUIRES lwip) + + +# check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user + # + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") +else() + if(EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup. + # + message(STATUS "") + message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}") + message(STATUS "") + else() + # + # wolfSSL is not an ESP-IDF component. We need to now determine if it is local and if so if it is part of the wolfSSL repo + # or if wolfSSL is simply installed as a local component. + # + if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" ) + # + # wolfSSL found in local project. + # + if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/include/" ) + message(STATUS "") + message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}") + message(STATUS "") + # + # Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components. + # + # We won't do anything else here, as it will be assumed the original install completed successfully. + # + else() + # + # This is the developer repo mode. wolfSSL will be assume to be not installed to ESP-IDF nor local project + # In this configuration, we are likely running a wolfSSL example found directly in the repo. + # + message(STATUS "") + message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}") + message(STATUS "") + + message(STATUS "************************************************************************************************") + # When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories. + # However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed. + # + # first check if there's a [root]/include/user_settings.h + if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" ) + message(STATUS "Found wolfSSL user_settings.h in ${WOLFSSL_ROOT}/include/user_settings.h") + else() + message(STATUS "Installing wolfSSL user_settings.h to ${WOLFSSL_ROOT}/include/user_settings.h") + file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h" DESTINATION "${WOLFSSL_ROOT}/include/") + endif() # user_settings.h + + # next check if there's a [root]/include/config.h + if( EXISTS "${WOLFSSL_ROOT}/include/config.h" ) + message(STATUS "Found wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h") + else() + message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_ROOT}/include/config.h") + file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_ROOT}/include/") + file(RENAME "${WOLFSSL_ROOT}/include/dummy_config_h" "${WOLFSSL_ROOT}/include/config.h") + endif() # config.h + message(STATUS "************************************************************************************************") + message(STATUS "") + endif() + + else() + # we did not find a ./components/wolfssl/include/ directory froim this pass of cmake. + if($WOLFSSL_FOUND_IDF) + message(STATUS "") + message(STATUS "WARNING: wolfSSL not found.") + message(STATUS "") + else() + # probably needs to be reparsed by Espressif + endif() # else we have not found ESP-IDF yet + endif() # else not a local wolfSSL component + + endif() #else not an ESP-IDF component +endif() # else not local copy and EDP-IDF wolfSSL + + +# RTOS_IDF_PATH is typically: +# "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos" +# depending on the environment, we may need to swap backslashes with forward slashes +string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos") + +# ESP-IDF after version 4.4x has a different RTOS directory structure +string(REPLACE "\\" "/" RTOS_IDF_PATH5 "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos") + +if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/) + set(COMPONENT_ADD_INCLUDEDIRS + "." + "${WOLFSSL_ROOT}/include" + "${RTOS_IDF_PATH5}" + "${WOLFSSL_ROOT}" + ) +else() + + set(COMPONENT_ADD_INCLUDEDIRS + "." + "${WOLFSSL_ROOT}/include" + "${RTOS_IDF_PATH}" + "${WOLFSSL_ROOT}" + ) +endif() + +if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib) + list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib") +endif() + +set(COMPONENT_SRCEXCLUDE + "${WOLFSSL_ROOT}/src/bio.c" + "${WOLFSSL_ROOT}/src/conf.c" + "${WOLFSSL_ROOT}/src/misc.c" + "${WOLFSSL_ROOT}/src/pk.c" + "${WOLFSSL_ROOT}/src/ssl_misc.c" # included by ssl.c + "${WOLFSSL_ROOT}/src/x509.c" + "${WOLFSSL_ROOT}/src/x509_str.c" + "${WOLFSSL_ROOT}/wolfcrypt/src/evp.c" + "${WOLFSSL_ROOT}/wolfcrypt/src/misc.c" + "${EXCLUDE_ASM}" + ) + +register_component() + +# some optional diagnostics +if (0) + get_cmake_property(_variableNames VARIABLES) + list (SORT _variableNames) + message(STATUS "") + message(STATUS "ALL VARIABLES BEGIN") + message(STATUS "") + foreach (_variableName ${_variableNames}) + message(STATUS "${_variableName}=${${_variableName}}") + endforeach() + message(STATUS "") + message(STATUS "ALL VARIABLES END") + message(STATUS "") +endif() + +# check to see if there's both a local copy and EDP-IDF copy of the wolfssl components +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") +endif() +# end multiple component check + + diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/component.mk b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/component.mk new file mode 100644 index 0000000000..5234a007e1 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/component.mk @@ -0,0 +1,40 @@ +# +# Copyright (C) 2006-2023 wolfSSL Inc. +# +# This file is part of wolfSSL. +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# +# +# Component Makefile +# + +COMPONENT_ADD_INCLUDEDIRS := . ./include + +COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/components/freertos/include/freertos" +# COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/soc/esp32s3/include/soc" + +COMPONENT_SRCDIRS := src wolfcrypt/src +COMPONENT_SRCDIRS += wolfcrypt/src/port/Espressif +COMPONENT_SRCDIRS += wolfcrypt/src/port/atmel +COMPONENT_SRCDIRS += wolfcrypt/benchmark +COMPONENT_SRCDIRS += wolfcrypt/test + +CFLAGS +=-DWOLFSSL_USER_SETTINGS + +COMPONENT_OBJEXCLUDE := wolfcrypt/src/aes_asm.o +COMPONENT_OBJEXCLUDE += wolfcrypt/src/evp.o +COMPONENT_OBJEXCLUDE += wolfcrypt/src/misc.o +COMPONENT_OBJEXCLUDE += src/bio.o diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt index ca570118c1..6257bbfad3 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt @@ -7,4 +7,57 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") set(COMPONENT_SRCS "client-tls.c" "wifi_connect.c") set(COMPONENT_ADD_INCLUDEDIRS "." "./include") +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user + # + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") +endif() + register_component() + +set (git_cmd "git") +set (git_rev_parse "rev-parse") +set (git_short "--short") +set (git_HEAD "HEAD") +set (git_show "show") +set (git_no_patch "--no-patch") +set (git_no_notes "--no-notes") +set (git_pretty "--pretty=\'\%cd\'" ) + +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + # LIBWOLFSSL_VERSION_GIT_HASH + execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) + string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH ${LIBWOLFSSL_VERSION_GIT_HASH_VAR}) + string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) + if(${WOLFSSL_FOUND_GIT_VALUE}) + message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH=${LIBWOLFSSL_VERSION_GIT_HASH}") + #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR1}\"" APPEND) + #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR}\"" APPEND) + add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH}\") + endif() + + # LIBWOLFSSL_VERSION_GIT_SHORT_HASH + execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_short} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) + string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_SHORT_HASH ${LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR}) + string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) + if(${WOLFSSL_FOUND_GIT_VALUE}) + message(STATUS "Found LIBWOLFSSL_VERSION_GIT_SHORT_HASH=${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}") + add_definitions(-DLIBWOLFSSL_VERSION_GIT_SHORT_HASH=\"${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}\") + endif() + + # LIBWOLFSSL_VERSION_GIT_SHORT_HASH + execute_process(COMMAND ${git_cmd} ${git_show} ${git_no_patch} ${git_no_notes} ${git_pretty} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ) + string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH_DATE ${LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR}) + string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) + if(${WOLFSSL_FOUND_GIT_VALUE}) + message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH_DATE=${LIBWOLFSSL_VERSION_GIT_HASH_DATE}") + add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH_DATE=\"${LIBWOLFSSL_VERSION_GIT_HASH_DATE}\") + endif() +endif() + +message(STATUS "") + diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/wifi_connect.h b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/wifi_connect.h index a7bc83ea74..7b85be227a 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/wifi_connect.h +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/wifi_connect.h @@ -25,9 +25,9 @@ #include "esp_log.h" #include "esp_wifi.h" #if ESP_IDF_VERSION_MAJOR >= 4 -#include "esp_event.h" + #include "esp_event.h" #else -#include "esp_event_loop.h" + #include "esp_event_loop.h" #endif #define DEFAULT_PORT 11111 diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c index dadaacca65..eb0c3c6618 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c @@ -27,11 +27,20 @@ #include "lwip/netdb.h" #include "lwip/apps/sntp.h" #include "nvs_flash.h" + +/* wolfSSL */ +#include +#include +#include +#ifndef WOLFSSL_ESPIDF + #warning "problem with wolfSSL user_settings. Check components/wolfssl/include" +#endif + #if ESP_IDF_VERSION_MAJOR >= 4 -#include "protocol_examples_common.h" + #include "protocol_examples_common.h" #else -const static int CONNECTED_BIT = BIT0; -static EventGroupHandle_t wifi_event_group; + const static int CONNECTED_BIT = BIT0; + static EventGroupHandle_t wifi_event_group; #endif /* proto-type */ @@ -129,6 +138,53 @@ static esp_err_t wifi_event_handler(void *ctx, system_event_t *event) void app_main(void) { ESP_LOGI(TAG, "Start app_main..."); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "CONFIG_IDF_TARGET = %s", CONFIG_IDF_TARGET); + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_STRING = %s", LIBWOLFSSL_VERSION_STRING); + +#if defined(WOLFSSL_MULTI_INSTALL_WARNING) + ESP_LOGI(TAG, ""); + ESP_LOGI(TAG, "WARNING: Multiple wolfSSL installs found."); + ESP_LOGI(TAG, "Check ESP-IDF and local project [components] directory."); + ESP_LOGI(TAG, ""); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_HASH) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH = %s", LIBWOLFSSL_VERSION_GIT_HASH); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_SHORT_HASH ) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_SHORT_HASH = %s", LIBWOLFSSL_VERSION_GIT_SHORT_HASH); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_HASH_DATE) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH_DATE = %s", LIBWOLFSSL_VERSION_GIT_HASH_DATE); +#endif + + + /* some interesting settings are target specific (ESP32, -C3, -S3, etc */ +#if defined(CONFIG_IDF_TARGET_ESP32C3) + /* not available for C3 at this time */ +#elif defined(CONFIG_IDF_TARGET_ESP32S3) + ESP_LOGI(TAG, "CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ = %u MHz", + CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ + ); + ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount); +#else + ESP_LOGI(TAG, "CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ = %u MHz", + CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ + ); + ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount); +#endif + + /* all platforms: stack high water mark check */ + ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL)); + + ESP_ERROR_CHECK(nvs_flash_init()); ESP_LOGI(TAG, "Initialize wifi"); diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt new file mode 100644 index 0000000000..77de27ee58 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt @@ -0,0 +1,207 @@ +# +# Copyright (C) 2006-2023 wolfSSL Inc. +# +# This file is part of wolfSSL. +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# +# cmake for wolfssl +# +cmake_minimum_required(VERSION 3.5) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") +set(CMAKE_CURRENT_SOURCE_DIR ".") + +# We are currently in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl +# The root of wolfSSL is 7 directories up from here: +get_filename_component(WOLFSSL_ROOT "../../../../../../../" ABSOLUTE) + +# Espressif may take several passes through this makefile. Check to see if we found IDF +string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF) + +if($WOLFSSL_FOUND_IDF) + message(STATUS "IDF_PATH = $ENV{IDF_PATH}") + message(STATUS "WOLFSSL_ROOT = ${WOLFSSL_ROOT}") + message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}") +endif() + +# get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa +FILE(GLOB EXCLUDE_ASM *.S) +file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S") + +message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}") + +set(INCLUDE_PATH ${WOLFSSL_ROOT}) + +set(COMPONENT_SRCDIRS "${WOLFSSL_ROOT}/src/" + "${WOLFSSL_ROOT}/wolfcrypt/src/" + "${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif/" + "${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel/" + "${WOLFSSL_ROOT}/wolfcrypt/benchmark/" + "${WOLFSSL_ROOT}/wolfcrypt/test/" + ) + +set(COMPONENT_REQUIRES lwip) + + +# check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user + # + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") +else() + if(EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup. + # + message(STATUS "") + message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}") + message(STATUS "") + else() + # + # wolfSSL is not an ESP-IDF component. We need to now determine if it is local and if so if it is part of the wolfSSL repo + # or if wolfSSL is simply installed as a local component. + # + if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" ) + # + # wolfSSL found in local project. + # + if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/include/" ) + message(STATUS "") + message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}") + message(STATUS "") + # + # Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components. + # + # We won't do anything else here, as it will be assumed the original install completed successfully. + # + else() + # + # This is the developer repo mode. wolfSSL will be assume to be not installed to ESP-IDF nor local project + # In this configuration, we are likely running a wolfSSL example found directly in the repo. + # + message(STATUS "") + message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}") + message(STATUS "") + + message(STATUS "************************************************************************************************") + # When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories. + # However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed. + # + # first check if there's a [root]/include/user_settings.h + if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" ) + message(STATUS "Found wolfSSL user_settings.h in ${WOLFSSL_ROOT}/include/user_settings.h") + else() + message(STATUS "Installing wolfSSL user_settings.h to ${WOLFSSL_ROOT}/include/user_settings.h") + file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h" DESTINATION "${WOLFSSL_ROOT}/include/") + endif() # user_settings.h + + # next check if there's a [root]/include/config.h + if( EXISTS "${WOLFSSL_ROOT}/include/config.h" ) + message(STATUS "Found wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h") + else() + message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_ROOT}/include/config.h") + file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_ROOT}/include/") + file(RENAME "${WOLFSSL_ROOT}/include/dummy_config_h" "${WOLFSSL_ROOT}/include/config.h") + endif() # config.h + message(STATUS "************************************************************************************************") + message(STATUS "") + endif() + + else() + # we did not find a ./components/wolfssl/include/ directory froim this pass of cmake. + if($WOLFSSL_FOUND_IDF) + message(STATUS "") + message(STATUS "WARNING: wolfSSL not found.") + message(STATUS "") + else() + # probably needs to be reparsed by Espressif + endif() # else we have not found ESP-IDF yet + endif() # else not a local wolfSSL component + + endif() #else not an ESP-IDF component +endif() # else not local copy and EDP-IDF wolfSSL + + +# RTOS_IDF_PATH is typically: +# "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos" +# depending on the environment, we may need to swap backslashes with forward slashes +string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos") + +# ESP-IDF after version 4.4x has a different RTOS directory structure +string(REPLACE "\\" "/" RTOS_IDF_PATH5 "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos") + +if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/) + set(COMPONENT_ADD_INCLUDEDIRS + "." + "${WOLFSSL_ROOT}/include" + "${RTOS_IDF_PATH5}" + "${WOLFSSL_ROOT}" + ) +else() + + set(COMPONENT_ADD_INCLUDEDIRS + "." + "${WOLFSSL_ROOT}/include" + "${RTOS_IDF_PATH}" + "${WOLFSSL_ROOT}" + ) +endif() + +if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib) + list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib") +endif() + +set(COMPONENT_SRCEXCLUDE + "${WOLFSSL_ROOT}/src/bio.c" + "${WOLFSSL_ROOT}/src/conf.c" + "${WOLFSSL_ROOT}/src/misc.c" + "${WOLFSSL_ROOT}/src/pk.c" + "${WOLFSSL_ROOT}/src/ssl_misc.c" # included by ssl.c + "${WOLFSSL_ROOT}/src/x509.c" + "${WOLFSSL_ROOT}/src/x509_str.c" + "${WOLFSSL_ROOT}/wolfcrypt/src/evp.c" + "${WOLFSSL_ROOT}/wolfcrypt/src/misc.c" + "${EXCLUDE_ASM}" + ) + +register_component() + +# some optional diagnostics +if (0) + get_cmake_property(_variableNames VARIABLES) + list (SORT _variableNames) + message(STATUS "") + message(STATUS "ALL VARIABLES BEGIN") + message(STATUS "") + foreach (_variableName ${_variableNames}) + message(STATUS "${_variableName}=${${_variableName}}") + endforeach() + message(STATUS "") + message(STATUS "ALL VARIABLES END") + message(STATUS "") +endif() + +# check to see if there's both a local copy and EDP-IDF copy of the wolfssl components +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") +endif() +# end multiple component check + + diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/component.mk b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/component.mk new file mode 100644 index 0000000000..5234a007e1 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/component.mk @@ -0,0 +1,40 @@ +# +# Copyright (C) 2006-2023 wolfSSL Inc. +# +# This file is part of wolfSSL. +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# +# +# Component Makefile +# + +COMPONENT_ADD_INCLUDEDIRS := . ./include + +COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/components/freertos/include/freertos" +# COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/soc/esp32s3/include/soc" + +COMPONENT_SRCDIRS := src wolfcrypt/src +COMPONENT_SRCDIRS += wolfcrypt/src/port/Espressif +COMPONENT_SRCDIRS += wolfcrypt/src/port/atmel +COMPONENT_SRCDIRS += wolfcrypt/benchmark +COMPONENT_SRCDIRS += wolfcrypt/test + +CFLAGS +=-DWOLFSSL_USER_SETTINGS + +COMPONENT_OBJEXCLUDE := wolfcrypt/src/aes_asm.o +COMPONENT_OBJEXCLUDE += wolfcrypt/src/evp.o +COMPONENT_OBJEXCLUDE += wolfcrypt/src/misc.o +COMPONENT_OBJEXCLUDE += src/bio.o diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt index 4e6e5a5dea..4ca497ce98 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt @@ -7,4 +7,59 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") set(COMPONENT_SRCS "server-tls.c" "wifi_connect.c") set(COMPONENT_ADD_INCLUDEDIRS "." "./include") +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user + # + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") +endif() + + register_component() + + +set (git_cmd "git") +set (git_rev_parse "rev-parse") +set (git_short "--short") +set (git_HEAD "HEAD") +set (git_show "show") +set (git_no_patch "--no-patch") +set (git_no_notes "--no-notes") +set (git_pretty "--pretty=\'\%cd\'" ) + +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + # LIBWOLFSSL_VERSION_GIT_HASH + execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) + string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH ${LIBWOLFSSL_VERSION_GIT_HASH_VAR}) + string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) + if(${WOLFSSL_FOUND_GIT_VALUE}) + message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH=${LIBWOLFSSL_VERSION_GIT_HASH}") + #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR1}\"" APPEND) + #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR}\"" APPEND) + add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH}\") + endif() + + # LIBWOLFSSL_VERSION_GIT_SHORT_HASH + execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_short} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) + string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_SHORT_HASH ${LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR}) + string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) + if(${WOLFSSL_FOUND_GIT_VALUE}) + message(STATUS "Found LIBWOLFSSL_VERSION_GIT_SHORT_HASH=${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}") + add_definitions(-DLIBWOLFSSL_VERSION_GIT_SHORT_HASH=\"${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}\") + endif() + + # LIBWOLFSSL_VERSION_GIT_SHORT_HASH + execute_process(COMMAND ${git_cmd} ${git_show} ${git_no_patch} ${git_no_notes} ${git_pretty} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ) + string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH_DATE ${LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR}) + string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) + if(${WOLFSSL_FOUND_GIT_VALUE}) + message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH_DATE=${LIBWOLFSSL_VERSION_GIT_HASH_DATE}") + add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH_DATE=\"${LIBWOLFSSL_VERSION_GIT_HASH_DATE}\") + endif() +endif() + +message(STATUS "") + diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c index 450677698f..37c636b5e8 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c @@ -1,4 +1,4 @@ -/* wifi_connect.c +/* wifi_connect.c * * Copyright (C) 2006-2023 wolfSSL Inc. * @@ -27,11 +27,20 @@ #include "lwip/netdb.h" #include "lwip/apps/sntp.h" #include "nvs_flash.h" + +/* wolfSSL */ +#include +#include +#include +#ifndef WOLFSSL_ESPIDF + #warning "problem with wolfSSL user_settings. Check components/wolfssl/include" +#endif + #if ESP_IDF_VERSION_MAJOR >= 4 -#include "protocol_examples_common.h" + #include "protocol_examples_common.h" #else -const static int CONNECTED_BIT = BIT0; -static EventGroupHandle_t wifi_event_group; + const static int CONNECTED_BIT = BIT0; + static EventGroupHandle_t wifi_event_group; #endif /* prefix for logging */ @@ -56,7 +65,7 @@ static void set_time() utctime.tv_usec = 0; tz.tz_minuteswest = 0; tz.tz_dsttime = 0; - + settimeofday(&utctime, &tz); time(&now); @@ -128,7 +137,52 @@ static esp_err_t wifi_event_handler(void *ctx, system_event_t *event) /* entry point */ void app_main(void) { - ESP_LOGI(TAG, "Start app_main..."); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "CONFIG_IDF_TARGET = %s", CONFIG_IDF_TARGET); + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_STRING = %s", LIBWOLFSSL_VERSION_STRING); + +#if defined(WOLFSSL_MULTI_INSTALL_WARNING) + ESP_LOGI(TAG, ""); + ESP_LOGI(TAG, "WARNING: Multiple wolfSSL installs found."); + ESP_LOGI(TAG, "Check ESP-IDF and local project [components] directory."); + ESP_LOGI(TAG, ""); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_HASH) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH = %s", LIBWOLFSSL_VERSION_GIT_HASH); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_SHORT_HASH ) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_SHORT_HASH = %s", LIBWOLFSSL_VERSION_GIT_SHORT_HASH); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_HASH_DATE) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH_DATE = %s", LIBWOLFSSL_VERSION_GIT_HASH_DATE); +#endif + + + /* some interesting settings are target specific (ESP32, -C3, -S3, etc */ +#if defined(CONFIG_IDF_TARGET_ESP32C3) + /* not available for C3 at this time */ +#elif defined(CONFIG_IDF_TARGET_ESP32S3) + ESP_LOGI(TAG, "CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ = %u MHz", + CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ + ); + ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount); +#else + ESP_LOGI(TAG, "CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ = %u MHz", + CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ + ); + ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount); +#endif + + /* all platforms: stack high water mark check */ + ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL)); + ESP_ERROR_CHECK(nvs_flash_init()); ESP_LOGI(TAG, "Initialize wifi"); @@ -161,7 +215,7 @@ void app_main(void) }; /* WiFi station mode */ ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) ); - /* Wifi Set the configuration of the ESP32 STA or AP */ + /* Wifi Set the configuration of the ESP32 STA or AP */ ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); /* Start Wifi */ ESP_ERROR_CHECK(esp_wifi_start() ); diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt new file mode 100644 index 0000000000..77de27ee58 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt @@ -0,0 +1,207 @@ +# +# Copyright (C) 2006-2023 wolfSSL Inc. +# +# This file is part of wolfSSL. +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# +# cmake for wolfssl +# +cmake_minimum_required(VERSION 3.5) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") +set(CMAKE_CURRENT_SOURCE_DIR ".") + +# We are currently in [root]/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl +# The root of wolfSSL is 7 directories up from here: +get_filename_component(WOLFSSL_ROOT "../../../../../../../" ABSOLUTE) + +# Espressif may take several passes through this makefile. Check to see if we found IDF +string(COMPARE EQUAL "${PROJECT_SOURCE_DIR}" "" WOLFSSL_FOUND_IDF) + +if($WOLFSSL_FOUND_IDF) + message(STATUS "IDF_PATH = $ENV{IDF_PATH}") + message(STATUS "WOLFSSL_ROOT = ${WOLFSSL_ROOT}") + message(STATUS "PROJECT_SOURCE_DIR = ${PROJECT_SOURCE_DIR}") +endif() + +# get a list of all wolfcrypt assembly files; we'll exclude them as they don't target Xtensa +FILE(GLOB EXCLUDE_ASM *.S) +file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S") + +message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}") + +set(INCLUDE_PATH ${WOLFSSL_ROOT}) + +set(COMPONENT_SRCDIRS "${WOLFSSL_ROOT}/src/" + "${WOLFSSL_ROOT}/wolfcrypt/src/" + "${WOLFSSL_ROOT}/wolfcrypt/src/port/Espressif/" + "${WOLFSSL_ROOT}/wolfcrypt/src/port/atmel/" + "${WOLFSSL_ROOT}/wolfcrypt/benchmark/" + "${WOLFSSL_ROOT}/wolfcrypt/test/" + ) + +set(COMPONENT_REQUIRES lwip) + + +# check to see if there's both a local copy and EDP-IDF copy of the wolfssl and/or wolfssh components +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user + # + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") +else() + if(EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup. + # + message(STATUS "") + message(STATUS "Using components/wolfssl in IDF_PATH = $ENV{IDF_PATH}") + message(STATUS "") + else() + # + # wolfSSL is not an ESP-IDF component. We need to now determine if it is local and if so if it is part of the wolfSSL repo + # or if wolfSSL is simply installed as a local component. + # + if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" ) + # + # wolfSSL found in local project. + # + if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/include/" ) + message(STATUS "") + message(STATUS "Using installed project ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}") + message(STATUS "") + # + # Note we already checked above and confirmed there's not another wolfSSL installed in the ESP-IDF components. + # + # We won't do anything else here, as it will be assumed the original install completed successfully. + # + else() + # + # This is the developer repo mode. wolfSSL will be assume to be not installed to ESP-IDF nor local project + # In this configuration, we are likely running a wolfSSL example found directly in the repo. + # + message(STATUS "") + message(STATUS "Using developer repo ./components/wolfssl in CMAKE_HOME_DIRECTORY = $ENV{CMAKE_HOME_DIRECTORY}") + message(STATUS "") + + message(STATUS "************************************************************************************************") + # When in developer mode, we are typically running wolfSSL examples such as benchmark or test directories. + # However, the as-cloned or distributed wolfSSL does not have the ./include/ directory, so we'll add it as needed. + # + # first check if there's a [root]/include/user_settings.h + if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" ) + message(STATUS "Found wolfSSL user_settings.h in ${WOLFSSL_ROOT}/include/user_settings.h") + else() + message(STATUS "Installing wolfSSL user_settings.h to ${WOLFSSL_ROOT}/include/user_settings.h") + file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/user_settings.h" DESTINATION "${WOLFSSL_ROOT}/include/") + endif() # user_settings.h + + # next check if there's a [root]/include/config.h + if( EXISTS "${WOLFSSL_ROOT}/include/config.h" ) + message(STATUS "Found wolfSSL config.h in ${WOLFSSL_ROOT}/include/config.h") + else() + message(STATUS "Installing wolfSSL config.h to ${WOLFSSL_ROOT}/include/config.h") + file(COPY "${WOLFSSL_ROOT}/IDE/Espressif/ESP-IDF/dummy_config_h" DESTINATION "${WOLFSSL_ROOT}/include/") + file(RENAME "${WOLFSSL_ROOT}/include/dummy_config_h" "${WOLFSSL_ROOT}/include/config.h") + endif() # config.h + message(STATUS "************************************************************************************************") + message(STATUS "") + endif() + + else() + # we did not find a ./components/wolfssl/include/ directory froim this pass of cmake. + if($WOLFSSL_FOUND_IDF) + message(STATUS "") + message(STATUS "WARNING: wolfSSL not found.") + message(STATUS "") + else() + # probably needs to be reparsed by Espressif + endif() # else we have not found ESP-IDF yet + endif() # else not a local wolfSSL component + + endif() #else not an ESP-IDF component +endif() # else not local copy and EDP-IDF wolfSSL + + +# RTOS_IDF_PATH is typically: +# "/Users/{username}/Desktop/esp-idf/components/freertos/include/freertos" +# depending on the environment, we may need to swap backslashes with forward slashes +string(REPLACE "\\" "/" RTOS_IDF_PATH "$ENV{IDF_PATH}/components/freertos/include/freertos") + +# ESP-IDF after version 4.4x has a different RTOS directory structure +string(REPLACE "\\" "/" RTOS_IDF_PATH5 "$ENV{IDF_PATH}/components/freertos/FreeRTOS-Kernel/include/freertos") + +if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/) + set(COMPONENT_ADD_INCLUDEDIRS + "." + "${WOLFSSL_ROOT}/include" + "${RTOS_IDF_PATH5}" + "${WOLFSSL_ROOT}" + ) +else() + + set(COMPONENT_ADD_INCLUDEDIRS + "." + "${WOLFSSL_ROOT}/include" + "${RTOS_IDF_PATH}" + "${WOLFSSL_ROOT}" + ) +endif() + +if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib) + list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib") +endif() + +set(COMPONENT_SRCEXCLUDE + "${WOLFSSL_ROOT}/src/bio.c" + "${WOLFSSL_ROOT}/src/conf.c" + "${WOLFSSL_ROOT}/src/misc.c" + "${WOLFSSL_ROOT}/src/pk.c" + "${WOLFSSL_ROOT}/src/ssl_misc.c" # included by ssl.c + "${WOLFSSL_ROOT}/src/x509.c" + "${WOLFSSL_ROOT}/src/x509_str.c" + "${WOLFSSL_ROOT}/wolfcrypt/src/evp.c" + "${WOLFSSL_ROOT}/wolfcrypt/src/misc.c" + "${EXCLUDE_ASM}" + ) + +register_component() + +# some optional diagnostics +if (0) + get_cmake_property(_variableNames VARIABLES) + list (SORT _variableNames) + message(STATUS "") + message(STATUS "ALL VARIABLES BEGIN") + message(STATUS "") + foreach (_variableName ${_variableNames}) + message(STATUS "${_variableName}=${${_variableName}}") + endforeach() + message(STATUS "") + message(STATUS "ALL VARIABLES END") + message(STATUS "") +endif() + +# check to see if there's both a local copy and EDP-IDF copy of the wolfssl components +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") +endif() +# end multiple component check + + diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/component.mk b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/component.mk new file mode 100644 index 0000000000..5234a007e1 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/component.mk @@ -0,0 +1,40 @@ +# +# Copyright (C) 2006-2023 wolfSSL Inc. +# +# This file is part of wolfSSL. +# +# wolfSSL is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# wolfSSL is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA +# +# +# Component Makefile +# + +COMPONENT_ADD_INCLUDEDIRS := . ./include + +COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/components/freertos/include/freertos" +# COMPONENT_ADD_INCLUDEDIRS += "$ENV{IDF_PATH}/soc/esp32s3/include/soc" + +COMPONENT_SRCDIRS := src wolfcrypt/src +COMPONENT_SRCDIRS += wolfcrypt/src/port/Espressif +COMPONENT_SRCDIRS += wolfcrypt/src/port/atmel +COMPONENT_SRCDIRS += wolfcrypt/benchmark +COMPONENT_SRCDIRS += wolfcrypt/test + +CFLAGS +=-DWOLFSSL_USER_SETTINGS + +COMPONENT_OBJEXCLUDE := wolfcrypt/src/aes_asm.o +COMPONENT_OBJEXCLUDE += wolfcrypt/src/evp.o +COMPONENT_OBJEXCLUDE += wolfcrypt/src/misc.o +COMPONENT_OBJEXCLUDE += src/bio.o diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt index 9cf6b3937f..d21ad32e11 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt @@ -11,4 +11,57 @@ set(COMPONENT_SRCS "main.c") set(COMPONENT_ADD_INCLUDEDIRS ".") +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user + # + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") +endif() + register_component() + +set (git_cmd "git") +set (git_rev_parse "rev-parse") +set (git_short "--short") +set (git_HEAD "HEAD") +set (git_show "show") +set (git_no_patch "--no-patch") +set (git_no_notes "--no-notes") +set (git_pretty "--pretty=\'\%cd\'" ) + +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + # LIBWOLFSSL_VERSION_GIT_HASH + execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) + string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH ${LIBWOLFSSL_VERSION_GIT_HASH_VAR}) + string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) + if(${WOLFSSL_FOUND_GIT_VALUE}) + message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH=${LIBWOLFSSL_VERSION_GIT_HASH}") + #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR1}\"" APPEND) + #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR}\"" APPEND) + add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH}\") + endif() + + # LIBWOLFSSL_VERSION_GIT_SHORT_HASH + execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_short} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) + string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_SHORT_HASH ${LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR}) + string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) + if(${WOLFSSL_FOUND_GIT_VALUE}) + message(STATUS "Found LIBWOLFSSL_VERSION_GIT_SHORT_HASH=${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}") + add_definitions(-DLIBWOLFSSL_VERSION_GIT_SHORT_HASH=\"${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}\") + endif() + + # LIBWOLFSSL_VERSION_GIT_SHORT_HASH + execute_process(COMMAND ${git_cmd} ${git_show} ${git_no_patch} ${git_no_notes} ${git_pretty} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ) + string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH_DATE ${LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR}) + string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) + if(${WOLFSSL_FOUND_GIT_VALUE}) + message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH_DATE=${LIBWOLFSSL_VERSION_GIT_HASH_DATE}") + add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH_DATE=\"${LIBWOLFSSL_VERSION_GIT_HASH_DATE}\") + endif() +endif() + +message(STATUS "") + diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/main.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/main.c index 9bab066530..01538f72e3 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/main.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/main.c @@ -159,7 +159,7 @@ void app_main(void) CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ ); ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount); -#else +#else ESP_LOGI(TAG, "CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ = %u MHz", CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ ); From 59880d5cc18214011c529ac6657c269f12a4fd67 Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Thu, 26 Jan 2023 22:11:42 -0800 Subject: [PATCH 02/11] include.am Espressif local no-setup component files --- IDE/Espressif/include.am | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/IDE/Espressif/include.am b/IDE/Espressif/include.am index c7d0d76b80..332b5c442c 100644 --- a/IDE/Espressif/include.am +++ b/IDE/Espressif/include.am @@ -28,6 +28,8 @@ EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/component.mk EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/Kconfig.projbuild EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/main.c EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/main.h +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/component.mk EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/CMakeLists.txt EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/main @@ -41,6 +43,8 @@ EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/component.mk EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/Kconfig.projbuild EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/wifi_connect.c EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/wifi_connect.h +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/component.mk EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/CMakeLists.txt EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/Makefile @@ -52,6 +56,8 @@ EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/component.mk EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/wifi_connect.c EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/include/wifi_connect.h +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/component.mk EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/CMakeLists.txt EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/Makefile @@ -65,6 +71,8 @@ EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/Kconfig.projbuild EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/main.c EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/time_helper.c EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/time_helper.h +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/component.mk EXTRA_DIST+= IDE/Espressif/ESP-IDF/libs/CMakeLists.txt EXTRA_DIST+= IDE/Espressif/ESP-IDF/libs/component.mk From 50cd511cf28ea83497b66c56a2969c0d5a51f646 Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Tue, 31 Jan 2023 20:52:39 -0800 Subject: [PATCH 03/11] cleanup Espressif Example CMakeLists.txt, use function --- .../components/wolfssl/CMakeLists.txt | 15 +++- .../wolfssl_benchmark/main/CMakeLists.txt | 76 +++++++++++-------- .../components/wolfssl/CMakeLists.txt | 17 ++++- .../wolfssl_client/main/CMakeLists.txt | 76 +++++++++++-------- .../components/wolfssl/CMakeLists.txt | 17 ++++- .../wolfssl_server/main/CMakeLists.txt | 76 +++++++++++-------- .../components/wolfssl/CMakeLists.txt | 17 ++++- .../examples/wolfssl_test/main/CMakeLists.txt | 76 +++++++++++-------- 8 files changed, 229 insertions(+), 141 deletions(-) diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt index f923bfa589..e52e6b25b9 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt @@ -40,7 +40,9 @@ endif() FILE(GLOB EXCLUDE_ASM *.S) file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S") -message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}") +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}") +endif() set(INCLUDE_PATH ${WOLFSSL_ROOT}) @@ -61,7 +63,9 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user # message(STATUS "") + message(STATUS "********************************************************************") message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "********************************************************************") message(STATUS "") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") @@ -106,6 +110,7 @@ else() # # first check if there's a [root]/include/user_settings.h if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" ) + # we won't overwrite an existing user settings file, just note that we already have one: message(STATUS "Found wolfSSL user_settings.h in ${WOLFSSL_ROOT}/include/user_settings.h") else() message(STATUS "Installing wolfSSL user_settings.h to ${WOLFSSL_ROOT}/include/user_settings.h") @@ -125,13 +130,14 @@ else() endif() else() - # we did not find a ./components/wolfssl/include/ directory froim this pass of cmake. + # we did not find a ./components/wolfssl/include/ directory from this pass of cmake. if($WOLFSSL_FOUND_IDF) message(STATUS "") message(STATUS "WARNING: wolfSSL not found.") message(STATUS "") else() - # probably needs to be reparsed by Espressif + # probably needs to be re-parsed by Espressif + message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}") endif() # else we have not found ESP-IDF yet endif() # else not a local wolfSSL component @@ -201,7 +207,10 @@ endif() # check to see if there's both a local copy and EDP-IDF copy of the wolfssl components if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) message(STATUS "") + message(STATUS "") + message(STATUS "********************************************************************") message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "********************************************************************") message(STATUS "") endif() # end multiple component check diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt index 1b3fd0ae3f..c107b46af2 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt @@ -7,6 +7,8 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") set(COMPONENT_SRCS main.c) set(COMPONENT_ADD_INCLUDEDIRS ".") +set (git_cmd "git") + if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) # # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user @@ -19,44 +21,54 @@ endif() register_component() -set (git_cmd "git") -set (git_rev_parse "rev-parse") -set (git_short "--short") -set (git_HEAD "HEAD") -set (git_show "show") -set (git_no_patch "--no-patch") -set (git_no_notes "--no-notes") -set (git_pretty "--pretty=\'\%cd\'" ) +# +# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT) +# +# Save the THIS_VAR as a string in a macro called VAR_OUPUT +# +# VAR_OUPUT: the name of the macro to define +# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process() +# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful. +# +function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) + # is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true. + string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE) + + # if we had a successful operation, save the THIS_VAR in VAR_OUPUT + if(${IS_VALID_VALUE}) + # strip newline chars in THIS_VAR parameter and save in VAR_VALUE + string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR}) + + # we'll could percolate the value to the parent for possible later use + # set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE) + + # but we're only using it here in this function + set(${VAR_OUPUT} ${VAR_VALUE}) + + # we'll print what we found to the console + message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") + + # the interesting part is defining the VAR_OUPUT name a value to use in the app + add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + else() + # if we get here, check the execute_process command and parameters. + message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT") + set(${VAR_OUPUT} "Unknown") + endif() +endfunction() # LIBWOLFSSL_SAVE_INFO if(NOT CMAKE_BUILD_EARLY_EXPANSION) # LIBWOLFSSL_VERSION_GIT_HASH - execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) - string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH ${LIBWOLFSSL_VERSION_GIT_HASH_VAR}) - string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) - if(${WOLFSSL_FOUND_GIT_VALUE}) - message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH=${LIBWOLFSSL_VERSION_GIT_HASH}") - #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR1}\"" APPEND) - #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR}\"" APPEND) - add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH}\") - endif() + execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}") # LIBWOLFSSL_VERSION_GIT_SHORT_HASH - execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_short} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) - string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_SHORT_HASH ${LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR}) - string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) - if(${WOLFSSL_FOUND_GIT_VALUE}) - message(STATUS "Found LIBWOLFSSL_VERSION_GIT_SHORT_HASH=${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}") - add_definitions(-DLIBWOLFSSL_VERSION_GIT_SHORT_HASH=\"${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}\") - endif() + execute_process(COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}") - # LIBWOLFSSL_VERSION_GIT_SHORT_HASH - execute_process(COMMAND ${git_cmd} ${git_show} ${git_no_patch} ${git_no_notes} ${git_pretty} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ) - string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH_DATE ${LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR}) - string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) - if(${WOLFSSL_FOUND_GIT_VALUE}) - message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH_DATE=${LIBWOLFSSL_VERSION_GIT_HASH_DATE}") - add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH_DATE=\"${LIBWOLFSSL_VERSION_GIT_HASH_DATE}\") - endif() + # LIBWOLFSSL_VERSION_GIT_HASH_DATE + execute_process(COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}") endif() message(STATUS "") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt index 77de27ee58..e52e6b25b9 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt @@ -40,7 +40,9 @@ endif() FILE(GLOB EXCLUDE_ASM *.S) file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S") -message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}") +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}") +endif() set(INCLUDE_PATH ${WOLFSSL_ROOT}) @@ -61,8 +63,12 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user # message(STATUS "") + message(STATUS "********************************************************************") message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "********************************************************************") message(STATUS "") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") + else() if(EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) # @@ -104,6 +110,7 @@ else() # # first check if there's a [root]/include/user_settings.h if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" ) + # we won't overwrite an existing user settings file, just note that we already have one: message(STATUS "Found wolfSSL user_settings.h in ${WOLFSSL_ROOT}/include/user_settings.h") else() message(STATUS "Installing wolfSSL user_settings.h to ${WOLFSSL_ROOT}/include/user_settings.h") @@ -123,13 +130,14 @@ else() endif() else() - # we did not find a ./components/wolfssl/include/ directory froim this pass of cmake. + # we did not find a ./components/wolfssl/include/ directory from this pass of cmake. if($WOLFSSL_FOUND_IDF) message(STATUS "") message(STATUS "WARNING: wolfSSL not found.") message(STATUS "") else() - # probably needs to be reparsed by Espressif + # probably needs to be re-parsed by Espressif + message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}") endif() # else we have not found ESP-IDF yet endif() # else not a local wolfSSL component @@ -199,7 +207,10 @@ endif() # check to see if there's both a local copy and EDP-IDF copy of the wolfssl components if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) message(STATUS "") + message(STATUS "") + message(STATUS "********************************************************************") message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "********************************************************************") message(STATUS "") endif() # end multiple component check diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt index 6257bbfad3..60bb32a35d 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt @@ -7,6 +7,8 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") set(COMPONENT_SRCS "client-tls.c" "wifi_connect.c") set(COMPONENT_ADD_INCLUDEDIRS "." "./include") +set (git_cmd "git") + if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) # # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user @@ -19,44 +21,54 @@ endif() register_component() -set (git_cmd "git") -set (git_rev_parse "rev-parse") -set (git_short "--short") -set (git_HEAD "HEAD") -set (git_show "show") -set (git_no_patch "--no-patch") -set (git_no_notes "--no-notes") -set (git_pretty "--pretty=\'\%cd\'" ) +# +# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT) +# +# Save the THIS_VAR as a string in a macro called VAR_OUPUT +# +# VAR_OUPUT: the name of the macro to define +# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process() +# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful. +# +function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) + # is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true. + string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE) + + # if we had a successful operation, save the THIS_VAR in VAR_OUPUT + if(${IS_VALID_VALUE}) + # strip newline chars in THIS_VAR parameter and save in VAR_VALUE + string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR}) + + # we'll could percolate the value to the parent for possible later use + # set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE) + + # but we're only using it here in this function + set(${VAR_OUPUT} ${VAR_VALUE}) + + # we'll print what we found to the console + message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") + + # the interesting part is defining the VAR_OUPUT name a value to use in the app + add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + else() + # if we get here, check the execute_process command and parameters. + message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT") + set(${VAR_OUPUT} "Unknown") + endif() +endfunction() # LIBWOLFSSL_SAVE_INFO if(NOT CMAKE_BUILD_EARLY_EXPANSION) # LIBWOLFSSL_VERSION_GIT_HASH - execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) - string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH ${LIBWOLFSSL_VERSION_GIT_HASH_VAR}) - string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) - if(${WOLFSSL_FOUND_GIT_VALUE}) - message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH=${LIBWOLFSSL_VERSION_GIT_HASH}") - #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR1}\"" APPEND) - #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR}\"" APPEND) - add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH}\") - endif() + execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}") # LIBWOLFSSL_VERSION_GIT_SHORT_HASH - execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_short} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) - string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_SHORT_HASH ${LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR}) - string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) - if(${WOLFSSL_FOUND_GIT_VALUE}) - message(STATUS "Found LIBWOLFSSL_VERSION_GIT_SHORT_HASH=${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}") - add_definitions(-DLIBWOLFSSL_VERSION_GIT_SHORT_HASH=\"${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}\") - endif() + execute_process(COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}") - # LIBWOLFSSL_VERSION_GIT_SHORT_HASH - execute_process(COMMAND ${git_cmd} ${git_show} ${git_no_patch} ${git_no_notes} ${git_pretty} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ) - string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH_DATE ${LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR}) - string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) - if(${WOLFSSL_FOUND_GIT_VALUE}) - message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH_DATE=${LIBWOLFSSL_VERSION_GIT_HASH_DATE}") - add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH_DATE=\"${LIBWOLFSSL_VERSION_GIT_HASH_DATE}\") - endif() + # LIBWOLFSSL_VERSION_GIT_HASH_DATE + execute_process(COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}") endif() message(STATUS "") diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt index 77de27ee58..e52e6b25b9 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt @@ -40,7 +40,9 @@ endif() FILE(GLOB EXCLUDE_ASM *.S) file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S") -message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}") +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}") +endif() set(INCLUDE_PATH ${WOLFSSL_ROOT}) @@ -61,8 +63,12 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user # message(STATUS "") + message(STATUS "********************************************************************") message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "********************************************************************") message(STATUS "") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") + else() if(EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) # @@ -104,6 +110,7 @@ else() # # first check if there's a [root]/include/user_settings.h if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" ) + # we won't overwrite an existing user settings file, just note that we already have one: message(STATUS "Found wolfSSL user_settings.h in ${WOLFSSL_ROOT}/include/user_settings.h") else() message(STATUS "Installing wolfSSL user_settings.h to ${WOLFSSL_ROOT}/include/user_settings.h") @@ -123,13 +130,14 @@ else() endif() else() - # we did not find a ./components/wolfssl/include/ directory froim this pass of cmake. + # we did not find a ./components/wolfssl/include/ directory from this pass of cmake. if($WOLFSSL_FOUND_IDF) message(STATUS "") message(STATUS "WARNING: wolfSSL not found.") message(STATUS "") else() - # probably needs to be reparsed by Espressif + # probably needs to be re-parsed by Espressif + message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}") endif() # else we have not found ESP-IDF yet endif() # else not a local wolfSSL component @@ -199,7 +207,10 @@ endif() # check to see if there's both a local copy and EDP-IDF copy of the wolfssl components if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) message(STATUS "") + message(STATUS "") + message(STATUS "********************************************************************") message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "********************************************************************") message(STATUS "") endif() # end multiple component check diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt index 4ca497ce98..e754ae0f22 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt @@ -7,6 +7,8 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") set(COMPONENT_SRCS "server-tls.c" "wifi_connect.c") set(COMPONENT_ADD_INCLUDEDIRS "." "./include") +set (git_cmd "git") + if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) # # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user @@ -20,46 +22,54 @@ endif() register_component() +# +# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT) +# +# Save the THIS_VAR as a string in a macro called VAR_OUPUT +# +# VAR_OUPUT: the name of the macro to define +# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process() +# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful. +# +function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) + # is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true. + string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE) -set (git_cmd "git") -set (git_rev_parse "rev-parse") -set (git_short "--short") -set (git_HEAD "HEAD") -set (git_show "show") -set (git_no_patch "--no-patch") -set (git_no_notes "--no-notes") -set (git_pretty "--pretty=\'\%cd\'" ) + # if we had a successful operation, save the THIS_VAR in VAR_OUPUT + if(${IS_VALID_VALUE}) + # strip newline chars in THIS_VAR parameter and save in VAR_VALUE + string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR}) + + # we'll could percolate the value to the parent for possible later use + # set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE) + + # but we're only using it here in this function + set(${VAR_OUPUT} ${VAR_VALUE}) + + # we'll print what we found to the console + message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") + + # the interesting part is defining the VAR_OUPUT name a value to use in the app + add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + else() + # if we get here, check the execute_process command and parameters. + message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT") + set(${VAR_OUPUT} "Unknown") + endif() +endfunction() # LIBWOLFSSL_SAVE_INFO if(NOT CMAKE_BUILD_EARLY_EXPANSION) # LIBWOLFSSL_VERSION_GIT_HASH - execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) - string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH ${LIBWOLFSSL_VERSION_GIT_HASH_VAR}) - string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) - if(${WOLFSSL_FOUND_GIT_VALUE}) - message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH=${LIBWOLFSSL_VERSION_GIT_HASH}") - #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR1}\"" APPEND) - #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR}\"" APPEND) - add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH}\") - endif() + execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}") # LIBWOLFSSL_VERSION_GIT_SHORT_HASH - execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_short} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) - string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_SHORT_HASH ${LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR}) - string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) - if(${WOLFSSL_FOUND_GIT_VALUE}) - message(STATUS "Found LIBWOLFSSL_VERSION_GIT_SHORT_HASH=${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}") - add_definitions(-DLIBWOLFSSL_VERSION_GIT_SHORT_HASH=\"${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}\") - endif() + execute_process(COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}") - # LIBWOLFSSL_VERSION_GIT_SHORT_HASH - execute_process(COMMAND ${git_cmd} ${git_show} ${git_no_patch} ${git_no_notes} ${git_pretty} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ) - string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH_DATE ${LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR}) - string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) - if(${WOLFSSL_FOUND_GIT_VALUE}) - message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH_DATE=${LIBWOLFSSL_VERSION_GIT_HASH_DATE}") - add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH_DATE=\"${LIBWOLFSSL_VERSION_GIT_HASH_DATE}\") - endif() + # LIBWOLFSSL_VERSION_GIT_HASH_DATE + execute_process(COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}") endif() message(STATUS "") - diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt index 77de27ee58..e52e6b25b9 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt @@ -40,7 +40,9 @@ endif() FILE(GLOB EXCLUDE_ASM *.S) file(GLOB_RECURSE EXCLUDE_ASM ${CMAKE_SOURCE_DIR} "${WOLFSSL_ROOT}/wolfcrypt/src/*.S") -message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}") +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + message(STATUS "EXCLUDE_ASM = ${EXCLUDE_ASM}") +endif() set(INCLUDE_PATH ${WOLFSSL_ROOT}) @@ -61,8 +63,12 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user # message(STATUS "") + message(STATUS "********************************************************************") message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "********************************************************************") message(STATUS "") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") + else() if(EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) # @@ -104,6 +110,7 @@ else() # # first check if there's a [root]/include/user_settings.h if( EXISTS "${WOLFSSL_ROOT}/include/user_settings.h" ) + # we won't overwrite an existing user settings file, just note that we already have one: message(STATUS "Found wolfSSL user_settings.h in ${WOLFSSL_ROOT}/include/user_settings.h") else() message(STATUS "Installing wolfSSL user_settings.h to ${WOLFSSL_ROOT}/include/user_settings.h") @@ -123,13 +130,14 @@ else() endif() else() - # we did not find a ./components/wolfssl/include/ directory froim this pass of cmake. + # we did not find a ./components/wolfssl/include/ directory from this pass of cmake. if($WOLFSSL_FOUND_IDF) message(STATUS "") message(STATUS "WARNING: wolfSSL not found.") message(STATUS "") else() - # probably needs to be reparsed by Espressif + # probably needs to be re-parsed by Espressif + message(STATUS "wolfSSL found IDF. Project Source:${PROJECT_SOURCE_DIR}") endif() # else we have not found ESP-IDF yet endif() # else not a local wolfSSL component @@ -199,7 +207,10 @@ endif() # check to see if there's both a local copy and EDP-IDF copy of the wolfssl components if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) message(STATUS "") + message(STATUS "") + message(STATUS "********************************************************************") message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "********************************************************************") message(STATUS "") endif() # end multiple component check diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt index d21ad32e11..5c9452238d 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt @@ -11,6 +11,8 @@ set(COMPONENT_SRCS "main.c") set(COMPONENT_ADD_INCLUDEDIRS ".") +set (git_cmd "git") + if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) # # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user @@ -23,44 +25,54 @@ endif() register_component() -set (git_cmd "git") -set (git_rev_parse "rev-parse") -set (git_short "--short") -set (git_HEAD "HEAD") -set (git_show "show") -set (git_no_patch "--no-patch") -set (git_no_notes "--no-notes") -set (git_pretty "--pretty=\'\%cd\'" ) +# +# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT) +# +# Save the THIS_VAR as a string in a macro called VAR_OUPUT +# +# VAR_OUPUT: the name of the macro to define +# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process() +# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful. +# +function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) + # is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true. + string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE) + + # if we had a successful operation, save the THIS_VAR in VAR_OUPUT + if(${IS_VALID_VALUE}) + # strip newline chars in THIS_VAR parameter and save in VAR_VALUE + string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR}) + + # we'll could percolate the value to the parent for possible later use + # set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE) + + # but we're only using it here in this function + set(${VAR_OUPUT} ${VAR_VALUE}) + + # we'll print what we found to the console + message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") + + # the interesting part is defining the VAR_OUPUT name a value to use in the app + add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + else() + # if we get here, check the execute_process command and parameters. + message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT") + set(${VAR_OUPUT} "Unknown") + endif() +endfunction() # LIBWOLFSSL_SAVE_INFO if(NOT CMAKE_BUILD_EARLY_EXPANSION) # LIBWOLFSSL_VERSION_GIT_HASH - execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) - string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH ${LIBWOLFSSL_VERSION_GIT_HASH_VAR}) - string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) - if(${WOLFSSL_FOUND_GIT_VALUE}) - message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH=${LIBWOLFSSL_VERSION_GIT_HASH}") - #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR1}\"" APPEND) - #idf_build_set_property(COMPILE_DEFINITIONS "LIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH_VAR}\"" APPEND) - add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH=\"${LIBWOLFSSL_VERSION_GIT_HASH}\") - endif() + execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}") # LIBWOLFSSL_VERSION_GIT_SHORT_HASH - execute_process(COMMAND ${git_cmd} ${git_rev_parse} ${git_short} ${git_HEAD} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ERROR_QUIET ) - string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_SHORT_HASH ${LIBWOLFSSL_VERSION_GIT_SHORT_HASH_VAR}) - string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) - if(${WOLFSSL_FOUND_GIT_VALUE}) - message(STATUS "Found LIBWOLFSSL_VERSION_GIT_SHORT_HASH=${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}") - add_definitions(-DLIBWOLFSSL_VERSION_GIT_SHORT_HASH=\"${LIBWOLFSSL_VERSION_GIT_SHORT_HASH}\") - endif() + execute_process(COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}") - # LIBWOLFSSL_VERSION_GIT_SHORT_HASH - execute_process(COMMAND ${git_cmd} ${git_show} ${git_no_patch} ${git_no_notes} ${git_pretty} OUTPUT_VARIABLE LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR RESULT_VARIABLE WOLFSSL_GIT_PEEK_RESULT ) - string(REPLACE "\n" "" LIBWOLFSSL_VERSION_GIT_HASH_DATE ${LIBWOLFSSL_VERSION_GIT_HASH_DATE_VAR}) - string(COMPARE EQUAL "${WOLFSSL_GIT_PEEK_RESULT}" "0" WOLFSSL_FOUND_GIT_VALUE) - if(${WOLFSSL_FOUND_GIT_VALUE}) - message(STATUS "Found LIBWOLFSSL_VERSION_GIT_HASH_DATE=${LIBWOLFSSL_VERSION_GIT_HASH_DATE}") - add_definitions(-DLIBWOLFSSL_VERSION_GIT_HASH_DATE=\"${LIBWOLFSSL_VERSION_GIT_HASH_DATE}\") - endif() + # LIBWOLFSSL_VERSION_GIT_HASH_DATE + execute_process(COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}") endif() message(STATUS "") From 6c9dbcc7f471e8b006bb8af1bee65614a574f33c Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Wed, 1 Feb 2023 19:46:48 -0800 Subject: [PATCH 04/11] multiple wolfSSL installs is now a fatal Espressif build error --- .../components/wolfssl/CMakeLists.txt | 19 +++++++++++++++---- .../components/wolfssl/CMakeLists.txt | 19 +++++++++++++++---- .../components/wolfssl/CMakeLists.txt | 19 +++++++++++++++---- .../components/wolfssl/CMakeLists.txt | 19 +++++++++++++++---- 4 files changed, 60 insertions(+), 16 deletions(-) diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt index e52e6b25b9..2423b802c1 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/components/wolfssl/CMakeLists.txt @@ -63,14 +63,25 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user # message(STATUS "") - message(STATUS "********************************************************************") - message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") - message(STATUS "********************************************************************") + message(STATUS "**************************************************************************************") + message(STATUS "") + message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") + message(STATUS "To proceed: ") message(STATUS "") + message(STATUS "Remove either the local project component: ${CMAKE_HOME_DIRECTORY}/components/wolfssl/ ") + message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ") + message(STATUS "") + message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.") + message(STATUS "") + message(STATUS "**************************************************************************************") + message(STATUS "") + + # Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition: set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") else() - if(EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) # # wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup. # diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt index e52e6b25b9..2423b802c1 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/components/wolfssl/CMakeLists.txt @@ -63,14 +63,25 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user # message(STATUS "") - message(STATUS "********************************************************************") - message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") - message(STATUS "********************************************************************") + message(STATUS "**************************************************************************************") + message(STATUS "") + message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") + message(STATUS "To proceed: ") message(STATUS "") + message(STATUS "Remove either the local project component: ${CMAKE_HOME_DIRECTORY}/components/wolfssl/ ") + message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ") + message(STATUS "") + message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.") + message(STATUS "") + message(STATUS "**************************************************************************************") + message(STATUS "") + + # Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition: set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") else() - if(EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) # # wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup. # diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt index e52e6b25b9..2423b802c1 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/components/wolfssl/CMakeLists.txt @@ -63,14 +63,25 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user # message(STATUS "") - message(STATUS "********************************************************************") - message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") - message(STATUS "********************************************************************") + message(STATUS "**************************************************************************************") + message(STATUS "") + message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") + message(STATUS "To proceed: ") message(STATUS "") + message(STATUS "Remove either the local project component: ${CMAKE_HOME_DIRECTORY}/components/wolfssl/ ") + message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ") + message(STATUS "") + message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.") + message(STATUS "") + message(STATUS "**************************************************************************************") + message(STATUS "") + + # Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition: set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") else() - if(EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) # # wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup. # diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt index e52e6b25b9..2423b802c1 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/components/wolfssl/CMakeLists.txt @@ -63,14 +63,25 @@ if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PA # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user # message(STATUS "") - message(STATUS "********************************************************************") - message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") - message(STATUS "********************************************************************") + message(STATUS "**************************************************************************************") + message(STATUS "") + message(STATUS "Error: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") + message(STATUS "To proceed: ") message(STATUS "") + message(STATUS "Remove either the local project component: ${CMAKE_HOME_DIRECTORY}/components/wolfssl/ ") + message(STATUS "or the Espressif shared component installed at: $ENV{IDF_PATH}/components/wolfssl/ ") + message(STATUS "") + message(FATAL_ERROR "Please use wolfSSL in either local project or Espressif components, but not both.") + message(STATUS "") + message(STATUS "**************************************************************************************") + message(STATUS "") + + # Optional: if you change the above FATAL_ERROR to STATUS you can warn at runtime with this macro definition: set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") else() - if(EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + if( EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) # # wolfSSL found in ESP-IDF components and is assumed to be already configured in user_settings.h via setup. # From 2fd747dc519bc934ffc525398a0b745ca72dc0bd Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Thu, 2 Feb 2023 09:08:58 -0800 Subject: [PATCH 05/11] Examples no longer need setup --- IDE/Espressif/ESP-IDF/compileAllExamples.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IDE/Espressif/ESP-IDF/compileAllExamples.sh b/IDE/Espressif/ESP-IDF/compileAllExamples.sh index 4835f80f35..5efa50d747 100755 --- a/IDE/Espressif/ESP-IDF/compileAllExamples.sh +++ b/IDE/Espressif/ESP-IDF/compileAllExamples.sh @@ -4,7 +4,7 @@ # cd wolfssl && docker run --rm -v $PWD:/project -w /project espressif/idf:latest IDE/Espressif/ESP-IDF/compileAllExamples.sh SCRIPT_DIR=$(builtin cd ${BASH_SOURCE%/*}; pwd) -pushd ${SCRIPT_DIR} && ./setup.sh; popd +# pushd ${SCRIPT_DIR} && ./setup.sh; popd for file in "benchmark" "client" "server" "test"; do cd ${IDF_PATH}/examples/protocols/wolfssl_${file}/ && idf.py build if [ $? -ne 0 ]; then From c68c039b188c9416af2940805d1d4b528b583e3b Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Thu, 2 Feb 2023 10:00:35 -0800 Subject: [PATCH 06/11] CompileAll builds local examples, not IDF_PATH ones --- IDE/Espressif/ESP-IDF/compileAllExamples.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/IDE/Espressif/ESP-IDF/compileAllExamples.sh b/IDE/Espressif/ESP-IDF/compileAllExamples.sh index 5efa50d747..fd5fcb3c1d 100755 --- a/IDE/Espressif/ESP-IDF/compileAllExamples.sh +++ b/IDE/Espressif/ESP-IDF/compileAllExamples.sh @@ -4,11 +4,10 @@ # cd wolfssl && docker run --rm -v $PWD:/project -w /project espressif/idf:latest IDE/Espressif/ESP-IDF/compileAllExamples.sh SCRIPT_DIR=$(builtin cd ${BASH_SOURCE%/*}; pwd) -# pushd ${SCRIPT_DIR} && ./setup.sh; popd for file in "benchmark" "client" "server" "test"; do - cd ${IDF_PATH}/examples/protocols/wolfssl_${file}/ && idf.py build + pushd ${SCRIPT_DIR}/examples/wolfssl_${file}/ && idf.py build; popd if [ $? -ne 0 ]; then echo "Failed in ${file}" exit 1 fi -done +done \ No newline at end of file From 0e013eeb5be052a11b78c82984a2b2177e168f61 Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Sun, 5 Feb 2023 12:42:05 -0800 Subject: [PATCH 07/11] Espressif compileAllExamples both local & ESP-IDF components --- IDE/Espressif/ESP-IDF/compileAllExamples.sh | 108 +++++++++++++++++++- 1 file changed, 103 insertions(+), 5 deletions(-) diff --git a/IDE/Espressif/ESP-IDF/compileAllExamples.sh b/IDE/Espressif/ESP-IDF/compileAllExamples.sh index fd5fcb3c1d..bc8dff7858 100755 --- a/IDE/Espressif/ESP-IDF/compileAllExamples.sh +++ b/IDE/Espressif/ESP-IDF/compileAllExamples.sh @@ -1,13 +1,111 @@ #!/bin/bash - +# +# testing script: compileAllExamples +# +# This script will compile all the local examples, optionally installing wolfSSL in the ESP-IDF components directory. +# # Example usage: # cd wolfssl && docker run --rm -v $PWD:/project -w /project espressif/idf:latest IDE/Espressif/ESP-IDF/compileAllExamples.sh - +# +# Parameter option to also run the ./setup.sh to install the wolfSSL component in ESP-IDF and test for multiple installs: +# +# --run-setup +# +# Note that once installed, the wolfSSL component will need to be manually removed to successfully run this script. +# +if [[ "$IDF_PATH" == "" ]]; then + echo "Error: $IDF_PATH not found; run Espressif export.sh" + exit 1 +fi SCRIPT_DIR=$(builtin cd ${BASH_SOURCE%/*}; pwd) +RUN_SETUP=$1 +THIS_ERR=0 + +echo "Found IDF_PATH = $IDF_PATH" + +# Regular tests of wolfSSL in local component directories of each project: +# +# Note these tests should FAIL if wolfSSL is already installed in ESP-IDF +# for file in "benchmark" "client" "server" "test"; do - pushd ${SCRIPT_DIR}/examples/wolfssl_${file}/ && idf.py build; popd - if [ $? -ne 0 ]; then + pushd ${SCRIPT_DIR}/examples/wolfssl_${file}/ && idf.py fullclean build; + THIS_ERR=$? + popd + if [ $THIS_ERR -ne 0 ]; then echo "Failed in ${file}" exit 1 fi -done \ No newline at end of file +done + + +# Check for option to also install wolfSSL. +# +# When doing so, we'll run a check that multiple installs should cause build failure. +if [[ "$RUN_SETUP" == "--run-setup" ]]; then + echo "Running wolfSSL setup.sh" + + # install wolfSSL into EDP-IDF shared components directory. + ./setup.sh --verbose + + THIS_ERR=$? + if [ $? -ne 0 ]; then + echo "Failed running setup.sh" + exit 1 + fi + + # Check ESP-IDF install: + # + # The wolfssl_test_idf should NOT have a local components/wolfssl when testing! + # This test is to confirm the ESP-IDF component build properly after setup. + # + echo "" + echo "Testing a build of wolfSSL in ESP-IDF components directory" + echo "" + for file in "test_idf"; do + pushd ${SCRIPT_DIR}/examples/wolfssl_${file}/ && idf.py fullclean build; + THIS_ERR=$? + popd + if [ $? -ne 0 ]; then + echo "Failed in ${file}" + exit 1 + fi + done + + # Check multiple installs: the wolfSSL component in ESP-IDF and local directory: + # + # The wolfssl_test project already has a local wolfSSL component directory. + # + # Once wolfssl has been installed to ESP-IDF components, the local + # component build SHOULD fail: + echo "" + echo "Testing a build of wolfSSL in both local and ESP-IDF components directory" + echo "" + for file in "test"; do + pushd ${SCRIPT_DIR}/examples/wolfssl_${file}/ && idf.py fullclean build; + THIS_ERR=$? + popd + if [ $THIS_ERR -ne 0 ]; then + echo "" + echo "Success: Confirmed build fails when wolfSSL found in ESP-IDF and local project." + echo "" + else + echo "Error: build should have failed when wolfSSL found in ESP-IDF and local project." + exit 1 + fi + done +else + echo "Skipping ESP-IDF install tests. For these tests, use parameter: --run-setup" +fi + + +# Show a reminder that wolfSSL was installed as a shared component. +if [[ "$RUN_SETUP" == "--run-setup" ]]; then + echo "" + echo "wolfSSL was installed as an ESP-IDF component. This will be in conflict with any project that has a local component." + echo "" + echo "Delete the installed component before re-running this test." + echo "" +fi + +# Done +echo "Completed compileAllExamples in $SCRIPT_DIR" From f657e8ff62d5a2e11c7821eb46302954a28c9f7f Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Sun, 5 Feb 2023 12:43:52 -0800 Subject: [PATCH 08/11] add wolfssl_test_idf test project --- .../examples/wolfssl_test_idf/CMakeLists.txt | 12 + .../wolfssl_test_idf/Kconfig.projbuild | 29 ++ .../examples/wolfssl_test_idf/README.md | 146 +++++++++ .../VisualGDB/VisualGDB_wolfssl_test_idf.sln | 37 +++ .../VisualGDB_wolfssl_test_idf.vgdbproj | 269 +++++++++++++++++ .../examples/wolfssl_test_idf/component.mk | 8 + .../wolfssl_test_idf/main/CMakeLists.txt | 79 +++++ .../wolfssl_test_idf/main/Kconfig.projbuild | 29 ++ .../wolfssl_test_idf/main/component.mk | 3 + .../examples/wolfssl_test_idf/main/main.c | 231 +++++++++++++++ .../wolfssl_test_idf/main/main_wip.c.ex | 278 ++++++++++++++++++ .../wolfssl_test_idf/main/time_helper.c | 119 ++++++++ .../wolfssl_test_idf/main/time_helper.h | 32 ++ .../wolfssl_test_idf/sdkconfig.defaults | 49 +++ 14 files changed, 1321 insertions(+) create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/CMakeLists.txt create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/Kconfig.projbuild create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/README.md create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/VisualGDB/VisualGDB_wolfssl_test_idf.sln create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/VisualGDB/VisualGDB_wolfssl_test_idf.vgdbproj create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/component.mk create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/CMakeLists.txt create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/Kconfig.projbuild create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/component.mk create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/main.c create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/main_wip.c.ex create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/time_helper.c create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/time_helper.h create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/sdkconfig.defaults diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/CMakeLists.txt new file mode 100644 index 0000000000..914efa6cbd --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/CMakeLists.txt @@ -0,0 +1,12 @@ +# The following lines of boilerplate have to be in your project's +# CMakeLists in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.5) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) + +set(COMPONENTS + main + wolfssl +) # set components + +project(wolfssl_test) diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/Kconfig.projbuild b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/Kconfig.projbuild new file mode 100644 index 0000000000..8fd12d3890 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/Kconfig.projbuild @@ -0,0 +1,29 @@ +menu "Example Configuration" + +config BENCH_ARGV + string "Arguments for benchmark test" + default "-lng 0" + help + -? Help, print this usage + 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. + - 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 Display benchmark result by specified language. + 0: English, 1: Japanese + Size of block in bytes + + e.g -lng 1 + e.g sha + +endmenu diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/README.md new file mode 100644 index 0000000000..e34220d9ee --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/README.md @@ -0,0 +1,146 @@ +# wolfSSL Crypt Test Example + +The Example contains of wolfSSL IDF test program. + +This IDF version does NOT contain a local component and exists only to test wolfSSL installed to the ESP-IDF components directory. + +The recommended configuration is to have only the CMakeLists.txt in the local project components\wolfssl directory. See the [wolfssl_test](../wolfssl_test/README.md) example. + +1. `idf.py menuconfig` to configure the program. + 1-1. Example Configuration -> + + TEST_ARG : argument that you want to use. Default is "-lng 0" + The list of argument can be find in help. + +When you want to run the test program + +1. `idf.py -p flash` to compile and load the firmware +2. `idf.py monitor` to see the message + +See the README.md file in the upper level 'examples' directory for more information about examples. + +Reminder than when building on WSL in `/mnt/c` there will be a noticeable performance degradation at compile time. Using `~/` will be faster at the cost of shared filesystems. + +Example build on WSL, assuming `git clone` from `c:\workspace`: + +``` +# Optionally install wolfSSL component +# cd /mnt/c/workspace/wolfssl/IDE/Espressif/ESP-IDF +./setup.sh + +# switch to test example +cd /mnt/c/workspace/wolfssl/IDE/Espressif/ESP-IDF/examples/wolfssl_test + +# Pick ESP-IDF install directory, this one for v4.4.2 in VisualGDB +. /mnt/c/SysGCC/esp32/esp-idf/v4.4.2/export.sh + +# build and flash, in this example to COM20 +idf.py build flash -p /dev/ttyS20 -b 921600 monitor +``` + +## Example Output + +Note the default wolfSSL `user_settings.h` is configured by default to be the most +compatible across the widest ranges of targets. Contact wolfSSL at support@wolfssl.com +for help in optimizing for your particular application, or see the +[docs](https://www.wolfssl.com/documentation/manuals/wolfssl/index.html). + +Compiled and flashed with `idf.py build flash -p /dev/ttyS7 -b 921600 monitor`: + +``` +ets Jun 8 2016 00:22:57 + +rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) +configsip: 0, SPIWP:0xee +clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 +mode:DIO, clock div:2 +load:0x3fff0030,len:6612 +load:0x40078000,len:14788 +load:0x40080400,len:3792 +entry 0x40080694 +I (26) boot: ESP-IDF v4.4.1-dirty 2nd stage bootloader +I (26) boot: compile time 15:25:38 +I (26) boot: chip revision: 1 +I (29) boot_comm: chip revision: 1, min. bootloader chip revision: 0 +I (37) boot.esp32: SPI Speed : 40MHz +I (41) boot.esp32: SPI Mode : DIO +I (46) boot.esp32: SPI Flash Size : 2MB +I (50) boot: Enabling RNG early entropy source... +I (56) boot: Partition Table: +I (59) boot: ## Label Usage Type ST Offset Length +I (67) boot: 0 nvs WiFi data 01 02 00009000 00006000 +I (74) boot: 1 phy_init RF data 01 01 0000f000 00001000 +I (81) boot: 2 factory factory app 00 00 00010000 00100000 +I (89) boot: End of partition table +I (93) boot_comm: chip revision: 1, min. application chip revision: 0 +I (100) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=16ca4h ( 93348) map +I (143) esp_image: segment 1: paddr=00026ccc vaddr=3ffb0000 size=024d4h ( 9428) load +I (147) esp_image: segment 2: paddr=000291a8 vaddr=40080000 size=06e70h ( 28272) load +I (160) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=412d8h (266968) map +I (257) esp_image: segment 4: paddr=00071300 vaddr=40086e70 size=045a8h ( 17832) load +I (265) esp_image: segment 5: paddr=000758b0 vaddr=50000000 size=00010h ( 16) load +I (270) boot: Loaded app from partition at offset 0x10000 +I (270) boot: Disabling RNG early entropy source... +I (285) cpu_start: Pro cpu up. +I (286) cpu_start: Starting app cpu, entry point is 0x40081088 +I (273) cpu_start: App cpu up. +I (300) cpu_start: Pro cpu start user code +I (300) cpu_start: cpu freq: 160000000 +I (300) cpu_start: Application information: +I (305) cpu_start: Project name: wolfssl_test +I (310) cpu_start: App version: v5.5.3-stable-108-gbd7b442df-di +I (317) cpu_start: Compile time: Nov 17 2022 15:24:40 +I (323) cpu_start: ELF file SHA256: 90957eeb4f0d2246... +I (329) cpu_start: ESP-IDF: v4.4.1-dirty +I (335) heap_init: Initializing. RAM available for dynamic allocation: +I (342) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM +I (348) heap_init: At 3FFB2DF0 len 0002D210 (180 KiB): DRAM +I (354) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM +I (360) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM +I (367) heap_init: At 4008B418 len 00014BE8 (82 KiB): IRAM +I (374) spi_flash: detected chip: generic +I (378) spi_flash: flash io: dio +W (382) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header. +I (396) cpu_start: Starting scheduler on PRO CPU. +I (0) cpu_start: Starting scheduler on APP CPU. +------------------------------------------------------------------------------ + wolfSSL version 5.5.3 +------------------------------------------------------------------------------ +error test passed! +MEMORY test passed! +base64 test passed! +asn test passed! +RANDOM test passed! +MD5 test passed! +MD4 test passed! +SHA test passed! +SHA-256 test passed! +SHA-512 test passed! +Hash test passed! +HMAC-MD5 test passed! +HMAC-SHA test passed! +HMAC-SHA256 test passed! +HMAC-SHA512 test passed! +HMAC-KDF test passed! +TLSv1.3 KDF test passed! +GMAC test passed! +DES test passed! +DES3 test passed! +AES test passed! +AES192 test passed! +AES256 test passed! +AES-GCM test passed! +RSA test passed! +PWDBASED test passed! +ECC test passed! +ECC buffer test passed! +CURVE25519 test passed! +ED25519 test passed! +logging test passed! +time test passed! +mutex test passed! +Test complete +I (136548) wolfcrypt_test: Exiting main with return code: 0 + +I (136548) wolfssl_test: wolf_test_task complete success result code = 0 +``` diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/VisualGDB/VisualGDB_wolfssl_test_idf.sln b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/VisualGDB/VisualGDB_wolfssl_test_idf.sln new file mode 100644 index 0000000000..41ea3189cc --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/VisualGDB/VisualGDB_wolfssl_test_idf.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.33027.164 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_test_idf", "VisualGDB_wolfssl_test_idf.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8CDC7138-1315-4362-8D34-6862D4A1CACF}" + ProjectSection(SolutionItems) = preProject + ..\..\..\compileAllExamples.sh = ..\..\..\compileAllExamples.sh + ..\..\..\setup.sh = ..\..\..\setup.sh + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|VisualGDB = Debug|VisualGDB + Release|VisualGDB = Release|VisualGDB + Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB + Tests (Release)|VisualGDB = Tests (Release)|VisualGDB + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {79CA8274-53BD-4953-A95F-E1C88CF70B24} + EndGlobalSection +EndGlobal diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/VisualGDB/VisualGDB_wolfssl_test_idf.vgdbproj b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/VisualGDB/VisualGDB_wolfssl_test_idf.vgdbproj new file mode 100644 index 0000000000..28bcb2d1dc --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/VisualGDB/VisualGDB_wolfssl_test_idf.vgdbproj @@ -0,0 +1,269 @@ + + + + + + Unknown + + true + + 35e5525f-318a-466e-a8c7-36548547d801 + true + true + SourceDirs + + + + + + com.visualgdb.xtensa-esp32-elf + + 11.2.0 + 9.2.90 + 2 + + + .. + DEBUG + build/$(PlatformName)/$(ConfigurationName) + + false + $(ToolchainNinja) + $(BuildDir) + + + + false + $(SYSPROGS_CMAKE_PATH) + + + true + false + false + Ninja + false + RemoveBuildDirectory + false + + + true + true + true + false + true + false + true + HideOuterProjectTargets + true + false + true + + + true + eadcc9ab-72b3-4b51-a838-593e5d80ddf7 + + Upper + HeaderDirectoryAndSubdirectories + true + + + release/v5.0 + esp-idf/v5.0 + ESPIDF + + COM20 + false + false + ESP32 + + + + + + + + + + + + + + + Default + + + + COM20 + + 115200 + 8 + None + One + None + + + 0 + false + false + false + ASCII + + + 255 + 0 + 0 + 0 + + + 255 + 169 + 169 + 169 + + + 255 + 211 + 211 + 211 + + + 255 + 144 + 238 + 144 + + + 255 + 169 + 169 + 169 + + + + 16 + true + true + true + true + 0 + + LF + false + false + false + + + + true + + + + + Unknown + + true + true + true + + + + false + + + + + Debug + + + + Release + + + + + + + + + false + false + false + false + false + false + false + false + false + + false + false + false + false + false + false + true + false + None + false + false + app_main + true + false + false + true + 0 + false + 0 + true + false + + + openocd + + -f interface/tigard.cfg -c "adapter_khz 3000" -f target/esp32.cfg + + + + false + + 131072 + Enabled + + set remotetimeout 60 + target remote :$$SYS:GDB_PORT$$ + mon gdb_breakpoint_override hard + mon reset halt + load + + false + 0 + 0 + false + + 5000 + 1 + true + + size2MB + freq40M + DIO + + true + + + true + Auto + 0 + false + false + true + false + false + + _estack + 0 + false + + true + + \ No newline at end of file diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/component.mk b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/component.mk new file mode 100644 index 0000000000..e19e22a535 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/component.mk @@ -0,0 +1,8 @@ +# +# Main component makefile. +# +# This Makefile can be left empty. By default, it will take the sources in the +# src/ directory, compile them and link them into lib(subdirectory_name).a +# in the build directory. This behaviour is entirely configurable, +# please read the ESP-IDF documents if you need to do this. +# \ No newline at end of file diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/CMakeLists.txt b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/CMakeLists.txt new file mode 100644 index 0000000000..5c9452238d --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/CMakeLists.txt @@ -0,0 +1,79 @@ + +# +# wolfssl crypt test +# +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_USER_SETTINGS") + +set(COMPONENT_SRCS "main.c") + +# when using time helper: +# set(COMPONENT_SRCS "main.c" "time_helper.c") + +set(COMPONENT_ADD_INCLUDEDIRS ".") + +set (git_cmd "git") + +if( EXISTS "${CMAKE_HOME_DIRECTORY}/components/wolfssl/" AND EXISTS "$ENV{IDF_PATH}/components/wolfssl/" ) + # + # wolfSSL found in both ESP-IDF and local project - needs to be resolved by user + # + message(STATUS "") + message(STATUS "WARNING: Found components/wolfssl in both local project and IDF_PATH") + message(STATUS "") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_MULTI_INSTALL_WARNING") +endif() + +register_component() + +# +# LIBWOLFSSL_SAVE_INFO(VAR_OUPUT THIS_VAR VAR_RESULT) +# +# Save the THIS_VAR as a string in a macro called VAR_OUPUT +# +# VAR_OUPUT: the name of the macro to define +# THIS_VAR: the OUTPUT_VARIABLE result from a execute_process() +# VAR_RESULT: the RESULT_VARIABLE from a execute_process(); "0" if successful. +# +function ( LIBWOLFSSL_SAVE_INFO VAR_OUPUT THIS_VAR VAR_RESULT ) + # is the RESULT_VARIABLE output value 0? If so, IS_VALID_VALUE is true. + string(COMPARE EQUAL "${VAR_RESULT}" "0" IS_VALID_VALUE) + + # if we had a successful operation, save the THIS_VAR in VAR_OUPUT + if(${IS_VALID_VALUE}) + # strip newline chars in THIS_VAR parameter and save in VAR_VALUE + string(REPLACE "\n" "" VAR_VALUE ${THIS_VAR}) + + # we'll could percolate the value to the parent for possible later use + # set(${VAR_OUPUT} ${VAR_VALUE} PARENT_SCOPE) + + # but we're only using it here in this function + set(${VAR_OUPUT} ${VAR_VALUE}) + + # we'll print what we found to the console + message(STATUS "Found ${VAR_OUPUT}=${VAR_VALUE}") + + # the interesting part is defining the VAR_OUPUT name a value to use in the app + add_definitions(-D${VAR_OUPUT}=\"${VAR_VALUE}\") + else() + # if we get here, check the execute_process command and parameters. + message(STATUS "LIBWOLFSSL_SAVE_INFO encountered a non-zero VAR_RESULT") + set(${VAR_OUPUT} "Unknown") + endif() +endfunction() # LIBWOLFSSL_SAVE_INFO + +if(NOT CMAKE_BUILD_EARLY_EXPANSION) + # LIBWOLFSSL_VERSION_GIT_HASH + execute_process(COMMAND ${git_cmd} "rev-parse" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH "${TMP_OUT}" "${TMP_RES}") + + # LIBWOLFSSL_VERSION_GIT_SHORT_HASH + execute_process(COMMAND ${git_cmd} "rev-parse" "--short" "HEAD" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ERROR_QUIET ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_SHORT_HASH "${TMP_OUT}" "${TMP_RES}") + + # LIBWOLFSSL_VERSION_GIT_HASH_DATE + execute_process(COMMAND ${git_cmd} "show" "--no-patch" "--no-notes" "--pretty=\'\%cd\'" OUTPUT_VARIABLE TMP_OUT RESULT_VARIABLE TMP_RES ) + LIBWOLFSSL_SAVE_INFO(LIBWOLFSSL_VERSION_GIT_HASH_DATE "${TMP_OUT}" "${TMP_RES}") +endif() + +message(STATUS "") + diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/Kconfig.projbuild b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/Kconfig.projbuild new file mode 100644 index 0000000000..264c808834 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/Kconfig.projbuild @@ -0,0 +1,29 @@ +menu "Example Configuration" + +config BENCH_ARGV + string "Arguments for benchmark test" + default "-lng 0" + help + -? Help, print this usage + 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. + - 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 Display benchmark result by specified language. + 0: English, 1: Japanese + Size of block in bytes + + e.g -lng 1 + e.g sha + +endmenu diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/component.mk b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/component.mk new file mode 100644 index 0000000000..d31083f65b --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/component.mk @@ -0,0 +1,3 @@ +# +# Main Makefile. This is basically the same as a component makefile. +# \ No newline at end of file diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/main.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/main.c new file mode 100644 index 0000000000..01538f72e3 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/main.c @@ -0,0 +1,231 @@ +/* main.c + * + * Copyright (C) 2006-2023 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* ESP-IDF */ +#include +#include "sdkconfig.h" + +/* wolfSSL */ +#include +#include +#include +#ifndef WOLFSSL_ESPIDF +#warning "problem with wolfSSL user settings. Check components/wolfssl/include" +#endif + +#include + +/* +** the wolfssl component can be installed in either: +** +** - the ESP-IDF component directory +** +** ** OR ** +** +** - the local project component directory +** +** it is not recommended to install in both. +** +*/ + +/* +** although the wolfcrypt/test includes a default time setting, +** see the enclosed optional time helper for adding NNTP. +** be sure to add "time_helper.c" in main/CMakeLists.txt +*/ +#undef WOLFSSL_USE_TIME_HELPER +#if defined(WOLFSSL_USE_TIME_HELPER) + #include "time_helper.h" */ +#endif + +/* see wolfssl/wolfcrypt/test/test.h */ +extern void wolf_crypt_task(); + + +static const char* const TAG = "wolfssl_test"; + +#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \ + && defined(WOLFSSL_ATECC508A) + +#include "wolfssl/wolfcrypt/port/atmel/atmel.h" + +/* when you need to use a custom slot allocation, */ +/* enable the definition CUSTOM_SLOT_ALLOCAION. */ +#if defined(CUSTOM_SLOT_ALLOCATION) + +static byte mSlotList[ATECC_MAX_SLOT]; + +/* initialize slot array */ +void my_atmel_slotInit() +{ + int i; + for (i = 0; i < ATECC_MAX_SLOT; i++) { + mSlotList[i] = ATECC_INVALID_SLOT; + } +} + +/* allocate slot depending on slotType */ +int my_atmel_alloc(int slotType) +{ + int i, slot = ATECC_INVALID_SLOT; + + switch (slotType) { + case ATMEL_SLOT_ENCKEY: + slot = 4; + break; + case ATMEL_SLOT_DEVICE: + slot = 0; + break; + case ATMEL_SLOT_ECDHE: + slot = 0; + break; + case ATMEL_SLOT_ECDHE_ENC: + slot = 4; + break; + case ATMEL_SLOT_ANY: + for (i = 0; i < ATECC_MAX_SLOT; i++) { + if (mSlotList[i] == ATECC_INVALID_SLOT) { + slot = i; + break; + } /* if */ + } /* for */ + } /* switch */ + + return slot; +} + +/* free slot array */ +void my_atmel_free(int slotId) +{ + if (slotId >= 0 && slotId < ATECC_MAX_SLOT) { + mSlotList[slotId] = ATECC_INVALID_SLOT; + } +} + +#endif /* CUSTOM_SLOT_ALLOCATION */ +#endif /* WOLFSSL_ESPWROOM32SE && HAVE_PK_CALLBACK && WOLFSSL_ATECC508A */ + + +/* entry point */ +void app_main(void) +{ + int rc = 0; + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + + + ESP_LOGI(TAG, "CONFIG_IDF_TARGET = %s", CONFIG_IDF_TARGET); + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_STRING = %s", LIBWOLFSSL_VERSION_STRING); + +#if defined(LIBWOLFSSL_VERSION_GIT_HASH) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH = %s", LIBWOLFSSL_VERSION_GIT_HASH); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_SHORT_HASH ) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_SHORT_HASH = %s", LIBWOLFSSL_VERSION_GIT_SHORT_HASH); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_HASH_DATE) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH_DATE = %s", LIBWOLFSSL_VERSION_GIT_HASH_DATE); +#endif + + + /* some interesting settings are target specific (ESP32, -C3, -S3, etc */ +#if defined(CONFIG_IDF_TARGET_ESP32C3) + /* not available for C3 at this time */ +#elif defined(CONFIG_IDF_TARGET_ESP32S3) + ESP_LOGI(TAG, "CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ = %u MHz", + CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ + ); + ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount); +#else + ESP_LOGI(TAG, "CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ = %u MHz", + CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ + ); + ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount); +#endif + + /* all platforms: stack high water mark check */ + ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL)); + + /* check to see if we are using hardware encryption */ +#if defined(NO_ESP32WROOM32_CRYPT) + ESP_LOGI(TAG, "NO_ESP32WROOM32_CRYPT defined! HW acceleration DISABLED."); +#else + #if defined(CONFIG_IDF_TARGET_ESP32C3) + #error "ESP32WROOM32_CRYPT not yet supported on ESP32-C3" + #elif defined(CONFIG_IDF_TARGET_ESP32S2) + #error "ESP32WROOM32_CRYPT not yet supported on ESP32-S2" + #elif defined(CONFIG_IDF_TARGET_ESP32S3) + #error "ESP32WROOM32_CRYPT not yet supported on ESP32-S3" + #else + ESP_LOGI(TAG, "ESP32WROOM32_CRYPT is enabled."); + #endif +#endif + + + +#if defined (WOLFSSL_USE_TIME_HELPER) + set_time(); +#endif + +/* when using atecc608a on esp32-wroom-32se */ +#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \ + && defined(WOLFSSL_ATECC508A) + #if defined(CUSTOM_SLOT_ALLOCATION) + my_atmel_slotInit(); + /* to register the callback, it needs to be initialized. */ + if ((wolfCrypt_Init()) != 0) { + ESP_LOGE(TAG, "wolfCrypt_Init failed"); + return; + } + atmel_set_slot_allocator(my_atmel_alloc, my_atmel_free); + #endif +#endif + +#ifdef NO_CRYPT_TEST + ESP_LOGI(TAG, "NO_CRYPT_TEST defined, skipping wolf_test_task"); +#else + /* Although wolfCrypt_Init() may be explicitly called above, + ** Note it is still always called in wolf_test_task. + */ + rc = wolf_test_task(); + /* note wolfCrypt_Cleanup() should always be called when finished. + ** This is called at the end of wolf_test_task(); + */ + + if (rc == 0) { + ESP_LOGI(TAG, "wolf_test_task complete success result code = %d", rc); + } + else { + ESP_LOGE(TAG, "wolf_test_task FAIL result code = %d", rc); + /* see wolfssl/wolfcrypt/error-crypt.h */ + } + + /* after the test, we'll just wait */ + while (1) { + /* nothing */ + } +#endif +} diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/main_wip.c.ex b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/main_wip.c.ex new file mode 100644 index 0000000000..b301e65201 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/main_wip.c.ex @@ -0,0 +1,278 @@ +/* main.c + * + * Copyright (C) 2006-2023 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +/* ESP-IDF */ +#include +#include "sdkconfig.h" + +/* wolfSSL */ +#include +#include +#include +#ifndef WOLFSSL_ESPIDF +#warning "problem with wolfSSL user settings. Check components/wolfssl/include" +#endif + +#include + +/* +** the wolfssl component can be installed in either: +** +** - the ESP-IDF component directory +** +** ** OR ** +** +** - the local project component directory +** +** it is not recommended to install in both. +** +*/ + +/* +** although the wolfcrypt/test includes a default time setting, +** see the enclosed optional time helper for adding NNTP. +** be sure to add "time_helper.c" in main/CMakeLists.txt +*/ +#undef WOLFSSL_USE_TIME_HELPER +#if defined(WOLFSSL_USE_TIME_HELPER) + #include "time_helper.h" */ +#endif + +/* see wolfssl/wolfcrypt/test/test.h */ +extern void wolf_crypt_task(); + + +static const char* const TAG = "wolfssl_test"; + +#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \ + && defined(WOLFSSL_ATECC508A) + +#include "wolfssl/wolfcrypt/port/atmel/atmel.h" + +/* when you need to use a custom slot allocation, */ +/* enable the definition CUSTOM_SLOT_ALLOCAION. */ +#if defined(CUSTOM_SLOT_ALLOCATION) + +static byte mSlotList[ATECC_MAX_SLOT]; + +/* initialize slot array */ +void my_atmel_slotInit() +{ + int i; + for (i = 0; i < ATECC_MAX_SLOT; i++) { + mSlotList[i] = ATECC_INVALID_SLOT; + } +} + +/* allocate slot depending on slotType */ +int my_atmel_alloc(int slotType) +{ + int i, slot = ATECC_INVALID_SLOT; + + switch (slotType) { + case ATMEL_SLOT_ENCKEY: + slot = 4; + break; + case ATMEL_SLOT_DEVICE: + slot = 0; + break; + case ATMEL_SLOT_ECDHE: + slot = 0; + break; + case ATMEL_SLOT_ECDHE_ENC: + slot = 4; + break; + case ATMEL_SLOT_ANY: + for (i = 0; i < ATECC_MAX_SLOT; i++) { + if (mSlotList[i] == ATECC_INVALID_SLOT) { + slot = i; + break; + } /* if */ + } /* for */ + } /* switch */ + + return slot; +} + +/* free slot array */ +void my_atmel_free(int slotId) +{ + if (slotId >= 0 && slotId < ATECC_MAX_SLOT) { + mSlotList[slotId] = ATECC_INVALID_SLOT; + } +} + +#endif /* CUSTOM_SLOT_ALLOCATION */ +#endif /* WOLFSSL_ESPWROOM32SE && HAVE_PK_CALLBACK && WOLFSSL_ATECC508A */ + + +/* entry point */ +void app_main(void) +{ + int rc = 0; + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "---------------------- BEGIN MAIN ----------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + ESP_LOGI(TAG, "--------------------------------------------------------"); + + + ESP_LOGI(TAG, "CONFIG_IDF_TARGET = %s", CONFIG_IDF_TARGET); + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_STRING = %s", LIBWOLFSSL_VERSION_STRING); + +#if defined(LIBWOLFSSL_VERSION_GIT_HASH) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH = %s", LIBWOLFSSL_VERSION_GIT_HASH); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_SHORT_HASH ) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_SHORT_HASH = %s", LIBWOLFSSL_VERSION_GIT_SHORT_HASH); +#endif + +#if defined(LIBWOLFSSL_VERSION_GIT_HASH_DATE) + ESP_LOGI(TAG, "LIBWOLFSSL_VERSION_GIT_HASH_DATE = %s", LIBWOLFSSL_VERSION_GIT_HASH_DATE); +#endif + + +#if defined(WOLFSSL_SHA512) + ESP_LOGI(TAG, "Found WOLFSSL_SHA512"); +#else + ESP_LOGI(TAG, "Missing WOLFSSL_SHA512"); +#endif + +#if defined(HAVE_ECC) + ESP_LOGI(TAG, "Found HAVE_ECC"); +#else + ESP_LOGI(TAG, "Missing HAVE_ECC"); +#endif + +#if defined(HAVE_CURVE25519) + ESP_LOGI(TAG, "Found HAVE_CURVE25519"); +#else + ESP_LOGI(TAG, "Missing HAVE_CURVE25519"); +#endif + +#if defined(CURVE25519_SMALL) + ESP_LOGI(TAG, "Found CURVE25519_SMALL"); +#else + ESP_LOGI(TAG, "Missing CURVE25519_SMALL"); +#endif + +#if defined(CURVED25519_SMALL) + ESP_LOGI(TAG, "Found CURVED25519_SMALL"); +#else + ESP_LOGI(TAG, "Missing CURVED25519_SMALL"); +#endif + +#if defined(HAVE_ED25519) + ESP_LOGI(TAG, "Found HAVE_ED25519"); +#else + ESP_LOGI(TAG, "Missing HAVE_ED25519"); +#endif + +#if defined(ED25519_SMALL) + ESP_LOGI(TAG, "Found ED25519_SMALL"); +#else + ESP_LOGI(TAG, "Missing ED25519_SMALL"); +#endif + + + + /* some interesting settings are target specific (ESP32, -C3, -S3, etc */ +#if defined(CONFIG_IDF_TARGET_ESP32C3) + /* not available for C3 at this time */ +#elif defined(CONFIG_IDF_TARGET_ESP32S3) + ESP_LOGI(TAG, "CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ = %u MHz", + CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ + ); + ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount); +#else + ESP_LOGI(TAG, "CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ = %u MHz", + CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ + ); + ESP_LOGI(TAG, "Xthal_have_ccount = %u", Xthal_have_ccount); +#endif + + /* all platforms: stack high water mark check */ + ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL)); + + /* check to see if we are using hardware encryption */ +#if defined(NO_ESP32WROOM32_CRYPT) + ESP_LOGI(TAG, "NO_ESP32WROOM32_CRYPT defined! HW acceleration DISABLED."); +#else + #if defined(CONFIG_IDF_TARGET_ESP32C3) + #error "ESP32WROOM32_CRYPT not yet supported on ESP32-C3" + #elif defined(CONFIG_IDF_TARGET_ESP32S2) + #error "ESP32WROOM32_CRYPT not yet supported on ESP32-S2" + #elif defined(CONFIG_IDF_TARGET_ESP32S3) + #error "ESP32WROOM32_CRYPT not yet supported on ESP32-S3" + #else + ESP_LOGI(TAG, "ESP32WROOM32_CRYPT is enabled."); + #endif +#endif + + + +#if defined (WOLFSSL_USE_TIME_HELPER) + set_time(); +#endif + +/* when using atecc608a on esp32-wroom-32se */ +#if defined(WOLFSSL_ESPWROOM32SE) && defined(HAVE_PK_CALLBACKS) \ + && defined(WOLFSSL_ATECC508A) + #if defined(CUSTOM_SLOT_ALLOCATION) + my_atmel_slotInit(); + /* to register the callback, it needs to be initialized. */ + if ((wolfCrypt_Init()) != 0) { + ESP_LOGE(TAG, "wolfCrypt_Init failed"); + return; + } + atmel_set_slot_allocator(my_atmel_alloc, my_atmel_free); + #endif +#endif + +#ifdef NO_CRYPT_TEST + ESP_LOGI(TAG, "NO_CRYPT_TEST defined, skipping wolf_test_task"); +#else + /* Although wolfCrypt_Init() may be explicitly called above, + ** Note it is still always called in wolf_test_task. + */ + rc = wolf_test_task(); + /* note wolfCrypt_Cleanup() should always be called when finished. + ** This is called at the end of wolf_test_task(); + */ + + if (rc == 0) { + ESP_LOGI(TAG, "wolf_test_task complete success result code = %d", rc); + } + else { + ESP_LOGE(TAG, "wolf_test_task FAIL result code = %d", rc); + /* see wolfssl/wolfcrypt/error-crypt.h */ + } + + /* all platforms: stack high water mark check */ + ESP_LOGI(TAG, "Stack HWM: %d\n", uxTaskGetStackHighWaterMark(NULL)); + + /* after the test, we'll just wait */ + while (1) { + /* nothing */ + } +#endif +} diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/time_helper.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/time_helper.c new file mode 100644 index 0000000000..c3cccde41a --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/time_helper.c @@ -0,0 +1,119 @@ +/* time_helper.c + * + * Copyright (C) 2006-2023 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ +#include +#include + +#include "sdkconfig.h" +#include "esp_log.h" + +#include "time_helper.h" + +const static char* TAG = "Time Helper"; + +#define TIME_ZONE "PST-8" +/* NELEMS(x) number of elements + * To determine the number of elements in the array, we can divide the total size of + * the array by the size of the array element + * See https://stackoverflow.com/questions/37538/how-do-i-determine-the-size-of-my-array-in-c + **/ +#define NELEMS(x) ( (int)(sizeof(x) / sizeof((x)[0])) ) +#define NTP_SERVER_LIST ( (char*[]) { \ + "pool.ntp.org", \ + "time.nist.gov", \ + "utcnist.colorado.edu" \ + } \ + ) +/* #define NTP_SERVER_COUNT using NELEMS: + * + * (int)(sizeof(NTP_SERVER_LIST) / sizeof(NTP_SERVER_LIST[0])) + */ +#define NTP_SERVER_COUNT NELEMS(NTP_SERVER_LIST) +char* ntpServerList[NTP_SERVER_COUNT] = NTP_SERVER_LIST; + +/* our NTP server list is global info */ +extern char* ntpServerList[NTP_SERVER_COUNT]; + + +int set_time(void) +{ + /* we'll also return a result code of zero */ + int res = 0; + int i = 0; /* counter for time servers */ + time_t interim_time; + + /* ideally, we'd like to set time from network, + * but let's set a default time, just in case */ + struct tm timeinfo = { + .tm_year = 2022 - 1900, + .tm_mon = 11, + .tm_mday = 15, + .tm_hour = 3, + .tm_min = 25, + .tm_sec = 0 + }; + struct timeval now; + +#ifndef NTP_SERVER_COUNT + #define NTP_SERVER_COUNT 0 + char* ntpServerList[NTP_SERVER_COUNT]; +#endif /* not defined: NTP_SERVER_COUNT */ + +#ifndef TIME_ZONE + #define TIME_ZONE "PST-8" +#endif /* not defined: TIME_ZONE */ + + + /* set interim static time */ + interim_time = mktime(&timeinfo); + now = (struct timeval){ .tv_sec = interim_time }; + settimeofday(&now, NULL); + + + /* set timezone */ + setenv("TZ", TIME_ZONE, 1); + tzset(); + + if (NTP_SERVER_COUNT) { + /* next, let's setup NTP time servers + * + * see https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html#sntp-time-synchronization + */ + sntp_setoperatingmode(SNTP_OPMODE_POLL); + + ESP_LOGI(TAG, "sntp_setservername:"); + for (i = 0; i < NTP_SERVER_COUNT; i++) { + const char* thisServer = ntpServerList[i]; + if (strncmp(thisServer, "\x00", 1) == 0) { + /* just in case we run out of NTP servers */ + break; + } + ESP_LOGI(TAG, "%s", thisServer); + sntp_setservername(i, thisServer); + } + sntp_init(); + ESP_LOGI(TAG, "sntp_init done."); + } + else { + ESP_LOGI(TAG, "No sntp time servers found."); + } + return res; +} + diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/time_helper.h b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/time_helper.h new file mode 100644 index 0000000000..1de6f0f8bc --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/main/time_helper.h @@ -0,0 +1,32 @@ +#ifndef _TIME_HELPER_H +/* + * Copyright (C) 2006-2023 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#ifdef __cplusplus +extern "C" { +#endif + +int set_time(void); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* #ifndef _TIME_HELPER_H */ diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/sdkconfig.defaults b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/sdkconfig.defaults new file mode 100644 index 0000000000..ccb7820e7b --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test_idf/sdkconfig.defaults @@ -0,0 +1,49 @@ +# +# Default main stack size +# +# This is typically way bigger than needed for stack size. See user_settings.h +# +CONFIG_ESP_MAIN_TASK_STACK_SIZE=55000 + +# Legacy stack size for older ESP-IDF versions +CONFIG_MAIN_TASK_STACK_SIZE=55000 + +# +# Watchdog Timers +# +# We don't want to have the watchdog timeout during tests +# +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=n +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=n + +# +# Compiler options +# +CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 +CONFIG_COMPILER_HIDE_PATHS_MACROS=y +CONFIG_COMPILER_STACK_CHECK_MODE_NORM=y +CONFIG_COMPILER_STACK_CHECK=y + +# minimum C3 chip revision known to work is 2. +# rev 0 and 1 not available for testing. +# all revisions expected to work. +CONFIG_ESP32C3_REV_MIN_0= +CONFIG_ESP32C3_REV_MIN_1= +CONFIG_ESP32C3_REV_MIN_2=y +CONFIG_ESP32C3_REV_MIN_3= + + +# +# Partition Table +# +# CONFIG_PARTITION_TABLE_SINGLE_APP is not set +CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE=y +# CONFIG_PARTITION_TABLE_TWO_OTA is not set +# CONFIG_PARTITION_TABLE_CUSTOM is not set +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp_large.csv" +CONFIG_PARTITION_TABLE_OFFSET=0x8000 +CONFIG_PARTITION_TABLE_MD5=y +# end of Partition Table From 2dde81b2ec84c38f63b6af94e5a2b8bdca01a0a3 Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Sun, 5 Feb 2023 12:45:50 -0800 Subject: [PATCH 09/11] move VisualGDB projects to subdirectories --- .../VisualGDB_wolfssl_benchmark.sln | 78 +-- .../VisualGDB_wolfssl_benchmark.vgdbproj | 535 ++++++++--------- .../VisualGDB_wolfssl_client.sln | 0 .../VisualGDB_wolfssl_client.vgdbproj | 14 +- .../ESP-IDF/examples/wolfssl_test/README.md | 6 +- .../VisualGDB/VisualGDB_wolfssl_test-WIP.sln | 31 + .../VisualGDB_wolfssl_test-WIP.vgdbproj | 269 +++++++++ .../VisualGDB_wolfssl_test.sln | 86 +-- .../VisualGDB_wolfssl_test.vgdbproj | 536 +++++++++--------- .../VisualGDB_wolfssl_test_IDF_v5_ESP32S3.sln | 31 + ...alGDB_wolfssl_test_IDF_v5_ESP32S3.vgdbproj | 2 +- 11 files changed, 963 insertions(+), 625 deletions(-) rename IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/{ => VisualGDB}/VisualGDB_wolfssl_benchmark.sln (75%) rename IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/{ => VisualGDB}/VisualGDB_wolfssl_benchmark.vgdbproj (95%) rename IDE/Espressif/ESP-IDF/examples/wolfssl_client/{ => VisualGDB}/VisualGDB_wolfssl_client.sln (100%) rename IDE/Espressif/ESP-IDF/examples/wolfssl_client/{ => VisualGDB}/VisualGDB_wolfssl_client.vgdbproj (94%) create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test-WIP.sln create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test-WIP.vgdbproj rename IDE/Espressif/ESP-IDF/examples/wolfssl_test/{ => VisualGDB}/VisualGDB_wolfssl_test.sln (88%) rename IDE/Espressif/ESP-IDF/examples/wolfssl_test/{ => VisualGDB}/VisualGDB_wolfssl_test.vgdbproj (95%) create mode 100644 IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.sln rename IDE/Espressif/ESP-IDF/examples/wolfssl_test/{ => VisualGDB}/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.vgdbproj (97%) diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB_wolfssl_benchmark.sln b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB/VisualGDB_wolfssl_benchmark.sln similarity index 75% rename from IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB_wolfssl_benchmark.sln rename to IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB/VisualGDB_wolfssl_benchmark.sln index 1b5b1e5b95..b0d40a1d95 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB_wolfssl_benchmark.sln +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB/VisualGDB_wolfssl_benchmark.sln @@ -1,39 +1,39 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.32802.440 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_benchmark", "VisualGDB_wolfssl_benchmark.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CF8A8B6E-ECCF-481A-92AC-1E2F432816E8}" - ProjectSection(SolutionItems) = preProject - components\wolfssl\wolfcrypt\benchmark\benchmark.c = components\wolfssl\wolfcrypt\benchmark\benchmark.c - components\wolfssl\wolfcrypt\benchmark\benchmark.h = components\wolfssl\wolfcrypt\benchmark\benchmark.h - ..\..\README.md = ..\..\README.md - ..\..\UPDATE.md = ..\..\UPDATE.md - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|VisualGDB = Debug|VisualGDB - Release|VisualGDB = Release|VisualGDB - Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB - Tests (Release)|VisualGDB = Tests (Release)|VisualGDB - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {969EF1DC-F8DA-46B8-A2AC-A7FDC3234245} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.33027.164 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_benchmark", "VisualGDB_wolfssl_benchmark.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{51FEFEA9-C2BA-43A1-8B36-9140367E5AAF}" + ProjectSection(SolutionItems) = preProject + ..\..\..\..\..\wolfcrypt\benchmark\benchmark.c = ..\..\..\..\..\wolfcrypt\benchmark\benchmark.c + ..\..\..\..\..\wolfcrypt\benchmark\benchmark.h = ..\..\..\..\..\wolfcrypt\benchmark\benchmark.h + components\wolfssl\CMakeLists.txt = components\wolfssl\CMakeLists.txt + ..\..\..\..\..\include\user_settings.h = ..\..\..\..\..\include\user_settings.h + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|VisualGDB = Debug|VisualGDB + Release|VisualGDB = Release|VisualGDB + Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB + Tests (Release)|VisualGDB = Tests (Release)|VisualGDB + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {668EEFC0-010C-4688-916F-A628190717D4} + EndGlobalSection +EndGlobal diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB_wolfssl_benchmark.vgdbproj b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB/VisualGDB_wolfssl_benchmark.vgdbproj similarity index 95% rename from IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB_wolfssl_benchmark.vgdbproj rename to IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB/VisualGDB_wolfssl_benchmark.vgdbproj index a5631c4889..911ba6c9aa 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB_wolfssl_benchmark.vgdbproj +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB/VisualGDB_wolfssl_benchmark.vgdbproj @@ -1,268 +1,269 @@ - - - - - - Unknown - - true - - 7bbd1486-d457-4e49-92ba-0cfc9d80849e - true - true - SourceDirs - - - - - - com.visualgdb.xtensa-esp32-elf - - 8.4.0 - 8.1.0 - 9 - - - - DEBUG - build/$(PlatformName)/$(ConfigurationName) - - false - $(ToolchainNinja) - $(BuildDir) - - - - false - $(SYSPROGS_CMAKE_PATH) - - - true - false - false - Ninja - false - RemoveBuildDirectory - false - - - true - true - true - false - true - false - true - HideOuterProjectTargets - true - false - true - - - true - eadcc9ab-72b3-4b51-a838-593e5d80ddf7 - - Upper - HeaderDirectoryAndSubdirectories - true - - - esp-idf/v4.4.2 - ESPIDF - - COM7 - false - false - ESP32 - - - - - - - - - - - - - - - Default - - - - COM20 - - 115200 - 8 - None - One - None - - - 0 - false - false - false - ASCII - - - 255 - 0 - 0 - 0 - - - 255 - 169 - 169 - 169 - - - 255 - 211 - 211 - 211 - - - 255 - 144 - 238 - 144 - - - 255 - 169 - 169 - 169 - - - - 16 - true - true - true - true - 0 - - LF - false - false - false - - - - true - - - - - Unknown - - true - true - true - - - - false - - - - - Debug - - - - Release - - - - - - - - - false - false - false - false - false - false - false - false - false - - false - false - false - false - false - false - true - false - None - false - false - app_main - true - false - false - true - 0 - false - 0 - true - false - - - openocd - - -f interface/tigard.cfg -c "adapter_khz 15000" -f target/esp32.cfg - - - - false - - 131072 - Enabled - - set remotetimeout 60 - target remote :$$SYS:GDB_PORT$$ - mon gdb_breakpoint_override hard - mon reset halt - load - - false - 0 - 0 - false - - 5000 - 1 - true - - size2MB - freq40M - DIO - - true - - - true - Disabled - 0 - false - false - true - false - false - - _estack - 0 - false - - true - + + + + + + Unknown + + true + + 7bbd1486-d457-4e49-92ba-0cfc9d80849e + true + true + SourceDirs + + + + + + com.visualgdb.xtensa-esp32-elf + + 11.2.0 + 9.2.90 + 2 + + + .. + DEBUG + build/$(PlatformName)/$(ConfigurationName) + + false + $(ToolchainNinja) + $(BuildDir) + + + + false + $(SYSPROGS_CMAKE_PATH) + + + true + false + false + Ninja + false + RemoveBuildDirectory + false + + + true + true + true + false + true + false + true + HideOuterProjectTargets + true + false + true + + + true + eadcc9ab-72b3-4b51-a838-593e5d80ddf7 + + Upper + HeaderDirectoryAndSubdirectories + true + + + release/v5.0 + esp-idf/v5.0 + ESPIDF + + COM20 + false + false + ESP32 + + + + + + + + + + + + + + + Default + + + + COM20 + + 115200 + 8 + None + One + None + + + 0 + false + false + false + ASCII + + + 255 + 0 + 0 + 0 + + + 255 + 169 + 169 + 169 + + + 255 + 211 + 211 + 211 + + + 255 + 144 + 238 + 144 + + + 255 + 169 + 169 + 169 + + + + 16 + true + true + true + true + 0 + + LF + false + false + false + + + + true + + + + + Unknown + + true + true + true + + + + false + + + + + Debug + + + + Release + + + + + + + + + false + false + false + false + false + false + false + false + false + + false + false + false + false + false + false + true + false + None + false + false + app_main + true + false + false + true + 0 + false + 0 + true + false + + + openocd + + -f interface/tigard.cfg -c "adapter_khz 15000" -f target/esp32.cfg + + + + false + + 131072 + Enabled + + set remotetimeout 60 + target remote :$$SYS:GDB_PORT$$ + mon gdb_breakpoint_override hard + mon reset halt + load + + false + 0 + 0 + false + + 5000 + 1 + true + + size2MB + freq40M + DIO + + true + + + true + Disabled + 0 + false + false + true + false + false + + _estack + 0 + false + + true + \ No newline at end of file diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/VisualGDB_wolfssl_client.sln b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/VisualGDB/VisualGDB_wolfssl_client.sln similarity index 100% rename from IDE/Espressif/ESP-IDF/examples/wolfssl_client/VisualGDB_wolfssl_client.sln rename to IDE/Espressif/ESP-IDF/examples/wolfssl_client/VisualGDB/VisualGDB_wolfssl_client.sln diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/VisualGDB_wolfssl_client.vgdbproj b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/VisualGDB/VisualGDB_wolfssl_client.vgdbproj similarity index 94% rename from IDE/Espressif/ESP-IDF/examples/wolfssl_client/VisualGDB_wolfssl_client.vgdbproj rename to IDE/Espressif/ESP-IDF/examples/wolfssl_client/VisualGDB/VisualGDB_wolfssl_client.vgdbproj index eb30976482..4ed71d97a4 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/VisualGDB_wolfssl_client.vgdbproj +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/VisualGDB/VisualGDB_wolfssl_client.vgdbproj @@ -18,11 +18,12 @@ com.visualgdb.xtensa-esp32-elf - 8.4.0 - 8.1.0 - 9 + 11.2.0 + 9.2.90 + 2 + .. DEBUG build/$(PlatformName)/$(ConfigurationName) @@ -57,6 +58,7 @@ false true + true e903e9cc-1a23-4b00-8914-7e45ec21e351 @@ -65,8 +67,8 @@ true - v4.4.2 - esp-idf/v4.4.2 + release/v5.0 + esp-idf/v5.0 ESPIDF COM20 @@ -155,6 +157,7 @@ true + Unknown @@ -177,6 +180,7 @@ + diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md index 363d0b4455..5be9875e84 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md @@ -1,14 +1,14 @@ # wolfSSL Crypt Test Example -The Example contains of wolfSSL benchmark program. +The Example contains of wolfSSL test program. 1. `idf.py menuconfig` to configure the program. 1-1. Example Configuration -> - BENCH_ARG : argument that you want to use. Default is "-lng 0" + TEST_ARG : argument that you want to use. Default is "-lng 0" The list of argument can be find in help. -When you want to run the benchmark program +When you want to run the test program 1. `idf.py -p flash` to compile and load the firmware 2. `idf.py monitor` to see the message diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test-WIP.sln b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test-WIP.sln new file mode 100644 index 0000000000..ac99b57b2d --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test-WIP.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.33027.164 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_test-WIP", "VisualGDB_wolfssl_test-WIP.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|VisualGDB = Debug|VisualGDB + Release|VisualGDB = Release|VisualGDB + Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB + Tests (Release)|VisualGDB = Tests (Release)|VisualGDB + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C84ED821-3F33-4EBD-94E4-FE860F402B2F} + EndGlobalSection +EndGlobal diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test-WIP.vgdbproj b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test-WIP.vgdbproj new file mode 100644 index 0000000000..2c1871e9a0 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test-WIP.vgdbproj @@ -0,0 +1,269 @@ + + + + + + Unknown + + true + + 35e5525f-318a-466e-a8c7-36548547d801 + true + true + SourceDirs + + + + + + com.visualgdb.xtensa-esp32-elf + + 8.4.0 + 8.1.0 + 9 + + + .. + DEBUG + build/$(PlatformName)/$(ConfigurationName) + + false + $(ToolchainNinja) + $(BuildDir) + + + + false + $(SYSPROGS_CMAKE_PATH) + + + true + false + false + Ninja + false + RemoveBuildDirectory + false + + + true + true + true + false + true + false + true + HideOuterProjectTargets + true + false + true + + + true + eadcc9ab-72b3-4b51-a838-593e5d80ddf7 + + Upper + HeaderDirectoryAndSubdirectories + true + + + v4.4.1 + esp-idf/v4.4.1 + ESPIDF + + COM20 + false + false + ESP32 + + + + + + + + + + + + + + + Default + + + + COM20 + + 115200 + 8 + None + One + None + + + 0 + false + true + false + ASCII + + + 255 + 0 + 0 + 0 + + + 255 + 169 + 169 + 169 + + + 255 + 211 + 211 + 211 + + + 255 + 144 + 238 + 144 + + + 255 + 169 + 169 + 169 + + + + 16 + true + true + true + true + 0 + + LF + false + false + false + + + + true + + + + + Unknown + + true + true + true + + + + false + + + + + Debug + + + + Release + + + + + + + + + false + false + false + false + false + false + false + false + false + + false + false + false + false + false + false + true + false + None + false + false + app_main + true + false + false + true + 0 + false + 0 + true + false + + + openocd + + -f interface/tigard.cfg -c "adapter_khz 13000" -f target/esp32.cfg + + + + false + + 131072 + Enabled + + set remotetimeout 60 + target remote :$$SYS:GDB_PORT$$ + mon gdb_breakpoint_override hard + mon reset halt + load + + false + 0 + 0 + false + + 5000 + 1 + true + + size2MB + freq40M + DIO + + true + + + true + Auto + 0 + false + false + true + false + false + + _estack + 0 + false + + true + + \ No newline at end of file diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test.sln b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test.sln similarity index 88% rename from IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test.sln rename to IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test.sln index e875bb7268..00b1845fc6 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test.sln +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test.sln @@ -1,42 +1,44 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.32802.440 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_test", "VisualGDB_wolfssl_test.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{35EEC1E7-13AB-4C74-BFCE-22142A10E1C1}" - ProjectSection(SolutionItems) = preProject - README.md = README.md - sdkconfig = sdkconfig - sdkconfig.defaults = sdkconfig.defaults - build\config\sdkconfig.h = build\config\sdkconfig.h - ..\..\..\..\..\wolfcrypt\test\test.c = ..\..\..\..\..\wolfcrypt\test\test.c - ..\..\..\..\..\wolfcrypt\test\test.h = ..\..\..\..\..\wolfcrypt\test\test.h - ..\..\..\..\..\..\..\SysGCC\esp32\esp-idf\v4.4.1\components\wolfssl\include\user_settings.h = ..\..\..\..\..\..\..\SysGCC\esp32\esp-idf\v4.4.1\components\wolfssl\include\user_settings.h - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|VisualGDB = Debug|VisualGDB - Release|VisualGDB = Release|VisualGDB - Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB - Tests (Release)|VisualGDB = Tests (Release)|VisualGDB - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB - {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A0AC9105-F2CF-44E7-8032-3CD9E77EC9F6} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.32802.440 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_test", "VisualGDB_wolfssl_test.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{35EEC1E7-13AB-4C74-BFCE-22142A10E1C1}" + ProjectSection(SolutionItems) = preProject + ..\..\..\compileAllExamples.sh = ..\..\..\compileAllExamples.sh + README.md = README.md + sdkconfig = sdkconfig + sdkconfig.defaults = sdkconfig.defaults + build\config\sdkconfig.h = build\config\sdkconfig.h + ..\..\..\..\..\wolfcrypt\test\test.c = ..\..\..\..\..\wolfcrypt\test\test.c + ..\..\..\..\..\wolfcrypt\test\test.h = ..\..\..\..\..\wolfcrypt\test\test.h + ..\..\..\..\..\include\user_settings.h = ..\..\..\..\..\include\user_settings.h + ..\..\..\..\..\..\include\user_settings.h = ..\..\..\..\..\..\include\user_settings.h + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|VisualGDB = Debug|VisualGDB + Release|VisualGDB = Release|VisualGDB + Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB + Tests (Release)|VisualGDB = Tests (Release)|VisualGDB + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A0AC9105-F2CF-44E7-8032-3CD9E77EC9F6} + EndGlobalSection +EndGlobal diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test.vgdbproj b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test.vgdbproj similarity index 95% rename from IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test.vgdbproj rename to IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test.vgdbproj index 383b5f5387..28bcb2d1dc 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test.vgdbproj +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test.vgdbproj @@ -1,269 +1,269 @@ - - - - - - Unknown - - true - - 35e5525f-318a-466e-a8c7-36548547d801 - true - true - SourceDirs - - - - - - com.visualgdb.xtensa-esp32-elf - - 8.4.0 - 8.1.0 - 9 - - - - DEBUG - build/$(PlatformName)/$(ConfigurationName) - - false - $(ToolchainNinja) - $(BuildDir) - - - - false - $(SYSPROGS_CMAKE_PATH) - - - true - false - false - Ninja - false - RemoveBuildDirectory - false - - - true - true - true - false - true - false - true - HideOuterProjectTargets - true - false - true - - - true - eadcc9ab-72b3-4b51-a838-593e5d80ddf7 - - Upper - HeaderDirectoryAndSubdirectories - true - - - v4.4.2 - esp-idf/v4.4.2 - ESPIDF - - COM20 - false - false - ESP32 - - - - - - - - - - - - - - - Default - - - - COM20 - - 115200 - 8 - None - One - None - - - 0 - false - false - false - ASCII - - - 255 - 0 - 0 - 0 - - - 255 - 169 - 169 - 169 - - - 255 - 211 - 211 - 211 - - - 255 - 144 - 238 - 144 - - - 255 - 169 - 169 - 169 - - - - 16 - true - true - true - true - 0 - - LF - false - false - false - - - - true - - - - - Unknown - - true - true - true - - - - false - - - - - Debug - - - - Release - - - - - - - - - false - false - false - false - false - false - false - false - false - - false - false - false - false - false - false - true - false - None - false - false - app_main - true - false - false - true - 0 - false - 0 - true - false - - - openocd - - -f interface/tigard.cfg -c "adapter_khz 3000" -f target/esp32.cfg - - - - false - - 131072 - Enabled - - set remotetimeout 60 - target remote :$$SYS:GDB_PORT$$ - mon gdb_breakpoint_override hard - mon reset halt - load - - false - 0 - 0 - false - - 5000 - 1 - true - - size2MB - freq40M - DIO - - true - - - true - Auto - 0 - false - false - true - false - false - - _estack - 0 - false - - true - + + + + + + Unknown + + true + + 35e5525f-318a-466e-a8c7-36548547d801 + true + true + SourceDirs + + + + + + com.visualgdb.xtensa-esp32-elf + + 11.2.0 + 9.2.90 + 2 + + + .. + DEBUG + build/$(PlatformName)/$(ConfigurationName) + + false + $(ToolchainNinja) + $(BuildDir) + + + + false + $(SYSPROGS_CMAKE_PATH) + + + true + false + false + Ninja + false + RemoveBuildDirectory + false + + + true + true + true + false + true + false + true + HideOuterProjectTargets + true + false + true + + + true + eadcc9ab-72b3-4b51-a838-593e5d80ddf7 + + Upper + HeaderDirectoryAndSubdirectories + true + + + release/v5.0 + esp-idf/v5.0 + ESPIDF + + COM20 + false + false + ESP32 + + + + + + + + + + + + + + + Default + + + + COM20 + + 115200 + 8 + None + One + None + + + 0 + false + false + false + ASCII + + + 255 + 0 + 0 + 0 + + + 255 + 169 + 169 + 169 + + + 255 + 211 + 211 + 211 + + + 255 + 144 + 238 + 144 + + + 255 + 169 + 169 + 169 + + + + 16 + true + true + true + true + 0 + + LF + false + false + false + + + + true + + + + + Unknown + + true + true + true + + + + false + + + + + Debug + + + + Release + + + + + + + + + false + false + false + false + false + false + false + false + false + + false + false + false + false + false + false + true + false + None + false + false + app_main + true + false + false + true + 0 + false + 0 + true + false + + + openocd + + -f interface/tigard.cfg -c "adapter_khz 3000" -f target/esp32.cfg + + + + false + + 131072 + Enabled + + set remotetimeout 60 + target remote :$$SYS:GDB_PORT$$ + mon gdb_breakpoint_override hard + mon reset halt + load + + false + 0 + 0 + false + + 5000 + 1 + true + + size2MB + freq40M + DIO + + true + + + true + Auto + 0 + false + false + true + false + false + + _estack + 0 + false + + true + \ No newline at end of file diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.sln b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.sln new file mode 100644 index 0000000000..ff22bd3e3c --- /dev/null +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.33027.164 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{803FD0C6-D64E-4E16-9DC3-1DAEC859A3D2}") = "VisualGDB_wolfssl_test_IDF_v5_ESP32S3", "VisualGDB_wolfssl_test_IDF_v5_ESP32S3.vgdbproj", "{EADCC9AB-72B3-4B51-A838-593E5D80DDF7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|VisualGDB = Debug|VisualGDB + Release|VisualGDB = Release|VisualGDB + Tests (Debug)|VisualGDB = Tests (Debug)|VisualGDB + Tests (Release)|VisualGDB = Tests (Release)|VisualGDB + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.ActiveCfg = Debug|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Debug|VisualGDB.Build.0 = Debug|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.ActiveCfg = Release|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Release|VisualGDB.Build.0 = Release|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.ActiveCfg = Tests (Debug)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Debug)|VisualGDB.Build.0 = Tests (Debug)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.ActiveCfg = Tests (Release)|VisualGDB + {EADCC9AB-72B3-4B51-A838-593E5D80DDF7}.Tests (Release)|VisualGDB.Build.0 = Tests (Release)|VisualGDB + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7F8E1DC0-55AD-4DF8-B65A-CD65B60E17F9} + EndGlobalSection +EndGlobal diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.vgdbproj b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.vgdbproj similarity index 97% rename from IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.vgdbproj rename to IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.vgdbproj index e483e12011..bbf7f1c269 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.vgdbproj +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.vgdbproj @@ -23,7 +23,7 @@ 2 - + .. DEBUG build/$(PlatformName)/$(ConfigurationName) From 3bd0531058abc37e0463a6417bd293c02d78cb21 Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Sun, 5 Feb 2023 12:52:23 -0800 Subject: [PATCH 10/11] move VisualGDB wolfssl_server to subdirectory --- .../{ => VisualGDB}/VisualGDB_wolfssl_server.sln | 0 .../{ => VisualGDB}/VisualGDB_wolfssl_server.vgdbproj | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename IDE/Espressif/ESP-IDF/examples/wolfssl_server/{ => VisualGDB}/VisualGDB_wolfssl_server.sln (100%) rename IDE/Espressif/ESP-IDF/examples/wolfssl_server/{ => VisualGDB}/VisualGDB_wolfssl_server.vgdbproj (96%) diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/VisualGDB_wolfssl_server.sln b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/VisualGDB/VisualGDB_wolfssl_server.sln similarity index 100% rename from IDE/Espressif/ESP-IDF/examples/wolfssl_server/VisualGDB_wolfssl_server.sln rename to IDE/Espressif/ESP-IDF/examples/wolfssl_server/VisualGDB/VisualGDB_wolfssl_server.sln diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/VisualGDB_wolfssl_server.vgdbproj b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/VisualGDB/VisualGDB_wolfssl_server.vgdbproj similarity index 96% rename from IDE/Espressif/ESP-IDF/examples/wolfssl_server/VisualGDB_wolfssl_server.vgdbproj rename to IDE/Espressif/ESP-IDF/examples/wolfssl_server/VisualGDB/VisualGDB_wolfssl_server.vgdbproj index 6f8dc6052e..c1194d45ed 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/VisualGDB_wolfssl_server.vgdbproj +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/VisualGDB/VisualGDB_wolfssl_server.vgdbproj @@ -23,7 +23,7 @@ 9 - + .. DEBUG build/$(PlatformName)/$(ConfigurationName) @@ -67,8 +67,8 @@ true - v4.4.2 - esp-idf/v4.4.2 + v4.4.1 + esp-idf/v4.4.1 ESPIDF COM20 From 1c7a5131c8e49e0f91e212759b3b83b87b45434b Mon Sep 17 00:00:00 2001 From: gojimmypi Date: Sun, 5 Feb 2023 12:54:26 -0800 Subject: [PATCH 11/11] update include.am for moved VisualGDB project files --- IDE/Espressif/include.am | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/IDE/Espressif/include.am b/IDE/Espressif/include.am index 332b5c442c..3d0dd43ad6 100644 --- a/IDE/Espressif/include.am +++ b/IDE/Espressif/include.am @@ -22,7 +22,7 @@ EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/Makefile EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/sdkconfig.defaults -EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB_wolfssl_benchmark.vgdbproj +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/VisualGDB/VisualGDB_wolfssl_benchmark.vgdbproj EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/CMakeLists.txt EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/component.mk EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/Kconfig.projbuild @@ -36,7 +36,7 @@ EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/main EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/Makefile EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/sdkconfig.defaults -EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/VisualGDB_wolfssl_client.vgdbproj +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/VisualGDB/VisualGDB_wolfssl_client.vgdbproj EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/CMakeLists.txt EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/component.mk @@ -50,7 +50,7 @@ EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/CMakeLists.txt EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/Makefile EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/sdkconfig.defaults -EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/VisualGDB_wolfssl_server.vgdbproj +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/VisualGDB/VisualGDB_wolfssl_server.vgdbproj EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/CMakeLists.txt EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/component.mk EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c @@ -63,8 +63,8 @@ EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/CMakeLists.txt EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/Makefile EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/sdkconfig.defaults -EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test.vgdbproj -EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.vgdbproj +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test.vgdbproj +EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/VisualGDB/VisualGDB_wolfssl_test_IDF_v5_ESP32S3.vgdbproj EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/CMakeLists.txt EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/component.mk EXTRA_DIST+= IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/Kconfig.projbuild