Fixes and cleanups for Keil MDK examples. Combine duplicate user_settings.h. Use SP math all by default. Disable old/deprecated algorithms. Add CMSIS RTOS timer support for TLS and benchmark.

This commit is contained in:
David Garske
2023-06-14 14:20:16 -07:00
committed by Lealem Amedie
parent 3cb0b4ab29
commit a56fe30c2c
43 changed files with 658 additions and 3863 deletions

View File

@ -165,7 +165,7 @@
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#define MDK_CONF_DSA 0
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
@ -204,6 +204,60 @@
// </e>
// </h>
// <h>Math / Memory
// <o> Math Library
// <0=>SP Math All (sp_int.c)
// <1=>Fast Math (tfm.c)
// <2=>Heap Math (integer.c)
// <3=>SP Math (RSA/DH 2048/3072/4096 and ECC 256/384/521 only)
// <4=>SP Math +ASM (faster)
#define MDK_CONF_MATH 0
#if MDK_CONF_MATH == 0
#define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
#elif MDK_CONF_MATH == 1
#define USE_FAST_MATH
#elif MDK_CONF_MATH == 2
#define USE_INTEGER_HEAP_MATH
#elif MDK_CONF_MATH == 3 || MDK_CONF_MATH == 4
#define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
#define WOLFSSL_HAVE_SP_RSA
#define WOLFSSL_HAVE_SP_DH
#define WOLFSSL_HAVE_SP_ECC
//#define WOLFSSL_SP_NO_2048
//#define WOLFSSL_SP_NO_3072
#define WOLFSSL_SP_4096
//#define WOLFSSL_SP_NO_256
//#define WOLFSSL_SP_384
//#define WOLFSSL_SP_521
#define WOLFSSL_SP_SMALL /* use smaller version of code */
//#define WOLFSSL_SP_NO_MALLOC /* do not use heap */
//#define WOLFSSL_SP_CACHE_RESISTANT
//#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
#if MDK_CONF_MATH == 4
/* SP Assembly Speedups - specific to chip type */
#define WOLFSSL_SP_ASM
//#define WOLFSSL_SP_ARM32_ASM
//#define WOLFSSL_SP_ARM64_ASM
//#define WOLFSSL_SP_ARM_THUMB_ASM
//#define WOLFSSL_SP_ARM_CORTEX_M_ASM
#endif
#endif
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
//#define WOLFSSL_SP_NO_MALLOC
#else
#define WOLFSSL_SMALL_STACK
#endif
// </e>
// </h>
// <h>Others
// <e>Inline
@ -253,22 +307,9 @@
#define NO_ERROR_STRINGS
#endif
// </e>
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
#endif
// </e>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 0
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#endif
// </e>
// </h>
//</h>
// <<< end of configuration section >>>

View File

@ -202,7 +202,7 @@
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#define MDK_CONF_DSA 0
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
@ -241,6 +241,60 @@
// </e>
// </h>
// <h>Math / Memory
// <o> Math Library
// <0=>SP Math All (sp_int.c)
// <1=>Fast Math (tfm.c)
// <2=>Heap Math (integer.c)
// <3=>SP Math (RSA/DH 2048/3072/4096 and ECC 256/384/521 only)
// <4=>SP Math +ASM (faster)
#define MDK_CONF_MATH 0
#if MDK_CONF_MATH == 0
#define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
#elif MDK_CONF_MATH == 1
#define USE_FAST_MATH
#elif MDK_CONF_MATH == 2
#define USE_INTEGER_HEAP_MATH
#elif MDK_CONF_MATH == 3 || MDK_CONF_MATH == 4
#define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
#define WOLFSSL_HAVE_SP_RSA
#define WOLFSSL_HAVE_SP_DH
#define WOLFSSL_HAVE_SP_ECC
//#define WOLFSSL_SP_NO_2048
//#define WOLFSSL_SP_NO_3072
#define WOLFSSL_SP_4096
//#define WOLFSSL_SP_NO_256
//#define WOLFSSL_SP_384
//#define WOLFSSL_SP_521
#define WOLFSSL_SP_SMALL /* use smaller version of code */
//#define WOLFSSL_SP_NO_MALLOC /* do not use heap */
//#define WOLFSSL_SP_CACHE_RESISTANT
//#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
#if MDK_CONF_MATH == 4
/* SP Assembly Speedups - specific to chip type */
#define WOLFSSL_SP_ASM
//#define WOLFSSL_SP_ARM32_ASM
//#define WOLFSSL_SP_ARM64_ASM
//#define WOLFSSL_SP_ARM_THUMB_ASM
//#define WOLFSSL_SP_ARM_CORTEX_M_ASM
#endif
#endif
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
//#define WOLFSSL_SP_NO_MALLOC
#else
#define WOLFSSL_SMALL_STACK
#endif
// </e>
// </h>
// <h>Others
// <e>Inline
@ -291,20 +345,6 @@
#endif
// </e>
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
#endif
// </e>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 0
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#endif
// </e>
// </h>
//</h>

View File

@ -224,7 +224,7 @@
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#define MDK_CONF_DSA 0
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
@ -263,6 +263,60 @@
// </e>
// </h>
// <h>Math / Memory
// <o> Math Library
// <0=>SP Math All (sp_int.c)
// <1=>Fast Math (tfm.c)
// <2=>Heap Math (integer.c)
// <3=>SP Math (RSA/DH 2048/3072/4096 and ECC 256/384/521 only)
// <4=>SP Math +ASM (faster)
#define MDK_CONF_MATH 0
#if MDK_CONF_MATH == 0
#define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
#elif MDK_CONF_MATH == 1
#define USE_FAST_MATH
#elif MDK_CONF_MATH == 2
#define USE_INTEGER_HEAP_MATH
#elif MDK_CONF_MATH == 3 || MDK_CONF_MATH == 4
#define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
#define WOLFSSL_HAVE_SP_RSA
#define WOLFSSL_HAVE_SP_DH
#define WOLFSSL_HAVE_SP_ECC
//#define WOLFSSL_SP_NO_2048
//#define WOLFSSL_SP_NO_3072
#define WOLFSSL_SP_4096
//#define WOLFSSL_SP_NO_256
//#define WOLFSSL_SP_384
//#define WOLFSSL_SP_521
#define WOLFSSL_SP_SMALL /* use smaller version of code */
//#define WOLFSSL_SP_NO_MALLOC /* do not use heap */
//#define WOLFSSL_SP_CACHE_RESISTANT
//#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
#if MDK_CONF_MATH == 4
/* SP Assembly Speedups - specific to chip type */
#define WOLFSSL_SP_ASM
//#define WOLFSSL_SP_ARM32_ASM
//#define WOLFSSL_SP_ARM64_ASM
//#define WOLFSSL_SP_ARM_THUMB_ASM
//#define WOLFSSL_SP_ARM_CORTEX_M_ASM
#endif
#endif
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
//#define WOLFSSL_SP_NO_MALLOC
#else
#define WOLFSSL_SMALL_STACK
#endif
// </e>
// </h>
// <h>Others
// <e>Inline
@ -312,22 +366,6 @@
#define NO_ERROR_STRINGS
#endif
// </e>
// <e>Small Stack
#define MDK_CONF_SMALL_STACK 1
#if MDK_CONF_SMALL_STACK == 0
#define NO_WOLFSSL_SMALL_STACK
#endif
// </e>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 1
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
#endif
// </e>
// </h>
//</h>

View File

@ -99,7 +99,7 @@ extern void benchmark_test(void) ;
extern void SER_Init(void) ;
/*-----------------------------------------------------------------------------
* mian entry
* main entry
*----------------------------------------------------------------------------*/
/*** This is the parent task entry ***/

View File

@ -21,21 +21,20 @@
#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 WOLFSSL_IGNORE_FILE_WARN
#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_CURRTIME_OSTICK /* use OS tick for current_time */
#define WOLFSSL_GMTIME
#define NO_MULTIBYTE_PRINT
// <<< Use Configuration Wizard in Context Menu >>>
@ -99,7 +98,7 @@
// <e>File System
#define MDK_CONF_FILESYSTEM 1
#define MDK_CONF_FILESYSTEM 0
#if MDK_CONF_FILESYSTEM == 0
#define NO_FILESYSTEM
#else
@ -109,7 +108,9 @@
// </e>
// <o> Network<0=>None <1=>RLnet <2=>User I/O
#ifndef MDK_CONF_NETWORK
#define MDK_CONF_NETWORK 1
#endif
#if MDK_CONF_NETWORK == 0
#elif MDK_CONF_NETWORK == 1
#define WOLFSSL_KEIL_TCP_NET
@ -150,7 +151,7 @@
// <h> wolfCrypt Configuration
// <h>Hash/Crypt Algrithm
// <h>Hash/Crypt Algorithm
// <e>MD2
#define MDK_CONF_MD2 0
@ -201,7 +202,7 @@
#endif
// </e>
// <e>RIPEMD
#define MDK_CONF_RIPEMD 1
#define MDK_CONF_RIPEMD 0
#if MDK_CONF_RIPEMD == 1
#define WOLFSSL_RIPEMD
#endif
@ -275,7 +276,7 @@
// </e>
// <e>CAMELLIA
#define MDK_CONF_CAMELLIA 1
#define MDK_CONF_CAMELLIA 0
#if MDK_CONF_CAMELLIA == 1
#define HAVE_CAMELLIA
#endif
@ -287,8 +288,19 @@
#define NO_DH
#endif
// </e>
// <e>RSA
#define MDK_CONF_RSA 1
#if MDK_CONF_RSA == 1
/* #define RSA_LOW_MEM */
#else
#define NO_RSA
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#define MDK_CONF_DSA 0
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
@ -297,7 +309,7 @@
// <e>SRP
#define MDK_CONF_SRP 1
#if MDK_CONF_SRP == 1
#define HAVE_SRP
#define WOLFCRYPT_HAVE_SRP
#endif
// </e>
@ -412,7 +424,7 @@
// </e>
// </h>
// <h>Cert/Key Strage
// <h>Cert/Key Storage
// <o>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
@ -432,25 +444,64 @@
#define MDK_CONF_KEY_GEN 0
#if MDK_CONF_KEY_GEN == 1
#define WOLFSSL_KEY_GEN
#define WOLFSSL_OLD_PRIME_CHECK /* use older prime check (faster) */
#endif
// </e>
// </h>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 1
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
// <h>Math / Memory
// <o> Math Library
// <0=>SP Math All (sp_int.c)
// <1=>Fast Math (tfm.c)
// <2=>Heap Math (integer.c)
// <3=>SP Math (RSA/DH 2048/3072/4096 and ECC 256/384/521 only)
// <4=>SP Math +ASM (faster)
#define MDK_CONF_MATH 0
#if MDK_CONF_MATH == 0
#define WOLFSSL_SP_MATH_ALL /* use SP math for all key sizes and curves */
#elif MDK_CONF_MATH == 1
#define USE_FAST_MATH
#elif MDK_CONF_MATH == 2
#define USE_INTEGER_HEAP_MATH
#elif MDK_CONF_MATH == 3 || MDK_CONF_MATH == 4
#define WOLFSSL_SP_MATH /* only SP math - disables integer.c/tfm.c */
#define WOLFSSL_HAVE_SP_RSA
#define WOLFSSL_HAVE_SP_DH
#define WOLFSSL_HAVE_SP_ECC
//#define WOLFSSL_SP_NO_2048
//#define WOLFSSL_SP_NO_3072
#define WOLFSSL_SP_4096
//#define WOLFSSL_SP_NO_256
//#define WOLFSSL_SP_384
//#define WOLFSSL_SP_521
#define WOLFSSL_SP_SMALL /* use smaller version of code */
//#define WOLFSSL_SP_NO_MALLOC /* do not use heap */
//#define WOLFSSL_SP_CACHE_RESISTANT
//#define WOLFSSL_SP_DIV_32 /* do not use 64-bit divides */
#if MDK_CONF_MATH == 4
/* SP Assembly Speedups - specific to chip type */
#define WOLFSSL_SP_ASM
//#define WOLFSSL_SP_ARM32_ASM
//#define WOLFSSL_SP_ARM64_ASM
//#define WOLFSSL_SP_ARM_THUMB_ASM
//#define WOLFSSL_SP_ARM_CORTEX_M_ASM
#endif
#endif
// </e>
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
#define NO_WOLFSSL_SMALL_STACK
#else
#define WOLFSSL_SMALL_STACK
#endif
// </e>
// </e>
// </h>
// </h>
/**** wolfSSL Configuration ****/
@ -465,6 +516,7 @@
#define WC_RSA_PSS
#define HAVE_HKDF
#define HAVE_FFDHE_2048
//#define HAVE_FFDHE_3072
#endif
// </e>

