summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2021-11-25 12:15:37 +0000
committerschwarze <>2021-11-25 12:15:37 +0000
commit0c3a7776d2ee6e4d66a61ad715c22adf27b4ed99 (patch)
tree9aea3ebaf16488366221139a852b4eec175645e3 /src/lib
parentaceb60d6e488e4f7d6c8398188afe5a176df80dc (diff)
downloadopenbsd-0c3a7776d2ee6e4d66a61ad715c22adf27b4ed99.tar.gz
openbsd-0c3a7776d2ee6e4d66a61ad715c22adf27b4ed99.tar.bz2
openbsd-0c3a7776d2ee6e4d66a61ad715c22adf27b4ed99.zip
Document BIO_method_name(3).
While here, also improve the rest of the page: * add missing BIO_TYPE_* constants * describe BIO_TYPE_START * better function argument names * more precision in the descriptions and regarding the RETURN VALUES * lots of wording improvements * improve the coding style below EXAMPLES * delete a BUGS section describing cretaceous behaviour
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/man/BIO_find_type.3145
1 files changed, 97 insertions, 48 deletions
diff --git a/src/lib/libcrypto/man/BIO_find_type.3 b/src/lib/libcrypto/man/BIO_find_type.3
index 99e93167a5..8882dbf404 100644
--- a/src/lib/libcrypto/man/BIO_find_type.3
+++ b/src/lib/libcrypto/man/BIO_find_type.3
@@ -1,7 +1,24 @@
1.\" $OpenBSD: BIO_find_type.3,v 1.9 2018/03/27 17:35:50 schwarze Exp $ 1.\" $OpenBSD: BIO_find_type.3,v 1.10 2021/11/25 12:15:37 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100
3.\" 3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>. 4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license:
6.\"
7.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
8.\"
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
11.\" copyright notice and this permission notice appear in all copies.
12.\"
13.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\"
21.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2000, 2013, 2016 The OpenSSL Project. All rights reserved. 22.\" Copyright (c) 2000, 2013, 2016 The OpenSSL Project. All rights reserved.
6.\" 23.\"
7.\" Redistribution and use in source and binary forms, with or without 24.\" Redistribution and use in source and binary forms, with or without
@@ -48,28 +65,33 @@
48.\" 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
49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\" 67.\"
51.Dd $Mdocdate: March 27 2018 $ 68.Dd $Mdocdate: November 25 2021 $
52.Dt BIO_FIND_TYPE 3 69.Dt BIO_FIND_TYPE 3
53.Os 70.Os
54.Sh NAME 71.Sh NAME
55.Nm BIO_find_type , 72.Nm BIO_find_type ,
56.Nm BIO_next , 73.Nm BIO_next ,
57.Nm BIO_method_type 74.Nm BIO_method_type ,
75.Nm BIO_method_name
58.Nd BIO chain traversal 76.Nd BIO chain traversal
59.Sh SYNOPSIS 77.Sh SYNOPSIS
60.In openssl/bio.h 78.In openssl/bio.h
61.Ft BIO * 79.Ft BIO *
62.Fo BIO_find_type 80.Fo BIO_find_type
63.Fa "BIO *b" 81.Fa "BIO *bio"
64.Fa "int bio_type" 82.Fa "int type"
65.Fc 83.Fc
66.Ft BIO * 84.Ft BIO *
67.Fo BIO_next 85.Fo BIO_next
68.Fa "BIO *b" 86.Fa "BIO *bio"
69.Fc 87.Fc
70.Ft int 88.Ft int
71.Fo BIO_method_type 89.Fo BIO_method_type
72.Fa "const BIO *b" 90.Fa "const BIO *bio"
91.Fc
92.Ft const char *
93.Fo BIO_method_name
94.Fa "const BIO *bio"
73.Fc 95.Fc
74.Fd #define BIO_TYPE_NONE 0 96.Fd #define BIO_TYPE_NONE 0
75.Fd #define BIO_TYPE_MEM (1|0x0400) 97.Fd #define BIO_TYPE_MEM (1|0x0400)
@@ -90,86 +112,113 @@
90.Fd #define BIO_TYPE_NULL_FILTER (17|0x0200) 112.Fd #define BIO_TYPE_NULL_FILTER (17|0x0200)
91.Fd #define BIO_TYPE_BER (18|0x0200) 113.Fd #define BIO_TYPE_BER (18|0x0200)
92.Fd #define BIO_TYPE_BIO (19|0x0400) 114.Fd #define BIO_TYPE_BIO (19|0x0400)
115.Fd #define BIO_TYPE_LINEBUFFER (20|0x0200)
116.Fd #define BIO_TYPE_DGRAM (21|0x0400|0x0100)
117.Fd #define BIO_TYPE_ASN1 (22|0x0200)
118.Fd #define BIO_TYPE_COMP (23|0x0200)
93.Fd #define BIO_TYPE_DESCRIPTOR 0x0100 119.Fd #define BIO_TYPE_DESCRIPTOR 0x0100
94.Fd #define BIO_TYPE_FILTER 0x0200 120.Fd #define BIO_TYPE_FILTER 0x0200
95.Fd #define BIO_TYPE_SOURCE_SINK 0x0400 121.Fd #define BIO_TYPE_SOURCE_SINK 0x0400
122.Fd #define BIO_TYPE_START 128
96.Sh DESCRIPTION 123.Sh DESCRIPTION
97The function
98.Fn BIO_find_type 124.Fn BIO_find_type
99searches for a BIO of a given type in a chain, starting at BIO 125searches for a BIO matching the given
100.Fa b . 126.Fa type
101If 127in the chain starting at
102.Fa bio_type 128.Fa bio .
103is a specific type (such as 129If the least significant byte of the
104.Dv BIO_TYPE_MEM ) , 130.Fa type
105then a search is made for a BIO of that type. 131argument is non-zero, only exact matches of the
106If 132.Fa type
107.Fa bio_type 133are accepted.
108is a general type (such as 134Otherwise, a match only requires that any of the bits set in the
109.Dv BIO_TYPE_SOURCE_SINK ) , 135.Fa type
110then the next matching BIO of the given general type is searched for. 136argument is also set in the candidate BIO.
111.Fn BIO_find_type
112returns the next matching BIO or
113.Dv NULL
114if none is found.
115.Pp 137.Pp
116Note: not all the 138Not all the
117.Dv BIO_TYPE_* 139.Dv BIO_TYPE_*
118types above have corresponding BIO implementations. 140types shown above have corresponding BIO implementations.
141.Pp
142Types with a least significant byte in the range from 0 to
143.Dv BIO_TYPE_START ,
144inclusive, are reserved for BIO types built into the library.
145Types with a least significant byte greater than
146.Dv BIO_TYPE_START
147are available for user-defined BIO types; see
148.Xr BIO_get_new_index 3
149for details.
119.Pp 150.Pp
120.Fn BIO_next 151.Fn BIO_next
121returns the next BIO in a chain. 152returns the next BIO in the chain after
122It can be used to traverse all BIOs in a chain or used in conjunction with 153.Fa bio .
154This function can be used to traverse all BIOs in a chain
155or in conjunction with
123.Fn BIO_find_type 156.Fn BIO_find_type
124to find all BIOs of a certain type. 157to find all BIOs of a certain type.
125.Pp 158.Pp
126.Fn BIO_method_type 159.Fn BIO_method_type
127returns the type of a BIO. 160returns the type of the given
161.Fa bio .
162.Pp
163.Fn BIO_method_name
164returns an ASCII string representing the type of the
165.Fa bio .
128.Sh RETURN VALUES 166.Sh RETURN VALUES
129.Fn BIO_find_type 167.Fn BIO_find_type
130returns a matching BIO or 168returns the next matching BIO or
169.Dv NULL
170if
171.Fa bio
172is a
131.Dv NULL 173.Dv NULL
132for no match. 174pointer or if no matching BIO is found.
133.Pp 175.Pp
134.Fn BIO_next 176.Fn BIO_next
135returns the next BIO in a chain. 177returns the next BIO or
178.Dv NULL
179if
180.Fa bio
181is a
182.Dv NULL
183pointer or points to the last BIO in a chain.
136.Pp 184.Pp
137.Fn BIO_method_type 185.Fn BIO_method_type
138returns the type of the BIO 186returns one of the
139.Fa b . 187.Dv BIO_TYPE_*
188constants.
189.Pp
190.Fn BIO_method_name
191returns an internal pointer to a string.
140.Sh EXAMPLES 192.Sh EXAMPLES
141Traverse a chain looking for digest BIOs: 193Traverse a chain looking for digest BIOs:
142.Bd -literal -offset 2n 194.Bd -literal -offset 2n
143BIO *btmp; 195BIO *btmp;
144btmp = in_bio; /* in_bio is chain to search through */
145 196
146do { 197btmp = in_bio; /* in_bio is the chain to search through */
198while (btmp != NULL) {
147 btmp = BIO_find_type(btmp, BIO_TYPE_MD); 199 btmp = BIO_find_type(btmp, BIO_TYPE_MD);
148 if (btmp == NULL) 200 if (btmp == NULL)
149 break; /* Not found */ 201 break; /* Not found */
150 /* btmp is a digest BIO, do something with it ...*/ 202
203 /* btmp is a digest BIO, do something with it ... */
151 ... 204 ...
152 205
153 btmp = BIO_next(btmp); 206 btmp = BIO_next(btmp);
154} while(btmp); 207}
155.Ed 208.Ed
156.Sh SEE ALSO 209.Sh SEE ALSO
210.Xr BIO_meth_new 3 ,
157.Xr BIO_new 3 211.Xr BIO_new 3
158.Sh HISTORY 212.Sh HISTORY
159.Fn BIO_method_type 213.Fn BIO_method_type
214and
215.Fn BIO_method_name
160first appeared in SSLeay 0.6.0. 216first appeared in SSLeay 0.6.0.
161.Fn BIO_find_type 217.Fn BIO_find_type
162first appeared in SSLeay 0.6.6. 218first appeared in SSLeay 0.6.6.
163Both functions have been available since 219These functions have been available since
164.Ox 2.4 . 220.Ox 2.4 .
165.Pp 221.Pp
166.Fn BIO_next 222.Fn BIO_next
167first appeared in OpenSSL 0.9.6 and has been available since 223first appeared in OpenSSL 0.9.6 and has been available since
168.Ox 2.9 . 224.Ox 2.9 .
169.Sh BUGS
170.Fn BIO_find_type
171in OpenSSL 0.9.5a and earlier could not be safely passed a
172.Dv NULL
173pointer for the
174.Fa b
175argument.