summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libssl/man/SSL_CTX_set_generate_session_id.393
1 files changed, 58 insertions, 35 deletions
diff --git a/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3 b/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3
index 29ff6a123e..5166b90605 100644
--- a/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3
+++ b/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3
@@ -1,7 +1,54 @@
1.\" $OpenBSD: SSL_CTX_set_generate_session_id.3,v 1.2 2016/11/30 18:07:12 schwarze Exp $
2.\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100
1.\" 3.\"
2.\" $OpenBSD: SSL_CTX_set_generate_session_id.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ 4.\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>.
5.\" Copyright (c) 2001, 2014 The OpenSSL Project. All rights reserved.
3.\" 6.\"
4.Dd $Mdocdate: November 5 2016 $ 7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: November 30 2016 $
5.Dt SSL_CTX_SET_GENERATE_SESSION_ID 3 52.Dt SSL_CTX_SET_GENERATE_SESSION_ID 3
6.Os 53.Os
7.Sh NAME 54.Sh NAME
@@ -11,10 +58,12 @@
11.Nd manipulate generation of SSL session IDs (server only) 58.Nd manipulate generation of SSL session IDs (server only)
12.Sh SYNOPSIS 59.Sh SYNOPSIS
13.In openssl/ssl.h 60.In openssl/ssl.h
14.Bd -literal 61.Ft typedef int
15 typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id, 62.Fo (*GEN_SESSION_CB)
16 unsigned int *id_len); 63.Fa "const SSL *ssl"
17.Ed 64.Fa "unsigned char *id"
65.Fa "unsigned int *id_len"
66.Fc
18.Ft int 67.Ft int
19.Fn SSL_CTX_set_generate_session_id "SSL_CTX *ctx" "GEN_SESSION_CB cb" 68.Fn SSL_CTX_set_generate_session_id "SSL_CTX *ctx" "GEN_SESSION_CB cb"
20.Ft int 69.Ft int
@@ -46,12 +95,11 @@ checks, whether a session with id
46is already contained in the internal session cache 95is already contained in the internal session cache
47of the parent context of 96of the parent context of
48.Fa ssl . 97.Fa ssl .
49.Sh NOTES 98.Pp
50When a new session is established between client and server, 99When a new session is established between client and server,
51the server generates a session id. 100the server generates a session id.
52The session id is an arbitrary sequence of bytes. 101The session id is an arbitrary sequence of bytes.
53The length of the session id is 16 bytes for SSLv2 sessions and between 1 and 102The length of the session id is between 1 and 32 bytes.
5432 bytes for SSLv3/TLSv1.
55The session id is not security critical but must be unique for the server. 103The session id is not security critical but must be unique for the server.
56Additionally, the session id is transmitted in the clear when reusing the 104Additionally, the session id is transmitted in the clear when reusing the
57session so it must not contain sensitive information. 105session so it must not contain sensitive information.
@@ -80,17 +128,6 @@ or write to the location
80.Fa id 128.Fa id
81exceeding the given limit. 129exceeding the given limit.
82.Pp 130.Pp
83If a SSLv2 session id is generated and
84.Fa id_len
85is reduced, it will be restored after the callback has finished and the session
86id will be padded with 0x00.
87It is not recommended to change the
88.Fa id_len
89for SSLv2 sessions.
90The callback can use the
91.Xr SSL_get_version 3
92function to check whether the session is of type SSLv2.
93.Pp
94The location 131The location
95.Fa id 132.Fa id
96is filled with 0x00 before the callback is called, 133is filled with 0x00 before the callback is called,
@@ -101,7 +138,7 @@ untouched while maintaining reproducibility.
101Since the sessions must be distinguished, session ids must be unique. 138Since the sessions must be distinguished, session ids must be unique.
102Without the callback a random number is used, 139Without the callback a random number is used,
103so that the probability of generating the same session id is extremely small 140so that the probability of generating the same session id is extremely small
104(2^128 possible ids for an SSLv2 session, 2^256 for SSLv3/TLSv1). 141(2^256 for TLSv1).
105In order to ensure the uniqueness of the generated session id, 142In order to ensure the uniqueness of the generated session id,
106the callback must call 143the callback must call
107.Fn SSL_has_matching_session_id 144.Fn SSL_has_matching_session_id
@@ -128,13 +165,6 @@ since the external cache is not tested with
128.Fn SSL_has_matching_session_id 165.Fn SSL_has_matching_session_id
129and the same race condition applies. 166and the same race condition applies.
130.Pp 167.Pp
131When calling
132.Fn SSL_has_matching_session_id
133for an SSLv2 session with reduced
134.Fa id_len Ns ,
135the match operation will be performed using the fixed length required and with
136a 0x00 padded id.
137.Pp
138The callback must return 0 if it cannot generate a session id for whatever 168The callback must return 0 if it cannot generate a session id for whatever
139reason and return 1 on success. 169reason and return 1 on success.
140.Sh RETURN VALUES 170.Sh RETURN VALUES
@@ -157,13 +187,6 @@ generate_session_id(const SSL *ssl, unsigned char *id,
157 unsigned int *id_len) 187 unsigned int *id_len)
158{ 188{
159 unsigned int count = 0; 189 unsigned int count = 0;
160 const char *version;
161
162 version = SSL_get_version(ssl);
163 if (!strcmp(version, "SSLv2")) {
164 /* we must not change id_len */
165 ;
166 }
167 190
168 do { 191 do {
169 RAND_pseudo_bytes(id, *id_len); 192 RAND_pseudo_bytes(id, *id_len);