don't compare session id if server rejects

This commit is contained in:
toddouska 2012-05-11 12:21:17 -07:00
parent 89b0c932a5
commit 7b2d62f4f7
3 changed files with 13 additions and 5 deletions

View File

@ -199,7 +199,7 @@ AC_ARG_ENABLE(bump,
if test "$ENABLED_BUMP" = "yes" if test "$ENABLED_BUMP" = "yes"
then then
AM_CFLAGS="$AM_CFLAGS -DLARGE_STATIC_BUFFERS -DCYASSL_CERT_GEN -DCYASSL_KEY_GEN -DHUGE_SESSION_CACHE -DOPENSSL_EXTRA -DFP_MAX_BITS=8192 -DCYASSL_DER_LOAD -DCYASSL_ALT_NAMES" AM_CFLAGS="$AM_CFLAGS -DLARGE_STATIC_BUFFERS -DCYASSL_CERT_GEN -DCYASSL_KEY_GEN -DHUGE_SESSION_CACHE -DOPENSSL_EXTRA -DFP_MAX_BITS=8192 -DCYASSL_DER_LOAD -DCYASSL_ALT_NAMES -DCYASSL_TEST_CERT"
fi fi
# fastmath # fastmath

View File

@ -4150,6 +4150,7 @@ int SetCipherList(Suites* s, const char* list)
byte compression; byte compression;
ProtocolVersion pv; ProtocolVersion pv;
word32 i = *inOutIdx; word32 i = *inOutIdx;
int serverResumption = 0;
#ifdef CYASSL_CALLBACKS #ifdef CYASSL_CALLBACKS
if (ssl->hsInfoOn) AddPacketName("ServerHello", &ssl->handShakeInfo); if (ssl->hsInfoOn) AddPacketName("ServerHello", &ssl->handShakeInfo);
@ -4191,6 +4192,7 @@ int SetCipherList(Suites* s, const char* list)
if (b) { if (b) {
XMEMCPY(ssl->arrays.sessionID, input + i, b); XMEMCPY(ssl->arrays.sessionID, input + i, b);
i += b; i += b;
serverResumption = 1;
} }
ssl->options.cipherSuite0 = input[i++]; ssl->options.cipherSuite0 = input[i++];
ssl->options.cipherSuite = input[i++]; ssl->options.cipherSuite = input[i++];
@ -4206,8 +4208,8 @@ int SetCipherList(Suites* s, const char* list)
*inOutIdx = i; *inOutIdx = i;
if (ssl->options.resuming) { if (ssl->options.resuming) {
if (XMEMCMP(ssl->arrays.sessionID, ssl->session.sessionID, ID_LEN) if (serverResumption && XMEMCMP(ssl->arrays.sessionID,
== 0) { ssl->session.sessionID, ID_LEN) == 0) {
if (SetCipherSpecs(ssl) == 0) { if (SetCipherSpecs(ssl) == 0) {
int ret; int ret;
XMEMCPY(ssl->arrays.masterSecret, ssl->session.masterSecret, XMEMCPY(ssl->arrays.masterSecret, ssl->session.masterSecret,

View File

@ -1745,7 +1745,10 @@ void CyaSSL_CTX_SetCACb(CYASSL_CTX* ctx, CallbackCACache cb)
CYASSL_SESSION* CyaSSL_get_session(CYASSL* ssl) CYASSL_SESSION* CyaSSL_get_session(CYASSL* ssl)
{ {
CYASSL_ENTER("SSL_get_session"); CYASSL_ENTER("SSL_get_session");
return GetSession(ssl, 0); if (ssl)
return GetSession(ssl, 0);
return NULL;
} }
@ -7385,7 +7388,10 @@ int CyaSSL_get_chain_cert_pem(CYASSL_X509_CHAIN* chain, int idx,
const byte* CyaSSL_get_sessionID(const CYASSL_SESSION* session) const byte* CyaSSL_get_sessionID(const CYASSL_SESSION* session)
{ {
CYASSL_ENTER("CyaSSL_get_sessionID"); CYASSL_ENTER("CyaSSL_get_sessionID");
return session->sessionID; if (session)
return session->sessionID;
return NULL;
} }