summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/man/BIO_push.3185
1 files changed, 148 insertions, 37 deletions
diff --git a/src/lib/libcrypto/man/BIO_push.3 b/src/lib/libcrypto/man/BIO_push.3
index e757d6de67..aa0c3115a9 100644
--- a/src/lib/libcrypto/man/BIO_push.3
+++ b/src/lib/libcrypto/man/BIO_push.3
@@ -1,8 +1,26 @@
1.\" $OpenBSD: BIO_push.3,v 1.8 2022/12/02 22:58:56 tb Exp $ 1.\" $OpenBSD: BIO_push.3,v 1.9 2022/12/06 21:13:01 schwarze Exp $
2.\" OpenSSL doc/man3/BIO_push.pod 76ed5a42 Jun 29 13:38:55 2014 +0100 2.\" full merge up to:
3.\" OpenSSL doc/man7/bio.pod a9c85cea Nov 11 09:33:55 2016 +0100 3.\" OpenSSL doc/man3/BIO_push.pod 791bfd91 Nov 19 20:38:27 2021 +0100
4.\" OpenSSL doc/man7/bio.pod 1cb7eff4 Sep 10 13:56:40 2019 +0100
4.\" 5.\"
5.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 6.\" This file is a derived work.
7.\" The changes are covered by the following Copyright and license:
8.\"
9.\" Copyright (c) 2022 Ingo Schwarze <schwarze@openbsd.org>
10.\"
11.\" Permission to use, copy, modify, and distribute this software for any
12.\" purpose with or without fee is hereby granted, provided that the above
13.\" copyright notice and this permission notice appear in all copies.
14.\"
15.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
16.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
17.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
18.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
20.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
21.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22.\"
23.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
6.\" Copyright (c) 2000, 2014 The OpenSSL Project. All rights reserved. 24.\" Copyright (c) 2000, 2014 The OpenSSL Project. All rights reserved.
7.\" 25.\"
8.\" Redistribution and use in source and binary forms, with or without 26.\" Redistribution and use in source and binary forms, with or without
@@ -49,75 +67,163 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 67.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 69.\"
52.Dd $Mdocdate: December 2 2022 $ 70.Dd $Mdocdate: December 6 2022 $
53.Dt BIO_PUSH 3 71.Dt BIO_PUSH 3
54.Os 72.Os
55.Sh NAME 73.Sh NAME
56.Nm BIO_push , 74.Nm BIO_push ,
57.Nm BIO_pop 75.Nm BIO_pop ,
58.Nd add and remove BIOs from a chain 76.Nm BIO_set_next
77.Nd manipulate BIO chains
59.Sh SYNOPSIS 78.Sh SYNOPSIS
60.In openssl/bio.h 79.In openssl/bio.h
61.Ft BIO * 80.Ft BIO *
62.Fo BIO_push 81.Fo BIO_push
63.Fa "BIO *b" 82.Fa "BIO *b"
64.Fa "BIO *append" 83.Fa "BIO *new_tail"
65.Fc 84.Fc
66.Ft BIO * 85.Ft BIO *
67.Fo BIO_pop 86.Fo BIO_pop
68.Fa "BIO *b" 87.Fa "BIO *b"
69.Fc 88.Fc
89.Ft void
90.Fo BIO_set_next
91.Fa "BIO *b"
92.Fa "BIO *new_tail"
93.Fc
70.Sh DESCRIPTION 94.Sh DESCRIPTION
71BIOs can be joined together to form chains. 95BIOs can be joined together to form chains.
72A chain normally consists of one or more filter BIOs 96A chain normally consists of one or more filter BIOs
73and one source/sink BIO at the end. 97and one source/sink BIO at the end.
74Data read from or written to the first BIO traverses the chain 98Data read from or written to the first BIO traverses the chain
75to the end. 99to the end.
76A single BIO can be regarded as a chain with one component.
77.Pp 100.Pp
78The 101Every BIO is a member of exactly one chain.
102It is either at the beginning of its chain
103or there is exactly one preceding BIO.
104It is either at the end of its chain
105or there is exactly one following BIO.
106If there is neither a preceding nor a following BIO,
107it can be regarded as a chain with one member.
108.Pp
79.Fn BIO_push 109.Fn BIO_push
80function appends the BIO 110appends the chain starting at
81.Fa append 111.Fa new_tail
82to 112to the end of the chain that contains
83.Fa b
84and returns
85.Fa b . 113.Fa b .
114Unless
115.Fa b
116is
117.Dv NULL ,
118it then calls
119.Xr BIO_ctrl 3
120on
121.Fa b
122with an argument of
123.Dv BIO_CTRL_PUSH .
124If
125.Fa b
126or
127.Fa new_tail
128is
129.Dv NULL ,
130nothing is appended.
131.Pp
132In LibreSSL, if
133.Fa new_tail
134is not at the beginning of its chain,
135the head of that chain up to but not including
136.Fa new_tail
137is cut off and becomes a separate chain.
138For portability, it is best to make sure that
139.Fa new_tail
140is at the beginning of its chain before calling
141.Fn BIO_push .
86.Pp 142.Pp
87.Fn BIO_pop 143.Fn BIO_pop
88removes the BIO 144removes the BIO
89.Fa b 145.Fa b
90from a chain and returns the next BIO in the chain, or 146from its chain.
91.Dv NULL 147Despite the word
92if there is no next BIO. 148.Dq pop
93The removed BIO then becomes a single BIO with no association with the 149in the function name,
94original chain. 150.Fa b
95It can thus be freed or attached to a different chain. 151can be at the beginning, in the middle, or at the end of its chain.
152Before removal,
153.Xr BIO_ctrl 3
154is called on
155.Fa b
156with an argument of
157.Dv BIO_CTRL_POP .
158The removed BIO
159.Fa b
160becomes the only member of its own chain and can thus be freed
161or attached to a different chain.
162If
163.Fa b
164is
165.Dv NULL ,
166no action occurs.
96.Pp 167.Pp
97The names of these functions are misleading. 168.Fn BIO_set_next
98.Fn BIO_push 169appends the chain starting with
99joins two BIO chains whereas 170.Fa new_tail
100.Fn BIO_pop 171to the chain ending with
101deletes a single BIO from a chain; 172.Fa b .
102the deleted BIO does not need to be at the end of a chain.
103.Pp 173.Pp
104The process of calling 174In LibreSSL, if
105.Fn BIO_push 175.Fa new_tail
106and 176is not at the beginning of its chain,
177the head of that chain up to but not including
178.Fa new_tail
179is cut off and becomes a separate chain,
180and if
181.Fa b
182is not at the end of its chain,
183the tail of that chain starting after
184.Fa b
185is cut off and becomes a separate chain,
186.Pp
187For portability, it is best to make sure that
188.Fa b
189is at the end of its chain and that
190.Fa new_tail
191is at the beginning of its chain before calling
192.Fn BIO_set_next
193and to avoid calling
107.Fn BIO_pop 194.Fn BIO_pop
108on a BIO may have additional consequences: a 195on
196.Fa new_tail
197afterwards.
198.Pp
199In LibreSSL, the only built-in BIO type for which
109.Xr BIO_ctrl 3 200.Xr BIO_ctrl 3
110call is made to the affected BIOs. 201calls with an argument of
111Any effects will be noted in the descriptions of individual BIOs. 202.Dv BIO_CTRL_PUSH
203or
204.Dv BIO_CTRL_POP
205have any effect is
206.Xr BIO_f_ssl 3 .
112.Sh RETURN VALUES 207.Sh RETURN VALUES
113.Fn BIO_push 208.Fn BIO_push
114returns the beginning of the chain, 209returns
115.Fa b . 210.Fa b
211if it is not
212.Dv NULL
213or
214.Fa new_tail
215if it is.
116.Pp 216.Pp
117.Fn BIO_pop 217.Fn BIO_pop
118returns the next BIO in the chain, or 218returns the BIO that followed
219.Fa b
220in its chain, or
221.Dv NULL
222if
223.Fa b
224is
119.Dv NULL 225.Dv NULL
120if there is no next BIO. 226or was at the end of its chain.
121.Sh EXAMPLES 227.Sh EXAMPLES
122For these examples suppose 228For these examples suppose
123.Sy md1 229.Sy md1
@@ -183,3 +289,8 @@ first appeared in SSLeay 0.6.0.
183first appeared in SSLeay 0.6.4. 289first appeared in SSLeay 0.6.4.
184Both functions have been available since 290Both functions have been available since
185.Ox 2.4 . 291.Ox 2.4 .
292.Pp
293.Fn BIO_set_next
294first appeared in OpenSSL 1.1.0
295and has been available since
296.Ox 7.1 .