diff --git a/IDE/Espressif/ESP-IDF/README.md b/IDE/Espressif/ESP-IDF/README.md index da1dbea81..c7c6cd91e 100644 --- a/IDE/Espressif/ESP-IDF/README.md +++ b/IDE/Espressif/ESP-IDF/README.md @@ -24,7 +24,7 @@ Including the following examples: Uncomment out #define WOLFSSL_ESPWROOM32 in /path/to/wolfssl/wolfssl/wolfcrypt/settings.h ## Configuration - 1. The *user_settings.h* for each example can be found in /path/to/examples/protocols/wolfssl_xxx/main/include/user_settings.h + 1. The *user_settings.h* can be found in /path/to/esp-idf/components/wolfssl/include/user_settings.h ## Build examples 1. See README in each example folder diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/sdkconfig.defaults b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/sdkconfig.defaults index 29cf15a34..61fd6d665 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/sdkconfig.defaults +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/sdkconfig.defaults @@ -2,3 +2,5 @@ CONFIG_BENCH_ARGV="-lng 0" CONFIG_MAIN_TASK_STACK_SIZE=5000 CONFIG_FREERTOS_HZ=1000 CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0= +CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y +170 CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c index 034513e48..403e48285 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/client-tls.c @@ -34,7 +34,7 @@ #include /* wolfSSL */ -#include +#include #include #include diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/user_settings.h b/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/user_settings.h deleted file mode 100644 index 7fade0591..000000000 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_client/main/include/user_settings.h +++ /dev/null @@ -1,60 +0,0 @@ -/* user_settings.h - * - * Copyright (C) 2006-2018 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 - */ - -#define BENCH_EMBEDDED -#define USE_CERT_BUFFERS_2048 - -/* TLS 1.3 */ -#define WOLFSSL_TLS13 -#define HAVE_TLS_EXTENSIONS -#define WC_RSA_PSS -#define HAVE_HKDF -#define HAVE_FFDHE_2048 -#define HAVE_AEAD -#define HAVE_SUPPORTED_CURVES - -/* when you want to use SINGLE THREAD */ -/* #define SINGLE_THREADED */ -#define NO_FILESYSTEM - -#define HAVE_AESGCM -/* when you want to use SHA384 */ -/* #define WOLFSSL_SHA384 */ -#define WOLFSSL_SHA512 -#define HAVE_ECC -#define HAVE_CURVE25519 -#define CURVE25519_SMALL -#define HAVE_ED25519 - -/* debug options */ -/* #define DEBUG_WOLFSSL */ -/* #define WOLFSSL_ESP32WROOM32_CRYPT_DEBUG */ - -/* date/time */ -/* if it cannot adjust time in the device, */ -/* enable macro below */ -/* #define NO_ASN_TIME */ -/* #define XTIME time */ - -/* when you want not to use HW acceleration */ -/* #define NO_ESP32WROOM32_CRYPT */ -/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH*/ -/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_AES */ diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/include/user_settings.h b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/include/user_settings.h deleted file mode 100644 index 7fade0591..000000000 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/include/user_settings.h +++ /dev/null @@ -1,60 +0,0 @@ -/* user_settings.h - * - * Copyright (C) 2006-2018 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 - */ - -#define BENCH_EMBEDDED -#define USE_CERT_BUFFERS_2048 - -/* TLS 1.3 */ -#define WOLFSSL_TLS13 -#define HAVE_TLS_EXTENSIONS -#define WC_RSA_PSS -#define HAVE_HKDF -#define HAVE_FFDHE_2048 -#define HAVE_AEAD -#define HAVE_SUPPORTED_CURVES - -/* when you want to use SINGLE THREAD */ -/* #define SINGLE_THREADED */ -#define NO_FILESYSTEM - -#define HAVE_AESGCM -/* when you want to use SHA384 */ -/* #define WOLFSSL_SHA384 */ -#define WOLFSSL_SHA512 -#define HAVE_ECC -#define HAVE_CURVE25519 -#define CURVE25519_SMALL -#define HAVE_ED25519 - -/* debug options */ -/* #define DEBUG_WOLFSSL */ -/* #define WOLFSSL_ESP32WROOM32_CRYPT_DEBUG */ - -/* date/time */ -/* if it cannot adjust time in the device, */ -/* enable macro below */ -/* #define NO_ASN_TIME */ -/* #define XTIME time */ - -/* when you want not to use HW acceleration */ -/* #define NO_ESP32WROOM32_CRYPT */ -/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH*/ -/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_AES */ diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c index 3cc1227ce..4d4550891 100644 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c +++ b/IDE/Espressif/ESP-IDF/examples/wolfssl_server/main/server-tls.c @@ -31,7 +31,7 @@ #include /* wolfSSL */ -#include +#include #include #include diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/include/user_settings.h b/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/include/user_settings.h deleted file mode 100644 index 7fade0591..000000000 --- a/IDE/Espressif/ESP-IDF/examples/wolfssl_test/main/include/user_settings.h +++ /dev/null @@ -1,60 +0,0 @@ -/* user_settings.h - * - * Copyright (C) 2006-2018 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 - */ - -#define BENCH_EMBEDDED -#define USE_CERT_BUFFERS_2048 - -/* TLS 1.3 */ -#define WOLFSSL_TLS13 -#define HAVE_TLS_EXTENSIONS -#define WC_RSA_PSS -#define HAVE_HKDF -#define HAVE_FFDHE_2048 -#define HAVE_AEAD -#define HAVE_SUPPORTED_CURVES - -/* when you want to use SINGLE THREAD */ -/* #define SINGLE_THREADED */ -#define NO_FILESYSTEM - -#define HAVE_AESGCM -/* when you want to use SHA384 */ -/* #define WOLFSSL_SHA384 */ -#define WOLFSSL_SHA512 -#define HAVE_ECC -#define HAVE_CURVE25519 -#define CURVE25519_SMALL -#define HAVE_ED25519 - -/* debug options */ -/* #define DEBUG_WOLFSSL */ -/* #define WOLFSSL_ESP32WROOM32_CRYPT_DEBUG */ - -/* date/time */ -/* if it cannot adjust time in the device, */ -/* enable macro below */ -/* #define NO_ASN_TIME */ -/* #define XTIME time */ - -/* when you want not to use HW acceleration */ -/* #define NO_ESP32WROOM32_CRYPT */ -/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH*/ -/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_AES */ diff --git a/IDE/Espressif/ESP-IDF/libs/component.mk b/IDE/Espressif/ESP-IDF/libs/component.mk index 767353c94..a8ba31e6d 100644 --- a/IDE/Espressif/ESP-IDF/libs/component.mk +++ b/IDE/Espressif/ESP-IDF/libs/component.mk @@ -2,12 +2,14 @@ # Component Makefile # -COMPONENT_ADD_INCLUDEDIRS := . +COMPONENT_ADD_INCLUDEDIRS := . ./include COMPONENT_ADD_INCLUDEDIRS += ../freertos/include/freertos/ COMPONENT_SRCDIRS := src wolfcrypt/src COMPONENT_SRCDIRS += wolfcrypt/src/port/Espressif +CFLAGS +=-DWOLFSSL_USER_SETTINGS + COMPONENT_OBJEXCLUDE := wolfcrypt/src/aes_asm.o COMPONENT_OBJEXCLUDE += wolfcrypt/src/evp.o COMPONENT_OBJEXCLUDE += wolfcrypt/src/misc.o diff --git a/IDE/Espressif/ESP-IDF/setup.sh b/IDE/Espressif/ESP-IDF/setup.sh index 08c70448b..0eae5459d 100755 --- a/IDE/Espressif/ESP-IDF/setup.sh +++ b/IDE/Espressif/ESP-IDF/setup.sh @@ -39,6 +39,7 @@ ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/src ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfcrypt ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/wolfssl ${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/test +${MKDCMD} ${WOLFSSLLIB_TRG_DIR}/include popd > /dev/null # $WOLFSSL_ESPIDFDIR pushd ${BASEDIR} > /dev/null # WOLFSSL TOP DIR @@ -52,6 +53,9 @@ ${CPDCMD} -r ./wolfcrypt/benchmark ${WOLFSSLLIB_TRG_DIR}/wolfcrypt/ ${CPDCMD} -r ./wolfssl/*.h ${WOLFSSLLIB_TRG_DIR}/wolfssl/ ${CPDCMD} -r ./wolfssl/wolfcrypt ${WOLFSSLLIB_TRG_DIR}/wolfssl/ +# user_settings.h +${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/user_settings.h ${WOLFSSLLIB_TRG_DIR}/include/ + # unit test app ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/test/* ${WOLFSSLLIB_TRG_DIR}/test/ @@ -66,23 +70,19 @@ pushd ${BASEDIR} > /dev/null # WOLFSSL TOP DIR ${RMDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/ ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/ ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/ -${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/include ${CPDCMD} -r ./wolfcrypt/benchmark/benchmark.c ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/ ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_benchmark/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/ ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_benchmark/main/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/ -${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_benchmark/main/include/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_benchmark/main/include/ # Crypt Test program ${RMDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/ ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/ ${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/main/ -${MKDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/main/include ${CPDCMD} -r ./wolfcrypt/test/test.c ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/main/ ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_test/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/ ${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_test/main/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/main/ -${CPDCMD} -r ${WOLFSSL_ESPIDFDIR}/examples/wolfssl_test/main/include/* ${WOLFSSLEXP_TRG_DIR}/wolfssl_test/main/include/ # TLS Client program ${RMDCMD} ${WOLFSSLEXP_TRG_DIR}/wolfssl_client/ diff --git a/IDE/Espressif/ESP-IDF/test/README.md b/IDE/Espressif/ESP-IDF/test/README.md index 76cbce775..d1703d90e 100644 --- a/IDE/Espressif/ESP-IDF/test/README.md +++ b/IDE/Espressif/ESP-IDF/test/README.md @@ -1,15 +1,12 @@ -# wolfSSL unit tests +# wolfSSL unit-test app The test contains of wolfSSL unit-test app on Unity. When you want to run the app 1. Copy *test.c* file at /path/to/esp-idf/components/wolfssl/wolfcrypt/test/ folder to the wolfssl/test folder -2. Copy *user_settings.h* to /esp-idf/components/wolfssl/ -3. Add *CFLAGS += -DWOLFSSL_USER_SETTINGS* into components.mk at wolfssl/ -OR, copy *component_wolfssl.mk.use* into wolfssl/ folder -4. Go to /esp-idf/tools/unit-test-app/ folder -5. "make menuconfig" to configure unit test app. -6. "make TEST_COMPONENTS=wolfssl" to build wolfssl unit test app. +2. Go to /esp-idf/tools/unit-test-app/ folder +3. "make menuconfig" to configure unit test app. +4. "make TEST_COMPONENTS=wolfssl" to build wolfssl unit test app. NOTE: You should remove *user_settings.h* file at wolfssl/ folder after finishing run diff --git a/IDE/Espressif/ESP-IDF/test/component_wolfssl.mk.use b/IDE/Espressif/ESP-IDF/test/component_wolfssl.mk.use deleted file mode 100644 index 955934c10..000000000 --- a/IDE/Espressif/ESP-IDF/test/component_wolfssl.mk.use +++ /dev/null @@ -1,16 +0,0 @@ -# -# Component Makefile -# - -COMPONENT_ADD_INCLUDEDIRS := . -COMPONENT_ADD_INCLUDEDIRS += ../freertos/include/freertos/ - -COMPONENT_SRCDIRS := src wolfcrypt/src -COMPONENT_SRCDIRS += wolfcrypt/src/port/Espressif - -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/test/user_settings.h b/IDE/Espressif/ESP-IDF/test/user_settings.h deleted file mode 100644 index 4ceda676a..000000000 --- a/IDE/Espressif/ESP-IDF/test/user_settings.h +++ /dev/null @@ -1,59 +0,0 @@ -/* user_settings.h - * - * Copyright (C) 2006-2018 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 - */ - -#define BENCH_EMBEDDED -#define USE_CERT_BUFFERS_2048 - -/* TLS 1.3 */ -#define WOLFSSL_TLS13 -#define HAVE_TLS_EXTENSIONS -#define WC_RSA_PSS -#define HAVE_HKDF -#define HAVE_FFDHE_2048 -#define HAVE_AEAD -#define HAVE_SUPPORTED_CURVES - -// #define SINGLE_THREADED/* or define RTOS option */ -#define NO_FILESYSTEM - -#define HAVE_AESGCM -/* when you want to use SHA384 */ -#define WOLFSSL_SHA384 -#define WOLFSSL_SHA512 -#define HAVE_ECC -#define HAVE_CURVE25519 -#define CURVE25519_SMALL -#define HAVE_ED25519 - -/* debug options */ -/* #define DEBUG_WOLFSSL */ -/* #define WOLFSSL_ESP32WROOM32_CRYPT_DEBUG */ - -/* date/time */ -/* if it cannot adjust time in the device, */ -/* enable macro below */ -/* #define NO_ASN_TIME */ -/* #define XTIME time */ - -/* when you want not to use HW acceleration */ -/* #define NO_ESP32WROOM32_CRYPT */ -/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH*/ -/* #define NO_WOLFSSL_ESP32WROOM32_CRYPT_AES */ diff --git a/IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/include/user_settings.h b/IDE/Espressif/ESP-IDF/user_settings.h similarity index 100% rename from IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/main/include/user_settings.h rename to IDE/Espressif/ESP-IDF/user_settings.h