import libssl (LibreSSL 2.5.4)
[unleashed.git] / lib / libssl / man / SSL_CTX_set_options.3
bloba066229402e96f4a2bcb650b28049a9d0dfc6fc3
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
3 .\"
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.
9 .\"
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
12 .\" are met:
13 .\"
14 .\" 1. Redistributions of source code must retain the above copyright
15 .\"    notice, this list of conditions and the following disclaimer.
16 .\"
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
20 .\"    distribution.
21 .\"
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/)"
26 .\"
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.
31 .\"
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.
35 .\"
36 .\" 6. Redistributions of any form whatsoever must retain the following
37 .\"    acknowledgment:
38 .\"    "This product includes software developed by the OpenSSL Project
39 .\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
40 .\"
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.
53 .\"
54 .Dd $Mdocdate: December 1 2016 $
55 .Dt SSL_CTX_SET_OPTIONS 3
56 .Os
57 .Sh NAME
58 .Nm SSL_CTX_set_options ,
59 .Nm SSL_set_options ,
60 .Nm SSL_CTX_clear_options ,
61 .Nm SSL_clear_options ,
62 .Nm SSL_CTX_get_options ,
63 .Nm SSL_get_options ,
64 .Nm SSL_get_secure_renegotiation_support
65 .Nd manipulate SSL options
66 .Sh SYNOPSIS
67 .In openssl/ssl.h
68 .Ft long
69 .Fn SSL_CTX_set_options "SSL_CTX *ctx" "long options"
70 .Ft long
71 .Fn SSL_set_options "SSL *ssl" "long options"
72 .Ft long
73 .Fn SSL_CTX_clear_options "SSL_CTX *ctx" "long options"
74 .Ft long
75 .Fn SSL_clear_options "SSL *ssl" "long options"
76 .Ft long
77 .Fn SSL_CTX_get_options "SSL_CTX *ctx"
78 .Ft long
79 .Fn SSL_get_options "SSL *ssl"
80 .Ft long
81 .Fn SSL_get_secure_renegotiation_support "SSL *ssl"
82 .Sh DESCRIPTION
83 .Fn SSL_CTX_set_options
84 adds the options set via bitmask in
85 .Fa options
87 .Fa ctx .
88 Options already set before are not cleared!
89 .Pp
90 .Fn SSL_set_options
91 adds the options set via bitmask in
92 .Fa options
94 .Fa ssl .
95 Options already set before are not cleared!
96 .Pp
97 .Fn SSL_CTX_clear_options
98 clears the options set via bitmask in
99 .Fa options
101 .Fa ctx .
103 .Fn SSL_clear_options
104 clears the options set via bitmask in
105 .Fa options
107 .Fa ssl .
109 .Fn SSL_CTX_get_options
110 returns the options set for
111 .Fa ctx .
113 .Fn SSL_get_options
114 returns the options set for
115 .Fa ssl .
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
124 operation (|).
126 .Fn SSL_CTX_set_options
128 .Fn SSL_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
133 .Xr SSL_set_mode 3
134 functions.
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
138 .Xr SSL_new 3 ,
139 the current option setting is copied.
140 Changes to
141 .Fa ctx
142 do not affect already created
143 .Vt SSL
144 objects.
145 .Fn SSL_clear
146 does not affect the settings.
148 The following
149 .Em bug workaround
150 options are available:
151 .Bl -tag -width Ds
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
155 implementations.
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.
161 .It Dv SSL_OP_ALL
162 All of the above bug workarounds.
165 It is usually safe to use
166 .Dv SSL_OP_ALL
167 to enable the bug workaround options if compatibility with somewhat broken
168 implementations is desired.
170 The following
171 .Em modifying
172 options are available:
173 .Bl -tag -width Ds
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
187 preferences.
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
208 .Em only :
209 this option is currently set by default.
210 See the
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
241 aware of.
242 In the description below an implementation supporting secure renegotiation is
243 referred to as
244 .Dq patched .
245 A server not supporting secure
246 renegotiation is referred to as
247 .Dq unpatched .
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
255 server with a
256 .Em no_renegotiation
257 warning alert.
259 If the patched OpenSSL server attempts to renegotiate a fatal
260 .Em handshake_failure
261 alert is sent.
262 This is because the server code may be unaware of the unpatched nature of the
263 client.
265 .Em N.B.:
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
268 .Em no_renegotiation
269 alert.
270 OpenSSL versions 0.9.8m and later will regard a
271 .Em no_renegotiation
272 alert as fatal and respond with a fatal
273 .Em handshake_failure
274 alert.
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
278 If the option
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
283 fail.
285 The option
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
295 will
296 .Em not
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
301 .Em set
302 .Dv SSL_OP_LEGACY_SERVER_CONNECT .
304 OpenSSL client applications that want to ensure they can
305 .Em not
306 connect to unpatched servers (and thus avoid any security issues) should always
307 .Em clear
308 .Dv SSL_OP_LEGACY_SERVER_CONNECT
309 using
310 .Fn SSL_CTX_clear_options
312 .Fn SSL_clear_options .
313 .Sh RETURN VALUES
314 .Fn SSL_CTX_set_options
316 .Fn SSL_set_options
317 return the new options bitmask after adding
318 .Fa options .
320 .Fn SSL_CTX_clear_options
322 .Fn SSL_clear_options
323 return the new options bitmask after clearing
324 .Fa options .
326 .Fn SSL_CTX_get_options
328 .Fn SSL_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.
333 .Sh SEE ALSO
334 .Xr openssl 1 ,
335 .Xr ssl 3 ,
336 .Xr SSL_clear 3 ,
337 .Xr SSL_new 3
338 .Sh HISTORY
339 .Fn SSL_CTX_clear_options
341 .Fn SSL_clear_options
342 were first added in OpenSSL 0.9.8m.