add newSession flag to SetServerID to do full handshake w/ new session
This commit is contained in:
parent
7f7c595d10
commit
8c70b11528
@ -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*);
|
||||
|
19
src/ssl.c
19
src/ssl.c
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user