1 .\" $OpenBSD: SSL_get_session.3,v 1.3 2017/04/10 15:37:55 schwarze Exp $
2 .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
4 .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
5 .\" Copyright (c) 2000, 2001, 2005, 2013, 2016 The OpenSSL Project.
6 .\" All rights reserved.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice, this list of conditions and the following disclaimer in
17 .\" the documentation and/or other materials provided with the
20 .\" 3. All advertising materials mentioning features or use of this
21 .\" software must display the following acknowledgment:
22 .\" "This product includes software developed by the OpenSSL Project
23 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
25 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 .\" endorse or promote products derived from this software without
27 .\" prior written permission. For written permission, please contact
28 .\" openssl-core@openssl.org.
30 .\" 5. Products derived from this software may not be called "OpenSSL"
31 .\" nor may "OpenSSL" appear in their names without prior written
32 .\" permission of the OpenSSL Project.
34 .\" 6. Redistributions of any form whatsoever must retain the following
36 .\" "This product includes software developed by the OpenSSL Project
37 .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
39 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
52 .Dd $Mdocdate: April 10 2017 $
57 .Nm SSL_get0_session ,
59 .Nd retrieve TLS/SSL session data
63 .Fn SSL_get_session "const SSL *ssl"
65 .Fn SSL_get0_session "const SSL *ssl"
67 .Fn SSL_get1_session "SSL *ssl"
70 returns a pointer to the
74 The reference count of the
76 is not incremented, so that the pointer can become invalid by other operations.
85 but the reference count of the
87 is incremented by one.
91 session contains all information required to re-establish the connection
92 without a new handshake.
95 returns a pointer to the actual session.
96 As the reference counter is not incremented,
97 the pointer is only valid while the connection is in use.
102 is called, the session may be removed completely (if considered bad),
103 and the pointer obtained will become invalid.
104 Even if the session is valid,
105 it can be removed at any time due to timeout during
106 .Xr SSL_CTX_flush_sessions 3 .
108 If the data is to be kept,
110 will increment the reference count, so that the session will not be implicitly
111 removed by other operations but stays in memory.
112 In order to remove the session
113 .Xr SSL_SESSION_free 3
114 must be explicitly called once to decrement the reference count again.
117 objects keep internal link information about the session cache list when being
120 object's session cache.
123 object, regardless of its reference count, must therefore only be used with one
127 objects created from this
131 The following return values can occur:
134 There is no session available in
136 .It Pointer to an Vt SSL_SESSION
137 The return value points to the data of an
145 .Xr SSL_SESSION_free 3 ,
146 .Xr SSL_SESSION_get0_peer 3 ,
147 .Xr SSL_SESSION_get_compress_id 3 ,
148 .Xr SSL_SESSION_get_id 3 ,
149 .Xr SSL_SESSION_get_time 3 ,
150 .Xr SSL_SESSION_new 3 ,
151 .Xr SSL_SESSION_print 3