xref: /freebsd-src/crypto/openssl/doc/man3/SSL_CTX_add_session.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimSSL_CTX_add_session, SSL_CTX_remove_session - manipulate session cache
6e71b7053SJung-uk Kim
7e71b7053SJung-uk Kim=head1 SYNOPSIS
8e71b7053SJung-uk Kim
9e71b7053SJung-uk Kim #include <openssl/ssl.h>
10e71b7053SJung-uk Kim
11e71b7053SJung-uk Kim int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c);
12e71b7053SJung-uk Kim
13e71b7053SJung-uk Kim int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c);
14e71b7053SJung-uk Kim
15e71b7053SJung-uk Kim=head1 DESCRIPTION
16e71b7053SJung-uk Kim
17e71b7053SJung-uk KimSSL_CTX_add_session() adds the session B<c> to the context B<ctx>. The
18e71b7053SJung-uk Kimreference count for session B<c> is incremented by 1. If a session with
19e71b7053SJung-uk Kimthe same session id already exists, the old session is removed by calling
20e71b7053SJung-uk KimL<SSL_SESSION_free(3)>.
21e71b7053SJung-uk Kim
22e71b7053SJung-uk KimSSL_CTX_remove_session() removes the session B<c> from the context B<ctx> and
23e71b7053SJung-uk Kimmarks it as non-resumable. L<SSL_SESSION_free(3)> is called once for B<c>.
24e71b7053SJung-uk Kim
25e71b7053SJung-uk Kim=head1 NOTES
26e71b7053SJung-uk Kim
27e71b7053SJung-uk KimWhen adding a new session to the internal session cache, it is examined
28e71b7053SJung-uk Kimwhether a session with the same session id already exists. In this case
29e71b7053SJung-uk Kimit is assumed that both sessions are identical. If the same session is
30e71b7053SJung-uk Kimstored in a different SSL_SESSION object, The old session is
31e71b7053SJung-uk Kimremoved and replaced by the new session. If the session is actually
32e71b7053SJung-uk Kimidentical (the SSL_SESSION object is identical), SSL_CTX_add_session()
33e71b7053SJung-uk Kimis a no-op, and the return value is 0.
34e71b7053SJung-uk Kim
35e71b7053SJung-uk KimIf a server SSL_CTX is configured with the SSL_SESS_CACHE_NO_INTERNAL_STORE
36e71b7053SJung-uk Kimflag then the internal cache will not be populated automatically by new
37e71b7053SJung-uk Kimsessions negotiated by the SSL/TLS implementation, even though the internal
38e71b7053SJung-uk Kimcache will be searched automatically for session-resume requests (the
39e71b7053SJung-uk Kimlatter can be suppressed by SSL_SESS_CACHE_NO_INTERNAL_LOOKUP). So the
40e71b7053SJung-uk Kimapplication can use SSL_CTX_add_session() directly to have full control
41e71b7053SJung-uk Kimover the sessions that can be resumed if desired.
42e71b7053SJung-uk Kim
43e71b7053SJung-uk Kim
44e71b7053SJung-uk Kim=head1 RETURN VALUES
45e71b7053SJung-uk Kim
46e71b7053SJung-uk KimThe following values are returned by all functions:
47e71b7053SJung-uk Kim
48e71b7053SJung-uk Kim=over 4
49e71b7053SJung-uk Kim
50e71b7053SJung-uk Kim=item Z<>0
51e71b7053SJung-uk Kim
52e71b7053SJung-uk KimThe operation failed. In case of the add operation, it was tried to add
53e71b7053SJung-uk Kimthe same (identical) session twice. In case of the remove operation, the
54e71b7053SJung-uk Kimsession was not found in the cache.
55e71b7053SJung-uk Kim
56e71b7053SJung-uk Kim=item Z<>1
57e71b7053SJung-uk Kim
58e71b7053SJung-uk KimThe operation succeeded.
59e71b7053SJung-uk Kim
60e71b7053SJung-uk Kim=back
61e71b7053SJung-uk Kim
62e71b7053SJung-uk Kim=head1 SEE ALSO
63e71b7053SJung-uk Kim
64e71b7053SJung-uk KimL<ssl(7)>,
65e71b7053SJung-uk KimL<SSL_CTX_set_session_cache_mode(3)>,
66e71b7053SJung-uk KimL<SSL_SESSION_free(3)>
67e71b7053SJung-uk Kim
68e71b7053SJung-uk Kim=head1 COPYRIGHT
69e71b7053SJung-uk Kim
70e71b7053SJung-uk KimCopyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
71e71b7053SJung-uk Kim
72*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
73e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
74e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
75e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
76e71b7053SJung-uk Kim
77e71b7053SJung-uk Kim=cut
78