SSL_CTX_ADD_SESSION(3)
π NAME π
okay bestie, this is SSL_CTX_ADD_SESSION(3) from the Library Functions Manual, and it's all about the session-cache vibes π
SSL_CTX_add_session,SSL_CTX_remove_sessionβ manipulate session cache β¨
πΈ SYNOPSIS πΈ
the synopsis literally goes like this, no cap:
library βlibsslβ libcrypto #include <openssl/ssl.h>
int
SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c);
int
SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c);
π¦ DESCRIPTION π¦
SSL_CTX_add_session() adds the session c to the context ctx. the reference count for session c is incremented by 1. if a session with the same session id already exists, the old session is removed by calling SSL_SESSION_free(3) π
SSL_CTX_remove_session() removes the session c from the context ctx and marks it as non-resumable. SSL_SESSION_free(3) is called once for c. that's the tea β
when adding a new session to the internal session cache, it is examined whether a session with the same session id already exists. in this case it is assumed that both sessions are identical. if the same session is stored in a different SSL_SESSION object, the old session is removed and replaced by the new session. if the session is actually identical β like, the SSL_SESSION object is identical β then SSL_CTX_add_session() is a no-op, and the return value is 0 π«Ά
if a server SSL_CTX is configured with the SSL_SESS_CACHE_NO_INTERNAL_STORE flag, then the internal cache will not be populated automatically by new sessions negotiated by the SSL/TLS implementation β even though the internal cache will be searched automatically for session-resume requests. the latter can be suppressed by SSL_SESS_CACHE_NO_INTERNAL_LOOKUP. so the application can use SSL_CTX_add_session() directly to have full control over the sessions that can be resumed if desired. main character energy, honestly π
π RETURN VALUES π
the following values are returned by all functions, periodt:
0β the operation failed. in case of the add operation, it tried to add the same (identical) session twice. in case of the remove operation, the session was not found in the cache π1β the operation succeeded β¨
π SEE ALSO π
β HISTORY β
SSL_CTX_add_session() and SSL_CTX_remove_session() first appeared in SSLeay 0.8.0 and have been available since OpenBSD 2.4 π§
this little page is serving Debian build energy, dated June 8, 2025 β bye bestie, slay your session cache πβ¨
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2001, 2002, 2014 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms