diff --git a/IDE/MDK5-ARM/Conf/config-Crypt.h b/IDE/MDK5-ARM/Conf/config-Crypt.h deleted file mode 100644 index 49d7ef5c0..000000000 --- a/IDE/MDK5-ARM/Conf/config-Crypt.h +++ /dev/null @@ -1,304 +0,0 @@ -/* config-Crypt.h - * - * Copyright (C) 2006-2017 wolfSSL Inc. - * - * This file is part of wolfSSL. - * - * wolfSSL is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * wolfSSL is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA - */ - - -// <<< Use Configuration Wizard in Context Menu >>> - -// wolfCrypt Configuration - -// Cert/Key Strage -// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes) -#define MDK_CONF_CERT_BUFF 0 -#if MDK_CONF_CERT_BUFF== 1 -#define USE_CERT_BUFFERS_1024 -#elif MDK_CONF_CERT_BUFF == 2 -#define USE_CERT_BUFFERS_2048 -#endif -// - -// Crypt Algrithm - -// MD2 -#define MDK_CONF_MD2 1 -#if MDK_CONF_MD2 == 1 -#define WOLFSSL_MD2 -#endif -// -// MD4 -#define MDK_CONF_MD4 1 -#if MDK_CONF_MD4 == 0 -#define NO_MD4 -#endif -// -// MD5 -#define MDK_CONF_MD5 1 -#if MDK_CONF_MD5 == 0 -#define NO_MD5 -#endif -// -// SHA -#define MDK_CONF_SHA 1 -#if MDK_CONF_SHA == 0 -#define NO_SHA -#endif -// -// SHA-256 -#define MDK_CONF_SHA256 1 -#if MDK_CONF_SHA256 == 0 -#define NO_SHA256 -#endif -// -// SHA-384 -#define MDK_CONF_SHA384 1 -#if MDK_CONF_SHA384 == 1 -#define WOLFSSL_SHA384 -#endif -// -// SHA-512 -#define MDK_CONF_SHA512 1 -#if MDK_CONF_SHA512 == 1 -#define WOLFSSL_SHA512 -#endif -// -// RIPEMD -#define MDK_CONF_RIPEMD 1 -#if MDK_CONF_RIPEMD == 1 -#define WOLFSSL_RIPEMD -#endif -// -// BLAKE2 -#define MDK_CONF_BLAKE2 0 -#if MDK_CONF_BLAKE2 == 1 -#define HAVE_BLAKE2 -#endif -// -// HMAC -#define MDK_CONF_HMAC 1 -#if MDK_CONF_HMAC == 0 -#define NO_HMAC -#endif -// -// HMAC KDF -#define MDK_CONF_HKDF 1 -#if MDK_CONF_HKDF == 1 -#define HAVE_HKDF -#endif -// - -// AES CCM -#define MDK_CONF_AESCCM 1 -#if MDK_CONF_AESCCM == 1 -#define HAVE_AESCCM -#endif -// -// AES GCM -#define MDK_CONF_AESGCM 1 -#if MDK_CONF_AESGCM == 1 -#define HAVE_AESGCM -#endif -// - -// RC4 -#define MDK_CONF_RC4 1 -#if MDK_CONF_RC4 == 0 -#define NO_RC4 -#endif -// - -// HC128 -#define MDK_CONF_HC128 1 -#if MDK_CONF_AESGCM == 0 -#define NO_HC128 -#endif -// - -// RABBIT -#define MDK_CONF_RABBIT 1 -#if MDK_CONF_RABBIT == 0 -#define NO_RABBIT -#endif -// - -// CHACHA -#define MDK_CONF_CHACHA 1 -#if MDK_CONF_CHACHA == 1 -#define HAVE_CHACHA -#endif -// - -// POLY1305 -#define MDK_CONF_POLY1305 1 -#if MDK_CONF_POLY1305 == 1 -#define HAVE_POLY1305 -#define HAVE_ONE_TIME_AUTH -#endif -// - -// DES3 -#define MDK_CONF_DES3 1 -#if MDK_CONF_DES3 == 0 -#define NO_DES3 -#endif -// - -// AES -#define MDK_CONF_AES 1 -#if MDK_CONF_AES == 0 -#define NO_AES -#endif -// - -// CAMELLIA -#define MDK_CONF_CAMELLIA 1 -#if MDK_CONF_CAMELLIA == 1 -#define HAVE_CAMELLIA -#endif -// - -// DH -#define MDK_CONF_DH 1 -#if MDK_CONF_DH == 0 -#define NO_DH -#endif -// -// DSA -#define MDK_CONF_DSA 1 -#if MDK_CONF_DSA == 0 -#define NO_DSA -#endif -// - -// SRP -#define MDK_CONF_SRP 1 -#if MDK_CONF_SRP == 1 -#define HAVE_SRP -#endif -// - -// PWDBASED -#define MDK_CONF_PWDBASED 1 -#if MDK_CONF_PWDBASED == 0 -#define NO_PWDBASED -#endif -// - -// ECC -#define MDK_CONF_ECC 1 -#if MDK_CONF_ECC == 1 -#define HAVE_ECC -#endif -// - -// CURVE25519 -#define MDK_CONF_CURVE25519 1 -#if MDK_CONF_CURVE25519 == 1 -#define HAVE_CURVE25519 -#define CURVED25519_SMALL -//#define TFM_ECC256 -#endif -// - -// ED25519 -#define MDK_CONF_ED25519 1 -#if MDK_CONF_ED25519 == 1 -#define HAVE_ED25519 -#endif -// - -// PKCS7 -#define MDK_CONF_PKCS7 0 -#if MDK_CONF_PKCS7 == 1 -#define HAVE_PKCS7 -#endif -// - -// NTRU (need License, "crypto_ntru.h") -#define MDK_CONF_NTRU 0 -#if MDK_CONF_NTRU == 1 -#define HAVE_NTRU -#endif -// -// - -// Hardware Crypt (See document for usage) -// Hardware RNG -#define MDK_CONF_STM32F2_RNG 0 -#if MDK_CONF_STM32F2_RNG == 1 -#define STM32F2_RNG -#else - -#endif -// -// Hardware Crypt -#define MDK_CONF_STM32F2_CRYPTO 0 -#if MDK_CONF_STM32F2_CRYPTO == 1 -#define STM32F2_CRYPTO -#endif -// - -// - -// Other Settings - -// Use Fast Math -#define MDK_CONF_FASTMATH 1 -#if MDK_CONF_FASTMATH == 1 -#define USE_FAST_MATH -#define TFM_TIMING_RESISTANT -#endif -// -// Small Stack -#define MDK_CONF_SmallStack 0 -#if MDK_CONF_SmallStack == 0 -#define NO_WOLFSSL_SMALL_STACK -#endif -// -// ErrNo.h -#define MDK_CONF_ErrNo 1 -#if MDK_CONF_ErrNo == 1 -#define HAVE_ERRNO -#endif -// -// Error Strings -#define MDK_CONF_ErrorStrings 1 -#if MDK_CONF_ErrorStrings == 0 -#define NO_ERROR_STRINGS -#endif -// -// zlib (need "zlib.h") -#define MDK_CONF_LIBZ 0 -#if MDK_CONF_LIBZ == 1 -#define HAVE_LIBZ -#endif -// -// CAVIUM (need CAVIUM headers) -#define MDK_CONF_CAVIUM 0 -#if MDK_CONF_CAVIUM == 1 -#define HAVE_CAVIUM -#endif -// - -// - - - -// -// <<< end of configuration section >>> diff --git a/IDE/MDK5-ARM/Conf/user_settings.h b/IDE/MDK5-ARM/Conf/user_settings.h index f00c6fafe..ab882eaae 100644 --- a/IDE/MDK5-ARM/Conf/user_settings.h +++ b/IDE/MDK5-ARM/Conf/user_settings.h @@ -1,29 +1,515 @@ +/* user_settings.h + * + * Copyright (C) 2006-2017 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ -/* #define SINGLE_THREADED or define RTOS option */ -#define WOLFSSL_CMSIS_RTOS - -/* #define NO_FILESYSTEM or define Filesystem option */ -#define WOLFSSL_KEIL_FS -#define NO_WOLFSSL_DIR -#define WOLFSSL_NO_CURRDIR - -/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */ -#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */ - +#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 your Rand gen for the operational use */ -#define WOLFSSL_GENSEED_FORTEST -#define USE_WOLFSSL_MEMORY -#define WOLFSSL_MALLOC_CHECK +#define TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT +#define WC_RSA_BLINDING -#define XVALIDATEDATE(d, f,t) (0) #define WOLFSSL_USER_CURRTIME /* for benchmark */ +#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */ +#define WOLFSSL_GMTIME +// <<< Use Configuration Wizard in Context Menu >>> + + +// Common options +// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx +#define MDK_CONF_MPU 3 +#if MDK_CONF_MPU == 0 + +#elif MDK_CONF_MPU == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32F2xx +#elif MDK_CONF_MPU == 2 +#define WOLFSSL_STM32_CUBEMX +#define STM32F4xx +#elif MDK_CONF_MPU == 3 +#define WOLFSSL_STM32_CUBEMX +#define STM32F7xx +#endif + +// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <2=>SafeRTOS<3=>Windows +// <4=>PThread <5=>ThreadX<6=> ThreadX/NetX +// <7=>Micrium <8=>EBSnet<9=>MQX +// <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2 +// <13=>Frosted <14=>CMSIS RTOS<15=>Others +#define MDK_CONF_THREAD 14 +#if MDK_CONF_THREAD== 0 +#define SINGLE_THREADED +#elif MDK_CONF_THREAD == 1 +#define FREERTOS +#elif MDK_CONF_THREAD == 3 +#define WOLFSSL_SAFERTOS +#elif MDK_CONF_THREAD == 4 +#define USE_WINDOWS_API +#elif MDK_CONF_THREAD == 5 +#define WOLFSSL_PTHREADS +#elif MDK_CONF_THREAD == 6 +#define THREADX +#define NETX +#elif MDK_CONF_THREAD == 7 +#define MICRIUM +#elif MDK_CONF_THREAD == 8 +#define EBSNET +#elif MDK_CONF_THREAD == 9 +#define FREESCALE_MQX +#define FREESCALE_KSDK_MQX +#elif MDK_CONF_THREAD == 10 +#define WOLFSSL_TIRTOS +#elif MDK_CONF_THREAD == 11 +#define WOLFSSL_uITRON4 +#elif MDK_CONF_THREAD == 12 +#define WOLFSSL_uTKERNEL2 +#elif MDK_CONF_THREAD == 13 +#define WOLFSSL_FROSTED +#elif MDK_CONF_THREAD == 14 +#define WOLFSSL_CMSIS_RTOS +#elif MDK_CONF_THREAD == 15 +#define SINGLE_THREADED +#endif + + +// File System +#define MDK_CONF_FILESYSTEM 1 +#if MDK_CONF_FILESYSTEM == 0 +#define NO_FILESYSTEM +#else +#define WOLFSSL_KEIL_FS +#define NO_WOLFSSL_DIR +#endif +// + +// Network<0=>None <1=>RLnet <2=>User I/O +#define MDK_CONF_NETWORK 1 +#if MDK_CONF_NETWORK == 0 +#elif MDK_CONF_NETWORK == 1 +#define WOLFSSL_KEIL_TCP_NET +#elif MDK_CONF_NETWORK == 2 +#define WOLFSSL_USER_IO +#endif + +// Debug options + +// Debug Message +#define MDK_CONF_DebugMessage 0 +#if MDK_CONF_DebugMessage == 1 +#define DEBUG_WOLFSSL +#endif +// +// Check malloc +#define MDK_CONF_CheckMalloc 1 +#if MDK_CONF_CheckMalloc == 1 +#define WOLFSSL_MALLOC_CHECK +#define USE_WOLFSSL_MEMORY +#endif +// +// ErrNo.h +#define MDK_CONF_ErrNo 1 +#if MDK_CONF_ErrNo == 1 +#define HAVE_ERRNO +#endif +// +// Error Strings +#define MDK_CONF_ErrorStrings 1 +#if MDK_CONF_ErrorStrings == 0 +#define NO_ERROR_STRINGS +#endif +// + +// +// + +// wolfCrypt Configuration + +// Hash/Crypt Algrithm + +// MD2 +#define MDK_CONF_MD2 1 +#if MDK_CONF_MD2 == 1 +#define WOLFSSL_MD2 +#endif +// +// MD4 +#define MDK_CONF_MD4 1 +#if MDK_CONF_MD4 == 0 +#define NO_MD4 +#endif +// +// MD5 +#define MDK_CONF_MD5 1 +#if MDK_CONF_MD5 == 0 +#define NO_MD5 +#endif +// +// SHA +#define MDK_CONF_SHA 1 +#if MDK_CONF_SHA == 0 +#define NO_SHA +#endif +// +// SHA-256 +#define MDK_CONF_SHA256 1 +#if MDK_CONF_SHA256 == 0 +#define NO_SHA256 +#endif +// +// SHA-384 +#define MDK_CONF_SHA384 1 +#if MDK_CONF_SHA384 == 1 +#define WOLFSSL_SHA384 +#endif +// +// SHA-512 +#define MDK_CONF_SHA512 1 +#if MDK_CONF_SHA512 == 1 +#define WOLFSSL_SHA512 +#endif +// +// Hash DRBG +#define MDK_CONF_HASHDRBG 1 +#if MDK_CONF_HASHDRBG == 1 +#define HAVE_HASHDRBG +#endif +// +// RIPEMD +#define MDK_CONF_RIPEMD 1 +#if MDK_CONF_RIPEMD == 1 +#define WOLFSSL_RIPEMD +#endif +// +// BLAKE2 +#define MDK_CONF_BLAKE2 0 +#if MDK_CONF_BLAKE2 == 1 +#define HAVE_BLAKE2 +#endif +// +// HMAC +#define MDK_CONF_HMAC 1 +#if MDK_CONF_HMAC == 0 +#define NO_HMAC +#endif +// +// HMAC KDF +#define MDK_CONF_HKDF 1 +#if MDK_CONF_HKDF == 1 +#define HAVE_HKDF +#endif +// + +// AES CCM +#define MDK_CONF_AESCCM 1 +#if MDK_CONF_AESCCM == 1 +#define HAVE_AESCCM +#endif +// +// AES GCM +#define MDK_CONF_AESGCM 1 +#if MDK_CONF_AESGCM == 1 +#define HAVE_AESGCM +#endif +// + +// RC4 +#define MDK_CONF_RC4 1 +#if MDK_CONF_RC4 == 0 +#define NO_RC4 +#endif +// + +// HC128 +#define MDK_CONF_HC128 1 +#if MDK_CONF_AESGCM == 0 +#define NO_HC128 +#endif +// + +// RABBIT +#define MDK_CONF_RABBIT 1 +#if MDK_CONF_RABBIT == 0 +#define NO_RABBIT +#endif +// + +// CHACHA +#define MDK_CONF_CHACHA 1 +#if MDK_CONF_CHACHA == 1 +#define HAVE_CHACHA +#endif +// + +// POLY1305 +#define MDK_CONF_POLY1305 1 +#if MDK_CONF_POLY1305 == 1 +#define HAVE_POLY1305 +#define HAVE_ONE_TIME_AUTH +#endif +// + +// DES3 +#define MDK_CONF_DES3 1 +#if MDK_CONF_DES3 == 0 +#define NO_DES3 +#endif +// + +// AES +#define MDK_CONF_AES 1 +#if MDK_CONF_AES == 0 +#define NO_AES +#endif +// + +// CAMELLIA +#define MDK_CONF_CAMELLIA 1 +#if MDK_CONF_CAMELLIA == 1 +#define HAVE_CAMELLIA +#endif +// + +// DH +#define MDK_CONF_DH 1 +#if MDK_CONF_DH == 0 +#define NO_DH +#endif +// +// DSA +#define MDK_CONF_DSA 1 +#if MDK_CONF_DSA == 0 +#define NO_DSA +#endif +// + +// SRP +#define MDK_CONF_SRP 1 +#if MDK_CONF_SRP == 1 +#define HAVE_SRP +#endif +// + +// PWDBASED +#define MDK_CONF_PWDBASED 1 +#if MDK_CONF_PWDBASED == 0 +#define NO_PWDBASED +#endif +// + +// ECC +#define MDK_CONF_ECC 1 +#if MDK_CONF_ECC == 1 +#define HAVE_ECC +#endif +// + +// CURVE25519 +#define MDK_CONF_CURVE25519 1 +#if MDK_CONF_CURVE25519 == 1 +#define HAVE_CURVE25519 +#define CURVED25519_SMALL +#endif +// +// CURVE25519 SMALL +#define MDK_CONF_CURVE25519_SMALL 0 +#if MDK_CONF_CURVE25519_SMALL == 1 +#define CURVED25519_SMALL +#endif +// +// ED25519 +#define MDK_CONF_ED25519 1 +#if MDK_CONF_ED25519 == 1 +#define HAVE_ED25519 +#endif +// +// ED25519 SMALL +#define MDK_CONF_ED25519_SMALL 0 +#if MDK_CONF_ED25519_SMALL == 1 +#define ED25519_SMALL +#endif +// +// PKCS7 +#define MDK_CONF_PKCS7 0 +#if MDK_CONF_PKCS7 == 1 +#define HAVE_PKCS7 +#endif +// + +// NTRU (need License, "crypto_ntru.h") +#define MDK_CONF_NTRU 0 +#if MDK_CONF_NTRU == 1 +#define HAVE_NTRU +#endif +// +// + +// Random Seed, for TEST Only +#define MDK_CONF_RNDSEED 1 +#if MDK_CONF_RNDSEED == 1 +#define WOLFSSL_GENSEED_FORTEST +#endif +// + +// Hardware Crypt (See document for usage) +// Hardware RNG +#define MDK_CONF_STM32F2_RNG 1 +#if MDK_CONF_STM32F2_RNG == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_RNG +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Crypt +#define MDK_CONF_STM32F2_CRYPTO 1 +#if MDK_CONF_STM32F2_CRYPTO == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_CRYPTO +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Hash +#define MDK_CONF_STM32F2_HASH 1 +#if MDK_CONF_STM32F2_HASH == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_HASH +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// + +// Cert/Key Strage +// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes) +#define MDK_CONF_CERT_BUFF 0 +#if MDK_CONF_CERT_BUFF== 1 +#define USE_CERT_BUFFERS_1024 +#elif MDK_CONF_CERT_BUFF == 2 +#define USE_CERT_BUFFERS_2048 +#endif +// +// Cert/Key Generation +// CertGen +#define MDK_CONF_CERT_GEN 0 +#if MDK_CONF_CERT_GEN == 1 +#define WOLFSSL_CERT_GEN +#endif +// +// KeyGen +#define MDK_CONF_KEY_GEN 0 +#if MDK_CONF_KEY_GEN == 1 +#define WOLFSSL_KEY_GEN +#endif +// +// +// Use Fast Math +#define MDK_CONF_FASTMATH 1 +#if MDK_CONF_FASTMATH == 1 #define USE_FAST_MATH #define TFM_TIMING_RESISTANT +#endif +// +// Small Stack +#define MDK_CONF_SmallStack 0 +#if MDK_CONF_SmallStack == 0 +#define NO_WOLFSSL_SMALL_STACK +#endif +// -#define BENCH_EMBEDDED +// + + +/**** wolfSSL Configuration ****/ + +// wolfSSL Configuration + +// TLS 1.3 +#define MDK_CONF_TLS 0 +#if MDK_CONF_TLS == 1 +#define WOLFSSL_TLS13 +#define HAVE_TLS_EXTENSIONS +#define WC_RSA_PSS +#define HAVE_HKDF +#define HAVE_FFDHE_2048 +#endif +// + +// Include Old TLS +#define MDK_CONF_NO_OLDTLS 0 +#if MDK_CONF_NO_OLDTLS == 0 +#define NO_OLD_TLS +#endif +// +// CRL +#define MDK_CONF_CRL 0 +#if MDK_CONF_CRL == 1 +#define HAVE_CRL +#define WOLFSSL_DER_LOAD +#endif +// +// OCSP +#define MDK_CONF_OCSP 0 +#if MDK_CONF_OCSP == 1 +#define HAVE_OCSP +#endif +// +// OpenSSL Extra +#define MDK_CONF_OPENSSL_EXTRA 0 +#if MDK_CONF_OPENSSL_EXTRA == 1 +#define OPENSSL_EXTRA +#endif +// + +// -#define NO_WRITEV -#define NO_MAIN_DRIVER diff --git a/IDE/MDK5-ARM/Inc/config.h b/IDE/MDK5-ARM/Inc/config.h deleted file mode 100644 index 5603410fe..000000000 --- a/IDE/MDK5-ARM/Inc/config.h +++ /dev/null @@ -1,58 +0,0 @@ -/* config.h - * - * Copyright (C) 2006-2017 wolfSSL Inc. - * - * This file is part of wolfSSL. - * - * wolfSSL is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * wolfSSL is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA - */ - - -#define __CORTEX_M3__ - -#if defined(MDK_CONF_full) -#include "config-Crypt.h" -#include "config-wolfSSL.h" - -#elif defined(MDK_CONF_SimpleClient) -#include "config-Crypt.h" -#include "config-wolfSSL.h" - -#elif defined(MDK_CONF_SimpleServer) -#include "config-Crypt.h" -#include "config-wolfSSL.h" - -#elif defined(MDK_CONF_EchoClient) -#include "config-Crypt.h" -#include "config-wolfSSL.h" - -#elif defined(MDK_CONF_EchoServer) -#include "config-Crypt.h" -#include "config-wolfSSL.h" - -#elif defined(MDK_CONF_Benchmark) -#define SINGLE_THREADED -#include "config-Crypt.h" - -#elif defined(MDK_CONF_CryptTest) -#define SINGLE_THREADED -#include "config-Crypt.h" - -#elif defined(MDK_CONF_wolfSSL_lib) -#include "config-Crypt.h" -#include "config-wolfSSL.h" -#endif - - diff --git a/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h b/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h index a0fcab9c4..615c3ba9b 100644 --- a/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h +++ b/IDE/MDK5-ARM/Inc/wolfssl_MDK_ARM.h @@ -27,10 +27,6 @@ #include -/* Go to STDIN */ -#define fgets(buff, sz, fd) wolfssl_fgets(buff, sz, fd) -extern char * wolfssl_fgets ( char * str, int num, FILE * f ) ; - #define SOCKET_T int /*** #include ***/ @@ -72,8 +68,9 @@ typedef int socklen_t ; #define tcp_connect wolfssl_tcp_connect #define tcp_socket wolfssl_tcp_soket #define tcp_listen wolfssl_tcp_listen -#define tcp_select(a,b) (0) - +#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); diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/Abstract.txt b/IDE/MDK5-ARM/Projects/CryptBenchmark/Abstract.txt index b929f9bc9..d6ab1ff89 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/Abstract.txt +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/Abstract.txt @@ -1,14 +1,10 @@ -This program is a simple benchmark of wolfCrypt library. +wolfCrypt Benchmark -In order to run this benchmark, copy -{PACK}\wolfSSL\CyaSSL\{version}\cyassl\certs folder and files to the SD memory. +Use Configuration Wizard tab +user_settings.h for wolfCrypt options -For benchmark configuration, refer config-Crypt.h. +For further options, details, see wolfSSL User Manual. -For the hardware crypt on config-Crypt.h, download -STSW-STM32062: STM32F2xx standard peripherals library at -http://www.st.com/. Copy Libraries\STM32F2xx_StdPeriph_Driver\{inc,src} to - {PACK}\cyassl\IDE\MDK5-ARM\STM32F2xx_StdPeriph_Lib Support ------- diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.sct b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.sct new file mode 100644 index 000000000..a9641bd78 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.sct @@ -0,0 +1,14 @@ +LR_IROM1 0x08000000 0x00100000 { ; load region size_region + ER_IROM1 0x08000000 0x00100000 { ; load address = execution address + *.o (RESET, +First) + *(InRoot$$Sections) + .ANY (+RO) + } + RW_IRAM1 0x20010000 0x00040000 { ; RW data + .ANY (+RW +ZI) + } + RW_RETARGET 0x2000FFF0 0x00000010 { + retarget_io.o (+ZI +RW) + } +} + diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx index cf8773119..b1fbf5236 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx @@ -8,7 +8,7 @@ *.c *.s*; *.src; *.a* - *.obj + *.obj; *.o *.lib *.txt; *.h; *.inc *.plm @@ -22,16 +22,16 @@ - CryptBenchmark + wolfSSL-Benchmark 0x4 ARM-ADS - 12000000 + 25000000 1 1 - 0 - 1 + 1 + 0 0 @@ -45,7 +45,7 @@ 79 66 8 - .\Object\ + .\Output\ 1 @@ -78,23 +78,6 @@ 1 18 - - - 0 - Schematics (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf - - - 1 - User Manual (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm - - - 2 - MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) - http://www.keil.com/mcbstm32f200/ - - 0 1 @@ -117,7 +100,8 @@ 1 0 0 - 1 + 1 + 5 @@ -127,10 +111,15 @@ - .\STM32_SWO.ini - BIN\UL2CM3.DLL + + STLink\ST-LINKIII-KEIL_SWO.dll + + 0 + ST-LINKIII-KEIL_SWO + -U303030303030303030303031 -O8399 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO27 -TC216000000 -TP21 -TDS806B -TDT0 -TDC1F -TIEFFFFFFFF -TIP1 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) + 0 ARMRTXEVENTFLAGS @@ -139,18 +128,13 @@ 0 DLGTARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + (1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS - - 0 - ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) - 0 DLGUARM @@ -159,32 +143,28 @@ 0 UL2CM3 - -UM1020ADE -O206 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) + -UV0998FBE -O207 -S10 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO18 -TC216000000 -TP21 -TDS80B8 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) - - + + + 0 1 - 8 - 0x20000408 - 0 - - - - - 2 - 8 - 0x8004dc8 - 0 - - + eth_pins + + + + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.5.0\FileSystem\FileSystem.scvd + Keil.MDK-Middleware.7.5.0 + 1 + 0 0 - 0 + 1 1 0 0 @@ -203,50 +183,29 @@ 0 0 1 - 1 + 0 0 0 0 + 0 + 0 + 0 + + + + + + 1 + 0 + 2 + 2000000 + - - Source - 1 - 0 - 0 - 0 - - 1 - 1 - 1 - 0 - 0 - 0 - 0 - .\main.c - main.c - 0 - 0 - - - 1 - 2 - 1 - 0 - 0 - 0 - 0 - .\time-CortexM3-4.c - time-CortexM3-4.c - 0 - 0 - - - Configuration 1 @@ -254,24 +213,10 @@ 0 0 - 2 - 3 + 1 + 1 5 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 0 - 0 - - - 2 - 4 - 5 - 0 - 0 0 0 .\RTE\wolfSSL\user_settings.h @@ -288,11 +233,10 @@ 0 0 - 3 - 5 + 2 + 2 5 0 - 0 0 0 .\Abstract.txt @@ -302,6 +246,34 @@ + + Source + 1 + 0 + 0 + 0 + + 3 + 3 + 1 + 0 + 0 + 0 + .\main.c + main.c + 0 + 0 + + + + + ::Board Support + 1 + 0 + 0 + 1 + + ::CMSIS 1 diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx index d04bf9176..5642f7a4f 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx @@ -7,21 +7,22 @@ - CryptBenchmark + wolfSSL-Benchmark 0x4 ARM-ADS + 5060422::V5.06 update 4 (build 422)::ARMCC - STM32F207IGHx + STM32F756NGHx STMicroelectronics - Keil.STM32F2xx_DFP.2.2.0 + Keil.STM32F7xx_DFP.2.9.0 http://www.keil.com/pack - IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE + IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) + UL2CM3(-S0 -C0 -P0 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM)) 0 - $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h + $$Device:STM32F756NGHx$Drivers\CMSIS\Device\ST\STM32F7xx\Include\stm32f7xx.h @@ -31,7 +32,7 @@ - $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd + $$Device:STM32F756NGHx$CMSIS\SVD\STM32F7x.svd 0 0 @@ -46,14 +47,14 @@ 0 1 - .\Object\ - CryptBenchmark + .\Output\ + wolfCryptTest 1 0 0 1 1 - .\Object\ + .\Output\ 1 0 0 @@ -84,6 +85,8 @@ 0 0 + 0 + 0 0 @@ -108,11 +111,11 @@ SARMCM3.DLL -REMAP -MPU DCM.DLL - -pCM3 + -pCM7 SARMCM3.DLL -MPU TCM.DLL - -pCM3 + -pCM7 @@ -122,47 +125,6 @@ 0 16 - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - - 0 - 1 - - - - - - - - - - - - - .\STM32_SWO.ini - BIN\UL2CM3.DLL - @@ -171,11 +133,11 @@ 0 1 1 - 4100 + 4096 1 BIN\UL2CM3.DLL - + "" () @@ -211,7 +173,7 @@ 1 0 0 - "Cortex-M3" + "Cortex-M7" 1 0 @@ -220,13 +182,14 @@ 1 0 0 - 0 - 0 - 0 + 2 + 1 + 1 8 0 0 0 + 0 3 3 0 @@ -279,8 +242,8 @@ 0 - 0x20000000 - 0x20000 + 0x20010000 + 0x40000 1 @@ -314,8 +277,8 @@ 1 - 0x0 - 0x0 + 0x200000 + 0x100000 0 @@ -334,13 +297,13 @@ 0 - 0x20000000 - 0x20000 + 0x20010000 + 0x40000 0 - 0x0 - 0x0 + 0x20000000 + 0x10000 @@ -361,9 +324,16 @@ 0 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - HAVE_CONFIG_H MDK_CONF_Benchmark WOLFSSL_USER_SETTINGS + USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS @@ -378,6 +348,7 @@ 0 0 0 + 0 @@ -386,16 +357,16 @@ - 1 + 0 0 0 0 1 0 - 0x08000000 - 0x20000000 + + - + .\CryptBenchmark.sct @@ -405,33 +376,13 @@ - - Source - - - main.c - 1 - .\main.c - - - time-CortexM3-4.c - 1 - .\time-CortexM3-4.c - - - Configuration - - config-Crypt.h - 5 - .\RTE\wolfssl\config-Crypt.h - user_settings.h 5 - .\RTE\wolfssl\user_settings.h + .\RTE\wolfSSL\user_settings.h @@ -445,6 +396,19 @@ + + Source + + + main.c + 1 + .\main.c + + + + + ::Board Support + ::CMSIS @@ -468,351 +432,363 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + - - + + - + - - + + - + + + + + + + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + RTE\CMSIS\RTX_Conf_CM.c - - + + - + - - RTE\Device\STM32F207IGHx\RTE_Device.h - - + + RTE\Device\STM32F756NGHx\RTE_Device.h + + - + - - RTE\Device\STM32F207IGHx\startup_stm32f207xx.s - - + + RTE\Device\STM32F756NGHx\startup_stm32f756xx.s + + - + - - RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h - - + + RTE\Device\STM32F756NGHx\stm32f7xx_hal_conf.h + + - + - - RTE\Device\STM32F207IGHx\system_stm32f2xx.c - - + + RTE\Device\STM32F756NGHx\system_stm32f7xx.c + + - + - - RTE\Device\STM32F207IG\RTE_Device.h - - - - - - RTE\Device\STM32F207IG\startup_stm32f207xx.s - - - - - - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - - RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h - - - - - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - + RTE\File_System\FS_Config.c - - + + - + - + RTE\File_System\FS_Config_MC_0.h - - + + - + - + + RTE\File_System\FS_Config_NOR_0.h + + + + + + + RTE\Network\Net_Config.c - - + + - + RTE\Network\Net_Config_BSD.h - - + + - - RTE\Network\Net_Config_DNS_Client.h - - - - - + RTE\Network\Net_Config_ETH_0.h - - + + - + RTE\Network\Net_Config_TCP.h - - + + - + RTE\Network\Net_Config_UDP.h - - - - - - RTE\Network\Net_Debug.c - - - - - - RTE\Other\config-Crypt.h - - - - - - RTE\Other\config-FS.h - - - - - - RTE\Other\config-RTX-TCP-FS.h - - - - - - RTE\Other\config.h - - + + - RTE\wolfssl\config-Crypt.h - - - - - - - - RTE\wolfssl\config.h - - + RTE\wolfSSL\config-Crypt.h + + - - RTE\wolfssl\settings.h - - + + RTE\wolfSSL\config-wolfSSL.h + + - RTE\wolfssl\user_settings.h - - + RTE\wolfSSL\user_settings.h + + - + diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h index f00c6fafe..dbf6ad929 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/RTE/wolfSSL/user_settings.h @@ -1,29 +1,515 @@ - -/* #define SINGLE_THREADED or define RTOS option */ -#define WOLFSSL_CMSIS_RTOS - -/* #define NO_FILESYSTEM or define Filesystem option */ -#define WOLFSSL_KEIL_FS -#define NO_WOLFSSL_DIR -#define WOLFSSL_NO_CURRDIR - -/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */ -#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */ - +/* user_settings.h + * + * Copyright (C) 2006-2017 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + +#define NO_MAIN_DRIVER +#define BENCH_EMBEDDED +#define NO_DEV_RANDOM +#define WOLFSSL_USER_CURRTIME +#define SIZEOF_LONG_LONG 8 +#define NO_WRITEV #define NO_DEV_RANDOM -/* define your Rand gen for the operational use */ -#define WOLFSSL_GENSEED_FORTEST -#define USE_WOLFSSL_MEMORY -#define WOLFSSL_MALLOC_CHECK +#define TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT +#define WC_RSA_BLINDING -#define XVALIDATEDATE(d, f,t) (0) #define WOLFSSL_USER_CURRTIME /* for benchmark */ +#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */ +#define WOLFSSL_GMTIME +// <<< Use Configuration Wizard in Context Menu >>> + + +// Common options +// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx +#define MDK_CONF_MPU 3 +#if MDK_CONF_MPU == 0 + +#elif MDK_CONF_MPU == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32F2xx +#elif MDK_CONF_MPU == 2 +#define WOLFSSL_STM32_CUBEMX +#define STM32F4xx +#elif MDK_CONF_MPU == 3 +#define WOLFSSL_STM32_CUBEMX +#define STM32F7xx +#endif + +// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <2=>SafeRTOS<3=>Windows +// <4=>PThread <5=>ThreadX<6=> ThreadX/NetX +// <7=>Micrium <8=>EBSnet<9=>MQX +// <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2 +// <13=>Frosted <14=>CMSIS RTOS<15=>Others +#define MDK_CONF_THREAD 14 +#if MDK_CONF_THREAD== 0 +#define SINGLE_THREADED +#elif MDK_CONF_THREAD == 1 +#define FREERTOS +#elif MDK_CONF_THREAD == 3 +#define WOLFSSL_SAFERTOS +#elif MDK_CONF_THREAD == 4 +#define USE_WINDOWS_API +#elif MDK_CONF_THREAD == 5 +#define WOLFSSL_PTHREADS +#elif MDK_CONF_THREAD == 6 +#define THREADX +#define NETX +#elif MDK_CONF_THREAD == 7 +#define MICRIUM +#elif MDK_CONF_THREAD == 8 +#define EBSNET +#elif MDK_CONF_THREAD == 9 +#define FREESCALE_MQX +#define FREESCALE_KSDK_MQX +#elif MDK_CONF_THREAD == 10 +#define WOLFSSL_TIRTOS +#elif MDK_CONF_THREAD == 11 +#define WOLFSSL_uITRON4 +#elif MDK_CONF_THREAD == 12 +#define WOLFSSL_uTKERNEL2 +#elif MDK_CONF_THREAD == 13 +#define WOLFSSL_FROSTED +#elif MDK_CONF_THREAD == 14 +#define WOLFSSL_CMSIS_RTOS +#elif MDK_CONF_THREAD == 15 +#define SINGLE_THREADED +#endif + + +// File System +#define MDK_CONF_FILESYSTEM 1 +#if MDK_CONF_FILESYSTEM == 0 +#define NO_FILESYSTEM +#else +#define WOLFSSL_KEIL_FS +#define NO_WOLFSSL_DIR +#endif +// + +// Network<0=>None <1=>RLnet <2=>User I/O +#define MDK_CONF_NETWORK 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 + +// Debug options + +// Debug Message +#define MDK_CONF_DebugMessage 0 +#if MDK_CONF_DebugMessage == 1 +#define DEBUG_WOLFSSL +#endif +// +// Check malloc +#define MDK_CONF_CheckMalloc 1 +#if MDK_CONF_CheckMalloc == 1 +#define WOLFSSL_MALLOC_CHECK +#define USE_WOLFSSL_MEMORY +#endif +// +// ErrNo.h +#define MDK_CONF_ErrNo 1 +#if MDK_CONF_ErrNo == 1 +#define HAVE_ERRNO +#endif +// +// Error Strings +#define MDK_CONF_ErrorStrings 1 +#if MDK_CONF_ErrorStrings == 0 +#define NO_ERROR_STRINGS +#endif +// + +// +// + +// wolfCrypt Configuration + +// Hash/Crypt Algrithm + +// MD2 +#define MDK_CONF_MD2 1 +#if MDK_CONF_MD2 == 1 +#define WOLFSSL_MD2 +#endif +// +// MD4 +#define MDK_CONF_MD4 1 +#if MDK_CONF_MD4 == 0 +#define NO_MD4 +#endif +// +// MD5 +#define MDK_CONF_MD5 1 +#if MDK_CONF_MD5 == 0 +#define NO_MD5 +#endif +// +// SHA +#define MDK_CONF_SHA 1 +#if MDK_CONF_SHA == 0 +#define NO_SHA +#endif +// +// SHA-256 +#define MDK_CONF_SHA256 1 +#if MDK_CONF_SHA256 == 0 +#define NO_SHA256 +#endif +// +// SHA-384 +#define MDK_CONF_SHA384 1 +#if MDK_CONF_SHA384 == 1 +#define WOLFSSL_SHA384 +#endif +// +// SHA-512 +#define MDK_CONF_SHA512 1 +#if MDK_CONF_SHA512 == 1 +#define WOLFSSL_SHA512 +#endif +// +// Hash DRBG +#define MDK_CONF_HASHDRBG 1 +#if MDK_CONF_HASHDRBG == 1 +#define HAVE_HASHDRBG +#endif +// +// RIPEMD +#define MDK_CONF_RIPEMD 1 +#if MDK_CONF_RIPEMD == 1 +#define WOLFSSL_RIPEMD +#endif +// +// BLAKE2 +#define MDK_CONF_BLAKE2 0 +#if MDK_CONF_BLAKE2 == 1 +#define HAVE_BLAKE2 +#endif +// +// HMAC +#define MDK_CONF_HMAC 1 +#if MDK_CONF_HMAC == 0 +#define NO_HMAC +#endif +// +// HMAC KDF +#define MDK_CONF_HKDF 1 +#if MDK_CONF_HKDF == 1 +#define HAVE_HKDF +#endif +// + +// AES CCM +#define MDK_CONF_AESCCM 1 +#if MDK_CONF_AESCCM == 1 +#define HAVE_AESCCM +#endif +// +// AES GCM +#define MDK_CONF_AESGCM 1 +#if MDK_CONF_AESGCM == 1 +#define HAVE_AESGCM +#endif +// + +// RC4 +#define MDK_CONF_RC4 1 +#if MDK_CONF_RC4 == 0 +#define NO_RC4 +#endif +// + +// HC128 +#define MDK_CONF_HC128 1 +#if MDK_CONF_AESGCM == 0 +#define NO_HC128 +#endif +// + +// RABBIT +#define MDK_CONF_RABBIT 1 +#if MDK_CONF_RABBIT == 0 +#define NO_RABBIT +#endif +// + +// CHACHA +#define MDK_CONF_CHACHA 1 +#if MDK_CONF_CHACHA == 1 +#define HAVE_CHACHA +#endif +// + +// POLY1305 +#define MDK_CONF_POLY1305 1 +#if MDK_CONF_POLY1305 == 1 +#define HAVE_POLY1305 +#define HAVE_ONE_TIME_AUTH +#endif +// + +// DES3 +#define MDK_CONF_DES3 1 +#if MDK_CONF_DES3 == 0 +#define NO_DES3 +#endif +// + +// AES +#define MDK_CONF_AES 1 +#if MDK_CONF_AES == 0 +#define NO_AES +#endif +// + +// CAMELLIA +#define MDK_CONF_CAMELLIA 1 +#if MDK_CONF_CAMELLIA == 1 +#define HAVE_CAMELLIA +#endif +// + +// DH +#define MDK_CONF_DH 1 +#if MDK_CONF_DH == 0 +#define NO_DH +#endif +// +// DSA +#define MDK_CONF_DSA 1 +#if MDK_CONF_DSA == 0 +#define NO_DSA +#endif +// + +// SRP +#define MDK_CONF_SRP 1 +#if MDK_CONF_SRP == 1 +#define HAVE_SRP +#endif +// + +// PWDBASED +#define MDK_CONF_PWDBASED 1 +#if MDK_CONF_PWDBASED == 0 +#define NO_PWDBASED +#endif +// + +// ECC +#define MDK_CONF_ECC 1 +#if MDK_CONF_ECC == 1 +#define HAVE_ECC +#endif +// + +// CURVE25519 +#define MDK_CONF_CURVE25519 1 +#if MDK_CONF_CURVE25519 == 1 +#define HAVE_CURVE25519 +#define CURVED25519_SMALL +#endif +// +// CURVE25519 SMALL +#define MDK_CONF_CURVE25519_SMALL 0 +#if MDK_CONF_CURVE25519_SMALL == 1 +#define CURVED25519_SMALL +#endif +// +// ED25519 +#define MDK_CONF_ED25519 1 +#if MDK_CONF_ED25519 == 1 +#define HAVE_ED25519 +#endif +// +// ED25519 SMALL +#define MDK_CONF_ED25519_SMALL 0 +#if MDK_CONF_ED25519_SMALL == 1 +#define ED25519_SMALL +#endif +// +// PKCS7 +#define MDK_CONF_PKCS7 0 +#if MDK_CONF_PKCS7 == 1 +#define HAVE_PKCS7 +#endif +// + +// NTRU (need License, "crypto_ntru.h") +#define MDK_CONF_NTRU 0 +#if MDK_CONF_NTRU == 1 +#define HAVE_NTRU +#endif +// +// + +// Random Seed, for TEST Only +#define MDK_CONF_RNDSEED 1 +#if MDK_CONF_RNDSEED == 1 +#define WOLFSSL_GENSEED_FORTEST +#endif +// + +// Hardware Crypt (See document for usage) +// Hardware RNG +#define MDK_CONF_STM32F2_RNG 1 +#if MDK_CONF_STM32F2_RNG == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_RNG +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Crypt +#define MDK_CONF_STM32F2_CRYPTO 1 +#if MDK_CONF_STM32F2_CRYPTO == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_CRYPTO +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Hash +#define MDK_CONF_STM32F2_HASH 1 +#if MDK_CONF_STM32F2_HASH == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_HASH +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// + +// Cert/Key Strage +// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes) +#define MDK_CONF_CERT_BUFF 0 +#if MDK_CONF_CERT_BUFF== 1 +#define USE_CERT_BUFFERS_1024 +#elif MDK_CONF_CERT_BUFF == 2 +#define USE_CERT_BUFFERS_2048 +#endif +// +// Cert/Key Generation +// CertGen +#define MDK_CONF_CERT_GEN 0 +#if MDK_CONF_CERT_GEN == 1 +#define WOLFSSL_CERT_GEN +#endif +// +// KeyGen +#define MDK_CONF_KEY_GEN 0 +#if MDK_CONF_KEY_GEN == 1 +#define WOLFSSL_KEY_GEN +#endif +// +// +// Use Fast Math +#define MDK_CONF_FASTMATH 1 +#if MDK_CONF_FASTMATH == 1 #define USE_FAST_MATH #define TFM_TIMING_RESISTANT +#endif +// +// Small Stack +#define MDK_CONF_SmallStack 0 +#if MDK_CONF_SmallStack == 0 +#define NO_WOLFSSL_SMALL_STACK +#endif +// -#define BENCH_EMBEDDED +// + + +/**** wolfSSL Configuration ****/ + +// wolfSSL Configuration + +// TLS 1.3 +#define MDK_CONF_TLS 0 +#if MDK_CONF_TLS == 1 +#define WOLFSSL_TLS13 +#define HAVE_TLS_EXTENSIONS +#define WC_RSA_PSS +#define HAVE_HKDF +#define HAVE_FFDHE_2048 +#endif +// + +// Include Old TLS +#define MDK_CONF_NO_OLDTLS 0 +#if MDK_CONF_NO_OLDTLS == 0 +#define NO_OLD_TLS +#endif +// +// CRL +#define MDK_CONF_CRL 0 +#if MDK_CONF_CRL == 1 +#define HAVE_CRL +#define WOLFSSL_DER_LOAD +#endif +// +// OCSP +#define MDK_CONF_OCSP 0 +#if MDK_CONF_OCSP == 1 +#define HAVE_OCSP +#endif +// +// OpenSSL Extra +#define MDK_CONF_OPENSSL_EXTRA 0 +#if MDK_CONF_OPENSSL_EXTRA == 1 +#define OPENSSL_EXTRA +#endif +// + +// -#define NO_WRITEV -#define NO_MAIN_DRIVER diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c b/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c index 0ce49c0b6..25d9e3b5e 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/main.c @@ -28,16 +28,81 @@ #include "wolfcrypt/test/test.h" #include -#include "stm32f2xx_hal.h" -#include "cmsis_os.h" +#include + +/* Dummy definition for test RTC */ +#define RTC_YEAR 2018 +#define RTC_MONTH 1 +#define RTC_DAY 1 + +#if defined(STM32F7xx) +#include "stm32f7xx_hal.h" +#elif defined(STM32F4xx) +#include "stm32f4xx_hal.h" +#elif defined(STM32F2xx) +#include "stm32f2xx_hal.h" +#endif + +#warning "write MPU specific Set ups\n" +static void SystemClock_Config (void) { -/*----------------------------------------------------------------------------- - * System Clock Configuration - *----------------------------------------------------------------------------*/ -void SystemClock_Config(void) { - #warning "write MPU specific System Clock Set up\n" } +static void MPU_Config (void) { + +} + +static void CPU_CACHE_Enable (void) { + +} + +#ifdef RTE_CMSIS_RTOS_RTX +extern uint32_t os_time; +static time_t epochTime; + +uint32_t HAL_GetTick(void) { + return os_time; +} + +time_t time(time_t *t){ + return epochTime ; +} + +void setTime(time_t t){ + epochTime = t; +} +#endif + +#ifdef WOLFSSL_CURRTIME_OSTICK + +#include +extern uint32_t os_time; + +double current_time(int reset) +{ + if(reset) os_time = 0 ; + return (double)os_time /1000.0; +} + +#else + +#include +#define DWT ((DWT_Type *) (0xE0001000UL) ) +typedef struct +{ + uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ +} DWT_Type; + +extern uint32_t SystemCoreClock ; + +double current_time(int reset) +{ + if(reset) DWT->CYCCNT = 0 ; + return ((double)DWT->CYCCNT/SystemCoreClock) ; +} +#endif + /*----------------------------------------------------------------------------- * Initialize a Flash Memory Card *----------------------------------------------------------------------------*/ @@ -48,13 +113,13 @@ static void init_filesystem (void) { int32_t retv; retv = finit ("M0:"); - if (retv == 0) { + if (retv == fsOK) { retv = fmount ("M0:"); - if (retv == 0) { + if (retv == fsOK) { printf ("Drive M0 ready!\n"); } else { - printf ("Drive M0 mount failed!\n"); + printf ("Drive M0 mount failed(%d)!\n", retv); } } else { @@ -66,22 +131,26 @@ static void init_filesystem (void) { /*----------------------------------------------------------------------------- * mian entry *----------------------------------------------------------------------------*/ - void benchmark_test(void *arg) ; +void benchmark_test(void *arg) ; + int main() { - void * arg = NULL ; + void * arg = NULL ; + + MPU_Config(); + CPU_CACHE_Enable(); + HAL_Init(); /* Initialize the HAL Library */ + SystemClock_Config(); /* Configure the System Clock */ - HAL_Init(); /* Initialize the HAL Library */ - SystemClock_Config(); /* Configure the System Clock */ - - #if !defined(NO_FILESYSTEM) - init_filesystem (); - #endif - osDelay(300) ; - - printf("=== Start: Crypt Benchmark ===\n") ; - benchmark_test(arg) ; - printf("=== End: Crypt Benchmark ===\n") ; + #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); + printf("=== Start: Crypt Benchmark ===\n") ; + benchmark_test(arg) ; + printf("=== End: Crypt Benchmark ===\n") ; } + diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/time-CortexM3-4.c b/IDE/MDK5-ARM/Projects/CryptBenchmark/time-CortexM3-4.c deleted file mode 100644 index 115a4f672..000000000 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/time-CortexM3-4.c +++ /dev/null @@ -1,42 +0,0 @@ -/* time-STM32F2.c - * - * Copyright (C) 2006-2017 wolfSSL Inc. - * - * This file is part of wolfSSL. - * - * wolfSSL is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * wolfSSL is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA - */ - - -#ifdef HAVE_CONFIG_H - #include -#endif - - -#include -#define DWT ((DWT_Type *) (0xE0001000UL) ) -typedef struct -{ - uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ - uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ -} DWT_Type; - -extern uint32_t SystemCoreClock ; - -double current_time(int reset) -{ - if(reset) DWT->CYCCNT = 0 ; - return ((double)DWT->CYCCNT/SystemCoreClock) ; -} diff --git a/IDE/MDK5-ARM/Projects/CryptTest/Abstract.txt b/IDE/MDK5-ARM/Projects/CryptTest/Abstract.txt index 886be85b8..72a0fce0e 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/Abstract.txt +++ b/IDE/MDK5-ARM/Projects/CryptTest/Abstract.txt @@ -1,16 +1,11 @@ -This program is a simple test suite of wolfCrypt library. +wolfCrypt test -In order to run this test suite, copy -{PACK}\wolfSSL\CyaSSL\{version}\cyassl\certs folder and files to the SD memory. +Use Configuration Wizard tab +user_settings.h for wolfCrypt options -For selecting test crypt algorism options, refer config-Crypt.h. - -For the hardware crypt on config-Crypt.h, download -STSW-STM32062: STM32F2xx standard peripherals library at -http://www.st.com/. Copy Libraries\STM32F2xx_StdPeriph_Driver\{inc,src} to - {PACK}\cyassl\IDE\MDK5-ARM\STM32F2xx_StdPeriph_Lib +For further options, details, see wolfSSL User Manual. - Support +Support ------- Please send questions or comments to support@wolfssl.com diff --git a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.sct b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.sct new file mode 100644 index 000000000..a9641bd78 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.sct @@ -0,0 +1,14 @@ +LR_IROM1 0x08000000 0x00100000 { ; load region size_region + ER_IROM1 0x08000000 0x00100000 { ; load address = execution address + *.o (RESET, +First) + *(InRoot$$Sections) + .ANY (+RO) + } + RW_IRAM1 0x20010000 0x00040000 { ; RW data + .ANY (+RW +ZI) + } + RW_RETARGET 0x2000FFF0 0x00000010 { + retarget_io.o (+ZI +RW) + } +} + diff --git a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx index f0f9517f4..c0dbc1d86 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx +++ b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx @@ -8,7 +8,7 @@ *.c *.s*; *.src; *.a* - *.obj + *.obj; *.o *.lib *.txt; *.h; *.inc *.plm @@ -26,12 +26,12 @@ 0x4 ARM-ADS - 12000000 + 25000000 1 1 - 0 - 1 + 1 + 0 0 @@ -45,7 +45,7 @@ 79 66 8 - .\Object\ + .\Output\ 1 @@ -78,23 +78,6 @@ 1 18 - - - 0 - Schematics (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf - - - 1 - User Manual (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm - - - 2 - MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) - http://www.keil.com/mcbstm32f200/ - - 0 1 @@ -117,7 +100,8 @@ 1 0 0 - 1 + 1 + 5 @@ -128,9 +112,14 @@ .\STM32_SWO.ini - BIN\UL2CM3.DLL + STLink\ST-LINKIII-KEIL_SWO.dll + + 0 + ST-LINKIII-KEIL_SWO + -U303030303030303030303031 -O8399 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO1 -TC216000000 -TP21 -TDS86F -TDT0 -TDC1F -TIE1 -TIP1 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) + 0 ARMRTXEVENTFLAGS @@ -138,13 +127,13 @@ 0 - DLGUARM - (105=-1,-1,-1,-1,0) + ULP2CM3 + -UP0940001 -O207 -S10 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO1 -TC216000000 -TP11 -TDX0 -TDD0 -TDS8001 -TDT0 -TDC1F -TIE1 -TIP1 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) 0 DLGTARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + (1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 @@ -153,38 +142,39 @@ 0 - ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO7 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) + DLGUARM + (105=-1,-1,-1,-1,0) 0 UL2CM3 - -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) + -UV0998FBE -O207 -S10 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO1 -TC216000000 -TP21 -TDS86F -TDT0 -TDC1F -TIE1 -TIP1 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) - - + + + 0 1 - 8 - clientKey - 0 - - - - - 2 - 8 - 0x8004dc8 - 0 - - + mfxstm32l152Identifier + + + + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.5.0\FileSystem\FileSystem.scvd + Keil.MDK-Middleware.7.5.0 + 1 + + + C:\Keil_v5\ARM\PACK\Keil\ARM_Compiler\1.3.2\EventRecorder.scvd + Keil.ARM_Compiler.1.3.2 + 1 + 0 0 - 0 + 1 1 0 0 @@ -210,6 +200,19 @@ + 0 + 0 + 0 + + + + + + 1 + 0 + 2 + 2000000 + @@ -224,7 +227,6 @@ 1 1 0 - 0 0 0 .\main.c @@ -234,6 +236,46 @@ + + Linker Script + 1 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + .\CryptTest.sct + CryptTest.sct + 0 + 0 + + + + + Documentation + 0 + 0 + 0 + 0 + + 3 + 3 + 5 + 0 + 0 + 0 + .\Abstract.txt + Abstract.txt + 0 + 0 + + + Configuration 1 @@ -241,24 +283,10 @@ 0 0 - 2 - 2 + 4 + 4 5 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 0 - 0 - - - 2 - 3 - 5 - 0 - 0 0 0 .\RTE\wolfSSL\user_settings.h @@ -269,24 +297,11 @@ - Documentation + ::Board Support 1 0 0 - 0 - - 3 - 4 - 5 - 0 - 0 - 0 - 0 - .\Abstract.txt - Abstract.txt - 0 - 0 - + 1 diff --git a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx index f5810fcd3..e860a9aa7 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx +++ b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx @@ -10,18 +10,19 @@ CryptTest 0x4 ARM-ADS + 5060422::V5.06 update 4 (build 422)::ARMCC - STM32F207IGHx + STM32F756NGHx STMicroelectronics - Keil.STM32F2xx_DFP.2.2.0 + Keil.STM32F7xx_DFP.2.9.0 http://www.keil.com/pack - IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE + IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) + UL2CM3(-S0 -C0 -P0 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM)) 0 - $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h + $$Device:STM32F756NGHx$Drivers\CMSIS\Device\ST\STM32F7xx\Include\stm32f7xx.h @@ -31,7 +32,7 @@ - $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd + $$Device:STM32F756NGHx$CMSIS\SVD\STM32F7x.svd 0 0 @@ -46,14 +47,14 @@ 0 1 - .\Object\ + .\Output\ CryptTest 1 0 0 1 1 - .\Object\ + .\Output\ 1 0 0 @@ -84,6 +85,8 @@ 0 0 + 0 + 0 0 @@ -108,11 +111,11 @@ SARMCM3.DLL -REMAP -MPU DCM.DLL - -pCM3 + -pCM7 SARMCM3.DLL -MPU TCM.DLL - -pCM3 + -pCM7 @@ -122,47 +125,6 @@ 0 16 - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - - 0 - 1 - - - - - - - - - - - - - .\STM32_SWO.ini - BIN\UL2CM3.DLL - @@ -171,11 +133,11 @@ 0 1 1 - 4100 + 4096 1 BIN\UL2CM3.DLL - + "" () @@ -211,7 +173,7 @@ 1 0 0 - "Cortex-M3" + "Cortex-M7" 1 0 @@ -220,13 +182,14 @@ 1 0 0 - 0 - 0 - 0 + 2 + 1 + 1 8 0 0 0 + 0 3 3 0 @@ -279,8 +242,8 @@ 0 - 0x20000000 - 0x20000 + 0x20010000 + 0x40000 1 @@ -314,8 +277,8 @@ 1 - 0x0 - 0x0 + 0x200000 + 0x100000 0 @@ -334,13 +297,13 @@ 0 - 0x20000000 - 0x20000 + 0x20010000 + 0x40000 0 - 0x0 - 0x0 + 0x20000000 + 0x10000 @@ -361,9 +324,16 @@ 0 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - HAVE_CONFIG_H WOLFSSL_USER_SETTINGS MDK_CONF_CryptTest + USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS @@ -378,6 +348,7 @@ 0 0 0 + 0 @@ -386,16 +357,16 @@ - 1 + 0 0 0 0 1 0 - 0x08000000 - 0x20000000 + + - + .\CryptTest.sct @@ -416,17 +387,12 @@ - Configuration + Linker Script - config-Crypt.h + CryptTest.sct 5 - .\RTE\wolfSSL\config-Crypt.h - - - user_settings.h - 5 - .\RTE\wolfSSL\user_settings.h + .\CryptTest.sct @@ -440,6 +406,19 @@ + + Configuration + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h + + + + + ::Board Support + ::CMSIS @@ -463,367 +442,319 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + RTE\CMSIS\RTX_Conf_CM.c - - + + - - RTE\Device\STM32F207IGHx\RTE_Device.h - - + + RTE\Compiler\EventRecorderConf.h + + - - RTE\Device\STM32F207IGHx\startup_stm32f207xx.s - - + + RTE\Device\STM32F756NGHx\RTE_Device.h + + - - RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h - - + + RTE\Device\STM32F756NGHx\startup_stm32f756xx.s + + - - RTE\Device\STM32F207IGHx\system_stm32f2xx.c - - + + RTE\Device\STM32F756NGHx\stm32f7xx_hal_conf.h + + - - RTE\Device\STM32F207IGTx\RTE_Device.h - - - + + RTE\Device\STM32F756NGHx\system_stm32f7xx.c + + + + + - - RTE\Device\STM32F207IGTx\startup_stm32f207xx.s - - - - - - RTE\Device\STM32F207IGTx\stm32f2xx_hal_conf.h - - - - - - RTE\Device\STM32F207IGTx\system_stm32f2xx.c - - - - - - RTE\Device\STM32F207IG\RTE_Device.h - - - - - - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - + RTE\File_System\FS_Config.c - - + + - + RTE\File_System\FS_Config_MC_0.h - - + + - - RTE\Network\Net_Config.c - - - - - - RTE\Network\Net_Config_BSD.h - - - - - - RTE\Network\Net_Config_DNS_Client.h - - - - - - RTE\Network\Net_Config_ETH_0.h - - - - - - RTE\Network\Net_Config_TCP.h - - - - - - RTE\Network\Net_Config_UDP.h - - - - - - RTE\Network\Net_Debug.c - - - - - - RTE\Other\config-Crypt.h - - - - - - RTE\Other\config-FS.h - - - - - - RTE\Other\config-RTX-TCP-FS.h - - - - - - RTE\Other\config.h - - + + RTE\File_System\FS_Config_NOR_0.h + + - RTE\wolfSSL\config-Crypt.h - - - - - - - - RTE\wolfSSL\config.h - - - - - - RTE\wolfSSL\settings.h - - + RTE\wolfSSL\config-Crypt.h + + RTE\wolfSSL\user_settings.h - - + + diff --git a/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h index 38f402b0f..a444230ef 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h +++ b/IDE/MDK5-ARM/Projects/CryptTest/RTE/wolfSSL/user_settings.h @@ -1,31 +1,515 @@ +/* user_settings.h + * + * Copyright (C) 2006-2017 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ -/* #define SINGLE_THREADED or define RTOS option */ -#define WOLFSSL_CMSIS_RTOS - -/* #define NO_FILESYSTEM or define Filesystem option */ -#define WOLFSSL_KEIL_FS -#define NO_WOLFSSL_DIR -#define WOLFSSL_NO_CURRDIR - -/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */ -#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */ - +#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 your Rand gen for the operational use */ -#define WOLFSSL_GENSEED_FORTEST -#define USE_WOLFSSL_MEMORY -#define WOLFSSL_MALLOC_CHECK +#define TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT +#define WC_RSA_BLINDING -#define XVALIDATEDATE(d, f,t) (0) #define WOLFSSL_USER_CURRTIME /* for benchmark */ +#define WOLFSSL_CURRTIME_OSTICK /* use OS tich for current_time */ +#define WOLFSSL_GMTIME +// <<< Use Configuration Wizard in Context Menu >>> + + +// Common options +// MPU<0=>Undefined<1=>STM32F2xx<2=>STM32F4xx<3=>STM32F7xx +#define MDK_CONF_MPU 3 +#if MDK_CONF_MPU == 0 + +#elif MDK_CONF_MPU == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32F2xx +#elif MDK_CONF_MPU == 2 +#define WOLFSSL_STM32_CUBEMX +#define STM32F4xx +#elif MDK_CONF_MPU == 3 +#define WOLFSSL_STM32_CUBEMX +#define STM32F7xx +#endif + +// Thread/RTOS<0=>Single Threaded <1=>FreeRTOS <2=>SafeRTOS<3=>Windows +// <4=>PThread <5=>ThreadX<6=> ThreadX/NetX +// <7=>Micrium <8=>EBSnet<9=>MQX +// <10=>T-RTOS <11=>uITRON4<12=>uTKERNEL2 +// <13=>Frosted <14=>CMSIS RTOS<15=>Others +#define MDK_CONF_THREAD 14 +#if MDK_CONF_THREAD== 0 +#define SINGLE_THREADED +#elif MDK_CONF_THREAD == 1 +#define FREERTOS +#elif MDK_CONF_THREAD == 3 +#define WOLFSSL_SAFERTOS +#elif MDK_CONF_THREAD == 4 +#define USE_WINDOWS_API +#elif MDK_CONF_THREAD == 5 +#define WOLFSSL_PTHREADS +#elif MDK_CONF_THREAD == 6 +#define THREADX +#define NETX +#elif MDK_CONF_THREAD == 7 +#define MICRIUM +#elif MDK_CONF_THREAD == 8 +#define EBSNET +#elif MDK_CONF_THREAD == 9 +#define FREESCALE_MQX +#define FREESCALE_KSDK_MQX +#elif MDK_CONF_THREAD == 10 +#define WOLFSSL_TIRTOS +#elif MDK_CONF_THREAD == 11 +#define WOLFSSL_uITRON4 +#elif MDK_CONF_THREAD == 12 +#define WOLFSSL_uTKERNEL2 +#elif MDK_CONF_THREAD == 13 +#define WOLFSSL_FROSTED +#elif MDK_CONF_THREAD == 14 +#define WOLFSSL_CMSIS_RTOS +#elif MDK_CONF_THREAD == 15 +#define SINGLE_THREADED +#endif + + +// File System +#define MDK_CONF_FILESYSTEM 1 +#if MDK_CONF_FILESYSTEM == 0 +#define NO_FILESYSTEM +#else +#define WOLFSSL_KEIL_FS +#define NO_WOLFSSL_DIR +#endif +// + +// Network<0=>None <1=>RLnet <2=>User I/O +#define MDK_CONF_NETWORK 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 + +// Debug options + +// Debug Message +#define MDK_CONF_DebugMessage 0 +#if MDK_CONF_DebugMessage == 1 +#define DEBUG_WOLFSSL +#endif +// +// Check malloc +#define MDK_CONF_CheckMalloc 1 +#if MDK_CONF_CheckMalloc == 1 +#define WOLFSSL_MALLOC_CHECK +#define USE_WOLFSSL_MEMORY +#endif +// +// ErrNo.h +#define MDK_CONF_ErrNo 1 +#if MDK_CONF_ErrNo == 1 +#define HAVE_ERRNO +#endif +// +// Error Strings +#define MDK_CONF_ErrorStrings 1 +#if MDK_CONF_ErrorStrings == 0 +#define NO_ERROR_STRINGS +#endif +// + +// +// + +// wolfCrypt Configuration + +// Hash/Crypt Algrithm + +// MD2 +#define MDK_CONF_MD2 1 +#if MDK_CONF_MD2 == 1 +#define WOLFSSL_MD2 +#endif +// +// MD4 +#define MDK_CONF_MD4 1 +#if MDK_CONF_MD4 == 0 +#define NO_MD4 +#endif +// +// MD5 +#define MDK_CONF_MD5 1 +#if MDK_CONF_MD5 == 0 +#define NO_MD5 +#endif +// +// SHA +#define MDK_CONF_SHA 1 +#if MDK_CONF_SHA == 0 +#define NO_SHA +#endif +// +// SHA-256 +#define MDK_CONF_SHA256 1 +#if MDK_CONF_SHA256 == 0 +#define NO_SHA256 +#endif +// +// SHA-384 +#define MDK_CONF_SHA384 1 +#if MDK_CONF_SHA384 == 1 +#define WOLFSSL_SHA384 +#endif +// +// SHA-512 +#define MDK_CONF_SHA512 1 +#if MDK_CONF_SHA512 == 1 +#define WOLFSSL_SHA512 +#endif +// +// Hash DRBG +#define MDK_CONF_HASHDRBG 1 +#if MDK_CONF_HASHDRBG == 1 +#define HAVE_HASHDRBG +#endif +// +// RIPEMD +#define MDK_CONF_RIPEMD 1 +#if MDK_CONF_RIPEMD == 1 +#define WOLFSSL_RIPEMD +#endif +// +// BLAKE2 +#define MDK_CONF_BLAKE2 0 +#if MDK_CONF_BLAKE2 == 1 +#define HAVE_BLAKE2 +#endif +// +// HMAC +#define MDK_CONF_HMAC 1 +#if MDK_CONF_HMAC == 0 +#define NO_HMAC +#endif +// +// HMAC KDF +#define MDK_CONF_HKDF 1 +#if MDK_CONF_HKDF == 1 +#define HAVE_HKDF +#endif +// + +// AES CCM +#define MDK_CONF_AESCCM 1 +#if MDK_CONF_AESCCM == 1 +#define HAVE_AESCCM +#endif +// +// AES GCM +#define MDK_CONF_AESGCM 1 +#if MDK_CONF_AESGCM == 1 +#define HAVE_AESGCM +#endif +// + +// RC4 +#define MDK_CONF_RC4 1 +#if MDK_CONF_RC4 == 0 +#define NO_RC4 +#endif +// + +// HC128 +#define MDK_CONF_HC128 1 +#if MDK_CONF_AESGCM == 0 +#define NO_HC128 +#endif +// + +// RABBIT +#define MDK_CONF_RABBIT 1 +#if MDK_CONF_RABBIT == 0 +#define NO_RABBIT +#endif +// + +// CHACHA +#define MDK_CONF_CHACHA 1 +#if MDK_CONF_CHACHA == 1 +#define HAVE_CHACHA +#endif +// + +// POLY1305 +#define MDK_CONF_POLY1305 1 +#if MDK_CONF_POLY1305 == 1 +#define HAVE_POLY1305 +#define HAVE_ONE_TIME_AUTH +#endif +// + +// DES3 +#define MDK_CONF_DES3 1 +#if MDK_CONF_DES3 == 0 +#define NO_DES3 +#endif +// + +// AES +#define MDK_CONF_AES 1 +#if MDK_CONF_AES == 0 +#define NO_AES +#endif +// + +// CAMELLIA +#define MDK_CONF_CAMELLIA 1 +#if MDK_CONF_CAMELLIA == 1 +#define HAVE_CAMELLIA +#endif +// + +// DH +#define MDK_CONF_DH 1 +#if MDK_CONF_DH == 0 +#define NO_DH +#endif +// +// DSA +#define MDK_CONF_DSA 1 +#if MDK_CONF_DSA == 0 +#define NO_DSA +#endif +// + +// SRP +#define MDK_CONF_SRP 1 +#if MDK_CONF_SRP == 1 +#define HAVE_SRP +#endif +// + +// PWDBASED +#define MDK_CONF_PWDBASED 1 +#if MDK_CONF_PWDBASED == 0 +#define NO_PWDBASED +#endif +// + +// ECC +#define MDK_CONF_ECC 1 +#if MDK_CONF_ECC == 1 +#define HAVE_ECC +#endif +// + +// CURVE25519 +#define MDK_CONF_CURVE25519 1 +#if MDK_CONF_CURVE25519 == 1 +#define HAVE_CURVE25519 +#define CURVED25519_SMALL +#endif +// +// CURVE25519 SMALL +#define MDK_CONF_CURVE25519_SMALL 0 +#if MDK_CONF_CURVE25519_SMALL == 1 +#define CURVED25519_SMALL +#endif +// +// ED25519 +#define MDK_CONF_ED25519 1 +#if MDK_CONF_ED25519 == 1 +#define HAVE_ED25519 +#endif +// +// ED25519 SMALL +#define MDK_CONF_ED25519_SMALL 0 +#if MDK_CONF_ED25519_SMALL == 1 +#define ED25519_SMALL +#endif +// +// PKCS7 +#define MDK_CONF_PKCS7 0 +#if MDK_CONF_PKCS7 == 1 +#define HAVE_PKCS7 +#endif +// + +// NTRU (need License, "crypto_ntru.h") +#define MDK_CONF_NTRU 0 +#if MDK_CONF_NTRU == 1 +#define HAVE_NTRU +#endif +// +// + +// Random Seed, for TEST Only +#define MDK_CONF_RNDSEED 1 +#if MDK_CONF_RNDSEED == 1 +#define WOLFSSL_GENSEED_FORTEST +#endif +// + +// Hardware Crypt (See document for usage) +// Hardware RNG +#define MDK_CONF_STM32F2_RNG 1 +#if MDK_CONF_STM32F2_RNG == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_RNG +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Crypt +#define MDK_CONF_STM32F2_CRYPTO 1 +#if MDK_CONF_STM32F2_CRYPTO == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_CRYPTO +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// Hardware Hash +#define MDK_CONF_STM32F2_HASH 1 +#if MDK_CONF_STM32F2_HASH == 1 +#define WOLFSSL_STM32_CUBEMX +#define STM32_HASH +#define WC_ASYNC_DEV_SIZE 320+24 +#define STM32_HAL_TIMEOUT 0xFF + +#if defined(STM32F2xx) +#define WOLFSSL_STM32F2 +#elif defined(STM32F4xx) +#define WOLFSSL_STM32F4 +#elif defined(STM32F7xx) +#define WOLFSSL_STM32F7 +#endif + +#endif +// +// + +// Cert/Key Strage +// Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes) +#define MDK_CONF_CERT_BUFF 0 +#if MDK_CONF_CERT_BUFF== 1 +#define USE_CERT_BUFFERS_1024 +#elif MDK_CONF_CERT_BUFF == 2 +#define USE_CERT_BUFFERS_2048 +#endif +// +// Cert/Key Generation +// CertGen +#define MDK_CONF_CERT_GEN 0 +#if MDK_CONF_CERT_GEN == 1 +#define WOLFSSL_CERT_GEN +#endif +// +// KeyGen +#define MDK_CONF_KEY_GEN 0 +#if MDK_CONF_KEY_GEN == 1 +#define WOLFSSL_KEY_GEN +#endif +// +// +// Use Fast Math +#define MDK_CONF_FASTMATH 1 +#if MDK_CONF_FASTMATH == 1 #define USE_FAST_MATH #define TFM_TIMING_RESISTANT +#endif +// +// Small Stack +#define MDK_CONF_SmallStack 0 +#if MDK_CONF_SmallStack == 0 +#define NO_WOLFSSL_SMALL_STACK +#endif +// -#define BENCH_EMBEDDED +// -#define NO_WRITEV -#define NO_MAIN_DRIVER -#define WOLFSSL_MDK_SHELL + +/**** wolfSSL Configuration ****/ + +// wolfSSL Configuration + +// TLS 1.3 +#define MDK_CONF_TLS 0 +#if MDK_CONF_TLS == 1 +#define WOLFSSL_TLS13 +#define HAVE_TLS_EXTENSIONS +#define WC_RSA_PSS +#define HAVE_HKDF +#define HAVE_FFDHE_2048 +#endif +// + +// Include Old TLS +#define MDK_CONF_NO_OLDTLS 0 +#if MDK_CONF_NO_OLDTLS == 0 +#define NO_OLD_TLS +#endif +// +// CRL +#define MDK_CONF_CRL 0 +#if MDK_CONF_CRL == 1 +#define HAVE_CRL +#define WOLFSSL_DER_LOAD +#endif +// +// OCSP +#define MDK_CONF_OCSP 0 +#if MDK_CONF_OCSP == 1 +#define HAVE_OCSP +#endif +// +// OpenSSL Extra +#define MDK_CONF_OPENSSL_EXTRA 0 +#if MDK_CONF_OPENSSL_EXTRA == 1 +#define OPENSSL_EXTRA +#endif +// + +// diff --git a/IDE/MDK5-ARM/Projects/CryptTest/main.c b/IDE/MDK5-ARM/Projects/CryptTest/main.c index 814051c8a..3d88e2e7d 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/main.c +++ b/IDE/MDK5-ARM/Projects/CryptTest/main.c @@ -25,18 +25,82 @@ #include -#include "wolfcrypt/test/test.h" -#include "cmsis_os.h" #include -#include "stm32f2xx_hal.h" +#include + +/* Dummy definition for test RTC */ +#define RTC_YEAR 2018 +#define RTC_MONTH 1 +#define RTC_DAY 1 + +#if defined(STM32F7xx) +#include "stm32f7xx_hal.h" +#elif defined(STM32F4xx) +#include "stm32f4xx_hal.h" +#elif defined(STM32F2xx) +#include "stm32f2xx_hal.h" +#endif + +#warning "write MPU specific Set ups\n" +static void SystemClock_Config (void) { -/*----------------------------------------------------------------------------- - * System Clock Configuration - *----------------------------------------------------------------------------*/ -void SystemClock_Config(void) { - #warning "write MPU specific System Clock Set up\n" } +static void MPU_Config (void) { + +} + +static void CPU_CACHE_Enable (void) { + +} + + +#ifdef RTE_CMSIS_RTOS_RTX +extern uint32_t os_time; +static time_t epochTime; + +uint32_t HAL_GetTick(void) { + return os_time; +} + +time_t time(time_t *t){ + return epochTime ; +} + +void setTime(time_t t){ + epochTime = t; +} +#endif +#ifdef WOLFSSL_CURRTIME_OSTICK + +#include +extern uint32_t os_time; + +double current_time(int reset) +{ + if(reset) os_time = 0 ; + return (double)os_time /1000.0; +} + +#else + +#include +#define DWT ((DWT_Type *) (0xE0001000UL) ) +typedef struct +{ + uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ +} DWT_Type; + +extern uint32_t SystemCoreClock ; + +double current_time(int reset) +{ + if(reset) DWT->CYCCNT = 0 ; + return ((double)DWT->CYCCNT/SystemCoreClock) ; +} +#endif + /*----------------------------------------------------------------------------- * Initialize a Flash Memory Card *----------------------------------------------------------------------------*/ @@ -47,13 +111,13 @@ static void init_filesystem (void) { int32_t retv; retv = finit ("M0:"); - if (retv == 0) { + if (retv == fsOK) { retv = fmount ("M0:"); - if (retv == 0) { + if (retv == fsOK) { printf ("Drive M0 ready!\n"); } else { - printf ("Drive M0 mount failed!\n"); + printf ("Drive M0 mount failed(%d)!\n", retv); } } else { @@ -62,23 +126,28 @@ static void init_filesystem (void) { } #endif + /*----------------------------------------------------------------------------- * mian entry *----------------------------------------------------------------------------*/ +void wolfcrypt_test(void *arg) ; int main() { void * arg = NULL ; - HAL_Init(); /* Initialize the HAL Library */ - SystemClock_Config(); /* Configure the System Clock */ + 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 - osDelay(1000) ; + #endif - printf("=== Start: Crypt test ===\n") ; + 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") ; diff --git a/IDE/MDK5-ARM/Projects/EchoClient/Abstract.txt b/IDE/MDK5-ARM/Projects/EchoClient/Abstract.txt index 42ac37cf9..3586d285d 100644 --- a/IDE/MDK5-ARM/Projects/EchoClient/Abstract.txt +++ b/IDE/MDK5-ARM/Projects/EchoClient/Abstract.txt @@ -1,22 +1,12 @@ -This program is echo client with CyaSSL/wolfCrypt library. +wolfSSL example: echo Client -In order to run this program, -Copy {PACK}\wolfSSL\CyaSSL\{version}\cyassl\certs folder and files to the SD memory. -Set config-EchoClient.h configuration file for the Callee IP or Port number. +Use Configuration Wizard tab +main.c for remote IP address, port or TLS version +user_settings.h for wolfCrypt or wolfSSL options -For further configuration, refer config-Crypt.h and config-CyaSSL.h. - -When testing this client, it is recommended to test against one of the standard -CyaSSL example applications running on a desktop machine. The standard CyaSSL -example applications are located in the CyaSSL root directory under the -/examples directory. - -For the hardware crypt on config-Crypt.h, download -STSW-STM32062: STM32F2xx standard peripherals library at -http://www.st.com/. Copy Libraries\STM32F2xx_StdPeriph_Driver\{inc,src} to - {PACK}\cyassl\IDE\MDK5-ARM\STM32F2xx_StdPeriph_Lib +For further options, details, see wolfSSL User Manual. Support ------- -Please send questions or comments to support@wolfssl.com \ No newline at end of file +Please send questions or comments to support@wolfssl.com diff --git a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx index 1645ff076..0348f0834 100644 --- a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx +++ b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx @@ -8,7 +8,7 @@ *.c *.s*; *.src; *.a* - *.obj + *.obj; *.o *.lib *.txt; *.h; *.inc *.plm @@ -22,16 +22,16 @@ - STM32F207 Flash + echoClient 0x4 ARM-ADS - 12000000 + 25000000 1 1 - 0 - 1 + 1 + 0 0 @@ -45,7 +45,7 @@ 79 66 8 - .\Object\ + .\Output\ 1 @@ -78,23 +78,6 @@ 1 18 - - - 0 - Schematics (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf - - - 1 - User Manual (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm - - - 2 - MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) - http://www.keil.com/mcbstm32f200/ - - 0 1 @@ -117,7 +100,8 @@ 1 0 0 - 1 + 1 + 5 @@ -127,10 +111,15 @@ - .\STM32_SWO.ini - BIN\UL2CM3.DLL + + STLink\ST-LINKIII-KEIL_SWO.dll + + 0 + ST-LINKIII-KEIL_SWO + -U303030303030303030303031 -O8399 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO27 -TC216000000 -TP21 -TDS806B -TDT0 -TDC1F -TIEFFFFFFFF -TIP9 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) + 0 ARMRTXEVENTFLAGS @@ -139,18 +128,13 @@ 0 DLGTARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + (1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS - - 0 - ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) - 0 DLGUARM @@ -159,32 +143,77 @@ 0 UL2CM3 - -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) + -UV0998FBE -O207 -S10 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO18 -TC216000000 -TP21 -TDS80B8 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) - - - + + + 0 + 0 + 185 + 1 +
134219474
+ 0 + 0 + 0 + 0 + 0 + 1 + .\main.c + + \\echoClient\main.c\185 +
+ + 1 + 0 + 181 + 1 +
134219494
+ 0 + 0 + 0 + 0 + 0 + 1 + .\main.c + + \\echoClient\main.c\181 +
+ + 2 + 0 + 306 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + .\main.c + + +
+
+ + + 0 1 - 8 - port - 0 -
-
- - - 2 - 8 - 0x8004dc8 - 0 - - + eth_pins + + + + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.4.1\FileSystem\FileSystem.scvd + Keil.MDK-Middleware.7.4.1 + 1 + 0 0 - 0 + 1 1 0 0 @@ -203,13 +232,26 @@ 0 0 1 - 1 + 0 0 0 0 + 0 + 0 + 0 + + + + + + 1 + 0 + 2 + 2000000 +
@@ -224,7 +266,6 @@ 1 1 0 - 0 0 0 .\main.c @@ -234,6 +275,46 @@
+ + Documentation + 0 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + .\Abstract.txt + Abstract.txt + 0 + 0 + + + + + Linker Script + 1 + 0 + 0 + 0 + + 3 + 3 + 5 + 0 + 0 + 0 + .\wolfssl-link.sct + wolfssl-link.sct + 0 + 0 + + + Configuration 1 @@ -241,37 +322,10 @@ 0 0 - 2 - 2 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 0 - 0 - - - 2 - 3 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-wolfSSL.h - config-wolfSSL.h - 0 - 0 - - - 2 + 4 4 5 0 - 0 0 0 .\RTE\wolfSSL\user_settings.h @@ -282,24 +336,11 @@ - Dcumentation - 1 + ::Board Support + 0 0 0 - 0 - - 3 - 5 - 5 - 0 - 0 - 0 - 0 - .\Abstract.txt - Abstract.txt - 0 - 0 - + 1 @@ -312,7 +353,7 @@ ::CMSIS Driver - 1 + 0 0 0 1 @@ -320,7 +361,7 @@ ::Compiler - 1 + 0 0 0 1 @@ -336,7 +377,7 @@ ::File System - 0 + 1 0 0 1 @@ -344,7 +385,7 @@ ::Network - 1 + 0 0 0 1 diff --git a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx index 533c4ec28..c70b8eda8 100644 --- a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx +++ b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx @@ -7,21 +7,22 @@ - STM32F207 Flash + echoClient 0x4 ARM-ADS + 5060422::V5.06 update 4 (build 422)::ARMCC - STM32F207IGHx + STM32F756NGHx STMicroelectronics - Keil.STM32F2xx_DFP.2.2.0 + Keil.STM32F7xx_DFP.2.9.0 http://www.keil.com/pack - IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE + IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) + UL2CM3(-S0 -C0 -P0 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM)) 0 - $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h + $$Device:STM32F756NGHx$Drivers\CMSIS\Device\ST\STM32F7xx\Include\stm32f7xx.h @@ -31,7 +32,7 @@ - $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd + $$Device:STM32F756NGHx$CMSIS\SVD\STM32F7x.svd 0 0 @@ -46,14 +47,14 @@ 0 1 - .\Object\ - EchoClient + .\Output\ + echoClient 1 0 0 1 1 - .\Object\ + .\Output\ 1 0 0 @@ -84,6 +85,8 @@ 0 0 + 0 + 0 0 @@ -108,11 +111,11 @@ SARMCM3.DLL -REMAP -MPU DCM.DLL - -pCM3 + -pCM7 SARMCM3.DLL -MPU TCM.DLL - -pCM3 + -pCM7 @@ -122,47 +125,6 @@ 0 16 - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - - 0 - 1 - - - - - - - - - - - - - .\STM32_SWO.ini - BIN\UL2CM3.DLL - @@ -171,11 +133,11 @@ 0 1 1 - 4100 + 4096 1 BIN\UL2CM3.DLL - + "" () @@ -211,7 +173,7 @@ 1 0 0 - "Cortex-M3" + "Cortex-M7" 1 0 @@ -220,13 +182,14 @@ 1 0 0 - 0 - 0 - 0 + 2 + 1 + 1 8 0 0 0 + 0 3 3 0 @@ -279,8 +242,8 @@ 0 - 0x20000000 - 0x20000 + 0x20010000 + 0x40000 1 @@ -314,8 +277,8 @@ 1 - 0x0 - 0x0 + 0x200000 + 0x100000 0 @@ -334,13 +297,13 @@ 0 - 0x20000000 - 0x20000 + 0x20010000 + 0x40000 0 - 0x0 - 0x0 + 0x20000000 + 0x10000 @@ -356,14 +319,21 @@ 0 0 0 - 2 + 0 0 0 - 1 + 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - --diag_suppress=1293 - HSE_VALUE=25000000 HAVE_CONFIG_H MDK_CONF_EchoClient WOLFSSL_USER_SETTINGS + --diag_suppress=68 --diag_suppress=1293 + USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS @@ -378,6 +348,7 @@ 0 0 0 + 0 @@ -392,13 +363,13 @@ 0 1 0 - 0x08000000 - 0x20000000 + + - + .\Output\BSD_Client.sct - + --diag_suppress=68 @@ -416,18 +387,28 @@
- Configuration + Documentation - config-Crypt.h + Abstract.txt 5 - .\RTE\wolfSSL\config-Crypt.h + .\Abstract.txt + + + + Linker Script + - config-wolfSSL.h + wolfssl-link.sct 5 - .\RTE\wolfSSL\config-wolfSSL.h + .\wolfssl-link.sct + + + + Configuration + user_settings.h 5 @@ -436,14 +417,7 @@ - Dcumentation - - - Abstract.txt - 5 - .\Abstract.txt - - + ::Board Support ::CMSIS @@ -471,472 +445,449 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + + + + + + + + + + + + + - + - + - - + + - + + + + + + + - + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - + - + - + RTE\CMSIS\RTX_Conf_CM.c - - + + - + - - RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s - - - - - - RTE\Device\MK70FN1M0xxx12\system_MK70F12.c - - - - - - RTE\Device\STM32F207IGHx\RTE_Device.h - - + + RTE\Device\STM32F756NGHx\RTE_Device.h + + - + - - RTE\Device\STM32F207IGHx\startup_stm32f207xx.s - - + + RTE\Device\STM32F756NGHx\startup_stm32f756xx.s + + - + - - RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h - - + + RTE\Device\STM32F756NGHx\stm32f7xx_hal_conf.h + + - + - - RTE\Device\STM32F207IGHx\system_stm32f2xx.c - - + + RTE\Device\STM32F756NGHx\system_stm32f7xx.c + + - + - - RTE\Device\STM32F207IG\RTE_Device.h - - - - - - RTE\Device\STM32F207IG\startup_stm32f207xx.s - - - - - - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - - RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h - - - - - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - - RTE\Device\TM4C129ENCPDT\startup_TM4C129.s - - - - - - RTE\Device\TM4C129ENCPDT\system_tm4c129.c - - - - - + RTE\File_System\FS_Config.c - - + + - + - + RTE\File_System\FS_Config_MC_0.h - - + + - + - + RTE\Network\Net_Config.c - - + + - + - + RTE\Network\Net_Config_BSD.h - - + + - + - + RTE\Network\Net_Config_DNS_Client.h - - + + - + - + RTE\Network\Net_Config_ETH_0.h - - + + - + - + RTE\Network\Net_Config_TCP.h - - + + - + - + RTE\Network\Net_Config_UDP.h - - + + - + - - RTE\Network\Net_Debug.c - - - - - - RTE\Other\config-Crypt.h - - - - - - RTE\Other\config-wolfSSL.h - - - - - - RTE\Other\config-RTX-TCP-FS.h - - - - - - RTE\Other\config.h - - - - RTE\wolfSSL\config-Crypt.h - - + + - + - - RTE\wolfSSL\config-wolfSSL.h - - - - RTE\wolfSSL\config-wolfSSL.h - - + + - + - - RTE\wolfSSL\config.h - - - - - - RTE\wolfSSL\settings.h - - - - RTE\wolfSSL\user_settings.h - - + + - + diff --git a/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h deleted file mode 100644 index 38f402b0f..000000000 --- a/IDE/MDK5-ARM/Projects/EchoClient/RTE/wolfSSL/user_settings.h +++ /dev/null @@ -1,31 +0,0 @@ - -/* #define SINGLE_THREADED or define RTOS option */ -#define WOLFSSL_CMSIS_RTOS - -/* #define NO_FILESYSTEM or define Filesystem option */ -#define WOLFSSL_KEIL_FS -#define NO_WOLFSSL_DIR -#define WOLFSSL_NO_CURRDIR - -/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */ -#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */ - -#define NO_DEV_RANDOM -/* define your Rand gen for the operational use */ -#define WOLFSSL_GENSEED_FORTEST - -#define USE_WOLFSSL_MEMORY -#define WOLFSSL_MALLOC_CHECK - -#define XVALIDATEDATE(d, f,t) (0) -#define WOLFSSL_USER_CURRTIME /* for benchmark */ - -#define USE_FAST_MATH -#define TFM_TIMING_RESISTANT - -#define BENCH_EMBEDDED - -#define NO_WRITEV -#define NO_MAIN_DRIVER -#define WOLFSSL_MDK_SHELL - diff --git a/IDE/MDK5-ARM/Projects/EchoClient/config-EchoClient.h b/IDE/MDK5-ARM/Projects/EchoClient/config-EchoClient.h deleted file mode 100644 index e9d2bbd61..000000000 --- a/IDE/MDK5-ARM/Projects/EchoClient/config-EchoClient.h +++ /dev/null @@ -1,35 +0,0 @@ -/* config-RTX-TCP-FS.h - * - * Copyright (C) 2006-2017 wolfSSL Inc. - * - * This file is part of wolfSSL. - * - * wolfSSL is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * wolfSSL is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA - */ - - - - -// <<< Use Configuration Wizard in Context Menu >>> -// Build Target: Simple Client -// Callee IP Address -// Default: "192.168.1.100" -#define CYASSL_CALLEE_IP "192.168.11.3" -// Callee Port Number -// Default: "11111" -#define CYASSL_CALLEE_PORT 443 - -// -// <<< end of configuration section >>> diff --git a/IDE/MDK5-ARM/Projects/EchoClient/main.c b/IDE/MDK5-ARM/Projects/EchoClient/main.c index 37aab6c0e..3fe80f709 100644 --- a/IDE/MDK5-ARM/Projects/EchoClient/main.c +++ b/IDE/MDK5-ARM/Projects/EchoClient/main.c @@ -23,39 +23,63 @@ #include #endif -#include -#include +#include "wolfssl/wolfcrypt/settings.h" +#include "cmsis_os.h" /* CMSIS RTOS definitions */ +#include "rl_net.h" /* Network definitions */ +#include + +#if defined(STM32F7xx) +#include "stm32f7xx_hal.h" +#elif defined(STM32F4xx) +#include "stm32f4xx_hal.h" +#elif defined(STM32F2xx) #include "stm32f2xx_hal.h" -#include "cmsis_os.h" -#include "rl_net.h" -#include +#endif -#include +//-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- + +// RTC: for validate certificate date +// Year <1970-2099> +#define RTC_YEAR 2018 +// Month <1=>Jan<2=>Feb<3=>Mar<4=>Apr<5=>May<6=>Jun<7=>Jul<8=>Aut<9=>Sep<10=>Oct<11=>Nov<12=>Dec +#define RTC_MONTH 1 +// Day <1-31> +#define RTC_DAY 1 +// + +//------------- <<< end of configuration section >>> ----------------------- + +#warning "write MPU specific Set ups\n" +static void SystemClock_Config (void) { + +} + +static void MPU_Config (void) { + +} + +static void CPU_CACHE_Enable (void) { -/*----------------------------------------------------------------------------- - * Initialize Clock Configuration - *----------------------------------------------------------------------------*/ -void SystemClock_Config(void) { - #warning "write MPU specific System Clock Set up\n" } /*----------------------------------------------------------------------------- * Initialize a Flash Memory Card *----------------------------------------------------------------------------*/ #if !defined(NO_FILESYSTEM) -#include "rl_fs.h" +#include "rl_fs.h" /* FileSystem definitions */ + static void init_filesystem (void) { int32_t retv; retv = finit ("M0:"); - if (retv == 0) { + if (retv == fsOK) { retv = fmount ("M0:"); - if (retv == 0) { + if (retv == fsOK) { printf ("Drive M0 ready!\n"); } else { - printf ("Drive M0 mount failed!\n"); + printf ("Drive M0 mount failed(%d)!\n", retv); } } else { @@ -64,6 +88,68 @@ static void init_filesystem (void) { } #endif + +void net_loop(void const *arg) +{ + while(1) { + net_main (); + osThreadYield (); + } +} + +osThreadDef(net_loop, osPriorityLow, 2, 0); + +#ifdef RTE_CMSIS_RTOS_RTX +extern uint32_t os_time; +static time_t epochTime; + +uint32_t HAL_GetTick(void) { + return os_time; +} + +time_t time(time_t *t){ + return epochTime ; +} + +void setTime(time_t t){ + epochTime = t; +} +#endif + +#ifdef WOLFSSL_CURRTIME_OSTICK + +#include +extern uint32_t os_time; + +double current_time(int reset) +{ + if(reset) os_time = 0 ; + return (double)os_time /1000.0; +} + +#else + +#include +#define DWT ((DWT_Type *) (0xE0001000UL) ) +typedef struct +{ + uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ +} DWT_Type; + +extern uint32_t SystemCoreClock ; + +double current_time(int reset) +{ + if(reset) DWT->CYCCNT = 0 ; + return ((double)DWT->CYCCNT/SystemCoreClock) ; +} +#endif + +/*---------------------------------------------------------------------------- + Main Thread 'main': Run Network + *---------------------------------------------------------------------------*/ +#include typedef struct func_args { int argc; char** argv; @@ -71,30 +157,38 @@ typedef struct func_args { extern void echoclient_test(func_args * args) ; -/*----------------------------------------------------------------------------- - * mian entry - *----------------------------------------------------------------------------*/ int myoptind = 0; char* myoptarg = NULL; -int main() -{ - func_args args ; - args.argc = 1 ; +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 */ - SystemClock_Config (); #if !defined(NO_FILESYSTEM) init_filesystem (); #endif - netInitialize() ; - osDelay(300) ; + net_initialize (); + #if defined(DEBUG_WOLFSSL) printf("Turning ON Debug message\n") ; wolfSSL_Debugging_ON() ; #endif - printf("Starting EchoClient, Enter messages to EchoServer (\"quit\" to quit the program)\n") ; + 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) ; - printf("End of EchoClient\n") ; + + while(1) + osDelay(1000); } + diff --git a/IDE/MDK5-ARM/Projects/EchoClient/wolfssl-link.sct b/IDE/MDK5-ARM/Projects/EchoClient/wolfssl-link.sct new file mode 100644 index 000000000..a9641bd78 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/EchoClient/wolfssl-link.sct @@ -0,0 +1,14 @@ +LR_IROM1 0x08000000 0x00100000 { ; load region size_region + ER_IROM1 0x08000000 0x00100000 { ; load address = execution address + *.o (RESET, +First) + *(InRoot$$Sections) + .ANY (+RO) + } + RW_IRAM1 0x20010000 0x00040000 { ; RW data + .ANY (+RW +ZI) + } + RW_RETARGET 0x2000FFF0 0x00000010 { + retarget_io.o (+ZI +RW) + } +} + diff --git a/IDE/MDK5-ARM/Projects/EchoServer/Abstract.txt b/IDE/MDK5-ARM/Projects/EchoServer/Abstract.txt index 491c61020..f759f31b8 100644 --- a/IDE/MDK5-ARM/Projects/EchoServer/Abstract.txt +++ b/IDE/MDK5-ARM/Projects/EchoServer/Abstract.txt @@ -1,24 +1,12 @@ -This program is echo server with CyaSSL/wolfCrypt library. +wolfSSL example: echo Server -In order to run this program, -Copy {PACK}\wolfSSL\CyaSSL\{version}\cyassl\certs folder and files to the SD memory. -Set the server IP address in Net_Config_ETH_0.h -The server default port is 11111, defined in test.h. +Use Configuration Wizard tab +main.c for server port or TLS version +user_settings.h for wolfCrypt or wolfSSL options -For further configuration, refer config-Crypt.h and config-CyaSSL.h. - -When testing this server, it is recommended to test against one of the standard -CyaSSL example applications running on a desktop machine. The standard CyaSSL -example applications are located in the CyaSSL root directory under the -/examples directory. - -For the hardware crypt on config-Crypt.h, download -STSW-STM32062: STM32F2xx standard peripherals library at -http://www.st.com/. Copy Libraries\STM32F2xx_StdPeriph_Driver\{inc,src} to - {PACK}\cyassl\IDE\MDK5-ARM\STM32F2xx_StdPeriph_Lib +For further options, details, see wolfSSL User Manual. Support ------- Please send questions or comments to support@wolfssl.com - \ No newline at end of file diff --git a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx index 1645ff076..78b693549 100644 --- a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx +++ b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx @@ -8,7 +8,7 @@ *.c *.s*; *.src; *.a* - *.obj + *.obj; *.o *.lib *.txt; *.h; *.inc *.plm @@ -22,16 +22,16 @@ - STM32F207 Flash + echoServer 0x4 ARM-ADS - 12000000 + 25000000 1 1 - 0 - 1 + 1 + 0 0 @@ -45,7 +45,7 @@ 79 66 8 - .\Object\ + .\Output\ 1 @@ -78,23 +78,6 @@ 1 18 - - - 0 - Schematics (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf - - - 1 - User Manual (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm - - - 2 - MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) - http://www.keil.com/mcbstm32f200/ - - 0 1 @@ -117,7 +100,8 @@ 1 0 0 - 1 + 1 + 5 @@ -127,10 +111,15 @@ - .\STM32_SWO.ini - BIN\UL2CM3.DLL + + STLink\ST-LINKIII-KEIL_SWO.dll + + 0 + ST-LINKIII-KEIL_SWO + -U303030303030303030303031 -O8399 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO27 -TC216000000 -TP21 -TDS806B -TDT0 -TDC1F -TIEFFFFFFFF -TIP9 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) + 0 ARMRTXEVENTFLAGS @@ -139,18 +128,13 @@ 0 DLGTARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + (1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS - - 0 - ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) - 0 DLGUARM @@ -159,32 +143,28 @@ 0 UL2CM3 - -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) + -UV0998FBE -O207 -S10 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO18 -TC216000000 -TP21 -TDS80B8 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) - - + + + 0 1 - 8 - port - 0 - - - - - 2 - 8 - 0x8004dc8 - 0 - - + eth_pins + + + + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.5.0\FileSystem\FileSystem.scvd + Keil.MDK-Middleware.7.5.0 + 1 + 0 0 - 0 + 1 1 0 0 @@ -203,13 +183,26 @@ 0 0 1 - 1 + 0 0 0 0 + 0 + 0 + 0 + + + + + + 1 + 0 + 2 + 2000000 + @@ -224,7 +217,6 @@ 1 1 0 - 0 0 0 .\main.c @@ -234,6 +226,46 @@ + + Documentation + 0 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + .\Abstract.txt + Abstract.txt + 0 + 0 + + + + + Linker Script + 1 + 0 + 0 + 0 + + 3 + 3 + 5 + 0 + 0 + 0 + .\wolfssl-link.sct + wolfssl-link.sct + 0 + 0 + + + Configuration 1 @@ -241,37 +273,10 @@ 0 0 - 2 - 2 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 0 - 0 - - - 2 - 3 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-wolfSSL.h - config-wolfSSL.h - 0 - 0 - - - 2 + 4 4 5 0 - 0 0 0 .\RTE\wolfSSL\user_settings.h @@ -282,24 +287,11 @@ - Dcumentation - 1 + ::Board Support + 0 0 0 - 0 - - 3 - 5 - 5 - 0 - 0 - 0 - 0 - .\Abstract.txt - Abstract.txt - 0 - 0 - + 1 @@ -312,7 +304,7 @@ ::CMSIS Driver - 1 + 0 0 0 1 @@ -320,7 +312,7 @@ ::Compiler - 1 + 0 0 0 1 @@ -336,7 +328,7 @@ ::File System - 0 + 1 0 0 1 @@ -344,7 +336,7 @@ ::Network - 1 + 0 0 0 1 diff --git a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx index 8ed7027c8..d61eed47c 100644 --- a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx +++ b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx @@ -7,21 +7,22 @@ - STM32F207 Flash + echoServer 0x4 ARM-ADS + 5060422::V5.06 update 4 (build 422)::ARMCC - STM32F207IGHx + STM32F756NGHx STMicroelectronics - Keil.STM32F2xx_DFP.2.2.0 + Keil.STM32F7xx_DFP.2.9.0 http://www.keil.com/pack - IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE + IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) + UL2CM3(-S0 -C0 -P0 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM)) 0 - $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h + $$Device:STM32F756NGHx$Drivers\CMSIS\Device\ST\STM32F7xx\Include\stm32f7xx.h @@ -31,7 +32,7 @@ - $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd + $$Device:STM32F756NGHx$CMSIS\SVD\STM32F7x.svd 0 0 @@ -46,14 +47,14 @@ 0 1 - .\Object\ - EchoClient + .\Output\ + echoServer 1 0 0 1 1 - .\Object\ + .\Output\ 1 0 0 @@ -84,6 +85,8 @@ 0 0 + 0 + 0 0 @@ -108,11 +111,11 @@ SARMCM3.DLL -REMAP -MPU DCM.DLL - -pCM3 + -pCM7 SARMCM3.DLL -MPU TCM.DLL - -pCM3 + -pCM7 @@ -122,47 +125,6 @@ 0 16 - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - - 0 - 1 - - - - - - - - - - - - - .\STM32_SWO.ini - BIN\UL2CM3.DLL - @@ -171,11 +133,11 @@ 0 1 1 - 4100 + 4096 1 BIN\UL2CM3.DLL - + "" () @@ -211,7 +173,7 @@ 1 0 0 - "Cortex-M3" + "Cortex-M7" 1 0 @@ -220,13 +182,14 @@ 1 0 0 - 0 - 0 - 0 + 2 + 1 + 1 8 0 0 0 + 0 3 3 0 @@ -279,8 +242,8 @@ 0 - 0x20000000 - 0x20000 + 0x20010000 + 0x40000 1 @@ -314,8 +277,8 @@ 1 - 0x0 - 0x0 + 0x200000 + 0x100000 0 @@ -334,13 +297,13 @@ 0 - 0x20000000 - 0x20000 + 0x20010000 + 0x40000 0 - 0x0 - 0x0 + 0x20000000 + 0x10000 @@ -356,14 +319,21 @@ 0 0 0 - 2 + 0 0 0 - 1 + 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - --diag_suppress=1293 - HSE_VALUE=25000000 HAVE_CONFIG_H MDK_CONF_EchoClient WOLFSSL_USER_SETTINGS + --diag_suppress=68 --diag_suppress=1293 + USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS @@ -378,6 +348,7 @@ 0 0 0 + 0 @@ -392,13 +363,13 @@ 0 1 0 - 0x08000000 - 0x20000000 + + - + .\Output\wolfssl-link.sct - + --diag_suppress=68 @@ -416,18 +387,28 @@ - Configuration + Documentation - config-Crypt.h + Abstract.txt 5 - .\RTE\wolfSSL\config-Crypt.h + .\Abstract.txt + + + + Linker Script + - config-wolfSSL.h + wolfssl-link.sct 5 - .\RTE\wolfSSL\config-wolfSSL.h + .\wolfssl-link.sct + + + + Configuration + user_settings.h 5 @@ -436,14 +417,7 @@ - Dcumentation - - - Abstract.txt - 5 - .\Abstract.txt - - + ::Board Support ::CMSIS @@ -471,471 +445,452 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + + + + + + + + + + + + + - + - + - - + + - + + + + + + + - + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - + - + - + RTE\CMSIS\RTX_Conf_CM.c - - + + - + - - RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s - - - - - - RTE\Device\MK70FN1M0xxx12\system_MK70F12.c - - - - - - RTE\Device\STM32F207IGHx\RTE_Device.h - - + + RTE\Device\STM32F756NGHx\RTE_Device.h + + - + - - RTE\Device\STM32F207IGHx\startup_stm32f207xx.s - - + + RTE\Device\STM32F756NGHx\startup_stm32f756xx.s + + - + - - RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h - - + + RTE\Device\STM32F756NGHx\stm32f7xx_hal_conf.h + + - + - - RTE\Device\STM32F207IGHx\system_stm32f2xx.c - - + + RTE\Device\STM32F756NGHx\system_stm32f7xx.c + + - + - - RTE\Device\STM32F207IG\RTE_Device.h - - - - - - RTE\Device\STM32F207IG\startup_stm32f207xx.s - - - - - - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - - RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h - - - - - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - - RTE\Device\TM4C129ENCPDT\startup_TM4C129.s - - - - - - RTE\Device\TM4C129ENCPDT\system_tm4c129.c - - - - - + RTE\File_System\FS_Config.c - - + + - + - + RTE\File_System\FS_Config_MC_0.h - - + + - + - + RTE\Network\Net_Config.c - - + + - + - + RTE\Network\Net_Config_BSD.h - - + + - + - + RTE\Network\Net_Config_DNS_Client.h - - + + - + - + + RTE\Network\Net_Config_DNS_Server.h + + + + + RTE\Network\Net_Config_ETH_0.h - - + + - + - + RTE\Network\Net_Config_TCP.h - - + + - + - + RTE\Network\Net_Config_UDP.h - - + + - + - - RTE\Network\Net_Debug.c - - - - - - RTE\Other\config-Crypt.h - - - - - - RTE\Other\config-wolfSSL.h - - - - - - RTE\Other\config-RTX-TCP-FS.h - - - - - - RTE\Other\config.h - - - - - RTE\wolfSSL\config-Crypt.h - - - - - - - - RTE\wolfSSL\config-wolfSSL.h - - + RTE\wolfSSL\config-Crypt.h + + - RTE\wolfSSL\config-wolfSSL.h - - - - - - - - RTE\wolfSSL\config.h - - - - - - RTE\wolfSSL\settings.h - - + RTE\wolfSSL\config-wolfSSL.h + + - RTE\wolfSSL\user_settings.h - - - + RTE\wolfSSL\user_settings.h + + + + + diff --git a/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h deleted file mode 100644 index 38f402b0f..000000000 --- a/IDE/MDK5-ARM/Projects/EchoServer/RTE/wolfSSL/user_settings.h +++ /dev/null @@ -1,31 +0,0 @@ - -/* #define SINGLE_THREADED or define RTOS option */ -#define WOLFSSL_CMSIS_RTOS - -/* #define NO_FILESYSTEM or define Filesystem option */ -#define WOLFSSL_KEIL_FS -#define NO_WOLFSSL_DIR -#define WOLFSSL_NO_CURRDIR - -/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */ -#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */ - -#define NO_DEV_RANDOM -/* define your Rand gen for the operational use */ -#define WOLFSSL_GENSEED_FORTEST - -#define USE_WOLFSSL_MEMORY -#define WOLFSSL_MALLOC_CHECK - -#define XVALIDATEDATE(d, f,t) (0) -#define WOLFSSL_USER_CURRTIME /* for benchmark */ - -#define USE_FAST_MATH -#define TFM_TIMING_RESISTANT - -#define BENCH_EMBEDDED - -#define NO_WRITEV -#define NO_MAIN_DRIVER -#define WOLFSSL_MDK_SHELL - diff --git a/IDE/MDK5-ARM/Projects/EchoServer/main.c b/IDE/MDK5-ARM/Projects/EchoServer/main.c index b039c15d4..3138cdd2f 100644 --- a/IDE/MDK5-ARM/Projects/EchoServer/main.c +++ b/IDE/MDK5-ARM/Projects/EchoServer/main.c @@ -23,39 +23,82 @@ #include #endif -#include -#include +#include "wolfssl/wolfcrypt/settings.h" +#include "cmsis_os.h" /* CMSIS RTOS definitions */ +#include "rl_net.h" /* Network definitions */ +#include + +#if defined(STM32F7xx) +#include "stm32f7xx_hal.h" +#elif defined(STM32F4xx) +#include "stm32f4xx_hal.h" +#elif defined(STM32F2xx) #include "stm32f2xx_hal.h" -#include "cmsis_os.h" -#include "rl_net.h" -#include +#endif -#include +//-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- + +// Server parameter +// ==================== + +// Port +// Default: "11111" +#define SERVER_PORT "11111" +// + +// Protocol +// ==================== + +// SSL/TLS Version<0=> SSL3 <1=> TLS1.0 <2=> TLS1.1 <3=> TLS1.2 <4=> TLS1.3 +#define TLS_VER 3 + +// Other option +#define OTHER_OPTIONS "" +// + +// RTC: for validate certificate date +// Year <1970-2099> +#define RTC_YEAR 2018 +// Month <1=>Jan<2=>Feb<3=>Mar<4=>Apr<5=>May<6=>Jun<7=>Jul<8=>Aut<9=>Sep<10=>Oct<11=>Nov<12=>Dec +#define RTC_MONTH 1 +// Day <1-31> +#define RTC_DAY 1 +// + +//------------- <<< end of configuration section >>> ----------------------- + +#warning "write MPU specific Set ups\n" +static void SystemClock_Config (void) { -/*----------------------------------------------------------------------------- - * Initialize Clock Configuration - *----------------------------------------------------------------------------*/ -void SystemClock_Config(void) { - #warning "write MPU specific System Clock Set up\n" } +static void MPU_Config (void) { + +} + +static void CPU_CACHE_Enable (void) { + +} + + /*----------------------------------------------------------------------------- * Initialize a Flash Memory Card *----------------------------------------------------------------------------*/ - #if !defined(NO_FILESYSTEM) -#include "rl_fs.h" +#if !defined(NO_FILESYSTEM) +#include "rl_fs.h" /* FileSystem definitions */ + static void init_filesystem (void) { int32_t retv; retv = finit ("M0:"); - if (retv == 0) { + if (retv == fsOK) { retv = fmount ("M0:"); - if (retv == 0) { + if (retv == fsOK) { printf ("Drive M0 ready!\n"); } else { - printf ("Drive M0 mount failed!\n"); + printf ("Drive M0 mount failed(%d)!\n", retv); } } else { @@ -65,10 +108,68 @@ static void init_filesystem (void) { #endif -/*----------------------------------------------------------------------------- - * mian entry - *----------------------------------------------------------------------------*/ +void net_loop(void const *arg) +{ + while(1) { + net_main (); + osThreadYield (); + } +} +osThreadDef(net_loop, osPriorityLow, 2, 0); + +#ifdef RTE_CMSIS_RTOS_RTX +extern uint32_t os_time; +static time_t epochTime; + +uint32_t HAL_GetTick(void) { + return os_time; +} + +time_t time(time_t *t){ + return epochTime ; +} + +void setTime(time_t t){ + epochTime = t; +} +#endif + + +#ifdef WOLFSSL_CURRTIME_OSTICK + +#include +extern uint32_t os_time; + +double current_time(int reset) +{ + if(reset) os_time = 0 ; + return (double)os_time /1000.0; +} + +#else + +#include +#define DWT ((DWT_Type *) (0xE0001000UL) ) +typedef struct +{ + uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ +} DWT_Type; + +extern uint32_t SystemCoreClock ; + +double current_time(int reset) +{ + if(reset) DWT->CYCCNT = 0 ; + return ((double)DWT->CYCCNT/SystemCoreClock) ; +} +#endif + +/*---------------------------------------------------------------------------- + Main Thread 'main': Run Network + *---------------------------------------------------------------------------*/ +#include typedef struct func_args { int argc; char** argv; @@ -76,22 +177,37 @@ typedef struct func_args { extern void echoserver_test(func_args * args) ; -int main() -{ - func_args args ; - args.argc = 1 ; +int myoptind = 0; +char* myoptarg = NULL; + +int main (void) { + static char *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 */ - SystemClock_Config (); #if !defined(NO_FILESYSTEM) init_filesystem (); #endif - netInitialize() ; - osDelay(300) ; + net_initialize (); + #if defined(DEBUG_WOLFSSL) printf("Turning ON Debug message\n") ; wolfSSL_Debugging_ON() ; #endif - printf("echoserver: Started\n") ; + + 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) + osDelay(1000); + } + diff --git a/IDE/MDK5-ARM/Projects/EchoServer/wolfssl-link.sct b/IDE/MDK5-ARM/Projects/EchoServer/wolfssl-link.sct new file mode 100644 index 000000000..a9641bd78 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/EchoServer/wolfssl-link.sct @@ -0,0 +1,14 @@ +LR_IROM1 0x08000000 0x00100000 { ; load region size_region + ER_IROM1 0x08000000 0x00100000 { ; load address = execution address + *.o (RESET, +First) + *(InRoot$$Sections) + .ANY (+RO) + } + RW_IRAM1 0x20010000 0x00040000 { ; RW data + .ANY (+RW +ZI) + } + RW_RETARGET 0x2000FFF0 0x00000010 { + retarget_io.o (+ZI +RW) + } +} + diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/Abstract.txt b/IDE/MDK5-ARM/Projects/SimpleClient/Abstract.txt index 1a9a172c9..878057e9b 100644 --- a/IDE/MDK5-ARM/Projects/SimpleClient/Abstract.txt +++ b/IDE/MDK5-ARM/Projects/SimpleClient/Abstract.txt @@ -1,23 +1,12 @@ -This program is a simple client example with CyaSSL/wolfCrypt library. +wolfSSL example: TLS Client -In order to run this program, -Copy {PACK}\wolfSSL\CyaSSL\{version}\cyassl\certs folder and files to the SD memory. -Set config-SimpleClient.h configuration file for the Callee IP or Port number. +Use Configuration Wizard tab +main.c for remote IP address, port or TLS version +user_settings.h for wolfCrypt or wolfSSL options -For further configuration, refer config-Crypt.h and config-CyaSSL.h. -config-SimpleClient.h is to configure repote callee IP and port. - -When testing this client, it is recommended to test against one of the standard -CyaSSL example applications running on a desktop machine. The standard CyaSSL -example applications are located in the CyaSSL root directory under the -/examples directory. - -For the hardware crypt on config-Crypt.h, download -STSW-STM32062: STM32F2xx standard peripherals library at -http://www.st.com/. Copy Libraries\STM32F2xx_StdPeriph_Driver\{inc,src} to - {PACK}\cyassl\IDE\MDK5-ARM\STM32F2xx_StdPeriph_Lib +For further options, details, see wolfSSL User Manual. Support ------- -Please send questions or comments to support@wolfssl.com \ No newline at end of file +Please send questions or comments to support@wolfssl.com diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h deleted file mode 100644 index 38f402b0f..000000000 --- a/IDE/MDK5-ARM/Projects/SimpleClient/RTE/wolfSSL/user_settings.h +++ /dev/null @@ -1,31 +0,0 @@ - -/* #define SINGLE_THREADED or define RTOS option */ -#define WOLFSSL_CMSIS_RTOS - -/* #define NO_FILESYSTEM or define Filesystem option */ -#define WOLFSSL_KEIL_FS -#define NO_WOLFSSL_DIR -#define WOLFSSL_NO_CURRDIR - -/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */ -#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */ - -#define NO_DEV_RANDOM -/* define your Rand gen for the operational use */ -#define WOLFSSL_GENSEED_FORTEST - -#define USE_WOLFSSL_MEMORY -#define WOLFSSL_MALLOC_CHECK - -#define XVALIDATEDATE(d, f,t) (0) -#define WOLFSSL_USER_CURRTIME /* for benchmark */ - -#define USE_FAST_MATH -#define TFM_TIMING_RESISTANT - -#define BENCH_EMBEDDED - -#define NO_WRITEV -#define NO_MAIN_DRIVER -#define WOLFSSL_MDK_SHELL - diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx index 92b94982a..1e0d06b85 100644 --- a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx +++ b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx @@ -8,7 +8,7 @@ *.c *.s*; *.src; *.a* - *.obj + *.obj; *.o *.lib *.txt; *.h; *.inc *.plm @@ -22,16 +22,16 @@ - STM32F207 Flash + SimpleClient 0x4 ARM-ADS - 12000000 + 25000000 1 1 - 0 - 1 + 1 + 0 0 @@ -45,7 +45,7 @@ 79 66 8 - .\Object\ + .\Output\ 1 @@ -78,23 +78,6 @@ 1 18 - - - 0 - Schematics (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf - - - 1 - User Manual (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm - - - 2 - MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) - http://www.keil.com/mcbstm32f200/ - - 0 1 @@ -117,7 +100,8 @@ 1 0 0 - 1 + 1 + 5 @@ -127,10 +111,15 @@ - .\STM32_SWO.ini - BIN\UL2CM3.DLL + + STLink\ST-LINKIII-KEIL_SWO.dll + + 0 + ST-LINKIII-KEIL_SWO + -U303030303030303030303031 -O8399 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO27 -TC216000000 -TP21 -TDS806B -TDT0 -TDC1F -TIEFFFFFFFF -TIP9 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) + 0 ARMRTXEVENTFLAGS @@ -139,18 +128,13 @@ 0 DLGTARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + (1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS - - 0 - ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) - 0 DLGUARM @@ -159,14 +143,46 @@ 0 UL2CM3 - -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) + -UV0998FBE -O207 -S10 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO18 -TC216000000 -TP21 -TDS80B8 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) 0 0 - 109 + 185 + 1 +
134219474
+ 0 + 0 + 0 + 0 + 0 + 1 + .\main.c + + \\SimpleClient\main.c\185 +
+ + 1 + 0 + 181 + 1 +
134219494
+ 0 + 0 + 0 + 0 + 0 + 1 + .\main.c + + \\SimpleClient\main.c\181 +
+ + 2 + 0 + 306 1
0
0 @@ -180,28 +196,24 @@
- - + + + 0 1 - 8 - port - 0 - - - - - 2 - 8 - 0x8004dc8 - 0 - - + eth_pins + + + + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.4.1\FileSystem\FileSystem.scvd + Keil.MDK-Middleware.7.4.1 + 1 + 0 0 - 0 + 1 1 0 0 @@ -220,13 +232,26 @@ 0 0 1 - 1 + 0 0 0 0 + 0 + 0 + 0 + + + + + + 1 + 0 + 2 + 2000000 +
@@ -241,7 +266,6 @@ 1 1 0 - 0 0 0 .\main.c @@ -249,16 +273,43 @@ 0 0 +
+ + + Documentation + 0 + 0 + 0 + 0 - 1 + 2 2 - 1 + 5 0 - 0 0 0 - .\time-CortexM3-4.c - time-CortexM3-4.c + .\Abstract.txt + Abstract.txt + 0 + 0 + + + + + Linker Script + 1 + 0 + 0 + 0 + + 3 + 3 + 5 + 0 + 0 + 0 + .\wolfssl-link.sct + wolfssl-link.sct 0 0 @@ -271,37 +322,10 @@ 0 0 - 2 - 3 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 0 - 0 - - - 2 + 4 4 5 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-wolfSSL.h - config-wolfSSL.h - 0 - 0 - - - 2 - 5 - 5 - 0 - 0 0 0 .\RTE\wolfSSL\user_settings.h @@ -309,40 +333,14 @@ 0 0 - - 2 - 6 - 5 - 0 - 0 - 0 - 0 - .\config-SimpleClient.h - config-SimpleClient.h - 0 - 0 - - Dcumentation - 1 + ::Board Support + 0 0 0 - 0 - - 3 - 7 - 5 - 0 - 0 - 0 - 0 - .\Abstract.txt - Abstract.txt - 0 - 0 - + 1 @@ -355,7 +353,7 @@ ::CMSIS Driver - 1 + 0 0 0 1 @@ -363,7 +361,7 @@ ::Compiler - 1 + 0 0 0 1 @@ -379,7 +377,7 @@ ::File System - 0 + 1 0 0 1 @@ -387,7 +385,7 @@ ::Network - 1 + 0 0 0 1 diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvprojx b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvprojx new file mode 100644 index 000000000..ee180186e --- /dev/null +++ b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvprojx @@ -0,0 +1,896 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + SimpleClient + 0x4 + ARM-ADS + 5060422::V5.06 update 4 (build 422)::ARMCC + + + STM32F756NGHx + STMicroelectronics + Keil.STM32F7xx_DFP.2.9.0 + http://www.keil.com/pack + IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM)) + 0 + $$Device:STM32F756NGHx$Drivers\CMSIS\Device\ST\STM32F7xx\Include\stm32f7xx.h + + + + + + + + + + $$Device:STM32F756NGHx$CMSIS\SVD\STM32F7x.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\Output\ + SimpleClient + 1 + 0 + 0 + 1 + 1 + .\Output\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM7 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM7 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + "" () + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M7" + + 1 + 0 + 0 + 1 + 1 + 0 + 0 + 2 + 1 + 1 + 8 + 0 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20010000 + 0x40000 + + + 1 + 0x8000000 + 0x100000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x100000 + + + 1 + 0x200000 + 0x100000 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20010000 + 0x40000 + + + 0 + 0x20000000 + 0x10000 + + + + + + 1 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + --diag_suppress=68 --diag_suppress=1293 + USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + + + + .\Output\BSD_Client.sct + + + --diag_suppress=68 + + + + + + + + Source + + + main.c + 1 + .\main.c + + + + + Documentation + + + Abstract.txt + 5 + .\Abstract.txt + + + + + Linker Script + + + wolfssl-link.sct + 5 + .\wolfssl-link.sct + + + + + Configuration + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h + + + + + ::Board Support + + + ::CMSIS + + + ::CMSIS Driver + + + ::Compiler + + + ::Device + + + ::File System + + + ::Network + + + ::wolfSSL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RTE\CMSIS\RTX_Conf_CM.c + + + + + + + + RTE\Device\STM32F756NGHx\RTE_Device.h + + + + + + + + RTE\Device\STM32F756NGHx\startup_stm32f756xx.s + + + + + + + + RTE\Device\STM32F756NGHx\stm32f7xx_hal_conf.h + + + + + + + + RTE\Device\STM32F756NGHx\system_stm32f7xx.c + + + + + + + + RTE\File_System\FS_Config.c + + + + + + + + RTE\File_System\FS_Config_MC_0.h + + + + + + + + RTE\Network\Net_Config.c + + + + + + + + RTE\Network\Net_Config_BSD.h + + + + + + + + RTE\Network\Net_Config_DNS_Client.h + + + + + + + + RTE\Network\Net_Config_ETH_0.h + + + + + + + + RTE\Network\Net_Config_TCP.h + + + + + + + + RTE\Network\Net_Config_UDP.h + + + + + + + + RTE\wolfSSL\config-Crypt.h + + + + + + + + RTE\wolfSSL\config-wolfSSL.h + + + + + + + + RTE\wolfSSL\user_settings.h + + + + + + + + + +
diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/config-SimpleClient.h b/IDE/MDK5-ARM/Projects/SimpleClient/config-SimpleClient.h deleted file mode 100644 index c16dd0b42..000000000 --- a/IDE/MDK5-ARM/Projects/SimpleClient/config-SimpleClient.h +++ /dev/null @@ -1,52 +0,0 @@ -/* config-RTX-TCP-FS.h - * - * Copyright (C) 2006-2017 wolfSSL Inc. - * - * This file is part of wolfSSL. - * - * wolfSSL is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * wolfSSL is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA - */ - -// <<< Use Configuration Wizard in Context Menu >>> -// Build Target: Simple Client -// Callee IP Address -// Default: "192.168.1.100" -#define WOLFSSL_CALLEE_IP "192.168.10.8" -// Callee Port Number -// Default: "443" -#define WOLFSSL_CALLEE_PORT "11111" -// HTTP GET Option <0=> HTTP Get <1=> SSL/TLS Message -#define MDK_CONF_HTTP_GET 0 -#if MDK_CONF_HTTP_GET == 0 - #define WOLFSSL_HTTP_GET "-g" - #define WOLFSSL_HTTP_GET_COUNT 1 -#elif MDK_CONF_HTTP_GET == 1 - #define WOLFSSL_HTTP_GET "" - #define WOLFSSL_HTTP_GET_COUNT 0 -#endif -// SSL/TLS Version <0=> SSL3 <1=> TLS 1.0 <2=> TLS 1.1 <3=> TLS 1.2 -#define MDK_CONF_SSL_VERSION 3 -#if MDK_CONF_SSL_VERSION == 0 - #define WOLFSSL_SSL_VER "0" -#elif MDK_CONF_SSL_VERSION == 1 - #define WOLFSSL_SSL_VER "1" -#elif MDK_CONF_SSL_VERSION == 2 - #define WOLFSSL_SSL_VER "2" -#elif MDK_CONF_SSL_VERSION == 3 - #define WOLFSSL_SSL_VER "3" -#endif - -// -// <<< end of configuration section >>> diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/main.c b/IDE/MDK5-ARM/Projects/SimpleClient/main.c index 4374cbf30..472098717 100644 --- a/IDE/MDK5-ARM/Projects/SimpleClient/main.c +++ b/IDE/MDK5-ARM/Projects/SimpleClient/main.c @@ -23,39 +23,86 @@ #include #endif -#include -#include +#include "wolfssl/wolfcrypt/settings.h" +#include "cmsis_os.h" /* CMSIS RTOS definitions */ +#include "rl_net.h" /* Network definitions */ +#include + +#if defined(STM32F7xx) +#include "stm32f7xx_hal.h" +#elif defined(STM32F4xx) +#include "stm32f4xx_hal.h" +#elif defined(STM32F2xx) #include "stm32f2xx_hal.h" -#include "cmsis_os.h" -#include "rl_net.h" -#include +#endif -#include +//-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- + +// Remote Address +// ==================== +// +// IP Address +// Static IPv4 Address +// Default: "192.168.1.1" +#define REMOTE_IP "192.168.10.4" + +// Port +// Default: "11111" +#define REMOTE_PORT "11111" +// + +// Protocol +// ==================== + +// SSL/TLS Version<0=> SSL3 <1=> TLS1.0 <2=> TLS1.1 <3=> TLS1.2 <4=> TLS1.3 +#define TLS_VER 3 + +// Other option +#define OTHER_OPTIONS "" +// + +// RTC: for validate certificate date +// Year <1970-2099> +#define RTC_YEAR 2018 +// Month <1=>Jan<2=>Feb<3=>Mar<4=>Apr<5=>May<6=>Jun<7=>Jul<8=>Aut<9=>Sep<10=>Oct<11=>Nov<12=>Dec +#define RTC_MONTH 1 +// Day <1-31> +#define RTC_DAY 1 +// + +//------------- <<< end of configuration section >>> ----------------------- +#warning "write MPU specific Set ups\n" +static void SystemClock_Config (void) { -/*----------------------------------------------------------------------------- - * Initialize Clock Configuration - *----------------------------------------------------------------------------*/ -void SystemClock_Config(void) { - #warning "write MPU specific System Clock Set up\n" } +static void MPU_Config (void) { + +} + +static void CPU_CACHE_Enable (void) { + +} + + /*----------------------------------------------------------------------------- * Initialize a Flash Memory Card *----------------------------------------------------------------------------*/ #if !defined(NO_FILESYSTEM) -#include "rl_fs.h" +#include "rl_fs.h" /* FileSystem definitions */ + static void init_filesystem (void) { int32_t retv; retv = finit ("M0:"); - if (retv == 0) { + if (retv == fsOK) { retv = fmount ("M0:"); - if (retv == 0) { + if (retv == fsOK) { printf ("Drive M0 ready!\n"); } else { - printf ("Drive M0 mount failed!\n"); + printf ("Drive M0 mount failed(%d)!\n", retv); } } else { @@ -64,6 +111,68 @@ static void init_filesystem (void) { } #endif + +void net_loop(void const *arg) +{ + while(1) { + net_main (); + osThreadYield (); + } +} + +osThreadDef(net_loop, osPriorityLow, 2, 0); + +#ifdef RTE_CMSIS_RTOS_RTX +extern uint32_t os_time; +static time_t epochTime; + +uint32_t HAL_GetTick(void) { + return os_time; +} + +time_t time(time_t *t){ + return epochTime ; +} + +void setTime(time_t t){ + epochTime = t; +} +#endif + +#ifdef WOLFSSL_CURRTIME_OSTICK + +#include +extern uint32_t os_time; + +double current_time(int reset) +{ + if(reset) os_time = 0 ; + return (double)os_time /1000.0; +} + +#else + +#include +#define DWT ((DWT_Type *) (0xE0001000UL) ) +typedef struct +{ + uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ +} DWT_Type; + +extern uint32_t SystemCoreClock ; + +double current_time(int reset) +{ + if(reset) DWT->CYCCNT = 0 ; + return ((double)DWT->CYCCNT/SystemCoreClock) ; +} +#endif + +/*---------------------------------------------------------------------------- + Main Thread 'main': Run Network + *---------------------------------------------------------------------------*/ +#include typedef struct func_args { int argc; char** argv; @@ -71,39 +180,49 @@ typedef struct func_args { extern void client_test(func_args * args) ; -#include "config-SimpleClient.h" int myoptind = 0; char* myoptarg = NULL; -int main() -{ +int main (void) { static char *argv[] = - { "client", "-h", WOLFSSL_CALLEE_IP, "-p", WOLFSSL_CALLEE_PORT, - "-v", WOLFSSL_SSL_VER, WOLFSSL_HTTP_GET } ; + { "client", "-h", REMOTE_IP, "-p", REMOTE_PORT, + "-v", " ", OTHER_OPTIONS } ; static func_args args = - { 7 + WOLFSSL_HTTP_GET_COUNT, 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 */ - SystemClock_Config (); #if !defined(NO_FILESYSTEM) init_filesystem (); #endif - netInitialize() ; - osDelay(300) ; + net_initialize (); + #if defined(DEBUG_WOLFSSL) - printf("Turning ON Debug message\n") ; - wolfSSL_Debugging_ON() ; + printf("Turning ON Debug message\n") ; + wolfSSL_Debugging_ON() ; #endif - if(args.argc == 7) - printf("Simple SSL/TLS, ") ; - else - printf("HTTP GET, ") ; + snprintf(ver, VERSIZE, "%d", TLS_VER); + argv[6] = ver; - printf("Callee IP: %s, Port: %s, Version:%s\n", argv[2], argv[4], argv[6]) ; + printf("SSL/TLS Client(%d)\n ", 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); + + osThreadCreate (osThread(net_loop), NULL); + + client_test(&args) ; + + while(1) + osDelay(1000); - while(1) { - client_test(&args) ; - printf("Enter any key to iterate.\n") ; - getchar() ; - } } + diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/simpleClient.uvprojx b/IDE/MDK5-ARM/Projects/SimpleClient/simpleClient.uvprojx deleted file mode 100644 index 3b38ec8d8..000000000 --- a/IDE/MDK5-ARM/Projects/SimpleClient/simpleClient.uvprojx +++ /dev/null @@ -1,955 +0,0 @@ - - - - 2.1 - -
### uVision Project, (C) Keil Software
- - - - STM32F207 Flash - 0x4 - ARM-ADS - - - STM32F207IGHx - STMicroelectronics - Keil.STM32F2xx_DFP.2.2.0 - http://www.keil.com/pack - IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE - - - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) - 0 - $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h - - - - - - - - - - $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd - 0 - 0 - - - - - - - 0 - 0 - 0 - 0 - 1 - - .\Object\ - EchoClient - 1 - 0 - 0 - 1 - 1 - .\Object\ - 1 - 0 - 0 - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - - 0 - - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - SARMCM3.DLL - -REMAP -MPU - DCM.DLL - -pCM3 - SARMCM3.DLL - -MPU - TCM.DLL - -pCM3 - - - - 1 - 0 - 0 - 0 - 16 - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - - 0 - 1 - - - - - - - - - - - - - .\STM32_SWO.ini - BIN\UL2CM3.DLL - - - - - 1 - 0 - 0 - 1 - 1 - 4100 - - 1 - BIN\UL2CM3.DLL - - - - - - 0 - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - "Cortex-M3" - - 1 - 0 - 0 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 8 - 0 - 0 - 0 - 3 - 3 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x20000 - - - 1 - 0x8000000 - 0x100000 - - - 0 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x8000000 - 0x100000 - - - 1 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x20000 - - - 0 - 0x0 - 0x0 - - - - - - 1 - 4 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 2 - 0 - 0 - 1 - 0 - - --diag_suppress=1293 - HSE_VALUE=25000000 HAVE_CONFIG_H MDK_CONF_SimpleClient WOLFSSL_USER_SETTINGS - - - - - - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - 1 - 0 - 0 - 0 - 1 - 0 - 0x08000000 - 0x20000000 - - - - - - - - - - - - - Source - - - main.c - 1 - .\main.c - - - time-CortexM3-4.c - 1 - .\time-CortexM3-4.c - - - - - Configuration - - - config-Crypt.h - 5 - .\RTE\wolfSSL\config-Crypt.h - - - config-wolfSSL.h - 5 - .\RTE\wolfSSL\config-wolfSSL.h - - - user_settings.h - 5 - .\RTE\wolfSSL\user_settings.h - - - config-SimpleClient.h - 5 - .\config-SimpleClient.h - - - - - Dcumentation - - - Abstract.txt - 5 - .\Abstract.txt - - - - - ::CMSIS - - - ::CMSIS Driver - - - ::Compiler - - - ::Device - - - ::File System - - - ::Network - - - ::wolfSSL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RTE\CMSIS\RTX_Conf_CM.c - - - - - - - - RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s - - - - - - RTE\Device\MK70FN1M0xxx12\system_MK70F12.c - - - - - - RTE\Device\STM32F207IGHx\RTE_Device.h - - - - - - - - RTE\Device\STM32F207IGHx\startup_stm32f207xx.s - - - - - - - - RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h - - - - - - - - RTE\Device\STM32F207IGHx\system_stm32f2xx.c - - - - - - - - RTE\Device\STM32F207IG\RTE_Device.h - - - - - - RTE\Device\STM32F207IG\startup_stm32f207xx.s - - - - - - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - - RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h - - - - - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - - RTE\Device\TM4C129ENCPDT\startup_TM4C129.s - - - - - - RTE\Device\TM4C129ENCPDT\system_tm4c129.c - - - - - - RTE\File_System\FS_Config.c - - - - - - - - RTE\File_System\FS_Config_MC_0.h - - - - - - - - RTE\Network\Net_Config.c - - - - - - - - RTE\Network\Net_Config_BSD.h - - - - - - - - RTE\Network\Net_Config_DNS_Client.h - - - - - - - - RTE\Network\Net_Config_ETH_0.h - - - - - - - - RTE\Network\Net_Config_TCP.h - - - - - - - - RTE\Network\Net_Config_UDP.h - - - - - - - - RTE\Network\Net_Debug.c - - - - - - RTE\Other\config-Crypt.h - - - - - - RTE\Other\config-wolfSSL.h - - - - - - RTE\Other\config-RTX-TCP-FS.h - - - - - - RTE\Other\config.h - - - - - - RTE\wolfSSL\config-Crypt.h - - - - - - - - RTE\wolfSSL\config-wolfSSL.h - - - - - - RTE\wolfSSL\config-wolfSSL.h - - - - - - - - RTE\wolfSSL\config.h - - - - - - RTE\wolfSSL\settings.h - - - - - - RTE\wolfSSL\user_settings.h - - - - - - - - - -
diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/time-CortexM3-4.c b/IDE/MDK5-ARM/Projects/SimpleClient/time-CortexM3-4.c deleted file mode 100644 index 115a4f672..000000000 --- a/IDE/MDK5-ARM/Projects/SimpleClient/time-CortexM3-4.c +++ /dev/null @@ -1,42 +0,0 @@ -/* time-STM32F2.c - * - * Copyright (C) 2006-2017 wolfSSL Inc. - * - * This file is part of wolfSSL. - * - * wolfSSL is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * wolfSSL is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA - */ - - -#ifdef HAVE_CONFIG_H - #include -#endif - - -#include -#define DWT ((DWT_Type *) (0xE0001000UL) ) -typedef struct -{ - uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ - uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ -} DWT_Type; - -extern uint32_t SystemCoreClock ; - -double current_time(int reset) -{ - if(reset) DWT->CYCCNT = 0 ; - return ((double)DWT->CYCCNT/SystemCoreClock) ; -} diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/wolfssl-link.sct b/IDE/MDK5-ARM/Projects/SimpleClient/wolfssl-link.sct new file mode 100644 index 000000000..a9641bd78 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/SimpleClient/wolfssl-link.sct @@ -0,0 +1,14 @@ +LR_IROM1 0x08000000 0x00100000 { ; load region size_region + ER_IROM1 0x08000000 0x00100000 { ; load address = execution address + *.o (RESET, +First) + *(InRoot$$Sections) + .ANY (+RO) + } + RW_IRAM1 0x20010000 0x00040000 { ; RW data + .ANY (+RW +ZI) + } + RW_RETARGET 0x2000FFF0 0x00000010 { + retarget_io.o (+ZI +RW) + } +} + diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/Abstract.txt b/IDE/MDK5-ARM/Projects/SimpleServer/Abstract.txt index 89a9fd422..8a152aff0 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/Abstract.txt +++ b/IDE/MDK5-ARM/Projects/SimpleServer/Abstract.txt @@ -1,24 +1,12 @@ -This program is a simple server example with CyaSSL/wolfCrypt library. +wolfSSL example: TLS Server -In order to run this program, -Copy {PACK}\wolfSSL\CyaSSL\{version}\cyassl\certs folder and files to the SD memory. -Set the server IP address in Net_Config_ETH_0.h -The default server listning port is 11111, defined in test.h +Use Configuration Wizard tab +main.c for server port or TLS version +user_settings.h for wolfCrypt or wolfSSL options -For further configuration, refer config-Crypt.h and config-CyaSSL.h. -config-SimpleServer.h is for configuring the server port number. - -When testing this server, it is recommended to test against one of the standard -CyaSSL example applications running on a desktop machine. The standard CyaSSL -example applications are located in the CyaSSL root directory under the -/examples directory. - -For the hardware crypt on config-Crypt.h, download -STSW-STM32062: STM32F2xx standard peripherals library at -http://www.st.com/. Copy Libraries\STM32F2xx_StdPeriph_Driver\{inc,src} to - {PACK}\cyassl\IDE\MDK5-ARM\STM32F2xx_StdPeriph_Lib +For further options, details, see wolfSSL User Manual. Support ------- -Please send questions or comments to support@wolfssl.com \ No newline at end of file +Please send questions or comments to support@wolfssl.com diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h deleted file mode 100644 index 38f402b0f..000000000 --- a/IDE/MDK5-ARM/Projects/SimpleServer/RTE/wolfSSL/user_settings.h +++ /dev/null @@ -1,31 +0,0 @@ - -/* #define SINGLE_THREADED or define RTOS option */ -#define WOLFSSL_CMSIS_RTOS - -/* #define NO_FILESYSTEM or define Filesystem option */ -#define WOLFSSL_KEIL_FS -#define NO_WOLFSSL_DIR -#define WOLFSSL_NO_CURRDIR - -/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */ -#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */ - -#define NO_DEV_RANDOM -/* define your Rand gen for the operational use */ -#define WOLFSSL_GENSEED_FORTEST - -#define USE_WOLFSSL_MEMORY -#define WOLFSSL_MALLOC_CHECK - -#define XVALIDATEDATE(d, f,t) (0) -#define WOLFSSL_USER_CURRTIME /* for benchmark */ - -#define USE_FAST_MATH -#define TFM_TIMING_RESISTANT - -#define BENCH_EMBEDDED - -#define NO_WRITEV -#define NO_MAIN_DRIVER -#define WOLFSSL_MDK_SHELL - diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx index ff25d6393..8d194b2e4 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx +++ b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx @@ -8,7 +8,7 @@ *.c *.s*; *.src; *.a* - *.obj + *.obj; *.o *.lib *.txt; *.h; *.inc *.plm @@ -22,16 +22,16 @@ - STM32F207 Flash + SimpleServer 0x4 ARM-ADS - 12000000 + 25000000 1 1 - 0 - 1 + 1 + 0 0 @@ -45,7 +45,7 @@ 79 66 8 - .\Object\ + .\Output\ 1 @@ -78,23 +78,6 @@ 1 18 - - - 0 - Schematics (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf - - - 1 - User Manual (MCBSTM32F200) - C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm - - - 2 - MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) - http://www.keil.com/mcbstm32f200/ - - 0 1 @@ -117,7 +100,8 @@ 1 0 0 - 1 + 1 + 5 @@ -127,10 +111,15 @@ - .\STM32_SWO.ini - BIN\UL2CM3.DLL + + STLink\ST-LINKIII-KEIL_SWO.dll + + 0 + ST-LINKIII-KEIL_SWO + -U303030303030303030303031 -O8399 -S0 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO27 -TC216000000 -TP21 -TDS806B -TDT0 -TDC1F -TIEFFFFFFFF -TIP9 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) + 0 ARMRTXEVENTFLAGS @@ -139,18 +128,13 @@ 0 DLGTARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + (1010=-1,-1,-1,-1,0)(6017=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(6016=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) 0 ARMDBGFLAGS - - 0 - ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) - 0 DLGUARM @@ -159,32 +143,28 @@ 0 UL2CM3 - -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) + -UV0998FBE -O207 -S10 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(5BA02477) -L00(0) -TO18 -TC216000000 -TP21 -TDS80B8 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM) - - + + + 0 1 - 8 - port - 0 - - - - - 2 - 8 - 0x8004dc8 - 0 - - + eth_pins + + + + C:\Keil_v5\ARM\PACK\Keil\MDK-Middleware\7.5.0\FileSystem\FileSystem.scvd + Keil.MDK-Middleware.7.5.0 + 1 + 0 0 - 0 + 1 1 0 0 @@ -203,13 +183,26 @@ 0 0 1 - 1 + 0 0 0 0 + 0 + 0 + 0 + + + + + + 1 + 0 + 2 + 2000000 + @@ -224,7 +217,6 @@ 1 1 0 - 0 0 0 .\main.c @@ -234,6 +226,46 @@
+ + Documentation + 0 + 0 + 0 + 0 + + 2 + 2 + 5 + 0 + 0 + 0 + .\Abstract.txt + Abstract.txt + 0 + 0 + + + + + Linker Script + 1 + 0 + 0 + 0 + + 3 + 3 + 5 + 0 + 0 + 0 + .\wolfssl-link.sct + wolfssl-link.sct + 0 + 0 + + + Configuration 1 @@ -241,37 +273,10 @@ 0 0 - 2 - 2 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 0 - 0 - - - 2 - 3 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-wolfSSL.h - config-wolfSSL.h - 0 - 0 - - - 2 + 4 4 5 0 - 0 0 0 .\RTE\wolfSSL\user_settings.h @@ -279,40 +284,14 @@ 0 0 - - 2 - 5 - 5 - 0 - 0 - 0 - 0 - .\config-SimpleServer.h - config-SimpleServer.h - 0 - 0 - - Dcumentation - 1 + ::Board Support + 0 0 0 - 0 - - 3 - 6 - 5 - 0 - 0 - 0 - 0 - .\Abstract.txt - Abstract.txt - 0 - 0 - + 1 @@ -325,7 +304,7 @@ ::CMSIS Driver - 1 + 0 0 0 1 @@ -333,7 +312,7 @@ ::Compiler - 1 + 0 0 0 1 @@ -349,7 +328,7 @@ ::File System - 0 + 1 0 0 1 @@ -357,7 +336,7 @@ ::Network - 1 + 0 0 0 1 diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx index 5e1778b79..b142d5fb7 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx +++ b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx @@ -7,21 +7,22 @@ - STM32F207 Flash + SimpleServer 0x4 ARM-ADS + 5060422::V5.06 update 4 (build 422)::ARMCC - STM32F207IGHx + STM32F756NGHx STMicroelectronics - Keil.STM32F2xx_DFP.2.2.0 + Keil.STM32F7xx_DFP.2.9.0 http://www.keil.com/pack - IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE + IROM(0x08000000,0x100000) IROM2(0x00200000,0x100000) IRAM(0x20010000,0x40000) IRAM2(0x20000000,0x10000) CPUTYPE("Cortex-M7") FPU3(SFPU) CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) + UL2CM3(-S0 -C0 -P0 -FD20010000 -FC1000 -FN1 -FF0STM32F7x_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F756NGHx$CMSIS\Flash\STM32F7x_1024.FLM)) 0 - $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h + $$Device:STM32F756NGHx$Drivers\CMSIS\Device\ST\STM32F7xx\Include\stm32f7xx.h @@ -31,7 +32,7 @@ - $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd + $$Device:STM32F756NGHx$CMSIS\SVD\STM32F7x.svd 0 0 @@ -46,14 +47,14 @@ 0 1 - .\Object\ - EchoClient + .\Output\ + SimpleServer 1 0 0 1 1 - .\Object\ + .\Output\ 1 0 0 @@ -84,6 +85,8 @@ 0 0 + 0 + 0 0 @@ -108,11 +111,11 @@ SARMCM3.DLL -REMAP -MPU DCM.DLL - -pCM3 + -pCM7 SARMCM3.DLL -MPU TCM.DLL - -pCM3 + -pCM7 @@ -122,47 +125,6 @@ 0 16 - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - - 0 - 1 - - - - - - - - - - - - - .\STM32_SWO.ini - BIN\UL2CM3.DLL - @@ -171,11 +133,11 @@ 0 1 1 - 4100 + 4096 1 BIN\UL2CM3.DLL - + "" () @@ -211,7 +173,7 @@ 1 0 0 - "Cortex-M3" + "Cortex-M7" 1 0 @@ -220,13 +182,14 @@ 1 0 0 - 0 - 0 - 0 + 2 + 1 + 1 8 0 0 0 + 0 3 3 0 @@ -279,8 +242,8 @@ 0 - 0x20000000 - 0x20000 + 0x20010000 + 0x40000 1 @@ -314,8 +277,8 @@ 1 - 0x0 - 0x0 + 0x200000 + 0x100000 0 @@ -334,13 +297,13 @@ 0 - 0x20000000 - 0x20000 + 0x20010000 + 0x40000 0 - 0x0 - 0x0 + 0x20000000 + 0x10000 @@ -356,14 +319,21 @@ 0 0 0 - 2 + 0 0 0 - 1 + 0 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 - --diag_suppress=1293 - HSE_VALUE=25000000 HAVE_CONFIG_H MDK_CONF_EchoClient WOLFSSL_USER_SETTINGS + --diag_suppress=68 --diag_suppress=1293 + USE_STM32756G_EVAL USE_IOEXPANDER WOLFSSL_USER_SETTINGS @@ -378,6 +348,7 @@ 0 0 0 + 0 @@ -392,13 +363,13 @@ 0 1 0 - 0x08000000 - 0x20000000 + + - + .\Output\wolfssl-link.sct - + --diag_suppress=68 @@ -416,32 +387,7 @@ - Configuration - - - config-Crypt.h - 5 - .\RTE\wolfSSL\config-Crypt.h - - - config-wolfSSL.h - 5 - .\RTE\wolfSSL\config-wolfSSL.h - - - user_settings.h - 5 - .\RTE\wolfSSL\user_settings.h - - - config-SimpleServer.h - 5 - .\config-SimpleServer.h - - - - - Dcumentation + Documentation Abstract.txt @@ -450,6 +396,29 @@ + + Linker Script + + + wolfssl-link.sct + 5 + .\wolfssl-link.sct + + + + + Configuration + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h + + + + + ::Board Support + ::CMSIS @@ -476,472 +445,451 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + + + + + + + + + + + + + - + - + - - + + - + + + + + + + - + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - + - + - + - + RTE\CMSIS\RTX_Conf_CM.c - - + + - + - - RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s - - - - - - RTE\Device\MK70FN1M0xxx12\system_MK70F12.c - - - - - - RTE\Device\STM32F207IGHx\RTE_Device.h - - + + RTE\Device\STM32F756NGHx\RTE_Device.h + + - + - - RTE\Device\STM32F207IGHx\startup_stm32f207xx.s - - + + RTE\Device\STM32F756NGHx\startup_stm32f756xx.s + + - + - - RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h - - + + RTE\Device\STM32F756NGHx\stm32f7xx_hal_conf.h + + - + - - RTE\Device\STM32F207IGHx\system_stm32f2xx.c - - + + RTE\Device\STM32F756NGHx\system_stm32f7xx.c + + - + - - RTE\Device\STM32F207IG\RTE_Device.h - - - - - - RTE\Device\STM32F207IG\startup_stm32f207xx.s - - - - - - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - - RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h - - - - - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - - RTE\Device\TM4C129ENCPDT\startup_TM4C129.s - - - - - - RTE\Device\TM4C129ENCPDT\system_tm4c129.c - - - - - + RTE\File_System\FS_Config.c - - + + - + - + RTE\File_System\FS_Config_MC_0.h - - + + - + - + RTE\Network\Net_Config.c - - + + - + - + RTE\Network\Net_Config_BSD.h - - + + - + - + RTE\Network\Net_Config_DNS_Client.h - - + + - + - + + RTE\Network\Net_Config_DNS_Server.h + + + + + RTE\Network\Net_Config_ETH_0.h - - + + - + - + RTE\Network\Net_Config_TCP.h - - + + - + - + RTE\Network\Net_Config_UDP.h - - + + - + - - RTE\Network\Net_Debug.c - - - - - - RTE\Other\config-Crypt.h - - - - - - RTE\Other\config-wolfSSL.h - - - - - - RTE\Other\config-RTX-TCP-FS.h - - - - - - RTE\Other\config.h - - - - - RTE\wolfSSL\config-Crypt.h - - - - - - - - RTE\wolfSSL\config-wolfSSL.h - - + RTE\wolfSSL\config-Crypt.h + + - RTE\wolfSSL\config-wolfSSL.h - - - - - - - - RTE\wolfSSL\config.h - - - - - - RTE\wolfSSL\settings.h - - + RTE\wolfSSL\config-wolfSSL.h + + RTE\wolfSSL\user_settings.h - - + + - + diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/config-SimpleServer.h b/IDE/MDK5-ARM/Projects/SimpleServer/config-SimpleServer.h deleted file mode 100644 index f8486fa6f..000000000 --- a/IDE/MDK5-ARM/Projects/SimpleServer/config-SimpleServer.h +++ /dev/null @@ -1,30 +0,0 @@ -/* SimpleServer.h - * - * Copyright (C) 2006-2017 wolfSSL Inc. - * - * This file is part of wolfSSL. - * - * wolfSSL is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * wolfSSL is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA - */ - - -// <<< Use Configuration Wizard in Context Menu >>> -// Build Target: Simple Server -// Listen Port Number -// Default: "11111" -#define WOLFSSL_LISTEN_PORT "11111" - -// -// <<< end of configuration section >>> diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/main.c b/IDE/MDK5-ARM/Projects/SimpleServer/main.c index 772d844aa..7de2c64d8 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/main.c +++ b/IDE/MDK5-ARM/Projects/SimpleServer/main.c @@ -23,39 +23,81 @@ #include #endif -#include -#include +#include "wolfssl/wolfcrypt/settings.h" +#include "cmsis_os.h" /* CMSIS RTOS definitions */ +#include "rl_net.h" /* Network definitions */ +#include + +#if defined(STM32F7xx) +#include "stm32f7xx_hal.h" +#elif defined(STM32F4xx) +#include "stm32f4xx_hal.h" +#elif defined(STM32F2xx) #include "stm32f2xx_hal.h" -#include "cmsis_os.h" -#include "rl_net.h" -#include +#endif -#include +//-------- <<< Use Configuration Wizard in Context Menu >>> ----------------- + +// Server parameter +// ==================== + +// Port +// Default: "11111" +#define SERVER_PORT "11111" +// + +// Protocol +// ==================== + +// SSL/TLS Version<0=> SSL3 <1=> TLS1.0 <2=> TLS1.1 <3=> TLS1.2 <4=> TLS1.3 +#define TLS_VER 3 + +// Other option +#define OTHER_OPTIONS "" +// + +// RTC: for validate certificate date +// Year <1970-2099> +#define RTC_YEAR 2018 +// Month <1=>Jan<2=>Feb<3=>Mar<4=>Apr<5=>May<6=>Jun<7=>Jul<8=>Aut<9=>Sep<10=>Oct<11=>Nov<12=>Dec +#define RTC_MONTH 1 +// Day <1-31> +#define RTC_DAY 1 +// + +//------------- <<< end of configuration section >>> ----------------------- + +#warning "write MPU specific Set ups\n" +static void SystemClock_Config (void) { + +} + +static void MPU_Config (void) { + +} + +static void CPU_CACHE_Enable (void) { -/*----------------------------------------------------------------------------- - * Initialize Clock Configuration - *----------------------------------------------------------------------------*/ -void SystemClock_Config(void) { - #warning "write MPU specific System Clock Set up\n" } /*----------------------------------------------------------------------------- * Initialize a Flash Memory Card *----------------------------------------------------------------------------*/ #if !defined(NO_FILESYSTEM) -#include "rl_fs.h" +#include "rl_fs.h" /* FileSystem definitions */ + static void init_filesystem (void) { int32_t retv; retv = finit ("M0:"); - if (retv == 0) { + if (retv == fsOK) { retv = fmount ("M0:"); - if (retv == 0) { + if (retv == fsOK) { printf ("Drive M0 ready!\n"); } else { - printf ("Drive M0 mount failed!\n"); + printf ("Drive M0 mount failed(%d)!\n", retv); } } else { @@ -64,6 +106,68 @@ static void init_filesystem (void) { } #endif + +void net_loop(void const *arg) +{ + while(1) { + net_main (); + osThreadYield (); + } +} + +osThreadDef(net_loop, osPriorityLow, 2, 0); + +#ifdef RTE_CMSIS_RTOS_RTX +extern uint32_t os_time; +static time_t epochTime; + +uint32_t HAL_GetTick(void) { + return os_time; +} + +time_t time(time_t *t){ + return epochTime ; +} + +void setTime(time_t t){ + epochTime = t; +} +#endif + +#ifdef WOLFSSL_CURRTIME_OSTICK + +#include +extern uint32_t os_time; + +double current_time(int reset) +{ + if(reset) os_time = 0 ; + return (double)os_time /1000.0; +} + +#else + +#include +#define DWT ((DWT_Type *) (0xE0001000UL) ) +typedef struct +{ + uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ +} DWT_Type; + +extern uint32_t SystemCoreClock ; + +double current_time(int reset) +{ + if(reset) DWT->CYCCNT = 0 ; + return ((double)DWT->CYCCNT/SystemCoreClock) ; +} +#endif + +/*---------------------------------------------------------------------------- + Main Thread 'main': Run Network + *---------------------------------------------------------------------------*/ +#include typedef struct func_args { int argc; char** argv; @@ -71,34 +175,49 @@ typedef struct func_args { extern void server_test(func_args * args) ; -#include "config-SimpleServer.h" - -/*----------------------------------------------------------------------------- - * mian entry - *----------------------------------------------------------------------------*/ int myoptind = 0; char* myoptarg = NULL; -int main() -{ - static char *argv[] = { "server", "-p", WOLFSSL_LISTEN_PORT, "-d"} ; - static func_args args = { 4, argv } ; +int main (void) { + static char *argv[] = + { "server", "-p", SERVER_PORT, + "-v", " ", OTHER_OPTIONS } ; + static func_args args = + { 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 */ - SystemClock_Config (); #if !defined(NO_FILESYSTEM) init_filesystem (); #endif - netInitialize() ; - osDelay(300) ; + net_initialize (); + #if defined(DEBUG_WOLFSSL) - printf("Turning ON Debug message\n") ; - wolfSSL_Debugging_ON() ; + printf("Turning ON Debug message\n") ; + wolfSSL_Debugging_ON() ; #endif - printf("Simple Server: Started\n") ; - while(1) { - server_test(&args) ; - printf("Enter any key to iterate.\n") ; - getchar() ; - } + 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); + + osThreadCreate (osThread(net_loop), NULL); + + server_test(&args) ; + + while(1) + osDelay(1000); + } + diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/wolfssl-link.sct b/IDE/MDK5-ARM/Projects/SimpleServer/wolfssl-link.sct new file mode 100644 index 000000000..a9641bd78 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/SimpleServer/wolfssl-link.sct @@ -0,0 +1,14 @@ +LR_IROM1 0x08000000 0x00100000 { ; load region size_region + ER_IROM1 0x08000000 0x00100000 { ; load address = execution address + *.o (RESET, +First) + *(InRoot$$Sections) + .ANY (+RO) + } + RW_IRAM1 0x20010000 0x00040000 { ; RW data + .ANY (+RW +ZI) + } + RW_RETARGET 0x2000FFF0 0x00000010 { + retarget_io.o (+ZI +RW) + } +} + diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/wolfSSL-Full/RTE/wolfSSL/user_settings.h deleted file mode 100644 index 38f402b0f..000000000 --- a/IDE/MDK5-ARM/Projects/wolfSSL-Full/RTE/wolfSSL/user_settings.h +++ /dev/null @@ -1,31 +0,0 @@ - -/* #define SINGLE_THREADED or define RTOS option */ -#define WOLFSSL_CMSIS_RTOS - -/* #define NO_FILESYSTEM or define Filesystem option */ -#define WOLFSSL_KEIL_FS -#define NO_WOLFSSL_DIR -#define WOLFSSL_NO_CURRDIR - -/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */ -#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */ - -#define NO_DEV_RANDOM -/* define your Rand gen for the operational use */ -#define WOLFSSL_GENSEED_FORTEST - -#define USE_WOLFSSL_MEMORY -#define WOLFSSL_MALLOC_CHECK - -#define XVALIDATEDATE(d, f,t) (0) -#define WOLFSSL_USER_CURRTIME /* for benchmark */ - -#define USE_FAST_MATH -#define TFM_TIMING_RESISTANT - -#define BENCH_EMBEDDED - -#define NO_WRITEV -#define NO_MAIN_DRIVER -#define WOLFSSL_MDK_SHELL - diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h deleted file mode 100644 index 38f402b0f..000000000 --- a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/RTE/wolfSSL/user_settings.h +++ /dev/null @@ -1,31 +0,0 @@ - -/* #define SINGLE_THREADED or define RTOS option */ -#define WOLFSSL_CMSIS_RTOS - -/* #define NO_FILESYSTEM or define Filesystem option */ -#define WOLFSSL_KEIL_FS -#define NO_WOLFSSL_DIR -#define WOLFSSL_NO_CURRDIR - -/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */ -#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */ - -#define NO_DEV_RANDOM -/* define your Rand gen for the operational use */ -#define WOLFSSL_GENSEED_FORTEST - -#define USE_WOLFSSL_MEMORY -#define WOLFSSL_MALLOC_CHECK - -#define XVALIDATEDATE(d, f,t) (0) -#define WOLFSSL_USER_CURRTIME /* for benchmark */ - -#define USE_FAST_MATH -#define TFM_TIMING_RESISTANT - -#define BENCH_EMBEDDED - -#define NO_WRITEV -#define NO_MAIN_DRIVER -#define WOLFSSL_MDK_SHELL - diff --git a/examples/client/client.c b/examples/client/client.c index 632c89577..c01d5b6f2 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -24,26 +24,19 @@ #include #endif +#include + #include #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #include #include - - #if !defined(WOLFSSL_MDK_ARM) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #include "wolfssl_MDK_ARM.h" - #endif + #include "cmsis_os.h" + #include "rl_fs.h" + #include "rl_net.h" + #include "wolfssl_MDK_ARM.h" #endif -#include - -#include - #include #include @@ -110,7 +103,7 @@ static int NonBlockingSSL_Connect(WOLFSSL* ssl) error == WOLFSSL_ERROR_WANT_WRITE || error == WC_PENDING_E)) { int currTimeout = 1; - + if (error == WOLFSSL_ERROR_WANT_READ) printf("... client would read block\n"); else if (error == WOLFSSL_ERROR_WANT_WRITE) diff --git a/examples/echoclient/echoclient.c b/examples/echoclient/echoclient.c index d4cfcf354..21f51469c 100644 --- a/examples/echoclient/echoclient.c +++ b/examples/echoclient/echoclient.c @@ -35,21 +35,12 @@ #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #include #include - - #if !defined(WOLFSSL_MDK_ARM) - #include "cmsis_os.h" - #include "rl_net.h" - #else - #include "rtl.h" - #include "wolfssl_MDK_ARM.h" - #endif - #if defined(WOLFSSL_MDK_SHELL) - char * wolfssl_fgets ( char * str, int num, FILE * f ) ; - #define fgets wolfssl_fgets - #endif + #include "cmsis_os.h" + #include "rl_fs.h" + #include "rl_net.h" + #include "wolfssl_MDK_ARM.h" #endif - #include #include diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index 5bcb2014e..4968c945d 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -33,15 +33,10 @@ #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #include #include - - #if !defined(WOLFSSL_MDK_ARM) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #include "wolfssl_MDK_ARM.h" - #endif + #include "cmsis_os.h" + #include "rl_fs.h" + #include "rl_net.h" + #include "wolfssl_MDK_ARM.h" #endif #include diff --git a/examples/server/server.c b/examples/server/server.c index 60a5e442d..058e4dc32 100644 --- a/examples/server/server.c +++ b/examples/server/server.c @@ -33,18 +33,12 @@ #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #include #include - - #if !defined(WOLFSSL_MDK_ARM) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #include "wolfssl_MDK_ARM.h" - #endif - - + #include "cmsis_os.h" + #include "rl_fs.h" + #include "rl_net.h" + #include "wolfssl_MDK_ARM.h" #endif + #include #include #ifdef CYASSL_DTLS diff --git a/wolfcrypt/src/camellia.c b/wolfcrypt/src/camellia.c index cff40a80b..b3929bcc2 100644 --- a/wolfcrypt/src/camellia.c +++ b/wolfcrypt/src/camellia.c @@ -1598,10 +1598,11 @@ int wc_CamelliaDecryptDirect(Camellia* cam, byte* out, const byte* in) int wc_CamelliaCbcEncrypt(Camellia* cam, byte* out, const byte* in, word32 sz) { + word32 blocks; if (cam == NULL || out == NULL || in == NULL) { return BAD_FUNC_ARG; } - word32 blocks = sz / CAMELLIA_BLOCK_SIZE; + blocks = sz / CAMELLIA_BLOCK_SIZE; while (blocks--) { xorbuf((byte*)cam->reg, in, CAMELLIA_BLOCK_SIZE); @@ -1619,10 +1620,11 @@ int wc_CamelliaCbcEncrypt(Camellia* cam, byte* out, const byte* in, word32 sz) int wc_CamelliaCbcDecrypt(Camellia* cam, byte* out, const byte* in, word32 sz) { + word32 blocks; if (cam == NULL || out == NULL || in == NULL) { return BAD_FUNC_ARG; } - word32 blocks = sz / CAMELLIA_BLOCK_SIZE; + blocks = sz / CAMELLIA_BLOCK_SIZE; while (blocks--) { XMEMCPY(cam->tmp, in, CAMELLIA_BLOCK_SIZE); diff --git a/wolfcrypt/src/sha512.c b/wolfcrypt/src/sha512.c index c954a816e..b96b29ad6 100644 --- a/wolfcrypt/src/sha512.c +++ b/wolfcrypt/src/sha512.c @@ -156,7 +156,6 @@ /* #define DEBUG_YMM */ #endif - #if defined(HAVE_BYTEREVERSE64) && \ !defined(HAVE_INTEL_AVX1) && !defined(HAVE_INTEL_AVX2) #define ByteReverseWords64(out, in, size) ByteReverseWords64_1(out, size) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 7690fb88f..526036ce7 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -153,13 +153,6 @@ #include -#if defined(WOLFSSL_MDK_ARM) - #include - #include - extern FILE * wolfSSL_fopen(const char *fname, const char *mode) ; - #define fopen wolfSSL_fopen -#endif - #ifdef HAVE_NTRU #include "libntruencrypt/ntru_crypto.h" #endif @@ -7107,9 +7100,6 @@ byte GetEntropy(ENTROPY_CMD cmd, byte* out) #ifdef FREESCALE_MQX #define CERT_PREFIX "a:\\" #define CERT_PATH_SEP "\\" -#elif defined(WOLFSSL_MKD_SHELL) - #define CERT_PREFIX "" - #define CERT_PATH_SEP "/" #elif defined(WOLFSSL_uTKERNEL2) #define CERT_PREFIX "/uda/" #define CERT_PATH_SEP "/" diff --git a/wolfssl/internal.h b/wolfssl/internal.h index c3af73f7a..251201627 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -141,6 +141,8 @@ /* do nothing */ #elif defined(WOLFSSL_uTKERNEL2) /* do nothing */ +#elif defined(WOLFSSL_CMSIS_RTOS) + #include "cmsis_os.h" #elif defined(WOLFSSL_MDK_ARM) #if defined(WOLFSSL_MDK5) #include "cmsis_os.h" diff --git a/wolfssl/test.h b/wolfssl/test.h index 784aee03d..f1e2c6bc4 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -65,10 +65,6 @@ #elif defined (WOLFSSL_CMSIS_RTOS) #define sleep(t) osDelay(t/1000+1) ; #endif - - static int wolfssl_tcp_select(int sd, int timeout) - { return 0 ; } - #define tcp_select(sd,t) wolfssl_tcp_select(sd, t) /* avoid conflicting Keil TCP tcp_select */ #elif defined(WOLFSSL_TIRTOS) #include #include @@ -848,7 +844,7 @@ static INLINE int tcp_select(SOCKET_T socketfd, int to_sec) return TEST_SELECT_FAIL; } -#elif defined(WOLFSSL_TIRTOS) +#elif defined(WOLFSSL_TIRTOS) || defined(WOLFSSL_KEIL_TCP_NET) static INLINE int tcp_select(SOCKET_T socketfd, int to_sec) { return TEST_RECV_READY; @@ -880,8 +876,13 @@ static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr, if (bind(*sockfd, (const struct sockaddr*)&addr, sizeof(addr)) != 0) err_sys("tcp bind failed"); if (!udp) { - if (listen(*sockfd, 5) != 0) - err_sys("tcp listen failed"); + #ifdef WOLFSSL_KEIL_TCP_NET + #define SOCK_LISTEN_MAX_QUEUE 1 + #else + #define SOCK_LISTEN_MAX_QUEUE 5 + #endif + if (listen(*sockfd, SOCK_LISTEN_MAX_QUEUE) != 0) + err_sys("tcp listen failed"); } #if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_TIRTOS) if (*port == 0) { diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 6e9001291..ca9c8df1b 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -993,8 +993,6 @@ extern void uITRON4_free(void *p) ; #define NO_WOLFSSL_DIR #undef NO_RABBIT #define NO_RABBIT - #undef NO_64BIT - #define NO_64BIT #ifndef NO_STM32_RNG #undef STM32_RNG #define STM32_RNG diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index ee913ef50..710a2b230 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -69,6 +69,8 @@ #include "kernel.h" #elif defined(WOLFSSL_uTKERNEL2) #include "tk/tkernel.h" +#elif defined(WOLFSSL_CMSIS_RTOS) + #include "cmsis_os.h" #elif defined(WOLFSSL_MDK_ARM) #if defined(WOLFSSL_MDK5) #include "cmsis_os.h" diff --git a/wolfssl/wolfio.h b/wolfssl/wolfio.h index 59afd029b..65235132b 100644 --- a/wolfssl/wolfio.h +++ b/wolfssl/wolfio.h @@ -62,15 +62,12 @@ #include #elif defined(FREESCALE_KSDK_MQX) #include - #elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) - #if !defined(WOLFSSL_MDK_ARM) - #include "cmsis_os.h" - #include "rl_net.h" - #else - #include - #endif + #elif (defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET)) + #include "cmsis_os.h" + #include "rl_net.h" #include "errno.h" - #define SOCKET_T int + #elif defined(WOLFSSL_CMSIS_RTOS) + #include "cmsis_os.h" #elif defined(WOLFSSL_TIRTOS) #include #elif defined(FREERTOS_TCP) @@ -176,7 +173,6 @@ #define SOCKET_ECONNABORTED NIO_ECONNABORTED #endif #elif defined(WOLFSSL_MDK_ARM)|| defined(WOLFSSL_KEIL_TCP_NET) - #if !defined(WOLFSSL_MDK_ARM) #define SOCKET_EWOULDBLOCK BSD_ERROR_WOULDBLOCK #define SOCKET_EAGAIN BSD_ERROR_LOCKED #define SOCKET_ECONNRESET BSD_ERROR_CLOSED @@ -184,15 +180,6 @@ #define SOCKET_EPIPE BSD_ERROR #define SOCKET_ECONNREFUSED BSD_ERROR #define SOCKET_ECONNABORTED BSD_ERROR - #else - #define SOCKET_EWOULDBLOCK SCK_EWOULDBLOCK - #define SOCKET_EAGAIN SCK_ELOCKED - #define SOCKET_ECONNRESET SCK_ECLOSED - #define SOCKET_EINTR SCK_ERROR - #define SOCKET_EPIPE SCK_ERROR - #define SOCKET_ECONNREFUSED SCK_ERROR - #define SOCKET_ECONNABORTED SCK_ERROR - #endif #elif defined(WOLFSSL_PICOTCP) #define SOCKET_EWOULDBLOCK PICO_ERR_EAGAIN #define SOCKET_EAGAIN PICO_ERR_EAGAIN