add newSession flag to SetServerID to do full handshake w/ new session

pull/1/head
toddouska 2013-06-14 15:29:18 -07:00
parent 7f7c595d10
commit 8c70b11528
2 changed files with 13 additions and 10 deletions

View File

@ -217,8 +217,8 @@ CYASSL_API int CyaSSL_get_alert_history(CYASSL*, CYASSL_ALERT_HISTORY *);
CYASSL_API int CyaSSL_set_session(CYASSL* ssl,CYASSL_SESSION* session);
CYASSL_API CYASSL_SESSION* CyaSSL_get_session(CYASSL* ssl);
CYASSL_API void CyaSSL_flush_sessions(CYASSL_CTX *ctx, long tm);
CYASSL_API int CyaSSL_SetServerID(CYASSL* ssl, const unsigned char*,int);
CYASSL_API int CyaSSL_SetServerID(CYASSL* ssl, const unsigned char*,
int, int);
typedef int (*VerifyCallback)(int, CYASSL_X509_STORE_CTX*);
typedef int (*pem_password_cb)(char*, int, int, void*);

View File

@ -2788,22 +2788,25 @@ int CyaSSL_set_session(CYASSL* ssl, CYASSL_SESSION* session)
#ifndef NO_CLIENT_CACHE
/* Assocaite client session with serverID, find existing or store for saving
/* Associate client session with serverID, find existing or store for saving
if newSession flag on, don't reuse existing session
SSL_SUCCESS on ok */
int CyaSSL_SetServerID(CYASSL* ssl, const byte* id, int len)
int CyaSSL_SetServerID(CYASSL* ssl, const byte* id, int len, int newSession)
{
CYASSL_SESSION* session;
CYASSL_SESSION* session = NULL;
CYASSL_ENTER("CyaSSL_SetServerID");
if (ssl == NULL || id == NULL || len <= 0)
return BAD_FUNC_ARG;
session = GetSessionClient(ssl, id, len);
if (session) {
if (SetSession(ssl, session) != SSL_SUCCESS) {
CYASSL_MSG("SetSession failed");
session = NULL;
if (newSession == 0) {
session = GetSessionClient(ssl, id, len);
if (session) {
if (SetSession(ssl, session) != SSL_SUCCESS) {
CYASSL_MSG("SetSession failed");
session = NULL;
}
}
}