import libssl (LibreSSL 2.5.4)
[unleashed.git] / lib / libssl / man / SSL_CTX_add_session.3
blob44c3085a3f9917263acbb22b68e6294b07143e44
1 .\"     $OpenBSD: SSL_CTX_add_session.3,v 1.2 2016/11/30 13:21:23 schwarze Exp $
2 .\"     OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
3 .\"
4 .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and
5 .\" Geoff Thorpe <geoff@openssl.org>.
6 .\" Copyright (c) 2001, 2002, 2014 The OpenSSL Project.  All rights reserved.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\"
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\"    notice, this list of conditions and the following disclaimer.
14 .\"
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
18 .\"    distribution.
19 .\"
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/)"
24 .\"
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.
29 .\"
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.
33 .\"
34 .\" 6. Redistributions of any form whatsoever must retain the following
35 .\"    acknowledgment:
36 .\"    "This product includes software developed by the OpenSSL Project
37 .\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38 .\"
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.
51 .\"
52 .Dd $Mdocdate: November 30 2016 $
53 .Dt SSL_CTX_ADD_SESSION 3
54 .Os
55 .Sh NAME
56 .Nm SSL_CTX_add_session ,
57 .Nm SSL_add_session ,
58 .Nm SSL_CTX_remove_session ,
59 .Nm SSL_remove_session
60 .Nd manipulate session cache
61 .Sh SYNOPSIS
62 .In openssl/ssl.h
63 .Ft int
64 .Fn SSL_CTX_add_session "SSL_CTX *ctx" "SSL_SESSION *c"
65 .Ft int
66 .Fn SSL_add_session "SSL_CTX *ctx" "SSL_SESSION *c"
67 .Ft int
68 .Fn SSL_CTX_remove_session "SSL_CTX *ctx" "SSL_SESSION *c"
69 .Ft int
70 .Fn SSL_remove_session "SSL_CTX *ctx" "SSL_SESSION *c"
71 .Sh DESCRIPTION
72 .Fn SSL_CTX_add_session
73 adds the session
74 .Fa c
75 to the context
76 .Fa ctx .
77 The reference count for session
78 .Fa c
79 is incremented by 1.
80 If a session with the same session id already exists,
81 the old session is removed by calling
82 .Xr SSL_SESSION_free 3 .
83 .Pp
84 .Fn SSL_CTX_remove_session
85 removes the session
86 .Fa c
87 from the context
88 .Fa ctx .
89 .Xr SSL_SESSION_free 3
90 is called once for
91 .Fa c .
92 .Pp
93 .Fn SSL_add_session
94 and
95 .Fn SSL_remove_session
96 are synonyms for their
97 .Fn SSL_CTX_*
98 counterparts.
99 .Sh NOTES
100 When adding a new session to the internal session cache, it is examined
101 whether a session with the same session id already exists.
102 In this case it is assumed that both sessions are identical.
103 If the same session is stored in a different
104 .Vt SSL_SESSION
105 object, the old session is removed and replaced by the new session.
106 If the session is actually identical (the
107 .Vt SSL_SESSION
108 object is identical),
109 .Fn SSL_CTX_add_session
110 is a no-op, and the return value is 0.
112 If a server
113 .Vt SSL_CTX
114 is configured with the
115 .Dv SSL_SESS_CACHE_NO_INTERNAL_STORE
116 flag then the internal cache will not be populated automatically by new
117 sessions negotiated by the SSL/TLS implementation, even though the internal
118 cache will be searched automatically for session-resume requests (the
119 latter can be suppressed by
120 .Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP ) .
121 So the application can use
122 .Fn SSL_CTX_add_session
123 directly to have full control over the sessions that can be resumed if desired.
124 .Sh RETURN VALUES
125 The following values are returned by all functions:
126 .Bl -tag -width Ds
127 .It 0
128 The operation failed.
129 In case of the add operation, it was tried to add the same (identical) session
130 twice.
131 In case of the remove operation, the session was not found in the cache.
132 .It 1
133 The operation succeeded.
135 .Sh SEE ALSO
136 .Xr ssl 3 ,
137 .Xr SSL_CTX_set_session_cache_mode 3 ,
138 .Xr SSL_SESSION_free 3