diff options
| author | schwarze <> | 2017-01-04 05:14:51 +0000 |
|---|---|---|
| committer | schwarze <> | 2017-01-04 05:14:51 +0000 |
| commit | da995534eda29d95a33daf820426f8426360728c (patch) | |
| tree | 8e331ada8bb4ae35121a26f3453e9f02e803b3ff /src | |
| parent | 881e9ca4ac4f6120cb6119128535c149f0fbae8f (diff) | |
| download | openbsd-da995534eda29d95a33daf820426f8426360728c.tar.gz openbsd-da995534eda29d95a33daf820426f8426360728c.tar.bz2 openbsd-da995534eda29d95a33daf820426f8426360728c.zip | |
Describe what ASN1_OBJECT_new(3), ASN1_OBJECT_free(3), OBJ_dup(3),
and OBJ_create(3) really do rather than making broad and incomplete
statements that are only true in some cases.
Improve the one-line descriptions.
Some minor wording improvements while here.
There is obviously more work to do in the vicinity...
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/man/ASN1_OBJECT_new.3 | 77 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/OBJ_nid2obj.3 | 62 |
2 files changed, 105 insertions, 34 deletions
diff --git a/src/lib/libcrypto/man/ASN1_OBJECT_new.3 b/src/lib/libcrypto/man/ASN1_OBJECT_new.3 index 55a90bbcb2..e7c3540b3a 100644 --- a/src/lib/libcrypto/man/ASN1_OBJECT_new.3 +++ b/src/lib/libcrypto/man/ASN1_OBJECT_new.3 | |||
| @@ -1,7 +1,24 @@ | |||
| 1 | .\" $OpenBSD: ASN1_OBJECT_new.3,v 1.7 2016/11/10 14:34:18 jmc Exp $ | 1 | .\" $OpenBSD: ASN1_OBJECT_new.3,v 1.8 2017/01/04 05:14:51 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d4 Mar 19 12:28:58 2016 -0400 | 2 | .\" OpenSSL 99d63d4 Mar 19 12:28:58 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file was written by Dr. Stephen Henson. | 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. | ||
| 5 | .\" Copyright (c) 2002, 2006 The OpenSSL Project. All rights reserved. | 22 | .\" Copyright (c) 2002, 2006 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,13 +65,13 @@ | |||
| 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 10 2016 $ | 68 | .Dd $Mdocdate: January 4 2017 $ |
| 52 | .Dt ASN1_OBJECT_NEW 3 | 69 | .Dt ASN1_OBJECT_NEW 3 |
| 53 | .Os | 70 | .Os |
| 54 | .Sh NAME | 71 | .Sh NAME |
| 55 | .Nm ASN1_OBJECT_new , | 72 | .Nm ASN1_OBJECT_new , |
| 56 | .Nm ASN1_OBJECT_free | 73 | .Nm ASN1_OBJECT_free |
| 57 | .Nd ASN.1 object allocation functions | 74 | .Nd ASN.1 object identifiers |
| 58 | .Sh SYNOPSIS | 75 | .Sh SYNOPSIS |
| 59 | .In openssl/asn1.h | 76 | .In openssl/asn1.h |
| 60 | .Ft ASN1_OBJECT * | 77 | .Ft ASN1_OBJECT * |
| @@ -66,34 +83,45 @@ | |||
| 66 | .Fa "ASN1_OBJECT *a" | 83 | .Fa "ASN1_OBJECT *a" |
| 67 | .Fc | 84 | .Fc |
| 68 | .Sh DESCRIPTION | 85 | .Sh DESCRIPTION |
| 69 | The ASN1_OBJECT allocation routines allocate and free an | 86 | .Fn ASN1_OBJECT_new |
| 87 | allocates and initializes an empty | ||
| 70 | .Vt ASN1_OBJECT | 88 | .Vt ASN1_OBJECT |
| 71 | structure, which represents an ASN.1 OBJECT IDENTIFIER. | 89 | object, representing an ASN.1 OBJECT IDENTIFIER. |
| 90 | It can hold a short name, a long name, a numeric identifier (NID), | ||
| 91 | and a sequence of integers identifying a node in the International | ||
| 92 | Object Identifier tree as specified in ITU-T recommendation X.660. | ||
| 93 | The new object is marked as dynamically allocated. | ||
| 72 | .Pp | 94 | .Pp |
| 95 | Application programs normally use utility functions like | ||
| 96 | .Xr OBJ_nid2obj 3 | ||
| 97 | rather than using | ||
| 73 | .Fn ASN1_OBJECT_new | 98 | .Fn ASN1_OBJECT_new |
| 74 | allocates and initializes an | 99 | directly. |
| 75 | .Vt ASN1_OBJECT | ||
| 76 | structure. | ||
| 77 | .Pp | 100 | .Pp |
| 78 | .Fn ASN1_OBJECT_free | 101 | .Fn ASN1_OBJECT_free |
| 79 | frees up the | 102 | has the following effects: |
| 80 | .Vt ASN1_OBJECT | 103 | .Pp |
| 81 | structure | 104 | All data contained in |
| 82 | .Fa a . | 105 | .Fa a |
| 106 | that is marked as dynamically allocated is freed, | ||
| 107 | and the respective fields of | ||
| 108 | .Fa a | ||
| 109 | become empty. | ||
| 110 | Contained data not marked as dynamically allocated remains intact. | ||
| 111 | .Pp | ||
| 112 | If the object | ||
| 113 | .Fa a | ||
| 114 | itself is marked as dynamically allocated, it is freed. | ||
| 115 | Otherwise, the pointer | ||
| 116 | .Fa a | ||
| 117 | remains valid. | ||
| 118 | .Pp | ||
| 83 | If | 119 | If |
| 84 | .Fa a | 120 | .Fa a |
| 85 | is a | 121 | is a |
| 86 | .Dv NULL | 122 | .Dv NULL |
| 87 | pointer, no action occurs. | 123 | pointer or if neither the object itself nor any of its content |
| 88 | .Pp | 124 | is marked as dynamically allocated, no action occurs. |
| 89 | Although | ||
| 90 | .Fn ASN1_OBJECT_new | ||
| 91 | allocates a new | ||
| 92 | .Vt ASN1_OBJECT | ||
| 93 | structure, it is almost never used in applications. | ||
| 94 | The ASN.1 object utility functions such as | ||
| 95 | .Xr OBJ_nid2obj 3 | ||
| 96 | are used instead. | ||
| 97 | .Sh RETURN VALUES | 125 | .Sh RETURN VALUES |
| 98 | If the allocation fails, | 126 | If the allocation fails, |
| 99 | .Fn ASN1_OBJECT_new | 127 | .Fn ASN1_OBJECT_new |
| @@ -101,10 +129,9 @@ returns | |||
| 101 | .Dv NULL | 129 | .Dv NULL |
| 102 | and sets an error code that can be obtained by | 130 | and sets an error code that can be obtained by |
| 103 | .Xr ERR_get_error 3 . | 131 | .Xr ERR_get_error 3 . |
| 104 | Otherwise it returns a pointer to the newly allocated structure. | 132 | Otherwise it returns a pointer to the new object. |
| 105 | .Sh SEE ALSO | 133 | .Sh SEE ALSO |
| 106 | .Xr d2i_ASN1_OBJECT 3 , | 134 | .Xr d2i_ASN1_OBJECT 3 , |
| 107 | .Xr ERR_get_error 3 , | ||
| 108 | .Xr OBJ_nid2obj 3 | 135 | .Xr OBJ_nid2obj 3 |
| 109 | .Sh HISTORY | 136 | .Sh HISTORY |
| 110 | .Fn ASN1_OBJECT_new | 137 | .Fn ASN1_OBJECT_new |
diff --git a/src/lib/libcrypto/man/OBJ_nid2obj.3 b/src/lib/libcrypto/man/OBJ_nid2obj.3 index 6183831784..5fa3e6fa7a 100644 --- a/src/lib/libcrypto/man/OBJ_nid2obj.3 +++ b/src/lib/libcrypto/man/OBJ_nid2obj.3 | |||
| @@ -1,7 +1,24 @@ | |||
| 1 | .\" $OpenBSD: OBJ_nid2obj.3,v 1.4 2016/11/27 18:22:25 schwarze Exp $ | 1 | .\" $OpenBSD: OBJ_nid2obj.3,v 1.5 2017/01/04 05:14:51 schwarze Exp $ |
| 2 | .\" OpenSSL c264592d May 14 11:28:00 2006 +0000 | 2 | .\" OpenSSL c264592d May 14 11:28:00 2006 +0000 |
| 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) 2002, 2006, 2015, 2016 The OpenSSL Project. | 22 | .\" Copyright (c) 2002, 2006, 2015, 2016 The OpenSSL Project. |
| 6 | .\" All rights reserved. | 23 | .\" All rights reserved. |
| 7 | .\" | 24 | .\" |
| @@ -49,7 +66,7 @@ | |||
| 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 51 | .\" | 68 | .\" |
| 52 | .Dd $Mdocdate: November 27 2016 $ | 69 | .Dd $Mdocdate: January 4 2017 $ |
| 53 | .Dt OBJ_NID2OBJ 3 | 70 | .Dt OBJ_NID2OBJ 3 |
| 54 | .Os | 71 | .Os |
| 55 | .Sh NAME | 72 | .Sh NAME |
| @@ -67,7 +84,7 @@ | |||
| 67 | .Nm OBJ_create , | 84 | .Nm OBJ_create , |
| 68 | .Nm OBJ_cleanup , | 85 | .Nm OBJ_cleanup , |
| 69 | .Nm i2t_ASN1_OBJECT | 86 | .Nm i2t_ASN1_OBJECT |
| 70 | .Nd ASN.1 object utility functions | 87 | .Nd inspect and create ASN.1 object identifiers |
| 71 | .Sh SYNOPSIS | 88 | .Sh SYNOPSIS |
| 72 | .In openssl/objects.h | 89 | .In openssl/objects.h |
| 73 | .Ft ASN1_OBJECT * | 90 | .Ft ASN1_OBJECT * |
| @@ -225,8 +242,20 @@ to | |||
| 225 | If the two are identical, 0 is returned. | 242 | If the two are identical, 0 is returned. |
| 226 | .Pp | 243 | .Pp |
| 227 | .Fn OBJ_dup | 244 | .Fn OBJ_dup |
| 228 | returns a copy of | 245 | returns a deep copy of |
| 229 | .Fa o . | 246 | .Fa o |
| 247 | if | ||
| 248 | .Fa o | ||
| 249 | is marked as dynamically allocated. | ||
| 250 | The new object and all data contained in it is marked as dynamically | ||
| 251 | allocated. | ||
| 252 | If | ||
| 253 | .Fa o | ||
| 254 | is not marked as dynamically allocated, | ||
| 255 | .Fn OBJ_dup | ||
| 256 | just returns | ||
| 257 | .Fa o | ||
| 258 | itself. | ||
| 230 | .Pp | 259 | .Pp |
| 231 | .Fn OBJ_create | 260 | .Fn OBJ_create |
| 232 | adds a new object to the internal table. | 261 | adds a new object to the internal table. |
| @@ -238,6 +267,14 @@ the short name and | |||
| 238 | the long name. | 267 | the long name. |
| 239 | A new NID is returned for the created object. | 268 | A new NID is returned for the created object. |
| 240 | .Pp | 269 | .Pp |
| 270 | The new object added to the internal table and all the data | ||
| 271 | contained in it is marked as not dynamically allocated. | ||
| 272 | Consequently, retrieving it with | ||
| 273 | .Fn OBJ_nid2obj | ||
| 274 | or a similar function and then calling | ||
| 275 | .Xr ASN1_OBJECT_free 3 | ||
| 276 | on the returned pointer will have no effect. | ||
| 277 | .Pp | ||
| 241 | .Fn OBJ_cleanup | 278 | .Fn OBJ_cleanup |
| 242 | cleans up the internal object table: this should be called before | 279 | cleans up the internal object table: this should be called before |
| 243 | an application exits if any new objects were added using | 280 | an application exits if any new objects were added using |
| @@ -275,11 +312,13 @@ and | |||
| 275 | can process the numerical form of an OID. | 312 | can process the numerical form of an OID. |
| 276 | .Sh RETURN VALUES | 313 | .Sh RETURN VALUES |
| 277 | .Fn OBJ_nid2obj | 314 | .Fn OBJ_nid2obj |
| 278 | returns an | 315 | and |
| 316 | .Fn OBJ_dup | ||
| 317 | return an | ||
| 279 | .Vt ASN1_OBJECT | 318 | .Vt ASN1_OBJECT |
| 280 | structure or | 319 | object or |
| 281 | .Dv NULL | 320 | .Dv NULL |
| 282 | if an error occurred. | 321 | if an error occurs. |
| 283 | .Pp | 322 | .Pp |
| 284 | .Fn OBJ_nid2ln | 323 | .Fn OBJ_nid2ln |
| 285 | and | 324 | and |
| @@ -296,6 +335,11 @@ and | |||
| 296 | return a NID or | 335 | return a NID or |
| 297 | .Dv NID_undef | 336 | .Dv NID_undef |
| 298 | on error. | 337 | on error. |
| 338 | .Pp | ||
| 339 | .Fn OBJ_create | ||
| 340 | returns the new NID or | ||
| 341 | .Dv NID_undef | ||
| 342 | if an error occurs. | ||
| 299 | .Sh EXAMPLES | 343 | .Sh EXAMPLES |
| 300 | Create an object for | 344 | Create an object for |
| 301 | .Sy commonName : | 345 | .Sy commonName : |
