Improvements to session locking to allow per-row. Can manually be enabled with ENABLE_SESSION_CACHE_ROW_LOCK or forcefully disabled using NO_SESSION_CACHE_ROW_LOCK. Enabled by default for Titan cache. ZD 12715.

This commit is contained in:
David Garske
2021-08-16 16:30:06 -07:00
parent e7ef48d2b7
commit c8926a45ab
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,

589
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