1SSL_CTX_SET_MODE(3) OpenSSL SSL_CTX_SET_MODE(3)
2
3
4
6 SSL_CTX_set_mode, SSL_CTX_clear_mode, SSL_set_mode, SSL_clear_mode,
7 SSL_CTX_get_mode, SSL_get_mode - manipulate SSL engine mode
8
10 #include <openssl/ssl.h>
11
12 long SSL_CTX_set_mode(SSL_CTX *ctx, long mode);
13 long SSL_CTX_clear_mode(SSL_CTX *ctx, long mode);
14 long SSL_set_mode(SSL *ssl, long mode);
15 long SSL_clear_mode(SSL *ssl, long mode);
16
17 long SSL_CTX_get_mode(SSL_CTX *ctx);
18 long SSL_get_mode(SSL *ssl);
19
21 SSL_CTX_set_mode() adds the mode set via bitmask in mode to ctx.
22 Options already set before are not cleared. SSL_CTX_clear_mode()
23 removes the mode set via bitmask in mode from ctx.
24
25 SSL_set_mode() adds the mode set via bitmask in mode to ssl. Options
26 already set before are not cleared. SSL_clear_mode() removes the mode
27 set via bitmask in mode from ssl.
28
29 SSL_CTX_get_mode() returns the mode set for ctx.
30
31 SSL_get_mode() returns the mode set for ssl.
32
34 The following mode changes are available:
35
36 SSL_MODE_ENABLE_PARTIAL_WRITE
37 Allow SSL_write_ex(..., n, &r) to return with 0 < r < n (i.e.
38 report success when just a single record has been written). This
39 works in a similar way for SSL_write(). When not set (the default),
40 SSL_write_ex() or SSL_write() will only report success once the
41 complete chunk was written. Once SSL_write_ex() or SSL_write()
42 returns successful, r bytes have been written and the next call to
43 SSL_write_ex() or SSL_write() must only send the n-r bytes left,
44 imitating the behaviour of write().
45
46 SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
47 Make it possible to retry SSL_write_ex() or SSL_write() with
48 changed buffer location (the buffer contents must stay the same).
49 This is not the default to avoid the misconception that non-
50 blocking SSL_write() behaves like non-blocking write().
51
52 SSL_MODE_AUTO_RETRY
53 During normal operations, non-application data records might need
54 to be sent or received that the application is not aware of. If a
55 non-application data record was processed, SSL_read_ex(3) and
56 SSL_read(3) can return with a failure and indicate the need to
57 retry with SSL_ERROR_WANT_READ. If such a non-application data
58 record was processed, the flag SSL_MODE_AUTO_RETRY causes it to try
59 to process the next record instead of returning.
60
61 In a non-blocking environment applications must be prepared to
62 handle incomplete read/write operations. Setting
63 SSL_MODE_AUTO_RETRY for a non-blocking BIO will process non-
64 application data records until either no more data is available or
65 an application data record has been processed.
66
67 In a blocking environment, applications are not always prepared to
68 deal with the functions returning intermediate reports such as
69 retry requests, and setting the SSL_MODE_AUTO_RETRY flag will cause
70 the functions to only return after successfully processing an
71 application data record or a failure.
72
73 Turning off SSL_MODE_AUTO_RETRY can be useful with blocking BIOs in
74 case they are used in combination with something like select() or
75 poll(). Otherwise the call to SSL_read() or SSL_read_ex() might
76 hang when a non-application record was sent and no application data
77 was sent.
78
79 SSL_MODE_RELEASE_BUFFERS
80 When we no longer need a read buffer or a write buffer for a given
81 SSL, then release the memory we were using to hold it. Using this
82 flag can save around 34k per idle SSL connection. This flag has no
83 effect on SSL v2 connections, or on DTLS connections.
84
85 SSL_MODE_SEND_FALLBACK_SCSV
86 Send TLS_FALLBACK_SCSV in the ClientHello. To be set only by
87 applications that reconnect with a downgraded protocol version; see
88 draft-ietf-tls-downgrade-scsv-00 for details.
89
90 DO NOT ENABLE THIS if your application attempts a normal handshake.
91 Only use this in explicit fallback retries, following the guidance
92 in draft-ietf-tls-downgrade-scsv-00.
93
94 SSL_MODE_ASYNC
95 Enable asynchronous processing. TLS I/O operations may indicate a
96 retry with SSL_ERROR_WANT_ASYNC with this mode set if an
97 asynchronous capable engine is used to perform cryptographic
98 operations. See SSL_get_error(3).
99
100 SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG
101 Older versions of OpenSSL had a bug in the computation of the label
102 length used for computing the endpoint-pair shared secret. The bug
103 was that the terminating zero was included in the length of the
104 label. Setting this option enables this behaviour to allow
105 interoperability with such broken implementations. Please note that
106 setting this option breaks interoperability with correct
107 implementations. This option only applies to DTLS over SCTP.
108
109 All modes are off by default except for SSL_MODE_AUTO_RETRY which is on
110 by default since 1.1.1.
111
113 SSL_CTX_set_mode() and SSL_set_mode() return the new mode bitmask after
114 adding mode.
115
116 SSL_CTX_get_mode() and SSL_get_mode() return the current bitmask.
117
119 ssl(7), SSL_read_ex(3), SSL_read(3), SSL_write_ex(3) or SSL_write(3),
120 SSL_get_error(3)
121
123 SSL_MODE_ASYNC was added in OpenSSL 1.1.0.
124
126 Copyright 2001-2019 The OpenSSL Project Authors. All Rights Reserved.
127
128 Licensed under the OpenSSL license (the "License"). You may not use
129 this file except in compliance with the License. You can obtain a copy
130 in the file LICENSE in the source distribution or at
131 <https://www.openssl.org/source/license.html>.
132
133
134
1351.1.1d 2019-10-03 SSL_CTX_SET_MODE(3)