diff --git a/scripts/resume.test b/scripts/resume.test index 40a8613ae..337c30a76 100755 --- a/scripts/resume.test +++ b/scripts/resume.test @@ -4,6 +4,7 @@ # need a unique resume port since may run the same time as testsuite # use server port zero hack to get one +resume_string="reused" resume_port=0 no_pid=-1 server_pid=$no_pid @@ -65,7 +66,7 @@ fi # get created port 0 ephemeral port resume_port=`cat $ready_file` -./examples/client/client -r -p $resume_port +capture_out=$(./examples/client/client -r -p $resume_port 2>&1) client_result=$? if [ $client_result != 0 ] @@ -85,6 +86,15 @@ then exit 1 fi +case "$capture_out" in +*$resume_string*) + echo "resumed session" ;; +*) + echo "did NOT resume session as expected" + exit 1 + ;; +esac + echo -e "\nSuccess!\n" exit 0 diff --git a/src/ssl.c b/src/ssl.c index aa8a9ca6a..11c313c45 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -7635,7 +7635,7 @@ WOLFSSL_SESSION* GetSession(WOLFSSL* ssl, byte* masterSecret, } -int GetDeepCopySession(WOLFSSL* ssl, WOLFSSL_SESSION* copyFrom) +static int GetDeepCopySession(WOLFSSL* ssl, WOLFSSL_SESSION* copyFrom) { WOLFSSL_SESSION* copyInto = &ssl->session; void* tmpBuff = NULL; @@ -7733,16 +7733,18 @@ int SetSession(WOLFSSL* ssl, WOLFSSL_SESSION* session) return SSL_FAILURE; if (LowResTimer() < (session->bornOn + session->timeout)) { - GetDeepCopySession(ssl, session); - ssl->options.resuming = 1; + int ret = GetDeepCopySession(ssl, session); + if (ret == SSL_SUCCESS) { + ssl->options.resuming = 1; #ifdef SESSION_CERTS - ssl->version = session->version; - ssl->options.cipherSuite0 = session->cipherSuite0; - ssl->options.cipherSuite = session->cipherSuite; + ssl->version = session->version; + ssl->options.cipherSuite0 = session->cipherSuite0; + ssl->options.cipherSuite = session->cipherSuite; #endif + } - return SSL_SUCCESS; + return ret; } return SSL_FAILURE; /* session timed out */ } diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 8e5c5a157..1b84c4c80 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -340,7 +340,6 @@ WOLFSSL_API void wolfSSL_set_quiet_shutdown(WOLFSSL*, int); WOLFSSL_API int wolfSSL_get_error(WOLFSSL*, int); WOLFSSL_API int wolfSSL_get_alert_history(WOLFSSL*, WOLFSSL_ALERT_HISTORY *); -WOLFSSL_API int GetDeepCopySession(WOLFSSL*, WOLFSSL_SESSION*); WOLFSSL_API int wolfSSL_set_session(WOLFSSL* ssl,WOLFSSL_SESSION* session); WOLFSSL_API long wolfSSL_SSL_SESSION_set_timeout(WOLFSSL_SESSION* session, long t); WOLFSSL_API WOLFSSL_SESSION* wolfSSL_get_session(WOLFSSL* ssl);