From c0c98c8f6497b649d1d422acd8d649d455b15ee0 Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 11 May 2017 14:32:21 -0700 Subject: [PATCH] Fixes to address build warnings for GCC 7. Used `-Wimplicit-fallthrough=0` to suppress all switch fall-through warnings. --- configure.ac | 7 +++++++ src/ssl.c | 6 ++++-- src/tls13.c | 6 ++++-- wolfcrypt/test/test.c | 4 ++-- wolfssl/test.h | 4 ++-- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 800f10e53..3a2c8b8d5 100644 --- a/configure.ac +++ b/configure.ac @@ -113,6 +113,7 @@ OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET -DTFM_HUGE_SET" DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_WOLFSSL" LIB_ADD= LIB_STATIC_ADD= +SWITCH_FALLTHROUGH="-Wimplicit-fallthrough=0" thread_ls_on=no # Thread local storage @@ -3422,6 +3423,10 @@ case $host_os in fi ;; esac +# add workaround for switch fall-through +CFLAGS="$CFLAGS $SWITCH_FALLTHROUGH" + + # add user C_EXTRA_FLAGS back # For distro disable custom build options that interfere with symbol generation if test "$ENABLED_DISTRO" = "no" @@ -3430,6 +3435,8 @@ then fi OPTION_FLAGS="$USER_CFLAGS $USER_C_EXTRA_FLAGS $AM_CFLAGS" + + CREATE_HEX_VERSION AC_SUBST([AM_CPPFLAGS]) AC_SUBST([AM_CFLAGS]) diff --git a/src/ssl.c b/src/ssl.c index bfb41d5be..2297c4e4e 100755 --- a/src/ssl.c +++ b/src/ssl.c @@ -8509,12 +8509,14 @@ int wolfSSL_DTLS_SetCookieSecret(WOLFSSL* ssl, case KEY_EXCHANGE_SENT : #ifndef NO_CERTS - if (!ssl->options.resuming) - if (ssl->options.verifyPeer) + if (!ssl->options.resuming) { + if (ssl->options.verifyPeer) { if ( (ssl->error = SendCertificateRequest(ssl)) != 0) { WOLFSSL_ERROR(ssl->error); return SSL_FATAL_ERROR; } + } + } #endif ssl->options.acceptState = CERT_REQ_SENT; WOLFSSL_MSG("accept state CERT_REQ_SENT"); diff --git a/src/tls13.c b/src/tls13.c index 699542847..b3208edea 100644 --- a/src/tls13.c +++ b/src/tls13.c @@ -5404,13 +5404,15 @@ int wolfSSL_accept_TLSv13(WOLFSSL* ssl) WOLFSSL_MSG("accept state SERVER_EXTENSIONS_SENT"); case SERVER_EXTENSIONS_SENT : #ifndef NO_CERTS - if (!ssl->options.resuming) - if (ssl->options.verifyPeer) + if (!ssl->options.resuming) { + if (ssl->options.verifyPeer) { ssl->error = SendTls13CertificateRequest(ssl); if (ssl->error != 0) { WOLFSSL_ERROR(ssl->error); return SSL_FATAL_ERROR; } + } + } #endif ssl->options.acceptState = CERT_REQ_SENT; WOLFSSL_MSG("accept state CERT_REQ_SENT"); diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index b2f32f0a1..0ae6173d8 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -3642,9 +3642,9 @@ int aes_test(void) byte iv[] = "1234567890abcdef "; /* align */ #ifdef WOLFSSL_ASYNC_CRYPT - if (wc_AesAsyncInit(&enc, devId) != 0) + if (wc_AesInit(&enc, HEAP_HINT, devId) != 0) return -4200; - if (wc_AesAsyncInit(&dec, devId) != 0) + if (wc_AesInit(&dec, HEAP_HINT, devId) != 0) return -4201; #endif diff --git a/wolfssl/test.h b/wolfssl/test.h index a68fafe57..ebca22aba 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -597,7 +597,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer, #ifndef TEST_IPV6 /* peer could be in human readable form */ - if ( (peer != INADDR_ANY) && isalpha((int)peer[0])) { + if ( ((size_t)peer != INADDR_ANY) && isalpha((int)peer[0])) { #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) int err; struct hostent* entry = gethostbyname(peer, &err); @@ -627,7 +627,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer, addr->sin_family = AF_INET_V; #endif addr->sin_port = XHTONS(port); - if (peer == INADDR_ANY) + if ((size_t)peer == INADDR_ANY) addr->sin_addr.s_addr = INADDR_ANY; else { if (!useLookup)