summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2021-12-15 20:07:51 +0000
committerschwarze <>2021-12-15 20:07:51 +0000
commit1959f03a0a5b06e7800a2876638580fa1f2a8713 (patch)
tree347cf4cc9928f5f06b7102ef9daf11dea451fac9
parent32d18bff50d185454dd5f17af09dc363fc58a6d8 (diff)
downloadopenbsd-1959f03a0a5b06e7800a2876638580fa1f2a8713.tar.gz
openbsd-1959f03a0a5b06e7800a2876638580fa1f2a8713.tar.bz2
openbsd-1959f03a0a5b06e7800a2876638580fa1f2a8713.zip
Move OBJ_create(3) into its own manual page
because OBJ_nid2obj(3) is already long and more functions related to OBJ_create(3) have to be documented.
-rw-r--r--src/lib/libcrypto/man/ASN1_OBJECT_new.35
-rw-r--r--src/lib/libcrypto/man/ASN1_STRING_TABLE_add.35
-rw-r--r--src/lib/libcrypto/man/Makefile3
-rw-r--r--src/lib/libcrypto/man/OBJ_create.3140
-rw-r--r--src/lib/libcrypto/man/OBJ_nid2obj.367
5 files changed, 157 insertions, 63 deletions
diff --git a/src/lib/libcrypto/man/ASN1_OBJECT_new.3 b/src/lib/libcrypto/man/ASN1_OBJECT_new.3
index 24e9767f3d..6aa4723c7f 100644
--- a/src/lib/libcrypto/man/ASN1_OBJECT_new.3
+++ b/src/lib/libcrypto/man/ASN1_OBJECT_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_OBJECT_new.3,v 1.14 2021/12/09 18:43:50 schwarze Exp $ 1.\" $OpenBSD: ASN1_OBJECT_new.3,v 1.15 2021/12/15 20:07:51 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d4 Mar 19 12:28:58 2016 -0400 2.\" full merge up to: OpenSSL 99d63d4 Mar 19 12:28:58 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -65,7 +65,7 @@
65.\" 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
66.\" OF THE POSSIBILITY OF SUCH DAMAGE. 66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\" 67.\"
68.Dd $Mdocdate: December 9 2021 $ 68.Dd $Mdocdate: December 15 2021 $
69.Dt ASN1_OBJECT_NEW 3 69.Dt ASN1_OBJECT_NEW 3
70.Os 70.Os
71.Sh NAME 71.Sh NAME
@@ -186,6 +186,7 @@ Memory allocation failed.
186.Xr a2d_ASN1_OBJECT 3 , 186.Xr a2d_ASN1_OBJECT 3 ,
187.Xr ASN1_TYPE_get 3 , 187.Xr ASN1_TYPE_get 3 ,
188.Xr d2i_ASN1_OBJECT 3 , 188.Xr d2i_ASN1_OBJECT 3 ,
189.Xr OBJ_create 3 ,
189.Xr OBJ_nid2obj 3 190.Xr OBJ_nid2obj 3
190.Sh STANDARDS 191.Sh STANDARDS
191ITU-T Recommendation X.208, also known as ISO/IEC 8824-1: 192ITU-T Recommendation X.208, also known as ISO/IEC 8824-1:
diff --git a/src/lib/libcrypto/man/ASN1_STRING_TABLE_add.3 b/src/lib/libcrypto/man/ASN1_STRING_TABLE_add.3
index 85120de270..482faa0f53 100644
--- a/src/lib/libcrypto/man/ASN1_STRING_TABLE_add.3
+++ b/src/lib/libcrypto/man/ASN1_STRING_TABLE_add.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_STRING_TABLE_add.3,v 1.8 2021/12/14 20:14:22 schwarze Exp $ 1.\" $OpenBSD: ASN1_STRING_TABLE_add.3,v 1.9 2021/12/15 20:07:51 schwarze Exp $
2.\" checked up to: 2.\" checked up to:
3.\" OpenSSL ASN1_STRING_TABLE_add.pod 7b608d08 Jul 27 01:18:50 2017 +0800 3.\" OpenSSL ASN1_STRING_TABLE_add.pod 7b608d08 Jul 27 01:18:50 2017 +0800
4.\" 4.\"
@@ -16,7 +16,7 @@
16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18.\" 18.\"
19.Dd $Mdocdate: December 14 2021 $ 19.Dd $Mdocdate: December 15 2021 $
20.Dt ASN1_STRING_TABLE_ADD 3 20.Dt ASN1_STRING_TABLE_ADD 3
21.Os 21.Os
22.Sh NAME 22.Sh NAME
@@ -129,6 +129,7 @@ if nothing is found.
129.Sh SEE ALSO 129.Sh SEE ALSO
130.Xr ASN1_OBJECT_new 3 , 130.Xr ASN1_OBJECT_new 3 ,
131.Xr ASN1_STRING_set_by_NID 3 , 131.Xr ASN1_STRING_set_by_NID 3 ,
132.Xr OBJ_create 3 ,
132.Xr OBJ_nid2obj 3 133.Xr OBJ_nid2obj 3
133.Sh HISTORY 134.Sh HISTORY
134.Fn ASN1_STRING_TABLE_add , 135.Fn ASN1_STRING_TABLE_add ,
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 2986652b79..9a51640331 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.228 2021/12/14 15:22:49 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.229 2021/12/15 20:07:51 schwarze Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -206,6 +206,7 @@ MAN= \
206 HMAC.3 \ 206 HMAC.3 \
207 MD5.3 \ 207 MD5.3 \
208 NAME_CONSTRAINTS_new.3 \ 208 NAME_CONSTRAINTS_new.3 \
209 OBJ_create.3 \
209 OBJ_nid2obj.3 \ 210 OBJ_nid2obj.3 \
210 OCSP_CRLID_new.3 \ 211 OCSP_CRLID_new.3 \
211 OCSP_REQUEST_new.3 \ 212 OCSP_REQUEST_new.3 \
diff --git a/src/lib/libcrypto/man/OBJ_create.3 b/src/lib/libcrypto/man/OBJ_create.3
new file mode 100644
index 0000000000..37a3907193
--- /dev/null
+++ b/src/lib/libcrypto/man/OBJ_create.3
@@ -0,0 +1,140 @@
1.\" $OpenBSD: OBJ_create.3,v 1.1 2021/12/15 20:07:51 schwarze Exp $
2.\" full merge up to:
3.\" OpenSSL OBJ_nid2obj.pod 9b86974e Aug 17 15:21:33 2015 -0400
4.\" selective merge up to:
5.\" OpenSSL OBJ_nid2obj.pod 35fd9953 May 28 14:49:38 2019 +0200
6.\"
7.\" This file is a derived work.
8.\" The changes are covered by the following Copyright and license:
9.\"
10.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
11.\"
12.\" Permission to use, copy, modify, and distribute this software for any
13.\" purpose with or without fee is hereby granted, provided that the above
14.\" copyright notice and this permission notice appear in all copies.
15.\"
16.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
17.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
18.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
19.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
20.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
21.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
22.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23.\"
24.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
25.\" Copyright (c) 2002, 2006 The OpenSSL Project.
26.\" All rights reserved.
27.\"
28.\" Redistribution and use in source and binary forms, with or without
29.\" modification, are permitted provided that the following conditions
30.\" are met:
31.\"
32.\" 1. Redistributions of source code must retain the above copyright
33.\" notice, this list of conditions and the following disclaimer.
34.\"
35.\" 2. Redistributions in binary form must reproduce the above copyright
36.\" notice, this list of conditions and the following disclaimer in
37.\" the documentation and/or other materials provided with the
38.\" distribution.
39.\"
40.\" 3. All advertising materials mentioning features or use of this
41.\" software must display the following acknowledgment:
42.\" "This product includes software developed by the OpenSSL Project
43.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
44.\"
45.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
46.\" endorse or promote products derived from this software without
47.\" prior written permission. For written permission, please contact
48.\" openssl-core@openssl.org.
49.\"
50.\" 5. Products derived from this software may not be called "OpenSSL"
51.\" nor may "OpenSSL" appear in their names without prior written
52.\" permission of the OpenSSL Project.
53.\"
54.\" 6. Redistributions of any form whatsoever must retain the following
55.\" acknowledgment:
56.\" "This product includes software developed by the OpenSSL Project
57.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
58.\"
59.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
60.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
62.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
63.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
64.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
65.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
66.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
67.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
68.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
69.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
70.\" OF THE POSSIBILITY OF SUCH DAMAGE.
71.\"
72.Dd $Mdocdate: December 15 2021 $
73.Dt OBJ_CREATE 3
74.Os
75.Sh NAME
76.Nm OBJ_create ,
77.Nm OBJ_cleanup
78.Nd modify the table of ASN.1 object identifiers
79.Sh SYNOPSIS
80.In openssl/objects.h
81.Ft int
82.Fo OBJ_create
83.Fa "const char *oid"
84.Fa "const char *sn"
85.Fa "const char *ln"
86.Fc
87.Ft void
88.Fn OBJ_cleanup void
89.Sh DESCRIPTION
90.Fn OBJ_create
91adds a new object to the internal table.
92.Fa oid
93is the numerical form of the object,
94.Fa sn
95the short name and
96.Fa ln
97the long name.
98A new NID is returned for the created object.
99.Pp
100The new object added to the internal table and all the data
101contained in it is marked as not dynamically allocated.
102Consequently, retrieving it with
103.Xr OBJ_nid2obj 3
104or a similar function and then calling
105.Xr ASN1_OBJECT_free 3
106on the returned pointer will have no effect.
107.Pp
108.Fn OBJ_cleanup
109cleans up the internal object table: this should be called before
110an application exits if any new objects were added using
111.Fn OBJ_create .
112.Sh RETURN VALUES
113.Fn OBJ_create
114returns the new NID or
115.Dv NID_undef
116if an error occurs.
117.Pp
118In some cases of failure of
119.Fn OBJ_create ,
120the reason can be determined with
121.Xr ERR_get_error 3 .
122.Sh EXAMPLES
123Create a new NID and initialize an object from it:
124.Bd -literal -offset indent
125int new_nid;
126
127ASN1_OBJECT *obj;
128new_nid = OBJ_create("1.2.3.4", "NewOID", "New Object Identifier");
129obj = OBJ_nid2obj(new_nid);
130.Ed
131.Sh SEE ALSO
132.Xr ASN1_OBJECT_new 3 ,
133.Xr OBJ_nid2obj 3
134.Sh HISTORY
135.Fn OBJ_cleanup
136first appeared in SSLeay 0.8.0 and
137.Fn OBJ_create
138in SSLeay 0.9.0.
139These functions have been available since
140.Ox 2.4 .
diff --git a/src/lib/libcrypto/man/OBJ_nid2obj.3 b/src/lib/libcrypto/man/OBJ_nid2obj.3
index db9cd05c26..a43fe962e1 100644
--- a/src/lib/libcrypto/man/OBJ_nid2obj.3
+++ b/src/lib/libcrypto/man/OBJ_nid2obj.3
@@ -1,5 +1,6 @@
1.\" $OpenBSD: OBJ_nid2obj.3,v 1.15 2021/07/05 17:57:16 schwarze Exp $ 1.\" $OpenBSD: OBJ_nid2obj.3,v 1.16 2021/12/15 20:07:51 schwarze Exp $
2.\" OpenSSL c264592d May 14 11:28:00 2006 +0000 2.\" full merge up to: OpenSSL c264592d May 14 11:28:00 2006 +0000
3.\" selective merge up to: OpenSSL 35fd9953 May 28 14:49:38 2019 +0200
3.\" 4.\"
4.\" This file is a derived work. 5.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license: 6.\" The changes are covered by the following Copyright and license:
@@ -19,7 +20,7 @@
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\" 21.\"
21.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>. 22.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
22.\" Copyright (c) 2002, 2006, 2015, 2016 The OpenSSL Project. 23.\" Copyright (c) 2002, 2006, 2016 The OpenSSL Project.
23.\" All rights reserved. 24.\" All rights reserved.
24.\" 25.\"
25.\" Redistribution and use in source and binary forms, with or without 26.\" Redistribution and use in source and binary forms, with or without
@@ -66,7 +67,7 @@
66.\" 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
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 68.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 69.\"
69.Dd $Mdocdate: July 5 2021 $ 70.Dd $Mdocdate: December 15 2021 $
70.Dt OBJ_NID2OBJ 3 71.Dt OBJ_NID2OBJ 3
71.Os 72.Os
72.Sh NAME 73.Sh NAME
@@ -81,8 +82,6 @@
81.Nm OBJ_obj2txt , 82.Nm OBJ_obj2txt ,
82.Nm OBJ_cmp , 83.Nm OBJ_cmp ,
83.Nm OBJ_dup , 84.Nm OBJ_dup ,
84.Nm OBJ_create ,
85.Nm OBJ_cleanup ,
86.Nm i2t_ASN1_OBJECT , 85.Nm i2t_ASN1_OBJECT ,
87.Nm i2a_ASN1_OBJECT 86.Nm i2a_ASN1_OBJECT
88.Nd inspect and create ASN.1 object identifiers 87.Nd inspect and create ASN.1 object identifiers
@@ -137,14 +136,6 @@
137.Fo OBJ_dup 136.Fo OBJ_dup
138.Fa "const ASN1_OBJECT *o" 137.Fa "const ASN1_OBJECT *o"
139.Fc 138.Fc
140.Ft int
141.Fo OBJ_create
142.Fa "const char *oid"
143.Fa "const char *sn"
144.Fa "const char *ln"
145.Fc
146.Ft void
147.Fn OBJ_cleanup void
148.In openssl/asn1.h 139.In openssl/asn1.h
149.Ft int 140.Ft int
150.Fo i2t_ASN1_OBJECT 141.Fo i2t_ASN1_OBJECT
@@ -286,29 +277,6 @@ just returns
286.Fa o 277.Fa o
287itself. 278itself.
288.Pp 279.Pp
289.Fn OBJ_create
290adds a new object to the internal table.
291.Fa oid
292is the numerical form of the object,
293.Fa sn
294the short name and
295.Fa ln
296the long name.
297A new NID is returned for the created object.
298.Pp
299The new object added to the internal table and all the data
300contained in it is marked as not dynamically allocated.
301Consequently, retrieving it with
302.Fn OBJ_nid2obj
303or a similar function and then calling
304.Xr ASN1_OBJECT_free 3
305on the returned pointer will have no effect.
306.Pp
307.Fn OBJ_cleanup
308cleans up the internal object table: this should be called before
309an application exits if any new objects were added using
310.Fn OBJ_create .
311.Pp
312Objects can have a short name, a long name, and a numerical 280Objects can have a short name, a long name, and a numerical
313identifier (NID) associated with them. 281identifier (NID) associated with them.
314A standard set of objects is represented in an internal table. 282A standard set of objects is represented in an internal table.
@@ -323,7 +291,7 @@ For example, the OID for commonName has the following definitions:
323.Ed 291.Ed
324.Pp 292.Pp
325New objects can be added by calling 293New objects can be added by calling
326.Fn OBJ_create . 294.Xr OBJ_create 3 .
327.Pp 295.Pp
328Table objects have certain advantages over other objects: for example 296Table objects have certain advantages over other objects: for example
329their NIDs can be used in a C language switch statement. 297their NIDs can be used in a C language switch statement.
@@ -385,11 +353,6 @@ and
385.Fa b 353.Fa b
386are identical, or non-zero otherwise. 354are identical, or non-zero otherwise.
387.Pp 355.Pp
388.Fn OBJ_create
389returns the new NID or
390.Dv NID_undef
391if an error occurs.
392.Pp
393In some cases of failure of 356In some cases of failure of
394.Fn OBJ_nid2obj , 357.Fn OBJ_nid2obj ,
395.Fn OBJ_nid2ln , 358.Fn OBJ_nid2ln ,
@@ -398,7 +361,6 @@ In some cases of failure of
398.Fn OBJ_txt2obj , 361.Fn OBJ_txt2obj ,
399.Fn OBJ_obj2txt , 362.Fn OBJ_obj2txt ,
400.Fn OBJ_dup , 363.Fn OBJ_dup ,
401.Fn OBJ_create ,
402.Fn i2t_ASN1_OBJECT , 364.Fn i2t_ASN1_OBJECT ,
403and 365and
404.Fn i2a_ASN1_OBJECT , 366.Fn i2a_ASN1_OBJECT ,
@@ -419,14 +381,6 @@ if (OBJ_obj2nid(obj) == NID_commonName)
419 /* Do something */ 381 /* Do something */
420.Ed 382.Ed
421.Pp 383.Pp
422Create a new NID and initialize an object from it:
423.Bd -literal -offset indent
424int new_nid;
425ASN1_OBJECT *obj;
426new_nid = OBJ_create("1.2.3.4", "NewOID", "New Object Identifier");
427obj = OBJ_nid2obj(new_nid);
428.Ed
429.Pp
430Create a new object directly: 384Create a new object directly:
431.Bd -literal -offset indent 385.Bd -literal -offset indent
432obj = OBJ_txt2obj("1.2.3.4", 1); 386obj = OBJ_txt2obj("1.2.3.4", 1);
@@ -434,7 +388,8 @@ obj = OBJ_txt2obj("1.2.3.4", 1);
434.Sh SEE ALSO 388.Sh SEE ALSO
435.Xr ASN1_OBJECT_new 3 , 389.Xr ASN1_OBJECT_new 3 ,
436.Xr BIO_new 3 , 390.Xr BIO_new 3 ,
437.Xr d2i_ASN1_OBJECT 3 391.Xr d2i_ASN1_OBJECT 3 ,
392.Xr OBJ_create 3
438.Sh HISTORY 393.Sh HISTORY
439.Fn OBJ_nid2obj , 394.Fn OBJ_nid2obj ,
440.Fn OBJ_nid2ln , 395.Fn OBJ_nid2ln ,
@@ -448,11 +403,7 @@ and
448.Fn OBJ_dup 403.Fn OBJ_dup
449first appeared in SSLeay 0.5.1. 404first appeared in SSLeay 0.5.1.
450.Fn i2a_ASN1_OBJECT 405.Fn i2a_ASN1_OBJECT
451first appeared in SSLeay 0.6.0, 406first appeared in SSLeay 0.6.0, and
452.Fn OBJ_cleanup
453in SSLeay 0.8.0, and
454.Fn OBJ_create
455and
456.Fn i2t_ASN1_OBJECT 407.Fn i2t_ASN1_OBJECT
457in SSLeay 0.9.0. 408in SSLeay 0.9.0.
458All these functions have been available since 409All these functions have been available since