1SSL_CTX_sess_set_get_cb(3)          OpenSSL         SSL_CTX_sess_set_get_cb(3)
2
3
4

NAME

6       SSL_CTX_sess_set_new_cb, SSL_CTX_sess_set_remove_cb,
7       SSL_CTX_sess_set_get_cb, SSL_CTX_sess_get_new_cb,
8       SSL_CTX_sess_get_remove_cb, SSL_CTX_sess_get_get_cb - provide callback
9       functions for server side external session caching
10

SYNOPSIS

12        #include <openssl/ssl.h>
13
14        void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,
15                                     int (*new_session_cb)(SSL *, SSL_SESSION *));
16        void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx,
17                  void (*remove_session_cb)(SSL_CTX *ctx, SSL_SESSION *));
18        void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
19                  SSL_SESSION (*get_session_cb)(SSL *, unsigned char *, int, int *));
20
21        int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl, SSL_SESSION *sess);
22        void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx, SSL_SESSION *sess);
23        SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl, unsigned char *data, int len, int *copy);
24
25        int (*new_session_cb)(struct ssl_st *ssl, SSL_SESSION *sess);
26        void (*remove_session_cb)(struct ssl_ctx_st *ctx, SSL_SESSION *sess);
27        SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data,
28                      int len, int *copy);
29

DESCRIPTION

31       SSL_CTX_sess_set_new_cb() sets the callback function, which is
32       automatically called whenever a new session was negotiated.
33
34       SSL_CTX_sess_set_remove_cb() sets the callback function, which is
35       automatically called whenever a session is removed by the SSL engine,
36       because it is considered faulty or the session has become obsolete
37       because of exceeding the timeout value.
38
39       SSL_CTX_sess_set_get_cb() sets the callback function which is called,
40       whenever a SSL/TLS client proposed to resume a session but the session
41       could not be found in the internal session cache (see
42       SSL_CTX_set_session_cache_mode(3)).  (SSL/TLS server only.)
43
44       SSL_CTX_sess_get_new_cb(), SSL_CTX_sess_get_remove_cb(), and
45       SSL_CTX_sess_get_get_cb() allow to retrieve the function pointers of
46       the provided callback functions. If a callback function has not been
47       set, the NULL pointer is returned.
48

NOTES

50       In order to allow external session caching, synchronization with the
51       internal session cache is realized via callback functions. Inside these
52       callback functions, session can be saved to disk or put into a database
53       using the d2i_SSL_SESSION(3) interface.
54
55       The new_session_cb() is called, whenever a new session has been
56       negotiated and session caching is enabled (see
57       SSL_CTX_set_session_cache_mode(3)).  The new_session_cb() is passed the
58       ssl connection and the ssl session sess. If the callback returns 0, the
59       session will be immediately removed again.
60
61       The remove_session_cb() is called, whenever the SSL engine removes a
62       session from the internal cache. This happens when the session is
63       removed because it is expired or when a connection was not shutdown
64       cleanly. It also happens for all sessions in the internal session cache
65       when SSL_CTX_free(3) is called. The remove_session_cb() is passed the
66       ctx and the ssl session sess. It does not provide any feedback.
67
68       The get_session_cb() is only called on SSL/TLS servers with the session
69       id proposed by the client. The get_session_cb() is always called, also
70       when session caching was disabled. The get_session_cb() is passed the
71       ssl connection, the session id of length length at the memory location
72       data. With the parameter copy the callback can require the SSL engine
73       to increment the reference count of the SSL_SESSION object, Normally
74       the reference count is not incremented and therefore the session must
75       not be explicitly freed with SSL_SESSION_free(3).
76

SEE ALSO

78       ssl(3), d2i_SSL_SESSION(3), SSL_CTX_set_session_cache_mode(3),
79       SSL_CTX_flush_sessions(3), SSL_SESSION_free(3), SSL_CTX_free(3)
80
81
82
831.0.2k                            2017-01-26        SSL_CTX_sess_set_get_cb(3)
Impressum