1 .\" $OpenBSD: SSL_CTX_set_options.3,v 1.2 2016/12/01 15:40:14 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: December 1 2016 $
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.
192 .It Dv SSL_OP_NO_TLSv1_1
193 Do not use the TLSv1.1 protocol.
194 .It Dv SSL_OP_NO_TLSv1_2
195 Do not use the TLSv1.2 protocol.
196 .It Dv SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
197 When performing renegotiation as a server, always start a new session (i.e.,
198 session resumption requests are only accepted in the initial handshake).
199 This option is not needed for clients.
200 .It Dv SSL_OP_NO_TICKET
201 Normally clients and servers will, where possible, transparently make use of
202 RFC4507bis tickets for stateless session resumption.
204 If this option is set this functionality is disabled and tickets will not be
205 used by clients or servers.
206 .It Dv SSL_OP_LEGACY_SERVER_CONNECT
207 Allow legacy insecure renegotiation between OpenSSL and unpatched servers
209 this option is currently set by default.
211 .Sx SECURE RENEGOTIATION
212 section for more details.
215 The following options used to be supported at some point in the past
216 and no longer have any effect:
217 .Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION ,
218 .Dv SSL_OP_EPHEMERAL_RSA ,
219 .Dv SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER ,
220 .Dv SSL_OP_MICROSOFT_SESS_ID_BUG ,
221 .Dv SSL_OP_NETSCAPE_CA_DN_BUG ,
222 .Dv SSL_OP_NETSCAPE_CHALLENGE_BUG ,
223 .Dv SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG ,
224 .Dv SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG ,
225 .Dv SSL_OP_NO_SSLv2 ,
226 .Dv SSL_OP_NO_SSLv3 ,
227 .Dv SSL_OP_PKCS1_CHECK_1 ,
228 .Dv SSL_OP_PKCS1_CHECK_2 ,
229 .Dv SSL_OP_SAFARI_ECDHE_ECDSA_BUG ,
230 .Dv SSL_OP_SINGLE_DH_USE ,
231 .Dv SSL_OP_SSLEAY_080_CLIENT_DH_BUG ,
232 .Dv SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG ,
233 .Dv SSL_OP_TLS_BLOCK_PADDING_BUG ,
234 .Dv SSL_OP_TLS_D5_BUG .
235 .Sh SECURE RENEGOTIATION
236 OpenSSL 0.9.8m and later always attempts to use secure renegotiation as
237 described in RFC5746.
238 This counters the prefix attack described in CVE-2009-3555 and elsewhere.
240 This attack has far-reaching consequences which application writers should be
242 In the description below an implementation supporting secure renegotiation is
245 A server not supporting secure
246 renegotiation is referred to as
249 The following sections describe the operations permitted by OpenSSL's secure
250 renegotiation implementation.
251 .Ss Patched client and server
252 Connections and renegotiation are always permitted by OpenSSL implementations.
253 .Ss Unpatched client and patched OpenSSL server
254 The initial connection succeeds but client renegotiation is denied by the
259 If the patched OpenSSL server attempts to renegotiate a fatal
260 .Em handshake_failure
262 This is because the server code may be unaware of the unpatched nature of the
266 a bug in OpenSSL clients earlier than 0.9.8m (all of which are unpatched) will
267 result in the connection hanging if it receives a
270 OpenSSL versions 0.9.8m and later will regard a
272 alert as fatal and respond with a fatal
273 .Em handshake_failure
275 This is because the OpenSSL API currently has no provision to indicate to an
276 application that a renegotiation attempt was refused.
277 .Ss Patched OpenSSL client and unpatched server
279 .Dv SSL_OP_LEGACY_SERVER_CONNECT
280 is set then initial connections and renegotiation between patched OpenSSL
281 clients and unpatched servers succeeds.
282 If neither option is set then initial connections to unpatched servers will
286 .Dv SSL_OP_LEGACY_SERVER_CONNECT
287 is currently set by default even though it has security implications:
288 otherwise it would be impossible to connect to unpatched servers (i.e., all of
289 them initially) and this is clearly not acceptable.
290 Renegotiation is permitted because this does not add any additional security
291 issues: during an attack clients do not see any renegotiations anyway.
293 As more servers become patched the option
294 .Dv SSL_OP_LEGACY_SERVER_CONNECT
297 be set by default in a future version of OpenSSL.
299 OpenSSL client applications wishing to ensure they can connect to unpatched
300 servers should always
302 .Dv SSL_OP_LEGACY_SERVER_CONNECT .
304 OpenSSL client applications that want to ensure they can
306 connect to unpatched servers (and thus avoid any security issues) should always
308 .Dv SSL_OP_LEGACY_SERVER_CONNECT
310 .Fn SSL_CTX_clear_options
312 .Fn SSL_clear_options .
314 .Fn SSL_CTX_set_options
317 return the new options bitmask after adding
320 .Fn SSL_CTX_clear_options
322 .Fn SSL_clear_options
323 return the new options bitmask after clearing
326 .Fn SSL_CTX_get_options
329 return the current bitmask.
331 .Fn SSL_get_secure_renegotiation_support
332 returns 1 is the peer supports secure renegotiation and 0 if it does not.
339 .Fn SSL_CTX_clear_options
341 .Fn SSL_clear_options
342 were first added in OpenSSL 0.9.8m.