summaryrefslogtreecommitdiff
path: root/src/lib/libssl/doc/SSL_CTX_set_session_cache_mode.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/doc/SSL_CTX_set_session_cache_mode.3')
-rw-r--r--src/lib/libssl/doc/SSL_CTX_set_session_cache_mode.3140
1 files changed, 140 insertions, 0 deletions
diff --git a/src/lib/libssl/doc/SSL_CTX_set_session_cache_mode.3 b/src/lib/libssl/doc/SSL_CTX_set_session_cache_mode.3
new file mode 100644
index 0000000000..e7ebe2190e
--- /dev/null
+++ b/src/lib/libssl/doc/SSL_CTX_set_session_cache_mode.3
@@ -0,0 +1,140 @@
1.Dd $Mdocdate: October 12 2014 $
2.Dt SSL_CTX_SET_SESSION_CACHE_MODE 3
3.Os
4.Sh NAME
5.Nm SSL_CTX_set_session_cache_mode ,
6.Nm SSL_CTX_get_session_cache_mode
7.Nd enable/disable session caching
8.Sh SYNOPSIS
9.In openssl/ssl.h
10.Ft long
11.Fn SSL_CTX_set_session_cache_mode "SSL_CTX ctx" "long mode"
12.Ft long
13.Fn SSL_CTX_get_session_cache_mode "SSL_CTX ctx"
14.Sh DESCRIPTION
15.Fn SSL_CTX_set_session_cache_mode
16enables/disables session caching by setting the operational mode for
17.Ar ctx
18to
19.Ar mode .
20.Pp
21.Fn SSL_CTX_get_session_cache_mode
22returns the currently used cache mode.
23.Sh NOTES
24The OpenSSL library can store/retrieve SSL/TLS sessions for later reuse.
25The sessions can be held in memory for each
26.Fa ctx ,
27if more than one
28.Vt SSL_CTX
29object is being maintained, the sessions are unique for each
30.Vt SSL_CTX
31object.
32.Pp
33In order to reuse a session, a client must send the session's id to the server.
34It can only send exactly one id.
35The server then either agrees to reuse the session or it starts a full
36handshake (to create a new session).
37.Pp
38A server will lookup up the session in its internal session storage.
39If the session is not found in internal storage or lookups for the internal
40storage have been deactivated
41.Pq Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP ,
42the server will try the external storage if available.
43.Pp
44Since a client may try to reuse a session intended for use in a different
45context, the session id context must be set by the server (see
46.Xr SSL_CTX_set_session_id_context 3 ) .
47.Pp
48The following session cache modes and modifiers are available:
49.Bl -tag -width Ds
50.It Dv SSL_SESS_CACHE_OFF
51No session caching for client or server takes place.
52.It Dv SSL_SESS_CACHE_CLIENT
53Client sessions are added to the session cache.
54As there is no reliable way for the OpenSSL library to know whether a session
55should be reused or which session to choose (due to the abstract BIO layer the
56SSL engine does not have details about the connection),
57the application must select the session to be reused by using the
58.Xr SSL_set_session 3
59function.
60This option is not activated by default.
61.It Dv SSL_SESS_CACHE_SERVER
62Server sessions are added to the session cache.
63When a client proposes a session to be reused, the server looks for the
64corresponding session in (first) the internal session cache (unless
65.Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP
66is set), then (second) in the external cache if available.
67If the session is found, the server will try to reuse the session.
68This is the default.
69.It Dv SSL_SESS_CACHE_BOTH
70Enable both
71.Dv SSL_SESS_CACHE_CLIENT
72and
73.Dv SSL_SESS_CACHE_SERVER
74at the same time.
75.It Dv SSL_SESS_CACHE_NO_AUTO_CLEAR
76Normally the session cache is checked for expired sessions every 255
77connections using the
78.Xr SSL_CTX_flush_sessions 3
79function.
80Since this may lead to a delay which cannot be controlled,
81the automatic flushing may be disabled and
82.Xr SSL_CTX_flush_sessions 3
83can be called explicitly by the application.
84.It Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP
85By setting this flag, session-resume operations in an SSL/TLS server will not
86automatically look up sessions in the internal cache,
87even if sessions are automatically stored there.
88If external session caching callbacks are in use,
89this flag guarantees that all lookups are directed to the external cache.
90As automatic lookup only applies for SSL/TLS servers,
91the flag has no effect on clients.
92.It Dv SSL_SESS_CACHE_NO_INTERNAL_STORE
93Depending on the presence of
94.Dv SSL_SESS_CACHE_CLIENT
95and/or
96.Dv SSL_SESS_CACHE_SERVER,
97sessions negotiated in an SSL/TLS handshake may be cached for possible reuse.
98Normally a new session is added to the internal cache as well as any external
99session caching (callback) that is configured for the
100.Vt SSL_CTX .
101This flag will prevent sessions being stored in the internal cache
102(though the application can add them manually using
103.Xr SSL_CTX_add_session 3 ) .
104Note:
105in any SSL/TLS servers where external caching is configured, any successful
106session lookups in the external cache (e.g., for session-resume requests) would
107normally be copied into the local cache before processing continues \(en this
108flag prevents these additions to the internal cache as well.
109.It Dv SSL_SESS_CACHE_NO_INTERNAL
110Enable both
111.Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP
112and
113.Dv SSL_SESS_CACHE_NO_INTERNAL_STORE
114at the same time.
115.El
116.Pp
117The default mode is
118.Dv SSL_SESS_CACHE_SERVER .
119.Sh RETURN VALUES
120.Fn SSL_CTX_set_session_cache_mode
121returns the previously set cache mode.
122.Pp
123.Fn SSL_CTX_get_session_cache_mode
124returns the currently set cache mode.
125.Sh SEE ALSO
126.Xr ssl 3 ,
127.Xr SSL_CTX_add_session 3 ,
128.Xr SSL_CTX_flush_sessions 3 ,
129.Xr SSL_CTX_sess_number 3 ,
130.Xr SSL_CTX_sess_set_cache_size 3 ,
131.Xr SSL_CTX_sess_set_get_cb 3 ,
132.Xr SSL_CTX_set_session_id_context 3 ,
133.Xr SSL_CTX_set_timeout 3 ,
134.Xr SSL_session_reused 3 ,
135.Xr SSL_set_session 3
136.Sh HISTORY
137.Dv SSL_SESS_CACHE_NO_INTERNAL_STORE
138and
139.Dv SSL_SESS_CACHE_NO_INTERNAL
140were introduced in OpenSSL 0.9.6h.