Merge pull request #6269 from julek-wolfssl/fix-test_wolfSSL_CTX_add_session

Fix intermittent failures in test_wolfSSL_CTX_add_session
This commit is contained in:
JacobBarthelmeh
2023-04-05 15:19:36 -06:00
committed by GitHub
2 changed files with 11 additions and 1 deletions

View File

@@ -14916,6 +14916,7 @@ int wolfSSL_SetSession(WOLFSSL* ssl, WOLFSSL_SESSION* session)
session = ClientSessionToSession(session); session = ClientSessionToSession(session);
if (ssl == NULL || session == NULL) { if (ssl == NULL || session == NULL) {
WOLFSSL_MSG("ssl or session NULL");
return WOLFSSL_FAILURE; return WOLFSSL_FAILURE;
} }
@@ -14956,7 +14957,8 @@ int wolfSSL_SetSession(WOLFSSL* ssl, WOLFSSL_SESSION* session)
#endif #endif
{ {
ret = wolfSSL_DupSession(session, ssl->session, 0); ret = wolfSSL_DupSession(session, ssl->session, 0);
WOLFSSL_MSG("Session duplicate failed"); if (ret != WOLFSSL_SUCCESS)
WOLFSSL_MSG("Session duplicate failed");
} }
} }
@@ -15169,6 +15171,8 @@ WOLFSSL_SESSION* ClientSessionToSession(const WOLFSSL_SESSION* session)
if (error == 0) { if (error == 0) {
/* Check the session ID hash matches */ /* Check the session ID hash matches */
error = clientSession->sessionIDHash != sessionIDHash; error = clientSession->sessionIDHash != sessionIDHash;
if (error != 0)
WOLFSSL_MSG("session ID hash don't match");
} }
if (error == 0) { if (error == 0) {
/* Hashes match */ /* Hashes match */

View File

@@ -7388,7 +7388,13 @@ static int test_wolfSSL_CTX_add_session(void)
test_wolfSSL_CTX_add_session_server_sess = NULL; test_wolfSSL_CTX_add_session_server_sess = NULL;
test_wolfSSL_CTX_add_session_server_ctx = NULL; test_wolfSSL_CTX_add_session_server_ctx = NULL;
#ifdef NO_SESSION_CACHE_REF
for (j = 0; j < 5; j++) { for (j = 0; j < 5; j++) {
#else
/* The session may be overwritten in this case. Do only one resumption
* to stop this test from failing intermittently. */
for (j = 0; j < 2; j++) {
#endif
#ifdef WOLFSSL_TIRTOS #ifdef WOLFSSL_TIRTOS
fdOpenSession(Task_self()); fdOpenSession(Task_self());
#endif #endif