Merge pull request #4308 from dgarske/sess_row_cache

Improvements to session locking to allow per-row
This commit is contained in:
Sean Parkinson
2021-08-24 09:07:03 +10:00
committed by GitHub
4 changed files with 373 additions and 261 deletions

View File

@@ -2452,7 +2452,6 @@ WOLFSSL_API int wolfSSL_GetSessionAtIndex(int index, WOLFSSL_SESSION* session);
}
\endcode
\sa get_locked_session_stats
\sa wolfSSL_GetSessionAtIndex
\sa wolfSSL_GetSessionIndex
\sa AddSession
@@ -11510,7 +11509,6 @@ WOLFSSL_API int wolfSSL_PrintSessionStats(void);
return ret;
\endcode
\sa get_locked_session_stats
\sa wolfSSL_PrintSessionStats
*/
WOLFSSL_API int wolfSSL_get_session_stats(unsigned int* active,

View File

@@ -3654,6 +3654,7 @@ static int ProcessFinished(const byte* input, int size, int* sslBytes,
if (ret == 0 && session->flags.cached == 0) {
if (session->sslServer->options.haveSessionId) {
#ifndef NO_SESSION_CACHE
WOLFSSL_SESSION* sess = GetSession(session->sslServer, NULL, 0);
if (sess == NULL) {
AddSession(session->sslServer); /* don't re add */
@@ -3662,6 +3663,7 @@ static int ProcessFinished(const byte* input, int size, int* sslBytes,
#endif
}
session->flags.cached = 1;
#endif
}
}
@@ -5682,7 +5684,7 @@ int ssl_EnableRecovery(int onOff, int maxMemory, char* error)
#ifdef WOLFSSL_SESSION_STATS
#if defined(WOLFSSL_SESSION_STATS) && !defined(NO_SESSION_CACHE)
int ssl_GetSessionStats(unsigned int* active, unsigned int* total,
unsigned int* peak, unsigned int* maxSessions,

623
src/ssl.c

File diff suppressed because it is too large Load Diff

View File

@@ -3333,6 +3333,7 @@ struct WOLFSSL_X509_CHAIN {
/* wolfSSL session type */
struct WOLFSSL_SESSION {
int cacheRow; /* row in session cache */
word32 bornOn; /* create time in seconds */
word32 timeout; /* timeout in seconds */
byte sessionID[ID_LEN]; /* id for protocol */
@@ -3368,7 +3369,7 @@ struct WOLFSSL_SESSION {
wolfSSL_Mutex refMutex; /* ref count mutex */
#endif
int refCount; /* reference count */
#endif
#endif /* OPENSSL_EXTRA */
#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)
byte peerVerifyRet; /* cert verify error */
#endif
@@ -3398,7 +3399,7 @@ struct WOLFSSL_SESSION {
WOLFSSL_CRYPTO_EX_DATA ex_data;
#endif
byte side; /* Either WOLFSSL_CLIENT_END or
WOLFSSL_SERVER_END */
WOLFSSL_SERVER_END */
};