diff --git a/src/ssl.c b/src/ssl.c index 4b33be8dd..6a32986a1 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -14916,6 +14916,7 @@ int wolfSSL_SetSession(WOLFSSL* ssl, WOLFSSL_SESSION* session) session = ClientSessionToSession(session); if (ssl == NULL || session == NULL) { + WOLFSSL_MSG("ssl or session NULL"); return WOLFSSL_FAILURE; } @@ -14956,7 +14957,8 @@ int wolfSSL_SetSession(WOLFSSL* ssl, WOLFSSL_SESSION* session) #endif { 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) { /* Check the session ID hash matches */ error = clientSession->sessionIDHash != sessionIDHash; + if (error != 0) + WOLFSSL_MSG("session ID hash don't match"); } if (error == 0) { /* Hashes match */ diff --git a/tests/api.c b/tests/api.c index a6ca181bc..5f2075da8 100644 --- a/tests/api.c +++ b/tests/api.c @@ -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_ctx = NULL; +#ifdef NO_SESSION_CACHE_REF 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 fdOpenSession(Task_self()); #endif