diff options
author | schwarze <> | 2021-11-25 12:15:37 +0000 |
---|---|---|
committer | schwarze <> | 2021-11-25 12:15:37 +0000 |
commit | 0c3a7776d2ee6e4d66a61ad715c22adf27b4ed99 (patch) | |
tree | 9aea3ebaf16488366221139a852b4eec175645e3 /src/lib | |
parent | aceb60d6e488e4f7d6c8398188afe5a176df80dc (diff) | |
download | openbsd-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.3 | 145 |
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 |
97 | The function | ||
98 | .Fn BIO_find_type | 124 | .Fn BIO_find_type |
99 | searches for a BIO of a given type in a chain, starting at BIO | 125 | searches for a BIO matching the given |
100 | .Fa b . | 126 | .Fa type |
101 | If | 127 | in the chain starting at |
102 | .Fa bio_type | 128 | .Fa bio . |
103 | is a specific type (such as | 129 | If the least significant byte of the |
104 | .Dv BIO_TYPE_MEM ) , | 130 | .Fa type |
105 | then a search is made for a BIO of that type. | 131 | argument is non-zero, only exact matches of the |
106 | If | 132 | .Fa type |
107 | .Fa bio_type | 133 | are accepted. |
108 | is a general type (such as | 134 | Otherwise, a match only requires that any of the bits set in the |
109 | .Dv BIO_TYPE_SOURCE_SINK ) , | 135 | .Fa type |
110 | then the next matching BIO of the given general type is searched for. | 136 | argument is also set in the candidate BIO. |
111 | .Fn BIO_find_type | ||
112 | returns the next matching BIO or | ||
113 | .Dv NULL | ||
114 | if none is found. | ||
115 | .Pp | 137 | .Pp |
116 | Note: not all the | 138 | Not all the |
117 | .Dv BIO_TYPE_* | 139 | .Dv BIO_TYPE_* |
118 | types above have corresponding BIO implementations. | 140 | types shown above have corresponding BIO implementations. |
141 | .Pp | ||
142 | Types with a least significant byte in the range from 0 to | ||
143 | .Dv BIO_TYPE_START , | ||
144 | inclusive, are reserved for BIO types built into the library. | ||
145 | Types with a least significant byte greater than | ||
146 | .Dv BIO_TYPE_START | ||
147 | are available for user-defined BIO types; see | ||
148 | .Xr BIO_get_new_index 3 | ||
149 | for details. | ||
119 | .Pp | 150 | .Pp |
120 | .Fn BIO_next | 151 | .Fn BIO_next |
121 | returns the next BIO in a chain. | 152 | returns the next BIO in the chain after |
122 | It can be used to traverse all BIOs in a chain or used in conjunction with | 153 | .Fa bio . |
154 | This function can be used to traverse all BIOs in a chain | ||
155 | or in conjunction with | ||
123 | .Fn BIO_find_type | 156 | .Fn BIO_find_type |
124 | to find all BIOs of a certain type. | 157 | to find all BIOs of a certain type. |
125 | .Pp | 158 | .Pp |
126 | .Fn BIO_method_type | 159 | .Fn BIO_method_type |
127 | returns the type of a BIO. | 160 | returns the type of the given |
161 | .Fa bio . | ||
162 | .Pp | ||
163 | .Fn BIO_method_name | ||
164 | returns 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 |
130 | returns a matching BIO or | 168 | returns the next matching BIO or |
169 | .Dv NULL | ||
170 | if | ||
171 | .Fa bio | ||
172 | is a | ||
131 | .Dv NULL | 173 | .Dv NULL |
132 | for no match. | 174 | pointer or if no matching BIO is found. |
133 | .Pp | 175 | .Pp |
134 | .Fn BIO_next | 176 | .Fn BIO_next |
135 | returns the next BIO in a chain. | 177 | returns the next BIO or |
178 | .Dv NULL | ||
179 | if | ||
180 | .Fa bio | ||
181 | is a | ||
182 | .Dv NULL | ||
183 | pointer or points to the last BIO in a chain. | ||
136 | .Pp | 184 | .Pp |
137 | .Fn BIO_method_type | 185 | .Fn BIO_method_type |
138 | returns the type of the BIO | 186 | returns one of the |
139 | .Fa b . | 187 | .Dv BIO_TYPE_* |
188 | constants. | ||
189 | .Pp | ||
190 | .Fn BIO_method_name | ||
191 | returns an internal pointer to a string. | ||
140 | .Sh EXAMPLES | 192 | .Sh EXAMPLES |
141 | Traverse a chain looking for digest BIOs: | 193 | Traverse a chain looking for digest BIOs: |
142 | .Bd -literal -offset 2n | 194 | .Bd -literal -offset 2n |
143 | BIO *btmp; | 195 | BIO *btmp; |
144 | btmp = in_bio; /* in_bio is chain to search through */ | ||
145 | 196 | ||
146 | do { | 197 | btmp = in_bio; /* in_bio is the chain to search through */ |
198 | while (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 |
214 | and | ||
215 | .Fn BIO_method_name | ||
160 | first appeared in SSLeay 0.6.0. | 216 | first appeared in SSLeay 0.6.0. |
161 | .Fn BIO_find_type | 217 | .Fn BIO_find_type |
162 | first appeared in SSLeay 0.6.6. | 218 | first appeared in SSLeay 0.6.6. |
163 | Both functions have been available since | 219 | These 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 |
167 | first appeared in OpenSSL 0.9.6 and has been available since | 223 | first 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 | ||
171 | in OpenSSL 0.9.5a and earlier could not be safely passed a | ||
172 | .Dv NULL | ||
173 | pointer for the | ||
174 | .Fa b | ||
175 | argument. | ||