From 38c01b9d9fb3eb091695eee7eea8c16a1132821b Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Fri, 29 Apr 2022 10:34:38 -0600 Subject: [PATCH 1/3] fix for infer diff report --- src/ssl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ssl.c b/src/ssl.c index c6669fa6e..02eb7ec46 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -12737,7 +12737,7 @@ WOLFSSL_ABI int wolfSSL_CTX_set_timeout(WOLFSSL_CTX* ctx, unsigned int to) { #if defined(WOLFSSL_ERROR_CODE_OPENSSL) - word32 prev_timeout; + word32 prev_timeout = 0; #endif int ret = WOLFSSL_SUCCESS; From 9d7a02b28ebc6ece756112b63f50726f091a5a17 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Fri, 29 Apr 2022 10:40:44 -0600 Subject: [PATCH 2/3] remove uint from test case and put variable declaration at top of scope --- tests/api.c | 64 +++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/tests/api.c b/tests/api.c index c1498f681..0dc86d612 100644 --- a/tests/api.c +++ b/tests/api.c @@ -34252,43 +34252,45 @@ static void test_wolfSSL_Tls13_Key_Logging_test(void) #endif /* check if the keylog file exists */ + { + char buff[300] = {0}; + int found[4] = {0}; + int numfnd = 0; + int i; - char buff[300] = {0}; - int found[4] = {0}; + fp = XFOPEN("./MyKeyLog.txt", "r"); - fp = XFOPEN("./MyKeyLog.txt", "r"); + AssertNotNull(fp); - AssertNotNull(fp); - - while(XFGETS( buff, (int)sizeof(buff),fp) != NULL ) { - if(0 == strncmp(buff,"CLIENT_HANDSHAKE_TRAFFIC_SECRET ", - sizeof("CLIENT_HANDSHAKE_TRAFFIC_SECRET ")-1)) { - found[0] = 1; - continue; + while (XFGETS( buff, (int)sizeof(buff),fp) != NULL ) { + if (0 == strncmp(buff,"CLIENT_HANDSHAKE_TRAFFIC_SECRET ", + sizeof("CLIENT_HANDSHAKE_TRAFFIC_SECRET ")-1)) { + found[0] = 1; + continue; + } + else if (0 == strncmp(buff,"SERVER_HANDSHAKE_TRAFFIC_SECRET ", + sizeof("SERVER_HANDSHAKE_TRAFFIC_SECRET ")-1)) { + found[1] = 1; + continue; + } + else if (0 == strncmp(buff,"CLIENT_TRAFFIC_SECRET_0 ", + sizeof("CLIENT_TRAFFIC_SECRET_0 ")-1)) { + found[2] = 1; + continue; + } + else if (0 == strncmp(buff,"SERVER_TRAFFIC_SECRET_0 ", + sizeof("SERVER_TRAFFIC_SECRET_0 ")-1)) { + found[3] = 1; + continue; + } } - else if(0 == strncmp(buff,"SERVER_HANDSHAKE_TRAFFIC_SECRET ", - sizeof("SERVER_HANDSHAKE_TRAFFIC_SECRET ")-1)) { - found[1] = 1; - continue; - } - else if(0 == strncmp(buff,"CLIENT_TRAFFIC_SECRET_0 ", - sizeof("CLIENT_TRAFFIC_SECRET_0 ")-1)) { - found[2] = 1; - continue; - } - else if(0 == strncmp(buff,"SERVER_TRAFFIC_SECRET_0 ", - sizeof("SERVER_TRAFFIC_SECRET_0 ")-1)) { - found[3] = 1; - continue; + XFCLOSE(fp); + for (i = 0; i < 4; i++) { + if( found[i] != 0) + numfnd++; } + AssertIntEQ(numfnd, 4); } - XFCLOSE(fp); - int numfnd = 0; - for( uint i = 0; i < 4; i++) { - if( found[i] != 0) - numfnd++; - } - AssertIntEQ( numfnd,4 ); printf(resultFmt, passed); From 14ff3d1f0f68d3bba41555eda6b90a57f969a333 Mon Sep 17 00:00:00 2001 From: JacobBarthelmeh Date: Fri, 29 Apr 2022 14:46:35 -0700 Subject: [PATCH 3/3] fix for macro guard with test case building with trusted peer certs --- tests/api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/api.c b/tests/api.c index 0dc86d612..88a5c1f42 100644 --- a/tests/api.c +++ b/tests/api.c @@ -950,9 +950,11 @@ static void test_wolfSSL_CTX_trust_peer_cert(void) AssertIntEQ(wolfSSL_trust_peer_cert(ssl, cliCertFile, WOLFSSL_FILETYPE_PEM), WOLFSSL_SUCCESS); + #ifdef WOLFSSL_LOCAL_X509_STORE /* unload cert */ AssertIntNE(wolfSSL_Unload_trust_peers(NULL), WOLFSSL_SUCCESS); AssertIntEQ(wolfSSL_Unload_trust_peers(ssl), WOLFSSL_SUCCESS); + #endif #endif /* Test of loading certs from buffers */