mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
Merge pull request #525 from toddouska/session
add resume session string script check, make GetDeepCopySession stati…
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
# need a unique resume port since may run the same time as testsuite
|
# need a unique resume port since may run the same time as testsuite
|
||||||
# use server port zero hack to get one
|
# use server port zero hack to get one
|
||||||
|
resume_string="reused"
|
||||||
resume_port=0
|
resume_port=0
|
||||||
no_pid=-1
|
no_pid=-1
|
||||||
server_pid=$no_pid
|
server_pid=$no_pid
|
||||||
@@ -65,7 +66,7 @@ fi
|
|||||||
# get created port 0 ephemeral port
|
# get created port 0 ephemeral port
|
||||||
resume_port=`cat $ready_file`
|
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=$?
|
client_result=$?
|
||||||
|
|
||||||
if [ $client_result != 0 ]
|
if [ $client_result != 0 ]
|
||||||
@@ -85,6 +86,15 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "$capture_out" in
|
||||||
|
*$resume_string*)
|
||||||
|
echo "resumed session" ;;
|
||||||
|
*)
|
||||||
|
echo "did NOT resume session as expected"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
echo -e "\nSuccess!\n"
|
echo -e "\nSuccess!\n"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
16
src/ssl.c
16
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;
|
WOLFSSL_SESSION* copyInto = &ssl->session;
|
||||||
void* tmpBuff = NULL;
|
void* tmpBuff = NULL;
|
||||||
@@ -7733,16 +7733,18 @@ int SetSession(WOLFSSL* ssl, WOLFSSL_SESSION* session)
|
|||||||
return SSL_FAILURE;
|
return SSL_FAILURE;
|
||||||
|
|
||||||
if (LowResTimer() < (session->bornOn + session->timeout)) {
|
if (LowResTimer() < (session->bornOn + session->timeout)) {
|
||||||
GetDeepCopySession(ssl, session);
|
int ret = GetDeepCopySession(ssl, session);
|
||||||
ssl->options.resuming = 1;
|
if (ret == SSL_SUCCESS) {
|
||||||
|
ssl->options.resuming = 1;
|
||||||
|
|
||||||
#ifdef SESSION_CERTS
|
#ifdef SESSION_CERTS
|
||||||
ssl->version = session->version;
|
ssl->version = session->version;
|
||||||
ssl->options.cipherSuite0 = session->cipherSuite0;
|
ssl->options.cipherSuite0 = session->cipherSuite0;
|
||||||
ssl->options.cipherSuite = session->cipherSuite;
|
ssl->options.cipherSuite = session->cipherSuite;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return SSL_SUCCESS;
|
return ret;
|
||||||
}
|
}
|
||||||
return SSL_FAILURE; /* session timed out */
|
return SSL_FAILURE; /* session timed out */
|
||||||
}
|
}
|
||||||
|
@@ -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_error(WOLFSSL*, int);
|
||||||
WOLFSSL_API int wolfSSL_get_alert_history(WOLFSSL*, WOLFSSL_ALERT_HISTORY *);
|
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 int wolfSSL_set_session(WOLFSSL* ssl,WOLFSSL_SESSION* session);
|
||||||
WOLFSSL_API long wolfSSL_SSL_SESSION_set_timeout(WOLFSSL_SESSION* session, long t);
|
WOLFSSL_API long wolfSSL_SSL_SESSION_set_timeout(WOLFSSL_SESSION* session, long t);
|
||||||
WOLFSSL_API WOLFSSL_SESSION* wolfSSL_get_session(WOLFSSL* ssl);
|
WOLFSSL_API WOLFSSL_SESSION* wolfSSL_get_session(WOLFSSL* ssl);
|
||||||
|
Reference in New Issue
Block a user