From b676c695613b395df8f0050bc5399a737093d3d1 Mon Sep 17 00:00:00 2001 From: David Garske Date: Mon, 18 Nov 2019 06:03:26 -0800 Subject: [PATCH] Fix for DES mutex return code. Fix TLS bench thread shutdown. README.md updates. --- IDE/OPENSTM32/README.md | 23 ++++++++++++++++++++--- IDE/OPENSTM32/Src/wolfssl_example.c | 10 ++++++++-- wolfcrypt/src/des3.c | 2 +- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/IDE/OPENSTM32/README.md b/IDE/OPENSTM32/README.md index e317a1082..30adb473b 100644 --- a/IDE/OPENSTM32/README.md +++ b/IDE/OPENSTM32/README.md @@ -1,4 +1,4 @@ -# wolfSSL STM32 Example for Open STM32 Tools System Workbench +# wolfSSL STM32 Example for System Workbench for STM32 (Open STM32 Tools) This example includes: @@ -23,7 +23,9 @@ These examples use the CubeMX Hal for STM32. If you'd like to use the older Stan 6. Adjust the micro-controller define in `Project Settings -> C/C++ General -> Paths and Symbols -> Symbols -> GNU C`. Example uses `STM32F437xx`, but should be changed to reflect your micro-controller type. 7. Build and Run -Note: You may need to manually copy over the CubeMX HAL files for `stm32f4xx_hal_cryp.c`, `stm32f4xx_hal_cryp_ex.c`, `stm32f4xx_hal_cryp.h`, `stm32f4xx_hal_cryp_ex.h`. Also uncomment the `#define HAL_CRYP_MODULE_ENABLED` line in `stm32f4xx_hal_conf.h`. +If you hardware support crypto acceleration then: +1. Manually copy over the CubeMX HAL files for `stm32f4xx_hal_cryp.c`, `stm32f4xx_hal_cryp_ex.c`, `stm32f4xx_hal_cryp.h`, `stm32f4xx_hal_cryp_ex.h`. +2. Uncomment the `#define HAL_CRYP_MODULE_ENABLED` line in `stm32f4xx_hal_conf.h`. ## Configuration @@ -34,7 +36,22 @@ The settings for the wolfSTM32 project are located in `/IDE/OPENST * To enable STM32F7 support define `WOLFSSL_STM32F7`. * To enable STM32L4 support define `WOLFSSL_STM32L4`. -If you are using FreeRTOS make sure your `FreeRTOSConfig.h` has its `configTOTAL_HEAP_SIZE` increased. The TLS client/server benchmark example requires about 76 KB for allocated tasks (with stack) and peak heap. +If you are using FreeRTOS make sure your `FreeRTOSConfig.h` has its `configTOTAL_HEAP_SIZE` increased. + +The TLS client/server benchmark example requires about 76 KB for allocated tasks (with stack) and peak heap. + +## Example Output + +``` +....MENU + +.t. WolfCrypt Test +.b. WolfCrypt Benchmark +.l. WolfSSL TLS Bench +.e. Show Cipher List + +Please select one of the above options: +``` ## Support diff --git a/IDE/OPENSTM32/Src/wolfssl_example.c b/IDE/OPENSTM32/Src/wolfssl_example.c index 87a58ff31..91f8fac83 100644 --- a/IDE/OPENSTM32/Src/wolfssl_example.c +++ b/IDE/OPENSTM32/Src/wolfssl_example.c @@ -872,8 +872,10 @@ static void client_thread(const void* args) osSignalSet(info->server.threadId, 1); info->client.ret = ret; info->client.done = 1; - osThreadSuspend(NULL); + + if (info->doShutdown) + info->client.done = 1; } while (!info->doShutdown); osThreadTerminate(info->client.threadId); @@ -1104,8 +1106,10 @@ static void server_thread(const void* args) osSignalSet(info->client.threadId, 1); info->server.ret = ret; info->server.done = 1; - osThreadSuspend(NULL); + + if (info->doShutdown) + info->server.done = 1; } while (!info->doShutdown); osThreadTerminate(info->server.threadId); @@ -1308,6 +1312,7 @@ void wolfCryptDemo(const void* argument) case 't': printf("Running wolfCrypt Tests...\n"); #ifndef NO_CRYPT_TEST + args.return_code = 0; wolfcrypt_test(&args); #endif printf("Crypt Test: Return code %d\n", args.return_code); @@ -1316,6 +1321,7 @@ void wolfCryptDemo(const void* argument) case 'b': printf("Running wolfCrypt Benchmarks...\n"); #ifndef NO_CRYPT_BENCHMARK + args.return_code = 0; benchmark_test(&args); #endif printf("Benchmark Test: Return code %d\n", args.return_code); diff --git a/wolfcrypt/src/des3.c b/wolfcrypt/src/des3.c index aaca6c2c7..408ac6148 100644 --- a/wolfcrypt/src/des3.c +++ b/wolfcrypt/src/des3.c @@ -204,7 +204,7 @@ ret = wolfSSL_CryptHwMutexLock(); if (ret != 0) { - return ret; + return; } #ifdef WOLFSSL_STM32_CUBEMX