diff options
author | schwarze <> | 2021-10-24 15:10:13 +0000 |
---|---|---|
committer | schwarze <> | 2021-10-24 15:10:13 +0000 |
commit | 86484520bb9fdf67e7e47b29f0fed6ff22b63378 (patch) | |
tree | ab6e4a6859e452d35eeb3e6b83e50360a070a7e0 /src/lib/libssl/man/SSL_read.3 | |
parent | 05ad4b612f5c1f984f5d2f34e62751408dfaea72 (diff) | |
download | openbsd-86484520bb9fdf67e7e47b29f0fed6ff22b63378.tar.gz openbsd-86484520bb9fdf67e7e47b29f0fed6ff22b63378.tar.bz2 openbsd-86484520bb9fdf67e7e47b29f0fed6ff22b63378.zip |
merge documentation for SSL_read_ex(3), SSL_peek_ex(3), and SSL_write_ex(3)
from the OpenSSL 1.1.1 branch, which is still under a free license
Diffstat (limited to 'src/lib/libssl/man/SSL_read.3')
-rw-r--r-- | src/lib/libssl/man/SSL_read.3 | 66 |
1 files changed, 55 insertions, 11 deletions
diff --git a/src/lib/libssl/man/SSL_read.3 b/src/lib/libssl/man/SSL_read.3 index ea181ce15c..bb72a8ed82 100644 --- a/src/lib/libssl/man/SSL_read.3 +++ b/src/lib/libssl/man/SSL_read.3 | |||
@@ -1,6 +1,6 @@ | |||
1 | .\" $OpenBSD: SSL_read.3,v 1.7 2020/05/26 19:45:58 schwarze Exp $ | 1 | .\" $OpenBSD: SSL_read.3,v 1.8 2021/10/24 15:10:13 schwarze Exp $ |
2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 5a2443ae Nov 14 11:37:36 2016 +0000 |
3 | .\" partial merge up to: OpenSSL 18bad535 Apr 9 15:13:55 2019 +0100 | 3 | .\" partial merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 |
4 | .\" | 4 | .\" |
5 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and | 5 | .\" This file was written by Lutz Jaenicke <jaenicke@openssl.org> and |
6 | .\" Matt Caswell <matt@openssl.org>. | 6 | .\" Matt Caswell <matt@openssl.org>. |
@@ -51,38 +51,59 @@ | |||
51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
53 | .\" | 53 | .\" |
54 | .Dd $Mdocdate: May 26 2020 $ | 54 | .Dd $Mdocdate: October 24 2021 $ |
55 | .Dt SSL_READ 3 | 55 | .Dt SSL_READ 3 |
56 | .Os | 56 | .Os |
57 | .Sh NAME | 57 | .Sh NAME |
58 | .Nm SSL_read_ex , | ||
58 | .Nm SSL_read , | 59 | .Nm SSL_read , |
60 | .Nm SSL_peek_ex , | ||
59 | .Nm SSL_peek | 61 | .Nm SSL_peek |
60 | .Nd read bytes from a TLS connection | 62 | .Nd read bytes from a TLS connection |
61 | .Sh SYNOPSIS | 63 | .Sh SYNOPSIS |
62 | .In openssl/ssl.h | 64 | .In openssl/ssl.h |
63 | .Ft int | 65 | .Ft int |
66 | .Fn SSL_read_ex "SSL *ssl" "void *buf" "size_t num" "size_t *readbytes" | ||
67 | .Ft int | ||
64 | .Fn SSL_read "SSL *ssl" "void *buf" "int num" | 68 | .Fn SSL_read "SSL *ssl" "void *buf" "int num" |
65 | .Ft int | 69 | .Ft int |
70 | .Fn SSL_peek_ex "SSL *ssl" "void *buf" "size_t num" "size_t *readbytes" | ||
71 | .Ft int | ||
66 | .Fn SSL_peek "SSL *ssl" "void *buf" "int num" | 72 | .Fn SSL_peek "SSL *ssl" "void *buf" "int num" |
67 | .Sh DESCRIPTION | 73 | .Sh DESCRIPTION |
74 | .Fn SSL_read_ex | ||
75 | and | ||
68 | .Fn SSL_read | 76 | .Fn SSL_read |
69 | tries to read | 77 | try to read |
70 | .Fa num | 78 | .Fa num |
71 | bytes from the specified | 79 | bytes from the specified |
72 | .Fa ssl | 80 | .Fa ssl |
73 | into the buffer | 81 | into the buffer |
74 | .Fa buf . | 82 | .Fa buf . |
83 | On success | ||
84 | .Fn SSL_read_ex | ||
85 | stores the number of bytes actually read in | ||
86 | .Pf * Fa readbytes . | ||
75 | .Pp | 87 | .Pp |
88 | .Fn SSL_peek_ex | ||
89 | and | ||
76 | .Fn SSL_peek | 90 | .Fn SSL_peek |
77 | is identical to | 91 | are identical to |
78 | .Fn SSL_read | 92 | .Fn SSL_read_ex |
93 | and | ||
94 | .Fn SSL_read , | ||
95 | respectively, | ||
79 | except that no bytes are removed from the underlying BIO during | 96 | except that no bytes are removed from the underlying BIO during |
80 | the read, such that a subsequent call to | 97 | the read, such that a subsequent call to |
98 | .Fn SSL_read_ex | ||
99 | or | ||
81 | .Fn SSL_read | 100 | .Fn SSL_read |
82 | will yield at least the same bytes once again. | 101 | will yield at least the same bytes once again. |
83 | .Pp | 102 | .Pp |
84 | In the following, | 103 | In the following, |
85 | .Fn SSL_read | 104 | .Fn SSL_read_ex , |
105 | .Fn SSL_read , | ||
106 | .Fn SSL_peek_ex , | ||
86 | and | 107 | and |
87 | .Fn SSL_peek | 108 | .Fn SSL_peek |
88 | are called | 109 | are called |
@@ -107,11 +128,11 @@ or | |||
107 | .Xr SSL_set_accept_state 3 | 128 | .Xr SSL_set_accept_state 3 |
108 | before the first call to a read function. | 129 | before the first call to a read function. |
109 | .Pp | 130 | .Pp |
110 | The read functions works based on the TLS records. | 131 | The read functions work based on the TLS records. |
111 | The data are received in records (with a maximum record size of 16kB). | 132 | The data are received in records (with a maximum record size of 16kB). |
112 | Only when a record has been completely received, it can be processed | 133 | Only when a record has been completely received, it can be processed |
113 | (decrypted and checked for integrity). | 134 | (decrypted and checked for integrity). |
114 | Therefore data that was not retrieved at the last read call can | 135 | Therefore, data that was not retrieved at the last read call can |
115 | still be buffered inside the TLS layer and will be retrieved on the | 136 | still be buffered inside the TLS layer and will be retrieved on the |
116 | next read call. | 137 | next read call. |
117 | If | 138 | If |
@@ -182,7 +203,24 @@ or | |||
182 | .Dv SSL_ERROR_WANT_WRITE , | 203 | .Dv SSL_ERROR_WANT_WRITE , |
183 | it must be repeated with the same arguments. | 204 | it must be repeated with the same arguments. |
184 | .Sh RETURN VALUES | 205 | .Sh RETURN VALUES |
185 | The following return values can occur: | 206 | .Fn SSL_read_ex |
207 | and | ||
208 | .Fn SSL_peek_ex | ||
209 | return 1 for success or 0 for failure. | ||
210 | Success means that one or more application data bytes | ||
211 | have been read from the SSL connection. | ||
212 | Failure means that no bytes could be read from the SSL connection. | ||
213 | Failures can be retryable (e.g. we are waiting for more bytes to be | ||
214 | delivered by the network) or non-retryable (e.g. a fatal network error). | ||
215 | In the event of a failure, call | ||
216 | .Xr SSL_get_error 3 | ||
217 | to find out the reason which indicates whether the call is retryable or not. | ||
218 | .Pp | ||
219 | For | ||
220 | .Fn SSL_read | ||
221 | and | ||
222 | .Fn SSL_peek , | ||
223 | the following return values can occur: | ||
186 | .Bl -tag -width Ds | 224 | .Bl -tag -width Ds |
187 | .It >0 | 225 | .It >0 |
188 | The read operation was successful. | 226 | The read operation was successful. |
@@ -232,3 +270,9 @@ appeared in SSLeay 0.4 or earlier. | |||
232 | first appeared in SSLeay 0.6.6. | 270 | first appeared in SSLeay 0.6.6. |
233 | Both functions have been available since | 271 | Both functions have been available since |
234 | .Ox 2.4 . | 272 | .Ox 2.4 . |
273 | .Pp | ||
274 | .Fn SSL_read_ex | ||
275 | and | ||
276 | .Fn SSL_peek_ex | ||
277 | first appeared in OpenSSL 1.1.1 and have been available since | ||
278 | .Ox 7.1 . | ||