Debian Codegraph @

upstream/debian-unstable/man3/SSL_CTX_set_mode.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
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_MODE 3SSL"
58 .TH SSL_CTX_SET_MODE 3SSL 2026-04-07 3.6.2 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_mode, SSL_CTX_clear_mode, SSL_set_mode, SSL_clear_mode, SSL_CTX_get_mode, SSL_get_mode \- manipulate SSL engine mode
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 1
68 \& #include <openssl/ssl.h>
69 \&
70 \& long SSL_CTX_set_mode(SSL_CTX *ctx, long mode);
71 \& long SSL_CTX_clear_mode(SSL_CTX *ctx, long mode);
72 \& long SSL_set_mode(SSL *ssl, long mode);
73 \& long SSL_clear_mode(SSL *ssl, long mode);
74 \&
75 \& long SSL_CTX_get_mode(SSL_CTX *ctx);
76 \& long SSL_get_mode(SSL *ssl);
77 .Ve
78 .SH DESCRIPTION
79 .IX Header "DESCRIPTION"
80 \&\fBSSL_CTX_set_mode()\fR adds the mode set via bit-mask in \fBmode\fR to \fBctx\fR.
81 Options already set before are not cleared.
82 \&\fBSSL_CTX_clear_mode()\fR removes the mode set via bit-mask in \fBmode\fR from \fBctx\fR.
83 .PP
84 \&\fBSSL_set_mode()\fR adds the mode set via bit-mask in \fBmode\fR to \fBssl\fR.
85 Options already set before are not cleared.
86 \&\fBSSL_clear_mode()\fR removes the mode set via bit-mask in \fBmode\fR from \fBssl\fR.
87 .PP
88 \&\fBSSL_CTX_get_mode()\fR returns the mode set for \fBctx\fR.
89 .PP
90 \&\fBSSL_get_mode()\fR returns the mode set for \fBssl\fR.
91 .SH NOTES
92 .IX Header "NOTES"
93 The following mode changes are available:
94 .IP SSL_MODE_ENABLE_PARTIAL_WRITE 4
95 .IX Item "SSL_MODE_ENABLE_PARTIAL_WRITE"
96 Allow SSL_write_ex(..., n, &r) to return with 0 < r < n (i.e. report success
97 when just a single record has been written). This works in a similar way for
98 \&\fBSSL_write()\fR. When not set (the default), \fBSSL_write_ex()\fR or \fBSSL_write()\fR will only
99 report success once the complete chunk was written. Once \fBSSL_write_ex()\fR or
100 \&\fBSSL_write()\fR returns successful, \fBr\fR bytes have been written and the next call
101 to \fBSSL_write_ex()\fR or \fBSSL_write()\fR must only send the n\-r bytes left, imitating
102 the behaviour of \fBwrite()\fR.
103 .Sp
104 This mode cannot be enabled while in the middle of an incomplete write
105 operation.
106 .IP SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 4
107 .IX Item "SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER"
108 Make it possible to retry \fBSSL_write_ex()\fR or \fBSSL_write()\fR with changed buffer
109 location (the buffer contents must stay the same). This is not the default to
110 avoid the misconception that nonblocking \fBSSL_write()\fR behaves like
111 nonblocking \fBwrite()\fR.
112 .IP SSL_MODE_AUTO_RETRY 4
113 .IX Item "SSL_MODE_AUTO_RETRY"
114 During normal operations, non-application data records might need to be sent or
115 received that the application is not aware of.
116 If a non-application data record was processed,
117 \&\fBSSL_read_ex\fR\|(3) and \fBSSL_read\fR\|(3) can return with a failure and indicate the
118 need to retry with \fBSSL_ERROR_WANT_READ\fR.
119 If such a non-application data record was processed, the flag
120 \&\fBSSL_MODE_AUTO_RETRY\fR causes it to try to process the next record instead of
121 returning.
122 .Sp
123 In a nonblocking environment applications must be prepared to handle
124 incomplete read/write operations.
125 Setting \fBSSL_MODE_AUTO_RETRY\fR for a nonblocking \fBBIO\fR will process
126 non-application data records until either no more data is available or
127 an application data record has been processed.
128 .Sp
129 In a blocking environment, applications are not always prepared to
130 deal with the functions returning intermediate reports such as retry
131 requests, and setting the \fBSSL_MODE_AUTO_RETRY\fR flag will cause the functions
132 to only return after successfully processing an application data record or a
133 failure.
134 .Sp
135 Turning off \fBSSL_MODE_AUTO_RETRY\fR can be useful with blocking \fBBIO\fRs in case
136 they are used in combination with something like \fBselect()\fR or \fBpoll()\fR.
137 Otherwise the call to \fBSSL_read()\fR or \fBSSL_read_ex()\fR might hang when a
138 non-application record was sent and no application data was sent.
139 .IP SSL_MODE_RELEASE_BUFFERS 4
140 .IX Item "SSL_MODE_RELEASE_BUFFERS"
141 When we no longer need a read buffer or a write buffer for a given SSL,
142 then release the memory we were using to hold it.
143 Using this flag can
144 save around 34k per idle SSL connection.
145 This flag has no effect on SSL v2 connections, or on DTLS connections.
146 .IP SSL_MODE_SEND_FALLBACK_SCSV 4
147 .IX Item "SSL_MODE_SEND_FALLBACK_SCSV"
148 Send TLS_FALLBACK_SCSV in the ClientHello.
149 To be set only by applications that reconnect with a downgraded protocol
150 version; see draft\-ietf\-tls\-downgrade\-scsv\-00 for details.
151 .Sp
152 DO NOT ENABLE THIS if your application attempts a normal handshake.
153 Only use this in explicit fallback retries, following the guidance
154 in draft\-ietf\-tls\-downgrade\-scsv\-00.
155 .IP SSL_MODE_ASYNC 4
156 .IX Item "SSL_MODE_ASYNC"
157 Enable asynchronous processing. TLS I/O operations may indicate a retry with
158 SSL_ERROR_WANT_ASYNC with this mode set if an asynchronous capable engine is
159 used to perform cryptographic operations. See \fBSSL_get_error\fR\|(3).
160 .IP SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG 4
161 .IX Item "SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG"
162 Older versions of OpenSSL had a bug in the computation of the label length
163 used for computing the endpoint-pair shared secret. The bug was that the
164 terminating zero was included in the length of the label. Setting this option
165 enables this behaviour to allow interoperability with such broken
166 implementations. Please note that setting this option breaks interoperability
167 with correct implementations. This option only applies to DTLS over SCTP.
168 .PP
169 All modes are off by default except for SSL_MODE_AUTO_RETRY which is on by
170 default since 1.1.1.
171 .SH "RETURN VALUES"
172 .IX Header "RETURN VALUES"
173 \&\fBSSL_CTX_set_mode()\fR and \fBSSL_set_mode()\fR return the new mode bit-mask
174 after adding \fBmode\fR.
175 .PP
176 \&\fBSSL_CTX_get_mode()\fR and \fBSSL_get_mode()\fR return the current bit-mask.
177 .SH "SEE ALSO"
178 .IX Header "SEE ALSO"
179 \&\fBssl\fR\|(7), \fBSSL_read_ex\fR\|(3), \fBSSL_read\fR\|(3), \fBSSL_write_ex\fR\|(3) or
180 \&\fBSSL_write\fR\|(3), \fBSSL_get_error\fR\|(3)
181 .SH HISTORY
182 .IX Header "HISTORY"
183 SSL_MODE_ASYNC was added in OpenSSL 1.1.0.
184 .SH COPYRIGHT
185 .IX Header "COPYRIGHT"
186 Copyright 2001\-2023 The OpenSSL Project Authors. All Rights Reserved.
187 .PP
188 Licensed under the Apache License 2.0 (the "License"). You may not use
189 this file except in compliance with the License. You can obtain a copy
190 in the file LICENSE in the source distribution or at
191 <https://www.openssl.org/source/license.html>.