1SSL_get_session(3)                  OpenSSL                 SSL_get_session(3)
2
3
4

NAME

6       SSL_get_session - retrieve TLS/SSL session data
7

SYNOPSIS

9        #include <openssl/ssl.h>
10
11        SSL_SESSION *SSL_get_session(const SSL *ssl);
12        SSL_SESSION *SSL_get0_session(const SSL *ssl);
13        SSL_SESSION *SSL_get1_session(SSL *ssl);
14

DESCRIPTION

16       SSL_get_session() returns a pointer to the SSL_SESSION actually used in
17       ssl. The reference count of the SSL_SESSION is not incremented, so that
18       the pointer can become invalid by other operations.
19
20       SSL_get0_session() is the same as SSL_get_session().
21
22       SSL_get1_session() is the same as SSL_get_session(), but the reference
23       count of the SSL_SESSION is incremented by one.
24

NOTES

26       The ssl session contains all information required to re-establish the
27       connection without a new handshake.
28
29       SSL_get0_session() returns a pointer to the actual session. As the
30       reference counter is not incremented, the pointer is only valid while
31       the connection is in use. If SSL_clear(3) or SSL_free(3) is called, the
32       session may be removed completely (if considered bad), and the pointer
33       obtained will become invalid. Even if the session is valid, it can be
34       removed at any time due to timeout during SSL_CTX_flush_sessions(3).
35
36       If the data is to be kept, SSL_get1_session() will increment the
37       reference count, so that the session will not be implicitly removed by
38       other operations but stays in memory. In order to remove the session
39       SSL_SESSION_free(3) must be explicitly called once to decrement the
40       reference count again.
41
42       SSL_SESSION objects keep internal link information about the session
43       cache list, when being inserted into one SSL_CTX object's session
44       cache.  One SSL_SESSION object, regardless of its reference count, must
45       therefore only be used with one SSL_CTX object (and the SSL objects
46       created from this SSL_CTX object).
47

RETURN VALUES

49       The following return values can occur:
50
51       NULL
52           There is no session available in ssl.
53
54       Pointer to an SSL
55           The return value points to the data of an SSL session.
56

SEE ALSO

58       ssl(3), SSL_free(3), SSL_clear(3), SSL_SESSION_free(3)
59
60
61
621.0.2o                            2018-03-27                SSL_get_session(3)
Impressum