add resume session string script check, make GetDeepCopySession static local and check reutrn code

This commit is contained in:
toddouska 2016-08-15 09:32:36 -07:00
parent b38218a0b9
commit d74fa8299a
3 changed files with 20 additions and 9 deletions

View File

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

View File

@ -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 */
}

View File

@ -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);