From 1830a0a74c0041534aaecead9b2043e9052ba668 Mon Sep 17 00:00:00 2001 From: abrahamsonn Date: Thu, 25 Apr 2019 15:50:02 -0600 Subject: [PATCH 1/4] Removed trailing whitespaces --- IDE/IAR-EWARM/Projects/user_settings.h | 4 +-- IDE/IAR-EWARM/README | 50 +++++++++++++------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/IDE/IAR-EWARM/Projects/user_settings.h b/IDE/IAR-EWARM/Projects/user_settings.h index 6dacfb917..289a4d718 100644 --- a/IDE/IAR-EWARM/Projects/user_settings.h +++ b/IDE/IAR-EWARM/Projects/user_settings.h @@ -7,7 +7,7 @@ #define USE_CERT_BUFFERS_2048 #define WOLFSSL_USER_CURRTIME #define SIZEOF_LONG_LONG 8 -#define NO_WOLFSSL_DIR +#define NO_WOLFSSL_DIR #define WOLFSSL_NO_CURRDIR #define NO_WOLF_C99 #define NO_MULTIBYTE_PRINT @@ -31,4 +31,4 @@ #define HAVE_ECC #define HAVE_CURVE25519 #define CURVE25519_SMALL -#define HAVE_ED25519 \ No newline at end of file +#define HAVE_ED25519 diff --git a/IDE/IAR-EWARM/README b/IDE/IAR-EWARM/README index 2b5f80d77..637c65f7a 100644 --- a/IDE/IAR-EWARM/README +++ b/IDE/IAR-EWARM/README @@ -1,8 +1,8 @@ -CyaSSL IAR Project Files - -This directory contains project files for IAR EWARM IDE. These -projects have been set up to generic ARM Cortex-M MPUs. -In order to generate project for specific target MPU, take following steps. +CyaSSL IAR Project Files + +This directory contains project files for IAR EWARM IDE. These +projects have been set up to generic ARM Cortex-M MPUs. +In order to generate project for specific target MPU, take following steps. ** Note ** regarding Segger Embedded Operating System (embOS) The directory embOS contains projects specifically for embOS on IAR-EWARM. @@ -10,20 +10,20 @@ In order to generate project for specific target MPU, take following steps. uses embOS -Included Project Files ------------------------ -1. Workspace: wolfssl.eww - The workspace includes wolfSSL-Lib library and wolfCrypt-test, wolfCrypt-benchmark +Included Project Files +----------------------- +1. Workspace: wolfssl.eww + The workspace includes wolfSSL-Lib library and wolfCrypt-test, wolfCrypt-benchmark executable projects. 2. wolfSSL-Lib Project: lib/wolfSSL-lib.ewp - generates full set library of wolfCrypt and wolfSSL functions. + generates full set library of wolfCrypt and wolfSSL functions. -3. Test suites Project: test/wolfCrypt-test.ewp - generates test.out test suites executable +3. Test suites Project: test/wolfCrypt-test.ewp + generates test.out test suites executable -4. Benchmark Project: benchmark/wolfCrypt-benchmark.ewp - generates benchmark.out benchmark executable +4. Benchmark Project: benchmark/wolfCrypt-benchmark.ewp + generates benchmark.out benchmark executable Set Up Steps ------------ @@ -33,22 +33,22 @@ Set Up Steps You can build and download the to the simulator. Open Terminal I/O window, by "view"->"Terminal I/O", and start execution. -1. Project option settings - For each project,... - General Options: Choose appropriate "Target" options +1. Project option settings + For each project,... + General Options: Choose appropriate "Target" options -2. For executable projects,... +2. For executable projects,... Add "SystemInit" and "startup" for your MPU - Debugger: Choose your debug "Driver" + Debugger: Choose your debug "Driver" -3. For benchmark project,... +3. For benchmark project,... Choose option for current_time function. Or write own "current_time" benchmark timer with WOLFSSL_USER_CURRTIME option. -4. Build and download - Go to "Project->Make" and "Download and Debug" in Menu bar for EWARM build and download. +4. Build and download + Go to "Project->Make" and "Download and Debug" in Menu bar for EWARM build and download. -Support -------- -Please send questions or comments to support@wolfssl.com +Support +------- +Please send questions or comments to support@wolfssl.com From bbb72946b7a36c0dcb26d022e6bd83162d4884a0 Mon Sep 17 00:00:00 2001 From: abrahamsonn Date: Fri, 26 Apr 2019 11:35:50 -0600 Subject: [PATCH 2/4] initialized var. --- src/ssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ssl.c b/src/ssl.c index 3979bcaaf..55867bc53 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -4659,7 +4659,7 @@ int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff, int resetSuites = 0; void* heap = wolfSSL_CTX_GetHeap(ctx, ssl); int devId = wolfSSL_CTX_GetDevId(ctx, ssl); - word32 idx; + word32 idx = 0; int keySz = 0; #ifdef WOLFSSL_SMALL_STACK EncryptedInfo* info = NULL; From ea797fd98e60359beb846b7e3800a1e13097b44d Mon Sep 17 00:00:00 2001 From: abrahamsonn Date: Fri, 26 Apr 2019 14:08:20 -0600 Subject: [PATCH 3/4] Building with just bare TLS 1.3 settings will produce the error that the wolfSSL struct doesn't have extensions. --- src/tls13.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tls13.c b/src/tls13.c index 5f1825997..0a7f21c53 100644 --- a/src/tls13.c +++ b/src/tls13.c @@ -4015,7 +4015,8 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx, } #endif -#if defined(HAVE_SESSION_TICKET) || !defined(NO_PSK) +#if (defined(HAVE_SESSION_TICKET) || !defined(NO_PSK)) && \ + defined(HAVE_TLS_EXTENSIONS) if (TLSX_Find(ssl->extensions, TLSX_PRE_SHARED_KEY) != NULL) { if (ssl->options.downgrade) { if ((ret = InitHandshakeHashes(ssl)) != 0) From ef29aa94ea468e5fbbc13b13c1b8bcb6c0f4cc47 Mon Sep 17 00:00:00 2001 From: abrahamsonn Date: Fri, 26 Apr 2019 15:32:38 -0600 Subject: [PATCH 4/4] Added build option checks to tls.c and tls13.c Set tls.c and tls13.c to abort if the library is built with TLS 1.3 and not HAVE_TLS_EXTENSIONS --- src/tls.c | 12 ++++++++++-- src/tls13.c | 8 ++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/tls.c b/src/tls.c index 1fc090b8d..905ba0320 100644 --- a/src/tls.c +++ b/src/tls.c @@ -63,12 +63,13 @@ static int TLSX_KeyShare_IsSupported(int namedGroup); #endif -#if (!defined(NO_WOLFSSL_SERVER) && defined(WOLFSSL_TLS13) && \ +#if ((!defined(NO_WOLFSSL_SERVER) && defined(WOLFSSL_TLS13) && \ !defined(WOLFSSL_NO_SERVER_GROUPS_EXT)) || \ (defined(WOLFSSL_TLS13) && !defined(HAVE_ECC) && \ !defined(HAVE_CURVE25519) && defined(HAVE_SUPPORTED_CURVES)) || \ ((defined(HAVE_ECC) || defined(HAVE_CURVE25519)) && \ - defined(HAVE_SUPPORTED_CURVES)) + defined(HAVE_SUPPORTED_CURVES))) && \ + defined(HAVE_TLS_EXTENSIONS) static int TLSX_PopulateSupportedGroups(WOLFSSL* ssl, TLSX** extensions); #endif @@ -97,6 +98,13 @@ static int TLSX_PopulateSupportedGroups(WOLFSSL* ssl, TLSX** extensions); #if !defined(NO_RSA) && !defined(WC_RSA_PSS) #error The build option WC_RSA_PSS is required for TLS 1.3 with RSA #endif + #ifndef HAVE_TLS_EXTENSIONS + #ifndef _MSC_VER + #error "The build option HAVE_TLS_EXTENSIONS is required for TLS 1.3" + #else + #pragma message("Error: The build option HAVE_TLS_EXTENSIONS is required for TLS 1.3") + #endif + #endif #endif /* Warn if secrets logging is enabled */ diff --git a/src/tls13.c b/src/tls13.c index 5f1825997..ee7ced267 100644 --- a/src/tls13.c +++ b/src/tls13.c @@ -134,6 +134,14 @@ #error The build option HAVE_HKDF is required for TLS 1.3 #endif +#ifndef HAVE_TLS_EXTENSIONS + #ifndef _MSC_VER + #error "The build option HAVE_TLS_EXTENSIONS is required for TLS 1.3" + #else + #pragma message("error: The build option HAVE_TLS_EXTENSIONS is required for TLS 1.3") + #endif +#endif + /* Set ret to error value and jump to label. *