diff --git a/IDE/MDK5-ARM/Conf/user_settings.h b/IDE/MDK5-ARM/Conf/user_settings.h index 546cde7e5..2c1fd6c3a 100644 --- a/IDE/MDK5-ARM/Conf/user_settings.h +++ b/IDE/MDK5-ARM/Conf/user_settings.h @@ -59,8 +59,8 @@ // <4=>PThread <5=>ThreadX<6=> ThreadX/NetX // <7=>Micrium <8=>EBSnet<9=>MQX // <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2 -// <13=>Frosted <14=>CMSIS RTOS<15=>Others -#define MDK_CONF_THREAD 14 +// <13=>Frosted <14=>CMSIS RTOS<15=>CMSIS RTOSv2<16=>Others +#define MDK_CONF_THREAD 15 #if MDK_CONF_THREAD== 0 #define SINGLE_THREADED #elif MDK_CONF_THREAD == 1 @@ -92,6 +92,8 @@ #elif MDK_CONF_THREAD == 14 #define WOLFSSL_CMSIS_RTOS #elif MDK_CONF_THREAD == 15 +#define WOLFSSL_CMSIS_RTOSv2 +#elif MDK_CONF_THREAD == 16 #define SINGLE_THREADED #endif @@ -151,13 +153,13 @@ // Hash/Crypt Algrithm // MD2 -#define MDK_CONF_MD2 1 +#define MDK_CONF_MD2 0 #if MDK_CONF_MD2 == 1 #define WOLFSSL_MD2 #endif // // MD4 -#define MDK_CONF_MD4 1 +#define MDK_CONF_MD4 0 #if MDK_CONF_MD4 == 0 #define NO_MD4 #endif @@ -237,7 +239,7 @@ // // RC4 -#define MDK_CONF_RC4 1 +#define MDK_CONF_RC4 0 #if MDK_CONF_RC4 == 0 #define NO_RC4 #endif @@ -376,7 +378,7 @@ // Hardware Crypt (See document for usage) // Hardware RNG -#define MDK_CONF_STM32F2_RNG 1 +#define MDK_CONF_STM32F2_RNG 0 #if MDK_CONF_STM32F2_RNG == 1 #define WOLFSSL_STM32_CUBEMX #define STM32_RNG @@ -394,7 +396,7 @@ #endif // // Hardware Crypt -#define MDK_CONF_STM32F2_CRYPTO 1 +#define MDK_CONF_STM32F2_CRYPTO 0 #if MDK_CONF_STM32F2_CRYPTO == 1 #define WOLFSSL_STM32_CUBEMX #define STM32_CRYPTO @@ -412,7 +414,7 @@ #endif // // Hardware Hash -#define MDK_CONF_STM32F2_HASH 1 +#define MDK_CONF_STM32F2_HASH 0 #if MDK_CONF_STM32F2_HASH == 1 #define WOLFSSL_STM32_CUBEMX #define STM32_HASH @@ -462,7 +464,7 @@ #endif // // Small Stack -#define MDK_CONF_SmallStack 0 +#define MDK_CONF_SmallStack 1 #if MDK_CONF_SmallStack == 0 #define NO_WOLFSSL_SMALL_STACK #endif @@ -476,10 +478,11 @@ // wolfSSL Configuration // TLS 1.3 -#define MDK_CONF_TLS 0 +#define MDK_CONF_TLS 1 #if MDK_CONF_TLS == 1 #define WOLFSSL_TLS13 #define HAVE_TLS_EXTENSIONS +#define HAVE_SUPPORTED_CURVES #define WC_RSA_PSS #define HAVE_HKDF #define HAVE_FFDHE_2048 diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/Abstract.txt b/IDE/MDK5-ARM/Projects/CryptBenchmark/Abstract.txt index d6ab1ff89..f3c95a61c 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/Abstract.txt +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/Abstract.txt @@ -1,6 +1,7 @@ wolfCrypt Benchmark Use Configuration Wizard tab +RTE_Device.h: Check SDMMC1 (SD/SDIO/MMC card host interface 1) user_settings.h for wolfCrypt options For further options, details, see wolfSSL User Manual. diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx index b1fbf5236..e598c5563 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx @@ -101,7 +101,7 @@ 0 0 1 - 5 + 1 @@ -112,9 +112,14 @@ - STLink\ST-LINKIII-KEIL_SWO.dll + BIN\ULP2CM3.DLL + + 0 + ULP2CM3 + -UP1135060 -O207 -S10 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO19 -TC216000000 -TP11 -TDX0 -TDD0 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) + 0 ST-LINKIII-KEIL_SWO @@ -138,7 +143,7 @@ 0 DLGUARM - (105=-1,-1,-1,-1,0) + 0 @@ -155,8 +160,13 @@ - C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.5.0\FileSystem\FileSystem.scvd - Keil.MDK-Middleware.7.5.0 + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.7.0\FileSystem\FileSystem.scvd + Keil.MDK-Middleware.7.7.0 + 1 + + + C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.3.0\CMSIS\RTOS2\RTX\RTX5.scvd + ARM.CMSIS.5.3.0 1 @@ -197,6 +207,10 @@ + + + + 1 0 diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx index 4997dd9f7..095377e60 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx @@ -16,7 +16,7 @@ STM32F756NGHx STMicroelectronics - Keil.STM32F7xx_DFP.2.9.0 + Keil.STM32F7xx_DFP.2.11.0 http://www.keil.com/pack IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE @@ -176,7 +176,7 @@ 0 "Cortex-M7" - 1 + 0 0 0 1 @@ -446,6 +446,12 @@ + + + + + + @@ -460,8 +466,14 @@ - - + + + + + + + + @@ -496,14 +508,14 @@ - - + + - - + + @@ -532,128 +544,128 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -661,57 +673,71 @@ - RTE\CMSIS\RTX_Conf_CM.c + RTE\CMSIS\RTX_Conf_CM.c + + + + RTE\CMSIS\RTX_Config.c + + - + + RTE\CMSIS\RTX_Config.h + + + + + + + RTE\Device\STM32F756NGHx\RTE_Device.h - - + + - + RTE\Device\STM32F756NGHx\startup_stm32f756xx.s - - + + - + RTE\Device\STM32F756NGHx\stm32f7xx_hal_conf.h - - + + - + RTE\Device\STM32F756NGHx\system_stm32f7xx.c - - + + RTE\File_System\FS_Config.c - - + + RTE\File_System\FS_Config_MC_0.h - - + + @@ -766,8 +792,8 @@ RTE\wolfSSL\user_settings.h - - + + diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h index e8ba54756..30bb846d8 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h @@ -18,7 +18,8 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ - + +#define WOLFSSL_MDK5_COMPLv5 #define NO_MAIN_DRIVER #define BENCH_EMBEDDED #define NO_DEV_RANDOM @@ -58,8 +59,8 @@ // <4=>PThread <5=>ThreadX<6=> ThreadX/NetX // <7=>Micrium <8=>EBSnet<9=>MQX // <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2 -// <13=>Frosted <14=>CMSIS RTOS<15=>Others -#define MDK_CONF_THREAD 14 +// <13=>Frosted <14=>CMSIS RTOS<15=>CMSIS RTOSv2<16=>Others +#define MDK_CONF_THREAD 15 #if MDK_CONF_THREAD== 0 #define SINGLE_THREADED #elif MDK_CONF_THREAD == 1 @@ -91,6 +92,8 @@ #elif MDK_CONF_THREAD == 14 #define WOLFSSL_CMSIS_RTOS #elif MDK_CONF_THREAD == 15 +#define WOLFSSL_CMSIS_RTOSv2 +#elif MDK_CONF_THREAD == 16 #define SINGLE_THREADED #endif @@ -150,13 +153,13 @@ // Hash/Crypt Algrithm // MD2 -#define MDK_CONF_MD2 1 +#define MDK_CONF_MD2 0 #if MDK_CONF_MD2 == 1 #define WOLFSSL_MD2 #endif // // MD4 -#define MDK_CONF_MD4 1 +#define MDK_CONF_MD4 0 #if MDK_CONF_MD4 == 0 #define NO_MD4 #endif @@ -236,7 +239,7 @@ // // RC4 -#define MDK_CONF_RC4 1 +#define MDK_CONF_RC4 0 #if MDK_CONF_RC4 == 0 #define NO_RC4 #endif @@ -375,7 +378,7 @@ // Hardware Crypt (See document for usage) // Hardware RNG -#define MDK_CONF_STM32F2_RNG 1 +#define MDK_CONF_STM32F2_RNG 0 #if MDK_CONF_STM32F2_RNG == 1 #define WOLFSSL_STM32_CUBEMX #define STM32_RNG @@ -393,7 +396,7 @@ #endif // // Hardware Crypt -#define MDK_CONF_STM32F2_CRYPTO 1 +#define MDK_CONF_STM32F2_CRYPTO 0 #if MDK_CONF_STM32F2_CRYPTO == 1 #define WOLFSSL_STM32_CUBEMX #define STM32_CRYPTO @@ -411,7 +414,7 @@ #endif // // Hardware Hash -#define MDK_CONF_STM32F2_HASH 1 +#define MDK_CONF_STM32F2_HASH 0 #if MDK_CONF_STM32F2_HASH == 1 #define WOLFSSL_STM32_CUBEMX #define STM32_HASH @@ -461,7 +464,7 @@ #endif // // Small Stack -#define MDK_CONF_SmallStack 0 +#define MDK_CONF_SmallStack 1 #if MDK_CONF_SmallStack == 0 #define NO_WOLFSSL_SMALL_STACK #endif @@ -475,10 +478,11 @@ // wolfSSL Configuration // TLS 1.3 -#define MDK_CONF_TLS 0 +#define MDK_CONF_TLS 1 #if MDK_CONF_TLS == 1 #define WOLFSSL_TLS13 #define HAVE_TLS_EXTENSIONS +#define HAVE_SUPPORTED_CURVES #define WC_RSA_PSS #define HAVE_HKDF #define HAVE_FFDHE_2048 diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c b/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c index 25d9e3b5e..2ab319494 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c @@ -30,8 +30,16 @@ #include #include +#if defined(WOLFSSL_CMSIS_RTOS) +#include "cmsis_os.h" +#elif defined(WOLFSSL_CMSIS_RTOSv2) +#include "cmsis_os2.h" +#endif + /* Dummy definition for test RTC */ -#define RTC_YEAR 2018 +#define RTC_YEAR 2019 +#define RTC_MONTH 1 +#define RTC_DAY 1 #define RTC_MONTH 1 #define RTC_DAY 1 @@ -56,32 +64,30 @@ static void CPU_CACHE_Enable (void) { } -#ifdef RTE_CMSIS_RTOS_RTX +#if defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2) + +#if defined(WOLFSSL_CMSIS_RTOS) extern uint32_t os_time; -static time_t epochTime; - -uint32_t HAL_GetTick(void) { - return os_time; -} - -time_t time(time_t *t){ - return epochTime ; -} - -void setTime(time_t t){ - epochTime = t; -} #endif -#ifdef WOLFSSL_CURRTIME_OSTICK - -#include -extern uint32_t os_time; +uint32_t HAL_GetTick(void) +{ + #if defined(WOLFSSL_CMSIS_RTOS) + return os_time; + #elif defined(WOLFSSL_CMSIS_RTOSv2) + return osKernelGetTickCount(); + #endif +} double current_time(int reset) { - if(reset) os_time = 0 ; - return (double)os_time /1000.0; + if (reset) + return 0; + #if defined(WOLFSSL_CMSIS_RTOS) + return (double)os_time / 1000.0; + #elif defined(WOLFSSL_CMSIS_RTOSv2) + return (double)osKernelGetTickCount() / 1000.0; + #endif } #else @@ -103,6 +109,17 @@ double current_time(int reset) } #endif +static time_t epochTime; +time_t time(time_t *t) +{ + return epochTime; +} + +void setTime(time_t t) +{ + epochTime = t; +} + /*----------------------------------------------------------------------------- * Initialize a Flash Memory Card *----------------------------------------------------------------------------*/ diff --git a/IDE/MDK5-ARM/Projects/CryptTest/Abstract.txt b/IDE/MDK5-ARM/Projects/CryptTest/Abstract.txt index 72a0fce0e..808804bfa 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/Abstract.txt +++ b/IDE/MDK5-ARM/Projects/CryptTest/Abstract.txt @@ -1,6 +1,7 @@ wolfCrypt test Use Configuration Wizard tab +RTE_Device.h: Check SDMMC1 (SD/SDIO/MMC card host interface 1) user_settings.h for wolfCrypt options For further options, details, see wolfSSL User Manual. diff --git a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx index c0dbc1d86..e3db5d534 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx +++ b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx @@ -101,7 +101,7 @@ 0 0 1 - 5 + 1 @@ -112,7 +112,7 @@ .\STM32_SWO.ini - STLink\ST-LINKIII-KEIL_SWO.dll + BIN\ULP2CM3.DLL @@ -128,7 +128,7 @@ 0 ULP2CM3 - -UP0940001 -O207 -S10 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO1 -TC216000000 -TP11 -TDX0 -TDD0 -TDS8001 -TDT0 -TDC1F -TIE1 -TIP1 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) + -UP1135060 -O207 -S10 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO1 -TC216000000 -TP11 -TDX0 -TDD0 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP9 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) 0 @@ -143,7 +143,7 @@ 0 DLGUARM - (105=-1,-1,-1,-1,0) + 0 @@ -160,13 +160,18 @@ - C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.5.0\FileSystem\FileSystem.scvd - Keil.MDK-Middleware.7.5.0 + C:\Keil_v5\ARM\PACK\Keil\ARM_Compiler\1.3.3\EventRecorder.scvd + Keil.ARM_Compiler.1.3.3 1 - C:\Keil_v5\ARM\PACK\Keil\ARM_Compiler\1.3.2\EventRecorder.scvd - Keil.ARM_Compiler.1.3.2 + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.7.0\FileSystem\FileSystem.scvd + Keil.MDK-Middleware.7.7.0 + 1 + + + C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.3.0\CMSIS\RTOS2\RTX\RTX5.scvd + ARM.CMSIS.5.3.0 1 @@ -207,6 +212,10 @@ + + + + 1 0 diff --git a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx index f79650902..8e4dcd595 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx +++ b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx @@ -16,7 +16,7 @@ STM32F756NGHx STMicroelectronics - Keil.STM32F7xx_DFP.2.9.0 + Keil.STM32F7xx_DFP.2.11.0 http://www.keil.com/pack IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE @@ -176,7 +176,7 @@ 0 "Cortex-M7" - 1 + 0 0 0 1 @@ -456,6 +456,12 @@ + + + + + + @@ -470,8 +476,14 @@ - - + + + + + + + + @@ -512,14 +524,14 @@ - - + + - - + + @@ -644,20 +656,20 @@ - - + + - - + + - - + + @@ -665,9 +677,23 @@ - RTE\CMSIS\RTX_Conf_CM.c + RTE\CMSIS\RTX_Conf_CM.c + + + + RTE\CMSIS\RTX_Config.c + + + + + + + + RTE\CMSIS\RTX_Config.h + + @@ -680,50 +706,50 @@ - + RTE\Device\STM32F756NGHx\RTE_Device.h - - + + - + RTE\Device\STM32F756NGHx\startup_stm32f756xx.s - - + + - + RTE\Device\STM32F756NGHx\stm32f7xx_hal_conf.h - - + + - + RTE\Device\STM32F756NGHx\system_stm32f7xx.c - - + + RTE\File_System\FS_Config.c - - + + RTE\File_System\FS_Config_MC_0.h - - + + @@ -742,8 +768,8 @@ RTE\wolfSSL\user_settings.h - - + + diff --git a/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h index ffce5bd40..286eb78ae 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h +++ b/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h @@ -59,8 +59,8 @@ // <4=>PThread <5=>ThreadX<6=> ThreadX/NetX // <7=>Micrium <8=>EBSnet<9=>MQX // <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2 -// <13=>Frosted <14=>CMSIS RTOS<15=>Others -#define MDK_CONF_THREAD 14 +// <13=>Frosted <14=>CMSIS RTOS<15=>CMSIS RTOSv2<16=>Others +#define MDK_CONF_THREAD 15 #if MDK_CONF_THREAD== 0 #define SINGLE_THREADED #elif MDK_CONF_THREAD == 1 @@ -92,6 +92,8 @@ #elif MDK_CONF_THREAD == 14 #define WOLFSSL_CMSIS_RTOS #elif MDK_CONF_THREAD == 15 +#define WOLFSSL_CMSIS_RTOSv2 +#elif MDK_CONF_THREAD == 16 #define SINGLE_THREADED #endif @@ -151,13 +153,13 @@ // Hash/Crypt Algrithm // MD2 -#define MDK_CONF_MD2 1 +#define MDK_CONF_MD2 0 #if MDK_CONF_MD2 == 1 #define WOLFSSL_MD2 #endif // // MD4 -#define MDK_CONF_MD4 1 +#define MDK_CONF_MD4 0 #if MDK_CONF_MD4 == 0 #define NO_MD4 #endif @@ -237,7 +239,7 @@ // // RC4 -#define MDK_CONF_RC4 1 +#define MDK_CONF_RC4 0 #if MDK_CONF_RC4 == 0 #define NO_RC4 #endif @@ -376,7 +378,7 @@ // Hardware Crypt (See document for usage) // Hardware RNG -#define MDK_CONF_STM32F2_RNG 1 +#define MDK_CONF_STM32F2_RNG 0 #if MDK_CONF_STM32F2_RNG == 1 #define WOLFSSL_STM32_CUBEMX #define STM32_RNG @@ -394,7 +396,7 @@ #endif // // Hardware Crypt -#define MDK_CONF_STM32F2_CRYPTO 1 +#define MDK_CONF_STM32F2_CRYPTO 0 #if MDK_CONF_STM32F2_CRYPTO == 1 #define WOLFSSL_STM32_CUBEMX #define STM32_CRYPTO @@ -412,7 +414,7 @@ #endif // // Hardware Hash -#define MDK_CONF_STM32F2_HASH 1 +#define MDK_CONF_STM32F2_HASH 0 #if MDK_CONF_STM32F2_HASH == 1 #define WOLFSSL_STM32_CUBEMX #define STM32_HASH @@ -462,7 +464,7 @@ #endif // // Small Stack -#define MDK_CONF_SmallStack 0 +#define MDK_CONF_SmallStack 1 #if MDK_CONF_SmallStack == 0 #define NO_WOLFSSL_SMALL_STACK #endif @@ -476,10 +478,11 @@ // wolfSSL Configuration // TLS 1.3 -#define MDK_CONF_TLS 0 +#define MDK_CONF_TLS 1 #if MDK_CONF_TLS == 1 #define WOLFSSL_TLS13 #define HAVE_TLS_EXTENSIONS +#define HAVE_SUPPORTED_CURVES #define WC_RSA_PSS #define HAVE_HKDF #define HAVE_FFDHE_2048 diff --git a/IDE/MDK5-ARM/Projects/CryptTest/main.c b/IDE/MDK5-ARM/Projects/CryptTest/main.c index 3d88e2e7d..199a78df2 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/main.c +++ b/IDE/MDK5-ARM/Projects/CryptTest/main.c @@ -28,8 +28,13 @@ #include #include +#if defined(WOLFSSL_CMSIS_RTOS) + #include "cmsis_os.h" +#elif defined(WOLFSSL_CMSIS_RTOSv2) + #include "cmsis_os2.h" +#endif /* Dummy definition for test RTC */ -#define RTC_YEAR 2018 +#define RTC_YEAR 2019 #define RTC_MONTH 1 #define RTC_DAY 1 @@ -55,14 +60,19 @@ static void CPU_CACHE_Enable (void) { } -#ifdef RTE_CMSIS_RTOS_RTX +#if defined(WOLFSSL_CMSIS_RTOS) extern uint32_t os_time; -static time_t epochTime; +#endif uint32_t HAL_GetTick(void) { - return os_time; + #if defined(WOLFSSL_CMSIS_RTOS) + return os_time; + #elif defined(WOLFSSL_CMSIS_RTOSv2) + return osKernelGetTickCount(); + #endif } +static time_t epochTime; time_t time(time_t *t){ return epochTime ; } @@ -70,36 +80,6 @@ time_t time(time_t *t){ void setTime(time_t t){ epochTime = t; } -#endif -#ifdef WOLFSSL_CURRTIME_OSTICK - -#include -extern uint32_t os_time; - -double current_time(int reset) -{ - if(reset) os_time = 0 ; - return (double)os_time /1000.0; -} - -#else - -#include -#define DWT ((DWT_Type *) (0xE0001000UL) ) -typedef struct -{ - uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ - uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ -} DWT_Type; - -extern uint32_t SystemCoreClock ; - -double current_time(int reset) -{ - if(reset) DWT->CYCCNT = 0 ; - return ((double)DWT->CYCCNT/SystemCoreClock) ; -} -#endif /*----------------------------------------------------------------------------- * Initialize a Flash Memory Card diff --git a/IDE/MDK5-ARM/Projects/EchoClient/Abstract.txt b/IDE/MDK5-ARM/Projects/EchoClient/Abstract.txt index 3586d285d..46913b5e8 100644 --- a/IDE/MDK5-ARM/Projects/EchoClient/Abstract.txt +++ b/IDE/MDK5-ARM/Projects/EchoClient/Abstract.txt @@ -1,6 +1,9 @@ wolfSSL example: echo Client Use Configuration Wizard tab + +RTE_Device.h: Check SDMMC1 (SD/SDIO/MMC card host interface 1) +RTE_Device.h: Check ETH (Ethernet Interface) main.c for remote IP address, port or TLS version user_settings.h for wolfCrypt or wolfSSL options diff --git a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx index bfb18aec3..fdaf17155 100644 --- a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx +++ b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx @@ -16,7 +16,7 @@ STM32F756NGHx STMicroelectronics - Keil.STM32F7xx_DFP.2.9.0 + Keil.STM32F7xx_DFP.2.11.0 http://www.keil.com/pack IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE @@ -763,7 +763,7 @@ - + RTE\CMSIS\RTX_Conf_CM.c @@ -771,50 +771,50 @@ - + RTE\Device\STM32F756NGHx\RTE_Device.h - - + + - + RTE\Device\STM32F756NGHx\startup_stm32f756xx.s - - + + - + RTE\Device\STM32F756NGHx\stm32f7xx_hal_conf.h - - + + - + RTE\Device\STM32F756NGHx\system_stm32f7xx.c - - + + RTE\File_System\FS_Config.c - - + + RTE\File_System\FS_Config_MC_0.h - - + + @@ -822,7 +822,7 @@ RTE\Network\Net_Config.c - + @@ -830,7 +830,7 @@ RTE\Network\Net_Config_BSD.h - + @@ -838,7 +838,7 @@ RTE\Network\Net_Config_DNS_Client.h - + @@ -846,7 +846,7 @@ RTE\Network\Net_Config_ETH_0.h - + @@ -854,7 +854,7 @@ RTE\Network\Net_Config_TCP.h - + @@ -862,7 +862,7 @@ RTE\Network\Net_Config_UDP.h - + @@ -881,8 +881,8 @@ RTE\wolfSSL\user_settings.h - - + + diff --git a/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h new file mode 100644 index 000000000..30f64ccc3 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h @@ -0,0 +1,517 @@ +/* user_settings.h + * + * Copyright (C) 2006-2017 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 NO_MAIN_DRIVER +#define BENCH_EMBEDDED +#define NO_DEV_RANDOM +#define WOLFSSL_USER_CURRTIME +#define SIZEOF_LONG_LONG 8 +#define NO_WRITEV +#define NO_DEV_RANDOM + +#define TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT +#define WC_RSA_BLINDING + +#define WOLFSSL_USER_CURRTIME /* for benchmark */ +#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */ +#define WOLFSSL_GMTIME +#define NO_MULTIBYTE_PRINT + +// <<< Use Configuration Wizard in Context Menu >>> + + +// Common options +// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx +#define MDK_CONF_MPU 3 +#if MDK_CONF_MPU == 0 + +#elif MDK_CONF_MPU == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32F2xx +#elif MDK_CONF_MPU == 2 +#define WOLFSSL_STM32_CUBEMX +#define STM32F4xx +#elif MDK_CONF_MPU == 3 +#define WOLFSSL_STM32_CUBEMX +#define STM32F7xx +#endif + +// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <2=>SafeRTOS<3=>Windows +// <4=>PThread <5=>ThreadX<6=> ThreadX/NetX +// <7=>Micrium <8=>EBSnet<9=>MQX +// <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2 +// <13=>Frosted <14=>CMSIS RTOS<15=>Others +#define MDK_CONF_THREAD 14 +#if MDK_CONF_THREAD== 0 +#define SINGLE_THREADED +#elif MDK_CONF_THREAD == 1 +#define FREERTOS +#elif MDK_CONF_THREAD == 3 +#define WOLFSSL_SAFERTOS +#elif MDK_CONF_THREAD == 4 +#define USE_WINDOWS_API +#elif MDK_CONF_THREAD == 5 +#define WOLFSSL_PTHREADS +#elif MDK_CONF_THREAD == 6 +#define THREADX +#define NETX +#elif MDK_CONF_THREAD == 7 +#define MICRIUM +#elif MDK_CONF_THREAD == 8 +#define EBSNET +#elif MDK_CONF_THREAD == 9 +#define FREESCALE_MQX +#define FREESCALE_KSDK_MQX +#elif MDK_CONF_THREAD == 10 +#define WOLFSSL_TIRTOS +#elif MDK_CONF_THREAD == 11 +#define WOLFSSL_uITRON4 +#elif MDK_CONF_THREAD == 12 +#define WOLFSSL_uTKERNEL2 +#elif MDK_CONF_THREAD == 13 +#define WOLFSSL_FROSTED +#elif MDK_CONF_THREAD == 14 +#define WOLFSSL_CMSIS_RTOS +#elif MDK_CONF_THREAD == 15 +#define SINGLE_THREADED +#endif + + +// File System +#define MDK_CONF_FILESYSTEM 1 +#if MDK_CONF_FILESYSTEM == 0 +#define NO_FILESYSTEM +#else +#define WOLFSSL_KEIL_FS +#define NO_WOLFSSL_DIR +#endif +// + +// Network<0=>None <1=>RLnet <2=>User I/O +#define MDK_CONF_NETWORK 1 +#if MDK_CONF_NETWORK == 0 +#elif MDK_CONF_NETWORK == 1 +#define WOLFSSL_KEIL_TCP_NET +#elif MDK_CONF_NETWORK == 2 +#define WOLFSSL_USER_IO +#endif + +// Debug options + +// Debug Message +#define MDK_CONF_DebugMessage 0 +#if MDK_CONF_DebugMessage == 1 +#define DEBUG_WOLFSSL +#endif +// +// Check malloc +#define MDK_CONF_CheckMalloc 1 +#if MDK_CONF_CheckMalloc == 1 +#define WOLFSSL_MALLOC_CHECK +#define USE_WOLFSSL_MEMORY +#endif +// +// ErrNo.h +#define MDK_CONF_ErrNo 1 +#if MDK_CONF_ErrNo == 1 +#define HAVE_ERRNO +#endif +// +// Error Strings +#define MDK_CONF_ErrorStrings 1 +#if MDK_CONF_ErrorStrings == 0 +#define NO_ERROR_STRINGS +#endif +// + +// +// + +// wolfCrypt Configuration + +// Hash/Crypt Algrithm + +// MD2 +#define MDK_CONF_MD2 0 +#if MDK_CONF_MD2 == 1 +#define WOLFSSL_MD2 +#endif +// +// MD4 +#define MDK_CONF_MD4 0 +#if MDK_CONF_MD4 == 0 +#define NO_MD4 +#endif +// +// MD5 +#define MDK_CONF_MD5 1 +#if MDK_CONF_MD5 == 0 +#define NO_MD5 +#endif +// +// SHA +#define MDK_CONF_SHA 1 +#if MDK_CONF_SHA == 0 +#define NO_SHA +#endif +// +// SHA-256 +#define MDK_CONF_SHA256 1 +#if MDK_CONF_SHA256 == 0 +#define NO_SHA256 +#endif +// +// SHA-384 +#define MDK_CONF_SHA384 1 +#if MDK_CONF_SHA384 == 1 +#define WOLFSSL_SHA384 +#endif +// +// SHA-512 +#define MDK_CONF_SHA512 1 +#if MDK_CONF_SHA512 == 1 +#define WOLFSSL_SHA512 +#endif +// +// Hash DRBG +#define MDK_CONF_HASHDRBG 1 +#if MDK_CONF_HASHDRBG == 1 +#define HAVE_HASHDRBG +#endif +// +// RIPEMD +#define MDK_CONF_RIPEMD 1 +#if MDK_CONF_RIPEMD == 1 +#define WOLFSSL_RIPEMD +#endif +// +// BLAKE2 +#define MDK_CONF_BLAKE2 0 +#if MDK_CONF_BLAKE2 == 1 +#define HAVE_BLAKE2 +#endif +// +// HMAC +#define MDK_CONF_HMAC 1 +#if MDK_CONF_HMAC == 0 +#define NO_HMAC +#endif +// +// HMAC KDF +#define MDK_CONF_HKDF 1 +#if MDK_CONF_HKDF == 1 +#define HAVE_HKDF +#endif +// + +// AES CCM +#define MDK_CONF_AESCCM 1 +#if MDK_CONF_AESCCM == 1 +#define HAVE_AESCCM +#endif +// +// AES GCM +#define MDK_CONF_AESGCM 1 +#if MDK_CONF_AESGCM == 1 +#define HAVE_AESGCM +#endif +// + +// RC4 +#define MDK_CONF_RC4 0 +#if MDK_CONF_RC4 == 0 +#define NO_RC4 +#endif +// + +// HC128 +#define MDK_CONF_HC128 1 +#if MDK_CONF_AESGCM == 0 +#define NO_HC128 +#endif +// + +// RABBIT +#define MDK_CONF_RABBIT 1 +#if MDK_CONF_RABBIT == 0 +#define NO_RABBIT +#endif +// + +// CHACHA +#define MDK_CONF_CHACHA 1 +#if MDK_CONF_CHACHA == 1 +#define HAVE_CHACHA +#endif +// + +// POLY1305 +#define MDK_CONF_POLY1305 1 +#if MDK_CONF_POLY1305 == 1 +#define HAVE_POLY1305 +#define HAVE_ONE_TIME_AUTH +#endif +// + +// DES3 +#define MDK_CONF_DES3 1 +#if MDK_CONF_DES3 == 0 +#define NO_DES3 +#endif +// + +// AES +#define MDK_CONF_AES 1 +#if MDK_CONF_AES == 0 +#define NO_AES +#endif +// + +// CAMELLIA +#define MDK_CONF_CAMELLIA 1 +#if MDK_CONF_CAMELLIA == 1 +#define HAVE_CAMELLIA +#endif +// + +// DH +#define MDK_CONF_DH 1 +#if MDK_CONF_DH == 0 +#define NO_DH +#endif +// +// DSA +#define MDK_CONF_DSA 1 +#if MDK_CONF_DSA == 0 +#define NO_DSA +#endif +// + +// SRP +#define MDK_CONF_SRP 1 +#if MDK_CONF_SRP == 1 +#define HAVE_SRP +#endif +// + +// PWDBASED +#define MDK_CONF_PWDBASED 1 +#if MDK_CONF_PWDBASED == 0 +#define NO_PWDBASED +#endif +// + +// ECC +#define MDK_CONF_ECC 1 +#if MDK_CONF_ECC == 1 +#define HAVE_ECC +#endif +// + +// CURVE25519 +#define MDK_CONF_CURVE25519 1 +#if MDK_CONF_CURVE25519 == 1 +#define HAVE_CURVE25519 +#define CURVED25519_SMALL +#endif +// +// CURVE25519 SMALL +#define MDK_CONF_CURVE25519_SMALL 0 +#if MDK_CONF_CURVE25519_SMALL == 1 +#define CURVED25519_SMALL +#endif +// +// ED25519 +#define MDK_CONF_ED25519 1 +#if MDK_CONF_ED25519 == 1 +#define HAVE_ED25519 +#endif +// +// ED25519 SMALL +#define MDK_CONF_ED25519_SMALL 0 +#if MDK_CONF_ED25519_SMALL == 1 +#define ED25519_SMALL +#endif +// +// PKCS7 +#define MDK_CONF_PKCS7 0 +#if MDK_CONF_PKCS7 == 1 +#define HAVE_PKCS7 +#endif +// + +// NTRU (need License, "crypto_ntru.h") +#define MDK_CONF_NTRU 0 +#if MDK_CONF_NTRU == 1 +#define HAVE_NTRU +#endif +// +// + +// Random Seed, for TEST Only +#define MDK_CONF_RNDSEED 1 +#if MDK_CONF_RNDSEED == 1 +#define WOLFSSL_GENSEED_FORTEST +#endif +// + +// Hardware Crypt (See document for usage) +// Hardware RNG +#define MDK_CONF_STM32F2_RNG 0 +#if MDK_CONF_STM32F2_RNG == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_RNG +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Crypt +#define MDK_CONF_STM32F2_CRYPTO 0 +#if MDK_CONF_STM32F2_CRYPTO == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_CRYPTO +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Hash +#define MDK_CONF_STM32F2_HASH 0 +#if MDK_CONF_STM32F2_HASH == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_HASH +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// + +// Cert/Key Strage +// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes) +#define MDK_CONF_CERT_BUFF 0 +#if MDK_CONF_CERT_BUFF== 1 +#define USE_CERT_BUFFERS_1024 +#elif MDK_CONF_CERT_BUFF == 2 +#define USE_CERT_BUFFERS_2048 +#endif +// +// Cert/Key Generation +// CertGen +#define MDK_CONF_CERT_GEN 0 +#if MDK_CONF_CERT_GEN == 1 +#define WOLFSSL_CERT_GEN +#endif +// +// KeyGen +#define MDK_CONF_KEY_GEN 0 +#if MDK_CONF_KEY_GEN == 1 +#define WOLFSSL_KEY_GEN +#endif +// +// +// Use Fast Math +#define MDK_CONF_FASTMATH 1 +#if MDK_CONF_FASTMATH == 1 +#define USE_FAST_MATH +#define TFM_TIMING_RESISTANT +#endif +// +// Small Stack +#define MDK_CONF_SmallStack 1 +#if MDK_CONF_SmallStack == 0 +#define NO_WOLFSSL_SMALL_STACK +#endif +// + +// + + +/**** wolfSSL Configuration ****/ + +// wolfSSL Configuration + +// TLS 1.3 +#define MDK_CONF_TLS 1 +#if MDK_CONF_TLS == 1 +#define WOLFSSL_TLS13 +#define HAVE_TLS_EXTENSIONS +#define HAVE_SUPPORTED_CURVES +#define WC_RSA_PSS +#define HAVE_HKDF +#define HAVE_FFDHE_2048 +#endif +// + +// Include Old TLS +#define MDK_CONF_NO_OLDTLS 0 +#if MDK_CONF_NO_OLDTLS == 0 +#define NO_OLD_TLS +#endif +// +// CRL +#define MDK_CONF_CRL 0 +#if MDK_CONF_CRL == 1 +#define HAVE_CRL +#define WOLFSSL_DER_LOAD +#endif +// +// OCSP +#define MDK_CONF_OCSP 0 +#if MDK_CONF_OCSP == 1 +#define HAVE_OCSP +#endif +// +// OpenSSL Extra +#define MDK_CONF_OPENSSL_EXTRA 0 +#if MDK_CONF_OPENSSL_EXTRA == 1 +#define OPENSSL_EXTRA +#endif +// + +// + diff --git a/IDE/MDK5-ARM/Projects/EchoServer/Abstract.txt b/IDE/MDK5-ARM/Projects/EchoServer/Abstract.txt index f759f31b8..47ed1d9a3 100644 --- a/IDE/MDK5-ARM/Projects/EchoServer/Abstract.txt +++ b/IDE/MDK5-ARM/Projects/EchoServer/Abstract.txt @@ -1,6 +1,9 @@ wolfSSL example: echo Server Use Configuration Wizard tab + +RTE_Device.h: Check SDMMC1 (SD/SDIO/MMC card host interface 1) +RTE_Device.h: Check ETH (Ethernet Interface) main.c for server port or TLS version user_settings.h for wolfCrypt or wolfSSL options diff --git a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx index c2b337527..0650169d9 100644 --- a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx +++ b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx @@ -10,13 +10,13 @@ echoServer 0x4 ARM-ADS - 5060422::V5.06 update 4 (build 422)::ARMCC + 5060528::V5.06 update 5 (build 528)::ARMCC 0 STM32F756NGHx STMicroelectronics - Keil.STM32F7xx_DFP.2.9.0 + Keil.STM32F7xx_DFP.2.11.0 http://www.keil.com/pack IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE @@ -763,7 +763,7 @@ - + RTE\CMSIS\RTX_Conf_CM.c @@ -771,50 +771,50 @@ - + RTE\Device\STM32F756NGHx\RTE_Device.h - - + + - + RTE\Device\STM32F756NGHx\startup_stm32f756xx.s - - + + - + RTE\Device\STM32F756NGHx\stm32f7xx_hal_conf.h - - + + - + RTE\Device\STM32F756NGHx\system_stm32f7xx.c - - + + RTE\File_System\FS_Config.c - - + + RTE\File_System\FS_Config_MC_0.h - - + + @@ -822,7 +822,7 @@ RTE\Network\Net_Config.c - + @@ -830,15 +830,15 @@ RTE\Network\Net_Config_BSD.h - + - + RTE\Network\Net_Config_DNS_Client.h - + @@ -852,7 +852,7 @@ RTE\Network\Net_Config_ETH_0.h - + @@ -860,7 +860,7 @@ RTE\Network\Net_Config_TCP.h - + @@ -868,7 +868,7 @@ RTE\Network\Net_Config_UDP.h - + @@ -887,8 +887,8 @@ RTE\wolfSSL\user_settings.h - - + + diff --git a/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h new file mode 100644 index 000000000..4c99c520b --- /dev/null +++ b/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h @@ -0,0 +1,519 @@ +/* user_settings.h + * + * Copyright (C) 2006-2017 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 NO_MAIN_DRIVER +#define BENCH_EMBEDDED +#define NO_DEV_RANDOM +#define WOLFSSL_USER_CURRTIME +#define SIZEOF_LONG_LONG 8 +#define NO_WRITEV +#define NO_DEV_RANDOM + +#define TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT +#define WC_RSA_BLINDING + +#define WOLFSSL_USER_CURRTIME /* for benchmark */ +#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */ +#define WOLFSSL_GMTIME +#define NO_MULTIBYTE_PRINT + +// <<< Use Configuration Wizard in Context Menu >>> + + +// Common options +// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx +#define MDK_CONF_MPU 3 +#if MDK_CONF_MPU == 0 + +#elif MDK_CONF_MPU == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32F2xx +#elif MDK_CONF_MPU == 2 +#define WOLFSSL_STM32_CUBEMX +#define STM32F4xx +#elif MDK_CONF_MPU == 3 +#define WOLFSSL_STM32_CUBEMX +#define STM32F7xx +#endif + +// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <2=>SafeRTOS<3=>Windows +// <4=>PThread <5=>ThreadX<6=> ThreadX/NetX +// <7=>Micrium <8=>EBSnet<9=>MQX +// <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2 +// <13=>Frosted <14=>CMSIS RTOS<15=>CMSIS RTOSv2<16=>Others +#define MDK_CONF_THREAD 14 +#if MDK_CONF_THREAD== 0 +#define SINGLE_THREADED +#elif MDK_CONF_THREAD == 1 +#define FREERTOS +#elif MDK_CONF_THREAD == 3 +#define WOLFSSL_SAFERTOS +#elif MDK_CONF_THREAD == 4 +#define USE_WINDOWS_API +#elif MDK_CONF_THREAD == 5 +#define WOLFSSL_PTHREADS +#elif MDK_CONF_THREAD == 6 +#define THREADX +#define NETX +#elif MDK_CONF_THREAD == 7 +#define MICRIUM +#elif MDK_CONF_THREAD == 8 +#define EBSNET +#elif MDK_CONF_THREAD == 9 +#define FREESCALE_MQX +#define FREESCALE_KSDK_MQX +#elif MDK_CONF_THREAD == 10 +#define WOLFSSL_TIRTOS +#elif MDK_CONF_THREAD == 11 +#define WOLFSSL_uITRON4 +#elif MDK_CONF_THREAD == 12 +#define WOLFSSL_uTKERNEL2 +#elif MDK_CONF_THREAD == 13 +#define WOLFSSL_FROSTED +#elif MDK_CONF_THREAD == 14 +#define WOLFSSL_CMSIS_RTOS +#elif MDK_CONF_THREAD == 15 +#define WOLFSSL_CMSIS_RTOSv2 +#elif MDK_CONF_THREAD == 16 +#define SINGLE_THREADED +#endif + + +// File System +#define MDK_CONF_FILESYSTEM 1 +#if MDK_CONF_FILESYSTEM == 0 +#define NO_FILESYSTEM +#else +#define WOLFSSL_KEIL_FS +#define NO_WOLFSSL_DIR +#endif +// + +// Network<0=>None <1=>RLnet <2=>User I/O +#define MDK_CONF_NETWORK 1 +#if MDK_CONF_NETWORK == 0 +#elif MDK_CONF_NETWORK == 1 +#define WOLFSSL_KEIL_TCP_NET +#elif MDK_CONF_NETWORK == 2 +#define WOLFSSL_USER_IO +#endif + +// Debug options + +// Debug Message +#define MDK_CONF_DebugMessage 0 +#if MDK_CONF_DebugMessage == 1 +#define DEBUG_WOLFSSL +#endif +// +// Check malloc +#define MDK_CONF_CheckMalloc 1 +#if MDK_CONF_CheckMalloc == 1 +#define WOLFSSL_MALLOC_CHECK +#define USE_WOLFSSL_MEMORY +#endif +// +// ErrNo.h +#define MDK_CONF_ErrNo 1 +#if MDK_CONF_ErrNo == 1 +#define HAVE_ERRNO +#endif +// +// Error Strings +#define MDK_CONF_ErrorStrings 1 +#if MDK_CONF_ErrorStrings == 0 +#define NO_ERROR_STRINGS +#endif +// + +// +// + +// wolfCrypt Configuration + +// Hash/Crypt Algrithm + +// MD2 +#define MDK_CONF_MD2 0 +#if MDK_CONF_MD2 == 1 +#define WOLFSSL_MD2 +#endif +// +// MD4 +#define MDK_CONF_MD4 0 +#if MDK_CONF_MD4 == 0 +#define NO_MD4 +#endif +// +// MD5 +#define MDK_CONF_MD5 1 +#if MDK_CONF_MD5 == 0 +#define NO_MD5 +#endif +// +// SHA +#define MDK_CONF_SHA 1 +#if MDK_CONF_SHA == 0 +#define NO_SHA +#endif +// +// SHA-256 +#define MDK_CONF_SHA256 1 +#if MDK_CONF_SHA256 == 0 +#define NO_SHA256 +#endif +// +// SHA-384 +#define MDK_CONF_SHA384 1 +#if MDK_CONF_SHA384 == 1 +#define WOLFSSL_SHA384 +#endif +// +// SHA-512 +#define MDK_CONF_SHA512 1 +#if MDK_CONF_SHA512 == 1 +#define WOLFSSL_SHA512 +#endif +// +// Hash DRBG +#define MDK_CONF_HASHDRBG 1 +#if MDK_CONF_HASHDRBG == 1 +#define HAVE_HASHDRBG +#endif +// +// RIPEMD +#define MDK_CONF_RIPEMD 1 +#if MDK_CONF_RIPEMD == 1 +#define WOLFSSL_RIPEMD +#endif +// +// BLAKE2 +#define MDK_CONF_BLAKE2 0 +#if MDK_CONF_BLAKE2 == 1 +#define HAVE_BLAKE2 +#endif +// +// HMAC +#define MDK_CONF_HMAC 1 +#if MDK_CONF_HMAC == 0 +#define NO_HMAC +#endif +// +// HMAC KDF +#define MDK_CONF_HKDF 1 +#if MDK_CONF_HKDF == 1 +#define HAVE_HKDF +#endif +// + +// AES CCM +#define MDK_CONF_AESCCM 1 +#if MDK_CONF_AESCCM == 1 +#define HAVE_AESCCM +#endif +// +// AES GCM +#define MDK_CONF_AESGCM 1 +#if MDK_CONF_AESGCM == 1 +#define HAVE_AESGCM +#endif +// + +// RC4 +#define MDK_CONF_RC4 0 +#if MDK_CONF_RC4 == 0 +#define NO_RC4 +#endif +// + +// HC128 +#define MDK_CONF_HC128 1 +#if MDK_CONF_AESGCM == 0 +#define NO_HC128 +#endif +// + +// RABBIT +#define MDK_CONF_RABBIT 1 +#if MDK_CONF_RABBIT == 0 +#define NO_RABBIT +#endif +// + +// CHACHA +#define MDK_CONF_CHACHA 1 +#if MDK_CONF_CHACHA == 1 +#define HAVE_CHACHA +#endif +// + +// POLY1305 +#define MDK_CONF_POLY1305 1 +#if MDK_CONF_POLY1305 == 1 +#define HAVE_POLY1305 +#define HAVE_ONE_TIME_AUTH +#endif +// + +// DES3 +#define MDK_CONF_DES3 1 +#if MDK_CONF_DES3 == 0 +#define NO_DES3 +#endif +// + +// AES +#define MDK_CONF_AES 1 +#if MDK_CONF_AES == 0 +#define NO_AES +#endif +// + +// CAMELLIA +#define MDK_CONF_CAMELLIA 1 +#if MDK_CONF_CAMELLIA == 1 +#define HAVE_CAMELLIA +#endif +// + +// DH +#define MDK_CONF_DH 1 +#if MDK_CONF_DH == 0 +#define NO_DH +#endif +// +// DSA +#define MDK_CONF_DSA 1 +#if MDK_CONF_DSA == 0 +#define NO_DSA +#endif +// + +// SRP +#define MDK_CONF_SRP 1 +#if MDK_CONF_SRP == 1 +#define HAVE_SRP +#endif +// + +// PWDBASED +#define MDK_CONF_PWDBASED 1 +#if MDK_CONF_PWDBASED == 0 +#define NO_PWDBASED +#endif +// + +// ECC +#define MDK_CONF_ECC 1 +#if MDK_CONF_ECC == 1 +#define HAVE_ECC +#endif +// + +// CURVE25519 +#define MDK_CONF_CURVE25519 1 +#if MDK_CONF_CURVE25519 == 1 +#define HAVE_CURVE25519 +#define CURVED25519_SMALL +#endif +// +// CURVE25519 SMALL +#define MDK_CONF_CURVE25519_SMALL 0 +#if MDK_CONF_CURVE25519_SMALL == 1 +#define CURVED25519_SMALL +#endif +// +// ED25519 +#define MDK_CONF_ED25519 1 +#if MDK_CONF_ED25519 == 1 +#define HAVE_ED25519 +#endif +// +// ED25519 SMALL +#define MDK_CONF_ED25519_SMALL 0 +#if MDK_CONF_ED25519_SMALL == 1 +#define ED25519_SMALL +#endif +// +// PKCS7 +#define MDK_CONF_PKCS7 0 +#if MDK_CONF_PKCS7 == 1 +#define HAVE_PKCS7 +#endif +// + +// NTRU (need License, "crypto_ntru.h") +#define MDK_CONF_NTRU 0 +#if MDK_CONF_NTRU == 1 +#define HAVE_NTRU +#endif +// +// + +// Random Seed, for TEST Only +#define MDK_CONF_RNDSEED 1 +#if MDK_CONF_RNDSEED == 1 +#define WOLFSSL_GENSEED_FORTEST +#endif +// + +// Hardware Crypt (See document for usage) +// Hardware RNG +#define MDK_CONF_STM32F2_RNG 0 +#if MDK_CONF_STM32F2_RNG == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_RNG +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Crypt +#define MDK_CONF_STM32F2_CRYPTO 0 +#if MDK_CONF_STM32F2_CRYPTO == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_CRYPTO +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Hash +#define MDK_CONF_STM32F2_HASH 0 +#if MDK_CONF_STM32F2_HASH == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_HASH +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// + +// Cert/Key Strage +// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes) +#define MDK_CONF_CERT_BUFF 0 +#if MDK_CONF_CERT_BUFF== 1 +#define USE_CERT_BUFFERS_1024 +#elif MDK_CONF_CERT_BUFF == 2 +#define USE_CERT_BUFFERS_2048 +#endif +// +// Cert/Key Generation +// CertGen +#define MDK_CONF_CERT_GEN 0 +#if MDK_CONF_CERT_GEN == 1 +#define WOLFSSL_CERT_GEN +#endif +// +// KeyGen +#define MDK_CONF_KEY_GEN 0 +#if MDK_CONF_KEY_GEN == 1 +#define WOLFSSL_KEY_GEN +#endif +// +// +// Use Fast Math +#define MDK_CONF_FASTMATH 1 +#if MDK_CONF_FASTMATH == 1 +#define USE_FAST_MATH +#define TFM_TIMING_RESISTANT +#endif +// +// Small Stack +#define MDK_CONF_SmallStack 1 +#if MDK_CONF_SmallStack == 0 +#define NO_WOLFSSL_SMALL_STACK +#endif +// + +// + + +/**** wolfSSL Configuration ****/ + +// wolfSSL Configuration + +// TLS 1.3 +#define MDK_CONF_TLS 1 +#if MDK_CONF_TLS == 1 +#define WOLFSSL_TLS13 +#define HAVE_TLS_EXTENSIONS +#define HAVE_SUPPORTED_CURVES +#define WC_RSA_PSS +#define HAVE_HKDF +#define HAVE_FFDHE_2048 +#endif +// + +// Include Old TLS +#define MDK_CONF_NO_OLDTLS 0 +#if MDK_CONF_NO_OLDTLS == 0 +#define NO_OLD_TLS +#endif +// +// CRL +#define MDK_CONF_CRL 0 +#if MDK_CONF_CRL == 1 +#define HAVE_CRL +#define WOLFSSL_DER_LOAD +#endif +// +// OCSP +#define MDK_CONF_OCSP 0 +#if MDK_CONF_OCSP == 1 +#define HAVE_OCSP +#endif +// +// OpenSSL Extra +#define MDK_CONF_OPENSSL_EXTRA 0 +#if MDK_CONF_OPENSSL_EXTRA == 1 +#define OPENSSL_EXTRA +#endif +// + +// + diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/Abstract.txt b/IDE/MDK5-ARM/Projects/SimpleClient/Abstract.txt index 878057e9b..7392dbf53 100644 --- a/IDE/MDK5-ARM/Projects/SimpleClient/Abstract.txt +++ b/IDE/MDK5-ARM/Projects/SimpleClient/Abstract.txt @@ -1,6 +1,9 @@ wolfSSL example: TLS Client Use Configuration Wizard tab + +RTE_Device.h: Check SDMMC1 (SD/SDIO/MMC card host interface 1) +RTE_Device.h: Check ETH (Ethernet Interface) main.c for remote IP address, port or TLS version user_settings.h for wolfCrypt or wolfSSL options diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h new file mode 100644 index 000000000..943a46a07 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h @@ -0,0 +1,519 @@ +/* user_settings.h + * + * Copyright (C) 2006-2017 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 NO_MAIN_DRIVER +#define BENCH_EMBEDDED +#define NO_DEV_RANDOM +#define WOLFSSL_USER_CURRTIME +#define SIZEOF_LONG_LONG 8 +#define NO_WRITEV +#define NO_DEV_RANDOM + +#define TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT +#define WC_RSA_BLINDING + +#define WOLFSSL_USER_CURRTIME /* for benchmark */ +#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */ +#define WOLFSSL_GMTIME +#define NO_MULTIBYTE_PRINT + +// <<< Use Configuration Wizard in Context Menu >>> + + +// Common options +// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx +#define MDK_CONF_MPU 3 +#if MDK_CONF_MPU == 0 + +#elif MDK_CONF_MPU == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32F2xx +#elif MDK_CONF_MPU == 2 +#define WOLFSSL_STM32_CUBEMX +#define STM32F4xx +#elif MDK_CONF_MPU == 3 +#define WOLFSSL_STM32_CUBEMX +#define STM32F7xx +#endif + +// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <2=>SafeRTOS<3=>Windows +// <4=>PThread <5=>ThreadX<6=> ThreadX/NetX +// <7=>Micrium <8=>EBSnet<9=>MQX +// <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2 +// <13=>Frosted <14=>CMSIS RTOS<15=>CMSIS RTOSv2<16=>Others +#define MDK_CONF_THREAD 15 +#if MDK_CONF_THREAD== 0 +#define SINGLE_THREADED +#elif MDK_CONF_THREAD == 1 +#define FREERTOS +#elif MDK_CONF_THREAD == 3 +#define WOLFSSL_SAFERTOS +#elif MDK_CONF_THREAD == 4 +#define USE_WINDOWS_API +#elif MDK_CONF_THREAD == 5 +#define WOLFSSL_PTHREADS +#elif MDK_CONF_THREAD == 6 +#define THREADX +#define NETX +#elif MDK_CONF_THREAD == 7 +#define MICRIUM +#elif MDK_CONF_THREAD == 8 +#define EBSNET +#elif MDK_CONF_THREAD == 9 +#define FREESCALE_MQX +#define FREESCALE_KSDK_MQX +#elif MDK_CONF_THREAD == 10 +#define WOLFSSL_TIRTOS +#elif MDK_CONF_THREAD == 11 +#define WOLFSSL_uITRON4 +#elif MDK_CONF_THREAD == 12 +#define WOLFSSL_uTKERNEL2 +#elif MDK_CONF_THREAD == 13 +#define WOLFSSL_FROSTED +#elif MDK_CONF_THREAD == 14 +#define WOLFSSL_CMSIS_RTOS +#elif MDK_CONF_THREAD == 15 +#define WOLFSSL_CMSIS_RTOSv2 +#elif MDK_CONF_THREAD == 16 +#define SINGLE_THREADED +#endif + + +// File System +#define MDK_CONF_FILESYSTEM 1 +#if MDK_CONF_FILESYSTEM == 0 +#define NO_FILESYSTEM +#else +#define WOLFSSL_KEIL_FS +#define NO_WOLFSSL_DIR +#endif +// + +// Network<0=>None <1=>RLnet <2=>User I/O +#define MDK_CONF_NETWORK 1 +#if MDK_CONF_NETWORK == 0 +#elif MDK_CONF_NETWORK == 1 +#define WOLFSSL_KEIL_TCP_NET +#elif MDK_CONF_NETWORK == 2 +#define WOLFSSL_USER_IO +#endif + +// Debug options + +// Debug Message +#define MDK_CONF_DebugMessage 0 +#if MDK_CONF_DebugMessage == 1 +#define DEBUG_WOLFSSL +#endif +// +// Check malloc +#define MDK_CONF_CheckMalloc 1 +#if MDK_CONF_CheckMalloc == 1 +#define WOLFSSL_MALLOC_CHECK +#define USE_WOLFSSL_MEMORY +#endif +// +// ErrNo.h +#define MDK_CONF_ErrNo 1 +#if MDK_CONF_ErrNo == 1 +#define HAVE_ERRNO +#endif +// +// Error Strings +#define MDK_CONF_ErrorStrings 1 +#if MDK_CONF_ErrorStrings == 0 +#define NO_ERROR_STRINGS +#endif +// + +// +// + +// wolfCrypt Configuration + +// Hash/Crypt Algrithm + +// MD2 +#define MDK_CONF_MD2 0 +#if MDK_CONF_MD2 == 1 +#define WOLFSSL_MD2 +#endif +// +// MD4 +#define MDK_CONF_MD4 0 +#if MDK_CONF_MD4 == 0 +#define NO_MD4 +#endif +// +// MD5 +#define MDK_CONF_MD5 1 +#if MDK_CONF_MD5 == 0 +#define NO_MD5 +#endif +// +// SHA +#define MDK_CONF_SHA 1 +#if MDK_CONF_SHA == 0 +#define NO_SHA +#endif +// +// SHA-256 +#define MDK_CONF_SHA256 1 +#if MDK_CONF_SHA256 == 0 +#define NO_SHA256 +#endif +// +// SHA-384 +#define MDK_CONF_SHA384 1 +#if MDK_CONF_SHA384 == 1 +#define WOLFSSL_SHA384 +#endif +// +// SHA-512 +#define MDK_CONF_SHA512 1 +#if MDK_CONF_SHA512 == 1 +#define WOLFSSL_SHA512 +#endif +// +// Hash DRBG +#define MDK_CONF_HASHDRBG 1 +#if MDK_CONF_HASHDRBG == 1 +#define HAVE_HASHDRBG +#endif +// +// RIPEMD +#define MDK_CONF_RIPEMD 1 +#if MDK_CONF_RIPEMD == 1 +#define WOLFSSL_RIPEMD +#endif +// +// BLAKE2 +#define MDK_CONF_BLAKE2 0 +#if MDK_CONF_BLAKE2 == 1 +#define HAVE_BLAKE2 +#endif +// +// HMAC +#define MDK_CONF_HMAC 1 +#if MDK_CONF_HMAC == 0 +#define NO_HMAC +#endif +// +// HMAC KDF +#define MDK_CONF_HKDF 1 +#if MDK_CONF_HKDF == 1 +#define HAVE_HKDF +#endif +// + +// AES CCM +#define MDK_CONF_AESCCM 1 +#if MDK_CONF_AESCCM == 1 +#define HAVE_AESCCM +#endif +// +// AES GCM +#define MDK_CONF_AESGCM 1 +#if MDK_CONF_AESGCM == 1 +#define HAVE_AESGCM +#endif +// + +// RC4 +#define MDK_CONF_RC4 0 +#if MDK_CONF_RC4 == 0 +#define NO_RC4 +#endif +// + +// HC128 +#define MDK_CONF_HC128 1 +#if MDK_CONF_AESGCM == 0 +#define NO_HC128 +#endif +// + +// RABBIT +#define MDK_CONF_RABBIT 1 +#if MDK_CONF_RABBIT == 0 +#define NO_RABBIT +#endif +// + +// CHACHA +#define MDK_CONF_CHACHA 1 +#if MDK_CONF_CHACHA == 1 +#define HAVE_CHACHA +#endif +// + +// POLY1305 +#define MDK_CONF_POLY1305 1 +#if MDK_CONF_POLY1305 == 1 +#define HAVE_POLY1305 +#define HAVE_ONE_TIME_AUTH +#endif +// + +// DES3 +#define MDK_CONF_DES3 1 +#if MDK_CONF_DES3 == 0 +#define NO_DES3 +#endif +// + +// AES +#define MDK_CONF_AES 1 +#if MDK_CONF_AES == 0 +#define NO_AES +#endif +// + +// CAMELLIA +#define MDK_CONF_CAMELLIA 1 +#if MDK_CONF_CAMELLIA == 1 +#define HAVE_CAMELLIA +#endif +// + +// DH +#define MDK_CONF_DH 1 +#if MDK_CONF_DH == 0 +#define NO_DH +#endif +// +// DSA +#define MDK_CONF_DSA 1 +#if MDK_CONF_DSA == 0 +#define NO_DSA +#endif +// + +// SRP +#define MDK_CONF_SRP 1 +#if MDK_CONF_SRP == 1 +#define HAVE_SRP +#endif +// + +// PWDBASED +#define MDK_CONF_PWDBASED 1 +#if MDK_CONF_PWDBASED == 0 +#define NO_PWDBASED +#endif +// + +// ECC +#define MDK_CONF_ECC 1 +#if MDK_CONF_ECC == 1 +#define HAVE_ECC +#endif +// + +// CURVE25519 +#define MDK_CONF_CURVE25519 1 +#if MDK_CONF_CURVE25519 == 1 +#define HAVE_CURVE25519 +#define CURVED25519_SMALL +#endif +// +// CURVE25519 SMALL +#define MDK_CONF_CURVE25519_SMALL 0 +#if MDK_CONF_CURVE25519_SMALL == 1 +#define CURVED25519_SMALL +#endif +// +// ED25519 +#define MDK_CONF_ED25519 1 +#if MDK_CONF_ED25519 == 1 +#define HAVE_ED25519 +#endif +// +// ED25519 SMALL +#define MDK_CONF_ED25519_SMALL 0 +#if MDK_CONF_ED25519_SMALL == 1 +#define ED25519_SMALL +#endif +// +// PKCS7 +#define MDK_CONF_PKCS7 0 +#if MDK_CONF_PKCS7 == 1 +#define HAVE_PKCS7 +#endif +// + +// NTRU (need License, "crypto_ntru.h") +#define MDK_CONF_NTRU 0 +#if MDK_CONF_NTRU == 1 +#define HAVE_NTRU +#endif +// +// + +// Random Seed, for TEST Only +#define MDK_CONF_RNDSEED 1 +#if MDK_CONF_RNDSEED == 1 +#define WOLFSSL_GENSEED_FORTEST +#endif +// + +// Hardware Crypt (See document for usage) +// Hardware RNG +#define MDK_CONF_STM32F2_RNG 0 +#if MDK_CONF_STM32F2_RNG == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_RNG +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Crypt +#define MDK_CONF_STM32F2_CRYPTO 0 +#if MDK_CONF_STM32F2_CRYPTO == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_CRYPTO +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Hash +#define MDK_CONF_STM32F2_HASH 0 +#if MDK_CONF_STM32F2_HASH == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_HASH +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// + +// Cert/Key Strage +// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes) +#define MDK_CONF_CERT_BUFF 0 +#if MDK_CONF_CERT_BUFF== 1 +#define USE_CERT_BUFFERS_1024 +#elif MDK_CONF_CERT_BUFF == 2 +#define USE_CERT_BUFFERS_2048 +#endif +// +// Cert/Key Generation +// CertGen +#define MDK_CONF_CERT_GEN 0 +#if MDK_CONF_CERT_GEN == 1 +#define WOLFSSL_CERT_GEN +#endif +// +// KeyGen +#define MDK_CONF_KEY_GEN 0 +#if MDK_CONF_KEY_GEN == 1 +#define WOLFSSL_KEY_GEN +#endif +// +// +// Use Fast Math +#define MDK_CONF_FASTMATH 1 +#if MDK_CONF_FASTMATH == 1 +#define USE_FAST_MATH +#define TFM_TIMING_RESISTANT +#endif +// +// Small Stack +#define MDK_CONF_SmallStack 1 +#if MDK_CONF_SmallStack == 0 +#define NO_WOLFSSL_SMALL_STACK +#endif +// + +// + + +/**** wolfSSL Configuration ****/ + +// wolfSSL Configuration + +// TLS 1.3 +#define MDK_CONF_TLS 1 +#if MDK_CONF_TLS == 1 +#define WOLFSSL_TLS13 +#define HAVE_TLS_EXTENSIONS +#define HAVE_SUPPORTED_CURVES +#define WC_RSA_PSS +#define HAVE_HKDF +#define HAVE_FFDHE_2048 +#endif +// + +// Include Old TLS +#define MDK_CONF_NO_OLDTLS 0 +#if MDK_CONF_NO_OLDTLS == 0 +#define NO_OLD_TLS +#endif +// +// CRL +#define MDK_CONF_CRL 0 +#if MDK_CONF_CRL == 1 +#define HAVE_CRL +#define WOLFSSL_DER_LOAD +#endif +// +// OCSP +#define MDK_CONF_OCSP 0 +#if MDK_CONF_OCSP == 1 +#define HAVE_OCSP +#endif +// +// OpenSSL Extra +#define MDK_CONF_OPENSSL_EXTRA 0 +#if MDK_CONF_OPENSSL_EXTRA == 1 +#define OPENSSL_EXTRA +#endif +// + +// + diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx index 1e0d06b85..38fdb5408 100644 --- a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx +++ b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx @@ -101,7 +101,7 @@ 0 0 1 - 5 + 1 @@ -112,9 +112,14 @@ - STLink\ST-LINKIII-KEIL_SWO.dll + BIN\ULP2CM3.DLL + + 0 + ULP2CM3 + -UP1135060 -O207 -S10 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO19 -TC216000000 -TP11 -TDX0 -TDD0 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) + 0 ST-LINKIII-KEIL_SWO @@ -138,7 +143,7 @@ 0 DLGUARM - (105=-1,-1,-1,-1,0) + 0 @@ -146,56 +151,7 @@ -UV0998FBE -O207 -S10 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO18 -TC216000000 -TP21 -TDS80B8 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) - - - 0 - 0 - 185 - 1 -
134219474
- 0 - 0 - 0 - 0 - 0 - 1 - .\main.c - - \\SimpleClient\main.c\185 -
- - 1 - 0 - 181 - 1 -
134219494
- 0 - 0 - 0 - 0 - 0 - 1 - .\main.c - - \\SimpleClient\main.c\181 -
- - 2 - 0 - 306 - 1 -
0
- 0 - 0 - 0 - 0 - 0 - 0 - .\main.c - - -
-
+ 0 @@ -204,8 +160,18 @@ - C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.4.1\FileSystem\FileSystem.scvd - Keil.MDK-Middleware.7.4.1 + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.7.0\FileSystem\FileSystem.scvd + Keil.MDK-Middleware.7.7.0 + 1 + + + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.7.0\Network\Network.scvd + Keil.MDK-Middleware.7.7.0 + 1 + + + C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.3.0\CMSIS\RTOS2\RTX\RTX5.scvd + ARM.CMSIS.5.3.0 1 @@ -246,6 +212,10 @@ + + + + 1 0 @@ -337,7 +307,7 @@ ::Board Support - 0 + 1 0 0 1 @@ -353,7 +323,7 @@ ::CMSIS Driver - 0 + 1 0 0 1 @@ -377,7 +347,7 @@ ::File System - 1 + 0 0 0 1 @@ -385,7 +355,7 @@ ::Network - 0 + 1 0 0 1 diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvprojx b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvprojx index 4476a45e1..913abe82b 100644 --- a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvprojx +++ b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvprojx @@ -16,7 +16,7 @@ STM32F756NGHx STMicroelectronics - Keil.STM32F7xx_DFP.2.9.0 + Keil.STM32F7xx_DFP.2.11.0 http://www.keil.com/pack IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE @@ -176,7 +176,7 @@ 0 "Cortex-M7" - 1 + 0 0 0 1 @@ -489,6 +489,12 @@
+ + + + + + @@ -515,8 +521,14 @@ - - + + + + + + + + @@ -551,50 +563,50 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -629,244 +641,264 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - RTE\CMSIS\RTX_Conf_CM.c + + RTE\CMSIS\RTX_Conf_CM.c + + + + RTE\CMSIS\RTX_Config.c + + - + + RTE\CMSIS\RTX_Config.h + + + + + + + RTE\Device\STM32F756NGHx\RTE_Device.h - - + + - + RTE\Device\STM32F756NGHx\startup_stm32f756xx.s - - + + - + RTE\Device\STM32F756NGHx\stm32f7xx_hal_conf.h - - + + - + RTE\Device\STM32F756NGHx\system_stm32f7xx.c - - + + RTE\File_System\FS_Config.c - - + + RTE\File_System\FS_Config_MC_0.h - - + + - + RTE\Network\Net_Config.c - - + + - + RTE\Network\Net_Config_BSD.h - - + + - + RTE\Network\Net_Config_DNS_Client.h - - + + - + RTE\Network\Net_Config_ETH_0.h - - + + - + RTE\Network\Net_Config_TCP.h - - + + - + RTE\Network\Net_Config_UDP.h - - + + + + RTE\Network\Net_Debug.c + + + + RTE\wolfSSL\config-Crypt.h @@ -879,10 +911,10 @@ - + RTE\wolfSSL\user_settings.h - - + + diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/main.c b/IDE/MDK5-ARM/Projects/SimpleClient/main.c index 472098717..c78944529 100644 --- a/IDE/MDK5-ARM/Projects/SimpleClient/main.c +++ b/IDE/MDK5-ARM/Projects/SimpleClient/main.c @@ -25,10 +25,15 @@ #include "wolfssl/wolfcrypt/settings.h" -#include "cmsis_os.h" /* CMSIS RTOS definitions */ #include "rl_net.h" /* Network definitions */ #include +#if defined(WOLFSSL_CMSIS_RTOS) + #include "cmsis_os.h" +#elif defined(WOLFSSL_CMSIS_RTOSv2) + #include "cmsis_os2.h" +#endif + #if defined(STM32F7xx) #include "stm32f7xx_hal.h" #elif defined(STM32F4xx) @@ -64,27 +69,59 @@ // RTC: for validate certificate date // Year <1970-2099> -#define RTC_YEAR 2018 -// Month <1=>Jan<2=>Feb<3=>Mar<4=>Apr<5=>May<6=>Jun<7=>Jul<8=>Aut<9=>Sep<10=>Oct<11=>Nov<12=>Dec +#define RTC_YEAR 2019 +// Month <1=>Jan<2=>Feb<3=>Mar<4=>Apr<5=>May<6=>Jun<7=>Jul<8=>Aug<9=>Sep<10=>Oct<11=>Nov<12=>Dec #define RTC_MONTH 1 // Day <1-31> #define RTC_DAY 1 // //------------- <<< end of configuration section >>> ----------------------- + #warning "write MPU specific Set ups\n" -static void SystemClock_Config (void) { - +static void SystemClock_Config(void) +{ } -static void MPU_Config (void) { - +static void MPU_Config(void) +{ } -static void CPU_CACHE_Enable (void) { - +static void CPU_CACHE_Enable(void) +{ } +#if defined(WOLFSSL_CMSIS_RTOS) +extern uint32_t os_time; +#endif + +uint32_t HAL_GetTick(void) { + #if defined(WOLFSSL_CMSIS_RTOS) + return os_time; + #elif defined(WOLFSSL_CMSIS_RTOSv2) + return osKernelGetTickCount(); + #endif +} + +static time_t epochTime; +time_t time(time_t *t){ + return epochTime ; +} + +void setTime(time_t t){ + epochTime = t; +} + +double current_time(int reset) +{ + if (reset) + return 0; + #if defined(WOLFSSL_CMSIS_RTOS) + return (double)os_time / 1000.0; + #elif defined(WOLFSSL_CMSIS_RTOSv2) + return (double)osKernelGetTickCount() / 1000.0; + #endif +} /*----------------------------------------------------------------------------- * Initialize a Flash Memory Card @@ -111,62 +148,21 @@ static void init_filesystem (void) { } #endif +extern void client_test(void const*arg); -void net_loop(void const *arg) -{ - while(1) { - net_main (); - osThreadYield (); - } -} - -osThreadDef(net_loop, osPriorityLow, 2, 0); - -#ifdef RTE_CMSIS_RTOS_RTX -extern uint32_t os_time; -static time_t epochTime; - -uint32_t HAL_GetTick(void) { - return os_time; -} - -time_t time(time_t *t){ - return epochTime ; -} - -void setTime(time_t t){ - epochTime = t; -} -#endif - -#ifdef WOLFSSL_CURRTIME_OSTICK - -#include -extern uint32_t os_time; - -double current_time(int reset) -{ - if(reset) os_time = 0 ; - return (double)os_time /1000.0; -} - +#if defined(WOLFSSL_CMSIS_RTOSv2) +void app_main(void *arg) #else - -#include -#define DWT ((DWT_Type *) (0xE0001000UL) ) -typedef struct +void app_main(void const*arg) +#endif { - uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ - uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ -} DWT_Type; - -extern uint32_t SystemCoreClock ; - -double current_time(int reset) -{ - if(reset) DWT->CYCCNT = 0 ; - return ((double)DWT->CYCCNT/SystemCoreClock) ; + if(netInitialize () == netOK) + client_test(arg); + else printf("ERROR: netInitialize\n"); } + +#if defined(WOLFSSL_CMSIS_RTOS) +osThreadDef(app_main, osPriorityLow, 1, 32*1024); #endif /*---------------------------------------------------------------------------- @@ -178,7 +174,6 @@ typedef struct func_args { char** argv; } func_args; -extern void client_test(func_args * args) ; int myoptind = 0; char* myoptarg = NULL; @@ -192,17 +187,19 @@ int main (void) { char *verStr[] = { "SSL3", "TLS1.0", "TLS1.1", "TLS1.2", "TLS1.3"}; #define VERSIZE 2 - char ver[VERSIZE]; + static char ver[VERSIZE]; MPU_Config(); /* Configure the MPU */ CPU_CACHE_Enable(); /* Enable the CPU Cache */ HAL_Init(); /* Initialize the HAL Library */ SystemClock_Config(); /* Configure the System Clock */ - + #if defined(WOLFSSL_CMSIS_RTOSv2) + osKernelInitialize(); + #endif + #if !defined(NO_FILESYSTEM) init_filesystem (); #endif - net_initialize (); #if defined(DEBUG_WOLFSSL) printf("Turning ON Debug message\n") ; @@ -217,12 +214,12 @@ int main (void) { printf(" Other options: %s\n", OTHER_OPTIONS); setTime((time_t)((RTC_YEAR-1970)*365*24*60*60) + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60); - osThreadCreate (osThread(net_loop), NULL); - - client_test(&args) ; - - while(1) - osDelay(1000); + #if defined(WOLFSSL_CMSIS_RTOS) + osThreadCreate (osThread(app_main), (void *)&args); + #elif defined(WOLFSSL_CMSIS_RTOSv2) + osThreadNew(app_main, (void *)&args, NULL); + #endif + osKernelStart(); } diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/Abstract.txt b/IDE/MDK5-ARM/Projects/SimpleServer/Abstract.txt index 8a152aff0..d27563a87 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/Abstract.txt +++ b/IDE/MDK5-ARM/Projects/SimpleServer/Abstract.txt @@ -1,6 +1,9 @@ wolfSSL example: TLS Server Use Configuration Wizard tab + +RTE_Device.h: Check SDMMC1 (SD/SDIO/MMC card host interface 1) +RTE_Device.h: Check ETH (Ethernet Interface) main.c for server port or TLS version user_settings.h for wolfCrypt or wolfSSL options diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h new file mode 100644 index 000000000..943a46a07 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h @@ -0,0 +1,519 @@ +/* user_settings.h + * + * Copyright (C) 2006-2017 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 NO_MAIN_DRIVER +#define BENCH_EMBEDDED +#define NO_DEV_RANDOM +#define WOLFSSL_USER_CURRTIME +#define SIZEOF_LONG_LONG 8 +#define NO_WRITEV +#define NO_DEV_RANDOM + +#define TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT +#define WC_RSA_BLINDING + +#define WOLFSSL_USER_CURRTIME /* for benchmark */ +#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */ +#define WOLFSSL_GMTIME +#define NO_MULTIBYTE_PRINT + +// <<< Use Configuration Wizard in Context Menu >>> + + +// Common options +// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx +#define MDK_CONF_MPU 3 +#if MDK_CONF_MPU == 0 + +#elif MDK_CONF_MPU == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32F2xx +#elif MDK_CONF_MPU == 2 +#define WOLFSSL_STM32_CUBEMX +#define STM32F4xx +#elif MDK_CONF_MPU == 3 +#define WOLFSSL_STM32_CUBEMX +#define STM32F7xx +#endif + +// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <2=>SafeRTOS<3=>Windows +// <4=>PThread <5=>ThreadX<6=> ThreadX/NetX +// <7=>Micrium <8=>EBSnet<9=>MQX +// <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2 +// <13=>Frosted <14=>CMSIS RTOS<15=>CMSIS RTOSv2<16=>Others +#define MDK_CONF_THREAD 15 +#if MDK_CONF_THREAD== 0 +#define SINGLE_THREADED +#elif MDK_CONF_THREAD == 1 +#define FREERTOS +#elif MDK_CONF_THREAD == 3 +#define WOLFSSL_SAFERTOS +#elif MDK_CONF_THREAD == 4 +#define USE_WINDOWS_API +#elif MDK_CONF_THREAD == 5 +#define WOLFSSL_PTHREADS +#elif MDK_CONF_THREAD == 6 +#define THREADX +#define NETX +#elif MDK_CONF_THREAD == 7 +#define MICRIUM +#elif MDK_CONF_THREAD == 8 +#define EBSNET +#elif MDK_CONF_THREAD == 9 +#define FREESCALE_MQX +#define FREESCALE_KSDK_MQX +#elif MDK_CONF_THREAD == 10 +#define WOLFSSL_TIRTOS +#elif MDK_CONF_THREAD == 11 +#define WOLFSSL_uITRON4 +#elif MDK_CONF_THREAD == 12 +#define WOLFSSL_uTKERNEL2 +#elif MDK_CONF_THREAD == 13 +#define WOLFSSL_FROSTED +#elif MDK_CONF_THREAD == 14 +#define WOLFSSL_CMSIS_RTOS +#elif MDK_CONF_THREAD == 15 +#define WOLFSSL_CMSIS_RTOSv2 +#elif MDK_CONF_THREAD == 16 +#define SINGLE_THREADED +#endif + + +// File System +#define MDK_CONF_FILESYSTEM 1 +#if MDK_CONF_FILESYSTEM == 0 +#define NO_FILESYSTEM +#else +#define WOLFSSL_KEIL_FS +#define NO_WOLFSSL_DIR +#endif +// + +// Network<0=>None <1=>RLnet <2=>User I/O +#define MDK_CONF_NETWORK 1 +#if MDK_CONF_NETWORK == 0 +#elif MDK_CONF_NETWORK == 1 +#define WOLFSSL_KEIL_TCP_NET +#elif MDK_CONF_NETWORK == 2 +#define WOLFSSL_USER_IO +#endif + +// Debug options + +// Debug Message +#define MDK_CONF_DebugMessage 0 +#if MDK_CONF_DebugMessage == 1 +#define DEBUG_WOLFSSL +#endif +// +// Check malloc +#define MDK_CONF_CheckMalloc 1 +#if MDK_CONF_CheckMalloc == 1 +#define WOLFSSL_MALLOC_CHECK +#define USE_WOLFSSL_MEMORY +#endif +// +// ErrNo.h +#define MDK_CONF_ErrNo 1 +#if MDK_CONF_ErrNo == 1 +#define HAVE_ERRNO +#endif +// +// Error Strings +#define MDK_CONF_ErrorStrings 1 +#if MDK_CONF_ErrorStrings == 0 +#define NO_ERROR_STRINGS +#endif +// + +// +// + +// wolfCrypt Configuration + +// Hash/Crypt Algrithm + +// MD2 +#define MDK_CONF_MD2 0 +#if MDK_CONF_MD2 == 1 +#define WOLFSSL_MD2 +#endif +// +// MD4 +#define MDK_CONF_MD4 0 +#if MDK_CONF_MD4 == 0 +#define NO_MD4 +#endif +// +// MD5 +#define MDK_CONF_MD5 1 +#if MDK_CONF_MD5 == 0 +#define NO_MD5 +#endif +// +// SHA +#define MDK_CONF_SHA 1 +#if MDK_CONF_SHA == 0 +#define NO_SHA +#endif +// +// SHA-256 +#define MDK_CONF_SHA256 1 +#if MDK_CONF_SHA256 == 0 +#define NO_SHA256 +#endif +// +// SHA-384 +#define MDK_CONF_SHA384 1 +#if MDK_CONF_SHA384 == 1 +#define WOLFSSL_SHA384 +#endif +// +// SHA-512 +#define MDK_CONF_SHA512 1 +#if MDK_CONF_SHA512 == 1 +#define WOLFSSL_SHA512 +#endif +// +// Hash DRBG +#define MDK_CONF_HASHDRBG 1 +#if MDK_CONF_HASHDRBG == 1 +#define HAVE_HASHDRBG +#endif +// +// RIPEMD +#define MDK_CONF_RIPEMD 1 +#if MDK_CONF_RIPEMD == 1 +#define WOLFSSL_RIPEMD +#endif +// +// BLAKE2 +#define MDK_CONF_BLAKE2 0 +#if MDK_CONF_BLAKE2 == 1 +#define HAVE_BLAKE2 +#endif +// +// HMAC +#define MDK_CONF_HMAC 1 +#if MDK_CONF_HMAC == 0 +#define NO_HMAC +#endif +// +// HMAC KDF +#define MDK_CONF_HKDF 1 +#if MDK_CONF_HKDF == 1 +#define HAVE_HKDF +#endif +// + +// AES CCM +#define MDK_CONF_AESCCM 1 +#if MDK_CONF_AESCCM == 1 +#define HAVE_AESCCM +#endif +// +// AES GCM +#define MDK_CONF_AESGCM 1 +#if MDK_CONF_AESGCM == 1 +#define HAVE_AESGCM +#endif +// + +// RC4 +#define MDK_CONF_RC4 0 +#if MDK_CONF_RC4 == 0 +#define NO_RC4 +#endif +// + +// HC128 +#define MDK_CONF_HC128 1 +#if MDK_CONF_AESGCM == 0 +#define NO_HC128 +#endif +// + +// RABBIT +#define MDK_CONF_RABBIT 1 +#if MDK_CONF_RABBIT == 0 +#define NO_RABBIT +#endif +// + +// CHACHA +#define MDK_CONF_CHACHA 1 +#if MDK_CONF_CHACHA == 1 +#define HAVE_CHACHA +#endif +// + +// POLY1305 +#define MDK_CONF_POLY1305 1 +#if MDK_CONF_POLY1305 == 1 +#define HAVE_POLY1305 +#define HAVE_ONE_TIME_AUTH +#endif +// + +// DES3 +#define MDK_CONF_DES3 1 +#if MDK_CONF_DES3 == 0 +#define NO_DES3 +#endif +// + +// AES +#define MDK_CONF_AES 1 +#if MDK_CONF_AES == 0 +#define NO_AES +#endif +// + +// CAMELLIA +#define MDK_CONF_CAMELLIA 1 +#if MDK_CONF_CAMELLIA == 1 +#define HAVE_CAMELLIA +#endif +// + +// DH +#define MDK_CONF_DH 1 +#if MDK_CONF_DH == 0 +#define NO_DH +#endif +// +// DSA +#define MDK_CONF_DSA 1 +#if MDK_CONF_DSA == 0 +#define NO_DSA +#endif +// + +// SRP +#define MDK_CONF_SRP 1 +#if MDK_CONF_SRP == 1 +#define HAVE_SRP +#endif +// + +// PWDBASED +#define MDK_CONF_PWDBASED 1 +#if MDK_CONF_PWDBASED == 0 +#define NO_PWDBASED +#endif +// + +// ECC +#define MDK_CONF_ECC 1 +#if MDK_CONF_ECC == 1 +#define HAVE_ECC +#endif +// + +// CURVE25519 +#define MDK_CONF_CURVE25519 1 +#if MDK_CONF_CURVE25519 == 1 +#define HAVE_CURVE25519 +#define CURVED25519_SMALL +#endif +// +// CURVE25519 SMALL +#define MDK_CONF_CURVE25519_SMALL 0 +#if MDK_CONF_CURVE25519_SMALL == 1 +#define CURVED25519_SMALL +#endif +// +// ED25519 +#define MDK_CONF_ED25519 1 +#if MDK_CONF_ED25519 == 1 +#define HAVE_ED25519 +#endif +// +// ED25519 SMALL +#define MDK_CONF_ED25519_SMALL 0 +#if MDK_CONF_ED25519_SMALL == 1 +#define ED25519_SMALL +#endif +// +// PKCS7 +#define MDK_CONF_PKCS7 0 +#if MDK_CONF_PKCS7 == 1 +#define HAVE_PKCS7 +#endif +// + +// NTRU (need License, "crypto_ntru.h") +#define MDK_CONF_NTRU 0 +#if MDK_CONF_NTRU == 1 +#define HAVE_NTRU +#endif +// +// + +// Random Seed, for TEST Only +#define MDK_CONF_RNDSEED 1 +#if MDK_CONF_RNDSEED == 1 +#define WOLFSSL_GENSEED_FORTEST +#endif +// + +// Hardware Crypt (See document for usage) +// Hardware RNG +#define MDK_CONF_STM32F2_RNG 0 +#if MDK_CONF_STM32F2_RNG == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_RNG +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Crypt +#define MDK_CONF_STM32F2_CRYPTO 0 +#if MDK_CONF_STM32F2_CRYPTO == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_CRYPTO +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Hash +#define MDK_CONF_STM32F2_HASH 0 +#if MDK_CONF_STM32F2_HASH == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_HASH +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// + +// Cert/Key Strage +// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes) +#define MDK_CONF_CERT_BUFF 0 +#if MDK_CONF_CERT_BUFF== 1 +#define USE_CERT_BUFFERS_1024 +#elif MDK_CONF_CERT_BUFF == 2 +#define USE_CERT_BUFFERS_2048 +#endif +// +// Cert/Key Generation +// CertGen +#define MDK_CONF_CERT_GEN 0 +#if MDK_CONF_CERT_GEN == 1 +#define WOLFSSL_CERT_GEN +#endif +// +// KeyGen +#define MDK_CONF_KEY_GEN 0 +#if MDK_CONF_KEY_GEN == 1 +#define WOLFSSL_KEY_GEN +#endif +// +// +// Use Fast Math +#define MDK_CONF_FASTMATH 1 +#if MDK_CONF_FASTMATH == 1 +#define USE_FAST_MATH +#define TFM_TIMING_RESISTANT +#endif +// +// Small Stack +#define MDK_CONF_SmallStack 1 +#if MDK_CONF_SmallStack == 0 +#define NO_WOLFSSL_SMALL_STACK +#endif +// + +// + + +/**** wolfSSL Configuration ****/ + +// wolfSSL Configuration + +// TLS 1.3 +#define MDK_CONF_TLS 1 +#if MDK_CONF_TLS == 1 +#define WOLFSSL_TLS13 +#define HAVE_TLS_EXTENSIONS +#define HAVE_SUPPORTED_CURVES +#define WC_RSA_PSS +#define HAVE_HKDF +#define HAVE_FFDHE_2048 +#endif +// + +// Include Old TLS +#define MDK_CONF_NO_OLDTLS 0 +#if MDK_CONF_NO_OLDTLS == 0 +#define NO_OLD_TLS +#endif +// +// CRL +#define MDK_CONF_CRL 0 +#if MDK_CONF_CRL == 1 +#define HAVE_CRL +#define WOLFSSL_DER_LOAD +#endif +// +// OCSP +#define MDK_CONF_OCSP 0 +#if MDK_CONF_OCSP == 1 +#define HAVE_OCSP +#endif +// +// OpenSSL Extra +#define MDK_CONF_OPENSSL_EXTRA 0 +#if MDK_CONF_OPENSSL_EXTRA == 1 +#define OPENSSL_EXTRA +#endif +// + +// + diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx index 8d194b2e4..793053daf 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx +++ b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx @@ -101,7 +101,7 @@ 0 0 1 - 5 + 1 @@ -112,9 +112,14 @@ - STLink\ST-LINKIII-KEIL_SWO.dll + BIN\ULP2CM3.DLL + + 0 + ULP2CM3 + -UP1135060 -O207 -S10 -C0 -P00 -N00("") -D00(00000000) -L00(0) -TO19 -TC216000000 -TP11 -TDX0 -TDD0 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) + 0 ST-LINKIII-KEIL_SWO @@ -155,8 +160,18 @@ - C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.5.0\FileSystem\FileSystem.scvd - Keil.MDK-Middleware.7.5.0 + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.7.0\FileSystem\FileSystem.scvd + Keil.MDK-Middleware.7.7.0 + 1 + + + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.7.0\Network\Network.scvd + Keil.MDK-Middleware.7.7.0 + 1 + + + C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.3.0\CMSIS\RTOS2\RTX\RTX5.scvd + ARM.CMSIS.5.3.0 1 @@ -197,6 +212,10 @@ + + + + 1 0 @@ -336,7 +355,7 @@ ::Network - 0 + 1 0 0 1 diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx index 9e867e1d1..33c84cb0e 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx +++ b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx @@ -16,7 +16,7 @@ STM32F756NGHx STMicroelectronics - Keil.STM32F7xx_DFP.2.9.0 + Keil.STM32F7xx_DFP.2.11.0 http://www.keil.com/pack IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE @@ -176,7 +176,7 @@ 0 "Cortex-M7" - 1 + 0 0 0 1 @@ -489,6 +489,12 @@ + + + + + + @@ -515,8 +521,14 @@ - - + + + + + + + + @@ -551,50 +563,50 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -629,216 +641,230 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - RTE\CMSIS\RTX_Conf_CM.c + + RTE\CMSIS\RTX_Conf_CM.c + + + + RTE\CMSIS\RTX_Config.c + + - + + RTE\CMSIS\RTX_Config.h + + + + + + + RTE\Device\STM32F756NGHx\RTE_Device.h - - + + - + RTE\Device\STM32F756NGHx\startup_stm32f756xx.s - - + + - + RTE\Device\STM32F756NGHx\stm32f7xx_hal_conf.h - - + + - + RTE\Device\STM32F756NGHx\system_stm32f7xx.c - - + + RTE\File_System\FS_Config.c - - + + RTE\File_System\FS_Config_MC_0.h - - + + - + RTE\Network\Net_Config.c - - + + - + RTE\Network\Net_Config_BSD.h - - + + - + RTE\Network\Net_Config_DNS_Client.h - - + + @@ -849,26 +875,26 @@ - + RTE\Network\Net_Config_ETH_0.h - - + + - + RTE\Network\Net_Config_TCP.h - - + + - + RTE\Network\Net_Config_UDP.h - - + + @@ -885,10 +911,10 @@ - + RTE\wolfSSL\user_settings.h - - + + diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/main.c b/IDE/MDK5-ARM/Projects/SimpleServer/main.c index 7de2c64d8..2e73dfc56 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/main.c +++ b/IDE/MDK5-ARM/Projects/SimpleServer/main.c @@ -20,15 +20,22 @@ */ #ifdef HAVE_CONFIG_H - #include +#include #endif #include "wolfssl/wolfcrypt/settings.h" -#include "cmsis_os.h" /* CMSIS RTOS definitions */ #include "rl_net.h" /* Network definitions */ #include +#if defined(WOLFSSL_CMSIS_RTOS) +#include "cmsis_os.h" +#elif defined(WOLFSSL_CMSIS_RTOSv2) +#include "cmsis_os2.h" +#endif + +/* Dummy definition for test RTC */ +#define RTC_YEAR 2019 #if defined(STM32F7xx) #include "stm32f7xx_hal.h" #elif defined(STM32F4xx) @@ -59,7 +66,7 @@ // RTC: for validate certificate date // Year <1970-2099> -#define RTC_YEAR 2018 +#define RTC_YEAR 2019 // Month <1=>Jan<2=>Feb<3=>Mar<4=>Apr<5=>May<6=>Jun<7=>Jul<8=>Aut<9=>Sep<10=>Oct<11=>Nov<12=>Dec #define RTC_MONTH 1 // Day <1-31> @@ -106,43 +113,28 @@ static void init_filesystem (void) { } #endif +#if defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2) -void net_loop(void const *arg) -{ - while(1) { - net_main (); - osThreadYield (); - } -} - -osThreadDef(net_loop, osPriorityLow, 2, 0); - -#ifdef RTE_CMSIS_RTOS_RTX +#if defined(WOLFSSL_CMSIS_RTOS) extern uint32_t os_time; -static time_t epochTime; - -uint32_t HAL_GetTick(void) { - return os_time; -} - -time_t time(time_t *t){ - return epochTime ; -} - -void setTime(time_t t){ - epochTime = t; -} #endif -#ifdef WOLFSSL_CURRTIME_OSTICK - -#include -extern uint32_t os_time; +uint32_t HAL_GetTick(void) +{ + #if defined(WOLFSSL_CMSIS_RTOS) + return os_time; + #elif defined(WOLFSSL_CMSIS_RTOSv2) + return osKernelGetTickCount(); + #endif +} double current_time(int reset) { - if(reset) os_time = 0 ; - return (double)os_time /1000.0; + #if defined(WOLFSSL_CMSIS_RTOS) + return (double)os_time / 1000.0; + #elif defined(WOLFSSL_CMSIS_RTOSv2) + return (double)osKernelGetTickCount() / 1000.0; + #endif } #else @@ -155,15 +147,46 @@ typedef struct uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ } DWT_Type; -extern uint32_t SystemCoreClock ; +extern uint32_t SystemCoreClock; double current_time(int reset) { - if(reset) DWT->CYCCNT = 0 ; - return ((double)DWT->CYCCNT/SystemCoreClock) ; + if (reset) + DWT->CYCCNT = 0; + return ((double)DWT->CYCCNT / SystemCoreClock); } #endif +static time_t epochTime; +time_t time(time_t *t) +{ + return epochTime; +} + +void setTime(time_t t) +{ + epochTime = t; +} + + +extern void server_test(void const *arg); + +#if defined(WOLFSSL_CMSIS_RTOSv2) +void app_main(void *arg) +#else +void app_main(void const*arg) +#endif +{ + if (netInitialize() == netOK) + server_test(arg); + else + printf("ERROR: netInitialize\n"); +} + +#if defined(WOLFSSL_CMSIS_RTOS) +osThreadDef(app_main, osPriorityLow, 1, 32 * 1024); +#endif + /*---------------------------------------------------------------------------- Main Thread 'main': Run Network *---------------------------------------------------------------------------*/ @@ -173,12 +196,11 @@ typedef struct func_args { char** argv; } func_args; -extern void server_test(func_args * args) ; - int myoptind = 0; -char* myoptarg = NULL; +char *myoptarg = NULL; -int main (void) { +int main(void) +{ static char *argv[] = { "server", "-p", SERVER_PORT, "-v", " ", OTHER_OPTIONS } ; @@ -197,12 +219,15 @@ int main (void) { #if !defined(NO_FILESYSTEM) init_filesystem (); #endif - net_initialize (); - #if defined(DEBUG_WOLFSSL) - printf("Turning ON Debug message\n") ; - wolfSSL_Debugging_ON() ; - #endif +#if defined(WOLFSSL_CMSIS_RTOSv2) + osKernelInitialize(); +#endif + +#if defined(DEBUG_WOLFSSL) + printf("Turning ON Debug message\n"); + wolfSSL_Debugging_ON(); +#endif snprintf(ver, VERSIZE, "%d", TLS_VER); argv[4] = ver; @@ -212,12 +237,10 @@ int main (void) { printf(" Other options: %s\n", OTHER_OPTIONS); setTime((RTC_YEAR-1970)*365*24*60*60 + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60); - osThreadCreate (osThread(net_loop), NULL); - - server_test(&args) ; - - while(1) - osDelay(1000); - +#if defined(WOLFSSL_CMSIS_RTOS) + osThreadCreate(osThread(app_main), (void *)&args); +#elif defined(WOLFSSL_CMSIS_RTOSv2) + osThreadNew(app_main, (void *)&args, NULL); +#endif + osKernelStart(); } - diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/Abstract.txt b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/Abstract.txt new file mode 100644 index 000000000..6a6c9c3c6 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/Abstract.txt @@ -0,0 +1,14 @@ +wolfSSL example: TLS Library + +Use Configuration Wizard tab + +RTE_Device.h: Check SDMMC1 (SD/SDIO/MMC card host interface 1) +RTE_Device.h: Check ETH (Ethernet Interface) +user_settings.h for wolfCrypt or wolfSSL options + +For further options, details, see wolfSSL User Manual. + + +Support +------- +Please send questions or comments to support@wolfssl.com diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h new file mode 100644 index 000000000..943a46a07 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h @@ -0,0 +1,519 @@ +/* user_settings.h + * + * Copyright (C) 2006-2017 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 NO_MAIN_DRIVER +#define BENCH_EMBEDDED +#define NO_DEV_RANDOM +#define WOLFSSL_USER_CURRTIME +#define SIZEOF_LONG_LONG 8 +#define NO_WRITEV +#define NO_DEV_RANDOM + +#define TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT +#define WC_RSA_BLINDING + +#define WOLFSSL_USER_CURRTIME /* for benchmark */ +#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */ +#define WOLFSSL_GMTIME +#define NO_MULTIBYTE_PRINT + +// <<< Use Configuration Wizard in Context Menu >>> + + +// Common options +// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx +#define MDK_CONF_MPU 3 +#if MDK_CONF_MPU == 0 + +#elif MDK_CONF_MPU == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32F2xx +#elif MDK_CONF_MPU == 2 +#define WOLFSSL_STM32_CUBEMX +#define STM32F4xx +#elif MDK_CONF_MPU == 3 +#define WOLFSSL_STM32_CUBEMX +#define STM32F7xx +#endif + +// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <2=>SafeRTOS<3=>Windows +// <4=>PThread <5=>ThreadX<6=> ThreadX/NetX +// <7=>Micrium <8=>EBSnet<9=>MQX +// <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2 +// <13=>Frosted <14=>CMSIS RTOS<15=>CMSIS RTOSv2<16=>Others +#define MDK_CONF_THREAD 15 +#if MDK_CONF_THREAD== 0 +#define SINGLE_THREADED +#elif MDK_CONF_THREAD == 1 +#define FREERTOS +#elif MDK_CONF_THREAD == 3 +#define WOLFSSL_SAFERTOS +#elif MDK_CONF_THREAD == 4 +#define USE_WINDOWS_API +#elif MDK_CONF_THREAD == 5 +#define WOLFSSL_PTHREADS +#elif MDK_CONF_THREAD == 6 +#define THREADX +#define NETX +#elif MDK_CONF_THREAD == 7 +#define MICRIUM +#elif MDK_CONF_THREAD == 8 +#define EBSNET +#elif MDK_CONF_THREAD == 9 +#define FREESCALE_MQX +#define FREESCALE_KSDK_MQX +#elif MDK_CONF_THREAD == 10 +#define WOLFSSL_TIRTOS +#elif MDK_CONF_THREAD == 11 +#define WOLFSSL_uITRON4 +#elif MDK_CONF_THREAD == 12 +#define WOLFSSL_uTKERNEL2 +#elif MDK_CONF_THREAD == 13 +#define WOLFSSL_FROSTED +#elif MDK_CONF_THREAD == 14 +#define WOLFSSL_CMSIS_RTOS +#elif MDK_CONF_THREAD == 15 +#define WOLFSSL_CMSIS_RTOSv2 +#elif MDK_CONF_THREAD == 16 +#define SINGLE_THREADED +#endif + + +// File System +#define MDK_CONF_FILESYSTEM 1 +#if MDK_CONF_FILESYSTEM == 0 +#define NO_FILESYSTEM +#else +#define WOLFSSL_KEIL_FS +#define NO_WOLFSSL_DIR +#endif +// + +// Network<0=>None <1=>RLnet <2=>User I/O +#define MDK_CONF_NETWORK 1 +#if MDK_CONF_NETWORK == 0 +#elif MDK_CONF_NETWORK == 1 +#define WOLFSSL_KEIL_TCP_NET +#elif MDK_CONF_NETWORK == 2 +#define WOLFSSL_USER_IO +#endif + +// Debug options + +// Debug Message +#define MDK_CONF_DebugMessage 0 +#if MDK_CONF_DebugMessage == 1 +#define DEBUG_WOLFSSL +#endif +// +// Check malloc +#define MDK_CONF_CheckMalloc 1 +#if MDK_CONF_CheckMalloc == 1 +#define WOLFSSL_MALLOC_CHECK +#define USE_WOLFSSL_MEMORY +#endif +// +// ErrNo.h +#define MDK_CONF_ErrNo 1 +#if MDK_CONF_ErrNo == 1 +#define HAVE_ERRNO +#endif +// +// Error Strings +#define MDK_CONF_ErrorStrings 1 +#if MDK_CONF_ErrorStrings == 0 +#define NO_ERROR_STRINGS +#endif +// + +// +// + +// wolfCrypt Configuration + +// Hash/Crypt Algrithm + +// MD2 +#define MDK_CONF_MD2 0 +#if MDK_CONF_MD2 == 1 +#define WOLFSSL_MD2 +#endif +// +// MD4 +#define MDK_CONF_MD4 0 +#if MDK_CONF_MD4 == 0 +#define NO_MD4 +#endif +// +// MD5 +#define MDK_CONF_MD5 1 +#if MDK_CONF_MD5 == 0 +#define NO_MD5 +#endif +// +// SHA +#define MDK_CONF_SHA 1 +#if MDK_CONF_SHA == 0 +#define NO_SHA +#endif +// +// SHA-256 +#define MDK_CONF_SHA256 1 +#if MDK_CONF_SHA256 == 0 +#define NO_SHA256 +#endif +// +// SHA-384 +#define MDK_CONF_SHA384 1 +#if MDK_CONF_SHA384 == 1 +#define WOLFSSL_SHA384 +#endif +// +// SHA-512 +#define MDK_CONF_SHA512 1 +#if MDK_CONF_SHA512 == 1 +#define WOLFSSL_SHA512 +#endif +// +// Hash DRBG +#define MDK_CONF_HASHDRBG 1 +#if MDK_CONF_HASHDRBG == 1 +#define HAVE_HASHDRBG +#endif +// +// RIPEMD +#define MDK_CONF_RIPEMD 1 +#if MDK_CONF_RIPEMD == 1 +#define WOLFSSL_RIPEMD +#endif +// +// BLAKE2 +#define MDK_CONF_BLAKE2 0 +#if MDK_CONF_BLAKE2 == 1 +#define HAVE_BLAKE2 +#endif +// +// HMAC +#define MDK_CONF_HMAC 1 +#if MDK_CONF_HMAC == 0 +#define NO_HMAC +#endif +// +// HMAC KDF +#define MDK_CONF_HKDF 1 +#if MDK_CONF_HKDF == 1 +#define HAVE_HKDF +#endif +// + +// AES CCM +#define MDK_CONF_AESCCM 1 +#if MDK_CONF_AESCCM == 1 +#define HAVE_AESCCM +#endif +// +// AES GCM +#define MDK_CONF_AESGCM 1 +#if MDK_CONF_AESGCM == 1 +#define HAVE_AESGCM +#endif +// + +// RC4 +#define MDK_CONF_RC4 0 +#if MDK_CONF_RC4 == 0 +#define NO_RC4 +#endif +// + +// HC128 +#define MDK_CONF_HC128 1 +#if MDK_CONF_AESGCM == 0 +#define NO_HC128 +#endif +// + +// RABBIT +#define MDK_CONF_RABBIT 1 +#if MDK_CONF_RABBIT == 0 +#define NO_RABBIT +#endif +// + +// CHACHA +#define MDK_CONF_CHACHA 1 +#if MDK_CONF_CHACHA == 1 +#define HAVE_CHACHA +#endif +// + +// POLY1305 +#define MDK_CONF_POLY1305 1 +#if MDK_CONF_POLY1305 == 1 +#define HAVE_POLY1305 +#define HAVE_ONE_TIME_AUTH +#endif +// + +// DES3 +#define MDK_CONF_DES3 1 +#if MDK_CONF_DES3 == 0 +#define NO_DES3 +#endif +// + +// AES +#define MDK_CONF_AES 1 +#if MDK_CONF_AES == 0 +#define NO_AES +#endif +// + +// CAMELLIA +#define MDK_CONF_CAMELLIA 1 +#if MDK_CONF_CAMELLIA == 1 +#define HAVE_CAMELLIA +#endif +// + +// DH +#define MDK_CONF_DH 1 +#if MDK_CONF_DH == 0 +#define NO_DH +#endif +// +// DSA +#define MDK_CONF_DSA 1 +#if MDK_CONF_DSA == 0 +#define NO_DSA +#endif +// + +// SRP +#define MDK_CONF_SRP 1 +#if MDK_CONF_SRP == 1 +#define HAVE_SRP +#endif +// + +// PWDBASED +#define MDK_CONF_PWDBASED 1 +#if MDK_CONF_PWDBASED == 0 +#define NO_PWDBASED +#endif +// + +// ECC +#define MDK_CONF_ECC 1 +#if MDK_CONF_ECC == 1 +#define HAVE_ECC +#endif +// + +// CURVE25519 +#define MDK_CONF_CURVE25519 1 +#if MDK_CONF_CURVE25519 == 1 +#define HAVE_CURVE25519 +#define CURVED25519_SMALL +#endif +// +// CURVE25519 SMALL +#define MDK_CONF_CURVE25519_SMALL 0 +#if MDK_CONF_CURVE25519_SMALL == 1 +#define CURVED25519_SMALL +#endif +// +// ED25519 +#define MDK_CONF_ED25519 1 +#if MDK_CONF_ED25519 == 1 +#define HAVE_ED25519 +#endif +// +// ED25519 SMALL +#define MDK_CONF_ED25519_SMALL 0 +#if MDK_CONF_ED25519_SMALL == 1 +#define ED25519_SMALL +#endif +// +// PKCS7 +#define MDK_CONF_PKCS7 0 +#if MDK_CONF_PKCS7 == 1 +#define HAVE_PKCS7 +#endif +// + +// NTRU (need License, "crypto_ntru.h") +#define MDK_CONF_NTRU 0 +#if MDK_CONF_NTRU == 1 +#define HAVE_NTRU +#endif +// +// + +// Random Seed, for TEST Only +#define MDK_CONF_RNDSEED 1 +#if MDK_CONF_RNDSEED == 1 +#define WOLFSSL_GENSEED_FORTEST +#endif +// + +// Hardware Crypt (See document for usage) +// Hardware RNG +#define MDK_CONF_STM32F2_RNG 0 +#if MDK_CONF_STM32F2_RNG == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_RNG +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Crypt +#define MDK_CONF_STM32F2_CRYPTO 0 +#if MDK_CONF_STM32F2_CRYPTO == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_CRYPTO +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Hash +#define MDK_CONF_STM32F2_HASH 0 +#if MDK_CONF_STM32F2_HASH == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_HASH +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// + +// Cert/Key Strage +// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes) +#define MDK_CONF_CERT_BUFF 0 +#if MDK_CONF_CERT_BUFF== 1 +#define USE_CERT_BUFFERS_1024 +#elif MDK_CONF_CERT_BUFF == 2 +#define USE_CERT_BUFFERS_2048 +#endif +// +// Cert/Key Generation +// CertGen +#define MDK_CONF_CERT_GEN 0 +#if MDK_CONF_CERT_GEN == 1 +#define WOLFSSL_CERT_GEN +#endif +// +// KeyGen +#define MDK_CONF_KEY_GEN 0 +#if MDK_CONF_KEY_GEN == 1 +#define WOLFSSL_KEY_GEN +#endif +// +// +// Use Fast Math +#define MDK_CONF_FASTMATH 1 +#if MDK_CONF_FASTMATH == 1 +#define USE_FAST_MATH +#define TFM_TIMING_RESISTANT +#endif +// +// Small Stack +#define MDK_CONF_SmallStack 1 +#if MDK_CONF_SmallStack == 0 +#define NO_WOLFSSL_SMALL_STACK +#endif +// + +// + + +/**** wolfSSL Configuration ****/ + +// wolfSSL Configuration + +// TLS 1.3 +#define MDK_CONF_TLS 1 +#if MDK_CONF_TLS == 1 +#define WOLFSSL_TLS13 +#define HAVE_TLS_EXTENSIONS +#define HAVE_SUPPORTED_CURVES +#define WC_RSA_PSS +#define HAVE_HKDF +#define HAVE_FFDHE_2048 +#endif +// + +// Include Old TLS +#define MDK_CONF_NO_OLDTLS 0 +#if MDK_CONF_NO_OLDTLS == 0 +#define NO_OLD_TLS +#endif +// +// CRL +#define MDK_CONF_CRL 0 +#if MDK_CONF_CRL == 1 +#define HAVE_CRL +#define WOLFSSL_DER_LOAD +#endif +// +// OCSP +#define MDK_CONF_OCSP 0 +#if MDK_CONF_OCSP == 1 +#define HAVE_OCSP +#endif +// +// OpenSSL Extra +#define MDK_CONF_OPENSSL_EXTRA 0 +#if MDK_CONF_OPENSSL_EXTRA == 1 +#define OPENSSL_EXTRA +#endif +// + +// + diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx index 5308bcfa7..1f0fdd699 100644 --- a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx @@ -8,7 +8,7 @@ *.c *.s*; *.src; *.a* - *.obj + *.obj; *.o *.lib *.txt; *.h; *.inc *.plm @@ -26,7 +26,7 @@ 0x4 ARM-ADS - 120000000 + 12000000 1 1 @@ -78,23 +78,6 @@ 1 18 - - - 0 - Schematics (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf - - - 1 - User Manual (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm - - - 2 - MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) - http://www.keil.com/mcbstm32f200/ - - 0 1 @@ -117,7 +100,8 @@ 1 0 0 - 7 + 1 + 1 @@ -131,6 +115,16 @@ BIN\ULP2CM3.DLL + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20020000 -FC1000 -FN2 -FF0STM32F7x_1024 -FS08000000 -FL0100000 -FF1STM32F7x_1024dual -FS18000000 -FL1100000 -FP0($$Device:STM32F765NGHx$CMSIS\Flash\STM32F7x_1024.FLM) -FP1($$Device:STM32F765NGHx$CMSIS\Flash\STM32F7x_1024dual.FLM)) + + + 0 + ULP2CM3 + -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO3 -TC10000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) + 0 DLGUARM @@ -146,16 +140,6 @@ ARMDBGFLAGS - - 0 - ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO3 -TC10000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) - - - 0 - UL2CM3 - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) - @@ -174,6 +158,16 @@ 0 + + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.7.0\Network\Network.scvd + Keil.MDK-Middleware.7.7.0 + 1 + + + C:\Keil_v5\ARM\PACK\ARM\CMSIS\5.3.0\CMSIS\RTOS2\RTX\RTX5.scvd + ARM.CMSIS.5.3.0 + 1 + 0 @@ -205,6 +199,17 @@ + 0 + 0 + 0 + + + + + + + + @@ -219,33 +224,6 @@ 1 5 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 0 - 0 - - - 1 - 2 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-wolfSSL.h - config-wolfSSL.h - 0 - 0 - - - 1 - 3 - 5 - 0 - 0 0 0 .\RTE\wolfSSL\user_settings.h @@ -273,7 +251,7 @@ ::CMSIS - 0 + 1 0 0 1 @@ -297,7 +275,7 @@ ::Network - 0 + 1 0 0 1 diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx index ba62f47a2..0d046e502 100644 --- a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx @@ -10,18 +10,20 @@ wolfSSL-Lib 0x4 ARM-ADS + 5060528::V5.06 update 5 (build 528)::ARMCC + 0 - STM32F207IG + STM32F765NGHx STMicroelectronics - Keil.STM32F2xx_DFP.2.2.0 + Keil.STM32F7xx_DFP.2.11.0 http://www.keil.com/pack - IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE + IRAM(0x20020000,0x60000) IRAM2(0x20000000,0x20000) IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) CPUTYPE("Cortex-M7") FPU3(DFPU) CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + UL2CM3(-S0 -C0 -P0 -FD20020000 -FC1000 -FN2 -FF0STM32F7x_1024 -FS08000000 -FL0100000 -FF1STM32F7x_1024dual -FS18000000 -FL1100000 -FP0($$Device:STM32F765NGHx$CMSIS\Flash\STM32F7x_1024.FLM) -FP1($$Device:STM32F765NGHx$CMSIS\Flash\STM32F7x_1024dual.FLM)) 0 - $$Device:STM32F207IG$Device\Include\stm32f2xx.h + $$Device:STM32F765NGHx$Drivers\CMSIS\Device\ST\STM32F7xx\Include\stm32f7xx.h @@ -31,7 +33,7 @@ - $$Device:STM32F207IG$SVD\STM32F20x.svd + $$Device:STM32F765NGHx$CMSIS\SVD\STM32F7x5_v1r1.svd 0 0 @@ -84,6 +86,8 @@ 0 0 + 0 + 0 0 @@ -106,13 +110,13 @@ SARMCM3.DLL - -REMAP -MPU + -REMAP -MPU DCM.DLL - -pCM3 + -pCM7 SARMCM3.DLL - -REMAP -MPU + -MPU TCM.DLL - -pCM3 + -pCM7 @@ -122,47 +126,6 @@ 0 16 - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - - 0 - 7 - - - - - - - - - - - - - - BIN\ULP2CM3.DLL - @@ -174,8 +137,8 @@ 4100 1 - BIN\ULP2CM3.DLL - "" () + BIN\UL2CM3.DLL + wolfSSL-lib @@ -211,24 +174,25 @@ 1 0 0 - "Cortex-M3" + "Cortex-M7" - 1 + 0 0 0 1 1 0 0 - 0 - 0 - 0 + 3 + 1 + 1 8 0 0 0 - 3 - 3 + 0 + 4 + 4 0 0 0 @@ -245,7 +209,7 @@ 0 0 1 - 0 + 1 0 @@ -279,8 +243,8 @@ 0 - 0x20000000 - 0x20000 + 0x20020000 + 0x60000 1 @@ -314,8 +278,8 @@ 1 - 0x0 - 0x0 + 0x200000 + 0x100000 0 @@ -334,13 +298,13 @@ 0 - 0x20000000 - 0x20000 + 0x20020000 + 0x60000 0 - 0x0 - 0x0 + 0x20000000 + 0x20000 @@ -361,9 +325,16 @@ 0 0 0 + 1 + 1 + 1 + 1 + 0 + 0 + 0 --diag_suppress=1293 - HAVE_CONFIG_H MDK_CONF_WOLFLIB WOLFSSL_USER_SETTINGS + MDK_CONF_WOLFLIB WOLFSSL_USER_SETTINGS @@ -378,6 +349,7 @@ 0 0 0 + 0 @@ -408,16 +380,6 @@ Configuration - - config-Crypt.h - 5 - .\RTE\wolfSSL\config-Crypt.h - - - config-wolfSSL.h - 5 - .\RTE\wolfSSL\config-wolfSSL.h - user_settings.h 5 @@ -427,6 +389,13 @@ Documentation + + + Abstract.txt + 5 + .\Abstract.txt + + wolfSSL-lib @@ -455,27 +424,37 @@ - + - + - + - + - + + + + + + + + + + + @@ -500,6 +479,12 @@ + + + + + + @@ -508,174 +493,226 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + - - + + - - RTE\CMSIS\RTX_Conf_CM.c - - - - - - - - RTE\Device\STM32F207IG\RTE_Device.h - - + + RTE\CMSIS\RTX_Conf_CM.c + + - - RTE\Device\STM32F207IG\startup_stm32f207xx.s - - + + RTE\CMSIS\RTX_Config.c + + + + RTE\CMSIS\RTX_Config.h + + + + + + + + RTE\Device\STM32F207IG\RTE_Device.h + + + + + + RTE\Device\STM32F207IG\startup_stm32f207xx.s + + + + RTE\Device\STM32F207IG\startup_stm32f2xx.s - - RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h - - + + RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h + + + + + + RTE\Device\STM32F207IG\system_stm32f2xx.c + + + + + + RTE\Device\STM32F765NGHx\RTE_Device.h + + - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - + + RTE\Device\STM32F765NGHx\startup_stm32f765xx.s + + + + + + + + RTE\Device\STM32F765NGHx\stm32f7xx_hal_conf.h + + + + + + + + RTE\Device\STM32F765NGHx\system_stm32f7xx.c + + @@ -692,50 +729,50 @@ - + RTE\Network\Net_Config.c - - + + - + RTE\Network\Net_Config_BSD.h - - + + - + RTE\Network\Net_Config_DNS_Client.h - - + + - + RTE\Network\Net_Config_ETH_0.h - - + + - + RTE\Network\Net_Config_TCP.h - - + + - + RTE\Network\Net_Config_UDP.h - - + + @@ -771,20 +808,16 @@ - RTE\wolfSSL\config-Crypt.h + RTE\wolfSSL\config-Crypt.h - - - + - RTE\wolfSSL\config-wolfSSL.h + RTE\wolfSSL\config-wolfSSL.h - - - + RTE\wolfSSL\config.h @@ -798,10 +831,10 @@ - + RTE\wolfSSL\user_settings.h - - + + diff --git a/IDE/MDK5-ARM/Src/ssl-dummy.c b/IDE/MDK5-ARM/Src/ssl-dummy.c index b62ac347a..3fe9926b3 100644 --- a/IDE/MDK5-ARM/Src/ssl-dummy.c +++ b/IDE/MDK5-ARM/Src/ssl-dummy.c @@ -24,30 +24,16 @@ #include #endif -#include -#include +#include +#include Signer* GetCA(void* vp, byte* hash) { return NULL ; } -int CyaSSL_dtls(CYASSL* ssl) -{ - return NULL ; -} - -int CyaSSL_get_using_nonblock(CYASSL* ssl) -{ - return NULL ; -} - Signer* GetCAByName(void* vp, byte* hash) { return NULL ; } -int CyaSSL_PemCertToDer(const char* fileName, unsigned char* derBuf, int derSz) -{ - return NULL ; -} diff --git a/examples/client/client.c b/examples/client/client.c index d0d0f27a8..4302c4d5b 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -31,10 +31,8 @@ #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #include #include - #include "cmsis_os.h" #include "rl_fs.h" #include "rl_net.h" - #include "wolfssl_MDK_ARM.h" #endif #include diff --git a/examples/server/server.c b/examples/server/server.c index 666a0cc10..7f45a2400 100644 --- a/examples/server/server.c +++ b/examples/server/server.c @@ -33,10 +33,8 @@ #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #include #include - #include "cmsis_os.h" #include "rl_fs.h" #include "rl_net.h" - #include "wolfssl_MDK_ARM.h" #endif #include diff --git a/src/tls.c b/src/tls.c index be82fd8f6..6532cf10e 100644 --- a/src/tls.c +++ b/src/tls.c @@ -7419,7 +7419,7 @@ word16 TLSX_PreSharedKey_GetSizeBinders(PreSharedKey* list, byte msgType) word16 len; if (msgType != client_hello) - return SANITY_MSG_E; + return (word16)SANITY_MSG_E; /* Length of all binders. */ len = OPAQUE16_LEN; @@ -7448,7 +7448,7 @@ word16 TLSX_PreSharedKey_WriteBinders(PreSharedKey* list, byte* output, word16 len; if (msgType != client_hello) - return SANITY_MSG_E; + return (word16)SANITY_MSG_E; /* Skip length of all binders. */ lenIdx = idx; @@ -7524,7 +7524,7 @@ static word16 TLSX_PreSharedKey_Write(PreSharedKey* list, byte* output, for (i=0; list != NULL && !list->chosen; i++) list = list->next; if (list == NULL) - return BUILD_MSG_ERROR; + return (word16)BUILD_MSG_ERROR; /* The index of the identity chosen by the server from the list supplied * by the client. @@ -7842,7 +7842,7 @@ static word16 TLSX_PskKeModes_GetSize(byte modes, byte msgType) return len; } - return SANITY_MSG_E; + return (word16)SANITY_MSG_E; } /* Writes the PSK KE modes extension into the output buffer. @@ -7871,7 +7871,7 @@ static word16 TLSX_PskKeModes_Write(byte modes, byte* output, byte msgType) return idx; } - return SANITY_MSG_E; + return (word16)SANITY_MSG_E; } /* Parse the PSK KE modes extension. diff --git a/src/tls13.c b/src/tls13.c index 6af8bcd0d..a36698b44 100644 --- a/src/tls13.c +++ b/src/tls13.c @@ -6278,7 +6278,6 @@ static int DoTls13KeyUpdate(WOLFSSL* ssl, const byte* input, word32* inOutIdx, break; default: return INVALID_PARAMETER; - break; } /* Move index to byte after message. */ diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index b240154d4..165a238d7 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -4049,15 +4049,32 @@ static void bench_rsa_helper(int doAsync, RsaKey rsaKey[BENCH_MAX_PENDING], #ifndef WOLFSSL_RSA_VERIFY_ONLY DECLARE_VAR_INIT(message, byte, len, messageStr, HEAP_HINT); #endif - - DECLARE_ARRAY_DYNAMIC(enc, byte, BENCH_MAX_PENDING, rsaKeySz, HEAP_HINT); + #if !defined(WOLFSSL_MDK5_COMPLv5) + /* MDK5 compiler regard this as a executable statement, and does not allow declarations after the line. */ + DECLARE_ARRAY_DYNAMIC_DEC(enc, byte, BENCH_MAX_PENDING, rsaKeySz, HEAP_HINT); + #else + byte* enc[BENCH_MAX_PENDING]; + int idxenc; + #endif #if !defined(WOLFSSL_RSA_VERIFY_INLINE) && \ !defined(WOLFSSL_RSA_PUBLIC_ONLY) - DECLARE_ARRAY_DYNAMIC(out, byte, BENCH_MAX_PENDING, rsaKeySz, HEAP_HINT); + #if !defined(WOLFSSL_MDK5_COMPLv5) + /* MDK5 compiler regard this as a executable statement, and does not allow declarations after the line. */ + DECLARE_ARRAY_DYNAMIC_DEC(out, byte, BENCH_MAX_PENDING, rsaKeySz, HEAP_HINT); + #else + int idxout; + byte* out[BENCH_MAX_PENDING]; + #endif #else byte* out[BENCH_MAX_PENDING]; #endif + DECLARE_ARRAY_DYNAMIC_EXE(enc, byte, BENCH_MAX_PENDING, rsaKeySz, HEAP_HINT); + #if !defined(WOLFSSL_RSA_VERIFY_INLINE) && \ + !defined(WOLFSSL_RSA_PUBLIC_ONLY) + DECLARE_ARRAY_DYNAMIC_EXE(out, byte, BENCH_MAX_PENDING, rsaKeySz, HEAP_HINT); + #endif + if (!rsa_sign_verify) { #ifndef WOLFSSL_RSA_VERIFY_ONLY /* begin public RSA */ diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index 67265a4b8..e0983161f 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -1418,6 +1418,43 @@ int wolfSSL_CryptHwMutexUnLock(void) { osMutexRelease (*m); return 0; } + +#elif defined(WOLFSSL_CMSIS_RTOSv2) + int wc_InitMutex(wolfSSL_Mutex *m) + { + static const osMutexAttr_t attr = { + "wolfSSL_mutex", osMutexRecursive, NULL, 0}; + + if ((*m = osMutexNew(&attr)) != NULL) + return 0; + else + return BAD_MUTEX_E; + } + + int wc_FreeMutex(wolfSSL_Mutex *m) + { + if (osMutexDelete(*m) == osOK) + return 0; + else + return BAD_MUTEX_E; + } + + + int wc_LockMutex(wolfSSL_Mutex *m) + { + if (osMutexAcquire(*m, osWaitForever) == osOK) + return 0; + else + return BAD_MUTEX_E; + } + + int wc_UnLockMutex(wolfSSL_Mutex *m) + { + if (osMutexRelease(*m) == osOK) + return 0; + else + return BAD_MUTEX_E; + } #elif defined(WOLFSSL_MDK_ARM) diff --git a/wolfssl/internal.h b/wolfssl/internal.h index a8d177d71..fc54466e1 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -149,14 +149,14 @@ /* do nothing */ #elif defined(WOLFSSL_CMSIS_RTOS) #include "cmsis_os.h" +#elif defined(WOLFSSL_CMSIS_RTOSv2) + #include "cmsis_os2.h" #elif defined(WOLFSSL_MDK_ARM) #if defined(WOLFSSL_MDK5) - #include "cmsis_os.h" + #include "cmsis_os.h" #else #include #endif -#elif defined(WOLFSSL_CMSIS_RTOS) - #include "cmsis_os.h" #elif defined(MBED) #elif defined(WOLFSSL_TIRTOS) /* do nothing */ diff --git a/wolfssl/test.h b/wolfssl/test.h index 7bbec9629..b9771ad5f 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -52,18 +52,19 @@ #include #include "rl_net.h" #define SOCKET_T int - typedef int socklen_t ; - static unsigned long inet_addr(const char *cp) + typedef int socklen_t ; + #define inet_addr wolfSSL_inet_addr + static unsigned long wolfSSL_inet_addr(const char *cp) { unsigned int a[4] ; unsigned long ret ; sscanf(cp, "%d.%d.%d.%d", &a[0], &a[1], &a[2], &a[3]) ; ret = ((a[3]<<24) + (a[2]<<16) + (a[1]<<8) + a[0]) ; return(ret) ; } - #if defined(HAVE_KEIL_RTX) - #define sleep(t) os_dly_wait(t/1000+1) ; - #elif defined (WOLFSSL_CMSIS_RTOS) - #define sleep(t) osDelay(t/1000+1) ; + #if defined(HAVE_KEIL_RTX) + #define sleep(t) os_dly_wait(t/1000+1); + #elif defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2) + #define sleep(t) osDelay(t/1000+1); #endif #elif defined(WOLFSSL_TIRTOS) #include diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index e29f8fcbd..8d7bab07e 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -317,9 +317,10 @@ #define FREE_VAR(VAR_NAME, HEAP) /* nothing to free, its stack */ #define FREE_ARRAY(VAR_NAME, VAR_ITEMS, HEAP) /* nothing to free, its stack */ - #define DECLARE_ARRAY_DYNAMIC(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \ + #define DECLARE_ARRAY_DYNAMIC_DEC(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \ VAR_TYPE* VAR_NAME[VAR_ITEMS]; \ - int idx##VAR_NAME; \ + int idx##VAR_NAME; + #define DECLARE_ARRAY_DYNAMIC_EXE(VAR_NAME, VAR_TYPE, VAR_ITEMS, VAR_SIZE, HEAP) \ for (idx##VAR_NAME=0; idx##VAR_NAME #elif (defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET)) - #include "cmsis_os.h" #include "rl_net.h" #include "errno.h" #elif defined(WOLFSSL_CMSIS_RTOS) #include "cmsis_os.h" + #elif defined(WOLFSSL_CMSIS_RTOSv2) + #include "cmsis_os2.h" #elif defined(WOLFSSL_TIRTOS) #include #elif defined(FREERTOS_TCP)