diff --git a/src/ssl.c b/src/ssl.c index 6e65256f0..9eaf2980f 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -11954,10 +11954,10 @@ static int wolfSSL_remove_ciphers(char* list, int sz, const char* toRemove) static char* buildEnabledCipherList(WOLFSSL_CTX* ctx, Suites* suites, int onlytlsv13suites, const char* list) { - int idx = 0; - int listsz = 0; - int len = 0; - int ianasz = 0; + word32 idx = 0; + word32 listsz = 0; + word32 len = 0; + word32 ianasz = 0; const char* enabledcs = NULL; char* locallist = NULL; char* head = NULL; @@ -11971,7 +11971,7 @@ static char* buildEnabledCipherList(WOLFSSL_CTX* ctx, Suites* suites, if (!suites->setSuites) return NULL; - listsz = XSTRLEN(list); + listsz = (word32)XSTRLEN(list); /* calculate necessary buffer length */ for(idx = 0; idx < suites->suiteSz; idx++) { @@ -11987,7 +11987,7 @@ static char* buildEnabledCipherList(WOLFSSL_CTX* ctx, Suites* suites, continue; if (XSTRNCMP(enabledcs, "None", XSTRLEN(enabledcs)) != 0) { - len += XSTRLEN(enabledcs) + 2; + len += (word32)XSTRLEN(enabledcs) + 2; } } @@ -12035,7 +12035,7 @@ static char* buildEnabledCipherList(WOLFSSL_CTX* ctx, Suites* suites, len -= ianasz + 1; } else{ - XFREE(locallist, ctx-heap, DYNAMIC_TYPE_TMP_BUFFER); + XFREE(locallist, ctx->heap, DYNAMIC_TYPE_TMP_BUFFER); return NULL; } } diff --git a/tests/api.c b/tests/api.c index 3f415fe51..c2a13993f 100644 --- a/tests/api.c +++ b/tests/api.c @@ -756,11 +756,14 @@ static void test_for_double_Free(void) AssertTrue(wolfSSL_CTX_use_certificate_file(ctx, testCertFile, WOLFSSL_FILETYPE_PEM)); AssertTrue(wolfSSL_CTX_use_PrivateKey_file(ctx, testKeyFile, WOLFSSL_FILETYPE_PEM)); AssertTrue(wolfSSL_CTX_set_cipher_list(ctx, optionsCiphers)); -#ifdef WOLFSSL_TLS13 +#if defined(OPENSSL_EXTRA) && defined(WOLFSSL_TLS13) && defined(HAVE_AESGCM) && \ + defined(WOLFSSL_SHA384) && defined(WOLFSSL_AES_256) /* only update TLSv13 suites */ AssertTrue(wolfSSL_CTX_set_cipher_list(ctx, "TLS13-AES256-GCM-SHA384")); #endif -#ifndef WOLFSSL_NO_TLS12 +#if defined(OPENSSL_EXTRA) && defined(HAVE_ECC) && defined(HAVE_AESGCM) && \ + !defined(NO_SHA256) && !defined(WOLFSSL_NO_TLS12) && \ + defined(WOLFSSL_AES_128) && !defined(NO_RSA) /* only update pre-TLSv13 suites */ AssertTrue(wolfSSL_CTX_set_cipher_list(ctx, "ECDHE-RSA-AES128-GCM-SHA256")); #endif @@ -781,11 +784,14 @@ static void test_for_double_Free(void) AssertNotNull(ssl); /* test setting ciphers at SSL level */ AssertTrue(wolfSSL_set_cipher_list(ssl, optionsCiphers)); -#ifdef WOLFSSL_TLS13 +#if defined(OPENSSL_EXTRA) && defined(WOLFSSL_TLS13) && defined(HAVE_AESGCM) && \ + defined(WOLFSSL_SHA384) && defined(WOLFSSL_AES_256) /* only update TLSv13 suites */ AssertTrue(wolfSSL_set_cipher_list(ssl, "TLS13-AES256-GCM-SHA384")); #endif -#ifndef WOLFSSL_NO_TLS12 +#if defined(OPENSSL_EXTRA) && defined(HAVE_ECC) && defined(HAVE_AESGCM) && \ + !defined(NO_SHA256) && !defined(WOLFSSL_NO_TLS12) && \ + defined(WOLFSSL_AES_128) && !defined(NO_RSA) /* only update pre-TLSv13 suites */ AssertTrue(wolfSSL_set_cipher_list(ssl, "ECDHE-RSA-AES128-GCM-SHA256")); #endif