1SSL_CTX_set_options(3)              OpenSSL             SSL_CTX_set_options(3)
2
3
4

NAME

6       SSL_CTX_set_options, SSL_set_options, SSL_CTX_clear_options,
7       SSL_clear_options, SSL_CTX_get_options, SSL_get_options,
8       SSL_get_secure_renegotiation_support - manipulate SSL options
9

SYNOPSIS

11        #include <openssl/ssl.h>
12
13        long SSL_CTX_set_options(SSL_CTX *ctx, long options);
14        long SSL_set_options(SSL *ssl, long options);
15
16        long SSL_CTX_clear_options(SSL_CTX *ctx, long options);
17        long SSL_clear_options(SSL *ssl, long options);
18
19        long SSL_CTX_get_options(SSL_CTX *ctx);
20        long SSL_get_options(SSL *ssl);
21
22        long SSL_get_secure_renegotiation_support(SSL *ssl);
23

DESCRIPTION

25       Note: all these functions are implemented using macros.
26
27       SSL_CTX_set_options() adds the options set via bitmask in options to
28       ctx.  Options already set before are not cleared!
29
30       SSL_set_options() adds the options set via bitmask in options to ssl.
31       Options already set before are not cleared!
32
33       SSL_CTX_clear_options() clears the options set via bitmask in options
34       to ctx.
35
36       SSL_clear_options() clears the options set via bitmask in options to
37       ssl.
38
39       SSL_CTX_get_options() returns the options set for ctx.
40
41       SSL_get_options() returns the options set for ssl.
42
43       SSL_get_secure_renegotiation_support() indicates whether the peer
44       supports secure renegotiation.
45

NOTES

