Fix intermittent failures in test_wolfSSL_CTX_add_session

This commit is contained in:
Juliusz Sosinowicz
2023-04-05 13:57:10 +02:00
parent 10c1009bbd
commit a51daf1bfa
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);
if (ssl == NULL || session == NULL) {
WOLFSSL_MSG("ssl or session NULL");
return WOLFSSL_FAILURE;
}
@ -14956,6 +14957,7 @@ int wolfSSL_SetSession(WOLFSSL* ssl, WOLFSSL_SESSION* session)
#endif
{
ret = wolfSSL_DupSession(session, ssl->session, 0);
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 */

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_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