Skip to content

Commit

Permalink
Disable OpenSSL internal SSL_SESSION cache for clients
Browse files Browse the repository at this point in the history
  • Loading branch information
rzikm committed Apr 29, 2024
1 parent 99dd60d commit 56a308e
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,14 @@ int CryptoNative_SslCtxSetCaching(SSL_CTX* ctx, int mode, int cacheSize, int con
// void shim functions don't lead to exceptions, so skip the unconditional error clearing.

// We never reuse same CTX for both client and server
SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SESS_CACHE_MODE, mode ? SSL_SESS_CACHE_BOTH : SSL_SESS_CACHE_OFF, NULL);
int modeFlags = SSL_SESS_CACHE_BOTH;
if (newSessionCb && removeSessionCb)
{
// sessions are completely controlled externally (from .NET), disable internal cache
modeFlags |= SSL_SESS_CACHE_NO_INTERNAL_STORE;
}

SSL_CTX_ctrl(ctx, SSL_CTRL_SET_SESS_CACHE_MODE, mode ? modeFlags : SSL_SESS_CACHE_OFF, NULL);
if (mode == 0)
{
SSL_CTX_set_options(ctx, SSL_OP_NO_TICKET);
Expand Down

0 comments on commit 56a308e

Please sign in to comment.