diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libssl/man/SSL_write.3 | 249 |
1 files changed, 0 insertions, 249 deletions
diff --git a/src/lib/libssl/man/SSL_write.3 b/src/lib/libssl/man/SSL_write.3 deleted file mode 100644 index 2c6fbcef08..0000000000 --- a/src/lib/libssl/man/SSL_write.3 +++ /dev/null | |||
@@ -1,249 +0,0 @@ | |||
1 | .\" $OpenBSD: SSL_write.3,v 1.7 2021/10/24 15:10:13 schwarze Exp $ | ||
2 | .\" full merge up to: OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | ||
3 | .\" partial merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 | ||
4 | .\" | ||
5 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> | ||
6 | .\" and Matt Caswell <matt@openssl.org>. | ||
7 | .\" Copyright (c) 2000, 2001, 2002, 2016 The OpenSSL Project. | ||
8 | .\" All rights reserved. | ||
9 | .\" | ||
10 | .\" Redistribution and use in source and binary forms, with or without | ||
11 | .\" modification, are permitted provided that the following conditions | ||
12 | .\" are met: | ||
13 | .\" | ||
14 | .\" 1. Redistributions of source code must retain the above copyright | ||
15 | .\" notice, this list of conditions and the following disclaimer. | ||
16 | .\" | ||
17 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
18 | .\" notice, this list of conditions and the following disclaimer in | ||
19 | .\" the documentation and/or other materials provided with the | ||
20 | .\" distribution. | ||
21 | .\" | ||
22 | .\" 3. All advertising materials mentioning features or use of this | ||
23 | .\" software must display the following acknowledgment: | ||
24 | .\" "This product includes software developed by the OpenSSL Project | ||
25 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
26 | .\" | ||
27 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
28 | .\" endorse or promote products derived from this software without | ||
29 | .\" prior written permission. For written permission, please contact | ||
30 | .\" openssl-core@openssl.org. | ||
31 | .\" | ||
32 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
33 | .\" nor may "OpenSSL" appear in their names without prior written | ||
34 | .\" permission of the OpenSSL Project. | ||
35 | .\" | ||
36 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
37 | .\" acknowledgment: | ||
38 | .\" "This product includes software developed by the OpenSSL Project | ||
39 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
40 | .\" | ||
41 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
42 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
44 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
45 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
46 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
47 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
48 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
49 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
50 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
53 | .\" | ||
54 | .Dd $Mdocdate: October 24 2021 $ | ||
55 | .Dt SSL_WRITE 3 | ||
56 | .Os | ||
57 | .Sh NAME | ||
58 | .Nm SSL_write_ex , | ||
59 | .Nm SSL_write | ||
60 | .Nd write bytes to a TLS connection | ||
61 | .Sh SYNOPSIS | ||
62 | .In openssl/ssl.h | ||
63 | .Ft int | ||
64 | .Fn SSL_write_ex "SSL *ssl" "const void *buf" "size_t num" "size_t *written" | ||
65 | .Ft int | ||
66 | .Fn SSL_write "SSL *ssl" "const void *buf" "int num" | ||
67 | .Sh DESCRIPTION | ||
68 | .Fn SSL_write_ex | ||
69 | and | ||
70 | .Fn SSL_write | ||
71 | write | ||
72 | .Fa num | ||
73 | bytes from the buffer | ||
74 | .Fa buf | ||
75 | into the specified | ||
76 | .Fa ssl | ||
77 | connection. | ||
78 | On success | ||
79 | .Fn SSL_write_ex | ||
80 | stores the number of bytes written in | ||
81 | .Pf * Fa written . | ||
82 | .Pp | ||
83 | In the following, | ||
84 | .Fn SSL_write_ex | ||
85 | and | ||
86 | .Fn SSL_write | ||
87 | are called | ||
88 | .Dq write functions . | ||
89 | .Pp | ||
90 | If necessary, a write function negotiates a TLS session, | ||
91 | if not already explicitly performed by | ||
92 | .Xr SSL_connect 3 | ||
93 | or | ||
94 | .Xr SSL_accept 3 . | ||
95 | If the peer requests a re-negotiation, | ||
96 | it will be performed transparently during the | ||
97 | write function operation. | ||
98 | The behaviour of the write functions depends on the underlying | ||
99 | .Vt BIO . | ||
100 | .Pp | ||
101 | For the transparent negotiation to succeed, the | ||
102 | .Fa ssl | ||
103 | must have been initialized to client or server mode. | ||
104 | This is done by calling | ||
105 | .Xr SSL_set_connect_state 3 | ||
106 | or | ||
107 | .Xr SSL_set_accept_state 3 | ||
108 | before the first call to a write function. | ||
109 | .Pp | ||
110 | If the underlying | ||
111 | .Vt BIO | ||
112 | is | ||
113 | .Em blocking , | ||
114 | the write function | ||
115 | will only return once the write operation has been finished or an error | ||
116 | occurred, except when a renegotiation takes place, in which case a | ||
117 | .Dv SSL_ERROR_WANT_READ | ||
118 | may occur. | ||
119 | This behaviour can be controlled with the | ||
120 | .Dv SSL_MODE_AUTO_RETRY | ||
121 | flag of the | ||
122 | .Xr SSL_CTX_set_mode 3 | ||
123 | call. | ||
124 | .Pp | ||
125 | If the underlying | ||
126 | .Vt BIO | ||
127 | is | ||
128 | .Em non-blocking , | ||
129 | the write function will also return when the underlying | ||
130 | .Vt BIO | ||
131 | could not satisfy the needs of the function to continue the operation. | ||
132 | In this case a call to | ||
133 | .Xr SSL_get_error 3 | ||
134 | with the return value of the write function will yield | ||
135 | .Dv SSL_ERROR_WANT_READ | ||
136 | or | ||
137 | .Dv SSL_ERROR_WANT_WRITE . | ||
138 | As at any time a re-negotiation is possible, a call to | ||
139 | a write function can also cause read operations. | ||
140 | The calling process then must repeat the call after taking appropriate action | ||
141 | to satisfy the needs of the write function. | ||
142 | The action depends on the underlying | ||
143 | .Vt BIO . | ||
144 | When using a non-blocking socket, nothing is to be done, but | ||
145 | .Xr select 2 | ||
146 | can be used to check for the required condition. | ||
147 | When using a buffering | ||
148 | .Vt BIO , | ||
149 | like a | ||
150 | .Vt BIO | ||
151 | pair, data must be written into or retrieved out of the BIO before being able | ||
152 | to continue. | ||
153 | .Pp | ||
154 | The write functions | ||
155 | will only return with success when the complete contents of | ||
156 | .Fa buf | ||
157 | of length | ||
158 | .Fa num | ||
159 | have been written. | ||
160 | This default behaviour can be changed with the | ||
161 | .Dv SSL_MODE_ENABLE_PARTIAL_WRITE | ||
162 | option of | ||
163 | .Xr SSL_CTX_set_mode 3 . | ||
164 | When this flag is set, the write functions will also return with | ||
165 | success when a partial write has been successfully completed. | ||
166 | In this case the write function operation is considered completed. | ||
167 | The bytes are sent and a new write call with a new buffer (with the | ||
168 | already sent bytes removed) must be started. | ||
169 | A partial write is performed with the size of a message block, | ||
170 | which is 16kB. | ||
171 | .Pp | ||
172 | When a write function call has to be repeated because | ||
173 | .Xr SSL_get_error 3 | ||
174 | returned | ||
175 | .Dv SSL_ERROR_WANT_READ | ||
176 | or | ||
177 | .Dv SSL_ERROR_WANT_WRITE , | ||
178 | it must be repeated with the same arguments. | ||
179 | .Pp | ||
180 | When calling | ||
181 | .Fn SSL_write | ||
182 | with | ||
183 | .Fa num Ns =0 | ||
184 | bytes to be sent, the behaviour is undefined. | ||
185 | .Fn SSL_write_ex | ||
186 | can be called with | ||
187 | .Fa num Ns =0 , | ||
188 | but will not send application data to the peer. | ||
189 | .Sh RETURN VALUES | ||
190 | .Fn SSL_write_ex | ||
191 | returns 1 for success or 0 for failure. | ||
192 | Success means that all requested application data bytes have been | ||
193 | written to the TLS connection or, if | ||
194 | .Dv SSL_MODE_ENABLE_PARTIAL_WRITE | ||
195 | is in use, at least one application data byte has been written | ||
196 | to the TLS connection. | ||
197 | Failure means that not all the requested bytes have been written yet (if | ||
198 | .Dv SSL_MODE_ENABLE_PARTIAL_WRITE | ||
199 | is not in use) or no bytes could be written to the TLS connection (if | ||
200 | .Dv SSL_MODE_ENABLE_PARTIAL_WRITE | ||
201 | is in use). | ||
202 | Failures can be retryable (e.g. the network write buffer has temporarily | ||
203 | filled up) or non-retryable (e.g. a fatal network error). | ||
204 | In the event of a failure, call | ||
205 | .Xr SSL_get_error 3 | ||
206 | to find out the reason | ||
207 | which indicates whether the call is retryable or not. | ||
208 | .Pp | ||
209 | For | ||
210 | .Fn SSL_write , | ||
211 | the following return values can occur: | ||
212 | .Bl -tag -width Ds | ||
213 | .It >0 | ||
214 | The write operation was successful. | ||
215 | The return value is the number of bytes actually written to the TLS | ||
216 | connection. | ||
217 | .It 0 | ||
218 | The write operation was not successful. | ||
219 | Probably the underlying connection was closed. | ||
220 | Call | ||
221 | .Xr SSL_get_error 3 | ||
222 | with the return value to find out whether an error occurred or the connection | ||
223 | was shut down cleanly | ||
224 | .Pq Dv SSL_ERROR_ZERO_RETURN . | ||
225 | .It <0 | ||
226 | The write operation was not successful, because either an error occurred or | ||
227 | action must be taken by the calling process. | ||
228 | Call | ||
229 | .Xr SSL_get_error 3 | ||
230 | with the return value to find out the reason. | ||
231 | .El | ||
232 | .Sh SEE ALSO | ||
233 | .Xr BIO_new 3 , | ||
234 | .Xr ssl 3 , | ||
235 | .Xr SSL_accept 3 , | ||
236 | .Xr SSL_connect 3 , | ||
237 | .Xr SSL_CTX_new 3 , | ||
238 | .Xr SSL_CTX_set_mode 3 , | ||
239 | .Xr SSL_get_error 3 , | ||
240 | .Xr SSL_read 3 , | ||
241 | .Xr SSL_set_connect_state 3 | ||
242 | .Sh HISTORY | ||
243 | .Fn SSL_write | ||
244 | appeared in SSLeay 0.4 or earlier and has been available since | ||
245 | .Ox 2.4 . | ||
246 | .Pp | ||
247 | .Fn SSL_write_ex | ||
248 | first appeared in OpenSSL 1.1.1 and has been available since | ||
249 | .Ox 7.1 . | ||