47       The behaviour of the SSL library can be changed by setting several
48       options.  The options are coded as bitmasks and can be combined by a
49       logical or operation (|).
50
51       SSL_CTX_set_options() and SSL_set_options() affect the (external)
52       protocol behaviour of the SSL library. The (internal) behaviour of the
53       API can be changed by using the similar SSL_CTX_set_mode(3) and
54       SSL_set_mode() functions.
55
56       During a handshake, the option settings of the SSL object are used.
57       When a new SSL object is created from a context using SSL_new(), the
58       current option setting is copied. Changes to ctx do not affect already
59       created SSL objects. SSL_clear() does not affect the settings.
60
61       The following bug workaround options are available:
62
63       SSL_OP_MICROSOFT_SESS_ID_BUG
64           www.microsoft.com - when talking SSLv2, if session-id reuse is
65           performed, the session-id passed back in the server-finished
66           message is different from the one decided upon.
67
68       SSL_OP_NETSCAPE_CHALLENGE_BUG
69           Netscape-Commerce/1.12, when talking SSLv2, accepts a 32 byte
70           challenge but then appears to only use 16 bytes when generating the
71           encryption keys.  Using 16 bytes is ok but it should be ok to use
72           32.  According to the SSLv3 spec, one should use 32 bytes for the
73           challenge when operating in SSLv2/v3 compatibility mode, but as
74           mentioned above, this breaks this server so 16 bytes is the way to
75           go.
76
77       SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG
78           As of OpenSSL 0.9.8q and 1.0.0c, this option has no effect.
79
80       SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG
81           ...
82
83       SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER
84           ...
85
86       SSL_OP_MSIE_SSLV2_RSA_PADDING
87           As of OpenSSL 0.9.7h and 0.9.8a, this option has no effect.
88
89       SSL_OP_SSLEAY_080_CLIENT_DH_BUG
90           ...
91
92       SSL_OP_TLS_D5_BUG
93           ...
94
95       SSL_OP_TLS_BLOCK_PADDING_BUG
96           ...
97
98       SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
99           Disables a countermeasure against a SSL 3.0/TLS 1.0 protocol
100           vulnerability affecting CBC ciphers, which cannot be handled by
101           some broken SSL implementations.  This option has no effect for
102           connections using other ciphers.
103
104       SSL_OP_ALL
105           All of the above bug workarounds.
106
107       It is usually safe to use SSL_OP_ALL to enable the bug workaround
108       options if compatibility with somewhat broken implementations is
109       desired.
110
111       The following modifying options are available:
112
113       SSL_OP_TLS_ROLLBACK_BUG
114           Disable version rollback attack detection.
115
116           During the client key exchange, the client must send the same
117           information about acceptable SSL/TLS protocol levels as during the
118           first hello. Some clients violate this rule by adapting to the
119           server's answer. (Example: the client sends a SSLv2 hello and
120           accepts up to SSLv3.1=TLSv1, the server only understands up to
121           SSLv3. In this case the client must still use the same
122           SSLv3.1=TLSv1 announcement. Some clients step down to SSLv3 with
123           respect to the server's answer and violate the version rollback
124           protection.)
125
126       SSL_OP_SINGLE_DH_USE
127           Always create a new key when using temporary/ephemeral DH
128           parameters (see SSL_CTX_set_tmp_dh_callback(3)).  This option must
129           be used to prevent small subgroup attacks, when the DH parameters
130           were not generated using "strong" primes (e.g. when using DSA-
131           parameters, see dhparam(1)).  If "strong" primes were used, it is
132           not strictly necessary to generate a new DH key during each
133           handshake but it is also recommended.  SSL_OP_SINGLE_DH_USE should
134           therefore be enabled whenever temporary/ephemeral DH parameters are
135           used.
136
137       SSL_OP_EPHEMERAL_RSA
138           Always use ephemeral (temporary) RSA key when doing RSA operations
139           (see SSL_CTX_set_tmp_rsa_callback(3)).  According to the
140           specifications this is only done, when a RSA key can only be used
141           for signature operations (namely under export ciphers with
142           restricted RSA keylength). By setting this option, ephemeral RSA
143           keys are always used. This option breaks compatibility with the
144           SSL/TLS specifications and may lead to interoperability problems
145           with clients and should therefore never be used. Ciphers with EDH
146           (ephemeral Diffie-Hellman) key exchange should be used instead.
147
148       SSL_OP_CIPHER_SERVER_PREFERENCE
149           When choosing a cipher, use the server's preferences instead of the
150           client preferences. When not set, the SSL server will always follow
151           the clients preferences. When set, the SSLv3/TLSv1 server will
152           choose following its own preferences. Because of the different
153           protocol, for SSLv2 the server will send its list of preferences to
154           the client and the client chooses.
155
156       SSL_OP_PKCS1_CHECK_1
157           ...
158
159       SSL_OP_PKCS1_CHECK_2
160           ...
161
162       SSL_OP_NETSCAPE_CA_DN_BUG
163           If we accept a netscape connection, demand a client cert, have a
164           non-self-signed CA which does not have its CA in netscape, and the
165           browser has a cert, it will crash/hang.  Works for 3.x and 4.xbeta
166
167       SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG
168           ...
169
170       SSL_OP_NO_SSLv2
171           Do not use the SSLv2 protocol.
172
173       SSL_OP_NO_SSLv3
174           Do not use the SSLv3 protocol.
175
176       SSL_OP_NO_TLSv1
177           Do not use the TLSv1 protocol.
178
179       SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
180           When performing renegotiation as a server, always start a new
181           session (i.e., session resumption requests are only accepted in the
182           initial handshake). This option is not needed for clients.
183
184       SSL_OP_NO_TICKET
185           Normally clients and servers will, where possible, transparently
186           make use of RFC4507bis tickets for stateless session resumption.
187
188           If this option is set this functionality is disabled and tickets
189           will not be used by clients or servers.
190
191       SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION
192           Allow legacy insecure renegotiation between OpenSSL and unpatched
193           clients or servers. See the SECURE RENEGOTIATION section for more
194           details.
195
196       SSL_OP_LEGACY_SERVER_CONNECT
197           Allow legacy insecure renegotiation between OpenSSL and unpatched
198           servers only: this option is currently set by default. See the
199           SECURE RENEGOTIATION section for more details.
200

SECURE RENEGOTIATION

