1SSL_CTX_add_session(3) OpenSSL SSL_CTX_add_session(3)
2
3
4
6 SSL_CTX_add_session, SSL_add_session, SSL_CTX_remove_session,
7 SSL_remove_session - manipulate session cache
8
10 #include <openssl/ssl.h>
11
12 int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c);
13 int SSL_add_session(SSL_CTX *ctx, SSL_SESSION *c);
14
15 int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c);
16 int SSL_remove_session(SSL_CTX *ctx, SSL_SESSION *c);
17
19 SSL_CTX_add_session() adds the session c to the context ctx. The
20 reference count for session c is incremented by 1. If a session with
21 the same session id already exists, the old session is removed by
22 calling SSL_SESSION_free(3).
23
24 SSL_CTX_remove_session() removes the session c from the context ctx.
25 SSL_SESSION_free(3) is called once for c.
26
27 SSL_add_session() and SSL_remove_session() are synonyms for their
28 SSL_CTX_*() counterparts.
29
31 When adding a new session to the internal session cache, it is examined
32 whether a session with the same session id already exists. In this case
33 it is assumed that both sessions are identical. If the same session is
34 stored in a different SSL_SESSION object, The old session is removed
35 and replaced by the new session. If the session is actually identical
36 (the SSL_SESSION object is identical), SSL_CTX_add_session() is a no-
37 op, and the return value is 0.
38
39 If a server SSL_CTX is configured with the
40 SSL_SESS_CACHE_NO_INTERNAL_STORE flag then the internal cache will not
41 be populated automatically by new sessions negotiated by the SSL/TLS
42 implementation, even though the internal cache will be searched
43 automatically for session-resume requests (the latter can be suppressed
44 by SSL_SESS_CACHE_NO_INTERNAL_LOOKUP). So the application can use
45 SSL_CTX_add_session() directly to have full control over the sessions
46 that can be resumed if desired.
47
49 The following values are returned by all functions:
50
51 0
52 The operation failed. In case of the add operation, it was tried to add
53 the same (identical) session twice. In case of the remove operation, the
54 session was not found in the cache.
55
56 1
57 The operation succeeded.
58
60 ssl(3), SSL_CTX_set_session_cache_mode(3), SSL_SESSION_free(3)
61
62
63
641.0.2o 2019-09-10 SSL_CTX_add_session(3)