View File

@ -1,4 +1,4 @@
/* wolfssl_KEIL_ARM.h
/* wolfssl_MDK_ARM.h
*
* Copyright (C) 2006-2023 wolfSSL Inc.
*
@ -70,7 +70,7 @@ typedef int socklen_t ;
#define tcp_listen wolfssl_tcp_listen
#define connect(a,b,c) connect(a, (SOCKADDR *)(b), c)
#define SOCKADDR struct sockaddr
/** KEIL-RL TCPnet ****/
/* TCPnet BSD socket does not have following functions. */
extern char *inet_ntoa(struct in_addr in);

View File

@ -233,7 +233,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\RTE\wolfSSL\user_settings.h</PathWithFileName>
<PathWithFileName>..\..\Conf\user_settings.h</PathWithFileName>
<FilenameWithoutPath>user_settings.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>

View File

@ -334,7 +334,7 @@
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls></MiscControls>
<Define>USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS</Define>
<Define>USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS MDK_CONF_NETWORK=0</Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
@ -383,7 +383,7 @@
<File>
<FileName>user_settings.h</FileName>
<FileType>5</FileType>
<FilePath>.\RTE\wolfSSL\user_settings.h</FilePath>
<FilePath>..\..\Conf\user_settings.h</FilePath>
</File>
</Files>
</Group>
@ -791,7 +791,7 @@
<targetInfos/>
</file>
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h" version="3.14.0">
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
<instance index="0">..\..\Conf\user_settings.h</instance>
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.15.7" condition="wolfCrypt-Core"/>
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.4" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.15.7"/>
<targetInfos>

View File

@ -1,497 +0,0 @@
/* user_settings.h
*
* Copyright (C) 2006-2023 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 WOLFSSL_MDK5_COMPLv5
#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 >>>
// <h>Common options
// <o> 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
// <o> Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS<4=>Windows
// <5=>PThread <6=>ThreadX
// <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
// <e>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
// </e>
// <o> Network<0=>None <1=>RLnet <2=>User I/O
#define MDK_CONF_NETWORK 0
#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
// <h>Debug options
// <e>Debug Message
#define MDK_CONF_DebugMessage 0
#if MDK_CONF_DebugMessage == 1
#define DEBUG_WOLFSSL
#endif
// </e>
// <e>Check malloc
#define MDK_CONF_CheckMalloc 1
#if MDK_CONF_CheckMalloc == 1
#define WOLFSSL_MALLOC_CHECK
#define USE_WOLFSSL_MEMORY
#endif
// </e>
// <e>ErrNo.h
#define MDK_CONF_ErrNo 1
#if MDK_CONF_ErrNo == 1
#define HAVE_ERRNO
#endif
// </e>
// <e>Error Strings
#define MDK_CONF_ErrorStrings 1
#if MDK_CONF_ErrorStrings == 0
#define NO_ERROR_STRINGS
#endif
// </e>
//</h>
//</h>
// <h> wolfCrypt Configuration
// <h>Hash/Crypt Algrithm
// <e>MD2
#define MDK_CONF_MD2 0
#if MDK_CONF_MD2 == 1
#define WOLFSSL_MD2
#endif
// </e>
// <e>MD4
#define MDK_CONF_MD4 0
#if MDK_CONF_MD4 == 0
#define NO_MD4
#endif
// </e>
// <e>MD5
#define MDK_CONF_MD5 1
#if MDK_CONF_MD5 == 0
#define NO_MD5
#endif
// </e>
// <e>SHA
#define MDK_CONF_SHA 1
#if MDK_CONF_SHA == 0
#define NO_SHA
#endif
// </e>
// <e>SHA-256
#define MDK_CONF_SHA256 1
#if MDK_CONF_SHA256 == 0
#define NO_SHA256
#endif
// </e>
// <e>SHA-384
#define MDK_CONF_SHA384 1
#if MDK_CONF_SHA384 == 1
#define WOLFSSL_SHA384
#endif
// </e>
// <e>SHA-512
#define MDK_CONF_SHA512 1
#if MDK_CONF_SHA512 == 1
#define WOLFSSL_SHA512
#endif
// </e>
// <e>Hash DRBG
#define MDK_CONF_HASHDRBG 1
#if MDK_CONF_HASHDRBG == 1
#define HAVE_HASHDRBG
#endif
// </e>
// <e>RIPEMD
#define MDK_CONF_RIPEMD 1
#if MDK_CONF_RIPEMD == 1
#define WOLFSSL_RIPEMD
#endif
// </e>
// <e>BLAKE2
#define MDK_CONF_BLAKE2 0
#if MDK_CONF_BLAKE2 == 1
#define HAVE_BLAKE2
#endif
// </e>
// <e>HMAC
#define MDK_CONF_HMAC 1
#if MDK_CONF_HMAC == 0
#define NO_HMAC
#endif
// </e>
// <e>HMAC KDF
#define MDK_CONF_HKDF 1
#if MDK_CONF_HKDF == 1
#define HAVE_HKDF
#endif
// </e>
// <e>AES CCM
#define MDK_CONF_AESCCM 1
#if MDK_CONF_AESCCM == 1
#define HAVE_AESCCM
#endif
// </e>
// <e>AES GCM
#define MDK_CONF_AESGCM 1
#if MDK_CONF_AESGCM == 1
#define HAVE_AESGCM
#endif
// </e>
// <e>RC4
#define MDK_CONF_RC4 0
#if MDK_CONF_RC4 == 0
#define NO_RC4
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1
#define HAVE_CHACHA
#endif
// </e>
// <e>POLY1305
#define MDK_CONF_POLY1305 1
#if MDK_CONF_POLY1305 == 1
#define HAVE_POLY1305
#define HAVE_ONE_TIME_AUTH
#endif
// </e>
// <e>DES3
#define MDK_CONF_DES3 1
#if MDK_CONF_DES3 == 0
#define NO_DES3
#endif
// </e>
// <e>AES
#define MDK_CONF_AES 1
#if MDK_CONF_AES == 0
#define NO_AES
#endif
// </e>
// <e>CAMELLIA
#define MDK_CONF_CAMELLIA 1
#if MDK_CONF_CAMELLIA == 1
#define HAVE_CAMELLIA
#endif
// </e>
// <e>DH
#define MDK_CONF_DH 1
#if MDK_CONF_DH == 0
#define NO_DH
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
// </e>
// <e>SRP
#define MDK_CONF_SRP 1
#if MDK_CONF_SRP == 1
#define HAVE_SRP
#endif
// </e>
// <e>PWDBASED
#define MDK_CONF_PWDBASED 1
#if MDK_CONF_PWDBASED == 0
#define NO_PWDBASED
#endif
// </e>
// <e>ECC
#define MDK_CONF_ECC 1
#if MDK_CONF_ECC == 1
#define HAVE_ECC
#endif
// </e>
// <e>CURVE25519
#define MDK_CONF_CURVE25519 1
#if MDK_CONF_CURVE25519 == 1
#define HAVE_CURVE25519
#define CURVED25519_SMALL
#endif
// </e>
// <e>CURVE25519 SMALL
#define MDK_CONF_CURVE25519_SMALL 0
#if MDK_CONF_CURVE25519_SMALL == 1
#define CURVED25519_SMALL
#endif
// </e>
// <e>ED25519
#define MDK_CONF_ED25519 1
#if MDK_CONF_ED25519 == 1
#define HAVE_ED25519
#endif
// </e>
// <e>ED25519 SMALL
#define MDK_CONF_ED25519_SMALL 0
#if MDK_CONF_ED25519_SMALL == 1
#define ED25519_SMALL
#endif
// </e>
// <e>PKCS7
#define MDK_CONF_PKCS7 0
#if MDK_CONF_PKCS7 == 1
#define HAVE_PKCS7
#endif
// </e>
// </h>
// <e>Random Seed, for TEST Only
#define MDK_CONF_RNDSEED 1
#if MDK_CONF_RNDSEED == 1
#define WOLFSSL_GENSEED_FORTEST
#endif
// </e>
// <h>Hardware Crypt (See document for usage)
// <e>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
// </e>
// <e>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
// </e>
// <e>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
// </e>
// </h>
// <h>Cert/Key Strage
// <o>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
//</h>
// <h>Cert/Key Generation
// <e>CertGen
#define MDK_CONF_CERT_GEN 0
#if MDK_CONF_CERT_GEN == 1
#define WOLFSSL_CERT_GEN
#endif
// </e>
// <e>KeyGen
#define MDK_CONF_KEY_GEN 0
#if MDK_CONF_KEY_GEN == 1
#define WOLFSSL_KEY_GEN
#endif
// </e>
// </h>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 1
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
#endif
// </e>
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
#endif
// </e>
// </h>
/**** wolfSSL Configuration ****/
// <h> wolfSSL Configuration
// <e>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
// </e>
// <e>Include Old TLS
#define MDK_CONF_NO_OLDTLS 0
#if MDK_CONF_NO_OLDTLS == 0
#define NO_OLD_TLS
#endif
// </e>
// <e>CRL
#define MDK_CONF_CRL 0
#if MDK_CONF_CRL == 1
#define HAVE_CRL
#define WOLFSSL_DER_LOAD
#endif
// </e>
// <e>OCSP
#define MDK_CONF_OCSP 0
#if MDK_CONF_OCSP == 1
#define HAVE_OCSP
#endif
// </e>
// <e>OpenSSL Extra
#define MDK_CONF_OPENSSL_EXTRA 0
#if MDK_CONF_OPENSSL_EXTRA == 1
#define OPENSSL_EXTRA
#endif
// </e>
//</h>

View File

@ -37,11 +37,11 @@
#endif
/* Dummy definition for test RTC */
#define RTC_YEAR 2019
#define RTC_YEAR 2023
#define RTC_MONTH 1
#define RTC_DAY 1
#define RTC_DAY 1
#define RTC_MONTH 1
#define RTC_DAY 1
#define RTC_DAY 1
#if defined(STM32F7xx)
#include "stm32f7xx_hal.h"
@ -72,22 +72,22 @@ 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
#if defined(WOLFSSL_CMSIS_RTOS)
return os_time;
#elif defined(WOLFSSL_CMSIS_RTOSv2)
return osKernelGetTickCount();
#endif
}
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
#if defined(WOLFSSL_CMSIS_RTOS)
return (double)os_time / 1000.0;
#elif defined(WOLFSSL_CMSIS_RTOSv2)
return (double)osKernelGetTickCount() / 1000.0;
#endif
}
#else
@ -96,28 +96,28 @@ double current_time(int reset)
#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 */
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 ;
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;
return epochTime;
}
void setTime(time_t t)
{
epochTime = t;
epochTime = t;
}
/*-----------------------------------------------------------------------------
@ -126,48 +126,51 @@ void setTime(time_t t)
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
static void init_filesystem (void) {
int32_t retv;
static void init_filesystem(void)
{
int32_t retv;
retv = finit ("M0:");
if (retv == fsOK) {
retv = fmount ("M0:");
retv = finit ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
retv = fmount ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
}
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
printf ("Drive M0 initialization failed!\n");
}
}
else {
printf ("Drive M0 initialization failed!\n");
}
}
#endif
/*-----------------------------------------------------------------------------
* mian entry
* main entry
*----------------------------------------------------------------------------*/
void benchmark_test(void *arg) ;
void benchmark_test(void *arg);
int main()
{
void * arg = NULL ;
MPU_Config();
void * arg = NULL;
MPU_Config();
CPU_CACHE_Enable();
HAL_Init(); /* Initialize the HAL Library */
SystemClock_Config(); /* Configure the System Clock */
#if !defined(NO_FILESYSTEM)
#if !defined(NO_FILESYSTEM)
init_filesystem ();
#endif
setTime((RTC_YEAR-1970)*365*24*60*60 + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60);
#endif
printf("=== Start: Crypt Benchmark ===\n") ;
benchmark_test(arg) ;
printf("=== End: Crypt Benchmark ===\n") ;
setTime((RTC_YEAR-1970)*365*24*60*60 +
RTC_MONTH*30*24*60*60 +
RTC_DAY*24*60*60);
printf("=== Start: Crypt Benchmark ===\n");
benchmark_test(arg);
printf("=== End: Crypt Benchmark ===\n");
return 0;
}

View File

@ -298,7 +298,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\RTE\wolfSSL\user_settings.h</PathWithFileName>
<PathWithFileName>..\..\Conf\user_settings.h</PathWithFileName>
<FilenameWithoutPath>user_settings.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>

View File

@ -334,7 +334,7 @@
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls></MiscControls>
<Define>USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS</Define>
<Define>USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS MDK_CONF_NETWORK=0</Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
@ -413,7 +413,7 @@
<File>
<FileName>user_settings.h</FileName>
<FileType>5</FileType>
<FilePath>.\RTE\wolfSSL\user_settings.h</FilePath>
<FilePath>..\..\Conf\user_settings.h</FilePath>
</File>
</Files>
</Group>
@ -760,14 +760,8 @@
<package name="MDK-Middleware" schemaVersion="1.4" url="http://www.keil.com/pack/" vendor="Keil" version="7.4.1"/>
<targetInfos/>
</file>
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\config-Crypt.h">
<instance index="0" removed="1">RTE\wolfSSL\config-Crypt.h</instance>
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="" condition="wolfCrypt-Core"/>
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.4" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.13.0"/>
<targetInfos/>
</file>
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h" version="3.14.0">
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
<instance index="0">..\..\Conf\user_settings.h</instance>
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.15.7" condition="wolfCrypt-Core"/>
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.4" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.15.7"/>
<targetInfos>

View File

@ -1,497 +0,0 @@
/* user_settings.h
*
* Copyright (C) 2006-2023 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 >>>
// <h>Common options
// <o> 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
// <o> Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
// <5=>PThread <6=>ThreadX
// <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
// <e>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
// </e>
// <o> Network<0=>None <1=>RLnet <2=>User I/O
#define MDK_CONF_NETWORK 0
#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
// <h>Debug options
// <e>Debug Message
#define MDK_CONF_DebugMessage 0
#if MDK_CONF_DebugMessage == 1
#define DEBUG_WOLFSSL
#endif
// </e>
// <e>Check malloc
#define MDK_CONF_CheckMalloc 1
#if MDK_CONF_CheckMalloc == 1
#define WOLFSSL_MALLOC_CHECK
#define USE_WOLFSSL_MEMORY
#endif
// </e>
// <e>ErrNo.h
#define MDK_CONF_ErrNo 1
#if MDK_CONF_ErrNo == 1
#define HAVE_ERRNO
#endif
// </e>
// <e>Error Strings
#define MDK_CONF_ErrorStrings 1
#if MDK_CONF_ErrorStrings == 0
#define NO_ERROR_STRINGS
#endif
// </e>
//</h>
//</h>
// <h> wolfCrypt Configuration
// <h>Hash/Crypt Algrithm
// <e>MD2
#define MDK_CONF_MD2 0
#if MDK_CONF_MD2 == 1
#define WOLFSSL_MD2
#endif
// </e>
// <e>MD4
#define MDK_CONF_MD4 0
#if MDK_CONF_MD4 == 0
#define NO_MD4
#endif
// </e>
// <e>MD5
#define MDK_CONF_MD5 1
#if MDK_CONF_MD5 == 0
#define NO_MD5
#endif
// </e>
// <e>SHA
#define MDK_CONF_SHA 1
#if MDK_CONF_SHA == 0
#define NO_SHA
#endif
// </e>
// <e>SHA-256
#define MDK_CONF_SHA256 1
#if MDK_CONF_SHA256 == 0
#define NO_SHA256
#endif
// </e>
// <e>SHA-384
#define MDK_CONF_SHA384 1
#if MDK_CONF_SHA384 == 1
#define WOLFSSL_SHA384
#endif
// </e>
// <e>SHA-512
#define MDK_CONF_SHA512 1
#if MDK_CONF_SHA512 == 1
#define WOLFSSL_SHA512
#endif
// </e>
// <e>Hash DRBG
#define MDK_CONF_HASHDRBG 1
#if MDK_CONF_HASHDRBG == 1
#define HAVE_HASHDRBG
#endif
// </e>
// <e>RIPEMD
#define MDK_CONF_RIPEMD 1
#if MDK_CONF_RIPEMD == 1
#define WOLFSSL_RIPEMD
#endif
// </e>
// <e>BLAKE2
#define MDK_CONF_BLAKE2 0
#if MDK_CONF_BLAKE2 == 1
#define HAVE_BLAKE2
#endif
// </e>
// <e>HMAC
#define MDK_CONF_HMAC 1
#if MDK_CONF_HMAC == 0
#define NO_HMAC
#endif
// </e>
// <e>HMAC KDF
#define MDK_CONF_HKDF 1
#if MDK_CONF_HKDF == 1
#define HAVE_HKDF
#endif
// </e>
// <e>AES CCM
#define MDK_CONF_AESCCM 1
#if MDK_CONF_AESCCM == 1
#define HAVE_AESCCM
#endif
// </e>
// <e>AES GCM
#define MDK_CONF_AESGCM 1
#if MDK_CONF_AESGCM == 1
#define HAVE_AESGCM
#endif
// </e>
// <e>RC4
#define MDK_CONF_RC4 0
#if MDK_CONF_RC4 == 0
#define NO_RC4
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1
#define HAVE_CHACHA
#endif
// </e>
// <e>POLY1305
#define MDK_CONF_POLY1305 1
#if MDK_CONF_POLY1305 == 1
#define HAVE_POLY1305
#define HAVE_ONE_TIME_AUTH
#endif
// </e>
// <e>DES3
#define MDK_CONF_DES3 1
#if MDK_CONF_DES3 == 0
#define NO_DES3
#endif
// </e>
// <e>AES
#define MDK_CONF_AES 1
#if MDK_CONF_AES == 0
#define NO_AES
#endif
// </e>
// <e>CAMELLIA
#define MDK_CONF_CAMELLIA 1
#if MDK_CONF_CAMELLIA == 1
#define HAVE_CAMELLIA
#endif
// </e>
// <e>DH
#define MDK_CONF_DH 1
#if MDK_CONF_DH == 0
#define NO_DH
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
// </e>
// <e>SRP
#define MDK_CONF_SRP 1
#if MDK_CONF_SRP == 1
#define HAVE_SRP
#endif
// </e>
// <e>PWDBASED
#define MDK_CONF_PWDBASED 1
#if MDK_CONF_PWDBASED == 0
#define NO_PWDBASED
#endif
// </e>
// <e>ECC
#define MDK_CONF_ECC 1
#if MDK_CONF_ECC == 1
#define HAVE_ECC
#endif
// </e>
// <e>CURVE25519
#define MDK_CONF_CURVE25519 1
#if MDK_CONF_CURVE25519 == 1
#define HAVE_CURVE25519
#define CURVED25519_SMALL
#endif
// </e>
// <e>CURVE25519 SMALL
#define MDK_CONF_CURVE25519_SMALL 0
#if MDK_CONF_CURVE25519_SMALL == 1
#define CURVED25519_SMALL
#endif
// </e>
// <e>ED25519
#define MDK_CONF_ED25519 1
#if MDK_CONF_ED25519 == 1
#define HAVE_ED25519
#endif
// </e>
// <e>ED25519 SMALL
#define MDK_CONF_ED25519_SMALL 0
#if MDK_CONF_ED25519_SMALL == 1
#define ED25519_SMALL
#endif
// </e>
// <e>PKCS7
#define MDK_CONF_PKCS7 0
#if MDK_CONF_PKCS7 == 1
#define HAVE_PKCS7
#endif
// </e>
// </h>
// <e>Random Seed, for TEST Only
#define MDK_CONF_RNDSEED 1
#if MDK_CONF_RNDSEED == 1
#define WOLFSSL_GENSEED_FORTEST
#endif
// </e>
// <h>Hardware Crypt (See document for usage)
// <e>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
// </e>
// <e>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
// </e>
// <e>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
// </e>
// </h>
// <h>Cert/Key Strage
// <o>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
//</h>
// <h>Cert/Key Generation
// <e>CertGen
#define MDK_CONF_CERT_GEN 0
#if MDK_CONF_CERT_GEN == 1
#define WOLFSSL_CERT_GEN
#endif
// </e>
// <e>KeyGen
#define MDK_CONF_KEY_GEN 0
#if MDK_CONF_KEY_GEN == 1
#define WOLFSSL_KEY_GEN
#endif
// </e>
// </h>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 1
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
#endif
// </e>
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
#endif
// </e>
// </h>
/**** wolfSSL Configuration ****/
// <h> wolfSSL Configuration
// <e>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
// </e>
// <e>Include Old TLS
#define MDK_CONF_NO_OLDTLS 0
#if MDK_CONF_NO_OLDTLS == 0
#define NO_OLD_TLS
#endif
// </e>
// <e>CRL
#define MDK_CONF_CRL 0
#if MDK_CONF_CRL == 1
#define HAVE_CRL
#define WOLFSSL_DER_LOAD
#endif
// </e>
// <e>OCSP
#define MDK_CONF_OCSP 0
#if MDK_CONF_OCSP == 1
#define HAVE_OCSP
#endif
// </e>
// <e>OpenSSL Extra
#define MDK_CONF_OPENSSL_EXTRA 0
#if MDK_CONF_OPENSSL_EXTRA == 1
#define OPENSSL_EXTRA
#endif
// </e>
//</h>

View File