202       OpenSSL 0.9.8m and later always attempts to use secure renegotiation as
203       described in RFC5746. This counters the prefix attack described in
204       CVE-2009-3555 and elsewhere.
205
206       The deprecated and highly broken SSLv2 protocol does not support
207       renegotiation at all: its use is strongly discouraged.
208
209       This attack has far reaching consequences which application writers
210       should be aware of. In the description below an implementation
211       supporting secure renegotiation is referred to as patched. A server not
212       supporting secure renegotiation is referred to as unpatched.
213
214       The following sections describe the operations permitted by OpenSSL's
215       secure renegotiation implementation.
216
217   Patched client and server
218       Connections and renegotiation are always permitted by OpenSSL
219       implementations.
220
221   Unpatched client and patched OpenSSL server
222       The initial connection suceeds but client renegotiation is denied by
223       the server with a no_renegotiation warning alert if TLS v1.0 is used or
224       a fatal handshake_failure alert in SSL v3.0.
225
226       If the patched OpenSSL server attempts to renegotiate a fatal
227       handshake_failure alert is sent. This is because the server code may be
228       unaware of the unpatched nature of the client.
229
230       If the option SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION is set then
231       renegotiation always succeeds.
232
233       NB: a bug in OpenSSL clients earlier than 0.9.8m (all of which are
234       unpatched) will result in the connection hanging if it receives a
235       no_renegotiation alert. OpenSSL versions 0.9.8m and later will regard a
236       no_renegotiation alert as fatal and respond with a fatal
237       handshake_failure alert. This is because the OpenSSL API currently has
238       no provision to indicate to an application that a renegotiation attempt
239       was refused.
240
241   Patched OpenSSL client and unpatched server.
242       If the option SSL_OP_LEGACY_SERVER_CONNECT or
243       SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION is set then initial
244       connections and renegotiation between patched OpenSSL clients and
245       unpatched servers succeeds. If neither option is set then initial
246       connections to unpatched servers will fail.
247
248       The option SSL_OP_LEGACY_SERVER_CONNECT is currently set by default
249       even though it has security implications: otherwise it would be
250       impossible to connect to unpatched servers (i.e. all of them initially)
251       and this is clearly not acceptable. Renegotiation is permitted because
252       this does not add any additional security issues: during an attack
253       clients do not see any renegotiations anyway.
254
255       As more servers become patched the option SSL_OP_LEGACY_SERVER_CONNECT
256       will not be set by default in a future version of OpenSSL.
257
258       OpenSSL client applications wishing to ensure they can connect to
259       unpatched servers should always set SSL_OP_LEGACY_SERVER_CONNECT
260
261       OpenSSL client applications that want to ensure they can not connect to
262       unpatched servers (and thus avoid any security issues) should always
263       clear SSL_OP_LEGACY_SERVER_CONNECT using SSL_CTX_clear_options() or
264       SSL_clear_options().
265
266       The difference between the SSL_OP_LEGACY_SERVER_CONNECT and
267       SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION options is that
268       SSL_OP_LEGACY_SERVER_CONNECT enables initial connections and secure
269       renegotiation between OpenSSL clients and unpatched servers only, while
270       SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION allows initial connections and
271       renegotiation between OpenSSL and unpatched clients or servers.
272

RETURN VALUES

274       SSL_CTX_set_options() and SSL_set_options() return the new options
275       bitmask after adding options.
276
277       SSL_CTX_clear_options() and SSL_clear_options() return the new options
278       bitmask after clearing options.
279
280       SSL_CTX_get_options() and SSL_get_options() return the current bitmask.
281
282       SSL_get_secure_renegotiation_support() returns 1 is the peer supports
283       secure renegotiation and 0 if it does not.
284

SEE ALSO

286       ssl(3), SSL_new(3), SSL_clear(3), SSL_CTX_set_tmp_dh_callback(3),
287       SSL_CTX_set_tmp_rsa_callback(3), dhparam(1)
288

HISTORY

290       SSL_OP_CIPHER_SERVER_PREFERENCE and
291       SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION have been added in
292       OpenSSL 0.9.7.
293
294       SSL_OP_TLS_ROLLBACK_BUG has been added in OpenSSL 0.9.6 and was
295       automatically enabled with SSL_OP_ALL. As of 0.9.7, it is no longer
296       included in SSL_OP_ALL and must be explicitly set.
297
298       SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS has been added in OpenSSL 0.9.6e.
299       Versions up to OpenSSL 0.9.6c do not include the countermeasure that
300       can be disabled with this option (in OpenSSL 0.9.6d, it was always
301       enabled).
302
303       SSL_CTX_clear_options() and SSL_clear_options() were first added in
304       OpenSSL 0.9.8m.
305
306       SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION, SSL_OP_LEGACY_SERVER_CONNECT
307       and the function SSL_get_secure_renegotiation_support() were first
308       added in OpenSSL 0.9.8m.
309
310
311
3121.0.0e                            2010-12-02            SSL_CTX_set_options(3)
Impressum