summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/man/BIO_read.372
1 files changed, 67 insertions, 5 deletions
diff --git a/src/lib/libcrypto/man/BIO_read.3 b/src/lib/libcrypto/man/BIO_read.3
index ac809bc782..5fea9f728a 100644
--- a/src/lib/libcrypto/man/BIO_read.3
+++ b/src/lib/libcrypto/man/BIO_read.3
@@ -1,10 +1,10 @@
1.\" $OpenBSD: BIO_read.3,v 1.10 2021/12/08 16:31:10 schwarze Exp $ 1.\" $OpenBSD: BIO_read.3,v 1.11 2022/12/18 17:40:55 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license: 5.\" The changes are covered by the following Copyright and license:
6.\" 6.\"
7.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> 7.\" Copyright (c) 2021, 2022 Ingo Schwarze <schwarze@openbsd.org>
8.\" 8.\"
9.\" Permission to use, copy, modify, and distribute this software for any 9.\" Permission to use, copy, modify, and distribute this software for any
10.\" purpose with or without fee is hereby granted, provided that the above 10.\" purpose with or without fee is hereby granted, provided that the above
@@ -65,15 +65,17 @@
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: December 8 2021 $ 68.Dd $Mdocdate: December 18 2022 $
69.Dt BIO_READ 3 69.Dt BIO_READ 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
72.Nm BIO_read , 72.Nm BIO_read ,
73.Nm BIO_number_read ,
73.Nm BIO_gets , 74.Nm BIO_gets ,
74.Nm BIO_write , 75.Nm BIO_write ,
75.Nm BIO_puts , 76.Nm BIO_puts ,
76.Nm BIO_indent 77.Nm BIO_indent ,
78.Nm BIO_number_written
77.Nd BIO I/O functions 79.Nd BIO I/O functions
78.Sh SYNOPSIS 80.Sh SYNOPSIS
79.In openssl/bio.h 81.In openssl/bio.h
@@ -83,6 +85,10 @@
83.Fa "void *buf" 85.Fa "void *buf"
84.Fa "int len" 86.Fa "int len"
85.Fc 87.Fc
88.Ft unsigned long
89.Fo BIO_number_read
90.Fa "BIO *b"
91.Fc
86.Ft int 92.Ft int
87.Fo BIO_gets 93.Fo BIO_gets
88.Fa "BIO *b" 94.Fa "BIO *b"
@@ -106,6 +112,10 @@
106.Fa "int indent" 112.Fa "int indent"
107.Fa "int max" 113.Fa "int max"
108.Fc 114.Fc
115.Ft unsigned long
116.Fo BIO_number_written
117.Fa "BIO *b"
118.Fc
109.Sh DESCRIPTION 119.Sh DESCRIPTION
110.Fn BIO_read 120.Fn BIO_read
111attempts to read 121attempts to read
@@ -115,6 +125,26 @@ bytes from
115and places the data in 125and places the data in
116.Fa buf . 126.Fa buf .
117.Pp 127.Pp
128.Fn BIO_number_read
129returns the grand total of bytes read from
130.Fa b
131using
132.Fn BIO_read
133so far.
134Bytes read with
135.Fn BIO_gets
136do
137.Sy not
138count.
139.Xr BIO_new 3
140and
141.Xr BIO_set 3
142initialize the counter to 0.
143When reading very large amounts of data,
144the counter will eventually wrap around from
145.Dv ULONG_MAX
146to 0.
147.Pp
118.Fn BIO_gets 148.Fn BIO_gets
119performs the BIOs "gets" operation and places the data in 149performs the BIOs "gets" operation and places the data in
120.Fa buf . 150.Fa buf .
@@ -152,6 +182,24 @@ but not more than
152.Fa max 182.Fa max
153characters. 183characters.
154.Pp 184.Pp
185.Fn BIO_number_written
186returns the grand total of bytes written to
187.Fa b
188using
189.Fn BIO_write ,
190.Fn BIO_puts ,
191and
192.Fn BIO_indent
193so far.
194.Xr BIO_new 3
195and
196.Xr BIO_set 3
197initialize the counter to 0.
198When writing very large amounts of data,
199the counter will eventually wrap around from
200.Dv ULONG_MAX
201to 0.
202.Pp
155One technique sometimes used with blocking sockets 203One technique sometimes used with blocking sockets
156is to use a system call (such as 204is to use a system call (such as
157.Xr select 2 , 205.Xr select 2 ,
@@ -189,6 +237,15 @@ to the chain.
189returns 1 if successful, even if nothing was written, 237returns 1 if successful, even if nothing was written,
190or 0 if writing fails. 238or 0 if writing fails.
191.Pp 239.Pp
240.Fn BIO_number_read
241and
242.Fn BIO_number_written
243return a number of bytes or 0 if
244.Fa b
245is a
246.Dv NULL
247pointer.
248.Pp
192The other functions return either the amount of data successfully 249The other functions return either the amount of data successfully
193read or written (if the return value is positive) or that no data 250read or written (if the return value is positive) or that no data
194was successfully read or written if the result is 0 or \-1. 251was successfully read or written if the result is 0 or \-1.
@@ -211,7 +268,12 @@ the application should retry the operation later.
211.Fn BIO_write , 268.Fn BIO_write ,
212and 269and
213.Fn BIO_puts 270.Fn BIO_puts
214first appeared in SSLeay 0.6.0 and have been available since 271first appeared in SSLeay 0.6.0.
272.Fn BIO_number_read
273and
274.Fn BIO_number_written
275first appeared in SSLeay 0.6.5.
276These functions have been available since
215.Ox 2.4 . 277.Ox 2.4 .
216.Pp 278.Pp
217.Fn BIO_indent 279.Fn BIO_indent