summaryrefslogtreecommitdiff
path: root/src/lib/libssl/man/SSL_read.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/man/SSL_read.3')
-rw-r--r--src/lib/libssl/man/SSL_read.366
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
75and
68.Fn SSL_read 76.Fn SSL_read
69tries to read 77try to read
70.Fa num 78.Fa num
71bytes from the specified 79bytes from the specified
72.Fa ssl 80.Fa ssl
73into the buffer 81into the buffer
74.Fa buf . 82.Fa buf .
83On success
84.Fn SSL_read_ex
85stores the number of bytes actually read in
86.Pf * Fa readbytes .
75.Pp 87.Pp
88.Fn SSL_peek_ex
89and
76.Fn SSL_peek 90.Fn SSL_peek
77is identical to 91are identical to
78.Fn SSL_read 92.Fn SSL_read_ex
93and
94.Fn SSL_read ,
95respectively,
79except that no bytes are removed from the underlying BIO during 96except that no bytes are removed from the underlying BIO during
80the read, such that a subsequent call to 97the read, such that a subsequent call to
98.Fn SSL_read_ex
99or
81.Fn SSL_read 100.Fn SSL_read
82will yield at least the same bytes once again. 101will yield at least the same bytes once again.
83.Pp 102.Pp
84In the following, 103In the following,
85.Fn SSL_read 104.Fn SSL_read_ex ,
105.Fn SSL_read ,
106.Fn SSL_peek_ex ,
86and 107and
87.Fn SSL_peek 108.Fn SSL_peek
88are called 109are called
@@ -107,11 +128,11 @@ or
107.Xr SSL_set_accept_state 3 128.Xr SSL_set_accept_state 3
108before the first call to a read function. 129before the first call to a read function.
109.Pp 130.Pp
110The read functions works based on the TLS records. 131The read functions work based on the TLS records.
111The data are received in records (with a maximum record size of 16kB). 132The data are received in records (with a maximum record size of 16kB).
112Only when a record has been completely received, it can be processed 133Only when a record has been completely received, it can be processed
113(decrypted and checked for integrity). 134(decrypted and checked for integrity).
114Therefore data that was not retrieved at the last read call can 135Therefore, data that was not retrieved at the last read call can
115still be buffered inside the TLS layer and will be retrieved on the 136still be buffered inside the TLS layer and will be retrieved on the
116next read call. 137next read call.
117If 138If
@@ -182,7 +203,24 @@ or
182.Dv SSL_ERROR_WANT_WRITE , 203.Dv SSL_ERROR_WANT_WRITE ,
183it must be repeated with the same arguments. 204it must be repeated with the same arguments.
184.Sh RETURN VALUES 205.Sh RETURN VALUES
185The following return values can occur: 206.Fn SSL_read_ex
207and
208.Fn SSL_peek_ex
209return 1 for success or 0 for failure.
210Success means that one or more application data bytes
211have been read from the SSL connection.
212Failure means that no bytes could be read from the SSL connection.
213Failures can be retryable (e.g. we are waiting for more bytes to be
214delivered by the network) or non-retryable (e.g. a fatal network error).
215In the event of a failure, call
216.Xr SSL_get_error 3
217to find out the reason which indicates whether the call is retryable or not.
218.Pp
219For
220.Fn SSL_read
221and
222.Fn SSL_peek ,
223the following return values can occur:
186.Bl -tag -width Ds 224.Bl -tag -width Ds
187.It >0 225.It >0
188The read operation was successful. 226The read operation was successful.
@@ -232,3 +270,9 @@ appeared in SSLeay 0.4 or earlier.
232first appeared in SSLeay 0.6.6. 270first appeared in SSLeay 0.6.6.
233Both functions have been available since 271Both functions have been available since
234.Ox 2.4 . 272.Ox 2.4 .
273.Pp
274.Fn SSL_read_ex
275and
276.Fn SSL_peek_ex
277first appeared in OpenSSL 1.1.1 and have been available since
278.Ox 7.1 .