@ -34,9 +34,9 @@
#include "cmsis_os2.h"
#endif
/* Dummy definition for test RTC */
#define RTC_YEAR 2019
#define RTC_YEAR 2023
#define RTC_MONTH 1
#define RTC_DAY 1
#define RTC_DAY 1
#if defined(STM32F7xx)
#include "stm32f7xx_hal.h"
@ -65,19 +65,19 @@ 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
#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 ;
time_t time(time_t *t) {
return epochTime;
}
void setTime(time_t t){
void setTime(time_t t) {
epochTime = t;
}
@ -87,48 +87,52 @@ void setTime(time_t t){
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
static void init_filesystem (void) {
int32_t retv;
static void init_filesystem(void)
{
int32_t retv;
retv = finit ("M0:");
if (retv == fsOK) {
retv = fmount ("M0:");
retv = finit ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
retv = fmount ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
}
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
printf ("Drive M0 initialization failed!\n");
}
}
else {
printf ("Drive M0 initialization failed!\n");
}
}
#endif
/*-----------------------------------------------------------------------------
* mian entry
* main entry
*----------------------------------------------------------------------------*/
void wolfcrypt_test(void *arg) ;
void wolfcrypt_test(void *arg);
int main()
{
void * arg = NULL ;
void * arg = NULL;
MPU_Config();
MPU_Config();
CPU_CACHE_Enable();
HAL_Init(); /* Initialize the HAL Library */
SystemClock_Config(); /* Configure the System Clock */
#if !defined(NO_FILESYSTEM)
#if !defined(NO_FILESYSTEM)
init_filesystem ();
#endif
#endif
setTime((RTC_YEAR-1970)*365*24*60*60 + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60);
setTime((RTC_YEAR-1970)*365*24*60*60 +
RTC_MONTH*30*24*60*60 +
RTC_DAY*24*60*60);
printf("=== Start: Crypt test === \n") ;
wolfcrypt_test(arg) ;
printf("=== End: Crypt test ===\n") ;
printf("=== Start: Crypt test === \n");
wolfcrypt_test(arg);
printf("=== End: Crypt test ===\n");
return 0;
}

View File

@ -328,7 +328,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\RTE\wolfSSL\user_settings.h</PathWithFileName>
<PathWithFileName>..\..\Conf\user_settings.h</PathWithFileName>
<FilenameWithoutPath>user_settings.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>

View File

@ -413,7 +413,7 @@
<File>
<FileName>user_settings.h</FileName>
<FileType>5</FileType>
<FilePath>.\RTE\wolfSSL\user_settings.h</FilePath>
<FilePath>..\..\Conf\user_settings.h</FilePath>
</File>
</Files>
</Group>
@ -880,7 +880,7 @@
<targetInfos/>
</file>
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h" version="3.14.0">
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
<instance index="0">..\..\Conf\user_settings.h</instance>
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.15.7" condition="wolfCrypt-Core"/>
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.4" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.15.7"/>
<targetInfos>

View File

@ -1,495 +0,0 @@
/* user_settings.h
*
* Copyright (C) 2006-2023 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 >>>
// <h>Common options
// <o> 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
// <o> Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
// <5=>PThread <6=>ThreadX
// <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 SINGLE_THREADED
#endif
// <e>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
// </e>
// <o> 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
// <h>Debug options
// <e>Debug Message
#define MDK_CONF_DebugMessage 0
#if MDK_CONF_DebugMessage == 1
#define DEBUG_WOLFSSL
#endif
// </e>
// <e>Check malloc
#define MDK_CONF_CheckMalloc 1
#if MDK_CONF_CheckMalloc == 1
#define WOLFSSL_MALLOC_CHECK
#define USE_WOLFSSL_MEMORY
#endif
// </e>
// <e>ErrNo.h
#define MDK_CONF_ErrNo 1
#if MDK_CONF_ErrNo == 1
#define HAVE_ERRNO
#endif
// </e>
// <e>Error Strings
#define MDK_CONF_ErrorStrings 1
#if MDK_CONF_ErrorStrings == 0
#define NO_ERROR_STRINGS
#endif
// </e>
//</h>
//</h>
// <h> wolfCrypt Configuration
// <h>Hash/Crypt Algrithm
// <e>MD2
#define MDK_CONF_MD2 0
#if MDK_CONF_MD2 == 1
#define WOLFSSL_MD2
#endif
// </e>
// <e>MD4
#define MDK_CONF_MD4 0
#if MDK_CONF_MD4 == 0
#define NO_MD4
#endif
// </e>
// <e>MD5
#define MDK_CONF_MD5 1
#if MDK_CONF_MD5 == 0
#define NO_MD5
#endif
// </e>
// <e>SHA
#define MDK_CONF_SHA 1
#if MDK_CONF_SHA == 0
#define NO_SHA
#endif
// </e>
// <e>SHA-256
#define MDK_CONF_SHA256 1
#if MDK_CONF_SHA256 == 0
#define NO_SHA256
#endif
// </e>
// <e>SHA-384
#define MDK_CONF_SHA384 1
#if MDK_CONF_SHA384 == 1
#define WOLFSSL_SHA384
#endif
// </e>
// <e>SHA-512
#define MDK_CONF_SHA512 1
#if MDK_CONF_SHA512 == 1
#define WOLFSSL_SHA512
#endif
// </e>
// <e>Hash DRBG
#define MDK_CONF_HASHDRBG 1
#if MDK_CONF_HASHDRBG == 1
#define HAVE_HASHDRBG
#endif
// </e>
// <e>RIPEMD
#define MDK_CONF_RIPEMD 1
#if MDK_CONF_RIPEMD == 1
#define WOLFSSL_RIPEMD
#endif
// </e>
// <e>BLAKE2
#define MDK_CONF_BLAKE2 0
#if MDK_CONF_BLAKE2 == 1
#define HAVE_BLAKE2
#endif
// </e>
// <e>HMAC
#define MDK_CONF_HMAC 1
#if MDK_CONF_HMAC == 0
#define NO_HMAC
#endif
// </e>
// <e>HMAC KDF
#define MDK_CONF_HKDF 1
#if MDK_CONF_HKDF == 1
#define HAVE_HKDF
#endif
// </e>
// <e>AES CCM
#define MDK_CONF_AESCCM 1
#if MDK_CONF_AESCCM == 1
#define HAVE_AESCCM
#endif
// </e>
// <e>AES GCM
#define MDK_CONF_AESGCM 1
#if MDK_CONF_AESGCM == 1
#define HAVE_AESGCM
#endif
// </e>
// <e>RC4
#define MDK_CONF_RC4 0
#if MDK_CONF_RC4 == 0
#define NO_RC4
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1
#define HAVE_CHACHA
#endif
// </e>
// <e>POLY1305
#define MDK_CONF_POLY1305 1
#if MDK_CONF_POLY1305 == 1
#define HAVE_POLY1305
#define HAVE_ONE_TIME_AUTH
#endif
// </e>
// <e>DES3
#define MDK_CONF_DES3 1
#if MDK_CONF_DES3 == 0
#define NO_DES3
#endif
// </e>
// <e>AES
#define MDK_CONF_AES 1
#if MDK_CONF_AES == 0
#define NO_AES
#endif
// </e>
// <e>CAMELLIA
#define MDK_CONF_CAMELLIA 1
#if MDK_CONF_CAMELLIA == 1
#define HAVE_CAMELLIA
#endif
// </e>
// <e>DH
#define MDK_CONF_DH 1
#if MDK_CONF_DH == 0
#define NO_DH
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
// </e>
// <e>SRP
#define MDK_CONF_SRP 1
#if MDK_CONF_SRP == 1
#define HAVE_SRP
#endif
// </e>
// <e>PWDBASED
#define MDK_CONF_PWDBASED 1
#if MDK_CONF_PWDBASED == 0
#define NO_PWDBASED
#endif
// </e>
// <e>ECC
#define MDK_CONF_ECC 1
#if MDK_CONF_ECC == 1
#define HAVE_ECC
#endif
// </e>
// <e>CURVE25519
#define MDK_CONF_CURVE25519 1
#if MDK_CONF_CURVE25519 == 1
#define HAVE_CURVE25519
#define CURVED25519_SMALL
#endif
// </e>
// <e>CURVE25519 SMALL
#define MDK_CONF_CURVE25519_SMALL 0
#if MDK_CONF_CURVE25519_SMALL == 1
#define CURVED25519_SMALL
#endif
// </e>
// <e>ED25519
#define MDK_CONF_ED25519 1
#if MDK_CONF_ED25519 == 1
#define HAVE_ED25519
#endif
// </e>
// <e>ED25519 SMALL
#define MDK_CONF_ED25519_SMALL 0
#if MDK_CONF_ED25519_SMALL == 1
#define ED25519_SMALL
#endif
// </e>
// <e>PKCS7
#define MDK_CONF_PKCS7 0
#if MDK_CONF_PKCS7 == 1
#define HAVE_PKCS7
#endif
// </e>
// </h>
// <e>Random Seed, for TEST Only
#define MDK_CONF_RNDSEED 1
#if MDK_CONF_RNDSEED == 1
#define WOLFSSL_GENSEED_FORTEST
#endif
// </e>
// <h>Hardware Crypt (See document for usage)
// <e>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
// </e>
// <e>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
// </e>
// <e>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
// </e>
// </h>
// <h>Cert/Key Strage
// <o>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
//</h>
// <h>Cert/Key Generation
// <e>CertGen
#define MDK_CONF_CERT_GEN 0
#if MDK_CONF_CERT_GEN == 1
#define WOLFSSL_CERT_GEN
#endif
// </e>
// <e>KeyGen
#define MDK_CONF_KEY_GEN 0
#if MDK_CONF_KEY_GEN == 1
#define WOLFSSL_KEY_GEN
#endif
// </e>
// </h>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 1
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
#endif
// </e>
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
#endif
// </e>
// </h>
/**** wolfSSL Configuration ****/
// <h> wolfSSL Configuration
// <e>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
// </e>
// <e>Include Old TLS
#define MDK_CONF_NO_OLDTLS 0
#if MDK_CONF_NO_OLDTLS == 0
#define NO_OLD_TLS
#endif
// </e>
// <e>CRL
#define MDK_CONF_CRL 0
#if MDK_CONF_CRL == 1
#define HAVE_CRL
#define WOLFSSL_DER_LOAD
#endif
// </e>
// <e>OCSP
#define MDK_CONF_OCSP 0
#if MDK_CONF_OCSP == 1
#define HAVE_OCSP
#endif
// </e>
// <e>OpenSSL Extra
#define MDK_CONF_OPENSSL_EXTRA 0
#if MDK_CONF_OPENSSL_EXTRA == 1
#define OPENSSL_EXTRA
#endif
// </e>
//</h>

View File

@ -26,7 +26,7 @@
#include "wolfssl/wolfcrypt/settings.h"
#include "cmsis_os.h" /* CMSIS RTOS definitions */
#include "rl_net.h" /* Network definitions */
#include "rl_net.h" /* Network definitions */
#include <time.h>
#if defined(STM32F7xx)
@ -40,12 +40,9 @@
//-------- <<< Use Configuration Wizard in Context Menu >>> -----------------
// <h>RTC: for validate certificate date
// <o>Year <1970-2099>
#define RTC_YEAR 2018
// <o>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 2023
#define RTC_MONTH 1
// <o>Day <1-31>
#define RTC_DAY 1
#define RTC_DAY 1
// </h>
//------------- <<< end of configuration section >>> -----------------------
@ -69,29 +66,30 @@ static void CPU_CACHE_Enable (void) {
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
static void init_filesystem (void) {
int32_t retv;
static void init_filesystem(void)
{
int32_t retv;
retv = finit ("M0:");
if (retv == fsOK) {
retv = fmount ("M0:");
retv = finit ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
retv = fmount ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
}
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
printf ("Drive M0 initialization failed!\n");
}
}
else {
printf ("Drive M0 initialization failed!\n");
}
}
#endif
void net_loop(void const *arg)
{
while(1) {
while (1) {
net_main ();
osThreadYield ();
}
@ -103,8 +101,8 @@ osThreadDef(net_loop, osPriorityLow, 2, 0);
extern uint32_t os_time;
static time_t epochTime;
uint32_t HAL_GetTick(void) {
return os_time;
uint32_t HAL_GetTick(void) {
return os_time;
}
time_t time(time_t *t){
@ -133,15 +131,15 @@ double current_time(int reset)
#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 */
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 ;
if (reset) DWT->CYCCNT = 0 ;
return ((double)DWT->CYCCNT/SystemCoreClock) ;
}
#endif
@ -160,20 +158,21 @@ extern void echoclient_test(func_args * args) ;
int myoptind = 0;
char* myoptarg = NULL;
int main (void) {
int main (void)
{
static char *argv[] =
{ "client" } ;
static func_args args =
{ 1, argv } ;
MPU_Config(); /* Configure the MPU */
CPU_CACHE_Enable(); /* Enable the CPU Cache */
HAL_Init(); /* Initialize the HAL Library */
SystemClock_Config(); /* Configure the System Clock */
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(NO_FILESYSTEM)
#if !defined(NO_FILESYSTEM)
init_filesystem ();
#endif
#endif
net_initialize ();
#if defined(DEBUG_WOLFSSL)
@ -181,14 +180,15 @@ int main (void) {
wolfSSL_Debugging_ON() ;
#endif
setTime((RTC_YEAR-1970)*365*24*60*60 + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60);
setTime((RTC_YEAR-1970)*365*24*60*60 +
RTC_MONTH*30*24*60*60 +
RTC_DAY*24*60*60);
osThreadCreate (osThread(net_loop), NULL);
echoclient_test(&args) ;
while(1)
while (1) {
osDelay(1000);
}
}

View File

@ -279,7 +279,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\RTE\wolfSSL\user_settings.h</PathWithFileName>
<PathWithFileName>..\..\Conf\user_settings.h</PathWithFileName>
<FilenameWithoutPath>user_settings.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>

View File

@ -413,7 +413,7 @@
<File>
<FileName>user_settings.h</FileName>
<FileType>5</FileType>
<FilePath>.\RTE\wolfSSL\user_settings.h</FilePath>
<FilePath>..\..\Conf\user_settings.h</FilePath>
</File>
</Files>
</Group>
@ -886,7 +886,7 @@
<targetInfos/>
</file>
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h" version="3.14.0">
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
<instance index="0">..\..\Conf\user_settings.h</instance>
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.15.7" condition="wolfCrypt-Core"/>
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.4" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.15.7"/>
<targetInfos>

View File

@ -1,497 +0,0 @@
/* user_settings.h
*
* Copyright (C) 2006-2023 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 >>>
// <h>Common options
// <o> 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
// <o> Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
// <5=>PThread <6=>ThreadX
// <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
// <e>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
// </e>
// <o> 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
// <h>Debug options
// <e>Debug Message
#define MDK_CONF_DebugMessage 0
#if MDK_CONF_DebugMessage == 1
#define DEBUG_WOLFSSL
#endif
// </e>
// <e>Check malloc
#define MDK_CONF_CheckMalloc 1
#if MDK_CONF_CheckMalloc == 1
#define WOLFSSL_MALLOC_CHECK
#define USE_WOLFSSL_MEMORY
#endif
// </e>
// <e>ErrNo.h
#define MDK_CONF_ErrNo 1
#if MDK_CONF_ErrNo == 1
#define HAVE_ERRNO
#endif
// </e>
// <e>Error Strings
#define MDK_CONF_ErrorStrings 1
#if MDK_CONF_ErrorStrings == 0
#define NO_ERROR_STRINGS
#endif
// </e>
//</h>
//</h>
// <h> wolfCrypt Configuration
// <h>Hash/Crypt Algrithm
// <e>MD2
#define MDK_CONF_MD2 0
#if MDK_CONF_MD2 == 1
#define WOLFSSL_MD2
#endif
// </e>
// <e>MD4
#define MDK_CONF_MD4 0
#if MDK_CONF_MD4 == 0
#define NO_MD4
#endif
// </e>
// <e>MD5
#define MDK_CONF_MD5 1
#if MDK_CONF_MD5 == 0
#define NO_MD5
#endif
// </e>
// <e>SHA
#define MDK_CONF_SHA 1
#if MDK_CONF_SHA == 0
#define NO_SHA
#endif
// </e>
// <e>SHA-256
#define MDK_CONF_SHA256 1
#if MDK_CONF_SHA256 == 0
#define NO_SHA256
#endif
// </e>
// <e>SHA-384
#define MDK_CONF_SHA384 1
#if MDK_CONF_SHA384 == 1
#define WOLFSSL_SHA384
#endif
// </e>
// <e>SHA-512
#define MDK_CONF_SHA512 1
#if MDK_CONF_SHA512 == 1
#define WOLFSSL_SHA512
#endif
// </e>
// <e>Hash DRBG
#define MDK_CONF_HASHDRBG 1
#if MDK_CONF_HASHDRBG == 1
#define HAVE_HASHDRBG
#endif
// </e>
// <e>RIPEMD
#define MDK_CONF_RIPEMD 1
#if MDK_CONF_RIPEMD == 1
#define WOLFSSL_RIPEMD
#endif
// </e>
// <e>BLAKE2
#define MDK_CONF_BLAKE2 0
#if MDK_CONF_BLAKE2 == 1
#define HAVE_BLAKE2
#endif
// </e>
// <e>HMAC
#define MDK_CONF_HMAC 1
#if MDK_CONF_HMAC == 0
#define NO_HMAC
#endif
// </e>
// <e>HMAC KDF
#define MDK_CONF_HKDF 1
#if MDK_CONF_HKDF == 1
#define HAVE_HKDF
#endif
// </e>
// <e>AES CCM
#define MDK_CONF_AESCCM 1
#if MDK_CONF_AESCCM == 1
#define HAVE_AESCCM
#endif
// </e>
// <e>AES GCM
#define MDK_CONF_AESGCM 1
#if MDK_CONF_AESGCM == 1
#define HAVE_AESGCM
#endif
// </e>
// <e>RC4
#define MDK_CONF_RC4 0
#if MDK_CONF_RC4 == 0
#define NO_RC4
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1
#define HAVE_CHACHA
#endif
// </e>
// <e>POLY1305
#define MDK_CONF_POLY1305 1
#if MDK_CONF_POLY1305 == 1
#define HAVE_POLY1305
#define HAVE_ONE_TIME_AUTH
#endif
// </e>
// <e>DES3
#define MDK_CONF_DES3 1
#if MDK_CONF_DES3 == 0
#define NO_DES3
#endif
// </e>
// <e>AES
#define MDK_CONF_AES 1
#if MDK_CONF_AES == 0
#define NO_AES
#endif
// </e>
// <e>CAMELLIA
#define MDK_CONF_CAMELLIA 1
#if MDK_CONF_CAMELLIA == 1
#define HAVE_CAMELLIA
#endif
// </e>
// <e>DH
#define MDK_CONF_DH 1
#if MDK_CONF_DH == 0
#define NO_DH
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
// </e>
// <e>SRP
#define MDK_CONF_SRP 1
#if MDK_CONF_SRP == 1
#define HAVE_SRP
#endif
// </e>
// <e>PWDBASED
#define MDK_CONF_PWDBASED 1
#if MDK_CONF_PWDBASED == 0
#define NO_PWDBASED
#endif
// </e>
// <e>ECC
#define MDK_CONF_ECC 1
#if MDK_CONF_ECC == 1
#define HAVE_ECC
#endif
// </e>
// <e>CURVE25519
#define MDK_CONF_CURVE25519 1
#if MDK_CONF_CURVE25519 == 1
#define HAVE_CURVE25519
#define CURVED25519_SMALL
#endif
// </e>
// <e>CURVE25519 SMALL
#define MDK_CONF_CURVE25519_SMALL 0
#if MDK_CONF_CURVE25519_SMALL == 1
#define CURVED25519_SMALL
#endif
// </e>
// <e>ED25519
#define MDK_CONF_ED25519 1
#if MDK_CONF_ED25519 == 1
#define HAVE_ED25519
#endif
// </e>
// <e>ED25519 SMALL
#define MDK_CONF_ED25519_SMALL 0
#if MDK_CONF_ED25519_SMALL == 1
#define ED25519_SMALL
#endif
// </e>
// <e>PKCS7
#define MDK_CONF_PKCS7 0
#if MDK_CONF_PKCS7 == 1
#define HAVE_PKCS7
#endif
// </e>
// </h>
// <e>Random Seed, for TEST Only
#define MDK_CONF_RNDSEED 1
#if MDK_CONF_RNDSEED == 1
#define WOLFSSL_GENSEED_FORTEST
#endif
// </e>
// <h>Hardware Crypt (See document for usage)
// <e>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
// </e>
// <e>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
// </e>
// <e>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
// </e>
// </h>
// <h>Cert/Key Strage
// <o>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
//</h>
// <h>Cert/Key Generation
// <e>CertGen
#define MDK_CONF_CERT_GEN 0
#if MDK_CONF_CERT_GEN == 1
#define WOLFSSL_CERT_GEN
#endif
// </e>
// <e>KeyGen
#define MDK_CONF_KEY_GEN 0
#if MDK_CONF_KEY_GEN == 1
#define WOLFSSL_KEY_GEN
#endif
// </e>
// </h>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 1
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
#endif
// </e>
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
#endif
// </e>
// </h>
/**** wolfSSL Configuration ****/
// <h> wolfSSL Configuration
// <e>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
// </e>
// <e>Include Old TLS
#define MDK_CONF_NO_OLDTLS 0
#if MDK_CONF_NO_OLDTLS == 0
#define NO_OLD_TLS
#endif
// </e>
// <e>CRL
#define MDK_CONF_CRL 0
#if MDK_CONF_CRL == 1
#define HAVE_CRL
#define WOLFSSL_DER_LOAD
#endif
// </e>
// <e>OCSP
#define MDK_CONF_OCSP 0
#if MDK_CONF_OCSP == 1
#define HAVE_OCSP
#endif
// </e>
// <e>OpenSSL Extra
#define MDK_CONF_OPENSSL_EXTRA 0
#if MDK_CONF_OPENSSL_EXTRA == 1
#define OPENSSL_EXTRA
#endif
// </e>
//</h>

View File

@ -26,7 +26,7 @@
#include "wolfssl/wolfcrypt/settings.h"
#include "cmsis_os.h" /* CMSIS RTOS definitions */
#include "rl_net.h" /* Network definitions */
#include "rl_net.h" /* Network definitions */
#include <time.h>
#if defined(STM32F7xx)
@ -58,12 +58,9 @@
// </h>
// <h>RTC: for validate certificate date
// <o>Year <1970-2099>
#define RTC_YEAR 2018
// <o>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 2023
#define RTC_MONTH 1
// <o>Day <1-31>
#define RTC_DAY 1
#define RTC_DAY 1
// </h>
//------------- <<< end of configuration section >>> -----------------------
@ -88,22 +85,23 @@ static void CPU_CACHE_Enable (void) {
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
static void init_filesystem (void) {
int32_t retv;
static void init_filesystem(void)
{
int32_t retv;
retv = finit ("M0:");
if (retv == fsOK) {
retv = fmount ("M0:");
retv = finit ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
retv = fmount ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
}
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
printf ("Drive M0 initialization failed!\n");
}
}
else {
printf ("Drive M0 initialization failed!\n");
}
}
#endif
@ -120,20 +118,20 @@ osThreadDef(net_loop, osPriorityLow, 2, 0);
#ifdef RTE_CMSIS_RTOS_RTX
extern uint32_t os_time;
static time_t epochTime;
static time_t epochTime;
uint32_t HAL_GetTick(void) {
return os_time;
uint32_t HAL_GetTick(void) {
return os_time;
}
time_t time(time_t *t){
return epochTime ;
time_t time(time_t *t) {
return epochTime;
}
void setTime(time_t t){
void setTime(time_t t) {
epochTime = t;
}
#endif
#endif /* RTE_CMSIS_RTOS_RTX */
#ifdef WOLFSSL_CURRTIME_OSTICK
@ -143,28 +141,27 @@ extern uint32_t os_time;
double current_time(int reset)
{
if(reset) os_time = 0 ;
return (double)os_time /1000.0;
if (reset) os_time = 0;
return (double)os_time /1000.0;
}
#else
#include <stdint.h>
#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 */
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 ;
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
#endif /* WOLFSSL_CURRTIME_OSTICK */
/*----------------------------------------------------------------------------
Main Thread 'main': Run Network
@ -175,39 +172,42 @@ typedef struct func_args {
char** argv;
} func_args;
extern void echoserver_test(func_args * args) ;
extern void echoserver_test(func_args * args);
int myoptind = 0;
char* myoptarg = NULL;
int main (void) {
int main (void)
{
static char *argv[] =
{ "server" } ;
static func_args args = { 1, argv } ;
{ "server" };
static func_args args = { 1, argv };
MPU_Config(); /* Configure the MPU */
CPU_CACHE_Enable(); /* Enable the CPU Cache */
HAL_Init(); /* Initialize the HAL Library */
SystemClock_Config(); /* Configure the System Clock */
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(NO_FILESYSTEM)
#if !defined(NO_FILESYSTEM)
init_filesystem ();
#endif
#endif
net_initialize ();
#if defined(DEBUG_WOLFSSL)
printf("Turning ON Debug message\n") ;
wolfSSL_Debugging_ON() ;
#endif
#if defined(DEBUG_WOLFSSL)
printf("Turning ON Debug message\n");
wolfSSL_Debugging_ON();
#endif
setTime((RTC_YEAR-1970)*365*24*60*60 + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60);
setTime((RTC_YEAR-1970)*365*24*60*60 +
RTC_MONTH*30*24*60*60 +
RTC_DAY*24*60*60);
osThreadCreate (osThread(net_loop), NULL);
echoserver_test(&args) ;
printf("echoserver: Terminated\n") ;
while(1)
echoserver_test(&args);
printf("echoserver: Terminated\n");
while (1) {
osDelay(1000);
}
}

View File

@ -1,497 +0,0 @@
/* user_settings.h
*
* Copyright (C) 2006-2023 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 >>>
// <h>Common options
// <o> 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
// <o> Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
// <5=>PThread <6=>ThreadX
// <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
// <e>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
// </e>
// <o> 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
// <h>Debug options
// <e>Debug Message
#define MDK_CONF_DebugMessage 0
#if MDK_CONF_DebugMessage == 1
#define DEBUG_WOLFSSL
#endif
// </e>
// <e>Check malloc
#define MDK_CONF_CheckMalloc 1
#if MDK_CONF_CheckMalloc == 1
#define WOLFSSL_MALLOC_CHECK
#define USE_WOLFSSL_MEMORY
#endif
// </e>
// <e>ErrNo.h
#define MDK_CONF_ErrNo 1
#if MDK_CONF_ErrNo == 1
#define HAVE_ERRNO
#endif
// </e>
// <e>Error Strings
#define MDK_CONF_ErrorStrings 1
#if MDK_CONF_ErrorStrings == 0
#define NO_ERROR_STRINGS
#endif
// </e>
//</h>
//</h>
// <h> wolfCrypt Configuration
// <h>Hash/Crypt Algrithm
// <e>MD2
#define MDK_CONF_MD2 0
#if MDK_CONF_MD2 == 1
#define WOLFSSL_MD2
#endif
// </e>
// <e>MD4
#define MDK_CONF_MD4 0
#if MDK_CONF_MD4 == 0
#define NO_MD4
#endif
// </e>
// <e>MD5
#define MDK_CONF_MD5 1
#if MDK_CONF_MD5 == 0
#define NO_MD5
#endif
// </e>
// <e>SHA
#define MDK_CONF_SHA 1
#if MDK_CONF_SHA == 0
#define NO_SHA
#endif
// </e>
// <e>SHA-256
#define MDK_CONF_SHA256 1
#if MDK_CONF_SHA256 == 0
#define NO_SHA256
#endif
// </e>
// <e>SHA-384
#define MDK_CONF_SHA384 1
#if MDK_CONF_SHA384 == 1
#define WOLFSSL_SHA384
#endif
// </e>
// <e>SHA-512
#define MDK_CONF_SHA512 1
#if MDK_CONF_SHA512 == 1
#define WOLFSSL_SHA512
#endif
// </e>
// <e>Hash DRBG
#define MDK_CONF_HASHDRBG 1
#if MDK_CONF_HASHDRBG == 1
#define HAVE_HASHDRBG
#endif
// </e>
// <e>RIPEMD
#define MDK_CONF_RIPEMD 1
#if MDK_CONF_RIPEMD == 1
#define WOLFSSL_RIPEMD
#endif
// </e>
// <e>BLAKE2
#define MDK_CONF_BLAKE2 0
#if MDK_CONF_BLAKE2 == 1
#define HAVE_BLAKE2
#endif
// </e>
// <e>HMAC
#define MDK_CONF_HMAC 1
#if MDK_CONF_HMAC == 0
#define NO_HMAC
#endif
// </e>
// <e>HMAC KDF
#define MDK_CONF_HKDF 1
#if MDK_CONF_HKDF == 1
#define HAVE_HKDF
#endif
// </e>
// <e>AES CCM
#define MDK_CONF_AESCCM 1
#if MDK_CONF_AESCCM == 1
#define HAVE_AESCCM
#endif
// </e>
// <e>AES GCM
#define MDK_CONF_AESGCM 1
#if MDK_CONF_AESGCM == 1
#define HAVE_AESGCM
#endif
// </e>
// <e>RC4
#define MDK_CONF_RC4 0
#if MDK_CONF_RC4 == 0
#define NO_RC4
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1
#define HAVE_CHACHA
#endif
// </e>
// <e>POLY1305
#define MDK_CONF_POLY1305 1
#if MDK_CONF_POLY1305 == 1
#define HAVE_POLY1305
#define HAVE_ONE_TIME_AUTH
#endif
// </e>
// <e>DES3
#define MDK_CONF_DES3 1
#if MDK_CONF_DES3 == 0
#define NO_DES3
#endif
// </e>
// <e>AES
#define MDK_CONF_AES 1
#if MDK_CONF_AES == 0
#define NO_AES
#endif
// </e>
// <e>CAMELLIA
#define MDK_CONF_CAMELLIA 1
#if MDK_CONF_CAMELLIA == 1
#define HAVE_CAMELLIA
#endif
// </e>
// <e>DH
#define MDK_CONF_DH 1
#if MDK_CONF_DH == 0
#define NO_DH
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
// </e>
// <e>SRP
#define MDK_CONF_SRP 1
#if MDK_CONF_SRP == 1
#define HAVE_SRP
#endif
// </e>
// <e>PWDBASED
#define MDK_CONF_PWDBASED 1
#if MDK_CONF_PWDBASED == 0
#define NO_PWDBASED
#endif
// </e>
// <e>ECC
#define MDK_CONF_ECC 1
#if MDK_CONF_ECC == 1
#define HAVE_ECC
#endif
// </e>
// <e>CURVE25519
#define MDK_CONF_CURVE25519 1
#if MDK_CONF_CURVE25519 == 1
#define HAVE_CURVE25519
#define CURVED25519_SMALL
#endif
// </e>
// <e>CURVE25519 SMALL
#define MDK_CONF_CURVE25519_SMALL 0
#if MDK_CONF_CURVE25519_SMALL == 1
#define CURVED25519_SMALL
#endif
// </e>
// <e>ED25519
#define MDK_CONF_ED25519 1
#if MDK_CONF_ED25519 == 1
#define HAVE_ED25519
#endif
// </e>
// <e>ED25519 SMALL
#define MDK_CONF_ED25519_SMALL 0
#if MDK_CONF_ED25519_SMALL == 1
#define ED25519_SMALL
#endif
// </e>
// <e>PKCS7
#define MDK_CONF_PKCS7 0
#if MDK_CONF_PKCS7 == 1
#define HAVE_PKCS7
#endif
// </e>
// </h>
// <e>Random Seed, for TEST Only
#define MDK_CONF_RNDSEED 1
#if MDK_CONF_RNDSEED == 1
#define WOLFSSL_GENSEED_FORTEST
#endif
// </e>
// <h>Hardware Crypt (See document for usage)
// <e>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
// </e>
// <e>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
// </e>
// <e>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
// </e>
// </h>
// <h>Cert/Key Strage
// <o>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
//</h>
// <h>Cert/Key Generation
// <e>CertGen
#define MDK_CONF_CERT_GEN 0
#if MDK_CONF_CERT_GEN == 1
#define WOLFSSL_CERT_GEN
#endif
// </e>
// <e>KeyGen
#define MDK_CONF_KEY_GEN 0
#if MDK_CONF_KEY_GEN == 1
#define WOLFSSL_KEY_GEN
#endif
// </e>
// </h>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 1
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
#endif
// </e>
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
#endif
// </e>
// </h>
/**** wolfSSL Configuration ****/
// <h> wolfSSL Configuration
// <e>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
// </e>
// <e>Include Old TLS
#define MDK_CONF_NO_OLDTLS 0
#if MDK_CONF_NO_OLDTLS == 0
#define NO_OLD_TLS
#endif
// </e>
// <e>CRL
#define MDK_CONF_CRL 0
#if MDK_CONF_CRL == 1
#define HAVE_CRL
#define WOLFSSL_DER_LOAD
#endif
// </e>
// <e>OCSP
#define MDK_CONF_OCSP 0
#if MDK_CONF_OCSP == 1
#define HAVE_OCSP
#endif
// </e>
// <e>OpenSSL Extra
#define MDK_CONF_OPENSSL_EXTRA 0
#if MDK_CONF_OPENSSL_EXTRA == 1
#define OPENSSL_EXTRA
#endif
// </e>
//</h>

View File

@ -298,7 +298,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\RTE\wolfSSL\user_settings.h</PathWithFileName>
<PathWithFileName>..\..\Conf\user_settings.h</PathWithFileName>
<FilenameWithoutPath>user_settings.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>

View File

@ -413,7 +413,7 @@
<File>
<FileName>user_settings.h</FileName>
<FileType>5</FileType>
<FilePath>.\RTE\wolfSSL\user_settings.h</FilePath>
<FilePath>..\..\Conf\user_settings.h</FilePath>
</File>
</Files>
</Group>
@ -912,7 +912,7 @@
<targetInfos/>
</file>
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h" version="3.15.7">
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
<instance index="0">..\..\Conf\user_settings.h</instance>
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.15.7" condition="wolfCrypt-Core"/>
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.4" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.15.7"/>
<targetInfos>

View File

@ -68,12 +68,9 @@
// </h>
// <h>RTC: for validate certificate date
// <o>Year <1970-2099>
#define RTC_YEAR 2019
// <o>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_YEAR 2023
#define RTC_MONTH 1
// <o>Day <1-31>
#define RTC_DAY 1
#define RTC_DAY 1
// </h>
//------------- <<< end of configuration section >>> -----------------------
@ -96,19 +93,19 @@ 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
#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 ;
time_t time(time_t *t) {
return epochTime;
}
void setTime(time_t t){
void setTime(time_t t) {
epochTime = t;
}
@ -129,22 +126,23 @@ double current_time(int reset)
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
static void init_filesystem (void) {
int32_t retv;
static void init_filesystem(void)
{
int32_t retv;
retv = finit ("M0:");
if (retv == fsOK) {
retv = fmount ("M0:");
retv = finit ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
retv = fmount ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
}
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
printf ("Drive M0 initialization failed!\n");
}
}
else {
printf ("Drive M0 initialization failed!\n");
}
}
#endif
@ -156,9 +154,10 @@ void app_main(void *arg)
void app_main(void const*arg)
#endif
{
if(netInitialize () == netOK)
client_test(arg);
else printf("ERROR: netInitialize\n");
if (netInitialize () == netOK)
client_test(arg);
else
printf("ERROR: netInitialize\n");
}
#if defined(WOLFSSL_CMSIS_RTOS)
@ -178,48 +177,51 @@ typedef struct func_args {
int myoptind = 0;
char* myoptarg = NULL;
int main (void) {
int main (void)
{
static char *argv[] =
{ "client", "-h", REMOTE_IP, "-p", REMOTE_PORT,
"-v", " ", OTHER_OPTIONS } ;
"-v", " ", OTHER_OPTIONS };
static func_args args =
{ sizeof(argv)/sizeof(*argv[0]), argv } ;
{ sizeof(argv)/sizeof(*argv[0]), argv };
char *verStr[] = { "SSL3", "TLS1.0", "TLS1.1", "TLS1.2", "TLS1.3"};
#define VERSIZE 2
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
#if defined(DEBUG_WOLFSSL)
printf("Turning ON Debug message\n") ;
wolfSSL_Debugging_ON() ;
#endif
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
#if defined(DEBUG_WOLFSSL)
printf("Turning ON Debug message\n");
wolfSSL_Debugging_ON();
#endif
snprintf(ver, VERSIZE, "%d", TLS_VER);
argv[6] = ver;
printf("SSL/TLS Client(%d)\n ", (int)(sizeof(argv)/sizeof(argv[0]))) ;
printf(" Remote IP: %s, Port: %s\n Version: %s\n", argv[2], argv[4], verStr[TLS_VER]) ;
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);
#if defined(WOLFSSL_CMSIS_RTOS)
osThreadCreate (osThread(app_main), (void *)&args);
#elif defined(WOLFSSL_CMSIS_RTOSv2)
osThreadNew(app_main, (void *)&args, NULL);
#endif
osKernelStart();
printf("SSL/TLS Client(%d)\n ", (int)(sizeof(argv)/sizeof(argv[0])));
printf(" Remote IP: %s, Port: %s\n Version: %s\n",
argv[2], argv[4], verStr[TLS_VER]);
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);
#if defined(WOLFSSL_CMSIS_RTOS)
osThreadCreate (osThread(app_main), (void *)&args);
#elif defined(WOLFSSL_CMSIS_RTOSv2)
osThreadNew(app_main, (void *)&args, NULL);
#endif
osKernelStart();
}

View File

@ -1,497 +0,0 @@
/* user_settings.h
*
* Copyright (C) 2006-2023 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 >>>
// <h>Common options
// <o> 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
// <o> Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
// <5=>PThread <6=>ThreadX
// <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
// <e>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
// </e>
// <o> 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
// <h>Debug options
// <e>Debug Message
#define MDK_CONF_DebugMessage 0
#if MDK_CONF_DebugMessage == 1
#define DEBUG_WOLFSSL
#endif
// </e>
// <e>Check malloc
#define MDK_CONF_CheckMalloc 1
#if MDK_CONF_CheckMalloc == 1
#define WOLFSSL_MALLOC_CHECK
#define USE_WOLFSSL_MEMORY
#endif
// </e>
// <e>ErrNo.h
#define MDK_CONF_ErrNo 1
#if MDK_CONF_ErrNo == 1
#define HAVE_ERRNO
#endif
// </e>
// <e>Error Strings
#define MDK_CONF_ErrorStrings 1
#if MDK_CONF_ErrorStrings == 0
#define NO_ERROR_STRINGS
#endif
// </e>
//</h>
//</h>
// <h> wolfCrypt Configuration
// <h>Hash/Crypt Algrithm
// <e>MD2
#define MDK_CONF_MD2 0
#if MDK_CONF_MD2 == 1
#define WOLFSSL_MD2
#endif
// </e>
// <e>MD4
#define MDK_CONF_MD4 0
#if MDK_CONF_MD4 == 0
#define NO_MD4
#endif
// </e>
// <e>MD5
#define MDK_CONF_MD5 1
#if MDK_CONF_MD5 == 0
#define NO_MD5
#endif
// </e>
// <e>SHA
#define MDK_CONF_SHA 1
#if MDK_CONF_SHA == 0
#define NO_SHA
#endif
// </e>
// <e>SHA-256
#define MDK_CONF_SHA256 1
#if MDK_CONF_SHA256 == 0
#define NO_SHA256
#endif
// </e>
// <e>SHA-384
#define MDK_CONF_SHA384 1
#if MDK_CONF_SHA384 == 1
#define WOLFSSL_SHA384
#endif
// </e>
// <e>SHA-512
#define MDK_CONF_SHA512 1
#if MDK_CONF_SHA512 == 1
#define WOLFSSL_SHA512
#endif
// </e>
// <e>Hash DRBG
#define MDK_CONF_HASHDRBG 1
#if MDK_CONF_HASHDRBG == 1
#define HAVE_HASHDRBG
#endif
// </e>
// <e>RIPEMD
#define MDK_CONF_RIPEMD 1
#if MDK_CONF_RIPEMD == 1
#define WOLFSSL_RIPEMD
#endif
// </e>
// <e>BLAKE2
#define MDK_CONF_BLAKE2 0
#if MDK_CONF_BLAKE2 == 1
#define HAVE_BLAKE2
#endif
// </e>
// <e>HMAC
#define MDK_CONF_HMAC 1
#if MDK_CONF_HMAC == 0
#define NO_HMAC
#endif
// </e>
// <e>HMAC KDF
#define MDK_CONF_HKDF 1
#if MDK_CONF_HKDF == 1
#define HAVE_HKDF
#endif
// </e>
// <e>AES CCM
#define MDK_CONF_AESCCM 1
#if MDK_CONF_AESCCM == 1
#define HAVE_AESCCM
#endif
// </e>
// <e>AES GCM
#define MDK_CONF_AESGCM 1
#if MDK_CONF_AESGCM == 1
#define HAVE_AESGCM
#endif
// </e>
// <e>RC4
#define MDK_CONF_RC4 0
#if MDK_CONF_RC4 == 0
#define NO_RC4
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1
#define HAVE_CHACHA
#endif
// </e>
// <e>POLY1305
#define MDK_CONF_POLY1305 1
#if MDK_CONF_POLY1305 == 1
#define HAVE_POLY1305
#define HAVE_ONE_TIME_AUTH
#endif
// </e>
// <e>DES3
#define MDK_CONF_DES3 1
#if MDK_CONF_DES3 == 0
#define NO_DES3
#endif
// </e>
// <e>AES
#define MDK_CONF_AES 1
#if MDK_CONF_AES == 0
#define NO_AES
#endif
// </e>
// <e>CAMELLIA
#define MDK_CONF_CAMELLIA 1
#if MDK_CONF_CAMELLIA == 1
#define HAVE_CAMELLIA
#endif
// </e>
// <e>DH
#define MDK_CONF_DH 1
#if MDK_CONF_DH == 0
#define NO_DH
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
// </e>
// <e>SRP
#define MDK_CONF_SRP 1
#if MDK_CONF_SRP == 1
#define HAVE_SRP
#endif
// </e>
// <e>PWDBASED
#define MDK_CONF_PWDBASED 1
#if MDK_CONF_PWDBASED == 0
#define NO_PWDBASED
#endif
// </e>
// <e>ECC
#define MDK_CONF_ECC 1
#if MDK_CONF_ECC == 1
#define HAVE_ECC
#endif
// </e>
// <e>CURVE25519
#define MDK_CONF_CURVE25519 1
#if MDK_CONF_CURVE25519 == 1
#define HAVE_CURVE25519
#define CURVED25519_SMALL
#endif
// </e>
// <e>CURVE25519 SMALL
#define MDK_CONF_CURVE25519_SMALL 0
#if MDK_CONF_CURVE25519_SMALL == 1
#define CURVED25519_SMALL
#endif
// </e>
// <e>ED25519
#define MDK_CONF_ED25519 1
#if MDK_CONF_ED25519 == 1
#define HAVE_ED25519
#endif
// </e>
// <e>ED25519 SMALL
#define MDK_CONF_ED25519_SMALL 0
#if MDK_CONF_ED25519_SMALL == 1
#define ED25519_SMALL
#endif
// </e>
// <e>PKCS7
#define MDK_CONF_PKCS7 0
#if MDK_CONF_PKCS7 == 1
#define HAVE_PKCS7
#endif
// </e>
// </h>
// <e>Random Seed, for TEST Only
#define MDK_CONF_RNDSEED 1
#if MDK_CONF_RNDSEED == 1
#define WOLFSSL_GENSEED_FORTEST
#endif
// </e>
// <h>Hardware Crypt (See document for usage)
// <e>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
// </e>
// <e>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
// </e>
// <e>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
// </e>
// </h>
// <h>Cert/Key Strage
// <o>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
//</h>
// <h>Cert/Key Generation
// <e>CertGen
#define MDK_CONF_CERT_GEN 0
#if MDK_CONF_CERT_GEN == 1
#define WOLFSSL_CERT_GEN
#endif
// </e>
// <e>KeyGen
#define MDK_CONF_KEY_GEN 0
#if MDK_CONF_KEY_GEN == 1
#define WOLFSSL_KEY_GEN
#endif
// </e>
// </h>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 1
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
#endif
// </e>
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
#endif
// </e>
// </h>
/**** wolfSSL Configuration ****/
// <h> wolfSSL Configuration
// <e>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
// </e>
// <e>Include Old TLS
#define MDK_CONF_NO_OLDTLS 0
#if MDK_CONF_NO_OLDTLS == 0
#define NO_OLD_TLS
#endif
// </e>
// <e>CRL
#define MDK_CONF_CRL 0
#if MDK_CONF_CRL == 1
#define HAVE_CRL
#define WOLFSSL_DER_LOAD
#endif
// </e>
// <e>OCSP
#define MDK_CONF_OCSP 0
#if MDK_CONF_OCSP == 1
#define HAVE_OCSP
#endif
// </e>
// <e>OpenSSL Extra
#define MDK_CONF_OPENSSL_EXTRA 0
#if MDK_CONF_OPENSSL_EXTRA == 1
#define OPENSSL_EXTRA
#endif
// </e>
//</h>

View File

@ -298,7 +298,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\RTE\wolfSSL\user_settings.h</PathWithFileName>
<PathWithFileName>..\..\Conf\user_settings.h</PathWithFileName>
<FilenameWithoutPath>user_settings.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>

View File

@ -413,7 +413,7 @@
<File>
<FileName>user_settings.h</FileName>
<FileType>5</FileType>
<FilePath>.\RTE\wolfSSL\user_settings.h</FilePath>
<FilePath>..\..\Conf\user_settings.h</FilePath>
</File>
</Files>
</Group>
@ -912,7 +912,7 @@
<targetInfos/>
</file>
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h" version="3.15.7">
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
<instance index="0">..\..\Conf\user_settings.h</instance>
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.15.7" condition="wolfCrypt-Core"/>
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.4" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.15.7"/>
<targetInfos>

View File

@ -66,11 +66,9 @@
// <h>RTC: for validate certificate date
// <o>Year <1970-2099>
#define RTC_YEAR 2019
// <o>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 2023
#define RTC_MONTH 1
// <o>Day <1-31>
#define RTC_DAY 1
#define RTC_DAY 1
// </h>
//------------- <<< end of configuration section >>> -----------------------
@ -94,22 +92,23 @@ static void CPU_CACHE_Enable (void) {
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
static void init_filesystem (void) {
int32_t retv;
static void init_filesystem(void)
{
int32_t retv;
retv = finit ("M0:");
if (retv == fsOK) {
retv = fmount ("M0:");
retv = finit ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
retv = fmount ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
}
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
printf ("Drive M0 initialization failed!\n");
}
}
else {
printf ("Drive M0 initialization failed!\n");
}
}
#endif
@ -121,20 +120,20 @@ 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
#if defined(WOLFSSL_CMSIS_RTOS)
return os_time;
#elif defined(WOLFSSL_CMSIS_RTOSv2)
return osKernelGetTickCount();
#endif
}
double current_time(int reset)
{
#if defined(WOLFSSL_CMSIS_RTOS)
return (double)os_time / 1000.0;
#elif defined(WOLFSSL_CMSIS_RTOSv2)
return (double)osKernelGetTickCount() / 1000.0;
#endif
#if defined(WOLFSSL_CMSIS_RTOS)
return (double)os_time / 1000.0;
#elif defined(WOLFSSL_CMSIS_RTOSv2)
return (double)osKernelGetTickCount() / 1000.0;
#endif
}
#else
@ -143,8 +142,8 @@ double current_time(int reset)
#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 */
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;
@ -203,22 +202,22 @@ int main(void)
{
static char *argv[] =
{ "server", "-p", SERVER_PORT,
"-v", " ", OTHER_OPTIONS } ;
"-v", " ", OTHER_OPTIONS };
static func_args args =
{ sizeof(argv)/sizeof(*argv[0]), argv } ;
{ sizeof(argv)/sizeof(*argv[0]), argv };
char *verStr[] = { "SSL3", "TLS1.0", "TLS1.1", "TLS1.2", "TLS1.3"};
#define VERSIZE 2
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(NO_FILESYSTEM)
#if !defined(NO_FILESYSTEM)
init_filesystem ();
#endif
#endif
#if defined(WOLFSSL_CMSIS_RTOSv2)
osKernelInitialize();
@ -232,10 +231,12 @@ int main(void)
snprintf(ver, VERSIZE, "%d", TLS_VER);
argv[4] = ver;
printf("SSL/TLS Server\n ") ;
printf(" Server Port: %s\n Version: %s\n", argv[2], verStr[TLS_VER]) ;
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);
printf("SSL/TLS Server\n ");
printf(" Server Port: %s\n Version: %s\n", argv[2], verStr[TLS_VER]);
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);
#if defined(WOLFSSL_CMSIS_RTOS)
osThreadCreate(osThread(app_main), (void *)&args);

View File

@ -51,22 +51,24 @@ void SystemClock_Config(void) {
*----------------------------------------------------------------------------*/
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h"
static void init_filesystem (void) {
int32_t retv;
retv = finit ("M0:");
if (retv == 0) {
retv = fmount ("M0:");
if (retv == 0) {
printf ("Drive M0 ready!\n");
static void init_filesystem(void)
{
int32_t retv;
retv = finit ("M0:");
if (retv == fsOK) {
retv = fmount ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
}
}
else {
printf ("Drive M0 mount failed!\n");
printf ("Drive M0 initialization failed!\n");
}
}
else {
printf ("Drive M0 initialization failed!\n");
}
}
#endif
@ -76,31 +78,31 @@ typedef struct func_args {
} func_args;
extern void shell_main(func_args * args) ;
extern void shell_main(func_args * args);
/*-----------------------------------------------------------------------------
* mian entry
* main entry
*----------------------------------------------------------------------------*/
int myoptind = 0;
char* myoptarg = NULL;
int main()
{
void *arg = NULL ;
void *arg = NULL;
SystemClock_Config() ;
SystemClock_Config();
#if !defined(NO_FILESYSTEM)
init_filesystem ();
#endif
netInitialize() ;
osDelay(300) ;
netInitialize();
osDelay(300);
#if defined(DEBUG_WOLFSSL)
printf("Turning ON Debug message\n") ;
wolfSSL_Debugging_ON() ;
#endif
#if defined(DEBUG_WOLFSSL)
printf("Turning ON Debug message\n");
wolfSSL_Debugging_ON();
#endif
shell_main(arg) ;
shell_main(arg);
}

View File

@ -300,7 +300,7 @@
<Focus>0</Focus>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\RTE\wolfSSL\user_settings.h</PathWithFileName>
<PathWithFileName>..\..\Conf\user_settings.h</PathWithFileName>
<FilenameWithoutPath>user_settings.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>

View File

@ -441,7 +441,7 @@
<File>
<FileName>user_settings.h</FileName>
<FileType>5</FileType>
<FilePath>.\RTE\wolfSSL\user_settings.h</FilePath>
<FilePath>..\..\Conf\user_settings.h</FilePath>
</File>
</Files>
</Group>
@ -972,7 +972,7 @@
<targetInfos/>
</file>
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h">
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
<instance index="0">..\..\Conf\user_settings.h</instance>
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfCrypt" Csub="CORE" Cvendor="wolfSSL" Cversion="3.9.0" condition="wolfCrypt-Core"/>
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.0" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.9.0"/>
<targetInfos>

View File

@ -1,497 +0,0 @@
/* user_settings.h
*
* Copyright (C) 2006-2023 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 >>>
// <h>Common options
// <o> 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
// <o> Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <3=>SafeRTOS <4=>Windows
// <5=>PThread <6=>ThreadX
// <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
// <e>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
// </e>
// <o> 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
// <h>Debug options
// <e>Debug Message
#define MDK_CONF_DebugMessage 0
#if MDK_CONF_DebugMessage == 1
#define DEBUG_WOLFSSL
#endif
// </e>
// <e>Check malloc
#define MDK_CONF_CheckMalloc 1
#if MDK_CONF_CheckMalloc == 1
#define WOLFSSL_MALLOC_CHECK
#define USE_WOLFSSL_MEMORY
#endif
// </e>
// <e>ErrNo.h
#define MDK_CONF_ErrNo 1
#if MDK_CONF_ErrNo == 1
#define HAVE_ERRNO
#endif
// </e>
// <e>Error Strings
#define MDK_CONF_ErrorStrings 1
#if MDK_CONF_ErrorStrings == 0
#define NO_ERROR_STRINGS
#endif
// </e>
//</h>
//</h>
// <h> wolfCrypt Configuration
// <h>Hash/Crypt Algrithm
// <e>MD2
#define MDK_CONF_MD2 0
#if MDK_CONF_MD2 == 1
#define WOLFSSL_MD2
#endif
// </e>
// <e>MD4
#define MDK_CONF_MD4 0
#if MDK_CONF_MD4 == 0
#define NO_MD4
#endif
// </e>
// <e>MD5
#define MDK_CONF_MD5 1
#if MDK_CONF_MD5 == 0
#define NO_MD5
#endif
// </e>
// <e>SHA
#define MDK_CONF_SHA 1
#if MDK_CONF_SHA == 0
#define NO_SHA
#endif
// </e>
// <e>SHA-256
#define MDK_CONF_SHA256 1
#if MDK_CONF_SHA256 == 0
#define NO_SHA256
#endif
// </e>
// <e>SHA-384
#define MDK_CONF_SHA384 1
#if MDK_CONF_SHA384 == 1
#define WOLFSSL_SHA384
#endif
// </e>
// <e>SHA-512
#define MDK_CONF_SHA512 1
#if MDK_CONF_SHA512 == 1
#define WOLFSSL_SHA512
#endif
// </e>
// <e>Hash DRBG
#define MDK_CONF_HASHDRBG 1
#if MDK_CONF_HASHDRBG == 1
#define HAVE_HASHDRBG
#endif
// </e>
// <e>RIPEMD
#define MDK_CONF_RIPEMD 1
#if MDK_CONF_RIPEMD == 1
#define WOLFSSL_RIPEMD
#endif
// </e>
// <e>BLAKE2
#define MDK_CONF_BLAKE2 0
#if MDK_CONF_BLAKE2 == 1
#define HAVE_BLAKE2
#endif
// </e>
// <e>HMAC
#define MDK_CONF_HMAC 1
#if MDK_CONF_HMAC == 0
#define NO_HMAC
#endif
// </e>
// <e>HMAC KDF
#define MDK_CONF_HKDF 1
#if MDK_CONF_HKDF == 1
#define HAVE_HKDF
#endif
// </e>
// <e>AES CCM
#define MDK_CONF_AESCCM 1
#if MDK_CONF_AESCCM == 1
#define HAVE_AESCCM
#endif
// </e>
// <e>AES GCM
#define MDK_CONF_AESGCM 1
#if MDK_CONF_AESGCM == 1
#define HAVE_AESGCM
#endif
// </e>
// <e>RC4
#define MDK_CONF_RC4 0
#if MDK_CONF_RC4 == 0
#define NO_RC4
#endif
// </e>
// <e>CHACHA
#define MDK_CONF_CHACHA 1
#if MDK_CONF_CHACHA == 1
#define HAVE_CHACHA
#endif
// </e>
// <e>POLY1305
#define MDK_CONF_POLY1305 1
#if MDK_CONF_POLY1305 == 1
#define HAVE_POLY1305
#define HAVE_ONE_TIME_AUTH
#endif
// </e>
// <e>DES3
#define MDK_CONF_DES3 1
#if MDK_CONF_DES3 == 0
#define NO_DES3
#endif
// </e>
// <e>AES
#define MDK_CONF_AES 1
#if MDK_CONF_AES == 0
#define NO_AES
#endif
// </e>
// <e>CAMELLIA
#define MDK_CONF_CAMELLIA 1
#if MDK_CONF_CAMELLIA == 1
#define HAVE_CAMELLIA
#endif
// </e>
// <e>DH
#define MDK_CONF_DH 1
#if MDK_CONF_DH == 0
#define NO_DH
#endif
// </e>
// <e>DSA
#define MDK_CONF_DSA 1
#if MDK_CONF_DSA == 0
#define NO_DSA
#endif
// </e>
// <e>SRP
#define MDK_CONF_SRP 1
#if MDK_CONF_SRP == 1
#define HAVE_SRP
#endif
// </e>
// <e>PWDBASED
#define MDK_CONF_PWDBASED 1
#if MDK_CONF_PWDBASED == 0
#define NO_PWDBASED
#endif
// </e>
// <e>ECC
#define MDK_CONF_ECC 1
#if MDK_CONF_ECC == 1
#define HAVE_ECC
#endif
// </e>
// <e>CURVE25519
#define MDK_CONF_CURVE25519 1
#if MDK_CONF_CURVE25519 == 1
#define HAVE_CURVE25519
#define CURVED25519_SMALL
#endif
// </e>
// <e>CURVE25519 SMALL
#define MDK_CONF_CURVE25519_SMALL 0
#if MDK_CONF_CURVE25519_SMALL == 1
#define CURVED25519_SMALL
#endif
// </e>
// <e>ED25519
#define MDK_CONF_ED25519 1
#if MDK_CONF_ED25519 == 1
#define HAVE_ED25519
#endif
// </e>
// <e>ED25519 SMALL
#define MDK_CONF_ED25519_SMALL 0
#if MDK_CONF_ED25519_SMALL == 1
#define ED25519_SMALL
#endif
// </e>
// <e>PKCS7
#define MDK_CONF_PKCS7 0
#if MDK_CONF_PKCS7 == 1
#define HAVE_PKCS7
#endif
// </e>
// </h>
// <e>Random Seed, for TEST Only
#define MDK_CONF_RNDSEED 1
#if MDK_CONF_RNDSEED == 1
#define WOLFSSL_GENSEED_FORTEST
#endif
// </e>
// <h>Hardware Crypt (See document for usage)
// <e>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
// </e>
// <e>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
// </e>
// <e>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
// </e>
// </h>
// <h>Cert/Key Strage
// <o>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
//</h>
// <h>Cert/Key Generation
// <e>CertGen
#define MDK_CONF_CERT_GEN 0
#if MDK_CONF_CERT_GEN == 1
#define WOLFSSL_CERT_GEN
#endif
// </e>
// <e>KeyGen
#define MDK_CONF_KEY_GEN 0
#if MDK_CONF_KEY_GEN == 1
#define WOLFSSL_KEY_GEN
#endif
// </e>
// </h>
// <e>Use Fast Math
#define MDK_CONF_FASTMATH 1
#if MDK_CONF_FASTMATH == 1
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
#endif
// </e>
// <e>Small Stack
#define MDK_CONF_SmallStack 1
#if MDK_CONF_SmallStack == 0
#define NO_WOLFSSL_SMALL_STACK
#endif
// </e>
// </h>
/**** wolfSSL Configuration ****/
// <h> wolfSSL Configuration
// <e>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
// </e>
// <e>Include Old TLS
#define MDK_CONF_NO_OLDTLS 0
#if MDK_CONF_NO_OLDTLS == 0
#define NO_OLD_TLS
#endif
// </e>
// <e>CRL
#define MDK_CONF_CRL 0
#if MDK_CONF_CRL == 1
#define HAVE_CRL
#define WOLFSSL_DER_LOAD
#endif
// </e>
// <e>OCSP
#define MDK_CONF_OCSP 0
#if MDK_CONF_OCSP == 1
#define HAVE_OCSP
#endif
// </e>
// <e>OpenSSL Extra
#define MDK_CONF_OPENSSL_EXTRA 0
#if MDK_CONF_OPENSSL_EXTRA == 1
#define OPENSSL_EXTRA
#endif
// </e>
//</h>

View File

@ -226,7 +226,7 @@
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\RTE\wolfSSL\user_settings.h</PathWithFileName>
<PathWithFileName>..\..\Conf\user_settings.h</PathWithFileName>
<FilenameWithoutPath>user_settings.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>

View File

@ -383,7 +383,7 @@
<File>
<FileName>user_settings.h</FileName>
<FileType>5</FileType>
<FilePath>.\RTE\wolfSSL\user_settings.h</FilePath>
<FilePath>..\..\Conf\user_settings.h</FilePath>
</File>
</Files>
</Group>
@ -832,7 +832,7 @@
<targetInfos/>
</file>
<file attr="config" category="header" name="wolfssl\IDE\MDK5-ARM\Conf\user_settings.h" version="3.9.0">
<instance index="0">RTE\wolfSSL\user_settings.h</instance>
<instance index="0">..\..\Conf\user_settings.h</instance>
<component Cbundle="wolfSSL" Cclass="wolfSSL" Cgroup="wolfSSL" Csub="Core" Cvendor="wolfSSL" Cversion="3.15.7" condition="wolfCrypt-Core"/>
<package license="wolfssl\IDE\MDK5-ARM\Docs\wolfSSL-License.txt" name="wolfSSL" schemaVersion="1.4" url="http://www.wolfSSL.com/files/ide" vendor="wolfSSL" version="3.15.7"/>
<targetInfos>

54
IDE/MDK5-ARM/README.md Normal file
View File

@ -0,0 +1,54 @@
# ARM Keil MDK 5 wolfSSL Support
wolfSSL has a Keil CMSIS pack available that is updated for each release.
This CMSIS pack contains the wolfCrypt and wolfSSL (TLS) libraries including test, benchmark and example applications.
## To install the wolfSSL pack
1) Open the Keil "Pack Installer"
2) Under Generic locate "wolfSSL::wolfSSL"
3) Click "Install"
## To add the pack to your project
1) Project -> Manage -> "Runtime Environment"
2) Expand "wolfSSL" and check the boxes for wolfCrypt CORE and wolfSSL CORE.
3) If running the wolfCrypt test or any of the TLS examples check those as well.
If the wolfSSL::wolfSSL pack isn't showing:
1) Project -> Manage -> "Select Software Packs"
2) Make sure wolfSSL:wolfSSL is selected to "latest"
3) Hit "OK"
## To configure wolfSSL
1) Add a pre-processor macro `WOLFSSL_USER_SETTINGS`
- Project -> Options for Target... -> C/C++ -> Preprocessor Symbols -> Define.
- Add `WOLFSSL_USER_SETTINGS`
2) Open the `user_settings.h` file. In wolfSSL -> user_settings.h
3) Configure math library (`MDK_CONF_MATH`). Default 0=SP Math all (sp_int.c)
4) Configure MPU (`MDK_CONF_MPU`): If not STM32, use 0 for none.
5) Configure the RTOS (`MDK_CONF_THREAD`): By default 15 = "CMSIS RTOSv2". For bare-metal use 0. For FreeRTOS use 1.
6) For wolfCrypt only (no TLS) add `#define WOLFCRYPT_ONLY` (resolves GetCA errors)
7) Increase stack/heap (if needed). This is typically in the startup.s, but for RTX is in the `RTX_Config.h`. For CMSIS RTOSv2 stack is set in `osThreadAttr_t` on call to `osThreadNew`.
## Building
If getting error for missing GetCA or GetCAByName then include `Src/ssl-dummy.c` or define `WOLFCRYPT_ONLY`.
If getting an error with missing `current_time` then please implement a function to return elapsed seconds (used by benchmark) like this:
```c
extern uint32_t os_time;
double current_time(int reset)
{
if (reset) os_time = 0 ;
return (double)os_time /1000.0;
}
```
## For Support
For question email support@wolfssl.com

