diff --git a/IDE/Espressif/ESP-IDF/README.md b/IDE/Espressif/ESP-IDF/README.md index 54d4d4168..0e8bfdd03 100644 --- a/IDE/Espressif/ESP-IDF/README.md +++ b/IDE/Espressif/ESP-IDF/README.md @@ -40,6 +40,5 @@ Including the following examples: Note: This is tested with : - OS: Ubuntu 18.04.1 LTS and Microsoft Windows 10 Pro 10.0.19041 and well as WSL Ubuntu - - ESP-IDF: v4.1 and v4.0.1 - - Module : ESP32-WROOM-32 - + - ESP-IDF: v4.4-dev-4031-gef98a363e3-dirty and v4.0.1-dirty + - Module : ESP32-WROOM-32 \ No newline at end of file diff --git a/IDE/Espressif/ESP-IDF/dummy_test_paths.h b/IDE/Espressif/ESP-IDF/dummy_test_paths.h new file mode 100644 index 000000000..7a9d3a173 --- /dev/null +++ b/IDE/Espressif/ESP-IDF/dummy_test_paths.h @@ -0,0 +1,25 @@ +/* wolfcrypt/test/test_paths.h + * + * Copyright (C) 2006-2021 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 + */ + +#ifndef NO_FILESYSTEM + #define CERT_PREFIX "@abs_top_srcdir@/" + #define CERT_WRITE_TEMP_DIR "@abs_top_builddir@/" +#endif /* NO_FILESYSTEM */ diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md index 0430ca2f5..d8f5c9437 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/README.md @@ -1,8 +1,8 @@ -#wolfSSL Example +# wolfSSL Benchmark Example The Example contains of wolfSSL benchmark program. -1. "make menuconfig" to configure the 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" @@ -10,7 +10,7 @@ The Example contains of wolfSSL benchmark program. When you want to run the benchmark program -1. "make flash" to compile and load the firmware -2. "make monitor" to see the message +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. diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/helper.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/helper.c index 0aa8631b5..5c67b26d2 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/helper.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/helper.c @@ -23,6 +23,7 @@ #include #include +#include #include #include "sdkconfig.h" diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md index 69da1accb..ee834071a 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/README.md @@ -2,21 +2,26 @@ The Example contains of wolfSSL tls client demo. -1. "make menuconfig" to config the project - 1-1. Example Configuration -> +1. `idf.py menuconfig` to config the project + + 1-1. Example Configuration -> - WIFI SSID: your own WIFI, which is connected to the Internet.(default is "myssid") - WIFI Password: WIFI password, and default is "mypassword" Target host ip address : the host that you want to connect to.(default is 127.0.0.1) + + 1-2. Example Connection Configuration -> + + WIFI SSID: your own WIFI, which is connected to the Internet.(default is "myssid") + WIFI Password: WIFI password, and default is "mypassword" + Note: the example program uses 11111 port. If you want to use different port , you need to modify DEFAULT_PORT definition in the code. When you want to test the wolfSSL client -1. "make flash monitor" to load the firmware and see the context +1. `idf.py -p flash` and then `idf.py monitor` to load the firmware and see the context 2. You can use /examples/server/server program for test. - e.g. Launch ./examples/server/server -v 4 -b -i + e.g. Launch ./examples/server/server -v 4 -b -i -d See the README.md file in the upper level 'examples' directory for more information about examples. diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/Kconfig.projbuild b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/Kconfig.projbuild index afcf6edc6..080abdb74 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/Kconfig.projbuild +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/Kconfig.projbuild @@ -1,17 +1,5 @@ menu "Example Configuration" -config WIFI_SSID - string "WiFi SSID" - default "myssid" - help - SSID (network name) for the example to connect to. - -config WIFI_PASSWORD - string "WiFi Password" - default "mypassword" - help - WiFi password (WPA or WPA2) for the example to use. - config TARGET_HOST string "Target host" default "127.0.01.1" diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md index 854017c1f..50a1859c7 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/README.md @@ -1,17 +1,18 @@ -#wolfSSL Example +# wolfSSL Server Example The Example contains a wolfSSL simple server. -1. "make menuconfigure" to configure the project +1. `idf.py menuconfigure` to configure the project - 1-1. Example Configuration -> + 1-1. Example Connection Configuration -> + WIFI SSID : your own WIFI, which is connected to the Internet.(default is "myssid") WIFI Password : WIFI password, and default is "mypassword" When you want to test the wolfSSL simple server demo -1. "make flash" to compile the code and load the firmware -2. "make monitor" to see the context. The assigned IP address can be found in output message. +1. `idf.py -p flash` to compile the code and load the firmware +2. `idf.py monitor` to see the context. The assigned IP address can be found in output message. 3. Once the server connects to the wifi, it is waiting for client request. ("Waiting for a connection..." message will be displayed.) @@ -19,4 +20,3 @@ When you want to test the wolfSSL simple server demo e.g ./example/client/client -h xx.xx.xx See the README.md file in the upper level 'examples' directory for more information about examples. - diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md index 3f3eace57..99a61e287 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/README.md @@ -1,10 +1,10 @@ -#wolfSSL Example +# wolfSSL Crypt Test Example The Example contains of wolfSSL test program. When you want to run the benchmark program -1. "make menuconfig" to configure the program,first -2. "make flash" to compile and load the firmware -3. "make monitor" to see the message +1. `idf.py menuconfig` to configure the program,first +2. `idf.py build` to compile and `idf.py -p flash` to load the firmware +3. `idf.py monitor` to see the message See the README.md file in the upper level 'examples' directory for more information about examples. diff --git a/IDE/Espressif/ESP-IDF/libs/CMakeLists.txt b/IDE/Espressif/ESP-IDF/libs/CMakeLists.txt index 5d17d6bc1..7207896d3 100644 --- a/IDE/Espressif/ESP-IDF/libs/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/libs/CMakeLists.txt @@ -16,12 +16,22 @@ set(COMPONENT_SRCDIRS "./src/" set(COMPONENT_REQUIRES lwip) -set(COMPONENT_ADD_INCLUDEDIRS - "." - "./include" - "../freertos/include/freertos" - "${WOLFSSL_ROOT}" - ) +if(IS_DIRECTORY ${IDF_PATH}/components/freertos/FreeRTOS-Kernel/) + set(COMPONENT_ADD_INCLUDEDIRS + "." + "./include" + "../freertos/FreeRTOS-Kernel/include/freertos" + "${WOLFSSL_ROOT}" + ) +else() + + set(COMPONENT_ADD_INCLUDEDIRS + "." + "./include" + "../freertos/include/freertos" + "${WOLFSSL_ROOT}" + ) +endif() if(IS_DIRECTORY ${IDF_PATH}/components/cryptoauthlib) list(APPEND COMPONENT_ADD_INCLUDEDIRS "../cryptoauthlib/lib") diff --git a/IDE/Espressif/ESP-IDF/setup.sh b/IDE/Espressif/ESP-IDF/setup.sh index 764ef7d84..11c746a80 100755 --- a/IDE/Espressif/ESP-IDF/setup.sh +++ b/IDE/Espressif/ESP-IDF/setup.sh @@ -58,6 +58,7 @@ ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/src ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfssl +${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfssl/openssl ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/test ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/include @@ -76,9 +77,12 @@ ${CPDCMD} ./src/*.c ${WOLFSSLLIB_TRG_DIR}/src/ ${CPDCMD} -r ./wolfcrypt/src/*.{c,i} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src/ ${CPDCMD} -r ./wolfcrypt/src/port ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/src/port/ ${CPDCMD} -r ./wolfcrypt/test ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/ +# Copy dummy test_paths.h to handle the case configure hasn't yet executed +${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/dummy_test_paths.h ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/test/test_paths.h ${CPDCMD} -r ./wolfcrypt/benchmark ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/ ${CPDCMD} -r ./wolfssl/*.h ${WOLFSSLLIB_TRG_DIR}/wolfssl/ +${CPDCMD} -r ./wolfssl/openssl/*.h ${WOLFSSLLIB_TRG_DIR}/wolfssl/openssl/ ${CPDCMD} -r ./wolfssl/wolfcrypt ${WOLFSSLLIB_TRG_DIR}/wolfssl/ # user_settings.h diff --git a/IDE/Espressif/ESP-IDF/setup_win.bat b/IDE/Espressif/ESP-IDF/setup_win.bat index 07793301e..158a1846c 100644 --- a/IDE/Espressif/ESP-IDF/setup_win.bat +++ b/IDE/Espressif/ESP-IDF/setup_win.bat @@ -17,13 +17,14 @@ set WOLFSSL_ESPIDFDIR=%BASEDIR%\IDE\Espressif\ESP-IDF set WOLFSSLLIB_TRG_DIR=%IDF_PATH%\components\wolfssl set WOLFSSLEXP_TRG_DIR=%IDF_PATH%\examples\protocols -echo Copy files into $IDF_PATH% +echo Copy files into %IDF_PATH% rem Remove/Create directories rmdir /S/Q %WOLFSSLLIB_TRG_DIR% mkdir %WOLFSSLLIB_TRG_DIR% mkdir %WOLFSSLLIB_TRG_DIR%\src mkdir %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src mkdir %WOLFSSLLIB_TRG_DIR%\wolfssl +mkdir %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl mkdir %WOLFSSLLIB_TRG_DIR%\test mkdir %WOLFSSLLIB_TRG_DIR%\include @@ -33,8 +34,12 @@ xcopy /Y/Q %BASEDIR%\wolfcrypt\src\*.c %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src xcopy /Y/Q %BASEDIR%\wolfcrypt\src\*.i %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src xcopy /E/Y/Q %BASEDIR%\wolfcrypt\src\port %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\ xcopy /E/Y/Q %BASEDIR%\wolfcrypt\test %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\ +rem Copy dummy test_paths.h to handle the case configure hasn't yet executed +echo F |xcopy /E/Y %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h +xcopy /E/Y/Q %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLIB_TRG_DIR%\wolfcrypt\test\test_paths.h xcopy /E/Y/Q %BASEDIR%\wolfcrypt\benchmark %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\ xcopy /Y/Q %BASEDIR%\wolfssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\ +xcopy /Y/Q %BASEDIR%\wolfssl\openssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\ xcopy /E/Y/Q %BASEDIR%\wolfssl\wolfcrypt %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\ rem user_settings.h @@ -50,11 +55,11 @@ rem Benchmark program rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\ -xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.h %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.h -xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.c +echo F |xcopy /E/Y %BASEDIR%\wolfcrypt\benchmark\benchmark.h %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.h +echo F |xcopy /E/Y %BASEDIR%\wolfcrypt\benchmark\benchmark.c %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.c xcopy /F/Q %BASEDIR%\wolfcrypt\benchmark\benchmark.c %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\ -xcopy /E/F/Q %WOLFSSL_ESPIDFDIR%\examples\wolfssl_benchmark %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ +xcopy /E/F/Q/Y %WOLFSSL_ESPIDFDIR%\examples\wolfssl_benchmark %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ rem Crypt Test program rmdir /S/Q %WOLFSSLEXP_TRG_DIR%\wolfssl_test\ diff --git a/IDE/Espressif/ESP-IDF/test/README.md b/IDE/Espressif/ESP-IDF/test/README.md index 6b2383fee..e832b5c50 100644 --- a/IDE/Espressif/ESP-IDF/test/README.md +++ b/IDE/Espressif/ESP-IDF/test/README.md @@ -4,7 +4,7 @@ The test contains of wolfSSL unit-test app on Unity. When you want to run the app 1. Go to /esp-idf/tools/unit-test-app/ folder -2. "idf.py menuconfig" to configure unit test app. -3. "idf.py -T wolfssl build" to build wolfssl unit test app. +2. `idf.py menuconfig` to configure unit test app. +3. `idf.py -T wolfssl build` to build wolfssl unit test app. See [https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/unit-tests.html] for more information about unit test app. diff --git a/IDE/include.am b/IDE/include.am index 7faf7668b..7d12b578a 100644 --- a/IDE/include.am +++ b/IDE/include.am @@ -47,3 +47,4 @@ include IDE/NETOS/include.am EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif EXTRA_DIST+= IDE/OPENSTM32/README.md EXTRA_DIST+= IDE/Espressif/ESP-IDF/setup_win.bat +EXTRA_DIST+= IDE/Espressif/ESP-IDF/dummy_test_paths.h diff --git a/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h b/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h index e3d2cc64c..827a415d4 100644 --- a/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h +++ b/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h @@ -38,11 +38,17 @@ #include "soc/dport_reg.h" #include "soc/hwcrypto_reg.h" #include "soc/cpu.h" -#include "driver/periph_ctrl.h" -#if ESP_IDF_VERSION_MAJOR >= 4 -#include + +#if ESP_IDF_VERSION_MAJOR >= 5 + #include "esp_private/periph_ctrl.h" #else -#include + #include "driver/periph_ctrl.h" +#endif + +#if ESP_IDF_VERSION_MAJOR >= 4 + #include +#else + #include #endif #ifdef __cplusplus