scr session resumption example

This commit is contained in:
toddouska 2014-09-26 10:47:57 -07:00
parent a260171e23
commit 95585e93df
2 changed files with 18 additions and 10 deletions

View File

@ -694,13 +694,21 @@ THREAD_RETURN CYASSL_THREAD client_test(void* args)
if (nonBlocking) {
printf("not doing secure renegotiation on example with"
" nonblocking yet");
}
else if (CyaSSL_Rehandshake(ssl) != SSL_SUCCESS) {
int err = CyaSSL_get_error(ssl, 0);
char buffer[CYASSL_MAX_ERROR_SZ];
printf("err = %d, %s\n", err,
} else {
#ifndef NO_SESSION_CACHE
if (resumeSession) {
session = CyaSSL_get_session(ssl);
CyaSSL_set_session(ssl, session);
resumeSession = 0; /* only resume once */
}
#endif
if (CyaSSL_Rehandshake(ssl) != SSL_SUCCESS) {
int err = CyaSSL_get_error(ssl, 0);
char buffer[CYASSL_MAX_ERROR_SZ];
printf("err = %d, %s\n", err,
CyaSSL_ERR_error_string(err, buffer));
err_sys("CyaSSL_Rehandshake failed");
err_sys("CyaSSL_Rehandshake failed");
}
}
}
#endif /* HAVE_SECURE_RENEGOTIATION */

View File

@ -8960,6 +8960,10 @@ static void PickHashSigAlgo(CYASSL* ssl,
ssl->options.serverState = SERVER_HELLO_COMPLETE;
if (ssl->keys.encryptionOn) {
*inOutIdx += ssl->keys.padSz;
}
if (ssl->options.resuming) {
if (ssl->options.haveSessionId && XMEMCMP(ssl->arrays->sessionID,
ssl->session.sessionID, ID_LEN) == 0) {
@ -8998,10 +9002,6 @@ static void PickHashSigAlgo(CYASSL* ssl,
}
#endif
if (ssl->keys.encryptionOn) {
*inOutIdx += ssl->keys.padSz;
}
return SetCipherSpecs(ssl);
}