View File

@ -29,11 +29,11 @@
Signer* GetCA(void* vp, byte* hash)
{
return NULL ;
return NULL;
}
Signer* GetCAByName(void* vp, byte* hash)
{
return NULL ;
return NULL;
}

9
IDE/MDK5-ARM/include.am Normal file
View File

@ -0,0 +1,9 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root
EXTRA_DIST+= IDE/MDK5-ARM/README.md
EXTRA_DIST+= IDE/MDK5-ARM/Conf/user_settings.h
EXTRA_DIST+= IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h
EXTRA_DIST+= IDE/MDK5-ARM/Projects
EXTRA_DIST+= IDE/MDK5-ARM/Src/ssl-dummy.c

View File

@ -53,6 +53,7 @@ include IDE/AURIX/include.am
include IDE/MCUEXPRESSO/include.am
include IDE/Espressif/include.am
include IDE/STARCORE/include.am
include IDE/MDK5-ARM/include.am
EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif
EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MYSQL IDE/LPCXPRESSO IDE/HEXIWEAR IDE/Espressif
EXTRA_DIST+= IDE/OPENSTM32/README.md

View File

@ -9256,6 +9256,13 @@ ProtocolVersion MakeDTLSv1_3(void)
return sys_now()/1000;
}
#elif defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2)
word32 LowResTimer(void)
{
return (word32)osKernelGetTickCount() / 1000;
}
#elif defined(WOLFSSL_TIRTOS)
word32 LowResTimer(void)

View File

@ -1713,6 +1713,14 @@ end:
{
return sys_now();
}
#elif defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2)
word32 TimeNowInMilliseconds(void)
{
return (word32)osKernelGetTickCount();
}
#elif defined(WOLFSSL_TIRTOS)
/* The time in milliseconds.
* Used for tickets to represent difference between when first seen and when
@ -1996,6 +2004,14 @@ end:
{
return sys_now();
}
#elif defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2)
sword64 TimeNowInMilliseconds(void)
{
return (sword64)osKernelGetTickCount();
}
#elif defined(WOLFSSL_TIRTOS)
/* The time in milliseconds.
* Used for tickets to represent difference between when first seen and when

View File

@ -9020,6 +9020,14 @@ void bench_sphincsKeySign(byte level, byte optim)
return (double)OSA_TimeGetMsec() / 1000;
}
#elif defined(WOLFSSL_CMSIS_RTOS) || defined(WOLFSSL_CMSIS_RTOSv2)
double current_time(int reset)
{
(void)reset;
return (double)osKernelGetTickCount() / 1000.0;
}
#elif defined(WOLFSSL_EMBOS)
#include "RTOS.h"