xref: /onnv-gate/usr/src/common/openssl/doc/ssl/SSL_CTX_add_session.pod (revision 2175:b0b2f052a486)
1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948SSL_CTX_add_session, SSL_add_session, SSL_CTX_remove_session, SSL_remove_session - manipulate session cache
6*2175Sjp161948
7*2175Sjp161948=head1 SYNOPSIS
8*2175Sjp161948
9*2175Sjp161948 #include <openssl/ssl.h>
10*2175Sjp161948
11*2175Sjp161948 int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c);
12*2175Sjp161948 int SSL_add_session(SSL_CTX *ctx, SSL_SESSION *c);
13*2175Sjp161948
14*2175Sjp161948 int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c);
15*2175Sjp161948 int SSL_remove_session(SSL_CTX *ctx, SSL_SESSION *c);
16*2175Sjp161948
17*2175Sjp161948=head1 DESCRIPTION
18*2175Sjp161948
19*2175Sjp161948SSL_CTX_add_session() adds the session B<c> to the context B<ctx>. The
20*2175Sjp161948reference count for session B<c> is incremented by 1. If a session with
21*2175Sjp161948the same session id already exists, the old session is removed by calling
22*2175Sjp161948L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>.
23*2175Sjp161948
24*2175Sjp161948SSL_CTX_remove_session() removes the session B<c> from the context B<ctx>.
25*2175Sjp161948L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> is called once for B<c>.
26*2175Sjp161948
27*2175Sjp161948SSL_add_session() and SSL_remove_session() are synonyms for their
28*2175Sjp161948SSL_CTX_*() counterparts.
29*2175Sjp161948
30*2175Sjp161948=head1 NOTES
31*2175Sjp161948
32*2175Sjp161948When adding a new session to the internal session cache, it is examined
33*2175Sjp161948whether a session with the same session id already exists. In this case
34*2175Sjp161948it is assumed that both sessions are identical. If the same session is
35*2175Sjp161948stored in a different SSL_SESSION object, The old session is
36*2175Sjp161948removed and replaced by the new session. If the session is actually
37*2175Sjp161948identical (the SSL_SESSION object is identical), SSL_CTX_add_session()
38*2175Sjp161948is a no-op, and the return value is 0.
39*2175Sjp161948
40*2175Sjp161948If a server SSL_CTX is configured with the SSL_SESS_CACHE_NO_INTERNAL_STORE
41*2175Sjp161948flag then the internal cache will not be populated automatically by new
42*2175Sjp161948sessions negotiated by the SSL/TLS implementation, even though the internal
43*2175Sjp161948cache will be searched automatically for session-resume requests (the
44*2175Sjp161948latter can be surpressed by SSL_SESS_CACHE_NO_INTERNAL_LOOKUP). So the
45*2175Sjp161948application can use SSL_CTX_add_session() directly to have full control
46*2175Sjp161948over the sessions that can be resumed if desired.
47*2175Sjp161948
48*2175Sjp161948
49*2175Sjp161948=head1 RETURN VALUES
50*2175Sjp161948
51*2175Sjp161948The following values are returned by all functions:
52*2175Sjp161948
53*2175Sjp161948=over 4
54*2175Sjp161948
55*2175Sjp161948=item 0
56*2175Sjp161948
57*2175Sjp161948 The operation failed. In case of the add operation, it was tried to add
58*2175Sjp161948 the same (identical) session twice. In case of the remove operation, the
59*2175Sjp161948 session was not found in the cache.
60*2175Sjp161948
61*2175Sjp161948=item 1
62*2175Sjp161948
63*2175Sjp161948 The operation succeeded.
64*2175Sjp161948
65*2175Sjp161948=back
66*2175Sjp161948
67*2175Sjp161948=head1 SEE ALSO
68*2175Sjp161948
69*2175Sjp161948L<ssl(3)|ssl(3)>,
70*2175Sjp161948L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>,
71*2175Sjp161948L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>
72*2175Sjp161948
73*2175Sjp161948=cut
74