1SSL_CTX_ADD_SESSION(3) OpenSSL SSL_CTX_ADD_SESSION(3)
2
3
4
6 SSL_CTX_add_session, SSL_CTX_remove_session - manipulate session cache
7
9 #include <openssl/ssl.h>
10
11 int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c);
12
13 int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c);
14
16 SSL_CTX_add_session() adds the session c to the context ctx. The
17 reference count for session c is incremented by 1. If a session with
18 the same session id already exists, the old session is removed by
19 calling SSL_SESSION_free(3).
20
21 SSL_CTX_remove_session() removes the session c from the context ctx and
22 marks it as non-resumable. SSL_SESSION_free(3) is called once for c.
23
25 When adding a new session to the internal session cache, it is examined
26 whether a session with the same session id already exists. In this case
27 it is assumed that both sessions are identical. If the same session is
28 stored in a different SSL_SESSION object, The old session is removed
29 and replaced by the new session. If the session is actually identical
30 (the SSL_SESSION object is identical), SSL_CTX_add_session() is a no-
31 op, and the return value is 0.
32
33 If a server SSL_CTX is configured with the
34 SSL_SESS_CACHE_NO_INTERNAL_STORE flag then the internal cache will not
35 be populated automatically by new sessions negotiated by the SSL/TLS
36 implementation, even though the internal cache will be searched
37 automatically for session-resume requests (the latter can be suppressed
38 by SSL_SESS_CACHE_NO_INTERNAL_LOOKUP). So the application can use
39 SSL_CTX_add_session() directly to have full control over the sessions
40 that can be resumed if desired.
41
43 The following values are returned by all functions:
44
45 0 The operation failed. In case of the add operation, it was tried to
46 add the same (identical) session twice. In case of the remove
47 operation, the session was not found in the cache.
48
49 1 The operation succeeded.
50
52 ssl(7), SSL_CTX_set_session_cache_mode(3), SSL_SESSION_free(3)
53
55 Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
56
57 Licensed under the OpenSSL license (the "License"). You may not use
58 this file except in compliance with the License. You can obtain a copy
59 in the file LICENSE in the source distribution or at
60 <https://www.openssl.org/source/license.html>.
61
62
63
641.1.1g 2020-04-23 SSL_CTX_ADD_SESSION(3)