summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man
diff options
context:
space:
mode:
authorjmc <>2016-11-07 15:52:47 +0000
committerjmc <>2016-11-07 15:52:47 +0000
commit94a8013c0e6b484829cc3c8b697578760ad01405 (patch)
tree8e0eba7cbf154c12c52f4456e7f1e277c6e71d31 /src/lib/libcrypto/man
parente638403f591087e1ef609e3bc88e3028a97af60e (diff)
downloadopenbsd-94a8013c0e6b484829cc3c8b697578760ad01405.tar.gz
openbsd-94a8013c0e6b484829cc3c8b697578760ad01405.tar.bz2
openbsd-94a8013c0e6b484829cc3c8b697578760ad01405.zip
various cleanup;
Diffstat (limited to 'src/lib/libcrypto/man')
-rw-r--r--src/lib/libcrypto/man/BIO.311
-rw-r--r--src/lib/libcrypto/man/BIO_ctrl.343
-rw-r--r--src/lib/libcrypto/man/BIO_f_base64.314
-rw-r--r--src/lib/libcrypto/man/BIO_f_buffer.312
-rw-r--r--src/lib/libcrypto/man/BIO_f_cipher.36
-rw-r--r--src/lib/libcrypto/man/BIO_f_md.314
-rw-r--r--src/lib/libcrypto/man/BIO_f_null.37
-rw-r--r--src/lib/libcrypto/man/BIO_find_type.312
-rw-r--r--src/lib/libcrypto/man/BIO_new.336
-rw-r--r--src/lib/libcrypto/man/BIO_push.342
-rw-r--r--src/lib/libcrypto/man/BIO_read.330
-rw-r--r--src/lib/libcrypto/man/BIO_s_accept.328
-rw-r--r--src/lib/libcrypto/man/BIO_s_bio.336
-rw-r--r--src/lib/libcrypto/man/BIO_s_connect.324
-rw-r--r--src/lib/libcrypto/man/BIO_s_fd.38
-rw-r--r--src/lib/libcrypto/man/BIO_s_file.310
-rw-r--r--src/lib/libcrypto/man/BIO_s_mem.312
-rw-r--r--src/lib/libcrypto/man/BIO_s_null.38
-rw-r--r--src/lib/libcrypto/man/BIO_s_socket.36
-rw-r--r--src/lib/libcrypto/man/BIO_set_callback.313
-rw-r--r--src/lib/libcrypto/man/BIO_should_retry.321
21 files changed, 193 insertions, 200 deletions
diff --git a/src/lib/libcrypto/man/BIO.3 b/src/lib/libcrypto/man/BIO.3
index f3a419721f..89b51720a6 100644
--- a/src/lib/libcrypto/man/BIO.3
+++ b/src/lib/libcrypto/man/BIO.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO.3,v 1.3 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO.3,v 1.4 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO 3 4.Dt BIO 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -10,14 +10,14 @@
10.In openssl/bio.h 10.In openssl/bio.h
11.Sh DESCRIPTION 11.Sh DESCRIPTION
12A BIO is an I/O abstraction, 12A BIO is an I/O abstraction,
13it hides many of the underlying I/O details from an application. 13hiding many of the underlying I/O details from an application.
14If an application uses a BIO for its I/O, it can transparently handle 14If an application uses a BIO for its I/O, it can transparently handle
15SSL connections, unencrypted network connections and file I/O. 15SSL connections, unencrypted network connections and file I/O.
16.Pp 16.Pp
17There are two types of BIO, a source/sink BIO and a filter BIO. 17There are two types of BIO, a source/sink BIO and a filter BIO.
18.Pp 18.Pp
19As its name implies, a source/sink BIO is a source and/or sink of data, 19As its name implies, a source/sink BIO is a source and/or sink of data.
20examples include a socket BIO and a file BIO. 20Examples include a socket BIO and a file BIO.
21.Pp 21.Pp
22A filter BIO takes data from one BIO and passes it through 22A filter BIO takes data from one BIO and passes it through
23to another, or to the application. 23to another, or to the application.
@@ -43,7 +43,6 @@ to the end (normally a source/sink BIO).
43.Xr BIO_f_ssl 3 , 43.Xr BIO_f_ssl 3 ,
44.Xr BIO_find_type 3 , 44.Xr BIO_find_type 3 ,
45.Xr BIO_new 3 , 45.Xr BIO_new 3 ,
46.Xr BIO_new_bio_pair 3 ,
47.Xr BIO_push 3 , 46.Xr BIO_push 3 ,
48.Xr BIO_read 3 , 47.Xr BIO_read 3 ,
49.Xr BIO_s_accept 3 , 48.Xr BIO_s_accept 3 ,
diff --git a/src/lib/libcrypto/man/BIO_ctrl.3 b/src/lib/libcrypto/man/BIO_ctrl.3
index 391158bd42..6557d10730 100644
--- a/src/lib/libcrypto/man/BIO_ctrl.3
+++ b/src/lib/libcrypto/man/BIO_ctrl.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_ctrl.3,v 1.3 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_ctrl.3,v 1.4 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_CTRL 3 4.Dt BIO_CTRL 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -122,16 +122,17 @@
122and 122and
123.Fn BIO_int_ctrl 123.Fn BIO_int_ctrl
124are BIO "control" operations taking arguments of various types. 124are BIO "control" operations taking arguments of various types.
125These functions are not normally called directly, 125These functions are not normally called directly -
126various macros are used instead. 126various macros are used instead.
127The standard macros are described below, macros specific to a 127The standard macros are described below.
128particular type of BIO are described in the specific BIO's manual 128Macros specific to a particular type of BIO
129page as well as any special features of the standard calls. 129are described in the specific BIO's manual page
130as well as any special features of the standard calls.
130.Pp 131.Pp
131.Fn BIO_reset 132.Fn BIO_reset
132typically resets a BIO to some initial state, in the case 133typically resets a BIO to some initial state.
133of file related BIOs for example it rewinds the file pointer 134In the case of file related BIOs, for example,
134to the start of the file. 135it rewinds the file pointer to the start of the file.
135.Pp 136.Pp
136.Fn BIO_seek 137.Fn BIO_seek
137resets a file related BIO's (that is file descriptor and 138resets a file related BIO's (that is file descriptor and
@@ -143,12 +144,12 @@ bytes from start of file.
143returns the current file position of a file related BIO. 144returns the current file position of a file related BIO.
144.Pp 145.Pp
145.Fn BIO_flush 146.Fn BIO_flush
146normally writes out any internally buffered data, in some cases 147normally writes out any internally buffered data.
147it is used to signal EOF and that no more data will be written. 148In some cases it is used to signal EOF and that no more data will be written.
148.Pp 149.Pp
149.Fn BIO_eof 150.Fn BIO_eof
150returns 1 if the BIO has read EOF, the precise meaning of 151returns 1 if the BIO has read EOF.
151"EOF" varies according to the BIO type. 152The precise meaning of "EOF" varies according to the BIO type.
152.Pp 153.Pp
153.Fn BIO_set_close 154.Fn BIO_set_close
154sets the BIO 155sets the BIO
@@ -180,7 +181,7 @@ and
180.Fn BIO_ctrl_wpending 181.Fn BIO_ctrl_wpending
181return a 182return a
182.Vt size_t 183.Vt size_t
183type and are functions, 184type and are functions.
184.Fn BIO_pending 185.Fn BIO_pending
185and 186and
186.Fn BIO_wpending 187.Fn BIO_wpending
@@ -189,7 +190,7 @@ are macros which call
189.Sh RETURN VALUES 190.Sh RETURN VALUES
190.Fn BIO_reset 191.Fn BIO_reset
191normally returns 1 for success and 0 or -1 for failure. 192normally returns 1 for success and 0 or -1 for failure.
192File BIOs are an exception, they return 0 for success and -1 for failure. 193File BIOs are an exception, returning 0 for success and -1 for failure.
193.Pp 194.Pp
194.Fn BIO_seek 195.Fn BIO_seek
195and 196and
@@ -203,7 +204,7 @@ always return 0 for success and -1 for failure.
203returns 1 for success and 0 or -1 for failure. 204returns 1 for success and 0 or -1 for failure.
204.Pp 205.Pp
205.Fn BIO_eof 206.Fn BIO_eof
206returns 1 if EOF has been reached 0 otherwise. 207returns 1 if EOF has been reached or 0 otherwise.
207.Pp 208.Pp
208.Fn BIO_set_close 209.Fn BIO_set_close
209always returns 1. 210always returns 1.
@@ -228,7 +229,7 @@ in a similar manner to
228.Fn BIO_write . 229.Fn BIO_write .
229The 230The
230.Fn BIO_should_retry 231.Fn BIO_should_retry
231call should be used and appropriate action taken is the call fails. 232call should be used and appropriate action taken if the call fails.
232.Pp 233.Pp
233The return values of 234The return values of
234.Fn BIO_pending 235.Fn BIO_pending
@@ -238,7 +239,7 @@ may not reliably determine the amount of pending data in all cases.
238For example in the case of a file BIO some data may be available in the 239For example in the case of a file BIO some data may be available in the
239.Vt FILE 240.Vt FILE
240structure's internal buffers but it is not possible 241structure's internal buffers but it is not possible
241to determine this in a portably way. 242to determine this in a portable way.
242For other types of BIO they may not be supported. 243For other types of BIO they may not be supported.
243.Pp 244.Pp
244If they do not internally handle a particular 245If they do not internally handle a particular
@@ -246,10 +247,10 @@ If they do not internally handle a particular
246operation, filter BIOs usually pass the operation 247operation, filter BIOs usually pass the operation
247to the next BIO in the chain. 248to the next BIO in the chain.
248This often means there is no need to locate the required BIO for 249This often means there is no need to locate the required BIO for
249a particular operation, it can be called on a chain and it will 250a particular operation: it can be called on a chain and it will
250be automatically passed to the relevant BIO. 251be automatically passed to the relevant BIO.
251However this can cause unexpected results: 252However this can cause unexpected results.
252for example no current filter BIOs implement 253For example no current filter BIOs implement
253.Fn BIO_seek , 254.Fn BIO_seek ,
254but this may still succeed if the chain ends 255but this may still succeed if the chain ends
255in a FILE or file descriptor BIO. 256in a FILE or file descriptor BIO.
diff --git a/src/lib/libcrypto/man/BIO_f_base64.3 b/src/lib/libcrypto/man/BIO_f_base64.3
index d86a2e0daa..5051ad14b8 100644
--- a/src/lib/libcrypto/man/BIO_f_base64.3
+++ b/src/lib/libcrypto/man/BIO_f_base64.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_f_base64.3,v 1.3 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_f_base64.3,v 1.4 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_F_BASE64 3 4.Dt BIO_F_BASE64 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -32,10 +32,10 @@ this is used to flush the final block through the BIO.
32The flag 32The flag
33.Dv BIO_FLAGS_BASE64_NO_NL 33.Dv BIO_FLAGS_BASE64_NO_NL
34can be set with 34can be set with
35.Xr BIO_set_flags 3 35.Fn BIO_set_flags
36to encode the data all on one line 36to encode the data all on one line
37or expect the data to be all on one line. 37or expect the data to be all on one line.
38.Sh NOTES 38.Pp
39Because of the format of base64 encoding the end of the encoded 39Because of the format of base64 encoding the end of the encoded
40block cannot always be reliably determined. 40block cannot always be reliably determined.
41.Sh RETURN VALUES 41.Sh RETURN VALUES
@@ -57,7 +57,7 @@ BIO_flush(b64);
57BIO_free_all(b64); 57BIO_free_all(b64);
58.Ed 58.Ed
59.Pp 59.Pp
60Read Base64 encoded data from standard input 60Read Base64-encoded data from standard input
61and write the decoded data to standard output: 61and write the decoded data to standard output:
62.Bd -literal -offset indent 62.Bd -literal -offset indent
63BIO *bio, *b64, *bio_out; 63BIO *bio, *b64, *bio_out;
@@ -75,8 +75,8 @@ BIO_flush(bio_out);
75BIO_free_all(b64); 75BIO_free_all(b64);
76.Ed 76.Ed
77.Sh BUGS 77.Sh BUGS
78The ambiguity of EOF in base64 encoded data can cause additional 78The ambiguity of EOF in base64-encoded data can cause additional
79data following the base64 encoded block to be misinterpreted. 79data following the base64-encoded block to be misinterpreted.
80.Pp 80.Pp
81There should be some way of specifying a test that the BIO can perform 81There should be some way of specifying a test that the BIO can perform
82to reliably determine EOF (for example a MIME boundary). 82to reliably determine EOF (for example a MIME boundary).
diff --git a/src/lib/libcrypto/man/BIO_f_buffer.3 b/src/lib/libcrypto/man/BIO_f_buffer.3
index 785934d553..c673fe535e 100644
--- a/src/lib/libcrypto/man/BIO_f_buffer.3
+++ b/src/lib/libcrypto/man/BIO_f_buffer.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_f_buffer.3,v 1.3 2015/11/11 22:14:39 jmc Exp $ 1.\" $OpenBSD: BIO_f_buffer.3,v 1.4 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 11 2015 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_F_BUFFER 3 4.Dt BIO_F_BUFFER 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -72,16 +72,16 @@ bytes of
72If 72If
73.Fa num 73.Fa num
74is larger than the current buffer size the buffer is expanded. 74is larger than the current buffer size the buffer is expanded.
75.Sh NOTES 75.Pp
76Buffering BIOs implement 76Buffering BIOs implement
77.Xr BIO_gets 3 77.Xr BIO_gets 3
78by using 78by using
79.Xr BIO_read 3 79.Xr BIO_read 3
80operations on the next BIO in the chain. 80operations on the next BIO in the chain.
81By prepending a buffering BIO to a chain 81By prepending a buffering BIO to a chain
82it is therefore possible to provide 82it is therefore possible to provide the functionality of
83.Xr BIO_gets 3 83.Xr BIO_gets 3
84functionality if the following BIOs do not support it (for example SSL BIOs). 84if the following BIOs do not support it (for example SSL BIOs).
85.Pp 85.Pp
86Data is only written to the next BIO in the chain 86Data is only written to the next BIO in the chain
87when the write buffer fills or when 87when the write buffer fills or when
@@ -93,7 +93,7 @@ whenever any pending data should be written
93such as when removing a buffering BIO using 93such as when removing a buffering BIO using
94.Xr BIO_pop 3 . 94.Xr BIO_pop 3 .
95.Xr BIO_flush 3 95.Xr BIO_flush 3
96may need to be retried if the ultimate source/sink BIO is non blocking. 96may need to be retried if the ultimate source/sink BIO is non-blocking.
97.Sh RETURN VALUES 97.Sh RETURN VALUES
98.Fn BIO_f_buffer 98.Fn BIO_f_buffer
99returns the buffering BIO method. 99returns the buffering BIO method.
diff --git a/src/lib/libcrypto/man/BIO_f_cipher.3 b/src/lib/libcrypto/man/BIO_f_cipher.3
index 4ecde4f69d..b6a7cb1ab9 100644
--- a/src/lib/libcrypto/man/BIO_f_cipher.3
+++ b/src/lib/libcrypto/man/BIO_f_cipher.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_f_cipher.3,v 1.3 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_f_cipher.3,v 1.4 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_F_CIPHER 3 4.Dt BIO_F_CIPHER 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -83,7 +83,7 @@ with the standard cipher routines to set it up.
83This is useful when 83This is useful when
84.Fn BIO_set_cipher 84.Fn BIO_set_cipher
85is not flexible enough for the applications needs. 85is not flexible enough for the applications needs.
86.Sh NOTES 86.Pp
87When encrypting, 87When encrypting,
88.Xr BIO_flush 3 88.Xr BIO_flush 3
89must be called to flush the final block through the BIO. 89must be called to flush the final block through the BIO.
diff --git a/src/lib/libcrypto/man/BIO_f_md.3 b/src/lib/libcrypto/man/BIO_f_md.3
index 3b3f1de329..8514883943 100644
--- a/src/lib/libcrypto/man/BIO_f_md.3
+++ b/src/lib/libcrypto/man/BIO_f_md.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_f_md.3,v 1.3 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_f_md.3,v 1.4 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_F_MD 3 4.Dt BIO_F_MD 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -80,7 +80,7 @@ macro.
80.Fn BIO_get_md_ctx 80.Fn BIO_get_md_ctx
81returns the digest BIOs context in 81returns the digest BIOs context in
82.Fa mdcp . 82.Fa mdcp .
83.Sh NOTES 83.Pp
84The context returned by 84The context returned by
85.Fn BIO_get_md_ctx 85.Fn BIO_get_md_ctx
86can be used in calls to 86can be used in calls to
@@ -112,10 +112,10 @@ then this can be done by prepending a buffering BIO.
112.Pp 112.Pp
113Before OpenSSL 1.0.0 the call to 113Before OpenSSL 1.0.0 the call to
114.Fn BIO_get_md_ctx 114.Fn BIO_get_md_ctx
115would only work if the BIO had been initialized for example by calling 115would only work if the BIO had been initialized, for example by calling
116.Fn BIO_set_md . 116.Fn BIO_set_md .
117In OpenSSL 1.0.0 and later the context is always returned 117In OpenSSL 1.0.0 and later the context is always returned
118and the BIO is state is set to initialized. 118and the state of the BIO is set to initialized.
119This allows applications to initialize the context externally 119This allows applications to initialize the context externally
120if the standard calls such as 120if the standard calls such as
121.Fn BIO_set_md 121.Fn BIO_set_md
@@ -130,7 +130,7 @@ and
130.Fn BIO_get_md_ctx 130.Fn BIO_get_md_ctx
131return 1 for success and 0 for failure. 131return 1 for success and 0 for failure.
132.Sh EXAMPLES 132.Sh EXAMPLES
133The following example creates a BIO chain containing an SHA1 and MD5 133The following example creates a BIO chain containing an SHA-1 and MD5
134digest BIO and passes the string "Hello World" through it. 134digest BIO and passes the string "Hello World" through it.
135Error checking has been omitted for clarity. 135Error checking has been omitted for clarity.
136.Bd -literal -offset 2n 136.Bd -literal -offset 2n
@@ -198,7 +198,7 @@ BIO_free_all(bio);
198.Sh BUGS 198.Sh BUGS
199The lack of support for 199The lack of support for
200.Xr BIO_puts 3 200.Xr BIO_puts 3
201and the non standard behaviour of 201and the non-standard behaviour of
202.Xr BIO_gets 3 202.Xr BIO_gets 3
203could be regarded as anomalous. 203could be regarded as anomalous.
204It could be argued that 204It could be argued that
diff --git a/src/lib/libcrypto/man/BIO_f_null.3 b/src/lib/libcrypto/man/BIO_f_null.3
index 236d233e57..8e1e58f159 100644
--- a/src/lib/libcrypto/man/BIO_f_null.3
+++ b/src/lib/libcrypto/man/BIO_f_null.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_f_null.3,v 1.3 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_f_null.3,v 1.4 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_F_NULL 3 4.Dt BIO_F_NULL 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -16,12 +16,11 @@
16.Fn BIO_f_null 16.Fn BIO_f_null
17returns the null filter BIO method. 17returns the null filter BIO method.
18This is a filter BIO that does nothing. 18This is a filter BIO that does nothing.
19As may be apparent, a null filter BIO is not particularly useful.
19.Pp 20.Pp
20All requests to a null filter BIO are passed through to the next BIO 21All requests to a null filter BIO are passed through to the next BIO
21in the chain: this means that a BIO chain containing a null filter BIO 22in the chain: this means that a BIO chain containing a null filter BIO
22behaves just as though the BIO was not there. 23behaves just as though the BIO was not there.
23.Sh NOTES
24As may be apparent, a null filter BIO is not particularly useful.
25.Sh RETURN VALUES 24.Sh RETURN VALUES
26.Fn BIO_f_null 25.Fn BIO_f_null
27returns the null filter BIO method. 26returns the null filter BIO method.
diff --git a/src/lib/libcrypto/man/BIO_find_type.3 b/src/lib/libcrypto/man/BIO_find_type.3
index 1db2fe85c6..be0e0d0b3d 100644
--- a/src/lib/libcrypto/man/BIO_find_type.3
+++ b/src/lib/libcrypto/man/BIO_find_type.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_find_type.3,v 1.3 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_find_type.3,v 1.4 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_FIND_TYPE 3 4.Dt BIO_FIND_TYPE 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -86,14 +86,6 @@ returns the next BIO in a chain.
86.Fn BIO_method_type 86.Fn BIO_method_type
87returns the type of the BIO 87returns the type of the BIO
88.Fa b . 88.Fa b .
89.Sh NOTES
90.Fn BIO_next
91was added to OpenSSL 0.9.6 to provide a 'clean' way to traverse a BIO
92chain or find multiple matches using
93.Fn BIO_find_type .
94Previous versions had to use:
95.Pp
96.Dl next = bio->next_bio;
97.Sh EXAMPLES 89.Sh EXAMPLES
98Traverse a chain looking for digest BIOs: 90Traverse a chain looking for digest BIOs:
99.Bd -literal -offset 2n 91.Bd -literal -offset 2n
diff --git a/src/lib/libcrypto/man/BIO_new.3 b/src/lib/libcrypto/man/BIO_new.3
index b08de9c650..7138598674 100644
--- a/src/lib/libcrypto/man/BIO_new.3
+++ b/src/lib/libcrypto/man/BIO_new.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_new.3,v 1.3 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_new.3,v 1.4 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_NEW 3 4.Dt BIO_NEW 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -43,7 +43,7 @@ function returns a new BIO using method
43sets the method of an already existing BIO. 43sets the method of an already existing BIO.
44.Pp 44.Pp
45.Fn BIO_free 45.Fn BIO_free
46frees up a single BIO, 46frees up a single BIO;
47.Fn BIO_vfree 47.Fn BIO_vfree
48also frees up a single BIO, but it does not return a value. 48also frees up a single BIO, but it does not return a value.
49Calling 49Calling
@@ -59,22 +59,7 @@ descriptions.
59frees up an entire BIO chain. 59frees up an entire BIO chain.
60It does not halt if an error occurs 60It does not halt if an error occurs
61freeing up an individual BIO in the chain. 61freeing up an individual BIO in the chain.
62.Sh RETURN VALUES
63.Fn BIO_new
64returns a newly created BIO or
65.Dv NULL
66if the call fails.
67.Pp 62.Pp
68.Fn BIO_set
69and
70.Fn BIO_free
71return 1 for success and 0 for failure.
72.Pp
73.Fn BIO_free_all
74and
75.Fn BIO_vfree
76do not return values.
77.Sh NOTES
78Some BIOs (such as memory BIOs) can be used immediately after calling 63Some BIOs (such as memory BIOs) can be used immediately after calling
79.Fn BIO_new . 64.Fn BIO_new .
80Others (such as file BIOs) need some additional initialization, and 65Others (such as file BIOs) need some additional initialization, and
@@ -100,6 +85,21 @@ a source/sink BIO is normally called
100.Fn BIO_s_* 85.Fn BIO_s_*
101and a filter BIO 86and a filter BIO
102.Fn BIO_f_* . 87.Fn BIO_f_* .
88.Sh RETURN VALUES
89.Fn BIO_new
90returns a newly created BIO or
91.Dv NULL
92if the call fails.
93.Pp
94.Fn BIO_set
95and
96.Fn BIO_free
97return 1 for success and 0 for failure.
98.Pp
99.Fn BIO_free_all
100and
101.Fn BIO_vfree
102do not return values.
103.Sh EXAMPLES 103.Sh EXAMPLES
104Create a memory BIO: 104Create a memory BIO:
105.Pp 105.Pp
diff --git a/src/lib/libcrypto/man/BIO_push.3 b/src/lib/libcrypto/man/BIO_push.3
index 0357a8446c..eff3619fb3 100644
--- a/src/lib/libcrypto/man/BIO_push.3
+++ b/src/lib/libcrypto/man/BIO_push.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_push.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_push.3,v 1.3 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_PUSH 3 4.Dt BIO_PUSH 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -35,22 +35,14 @@ from a chain and returns the next BIO in the chain, or
35.Dv NULL 35.Dv NULL
36if there is no next BIO. 36if there is no next BIO.
37The removed BIO then becomes a single BIO with no association with the 37The removed BIO then becomes a single BIO with no association with the
38original chain, it can thus be freed or attached to a different chain. 38original chain.
39.Sh RETURN VALUES 39it can thus be freed or attached to a different chain.
40.Fn BIO_push
41returns the beginning of the chain,
42.Fa b .
43.Pp 40.Pp
44.Fn BIO_pop
45returns the next BIO in the chain, or
46.Dv NULL
47if there is no next BIO.
48.Sh NOTES
49The names of these functions are perhaps a little misleading. 41The names of these functions are perhaps a little misleading.
50.Fn BIO_push 42.Fn BIO_push
51joins two BIO chains whereas 43joins two BIO chains whereas
52.Fn BIO_pop 44.Fn BIO_pop
53deletes a single BIO from a chain, 45deletes a single BIO from a chain;
54the deleted BIO does not need to be at the end of a chain. 46the deleted BIO does not need to be at the end of a chain.
55.Pp 47.Pp
56The process of calling 48The process of calling
@@ -60,6 +52,15 @@ and
60on a BIO may have additional consequences: 52on a BIO may have additional consequences:
61a control call is made to the affected BIOs. 53a control call is made to the affected BIOs.
62Any effects will be noted in the descriptions of individual BIOs. 54Any effects will be noted in the descriptions of individual BIOs.
55.Sh RETURN VALUES
56.Fn BIO_push
57returns the beginning of the chain,
58.Fa b .
59.Pp
60.Fn BIO_pop
61returns the next BIO in the chain, or
62.Dv NULL
63if there is no next BIO.
63.Sh EXAMPLES 64.Sh EXAMPLES
64For these examples suppose 65For these examples suppose
65.Sy md1 66.Sy md1
@@ -67,7 +68,7 @@ and
67.Sy md2 68.Sy md2
68are digest BIOs, 69are digest BIOs,
69.Sy b64 70.Sy b64
70is a base64 BIO and 71is a Base64 BIO and
71.Sy f 72.Sy f
72is a file BIO. 73is a file BIO.
73.Pp 74.Pp
@@ -92,17 +93,14 @@ by
92.Sy md1 93.Sy md1
93and 94and
94.Sy md2 , 95.Sy md2 ,
95.Sy base64 96Base64-encoded and written to
96encoded and written to
97.Sy f . 97.Sy f .
98.Pp 98.Pp
99It should be noted that reading causes data to pass 99It should be noted that reading causes data to pass
100in the reverse direction, that is data is read from 100in the reverse direction.
101That is, data is read from
101.Sy f , 102.Sy f ,
102base64 103Base64-decoded and digested by
103.Sy decoded
104and digested
105by
106.Sy md1 104.Sy md1
107and 105and
108.Sy md2 . 106.Sy md2 .
@@ -113,7 +111,7 @@ If this call is made:
113The call will return 111The call will return
114.Sy b64 112.Sy b64
115and the new chain will be 113and the new chain will be
116.Sy md1-b64-f Ns ; 114.Sy md1-b64-f ;
117data can be written to 115data can be written to
118.Sy md1 116.Sy md1
119as before. 117as before.
diff --git a/src/lib/libcrypto/man/BIO_read.3 b/src/lib/libcrypto/man/BIO_read.3
index 94a4fb1461..f19c31ecab 100644
--- a/src/lib/libcrypto/man/BIO_read.3
+++ b/src/lib/libcrypto/man/BIO_read.3
@@ -1,12 +1,12 @@
1.\" $OpenBSD: BIO_read.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_read.3,v 1.3 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_READ 3 4.Dt BIO_READ 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
7.Nm BIO_read , 7.Nm BIO_read ,
8.Nm BIO_write ,
9.Nm BIO_gets , 8.Nm BIO_gets ,
9.Nm BIO_write ,
10.Nm BIO_puts 10.Nm BIO_puts
11.Nd BIO I/O functions 11.Nd BIO I/O functions
12.Sh SYNOPSIS 12.Sh SYNOPSIS
@@ -69,17 +69,6 @@ attempts to write a null terminated string
69.Fa buf 69.Fa buf
70to BIO 70to BIO
71.Fa b . 71.Fa b .
72.Sh RETURN VALUES
73All these functions return either the amount of data successfully
74read or written (if the return value is positive) or that no data
75was successfully read or written if the result is 0 or -1.
76If the return value is -2, then the operation is not implemented
77in the specific BIO type.
78.Sh NOTES
79A 0 or -1 return is not necessarily an indication of an error.
80In particular when the source/sink is non-blocking or of a certain type
81it may merely be an indication that no data is currently available and that
82the application should retry the operation later.
83.Pp 72.Pp
84One technique sometimes used with blocking sockets 73One technique sometimes used with blocking sockets
85is to use a system call (such as 74is to use a system call (such as
@@ -100,7 +89,7 @@ can cause several reads (and writes in the case of SSL BIOs)
100on the underlying I/O structure and may block as a result. 89on the underlying I/O structure and may block as a result.
101Instead 90Instead
102.Xr select 2 91.Xr select 2
103(or equivalent) should be combined with non blocking I/O 92(or equivalent) should be combined with non-blocking I/O
104so successive reads will request a retry instead of blocking. 93so successive reads will request a retry instead of blocking.
105.Pp 94.Pp
106See 95See
@@ -113,5 +102,16 @@ function is not supported by a BIO then it is possible to
113work around this by adding a buffering BIO 102work around this by adding a buffering BIO
114.Xr BIO_f_buffer 3 103.Xr BIO_f_buffer 3
115to the chain. 104to the chain.
105.Sh RETURN VALUES
106All these functions return either the amount of data successfully
107read or written (if the return value is positive) or that no data
108was successfully read or written if the result is 0 or -1.
109If the return value is -2, then the operation is not implemented
110in the specific BIO type.
111.Pp
112A 0 or -1 return is not necessarily an indication of an error.
113In particular when the source/sink is non-blocking or of a certain type
114it may merely be an indication that no data is currently available and that
115the application should retry the operation later.
116.Sh SEE ALSO 116.Sh SEE ALSO
117.Xr BIO_should_retry 3 117.Xr BIO_should_retry 3
diff --git a/src/lib/libcrypto/man/BIO_s_accept.3 b/src/lib/libcrypto/man/BIO_s_accept.3
index 766d86e2a4..3cfb574977 100644
--- a/src/lib/libcrypto/man/BIO_s_accept.3
+++ b/src/lib/libcrypto/man/BIO_s_accept.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_s_accept.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_s_accept.3,v 1.3 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_S_ACCEPT 3 4.Dt BIO_S_ACCEPT 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -63,7 +63,9 @@
63.Sh DESCRIPTION 63.Sh DESCRIPTION
64.Fn BIO_s_accept 64.Fn BIO_s_accept
65returns the accept BIO method. 65returns the accept BIO method.
66This is a wrapper round the platform's TCP/IP socket accept routines. 66This is a wrapper round the platform's TCP/IP socket
67.Xr accept 2
68routines.
67.Pp 69.Pp
68Using accept BIOs, TCP/IP connections can be accepted 70Using accept BIOs, TCP/IP connections can be accepted
69and data transferred using only BIO routines. 71and data transferred using only BIO routines.
@@ -81,12 +83,12 @@ but not
81.Xr BIO_gets 3 . 83.Xr BIO_gets 3 .
82.Pp 84.Pp
83If the close flag is set on an accept BIO, then any active 85If the close flag is set on an accept BIO, then any active
84connection on that chain is shutdown and the socket closed when 86connection on that chain is shut down and the socket closed when
85the BIO is freed. 87the BIO is freed.
86.Pp 88.Pp
87Calling 89Calling
88.Xr BIO_reset 3 90.Xr BIO_reset 3
89on a accept BIO will close any active connection and reset the BIO 91on an accept BIO will close any active connection and reset the BIO
90into a state where it awaits another incoming connection. 92into a state where it awaits another incoming connection.
91.Pp 93.Pp
92.Xr BIO_get_fd 3 94.Xr BIO_get_fd 3
@@ -108,13 +110,13 @@ is the interface to use and
108.Ar port 110.Ar port
109is the port. 111is the port.
110Either or both values can be 112Either or both values can be
111.Qq * 113.Qq * ,
112which is interpreted as meaning any interface or port respectively. 114which is interpreted as meaning any interface or port respectively.
113.Ar port 115.Ar port
114has the same syntax as the port specified in 116has the same syntax as the port specified in
115.Xr BIO_set_conn_port 3 117.Xr BIO_set_conn_port 3
116for connect BIOs. 118for connect BIOs.
117It can be a numerical port string or a string to lookup using 119It can be a numerical port string or a string to look up using
118.Xr getservbyname 3 120.Xr getservbyname 3
119and a string table. 121and a string table.
120.Pp 122.Pp
@@ -130,7 +132,7 @@ It creates a new accept BIO with port
130.Fn BIO_set_nbio_accept 132.Fn BIO_set_nbio_accept
131sets the accept socket to blocking mode (the default) if 133sets the accept socket to blocking mode (the default) if
132.Fa n 134.Fa n
133is 0 or non blocking mode if 135is 0 or non-blocking mode if
134.Fa n 136.Fa n
135is 1. 137is 1.
136.Pp 138.Pp
@@ -139,7 +141,7 @@ can be used to set a chain of BIOs which will be duplicated
139and prepended to the chain when an incoming connection is received. 141and prepended to the chain when an incoming connection is received.
140This is useful if, for example, a buffering or SSL BIO 142This is useful if, for example, a buffering or SSL BIO
141is required for each connection. 143is required for each connection.
142The chain of BIOs must not be freed after this call, 144The chain of BIOs must not be freed after this call -
143they will be automatically freed when the accept BIO is freed. 145they will be automatically freed when the accept BIO is freed.
144.Pp 146.Pp
145.Fn BIO_set_bind_mode 147.Fn BIO_set_bind_mode
@@ -162,11 +164,11 @@ then a second attempt is made using
162.Pp 164.Pp
163.Fn BIO_do_accept 165.Fn BIO_do_accept
164serves two purposes. 166serves two purposes.
165When it is first called, after the accept BIO has been setup, 167When it is first called, after the accept BIO has been set up,
166it will attempt to create the accept socket and bind an address to it. 168it will attempt to create the accept socket and bind an address to it.
167Second and subsequent calls to 169Second and subsequent calls to
168.Fn BIO_do_accept 170.Fn BIO_do_accept
169will await an incoming connection, or request a retry in non blocking mode. 171will await an incoming connection, or request a retry in non-blocking mode.
170.Sh NOTES 172.Sh NOTES
171When an accept BIO is at the end of a chain, it will await an 173When an accept BIO is at the end of a chain, it will await an
172incoming connection before processing I/O calls. 174incoming connection before processing I/O calls.
@@ -181,8 +183,8 @@ socket will await an incoming connection then perform I/O on it.
181.Pp 183.Pp
182If any additional BIOs have been set using 184If any additional BIOs have been set using
183.Fn BIO_set_accept_bios , 185.Fn BIO_set_accept_bios ,
184then they are placed between the socket and the accept BIO, 186then they are placed between the socket and the accept BIO;
185that is the chain will be accept->otherbios->socket. 187that is, the chain will be accept->otherbios->socket.
186.Pp 188.Pp
187If a server wishes to process multiple connections (as is normally 189If a server wishes to process multiple connections (as is normally
188the case), then the accept BIO must be made available for further 190the case), then the accept BIO must be made available for further
diff --git a/src/lib/libcrypto/man/BIO_s_bio.3 b/src/lib/libcrypto/man/BIO_s_bio.3
index c7d602990e..ccd3bf8ef9 100644
--- a/src/lib/libcrypto/man/BIO_s_bio.3
+++ b/src/lib/libcrypto/man/BIO_s_bio.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_s_bio.3,v 1.4 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_s_bio.3,v 1.5 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_S_BIO 3 4.Dt BIO_S_BIO 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -79,7 +79,7 @@ have all the data processed by the chain under application control.
79.Pp 79.Pp
80One typical use of BIO pairs is 80One typical use of BIO pairs is
81to place TLS/SSL I/O under application control. 81to place TLS/SSL I/O under application control.
82This can be used when the application wishes to use a non standard 82This can be used when the application wishes to use a non-standard
83transport for TLS/SSL or the normal socket routines are inappropriate. 83transport for TLS/SSL or the normal socket routines are inappropriate.
84.Pp 84.Pp
85Calls to 85Calls to
@@ -147,7 +147,7 @@ does not check whether
147.Fa bio1 147.Fa bio1
148or 148or
149.Fa bio2 149.Fa bio2
150do point to some other BIO, the values are overwritten, 150point to some other BIO; the values are overwritten and
151.Xr BIO_free 3 151.Xr BIO_free 3
152is not called. 152is not called.
153.Pp 153.Pp
@@ -186,19 +186,7 @@ never returns an amount larger than that returned by
186can also be used to reset the value returned by 186can also be used to reset the value returned by
187.Fn BIO_get_read_request 187.Fn BIO_get_read_request
188to zero. 188to zero.
189.Sh RETURN VALUES 189.Pp
190.Fn BIO_new_bio_pair
191returns 1 on success, with the new BIOs available in
192.Fa bio1
193and
194.Fa bio2 ,
195or 0 on failure, with NULL pointers stored into the locations for
196.Fa bio1
197and
198.Fa bio2 .
199Check the error stack for more information.
200.\" XXX More return values need to be added here.
201.Sh NOTES
202Both halves of a BIO pair should be freed. 190Both halves of a BIO pair should be freed.
203Even if one half is implicitly freed due to a 191Even if one half is implicitly freed due to a
204.Xr BIO_free_all 3 192.Xr BIO_free_all 3
@@ -233,12 +221,24 @@ will be true.
233If the application then waits for data to become available 221If the application then waits for data to become available
234on the underlying transport before flushing the write buffer, 222on the underlying transport before flushing the write buffer,
235it will never succeed because the request was never sent. 223it will never succeed because the request was never sent.
224.Sh RETURN VALUES
225.Fn BIO_new_bio_pair
226returns 1 on success, with the new BIOs available in
227.Fa bio1
228and
229.Fa bio2 ,
230or 0 on failure, with NULL pointers stored into the locations for
231.Fa bio1
232and
233.Fa bio2 .
234Check the error stack for more information.
235.\" XXX More return values need to be added here.
236.Sh EXAMPLES 236.Sh EXAMPLES
237The BIO pair can be used to have full control 237The BIO pair can be used to have full control
238over the network access of an application. 238over the network access of an application.
239The application can call 239The application can call
240.Xr select 2 240.Xr select 2
241on the socket as required without having to go through the SSL-interface. 241on the socket as required without having to go through the SSL interface.
242.Bd -literal -offset 2n 242.Bd -literal -offset 2n
243BIO *internal_bio, *network_bio; 243BIO *internal_bio, *network_bio;
244\&... 244\&...
diff --git a/src/lib/libcrypto/man/BIO_s_connect.3 b/src/lib/libcrypto/man/BIO_s_connect.3
index e0da157e12..cc2790fca6 100644
--- a/src/lib/libcrypto/man/BIO_s_connect.3
+++ b/src/lib/libcrypto/man/BIO_s_connect.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_s_connect.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_s_connect.3,v 1.3 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_S_CONNECT 3 4.Dt BIO_S_CONNECT 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -106,8 +106,8 @@ into a state where it can connect to the same host again.
106places the underlying socket in 106places the underlying socket in
107.Fa c 107.Fa c
108if it is not 108if it is not
109.Dv NULL , 109.Dv NULL
110it also returns the socket. 110and also returns the socket.
111If 111If
112.Fa c 112.Fa c
113is not 113is not
@@ -151,7 +151,7 @@ and
151.Fn BIO_set_conn_ip 151.Fn BIO_set_conn_ip
152sets the IP address to 152sets the IP address to
153.Fa ip 153.Fa ip
154using binary form, that is four bytes specifying the IP address 154using binary form i.e. four bytes specifying the IP address
155in big-endian form. 155in big-endian form.
156.Pp 156.Pp
157.Fn BIO_set_conn_int_port 157.Fn BIO_set_conn_int_port
@@ -179,19 +179,19 @@ returns the port as an
179.Vt int . 179.Vt int .
180.Pp 180.Pp
181.Fn BIO_set_nbio 181.Fn BIO_set_nbio
182sets the non blocking I/O flag to 182sets the non-blocking I/O flag to
183.Fa n . 183.Fa n .
184If 184If
185.Fa n 185.Fa n
186is zero then blocking I/O is set. 186is zero then blocking I/O is set.
187If 187If
188.Fa n 188.Fa n
189is 1 then non blocking I/O is set. 189is 1 then non-blocking I/O is set.
190Blocking I/O is the default. 190Blocking I/O is the default.
191The call to 191The call to
192.Fn BIO_set_nbio 192.Fn BIO_set_nbio
193should be made before the connection is established 193should be made before the connection is established
194because non blocking I/O is set during the connect process. 194because non-blocking I/O is set during the connect process.
195.Pp 195.Pp
196.Fn BIO_new_connect 196.Fn BIO_new_connect
197combines 197combines
@@ -209,10 +209,10 @@ A zero or negative value is returned if the connection
209could not be established. 209could not be established.
210The call 210The call
211.Xr BIO_should_retry 3 211.Xr BIO_should_retry 3
212should be used for non blocking connect BIOs 212should be used for non-blocking connect BIOs
213to determine if the call should be retried. 213to determine if the call should be retried.
214.Sh NOTES 214.Pp
215If blocking I/O is set then a non positive return value from any 215If blocking I/O is set then a non-positive return value from any
216I/O call is caused by an error condition, although a zero return 216I/O call is caused by an error condition, although a zero return
217will normally mean that the connection was closed. 217will normally mean that the connection was closed.
218.Pp 218.Pp
@@ -244,7 +244,7 @@ from other I/O processing.
244If non-blocking I/O is set, 244If non-blocking I/O is set,
245then retries will be requested as appropriate. 245then retries will be requested as appropriate.
246.Pp 246.Pp
247It addition to 247In addition to
248.Xr BIO_should_read 3 248.Xr BIO_should_read 3
249and 249and
250.Xr BIO_should_write 3 250.Xr BIO_should_write 3
diff --git a/src/lib/libcrypto/man/BIO_s_fd.3 b/src/lib/libcrypto/man/BIO_s_fd.3
index 591b25d2f2..9365eaf973 100644
--- a/src/lib/libcrypto/man/BIO_s_fd.3
+++ b/src/lib/libcrypto/man/BIO_s_fd.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_s_fd.3,v 1.3 2016/11/06 16:43:53 schwarze Exp $ 1.\" $OpenBSD: BIO_s_fd.3,v 1.4 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_S_FD 3 4.Dt BIO_S_FD 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -91,7 +91,7 @@ returns a file descriptor BIO using
91.Fa fd 91.Fa fd
92and 92and
93.Fa close_flag . 93.Fa close_flag .
94.Sh NOTES 94.Pp
95The behaviour of 95The behaviour of
96.Xr BIO_read 3 96.Xr BIO_read 3
97and 97and
@@ -101,7 +101,7 @@ depends on the behavior of the platform's
101and 101and
102.Xr write 2 102.Xr write 2
103calls on the descriptor. 103calls on the descriptor.
104If the underlying file descriptor is in a non blocking mode, 104If the underlying file descriptor is in a non-blocking mode,
105then the BIO will behave in the manner described in the 105then the BIO will behave in the manner described in the
106.Xr BIO_read 3 106.Xr BIO_read 3
107and 107and
diff --git a/src/lib/libcrypto/man/BIO_s_file.3 b/src/lib/libcrypto/man/BIO_s_file.3
index 9676e4f0a5..47d5806d7e 100644
--- a/src/lib/libcrypto/man/BIO_s_file.3
+++ b/src/lib/libcrypto/man/BIO_s_file.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_s_file.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_s_file.3,v 1.3 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_S_FILE 3 4.Dt BIO_S_FILE 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -13,7 +13,7 @@
13.Nm BIO_write_filename , 13.Nm BIO_write_filename ,
14.Nm BIO_append_filename , 14.Nm BIO_append_filename ,
15.Nm BIO_rw_filename 15.Nm BIO_rw_filename
16.Nd FILE bio 16.Nd FILE BIO
17.Sh SYNOPSIS 17.Sh SYNOPSIS
18.In openssl/bio.h 18.In openssl/bio.h
19.Ft BIO_METHOD * 19.Ft BIO_METHOD *
@@ -153,7 +153,7 @@ set the file BIO
153to use file 153to use file
154.Fa name 154.Fa name
155for reading, writing, append or read write respectively. 155for reading, writing, append or read write respectively.
156.Sh NOTES 156.Pp
157When wrapping stdout, stdin, or stderr, the underlying stream 157When wrapping stdout, stdin, or stderr, the underlying stream
158should not normally be closed, so the 158should not normally be closed, so the
159.Dv BIO_NOCLOSE 159.Dv BIO_NOCLOSE
@@ -247,4 +247,4 @@ The return value for
247.Xr fseek 3 247.Xr fseek 3
248is 0 for success or -1 if an error occurred. 248is 0 for success or -1 if an error occurred.
249This differs from other types of BIO which will typically return 249This differs from other types of BIO which will typically return
2501 for success and a non positive value if an error occurred. 2501 for success and a non-positive value if an error occurred.
diff --git a/src/lib/libcrypto/man/BIO_s_mem.3 b/src/lib/libcrypto/man/BIO_s_mem.3
index 1512ebbb77..1fff26442c 100644
--- a/src/lib/libcrypto/man/BIO_s_mem.3
+++ b/src/lib/libcrypto/man/BIO_s_mem.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_s_mem.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_s_mem.3,v 1.3 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_S_MEM 3 4.Dt BIO_S_MEM 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -86,7 +86,7 @@ when it is empty.
86If 86If
87.Fa v 87.Fa v
88is zero, then an empty memory BIO will return EOF: 88is zero, then an empty memory BIO will return EOF:
89It will return zero and 89it will return zero and
90.Fn BIO_should_retry 90.Fn BIO_should_retry
91will be false. 91will be false.
92If 92If
@@ -111,8 +111,8 @@ It is implemented as a macro.
111sets the internal BUF_MEM structure to 111sets the internal BUF_MEM structure to
112.Fa bm 112.Fa bm
113and sets the close flag to 113and sets the close flag to
114.Fa c , 114.Fa c .
115that is 115That is,
116.Fa c 116.Fa c
117should be either 117should be either
118.Dv BIO_CLOSE 118.Dv BIO_CLOSE
@@ -147,7 +147,7 @@ it is
147.Em not 147.Em not
148copied first, so the supplied area of memory must be unchanged 148copied first, so the supplied area of memory must be unchanged
149until the BIO is freed. 149until the BIO is freed.
150.Sh NOTES 150.Pp
151Writes to memory BIOs will always succeed if memory is available: 151Writes to memory BIOs will always succeed if memory is available:
152their size can grow indefinitely. 152their size can grow indefinitely.
153.Pp 153.Pp
diff --git a/src/lib/libcrypto/man/BIO_s_null.3 b/src/lib/libcrypto/man/BIO_s_null.3
index 5910bd5ce1..c98d2affd3 100644
--- a/src/lib/libcrypto/man/BIO_s_null.3
+++ b/src/lib/libcrypto/man/BIO_s_null.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_s_null.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_s_null.3,v 1.3 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_S_NULL 3 4.Dt BIO_S_NULL 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -16,12 +16,12 @@
16.Fn BIO_s_null 16.Fn BIO_s_null
17returns the null sink BIO method. 17returns the null sink BIO method.
18Data written to the null sink is discarded, reads return EOF. 18Data written to the null sink is discarded, reads return EOF.
19.Sh NOTES 19.Pp
20A null sink BIO behaves in a similar manner to the 20A null sink BIO behaves in a similar manner to the
21.Xr null 4 21.Xr null 4
22device. 22device.
23.Pp 23.Pp
24A null bio can be placed on the end of a chain to discard any data 24A null BIO can be placed on the end of a chain to discard any data
25passed through it. 25passed through it.
26.Pp 26.Pp
27A null sink is useful if, for example, an application wishes 27A null sink is useful if, for example, an application wishes
diff --git a/src/lib/libcrypto/man/BIO_s_socket.3 b/src/lib/libcrypto/man/BIO_s_socket.3
index 8cc0243066..29d3cf83b0 100644
--- a/src/lib/libcrypto/man/BIO_s_socket.3
+++ b/src/lib/libcrypto/man/BIO_s_socket.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_s_socket.3,v 1.3 2016/11/06 16:43:53 schwarze Exp $ 1.\" $OpenBSD: BIO_s_socket.3,v 1.4 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_S_SOCKET 3 4.Dt BIO_S_SOCKET 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -40,7 +40,7 @@ returns a socket BIO using
40.Fa sock 40.Fa sock
41and 41and
42.Fa close_flag . 42.Fa close_flag .
43.Sh NOTES 43.Pp
44Socket BIOs also support any relevant functionality of file descriptor BIOs. 44Socket BIOs also support any relevant functionality of file descriptor BIOs.
45.Pp 45.Pp
46The reason for having separate file descriptor and socket BIOs 46The reason for having separate file descriptor and socket BIOs
diff --git a/src/lib/libcrypto/man/BIO_set_callback.3 b/src/lib/libcrypto/man/BIO_set_callback.3
index 68ca2780f8..62b7b3773b 100644
--- a/src/lib/libcrypto/man/BIO_set_callback.3
+++ b/src/lib/libcrypto/man/BIO_set_callback.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_set_callback.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_set_callback.3,v 1.3 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_SET_CALLBACK 3 4.Dt BIO_SET_CALLBACK 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -38,7 +38,7 @@
38.Fn BIO_set_callback 38.Fn BIO_set_callback
39and 39and
40.Fn BIO_get_callback 40.Fn BIO_get_callback
41set and retrieve the BIO callback, they are both macros. 41set and retrieve the BIO callback; they are both macros.
42The callback is called during most high level BIO operations. 42The callback is called during most high level BIO operations.
43It can be used for debugging purposes to trace operations on a BIO 43It can be used for debugging purposes to trace operations on a BIO
44or to modify its operation. 44or to modify its operation.
@@ -77,8 +77,8 @@ The meaning of the arguments
77and 77and
78.Fa argl 78.Fa argl
79depends on the value of 79depends on the value of
80.Fa oper , 80.Fa oper
81that is the operation being performed. 81(i.e. the operation being performed).
82.Pp 82.Pp
83.Fa retvalue 83.Fa retvalue
84is the return value that would be returned to the application 84is the return value that would be returned to the application
@@ -127,5 +127,6 @@ after.
127.Sh EXAMPLES 127.Sh EXAMPLES
128The 128The
129.Fn BIO_debug_callback 129.Fn BIO_debug_callback
130function is a good example, its source is in the file 130function is a good example.
131Its source is in the file
131.Pa crypto/bio/bio_cb.c . 132.Pa crypto/bio/bio_cb.c .
diff --git a/src/lib/libcrypto/man/BIO_should_retry.3 b/src/lib/libcrypto/man/BIO_should_retry.3
index c06e907235..f512e08b89 100644
--- a/src/lib/libcrypto/man/BIO_should_retry.3
+++ b/src/lib/libcrypto/man/BIO_should_retry.3
@@ -1,6 +1,6 @@
1.\" $OpenBSD: BIO_should_retry.3,v 1.2 2016/11/06 15:52:50 jmc Exp $ 1.\" $OpenBSD: BIO_should_retry.3,v 1.3 2016/11/07 15:52:47 jmc Exp $
2.\" 2.\"
3.Dd $Mdocdate: November 6 2016 $ 3.Dd $Mdocdate: November 7 2016 $
4.Dt BIO_SHOULD_RETRY 3 4.Dt BIO_SHOULD_RETRY 3
5.Os 5.Os
6.Sh NAME 6.Sh NAME
@@ -9,6 +9,7 @@
9.Nm BIO_should_write , 9.Nm BIO_should_write ,
10.Nm BIO_should_io_special , 10.Nm BIO_should_io_special ,
11.Nm BIO_retry_type , 11.Nm BIO_retry_type ,
12.Nm BIO_should_retry ,
12.Nm BIO_get_retry_BIO , 13.Nm BIO_get_retry_BIO ,
13.Nm BIO_get_retry_reason 14.Nm BIO_get_retry_reason
14.Nd BIO retry functions 15.Nd BIO retry functions
@@ -58,8 +59,8 @@ is true if the cause of the condition is that a BIO needs to read data.
58is true if the cause of the condition is that a BIO needs to write data. 59is true if the cause of the condition is that a BIO needs to write data.
59.Pp 60.Pp
60.Fn BIO_should_io_special 61.Fn BIO_should_io_special
61is true if some "special" condition, that is a reason other than 62is true if some "special" condition
62reading or writing, is the cause of the condition. 63(i.e. a reason other than reading or writing) is the cause of the condition.
63.Pp 64.Pp
64.Fn BIO_retry_type 65.Fn BIO_retry_type
65returns a mask of the cause of a retry condition consisting of the values 66returns a mask of the cause of a retry condition consisting of the values
@@ -82,7 +83,7 @@ depends on the type of BIO that resulted in this condition.
82returns the reason for a special condition 83returns the reason for a special condition
83if passed the relevant BIO, for example as returned by 84if passed the relevant BIO, for example as returned by
84.Fn BIO_get_retry_BIO . 85.Fn BIO_get_retry_BIO .
85.Sh NOTES 86.Pp
86If 87If
87.Fn BIO_should_retry 88.Fn BIO_should_retry
88returns false, then the precise "error condition" depends on 89returns false, then the precise "error condition" depends on
@@ -114,7 +115,7 @@ or avoid this situation by setting
114.Dv SSL_MODE_AUTO_RETRY 115.Dv SSL_MODE_AUTO_RETRY
115on the underlying SSL structure. 116on the underlying SSL structure.
116.Pp 117.Pp
117While an application may retry a failed non blocking call immediately, 118While an application may retry a failed non-blocking call immediately,
118this is likely to be very inefficient because the call will fail 119this is likely to be very inefficient because the call will fail
119repeatedly until data can be processed or is available. 120repeatedly until data can be processed or is available.
120An application will normally wait until the necessary condition 121An application will normally wait until the necessary condition
@@ -127,7 +128,7 @@ is true then a call to
127.Xr select 2 128.Xr select 2
128may be made to wait until data is available 129may be made to wait until data is available
129and then retry the BIO operation. 130and then retry the BIO operation.
130By combining the retry conditions of several non blocking BIOs in a single 131By combining the retry conditions of several non-blocking BIOs in a single
131.Xr select 2 132.Xr select 2
132call it is possible to service several BIOs in a single thread, 133call it is possible to service several BIOs in a single thread,
133though the performance may be poor if SSL BIOs are present because 134though the performance may be poor if SSL BIOs are present because
@@ -136,12 +137,12 @@ long delays can occur during the initial handshake process.
136It is possible for a BIO to block indefinitely if the underlying I/O 137It is possible for a BIO to block indefinitely if the underlying I/O
137structure cannot process or return any data. 138structure cannot process or return any data.
138This depends on the behaviour of the platforms I/O functions. 139This depends on the behaviour of the platforms I/O functions.
139This is often not desirable: one solution is to use non blocking I/O 140This is often not desirable: one solution is to use non-blocking I/O
140and use a timeout on the 141and use a timeout on the
141.Xr select 2 142.Xr select 2
142(or equivalent) call. 143(or equivalent) call.
143.Sh BUGS 144.Sh BUGS
144The OpenSSL ASN1 functions cannot gracefully deal with non blocking I/O: 145The OpenSSL ASN.1 functions cannot gracefully deal with non-blocking I/O:
145they cannot retry after a partial read or write. 146they cannot retry after a partial read or write.
146This is usually worked around by only passing the relevant data to ASN1 147This is usually worked around by only passing the relevant data to ASN.1
147functions when the entire structure can be read or written. 148functions when the entire structure can be read or written.