]>
Commit | Line | Data |
---|---|---|
0bc6597d LJ |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
1722496f | 5 | SSL_CTX_add_session, SSL_CTX_remove_session - manipulate session cache |
0bc6597d LJ |
6 | |
7 | =head1 SYNOPSIS | |
8 | ||
9 | #include <openssl/ssl.h> | |
10 | ||
11 | int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c); | |
0bc6597d LJ |
12 | |
13 | int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c); | |
0bc6597d LJ |
14 | |
15 | =head1 DESCRIPTION | |
16 | ||
17 | SSL_CTX_add_session() adds the session B<c> to the context B<ctx>. The | |
18 | reference count for session B<c> is incremented by 1. If a session with | |
19 | the same session id already exists, the old session is removed by calling | |
9b86974e | 20 | L<SSL_SESSION_free(3)>. |
0bc6597d | 21 | |
b8964668 MC |
22 | SSL_CTX_remove_session() removes the session B<c> from the context B<ctx> and |
23 | marks it as non-resumable. L<SSL_SESSION_free(3)> is called once for B<c>. | |
0bc6597d | 24 | |
0bc6597d LJ |
25 | =head1 NOTES |
26 | ||
27 | When adding a new session to the internal session cache, it is examined | |
28 | whether a session with the same session id already exists. In this case | |
29 | it is assumed that both sessions are identical. If the same session is | |
30 | stored in a different SSL_SESSION object, The old session is | |
31 | removed and replaced by the new session. If the session is actually | |
32 | identical (the SSL_SESSION object is identical), SSL_CTX_add_session() | |
33 | is a no-op, and the return value is 0. | |
34 | ||
e0db2eed GT |
35 | If a server SSL_CTX is configured with the SSL_SESS_CACHE_NO_INTERNAL_STORE |
36 | flag then the internal cache will not be populated automatically by new | |
37 | sessions negotiated by the SSL/TLS implementation, even though the internal | |
38 | cache will be searched automatically for session-resume requests (the | |
fc1d88f0 | 39 | latter can be suppressed by SSL_SESS_CACHE_NO_INTERNAL_LOOKUP). So the |
e0db2eed GT |
40 | application can use SSL_CTX_add_session() directly to have full control |
41 | over the sessions that can be resumed if desired. | |
42 | ||
0bc6597d LJ |
43 | |
44 | =head1 RETURN VALUES | |
45 | ||
46 | The following values are returned by all functions: | |
47 | ||
48 | =over 4 | |
49 | ||
c8919dde | 50 | =item Z<>0 |
0bc6597d | 51 | |
32c57705 BB |
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. | |
0bc6597d | 55 | |
c8919dde | 56 | =item Z<>1 |
1bc74519 | 57 | |
32c57705 | 58 | The operation succeeded. |
0bc6597d LJ |
59 | |
60 | =back | |
61 | ||
62 | =head1 SEE ALSO | |
63 | ||
b97fdb57 | 64 | L<ssl(7)>, |
9b86974e RS |
65 | L<SSL_CTX_set_session_cache_mode(3)>, |
66 | L<SSL_SESSION_free(3)> | |
0bc6597d | 67 | |
e2f92610 RS |
68 | =head1 COPYRIGHT |
69 | ||
70 | Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved. | |
71 | ||
72 | Licensed under the OpenSSL license (the "License"). You may not use | |
73 | this file except in compliance with the License. You can obtain a copy | |
74 | in the file LICENSE in the source distribution or at | |
75 | L<https://www.openssl.org/source/license.html>. | |
76 | ||
77 | =cut |