1 .\" $OpenBSD: SSL_CTX_set_options.3,v 1.4 2017/08/19 23:45:10 schwarze Exp $
2 .\" OpenSSL 361a1191 Dec 6 17:56:41 2015 +0100
4 .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org>,
5 .\" Bodo Moeller <bodo@openssl.org>, and
6 .\" Dr. Stephen Henson <steve@openssl.org>.
7 .\" Copyright (c) 2001-2003, 2005, 2007, 2009, 2010, 2013-2015
8 .\" The OpenSSL Project. All rights reserved.
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
14 .\" 1. Redistributions of source code must retain the above copyright
15 .\" notice, this list of conditions and the following disclaimer.
17 .\" 2. Redistributions in binary form must reproduce the above copyright
18 .\" notice, this list of conditions and the following disclaimer in
19 .\" the documentation and/or other materials provided with the
22 .\" 3. All advertising materials mentioning features or use of this
23 .\" software must display the following acknowledgment:
24 .\" "This product includes software developed by the OpenSSL Project
25 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
27 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
28 .\" endorse or promote products derived from this software without
29 .\" prior written permission. For written permission, please contact
30 .\" openssl-core@openssl.org.
32 .\" 5. Products derived from this software may not be called "OpenSSL"
33 .\" nor may "OpenSSL" appear in their names without prior written
34 .\" permission of the OpenSSL Project.
36 .\" 6. Redistributions of any form whatsoever must retain the following
38 .\" "This product includes software developed by the OpenSSL Project
39 .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
41 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
42 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
44 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
45 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
48 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
50 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
54 .Dd $Mdocdate: August 19 2017 $
55 .Dt SSL_CTX_SET_OPTIONS 3
58 .Nm SSL_CTX_set_options ,
60 .Nm SSL_CTX_clear_options ,
61 .Nm SSL_clear_options ,
62 .Nm SSL_CTX_get_options ,
64 .Nm SSL_get_secure_renegotiation_support
65 .Nd manipulate SSL options
69 .Fn SSL_CTX_set_options "SSL_CTX *ctx" "long options"
71 .Fn SSL_set_options "SSL *ssl" "long options"
73 .Fn SSL_CTX_clear_options "SSL_CTX *ctx" "long options"
75 .Fn SSL_clear_options "SSL *ssl" "long options"
77 .Fn SSL_CTX_get_options "SSL_CTX *ctx"
79 .Fn SSL_get_options "SSL *ssl"
81 .Fn SSL_get_secure_renegotiation_support "SSL *ssl"
83 .Fn SSL_CTX_set_options
84 adds the options set via bitmask in
88 Options already set before are not cleared!
91 adds the options set via bitmask in
95 Options already set before are not cleared!
97 .Fn SSL_CTX_clear_options
98 clears the options set via bitmask in
103 .Fn SSL_clear_options
104 clears the options set via bitmask in
109 .Fn SSL_CTX_get_options
110 returns the options set for
114 returns the options set for
117 .Fn SSL_get_secure_renegotiation_support
118 indicates whether the peer supports secure renegotiation.
120 All these functions are implemented using macros.
122 The behaviour of the SSL library can be changed by setting several options.
123 The options are coded as bitmasks and can be combined by a bitwise OR
126 .Fn SSL_CTX_set_options
129 affect the (external) protocol behaviour of the SSL library.
130 The (internal) behaviour of the API can be changed by using the similar
131 .Xr SSL_CTX_set_mode 3
136 During a handshake, the option settings of the SSL object are used.
137 When a new SSL object is created from a context using
139 the current option setting is copied.
142 do not affect already created
146 does not affect the settings.
150 options are available:
152 .It Dv SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
153 Disables a countermeasure against a TLS 1.0 protocol vulnerability
154 affecting CBC ciphers, which cannot be handled by some broken SSL
156 This option has no effect for connections using other ciphers.
157 .It Dv SSL_OP_TLSEXT_PADDING
158 Adds a padding extension to ensure the ClientHello size is never between 256
159 and 511 bytes in length.
160 This is needed as a workaround for some implementations.
162 All of the above bug workarounds.
165 It is usually safe to use
167 to enable the bug workaround options if compatibility with somewhat broken
168 implementations is desired.
172 options are available:
174 .It Dv SSL_OP_TLS_ROLLBACK_BUG
175 Disable version rollback attack detection.
177 During the client key exchange, the client must send the same information
178 about acceptable SSL/TLS protocol levels as during the first hello.
179 Some clients violate this rule by adapting to the server's answer.
180 (Example: the client sends a SSLv2 hello and accepts up to SSLv3.1=TLSv1,
181 the server only understands up to SSLv3.
182 In this case the client must still use the same SSLv3.1=TLSv1 announcement.
183 Some clients step down to SSLv3 with respect to the server's answer and violate
184 the version rollback protection.)
185 .It Dv SSL_OP_CIPHER_SERVER_PREFERENCE
186 When choosing a cipher, use the server's preferences instead of the client
188 When not set, the server will always follow the client's preferences.
189 When set, the server will choose following its own preferences.
190 .It Dv SSL_OP_NO_TLSv1
191 Do not use the TLSv1.0 protocol.
193 .Xr SSL_CTX_set_min_proto_version 3
195 .It Dv SSL_OP_NO_TLSv1_1
196 Do not use the TLSv1.1 protocol.
197 .It Dv SSL_OP_NO_TLSv1_2
198 Do not use the TLSv1.2 protocol.
200 .Xr SSL_CTX_set_max_proto_version 3
202 .It Dv SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
203 When performing renegotiation as a server, always start a new session (i.e.,
204 session resumption requests are only accepted in the initial handshake).
205 This option is not needed for clients.
206 .It Dv SSL_OP_NO_TICKET
207 Normally clients and servers will, where possible, transparently make use of
208 RFC4507bis tickets for stateless session resumption.
210 If this option is set this functionality is disabled and tickets will not be
211 used by clients or servers.
212 .It Dv SSL_OP_LEGACY_SERVER_CONNECT
213 Allow legacy insecure renegotiation between OpenSSL and unpatched servers
215 this option is currently set by default.
217 .Sx SECURE RENEGOTIATION
218 section for more details.
221 The following options used to be supported at some point in the past
222 and no longer have any effect:
223 .Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION ,
224 .Dv SSL_OP_EPHEMERAL_RSA ,
225 .Dv SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER ,
226 .Dv SSL_OP_MICROSOFT_SESS_ID_BUG ,
227 .Dv SSL_OP_NETSCAPE_CA_DN_BUG ,
228 .Dv SSL_OP_NETSCAPE_CHALLENGE_BUG ,
229 .Dv SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG ,
230 .Dv SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG ,
231 .Dv SSL_OP_NO_SSLv2 ,
232 .Dv SSL_OP_NO_SSLv3 ,
233 .Dv SSL_OP_PKCS1_CHECK_1 ,
234 .Dv SSL_OP_PKCS1_CHECK_2 ,
235 .Dv SSL_OP_SAFARI_ECDHE_ECDSA_BUG ,
236 .Dv SSL_OP_SINGLE_DH_USE ,
237 .Dv SSL_OP_SSLEAY_080_CLIENT_DH_BUG ,
238 .Dv SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG ,
239 .Dv SSL_OP_TLS_BLOCK_PADDING_BUG ,
240 .Dv SSL_OP_TLS_D5_BUG .
241 .Sh SECURE RENEGOTIATION
242 OpenSSL 0.9.8m and later always attempts to use secure renegotiation as
243 described in RFC5746.
244 This counters the prefix attack described in CVE-2009-3555 and elsewhere.
246 This attack has far-reaching consequences which application writers should be
248 In the description below an implementation supporting secure renegotiation is
251 A server not supporting secure
252 renegotiation is referred to as
255 The following sections describe the operations permitted by OpenSSL's secure
256 renegotiation implementation.
257 .Ss Patched client and server
258 Connections and renegotiation are always permitted by OpenSSL implementations.
259 .Ss Unpatched client and patched OpenSSL server
260 The initial connection succeeds but client renegotiation is denied by the
265 If the patched OpenSSL server attempts to renegotiate a fatal
266 .Em handshake_failure
268 This is because the server code may be unaware of the unpatched nature of the
272 a bug in OpenSSL clients earlier than 0.9.8m (all of which are unpatched) will
273 result in the connection hanging if it receives a
276 OpenSSL versions 0.9.8m and later will regard a
278 alert as fatal and respond with a fatal
279 .Em handshake_failure
281 This is because the OpenSSL API currently has no provision to indicate to an
282 application that a renegotiation attempt was refused.
283 .Ss Patched OpenSSL client and unpatched server
285 .Dv SSL_OP_LEGACY_SERVER_CONNECT
286 is set then initial connections and renegotiation between patched OpenSSL
287 clients and unpatched servers succeeds.
288 If neither option is set then initial connections to unpatched servers will
292 .Dv SSL_OP_LEGACY_SERVER_CONNECT
293 is currently set by default even though it has security implications:
294 otherwise it would be impossible to connect to unpatched servers (i.e., all of
295 them initially) and this is clearly not acceptable.
296 Renegotiation is permitted because this does not add any additional security
297 issues: during an attack clients do not see any renegotiations anyway.
299 As more servers become patched the option
300 .Dv SSL_OP_LEGACY_SERVER_CONNECT
303 be set by default in a future version of OpenSSL.
305 OpenSSL client applications wishing to ensure they can connect to unpatched
306 servers should always
308 .Dv SSL_OP_LEGACY_SERVER_CONNECT .
310 OpenSSL client applications that want to ensure they can
312 connect to unpatched servers (and thus avoid any security issues) should always
314 .Dv SSL_OP_LEGACY_SERVER_CONNECT
316 .Fn SSL_CTX_clear_options
318 .Fn SSL_clear_options .
320 .Fn SSL_CTX_set_options
323 return the new options bitmask after adding
326 .Fn SSL_CTX_clear_options
328 .Fn SSL_clear_options
329 return the new options bitmask after clearing
332 .Fn SSL_CTX_get_options
335 return the current bitmask.
337 .Fn SSL_get_secure_renegotiation_support
338 returns 1 is the peer supports secure renegotiation and 0 if it does not.
344 .Xr SSL_CTX_set_min_proto_version 3 ,
347 .Fn SSL_CTX_clear_options
349 .Fn SSL_clear_options
350 were first added in OpenSSL 0.9.8m.