summaryrefslogtreecommitdiff
path: root/src/lib/libssl/doc/SSL_CTX_sess_set_get_cb.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/doc/SSL_CTX_sess_set_get_cb.3')
-rw-r--r--src/lib/libssl/doc/SSL_CTX_sess_set_get_cb.3156
1 files changed, 156 insertions, 0 deletions
diff --git a/src/lib/libssl/doc/SSL_CTX_sess_set_get_cb.3 b/src/lib/libssl/doc/SSL_CTX_sess_set_get_cb.3
new file mode 100644
index 0000000000..d5c506cec8
--- /dev/null
+++ b/src/lib/libssl/doc/SSL_CTX_sess_set_get_cb.3
@@ -0,0 +1,156 @@
1.Dd $Mdocdate: October 12 2014 $
2.Dt SSL_CTX_SESS_SET_GET_CB 3
3.Os
4.Sh NAME
5.Nm SSL_CTX_sess_set_new_cb ,
6.Nm SSL_CTX_sess_set_remove_cb ,
7.Nm SSL_CTX_sess_set_get_cb ,
8.Nm SSL_CTX_sess_get_new_cb ,
9.Nm SSL_CTX_sess_get_remove_cb ,
10.Nm SSL_CTX_sess_get_get_cb
11.Nd provide callback functions for server side external session caching
12.Sh SYNOPSIS
13.In openssl/ssl.h
14.Ft void
15.Fo SSL_CTX_sess_set_new_cb
16.Fa "SSL_CTX *ctx"
17.Fa "int (*new_session_cb)(SSL *, SSL_SESSION *)"
18.Fc
19.Ft void
20.Fo SSL_CTX_sess_set_remove_cb
21.Fa "SSL_CTX *ctx"
22.Fa "void (*remove_session_cb)(SSL_CTX *ctx, SSL_SESSION *)"
23.Fc
24.Ft void
25.Fo SSL_CTX_sess_set_get_cb
26.Fa "SSL_CTX *ctx"
27.Fa "SSL_SESSION (*get_session_cb)(SSL *, unsigned char *, int, int *)"
28.Fc
29.Ft int
30.Fo "(*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))"
31.Fa "struct ssl_st *ssl"
32.Fa "SSL_SESSION *sess"
33.Fc
34.Ft void
35.Fo "(*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))"
36.Fa "struct ssl_ctx_st *ctx"
37.Fa "SSL_SESSION *sess"
38.Fc
39.Ft SSL_SESSION *
40.Fo "(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))"
41.Fa "struct ssl_st *ssl"
42.Fa "unsigned char *data"
43.Fa "int len"
44.Fa "int *copy"
45.Fc
46.Ft int
47.Fo "(*new_session_cb)"
48.Fa "struct ssl_st *ssl"
49.Fa "SSL_SESSION *sess"
50.Fc
51.Ft void
52.Fo "(*remove_session_cb)"
53.Fa "struct ssl_ctx_st *ctx"
54.Fa "SSL_SESSION *sess"
55.Fc
56.Ft SSL_SESSION *
57.Fo "(*get_session_cb)"
58.Fa "struct ssl_st *ssl"
59.Fa "unsigned char *data"
60.Fa "int len"
61.Fa "int *copy"
62.Fc
63.Sh DESCRIPTION
64.Fn SSL_CTX_sess_set_new_cb
65sets the callback function which is automatically called whenever a new session
66was negotiated.
67.Pp
68.Fn SSL_CTX_sess_set_remove_cb
69sets the callback function which is automatically called whenever a session is
70removed by the SSL engine (because it is considered faulty or the session has
71become obsolete because of exceeding the timeout value).
72.Pp
73.Fn SSL_CTX_sess_set_get_cb
74sets the callback function which is called whenever a SSL/TLS client proposes
75to resume a session but the session cannot be found in the internal session
76cache (see
77.Xr SSL_CTX_set_session_cache_mode 3 ) .
78(SSL/TLS server only.)
79.Pp
80.Fn SSL_CTX_sess_get_new_cb ,
81.Fn SSL_CTX_sess_get_remove_cb ,
82and
83.Fn SSL_CTX_sess_get_get_cb
84retrieve the function pointers of the provided callback functions.
85If a callback function has not been set, the
86.Dv NULL
87pointer is returned.
88.Sh NOTES
89In order to allow external session caching, synchronization with the internal
90session cache is realized via callback functions.
91Inside these callback functions, session can be saved to disk or put into a
92database using the
93.Xr d2i_SSL_SESSION 3
94interface.
95.Pp
96The
97.Fn new_session_cb
98function is called whenever a new session has been negotiated and session
99caching is enabled (see
100.Xr SSL_CTX_set_session_cache_mode 3 ) .
101The
102.Fn new_session_cb
103is passed the
104.Fa ssl
105connection and the ssl session
106.Fa sess .
107If the callback returns 0, the session will be immediately removed again.
108.Pp
109The
110.Fn remove_session_cb
111is called whenever the SSL engine removes a session from the internal cache.
112This happens when the session is removed because it is expired or when a
113connection was not shut down cleanly.
114It also happens for all sessions in the internal session cache when
115.Xr SSL_CTX_free 3
116is called.
117The
118.Fn remove_session_cb
119function is passed the
120.Fa ctx
121and the
122.Vt ssl
123session
124.Fa sess .
125It does not provide any feedback.
126.Pp
127The
128.Fn get_session_cb
129function is only called on SSL/TLS servers with the session id proposed by the
130client.
131The
132.Fn get_session_cb
133function is always called, also when session caching was disabled.
134The
135.Fn get_session_cb
136is passed the
137.Fa ssl
138connection, the session id of length
139.Fa length
140at the memory location
141.Fa data .
142With the parameter
143.Fa copy
144the callback can require the SSL engine to increment the reference count of the
145.Vt SSL_SESSION
146object,
147Normally the reference count is not incremented and therefore the session must
148not be explicitly freed with
149.Xr SSL_SESSION_free 3 .
150.Sh SEE ALSO
151.Xr d2i_SSL_SESSION 3 ,
152.Xr ssl 3 ,
153.Xr SSL_CTX_flush_sessions 3 ,
154.Xr SSL_CTX_free 3 ,
155.Xr SSL_CTX_set_session_cache_mode 3 ,
156.Xr SSL_SESSION_free 3