SSL_CTX_set_options.3ossl 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "SSL_CTX_SET_OPTIONS 3ossl"
  58. .TH SSL_CTX_SET_OPTIONS 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. SSL_CTX_set_options, SSL_set_options, SSL_CTX_clear_options,
  65. SSL_clear_options, SSL_CTX_get_options, SSL_get_options,
  66. SSL_get_secure_renegotiation_support \- manipulate SSL options
  67. .SH SYNOPSIS
  68. .IX Header "SYNOPSIS"
  69. .Vb 1
  70. \& #include <openssl/ssl.h>
  71. \&
  72. \& uint64_t SSL_CTX_set_options(SSL_CTX *ctx, uint64_t options);
  73. \& uint64_t SSL_set_options(SSL *ssl, uint64_t options);
  74. \&
  75. \& uint64_t SSL_CTX_clear_options(SSL_CTX *ctx, uint64_t options);
  76. \& uint64_t SSL_clear_options(SSL *ssl, uint64_t options);
  77. \&
  78. \& uint64_t SSL_CTX_get_options(const SSL_CTX *ctx);
  79. \& uint64_t SSL_get_options(const SSL *ssl);
  80. \&
  81. \& long SSL_get_secure_renegotiation_support(SSL *ssl);
  82. .Ve
  83. .SH DESCRIPTION
  84. .IX Header "DESCRIPTION"
  85. \&\fBSSL_CTX_set_options()\fR adds the options set via bit-mask in \fBoptions\fR to \fBctx\fR.
  86. Options already set before are not cleared!
  87. .PP
  88. \&\fBSSL_set_options()\fR adds the options set via bit-mask in \fBoptions\fR to \fBssl\fR.
  89. Options already set before are not cleared!
  90. .PP
  91. \&\fBSSL_CTX_clear_options()\fR clears the options set via bit-mask in \fBoptions\fR
  92. to \fBctx\fR.
  93. .PP
  94. \&\fBSSL_clear_options()\fR clears the options set via bit-mask in \fBoptions\fR to \fBssl\fR.
  95. .PP
  96. \&\fBSSL_CTX_get_options()\fR returns the options set for \fBctx\fR.
  97. .PP
  98. \&\fBSSL_get_options()\fR returns the options set for \fBssl\fR.
  99. .PP
  100. \&\fBSSL_get_secure_renegotiation_support()\fR indicates whether the peer supports
  101. secure renegotiation.
  102. Note, this is implemented via a macro.
  103. .SH NOTES
  104. .IX Header "NOTES"
  105. The behaviour of the SSL library can be changed by setting several options.
  106. The options are coded as bit-masks and can be combined by a bitwise \fBor\fR
  107. operation (|).
  108. .PP
  109. \&\fBSSL_CTX_set_options()\fR and \fBSSL_set_options()\fR affect the (external)
  110. protocol behaviour of the SSL library. The (internal) behaviour of
  111. the API can be changed by using the similar
  112. \&\fBSSL_CTX_set_mode\fR\|(3) and \fBSSL_set_mode()\fR functions.
  113. .PP
  114. During a handshake, the option settings of the SSL object are used. When
  115. a new SSL object is created from a context using \fBSSL_new()\fR, the current
  116. option setting is copied. Changes to \fBctx\fR do not affect already created
  117. SSL objects. \fBSSL_clear()\fR does not affect the settings.
  118. .PP
  119. The following \fBbug workaround\fR options are available:
  120. .IP SSL_OP_CRYPTOPRO_TLSEXT_BUG 4
  121. .IX Item "SSL_OP_CRYPTOPRO_TLSEXT_BUG"
  122. Add server-hello extension from the early version of cryptopro draft
  123. when GOST ciphersuite is negotiated. Required for interoperability with CryptoPro
  124. CSP 3.x.
  125. .IP SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS 4
  126. .IX Item "SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS"
  127. Disables a countermeasure against a SSL 3.0/TLS 1.0 protocol
  128. vulnerability affecting CBC ciphers, which cannot be handled by some
  129. broken SSL implementations. This option has no effect for connections
  130. using other ciphers.
  131. .IP SSL_OP_SAFARI_ECDHE_ECDSA_BUG 4
  132. .IX Item "SSL_OP_SAFARI_ECDHE_ECDSA_BUG"
  133. Don't prefer ECDHE-ECDSA ciphers when the client appears to be Safari on OS X.
  134. OS X 10.8..10.8.3 has broken support for ECDHE-ECDSA ciphers.
  135. .IP SSL_OP_TLSEXT_PADDING 4
  136. .IX Item "SSL_OP_TLSEXT_PADDING"
  137. Adds a padding extension to ensure the ClientHello size is never between
  138. 256 and 511 bytes in length. This is needed as a workaround for some
  139. implementations.
  140. .IP SSL_OP_ALL 4
  141. .IX Item "SSL_OP_ALL"
  142. All of the above bug workarounds.
  143. .PP
  144. It is usually safe to use \fBSSL_OP_ALL\fR to enable the bug workaround
  145. options if compatibility with somewhat broken implementations is
  146. desired.
  147. .PP
  148. The following \fBmodifying\fR options are available:
  149. .IP SSL_OP_ALLOW_CLIENT_RENEGOTIATION 4
  150. .IX Item "SSL_OP_ALLOW_CLIENT_RENEGOTIATION"
  151. Client-initiated renegotiation is disabled by default. Use
  152. this option to enable it.
  153. .IP SSL_OP_ALLOW_NO_DHE_KEX 4
  154. .IX Item "SSL_OP_ALLOW_NO_DHE_KEX"
  155. In TLSv1.3 allow a non\-(ec)dhe based key exchange mode on resumption. This means
  156. that there will be no forward secrecy for the resumed session.
  157. .IP SSL_OP_PREFER_NO_DHE_KEX 4
  158. .IX Item "SSL_OP_PREFER_NO_DHE_KEX"
  159. In TLSv1.3, on resumption let the server prefer a non\-(ec)dhe based key
  160. exchange mode over an (ec)dhe based one. Ignored without \fBSSL_OP_ALLOW_NO_DHE_KEX\fR
  161. being set as well. Always ignored on the client.
  162. .IP SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION 4
  163. .IX Item "SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION"
  164. Allow legacy insecure renegotiation between OpenSSL and unpatched clients or
  165. servers. See the \fBSECURE RENEGOTIATION\fR section for more details.
  166. .IP SSL_OP_CIPHER_SERVER_PREFERENCE 4
  167. .IX Item "SSL_OP_CIPHER_SERVER_PREFERENCE"
  168. When choosing a cipher, use the server's preferences instead of the client
  169. preferences. When not set, the SSL server will always follow the clients
  170. preferences. When set, the SSL/TLS server will choose following its
  171. own preferences.
  172. .IP SSL_OP_CISCO_ANYCONNECT 4
  173. .IX Item "SSL_OP_CISCO_ANYCONNECT"
  174. Use Cisco's version identifier of DTLS_BAD_VER when establishing a DTLSv1
  175. connection. Only available when using the deprecated \fBDTLSv1_client_method()\fR API.
  176. .IP SSL_OP_CLEANSE_PLAINTEXT 4
  177. .IX Item "SSL_OP_CLEANSE_PLAINTEXT"
  178. By default TLS and QUIC SSL objects keep a copy of received plaintext
  179. application data in a static buffer until it is overwritten by the
  180. next portion of data. When enabling SSL_OP_CLEANSE_PLAINTEXT
  181. deciphered application data is cleansed by calling \fBOPENSSL_cleanse\fR\|(3)
  182. after passing data to the application. Data is also cleansed when
  183. releasing the connection (e.g. \fBSSL_free\fR\|(3)).
  184. .Sp
  185. Since OpenSSL only cleanses internal buffers, the application is still
  186. responsible for cleansing all other buffers. Most notably, this
  187. applies to buffers passed to functions like \fBSSL_read\fR\|(3),
  188. \&\fBSSL_peek\fR\|(3) but also like \fBSSL_write\fR\|(3).
  189. .Sp
  190. TLS connections do not buffer data to be sent in plaintext. QUIC stream
  191. objects do buffer plaintext data to be sent and this option will also cause
  192. that data to be cleansed when it is discarded.
  193. .Sp
  194. This option can be set differently on individual QUIC stream objects and
  195. has no effect on QUIC connection objects (except where a default stream is
  196. being used).
  197. .IP SSL_OP_COOKIE_EXCHANGE 4
  198. .IX Item "SSL_OP_COOKIE_EXCHANGE"
  199. Turn on Cookie Exchange as described in RFC4347 Section 4.2.1. Only affects
  200. DTLS connections.
  201. .IP SSL_OP_DISABLE_TLSEXT_CA_NAMES 4
  202. .IX Item "SSL_OP_DISABLE_TLSEXT_CA_NAMES"
  203. Disable TLS Extension CA Names. You may want to disable it for security reasons
  204. or for compatibility with some Windows TLS implementations crashing when this
  205. extension is larger than 1024 bytes.
  206. .IP SSL_OP_ENABLE_KTLS 4
  207. .IX Item "SSL_OP_ENABLE_KTLS"
  208. Enable the use of kernel TLS. In order to benefit from kernel TLS OpenSSL must
  209. have been compiled with support for it, and it must be supported by the
  210. negotiated ciphersuites and extensions. The specific ciphersuites and extensions
  211. that are supported may vary by platform and kernel version.
  212. .Sp
  213. The kernel TLS data-path implements the record layer, and the encryption
  214. algorithm. The kernel will utilize the best hardware
  215. available for encryption. Using the kernel data-path should reduce the memory
  216. footprint of OpenSSL because no buffering is required. Also, the throughput
  217. should improve because data copy is avoided when user data is encrypted into
  218. kernel memory instead of the usual encrypt then copy to kernel.
  219. .Sp
  220. Kernel TLS might not support all the features of OpenSSL. For instance,
  221. renegotiation, and setting the maximum fragment size is not possible as of
  222. Linux 4.20.
  223. .Sp
  224. Note that with kernel TLS enabled some cryptographic operations are performed
  225. by the kernel directly and not via any available OpenSSL Providers. This might
  226. be undesirable if, for example, the application requires all cryptographic
  227. operations to be performed by the FIPS provider.
  228. .IP SSL_OP_ENABLE_KTLS_TX_ZEROCOPY_SENDFILE 4
  229. .IX Item "SSL_OP_ENABLE_KTLS_TX_ZEROCOPY_SENDFILE"
  230. With this option, \fBsendfile()\fR will use the zerocopy mode, which gives a
  231. performance boost when used with KTLS hardware offload. Note that invalid TLS
  232. records might be transmitted if the file is changed while being sent. This
  233. option has no effect if \fBSSL_OP_ENABLE_KTLS\fR is not enabled.
  234. .Sp
  235. This option only applies to Linux. KTLS sendfile on FreeBSD doesn't offer an
  236. option to disable zerocopy and always runs in this mode.
  237. .IP SSL_OP_ENABLE_MIDDLEBOX_COMPAT 4
  238. .IX Item "SSL_OP_ENABLE_MIDDLEBOX_COMPAT"
  239. If set then dummy Change Cipher Spec (CCS) messages are sent in TLSv1.3. This
  240. has the effect of making TLSv1.3 look more like TLSv1.2 so that middleboxes that
  241. do not understand TLSv1.3 will not drop the connection. Regardless of whether
  242. this option is set or not CCS messages received from the peer will always be
  243. ignored in TLSv1.3. This option is set by default. To switch it off use
  244. \&\fBSSL_clear_options()\fR. A future version of OpenSSL may not set this by default.
  245. .IP SSL_OP_IGNORE_UNEXPECTED_EOF 4
  246. .IX Item "SSL_OP_IGNORE_UNEXPECTED_EOF"
  247. Some TLS implementations do not send the mandatory close_notify alert on
  248. shutdown. If the application tries to wait for the close_notify alert but the
  249. peer closes the connection without sending it, an error is generated. When this
  250. option is enabled the peer does not need to send the close_notify alert and a
  251. closed connection will be treated as if the close_notify alert was received.
  252. .Sp
  253. You should only enable this option if the protocol running over TLS
  254. can detect a truncation attack itself, and that the application is checking for
  255. that truncation attack.
  256. .Sp
  257. For more information on shutting down a connection, see \fBSSL_shutdown\fR\|(3).
  258. .IP SSL_OP_LEGACY_SERVER_CONNECT 4
  259. .IX Item "SSL_OP_LEGACY_SERVER_CONNECT"
  260. Allow legacy insecure renegotiation between OpenSSL and unpatched servers
  261. \&\fBonly\fR. See the \fBSECURE RENEGOTIATION\fR section for more details.
  262. .IP SSL_OP_NO_ANTI_REPLAY 4
  263. .IX Item "SSL_OP_NO_ANTI_REPLAY"
  264. By default, when a server is configured for early data (i.e., max_early_data > 0),
  265. OpenSSL will switch on replay protection. See \fBSSL_read_early_data\fR\|(3) for a
  266. description of the replay protection feature. Anti-replay measures are required
  267. to comply with the TLSv1.3 specification. Some applications may be able to
  268. mitigate the replay risks in other ways and in such cases the built in OpenSSL
  269. functionality is not required. Those applications can turn this feature off by
  270. setting this option. This is a server-side option only. It is ignored by
  271. clients.
  272. .IP SSL_OP_NO_TX_CERTIFICATE_COMPRESSION 4
  273. .IX Item "SSL_OP_NO_TX_CERTIFICATE_COMPRESSION"
  274. Normally clients and servers will transparently attempt to negotiate the
  275. RFC8879 certificate compression option on TLSv1.3 connections.
  276. .Sp
  277. If this option is set, the certificate compression extension is ignored
  278. upon receipt and compressed certificates will not be sent to the peer.
  279. .IP SSL_OP_NO_RX_CERTIFICATE_COMPRESSION 4
  280. .IX Item "SSL_OP_NO_RX_CERTIFICATE_COMPRESSION"
  281. Normally clients and servers will transparently attempt to negotiate the
  282. RFC8879 certificate compression option on TLSv1.3 connections.
  283. .Sp
  284. If this option is set, the certificate compression extension will not be sent
  285. and compressed certificates will not be accepted from the peer.
  286. .IP SSL_OP_NO_COMPRESSION 4
  287. .IX Item "SSL_OP_NO_COMPRESSION"
  288. Do not use TLS record compression even if it is supported. This option is set by
  289. default. To switch it off use \fBSSL_clear_options()\fR. Note that TLS record
  290. compression is not recommended and is not available at security level 2 or
  291. above. From OpenSSL 3.2 the default security level is 2, so clearing this option
  292. will have no effect without also changing the default security level. See
  293. \&\fBSSL_CTX_set_security_level\fR\|(3).
  294. .IP SSL_OP_NO_ENCRYPT_THEN_MAC 4
  295. .IX Item "SSL_OP_NO_ENCRYPT_THEN_MAC"
  296. Normally clients and servers will transparently attempt to negotiate the
  297. RFC7366 Encrypt-then-MAC option on TLS and DTLS connection.
  298. .Sp
  299. If this option is set, Encrypt-then-MAC is disabled. Clients will not
  300. propose, and servers will not accept the extension.
  301. .IP SSL_OP_NO_EXTENDED_MASTER_SECRET 4
  302. .IX Item "SSL_OP_NO_EXTENDED_MASTER_SECRET"
  303. Normally clients and servers will transparently attempt to negotiate the
  304. RFC7627 Extended Master Secret option on TLS and DTLS connection.
  305. .Sp
  306. If this option is set, Extended Master Secret is disabled. Clients will
  307. not propose, and servers will not accept the extension.
  308. .IP SSL_OP_NO_QUERY_MTU 4
  309. .IX Item "SSL_OP_NO_QUERY_MTU"
  310. Do not query the MTU. Only affects DTLS connections.
  311. .IP SSL_OP_NO_RENEGOTIATION 4
  312. .IX Item "SSL_OP_NO_RENEGOTIATION"
  313. Disable all renegotiation in TLSv1.2 and earlier. Do not send HelloRequest
  314. messages, and ignore renegotiation requests via ClientHello.
  315. .IP SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION 4
  316. .IX Item "SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION"
  317. When performing renegotiation as a server, always start a new session
  318. (i.e., session resumption requests are only accepted in the initial
  319. handshake). This option is not needed for clients.
  320. .IP "SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_2, SSL_OP_NO_TLSv1_3, SSL_OP_NO_DTLSv1, SSL_OP_NO_DTLSv1_2" 4
  321. .IX Item "SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1, SSL_OP_NO_TLSv1_2, SSL_OP_NO_TLSv1_3, SSL_OP_NO_DTLSv1, SSL_OP_NO_DTLSv1_2"
  322. These options turn off the SSLv3, TLSv1, TLSv1.1, TLSv1.2 or TLSv1.3 protocol
  323. versions with TLS or the DTLSv1, DTLSv1.2 versions with DTLS,
  324. respectively.
  325. As of OpenSSL 1.1.0, these options are deprecated, use
  326. \&\fBSSL_CTX_set_min_proto_version\fR\|(3) and
  327. \&\fBSSL_CTX_set_max_proto_version\fR\|(3) instead.
  328. .IP SSL_OP_NO_TICKET 4
  329. .IX Item "SSL_OP_NO_TICKET"
  330. SSL/TLS supports two mechanisms for resuming sessions: session ids and stateless
  331. session tickets.
  332. .Sp
  333. When using session ids a copy of the session information is
  334. cached on the server and a unique id is sent to the client. When the client
  335. wishes to resume it provides the unique id so that the server can retrieve the
  336. session information from its cache.
  337. .Sp
  338. When using stateless session tickets the server uses a session ticket encryption
  339. key to encrypt the session information. This encrypted data is sent to the
  340. client as a "ticket". When the client wishes to resume it sends the encrypted
  341. data back to the server. The server uses its key to decrypt the data and resume
  342. the session. In this way the server can operate statelessly \- no session
  343. information needs to be cached locally.
  344. .Sp
  345. The TLSv1.3 protocol only supports tickets and does not directly support session
  346. ids. However, OpenSSL allows two modes of ticket operation in TLSv1.3: stateful
  347. and stateless. Stateless tickets work the same way as in TLSv1.2 and below.
  348. Stateful tickets mimic the session id behaviour available in TLSv1.2 and below.
  349. The session information is cached on the server and the session id is wrapped up
  350. in a ticket and sent back to the client. When the client wishes to resume, it
  351. presents a ticket in the same way as for stateless tickets. The server can then
  352. extract the session id from the ticket and retrieve the session information from
  353. its cache.
  354. .Sp
  355. By default OpenSSL will use stateless tickets. The SSL_OP_NO_TICKET option will
  356. cause stateless tickets to not be issued. In TLSv1.2 and below this means no
  357. ticket gets sent to the client at all. In TLSv1.3 a stateful ticket will be
  358. sent. This is a server-side option only.
  359. .Sp
  360. In TLSv1.3 it is possible to suppress all tickets (stateful and stateless) from
  361. being sent by calling \fBSSL_CTX_set_num_tickets\fR\|(3) or
  362. \&\fBSSL_set_num_tickets\fR\|(3).
  363. .IP SSL_OP_PRIORITIZE_CHACHA 4
  364. .IX Item "SSL_OP_PRIORITIZE_CHACHA"
  365. When SSL_OP_CIPHER_SERVER_PREFERENCE is set, temporarily reprioritize
  366. ChaCha20\-Poly1305 ciphers to the top of the server cipher list if a
  367. ChaCha20\-Poly1305 cipher is at the top of the client cipher list. This helps
  368. those clients (e.g. mobile) use ChaCha20\-Poly1305 if that cipher is anywhere
  369. in the server cipher list; but still allows other clients to use AES and other
  370. ciphers. Requires \fBSSL_OP_CIPHER_SERVER_PREFERENCE\fR.
  371. .IP SSL_OP_TLS_ROLLBACK_BUG 4
  372. .IX Item "SSL_OP_TLS_ROLLBACK_BUG"
  373. Disable version rollback attack detection.
  374. .Sp
  375. During the client key exchange, the client must send the same information
  376. about acceptable SSL/TLS protocol levels as during the first hello. Some
  377. clients violate this rule by adapting to the server's answer. (Example:
  378. the client sends a SSLv2 hello and accepts up to SSLv3.1=TLSv1, the server
  379. only understands up to SSLv3. In this case the client must still use the
  380. same SSLv3.1=TLSv1 announcement. Some clients step down to SSLv3 with respect
  381. to the server's answer and violate the version rollback protection.)
  382. .PP
  383. The following options no longer have any effect but their identifiers are
  384. retained for compatibility purposes:
  385. .IP SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG 4
  386. .IX Item "SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG"
  387. .PD 0
  388. .IP SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER 4
  389. .IX Item "SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER"
  390. .IP SSL_OP_SSLEAY_080_CLIENT_DH_BUG 4
  391. .IX Item "SSL_OP_SSLEAY_080_CLIENT_DH_BUG"
  392. .IP SSL_OP_TLS_D5_BUG 4
  393. .IX Item "SSL_OP_TLS_D5_BUG"
  394. .IP SSL_OP_TLS_BLOCK_PADDING_BUG 4
  395. .IX Item "SSL_OP_TLS_BLOCK_PADDING_BUG"
  396. .IP SSL_OP_MSIE_SSLV2_RSA_PADDING 4
  397. .IX Item "SSL_OP_MSIE_SSLV2_RSA_PADDING"
  398. .IP SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG 4
  399. .IX Item "SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG"
  400. .IP SSL_OP_MICROSOFT_SESS_ID_BUG 4
  401. .IX Item "SSL_OP_MICROSOFT_SESS_ID_BUG"
  402. .IP SSL_OP_NETSCAPE_CHALLENGE_BUG 4
  403. .IX Item "SSL_OP_NETSCAPE_CHALLENGE_BUG"
  404. .IP SSL_OP_PKCS1_CHECK_1 4
  405. .IX Item "SSL_OP_PKCS1_CHECK_1"
  406. .IP SSL_OP_PKCS1_CHECK_2 4
  407. .IX Item "SSL_OP_PKCS1_CHECK_2"
  408. .IP SSL_OP_SINGLE_DH_USE 4
  409. .IX Item "SSL_OP_SINGLE_DH_USE"
  410. .IP SSL_OP_SINGLE_ECDH_USE 4
  411. .IX Item "SSL_OP_SINGLE_ECDH_USE"
  412. .IP SSL_OP_EPHEMERAL_RSA 4
  413. .IX Item "SSL_OP_EPHEMERAL_RSA"
  414. .IP SSL_OP_NETSCAPE_CA_DN_BUG 4
  415. .IX Item "SSL_OP_NETSCAPE_CA_DN_BUG"
  416. .IP SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG 4
  417. .IX Item "SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG"
  418. .PD
  419. .SH "SECURE RENEGOTIATION"
  420. .IX Header "SECURE RENEGOTIATION"
  421. OpenSSL always attempts to use secure renegotiation as
  422. described in RFC5746. This counters the prefix attack described in
  423. CVE\-2009\-3555 and elsewhere.
  424. .PP
  425. This attack has far reaching consequences which application writers should be
  426. aware of. In the description below an implementation supporting secure
  427. renegotiation is referred to as \fIpatched\fR. A server not supporting secure
  428. renegotiation is referred to as \fIunpatched\fR.
  429. .PP
  430. The following sections describe the operations permitted by OpenSSL's secure
  431. renegotiation implementation.
  432. .SS "Patched client and server"
  433. .IX Subsection "Patched client and server"
  434. Connections and renegotiation are always permitted by OpenSSL implementations.
  435. .SS "Unpatched client and patched OpenSSL server"
  436. .IX Subsection "Unpatched client and patched OpenSSL server"
  437. The initial connection succeeds but client renegotiation is denied by the
  438. server with a \fBno_renegotiation\fR warning alert if TLS v1.0 is used or a fatal
  439. \&\fBhandshake_failure\fR alert in SSL v3.0.
  440. .PP
  441. If the patched OpenSSL server attempts to renegotiate a fatal
  442. \&\fBhandshake_failure\fR alert is sent. This is because the server code may be
  443. unaware of the unpatched nature of the client.
  444. .PP
  445. If the option \fBSSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION\fR is set then
  446. renegotiation \fBalways\fR succeeds.
  447. .SS "Patched OpenSSL client and unpatched server"
  448. .IX Subsection "Patched OpenSSL client and unpatched server"
  449. If the option \fBSSL_OP_LEGACY_SERVER_CONNECT\fR or
  450. \&\fBSSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION\fR is set then initial connections
  451. and renegotiation between patched OpenSSL clients and unpatched servers
  452. succeeds. If neither option is set then initial connections to unpatched
  453. servers will fail.
  454. .PP
  455. Setting the option \fBSSL_OP_LEGACY_SERVER_CONNECT\fR has security implications;
  456. clients that are willing to connect to servers that do not implement
  457. RFC 5746 secure renegotiation are subject to attacks such as
  458. CVE\-2009\-3555.
  459. .PP
  460. OpenSSL client applications wishing to ensure they can connect to unpatched
  461. servers should always \fBset\fR \fBSSL_OP_LEGACY_SERVER_CONNECT\fR
  462. .PP
  463. OpenSSL client applications that want to ensure they can \fBnot\fR connect to
  464. unpatched servers (and thus avoid any security issues) should always \fBclear\fR
  465. \&\fBSSL_OP_LEGACY_SERVER_CONNECT\fR using \fBSSL_CTX_clear_options()\fR or
  466. \&\fBSSL_clear_options()\fR.
  467. .PP
  468. The difference between the \fBSSL_OP_LEGACY_SERVER_CONNECT\fR and
  469. \&\fBSSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION\fR options is that
  470. \&\fBSSL_OP_LEGACY_SERVER_CONNECT\fR enables initial connections and secure
  471. renegotiation between OpenSSL clients and unpatched servers \fBonly\fR, while
  472. \&\fBSSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION\fR allows initial connections
  473. and renegotiation between OpenSSL and unpatched clients or servers.
  474. .SS "Applicability of options to QUIC connections and streams"
  475. .IX Subsection "Applicability of options to QUIC connections and streams"
  476. These options apply to SSL objects referencing a QUIC connection:
  477. .IP SSL_OP_ALLOW_NO_DHE_KEX 4
  478. .IX Item "SSL_OP_ALLOW_NO_DHE_KEX"
  479. .PD 0
  480. .IP SSL_OP_NO_TX_CERTIFICATE_COMPRESSION 4
  481. .IX Item "SSL_OP_NO_TX_CERTIFICATE_COMPRESSION"
  482. .IP SSL_OP_NO_RX_CERTIFICATE_COMPRESSION 4
  483. .IX Item "SSL_OP_NO_RX_CERTIFICATE_COMPRESSION"
  484. .IP SSL_OP_NO_TICKET 4
  485. .IX Item "SSL_OP_NO_TICKET"
  486. .IP SSL_OP_PRIORITIZE_CHACHA 4
  487. .IX Item "SSL_OP_PRIORITIZE_CHACHA"
  488. .PD
  489. .PP
  490. These options apply to SSL objects referencing a QUIC stream:
  491. .IP SSL_OP_CLEANSE_PLAINTEXT 4
  492. .IX Item "SSL_OP_CLEANSE_PLAINTEXT"
  493. .PP
  494. Options on QUIC connections are initialized from the options set on SSL_CTX
  495. before a QUIC connection SSL object is created. Options on QUIC streams are
  496. initialised from the options configured on the QUIC connection SSL object
  497. they are created from.
  498. .PP
  499. Setting options which relate to QUIC streams on a QUIC connection SSL object has
  500. no direct effect on the QUIC connection SSL object itself, but will change the
  501. options set on the default stream (if there is one) and will also determine the
  502. default options set on any future streams which are created.
  503. .PP
  504. Other options not mentioned above do not have an effect and will be ignored.
  505. .PP
  506. Options which relate to QUIC streams may also be set directly on QUIC stream SSL
  507. objects. Setting connection-related options on such an object has no effect.
  508. .SH "RETURN VALUES"
  509. .IX Header "RETURN VALUES"
  510. \&\fBSSL_CTX_set_options()\fR and \fBSSL_set_options()\fR return the new options bit-mask
  511. after adding \fBoptions\fR.
  512. .PP
  513. \&\fBSSL_CTX_clear_options()\fR and \fBSSL_clear_options()\fR return the new options bit-mask
  514. after clearing \fBoptions\fR.
  515. .PP
  516. \&\fBSSL_CTX_get_options()\fR and \fBSSL_get_options()\fR return the current bit-mask.
  517. .PP
  518. \&\fBSSL_get_secure_renegotiation_support()\fR returns 1 is the peer supports
  519. secure renegotiation and 0 if it does not.
  520. .SH "SEE ALSO"
  521. .IX Header "SEE ALSO"
  522. \&\fBssl\fR\|(7), \fBSSL_new\fR\|(3), \fBSSL_clear\fR\|(3), \fBSSL_shutdown\fR\|(3)
  523. \&\fBSSL_CTX_set_tmp_dh_callback\fR\|(3),
  524. \&\fBSSL_CTX_set_min_proto_version\fR\|(3),
  525. \&\fBopenssl\-dhparam\fR\|(1)
  526. .SH HISTORY
  527. .IX Header "HISTORY"
  528. The attempt to always try to use secure renegotiation was added in
  529. OpenSSL 0.9.8m.
  530. .PP
  531. The \fBSSL_OP_PRIORITIZE_CHACHA\fR and \fBSSL_OP_NO_RENEGOTIATION\fR options
  532. were added in OpenSSL 1.1.1.
  533. .PP
  534. The \fBSSL_OP_NO_EXTENDED_MASTER_SECRET\fR and \fBSSL_OP_IGNORE_UNEXPECTED_EOF\fR
  535. options were added in OpenSSL 3.0.
  536. .PP
  537. The \fBSSL_OP_\fR constants and the corresponding parameter and return values
  538. of the affected functions were changed to \f(CW\*(C`uint64_t\*(C'\fR type in OpenSSL 3.0.
  539. For that reason it is no longer possible use the \fBSSL_OP_\fR macro values
  540. in preprocessor \f(CW\*(C`#if\*(C'\fR conditions. However it is still possible to test
  541. whether these macros are defined or not.
  542. .SH COPYRIGHT
  543. .IX Header "COPYRIGHT"
  544. Copyright 2001\-2023 The OpenSSL Project Authors. All Rights Reserved.
  545. .PP
  546. Licensed under the Apache License 2.0 (the "License"). You may not use
  547. this file except in compliance with the License. You can obtain a copy
  548. in the file LICENSE in the source distribution or at
  549. <https://www.openssl.org/source/license.html>.