From 99d4a7417adcd2ed910b5c668c3691104a4d5284 Mon Sep 17 00:00:00 2001 From: Hideki Miyazaki Date: Tue, 15 Dec 2020 16:35:04 +0900 Subject: [PATCH 1/2] fix wolfssl unit test on ESP-IDF --- IDE/Espressif/ESP-IDF/test/CMakeLists.txt | 2 +- IDE/Espressif/ESP-IDF/test/README.md | 7 +++---- IDE/Espressif/ESP-IDF/test/test_wolfssl.c | 19 ++----------------- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/IDE/Espressif/ESP-IDF/test/CMakeLists.txt b/IDE/Espressif/ESP-IDF/test/CMakeLists.txt index a514e9b2e..bba297799 100644 --- a/IDE/Espressif/ESP-IDF/test/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/test/CMakeLists.txt @@ -1,6 +1,6 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_MAIN_DRIVER -DWOLFSSL_USER_SETTINGS") -set(COMPONENT_SRCDIRS ".") +set(COMPONENT_SRCS "test_wolfssl.c") set(COMPONENT_ADD_INCLUDEDIRS ".") set(COMPONENT_REQUIRES unity test_utils wolfssl) diff --git a/IDE/Espressif/ESP-IDF/test/README.md b/IDE/Espressif/ESP-IDF/test/README.md index 7b32de6e9..6b2383fee 100644 --- a/IDE/Espressif/ESP-IDF/test/README.md +++ b/IDE/Espressif/ESP-IDF/test/README.md @@ -3,9 +3,8 @@ 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. Go to /esp-idf/tools/unit-test-app/ folder -3. "idf.py menuconfig" to configure unit test app. -4. "idf.py -T wolfssl build" to build wolfssl unit test 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. 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/Espressif/ESP-IDF/test/test_wolfssl.c b/IDE/Espressif/ESP-IDF/test/test_wolfssl.c index b1cb8bd4c..b08e7fc5c 100644 --- a/IDE/Espressif/ESP-IDF/test/test_wolfssl.c +++ b/IDE/Espressif/ESP-IDF/test/test_wolfssl.c @@ -34,23 +34,12 @@ static xSemaphoreHandle exit_semaph; static volatile bool exit_loop=false; static uint64_t startTime = 0; +#include "../wolfcrypt/test/test.c" + #define SHA_STACK_SIZE (20*1024) #define TIMES_SHA 500 #define TIMES_AES 100 -#ifndef NO_SHA -int sha_test(); -#endif -#ifndef NO_SHA256 -int sha256_test(); -#endif -#ifdef WOLFSSL_SHA384 -int sha384_test(void); -#endif -#ifdef WOLFSSL_SHA512 -int sha512_test(void); -#endif - static uint64_t rsa_elapsedTime = 0; static void esp32TimerStart() { @@ -64,7 +53,6 @@ static uint64_t esp32elapsedTime() } #ifndef NO_RSA -int rsa_test(void); static void tskRsa_Test(void *pvParam) { int ret = 0; @@ -89,7 +77,6 @@ static void tskRsa_Test(void *pvParam) #endif #ifndef NO_AES -int aes_test(void); static void tskAes_Test(void *pvParam) { int ret = 0; @@ -131,7 +118,6 @@ static void tskAesGcm_Test(void *pvParam) } #ifdef WOLFSSL_AES_192 -int aes192_test(void); static void tskAes192_Test(void *pvParam) { int ret = 0; @@ -151,7 +137,6 @@ static void tskAes192_Test(void *pvParam) } #endif #ifdef WOLFSSL_AES_256 -int aes256_test(void); static void tskAes256_Test(void *pvParam) { int ret = 0; From b8997d0b47f82155dcbbff54a99124a79495409c Mon Sep 17 00:00:00 2001 From: Hideki Miyazaki Date: Tue, 5 Jan 2021 16:20:42 +0900 Subject: [PATCH 2/2] revert test_wolfssl.c changes add test.c as src target --- IDE/Espressif/ESP-IDF/test/CMakeLists.txt | 2 +- IDE/Espressif/ESP-IDF/test/test_wolfssl.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/IDE/Espressif/ESP-IDF/test/CMakeLists.txt b/IDE/Espressif/ESP-IDF/test/CMakeLists.txt index bba297799..ad31c5d98 100644 --- a/IDE/Espressif/ESP-IDF/test/CMakeLists.txt +++ b/IDE/Espressif/ESP-IDF/test/CMakeLists.txt @@ -1,6 +1,6 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_MAIN_DRIVER -DWOLFSSL_USER_SETTINGS") -set(COMPONENT_SRCS "test_wolfssl.c") +set(COMPONENT_SRCS "test_wolfssl.c" "../wolfcrypt/test/test.c") set(COMPONENT_ADD_INCLUDEDIRS ".") set(COMPONENT_REQUIRES unity test_utils wolfssl) diff --git a/IDE/Espressif/ESP-IDF/test/test_wolfssl.c b/IDE/Espressif/ESP-IDF/test/test_wolfssl.c index b08e7fc5c..b1cb8bd4c 100644 --- a/IDE/Espressif/ESP-IDF/test/test_wolfssl.c +++ b/IDE/Espressif/ESP-IDF/test/test_wolfssl.c @@ -34,12 +34,23 @@ static xSemaphoreHandle exit_semaph; static volatile bool exit_loop=false; static uint64_t startTime = 0; -#include "../wolfcrypt/test/test.c" - #define SHA_STACK_SIZE (20*1024) #define TIMES_SHA 500 #define TIMES_AES 100 +#ifndef NO_SHA +int sha_test(); +#endif +#ifndef NO_SHA256 +int sha256_test(); +#endif +#ifdef WOLFSSL_SHA384 +int sha384_test(void); +#endif +#ifdef WOLFSSL_SHA512 +int sha512_test(void); +#endif + static uint64_t rsa_elapsedTime = 0; static void esp32TimerStart() { @@ -53,6 +64,7 @@ static uint64_t esp32elapsedTime() } #ifndef NO_RSA +int rsa_test(void); static void tskRsa_Test(void *pvParam) { int ret = 0; @@ -77,6 +89,7 @@ static void tskRsa_Test(void *pvParam) #endif #ifndef NO_AES +int aes_test(void); static void tskAes_Test(void *pvParam) { int ret = 0; @@ -118,6 +131,7 @@ static void tskAesGcm_Test(void *pvParam) } #ifdef WOLFSSL_AES_192 +int aes192_test(void); static void tskAes192_Test(void *pvParam) { int ret = 0; @@ -137,6 +151,7 @@ static void tskAes192_Test(void *pvParam) } #endif #ifdef WOLFSSL_AES_256 +int aes256_test(void); static void tskAes256_Test(void *pvParam) { int ret = 0;