diff options
| author | schwarze <> | 2017-01-03 20:15:47 +0000 |
|---|---|---|
| committer | schwarze <> | 2017-01-03 20:15:47 +0000 |
| commit | 38d2b71d2a2adeefafc924e981c8ac3ded3caa51 (patch) | |
| tree | 9115c6517bef9bf4b4021cfbfac5340bbaccd455 /src | |
| parent | 0b4f5811f7723c0fb3cb005fcd2c13c3411e0fdb (diff) | |
| download | openbsd-38d2b71d2a2adeefafc924e981c8ac3ded3caa51.tar.gz openbsd-38d2b71d2a2adeefafc924e981c8ac3ded3caa51.tar.bz2 openbsd-38d2b71d2a2adeefafc924e981c8ac3ded3caa51.zip | |
Document ASN1_TYPE_new(3) and ASN1_TYPE_free(3), even though OpenSSL
does not document them. By being in <openssl/asn1.h>, they are
public, and it makes no sense to document accessors but not document
constructors and destructors.
Improve the one-line description.
Mention various missing details.
Many wording improvements.
Add some cross references.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/man/ASN1_TYPE_get.3 | 134 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/ASN1_item_new.3 | 6 |
2 files changed, 106 insertions, 34 deletions
diff --git a/src/lib/libcrypto/man/ASN1_TYPE_get.3 b/src/lib/libcrypto/man/ASN1_TYPE_get.3 index 5531e572d1..47ea1cdfc6 100644 --- a/src/lib/libcrypto/man/ASN1_TYPE_get.3 +++ b/src/lib/libcrypto/man/ASN1_TYPE_get.3 | |||
| @@ -1,7 +1,24 @@ | |||
| 1 | .\" $OpenBSD: ASN1_TYPE_get.3,v 1.2 2016/11/12 19:23:16 jmc Exp $ | 1 | .\" $OpenBSD: ASN1_TYPE_get.3,v 1.3 2017/01/03 20:15:47 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Mon Jun 6 00:43:05 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Mon Jun 6 00:43:05 2016 -0400 |
| 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) 2017 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) 2015, 2016 The OpenSSL Project. All rights reserved. | 22 | .\" Copyright (c) 2015, 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,17 +65,23 @@ | |||
| 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: November 12 2016 $ | 68 | .Dd $Mdocdate: January 3 2017 $ |
| 52 | .Dt ASN1_TYPE_GET 3 | 69 | .Dt ASN1_TYPE_GET 3 |
| 53 | .Os | 70 | .Os |
| 54 | .Sh NAME | 71 | .Sh NAME |
| 72 | .Nm ASN1_TYPE_new , | ||
| 73 | .Nm ASN1_TYPE_free , | ||
| 55 | .Nm ASN1_TYPE_get , | 74 | .Nm ASN1_TYPE_get , |
| 56 | .Nm ASN1_TYPE_set , | 75 | .Nm ASN1_TYPE_set , |
| 57 | .Nm ASN1_TYPE_set1 , | 76 | .Nm ASN1_TYPE_set1 , |
| 58 | .Nm ASN1_TYPE_cmp | 77 | .Nm ASN1_TYPE_cmp |
| 59 | .Nd ASN1_TYPE utility functions | 78 | .Nd ASN.1 objects of arbitrary type |
| 60 | .Sh SYNOPSIS | 79 | .Sh SYNOPSIS |
| 61 | .In openssl/asn1.h | 80 | .In openssl/asn1.h |
| 81 | .Ft ASN1_TYPE * | ||
| 82 | .Fn ASN1_TYPE_new void | ||
| 83 | .Ft void | ||
| 84 | .Fn ASN1_TYPE_free "ASN1_TYPE *a" | ||
| 62 | .Ft int | 85 | .Ft int |
| 63 | .Fo ASN1_TYPE_get | 86 | .Fo ASN1_TYPE_get |
| 64 | .Fa "ASN1_TYPE *a" | 87 | .Fa "ASN1_TYPE *a" |
| @@ -81,20 +104,41 @@ | |||
| 81 | .Fa "ASN1_TYPE *b" | 104 | .Fa "ASN1_TYPE *b" |
| 82 | .Fc | 105 | .Fc |
| 83 | .Sh DESCRIPTION | 106 | .Sh DESCRIPTION |
| 84 | These functions manipulate | ||
| 85 | .Vt ASN1_TYPE | 107 | .Vt ASN1_TYPE |
| 86 | structures. | 108 | represents the ASN.1 ANY type. |
| 87 | An | 109 | An |
| 88 | .Vt ASN1_TYPE | 110 | .Vt ASN1_TYPE |
| 89 | structure can contain any ASN.1 type or constructed type such as a | 111 | object can store an ASN.1 value of arbitrary type, |
| 90 | SEQUENCE: it is effectively equivalent to the ASN.1 ANY type. | 112 | including constructed types such as a SEQUENCE. |
| 113 | It also remembers internally which type it currently holds. | ||
| 114 | .Pp | ||
| 115 | .Fn ASN1_TYPE_new | ||
| 116 | allocates and initializes an empty | ||
| 117 | .Vt ASN1_TYPE | ||
| 118 | object of undefined type. | ||
| 119 | .Pp | ||
| 120 | .Fn ASN1_TYPE_free | ||
| 121 | frees | ||
| 122 | .Fa a | ||
| 123 | including the value stored in it, if any. | ||
| 124 | If | ||
| 125 | .Fa a | ||
| 126 | is a | ||
| 127 | .Dv NULL | ||
| 128 | pointer, no action occurs. | ||
| 91 | .Pp | 129 | .Pp |
| 92 | .Fn ASN1_TYPE_get | 130 | .Fn ASN1_TYPE_get |
| 93 | returns the type of | 131 | returns the type of |
| 94 | .Fa a . | 132 | .Fa a , |
| 133 | represented by one of the | ||
| 134 | .Dv V_ASN1_* | ||
| 135 | constants defined in | ||
| 136 | .In openssl/asn1.h . | ||
| 95 | .Pp | 137 | .Pp |
| 96 | .Fn ASN1_TYPE_set | 138 | .Fn ASN1_TYPE_set |
| 97 | sets the value of | 139 | frees the value contained in |
| 140 | .Fa a , | ||
| 141 | if any, and sets | ||
| 98 | .Fa a | 142 | .Fa a |
| 99 | to | 143 | to |
| 100 | .Fa type | 144 | .Fa type |
| @@ -107,28 +151,28 @@ internally so it must | |||
| 107 | be freed up after the call. | 151 | be freed up after the call. |
| 108 | .Pp | 152 | .Pp |
| 109 | .Fn ASN1_TYPE_set1 | 153 | .Fn ASN1_TYPE_set1 |
| 110 | sets the value of | 154 | sets the type of |
| 111 | .Fa a | 155 | .Fa a |
| 112 | to | 156 | to |
| 113 | .Fa type | 157 | .Fa type |
| 114 | and a copy of | 158 | and its value to a copy of |
| 115 | .Fa value . | 159 | .Fa value . |
| 116 | .Pp | 160 | If copying succeeds, the previous value that was contained in |
| 117 | .Fn ASN1_TYPE_cmp | ||
| 118 | compares ASN.1 types | ||
| 119 | .Fa a | 161 | .Fa a |
| 120 | and | 162 | is freed. |
| 121 | .Fa b . | 163 | If copying fails, |
| 164 | .Fa a | ||
| 165 | remains unchanged. | ||
| 122 | .Pp | 166 | .Pp |
| 123 | The type and meaning of the | 167 | The type and meaning of the |
| 124 | .Fa value | 168 | .Fa value |
| 125 | parameter for | 169 | argument of |
| 126 | .Fn ASN1_TYPE_set | 170 | .Fn ASN1_TYPE_set |
| 127 | and | 171 | and |
| 128 | .Fn ASN1_TYPE_set1 | 172 | .Fn ASN1_TYPE_set1 |
| 129 | is determined by the | 173 | is determined by the |
| 130 | .Fa type | 174 | .Fa type |
| 131 | parameter. | 175 | argument. |
| 132 | If | 176 | If |
| 133 | .Fa type | 177 | .Fa type |
| 134 | is | 178 | is |
| @@ -173,19 +217,26 @@ contains the entire ASN.1 encoding verbatim, including tag and | |||
| 173 | length octets. | 217 | length octets. |
| 174 | .Pp | 218 | .Pp |
| 175 | .Fn ASN1_TYPE_cmp | 219 | .Fn ASN1_TYPE_cmp |
| 176 | may not return zero if two types are equivalent but have different | 220 | checks that |
| 177 | encodings. | 221 | .Fa a |
| 178 | For example the single content octet of the boolean TRUE value under BER | 222 | and |
| 179 | can have any non-zero encoding but | 223 | .Fa b |
| 224 | have the same type, the same value, and are encoded in the same way. | ||
| 225 | .Pp | ||
| 226 | If the types agree and the values have the same meaning but are | ||
| 227 | encoded differently, they are considered different. | ||
| 228 | For example, a boolean value is represented | ||
| 229 | using a single content octet. | ||
| 230 | Under BER, any non-zero octet represents the TRUE value, but | ||
| 180 | .Fn ASN1_TYPE_cmp | 231 | .Fn ASN1_TYPE_cmp |
| 181 | will only return zero if the values are the same. | 232 | will only report a match if the content octet is the same. |
| 182 | .Pp | 233 | .Pp |
| 183 | If either or both of the parameters passed to | 234 | If either or both of the arguments passed to |
| 184 | .Fn ASN1_TYPE_cmp | 235 | .Fn ASN1_TYPE_cmp |
| 185 | is | 236 | is |
| 186 | .Dv NULL , | 237 | .Dv NULL , |
| 187 | the return value is non-zero. | 238 | the result is a mismatch. |
| 188 | Technically, if both parameters are | 239 | Technically, if both arguments are |
| 189 | .Dv NULL , | 240 | .Dv NULL , |
| 190 | the two types could be absent OPTIONAL fields and so should match, | 241 | the two types could be absent OPTIONAL fields and so should match, |
| 191 | however passing | 242 | however passing |
| @@ -198,13 +249,32 @@ for types which do | |||
| 198 | match. | 249 | match. |
| 199 | So applications should handle the case of two absent values separately. | 250 | So applications should handle the case of two absent values separately. |
| 200 | .Sh RETURN VALUES | 251 | .Sh RETURN VALUES |
| 201 | .Fn ASN1_TYPE_get | 252 | .Fn ASN1_TYPE_new |
| 202 | returns the type of the | 253 | returns the new |
| 203 | .Vt ASN1_TYPE | 254 | .Vt ASN1_TYPE |
| 204 | argument. | 255 | object or |
| 256 | .Dv NULL | ||
| 257 | if an error occurs. | ||
| 258 | .Pp | ||
| 259 | .Fn ASN1_TYPE_get | ||
| 260 | returns the type of | ||
| 261 | .Fa a | ||
| 262 | or 0 if an error occurs. | ||
| 263 | The latter can happen if | ||
| 264 | .Fa a | ||
| 265 | does not contain a value even though its type is not | ||
| 266 | .Dv V_ASN1_NULL . | ||
| 267 | For example, it will always happen for empty objects | ||
| 268 | newly constructed with | ||
| 269 | .Fn ASN1_TYPE_new . | ||
| 205 | .Pp | 270 | .Pp |
| 206 | .Fn ASN1_TYPE_set1 | 271 | .Fn ASN1_TYPE_set1 |
| 207 | returns 1 for success or 0 for failure. | 272 | returns 1 if the copying succeeds or 0 if it fails. |
| 208 | .Pp | 273 | .Pp |
| 209 | .Fn ASN1_TYPE_cmp | 274 | .Fn ASN1_TYPE_cmp |
| 210 | returns 0 if the types are identical or non-zero otherwise. | 275 | returns 0 for a match or non-zero for a mismatch. |
| 276 | .Sh SEE ALSO | ||
| 277 | .Xr ASN1_item_free 3 , | ||
| 278 | .Xr ASN1_STRING_dup 3 , | ||
| 279 | .Xr d2i_ASN1_TYPE 3 , | ||
| 280 | .Xr OBJ_dup 3 | ||
diff --git a/src/lib/libcrypto/man/ASN1_item_new.3 b/src/lib/libcrypto/man/ASN1_item_new.3 index 0444bbe15a..e679815751 100644 --- a/src/lib/libcrypto/man/ASN1_item_new.3 +++ b/src/lib/libcrypto/man/ASN1_item_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_item_new.3,v 1.1 2016/12/24 21:42:29 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_item_new.3,v 1.2 2017/01/03 20:15:47 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: December 24 2016 $ | 17 | .Dd $Mdocdate: January 3 2017 $ |
| 18 | .Dt ASN1_ITEM_NEW 3 | 18 | .Dt ASN1_ITEM_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -95,6 +95,8 @@ object or | |||
| 95 | if an error occurs. | 95 | if an error occurs. |
| 96 | .Sh SEE ALSO | 96 | .Sh SEE ALSO |
| 97 | .Xr ASN1_item_d2i 3 , | 97 | .Xr ASN1_item_d2i 3 , |
| 98 | .Xr ASN1_TYPE_new 3 , | ||
| 99 | .Xr d2i_ASN1_NULL 3 , | ||
| 98 | .Xr OBJ_nid2obj 3 | 100 | .Xr OBJ_nid2obj 3 |
| 99 | .Sh BUGS | 101 | .Sh BUGS |
| 100 | The | 102 | The |
