1 .\" $NetBSD: SSL_CTX_set_options.3,v 1.14 2015/06/12 17:01:14 christos Exp $
3 .\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
6 .\" ========================================================================
7 .de Sp \" Vertical space (when we can't use .PP)
11 .de Vb \" Begin verbatim text
16 .de Ve \" End verbatim text
20 .\" Set up some character translations and predefined strings. \*(-- will
21 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
22 .\" double quote, and \*(R" will give a right double quote. \*(C+ will
23 .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
24 .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
25 .\" nothing in troff, for use with C<>.
27 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
31 . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
32 . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
47 .\" Escape single quotes in literal strings from groff's Unicode transform.
51 .\" If the F register is turned on, we'll generate index entries on stderr for
52 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
53 .\" entries marked with X<> in POD. Of course, you'll have to process the
54 .\" output yourself in some meaningful fashion.
56 .\" Avoid warning from groff about undefined register 'F'.
60 .if \n(.g .if rF .nr rF 1
61 .if (\n(rF:(\n(.g==0)) \{
64 . tm Index:\\$1\t\\n%\t"\\$2"
74 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
75 .\" Fear. Run. Save yourself. No user-serviceable parts.
76 . \" fudge factors for nroff and troff
85 . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
91 . \" simple accents for nroff and troff
101 . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
102 . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
103 . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
104 . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
105 . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
106 . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
108 . \" troff and (daisy-wheel) nroff accents
109 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
110 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
111 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
112 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
113 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
114 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
115 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
116 .ds ae a\h'-(\w'a'u*4/10)'e
117 .ds Ae A\h'-(\w'A'u*4/10)'E
118 . \" corrections for vroff
119 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
120 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
121 . \" for low resolution devices (crt and lpr)
122 .if \n(.H>23 .if \n(.V>19 \
135 .\" ========================================================================
137 .IX Title "SSL_CTX_set_options 3"
138 .TH SSL_CTX_set_options 3 "2015-01-13" "1.0.1n" "OpenSSL"
139 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
140 .\" way too many mistakes in technical documents.
144 SSL_CTX_set_options, SSL_set_options, SSL_CTX_clear_options, SSL_clear_options, SSL_CTX_get_options, SSL_get_options, SSL_get_secure_renegotiation_support \- manipulate SSL options
148 .IX Header "SYNOPSIS"
150 \& #include <openssl/ssl.h>
152 \& long SSL_CTX_set_options(SSL_CTX *ctx, long options);
153 \& long SSL_set_options(SSL *ssl, long options);
155 \& long SSL_CTX_clear_options(SSL_CTX *ctx, long options);
156 \& long SSL_clear_options(SSL *ssl, long options);
158 \& long SSL_CTX_get_options(SSL_CTX *ctx);
159 \& long SSL_get_options(SSL *ssl);
161 \& long SSL_get_secure_renegotiation_support(SSL *ssl);
164 .IX Header "DESCRIPTION"
165 Note: all these functions are implemented using macros.
167 \&\fISSL_CTX_set_options()\fR adds the options set via bitmask in \fBoptions\fR to \fBctx\fR.
168 Options already set before are not cleared!
170 \&\fISSL_set_options()\fR adds the options set via bitmask in \fBoptions\fR to \fBssl\fR.
171 Options already set before are not cleared!
173 \&\fISSL_CTX_clear_options()\fR clears the options set via bitmask in \fBoptions\fR
176 \&\fISSL_clear_options()\fR clears the options set via bitmask in \fBoptions\fR to \fBssl\fR.
178 \&\fISSL_CTX_get_options()\fR returns the options set for \fBctx\fR.
180 \&\fISSL_get_options()\fR returns the options set for \fBssl\fR.
182 \&\fISSL_get_secure_renegotiation_support()\fR indicates whether the peer supports
183 secure renegotiation.
186 The behaviour of the \s-1SSL\s0 library can be changed by setting several options.
187 The options are coded as bitmasks and can be combined by a logical \fBor\fR
190 \&\fISSL_CTX_set_options()\fR and \fISSL_set_options()\fR affect the (external)
191 protocol behaviour of the \s-1SSL\s0 library. The (internal) behaviour of
192 the \s-1API\s0 can be changed by using the similar
193 \&\fISSL_CTX_set_mode\fR\|(3) and \fISSL_set_mode()\fR functions.
195 During a handshake, the option settings of the \s-1SSL\s0 object are used. When
196 a new \s-1SSL\s0 object is created from a context using \fISSL_new()\fR, the current
197 option setting is copied. Changes to \fBctx\fR do not affect already created
198 \&\s-1SSL\s0 objects. \fISSL_clear()\fR does not affect the settings.
200 The following \fBbug workaround\fR options are available:
201 .IP "\s-1SSL_OP_MICROSOFT_SESS_ID_BUG\s0" 4
202 .IX Item "SSL_OP_MICROSOFT_SESS_ID_BUG"
203 www.microsoft.com \- when talking SSLv2, if session-id reuse is
204 performed, the session-id passed back in the server-finished message
205 is different from the one decided upon.
206 .IP "\s-1SSL_OP_NETSCAPE_CHALLENGE_BUG\s0" 4
207 .IX Item "SSL_OP_NETSCAPE_CHALLENGE_BUG"
208 Netscape\-Commerce/1.12, when talking SSLv2, accepts a 32 byte
209 challenge but then appears to only use 16 bytes when generating the
210 encryption keys. Using 16 bytes is ok but it should be ok to use 32.
211 According to the SSLv3 spec, one should use 32 bytes for the challenge
212 when operating in SSLv2/v3 compatibility mode, but as mentioned above,
213 this breaks this server so 16 bytes is the way to go.
214 .IP "\s-1SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG\s0" 4
215 .IX Item "SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG"
216 As of OpenSSL 0.9.8q and 1.0.0c, this option has no effect.
217 .IP "\s-1SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG\s0" 4
218 .IX Item "SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG"
220 .IP "\s-1SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER\s0" 4
221 .IX Item "SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER"
223 .IP "\s-1SSL_OP_SAFARI_ECDHE_ECDSA_BUG\s0" 4
224 .IX Item "SSL_OP_SAFARI_ECDHE_ECDSA_BUG"
225 Don't prefer ECDHE-ECDSA ciphers when the client appears to be Safari on \s-1OS X.
226 OS X 10.8..10.8.3\s0 has broken support for ECDHE-ECDSA ciphers.
227 .IP "\s-1SSL_OP_SSLEAY_080_CLIENT_DH_BUG\s0" 4
228 .IX Item "SSL_OP_SSLEAY_080_CLIENT_DH_BUG"
230 .IP "\s-1SSL_OP_TLS_D5_BUG\s0" 4
231 .IX Item "SSL_OP_TLS_D5_BUG"
233 .IP "\s-1SSL_OP_TLS_BLOCK_PADDING_BUG\s0" 4
234 .IX Item "SSL_OP_TLS_BLOCK_PADDING_BUG"
236 .IP "\s-1SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS\s0" 4
237 .IX Item "SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS"
238 Disables a countermeasure against a \s-1SSL 3.0/TLS 1.0\s0 protocol
239 vulnerability affecting \s-1CBC\s0 ciphers, which cannot be handled by some
240 broken \s-1SSL\s0 implementations. This option has no effect for connections
242 .IP "\s-1SSL_OP_TLSEXT_PADDING\s0" 4
243 .IX Item "SSL_OP_TLSEXT_PADDING"
244 Adds a padding extension to ensure the ClientHello size is never between
245 256 and 511 bytes in length. This is needed as a workaround for some
247 .IP "\s-1SSL_OP_ALL\s0" 4
248 .IX Item "SSL_OP_ALL"
249 All of the above bug workarounds.
251 It is usually safe to use \fB\s-1SSL_OP_ALL\s0\fR to enable the bug workaround
252 options if compatibility with somewhat broken implementations is
255 The following \fBmodifying\fR options are available:
256 .IP "\s-1SSL_OP_TLS_ROLLBACK_BUG\s0" 4
257 .IX Item "SSL_OP_TLS_ROLLBACK_BUG"
258 Disable version rollback attack detection.
260 During the client key exchange, the client must send the same information
261 about acceptable \s-1SSL/TLS\s0 protocol levels as during the first hello. Some
262 clients violate this rule by adapting to the server's answer. (Example:
263 the client sends a SSLv2 hello and accepts up to SSLv3.1=TLSv1, the server
264 only understands up to SSLv3. In this case the client must still use the
265 same SSLv3.1=TLSv1 announcement. Some clients step down to SSLv3 with respect
266 to the server's answer and violate the version rollback protection.)
267 .IP "\s-1SSL_OP_SINGLE_DH_USE\s0" 4
268 .IX Item "SSL_OP_SINGLE_DH_USE"
269 Always create a new key when using temporary/ephemeral \s-1DH\s0 parameters
270 (see \fISSL_CTX_set_tmp_dh_callback\fR\|(3)).
271 This option must be used to prevent small subgroup attacks, when
272 the \s-1DH\s0 parameters were not generated using \*(L"strong\*(R" primes
273 (e.g. when using DSA-parameters, see \fIopenssl_dhparam\fR\|(1)).
274 If \*(L"strong\*(R" primes were used, it is not strictly necessary to generate
275 a new \s-1DH\s0 key during each handshake but it is also recommended.
276 \&\fB\s-1SSL_OP_SINGLE_DH_USE\s0\fR should therefore be enabled whenever
277 temporary/ephemeral \s-1DH\s0 parameters are used.
278 .IP "\s-1SSL_OP_EPHEMERAL_RSA\s0" 4
279 .IX Item "SSL_OP_EPHEMERAL_RSA"
280 This option is no longer implemented and is treated as no op.
281 .IP "\s-1SSL_OP_CIPHER_SERVER_PREFERENCE\s0" 4
282 .IX Item "SSL_OP_CIPHER_SERVER_PREFERENCE"
283 When choosing a cipher, use the server's preferences instead of the client
284 preferences. When not set, the \s-1SSL\s0 server will always follow the clients
285 preferences. When set, the SSLv3/TLSv1 server will choose following its
286 own preferences. Because of the different protocol, for SSLv2 the server
287 will send its list of preferences to the client and the client chooses.
288 .IP "\s-1SSL_OP_PKCS1_CHECK_1\s0" 4
289 .IX Item "SSL_OP_PKCS1_CHECK_1"
291 .IP "\s-1SSL_OP_PKCS1_CHECK_2\s0" 4
292 .IX Item "SSL_OP_PKCS1_CHECK_2"
294 .IP "\s-1SSL_OP_NETSCAPE_CA_DN_BUG\s0" 4
295 .IX Item "SSL_OP_NETSCAPE_CA_DN_BUG"
296 If we accept a netscape connection, demand a client cert, have a
297 non-self-signed \s-1CA\s0 which does not have its \s-1CA\s0 in netscape, and the
298 browser has a cert, it will crash/hang. Works for 3.x and 4.xbeta
299 .IP "\s-1SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG\s0" 4
300 .IX Item "SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG"
302 .IP "SSL_OP_NO_SSLv2" 4
303 .IX Item "SSL_OP_NO_SSLv2"
304 Do not use the SSLv2 protocol.
305 .IP "SSL_OP_NO_SSLv3" 4
306 .IX Item "SSL_OP_NO_SSLv3"
307 Do not use the SSLv3 protocol.
308 .IP "SSL_OP_NO_TLSv1" 4
309 .IX Item "SSL_OP_NO_TLSv1"
310 Do not use the TLSv1 protocol.
311 .IP "\s-1SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION\s0" 4
312 .IX Item "SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION"
313 When performing renegotiation as a server, always start a new session
314 (i.e., session resumption requests are only accepted in the initial
315 handshake). This option is not needed for clients.
316 .IP "\s-1SSL_OP_NO_TICKET\s0" 4
317 .IX Item "SSL_OP_NO_TICKET"
318 Normally clients and servers will, where possible, transparently make use
319 of RFC4507bis tickets for stateless session resumption.
321 If this option is set this functionality is disabled and tickets will
322 not be used by clients or servers.
323 .IP "\s-1SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION\s0" 4
324 .IX Item "SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION"
325 Allow legacy insecure renegotiation between OpenSSL and unpatched clients or
326 servers. See the \fB\s-1SECURE RENEGOTIATION\s0\fR section for more details.
327 .IP "\s-1SSL_OP_LEGACY_SERVER_CONNECT\s0" 4
328 .IX Item "SSL_OP_LEGACY_SERVER_CONNECT"
329 Allow legacy insecure renegotiation between OpenSSL and unpatched servers
330 \&\fBonly\fR: this option is currently set by default. See the
331 \&\fB\s-1SECURE RENEGOTIATION\s0\fR section for more details.
332 .SH "SECURE RENEGOTIATION"
333 .IX Header "SECURE RENEGOTIATION"
334 OpenSSL 0.9.8m and later always attempts to use secure renegotiation as
335 described in \s-1RFC5746.\s0 This counters the prefix attack described in
336 \&\s-1CVE\-2009\-3555\s0 and elsewhere.
338 The deprecated and highly broken SSLv2 protocol does not support
339 renegotiation at all: its use is \fBstrongly\fR discouraged.
341 This attack has far reaching consequences which application writers should be
342 aware of. In the description below an implementation supporting secure
343 renegotiation is referred to as \fIpatched\fR. A server not supporting secure
344 renegotiation is referred to as \fIunpatched\fR.
346 The following sections describe the operations permitted by OpenSSL's secure
347 renegotiation implementation.
348 .SS "Patched client and server"
349 .IX Subsection "Patched client and server"
350 Connections and renegotiation are always permitted by OpenSSL implementations.
351 .SS "Unpatched client and patched OpenSSL server"
352 .IX Subsection "Unpatched client and patched OpenSSL server"
353 The initial connection succeeds but client renegotiation is denied by the
354 server with a \fBno_renegotiation\fR warning alert if \s-1TLS\s0 v1.0 is used or a fatal
355 \&\fBhandshake_failure\fR alert in \s-1SSL\s0 v3.0.
357 If the patched OpenSSL server attempts to renegotiate a fatal
358 \&\fBhandshake_failure\fR alert is sent. This is because the server code may be
359 unaware of the unpatched nature of the client.
361 If the option \fB\s-1SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION\s0\fR is set then
362 renegotiation \fBalways\fR succeeds.
364 \&\fB\s-1NB:\s0\fR a bug in OpenSSL clients earlier than 0.9.8m (all of which are
365 unpatched) will result in the connection hanging if it receives a
366 \&\fBno_renegotiation\fR alert. OpenSSL versions 0.9.8m and later will regard
367 a \fBno_renegotiation\fR alert as fatal and respond with a fatal
368 \&\fBhandshake_failure\fR alert. This is because the OpenSSL \s-1API\s0 currently has
369 no provision to indicate to an application that a renegotiation attempt
371 .SS "Patched OpenSSL client and unpatched server."
372 .IX Subsection "Patched OpenSSL client and unpatched server."
373 If the option \fB\s-1SSL_OP_LEGACY_SERVER_CONNECT\s0\fR or
374 \&\fB\s-1SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION\s0\fR is set then initial connections
375 and renegotiation between patched OpenSSL clients and unpatched servers
376 succeeds. If neither option is set then initial connections to unpatched
379 The option \fB\s-1SSL_OP_LEGACY_SERVER_CONNECT\s0\fR is currently set by default even
380 though it has security implications: otherwise it would be impossible to
381 connect to unpatched servers (i.e. all of them initially) and this is clearly
382 not acceptable. Renegotiation is permitted because this does not add any
383 additional security issues: during an attack clients do not see any
384 renegotiations anyway.
386 As more servers become patched the option \fB\s-1SSL_OP_LEGACY_SERVER_CONNECT\s0\fR will
387 \&\fBnot\fR be set by default in a future version of OpenSSL.
389 OpenSSL client applications wishing to ensure they can connect to unpatched
390 servers should always \fBset\fR \fB\s-1SSL_OP_LEGACY_SERVER_CONNECT\s0\fR
392 OpenSSL client applications that want to ensure they can \fBnot\fR connect to
393 unpatched servers (and thus avoid any security issues) should always \fBclear\fR
394 \&\fB\s-1SSL_OP_LEGACY_SERVER_CONNECT\s0\fR using \fISSL_CTX_clear_options()\fR or
395 \&\fISSL_clear_options()\fR.
397 The difference between the \fB\s-1SSL_OP_LEGACY_SERVER_CONNECT\s0\fR and
398 \&\fB\s-1SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION\s0\fR options is that
399 \&\fB\s-1SSL_OP_LEGACY_SERVER_CONNECT\s0\fR enables initial connections and secure
400 renegotiation between OpenSSL clients and unpatched servers \fBonly\fR, while
401 \&\fB\s-1SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION\s0\fR allows initial connections
402 and renegotiation between OpenSSL and unpatched clients or servers.
404 .IX Header "RETURN VALUES"
405 \&\fISSL_CTX_set_options()\fR and \fISSL_set_options()\fR return the new options bitmask
406 after adding \fBoptions\fR.
408 \&\fISSL_CTX_clear_options()\fR and \fISSL_clear_options()\fR return the new options bitmask
409 after clearing \fBoptions\fR.
411 \&\fISSL_CTX_get_options()\fR and \fISSL_get_options()\fR return the current bitmask.
413 \&\fISSL_get_secure_renegotiation_support()\fR returns 1 is the peer supports
414 secure renegotiation and 0 if it does not.
416 .IX Header "SEE ALSO"
417 \&\fIssl\fR\|(3), \fISSL_new\fR\|(3), \fISSL_clear\fR\|(3),
418 \&\fISSL_CTX_set_tmp_dh_callback\fR\|(3),
419 \&\fISSL_CTX_set_tmp_rsa_callback\fR\|(3),
420 \&\fIopenssl_dhparam\fR\|(1)
423 \&\fB\s-1SSL_OP_CIPHER_SERVER_PREFERENCE\s0\fR and
424 \&\fB\s-1SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION\s0\fR have been added in
427 \&\fB\s-1SSL_OP_TLS_ROLLBACK_BUG\s0\fR has been added in OpenSSL 0.9.6 and was automatically
428 enabled with \fB\s-1SSL_OP_ALL\s0\fR. As of 0.9.7, it is no longer included in \fB\s-1SSL_OP_ALL\s0\fR
429 and must be explicitly set.
431 \&\fB\s-1SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS\s0\fR has been added in OpenSSL 0.9.6e.
432 Versions up to OpenSSL 0.9.6c do not include the countermeasure that
433 can be disabled with this option (in OpenSSL 0.9.6d, it was always
436 \&\fISSL_CTX_clear_options()\fR and \fISSL_clear_options()\fR were first added in OpenSSL
439 \&\fB\s-1SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION\s0\fR, \fB\s-1SSL_OP_LEGACY_SERVER_CONNECT\s0\fR
440 and the function \fISSL_get_secure_renegotiation_support()\fR were first added in