summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2021-10-22 11:24:45 +0000
committerschwarze <>2021-10-22 11:24:45 +0000
commitc36ab1d6c3f604f1ed750698145963419ddabf36 (patch)
tree4f5e236c10112a271b54f67ea47f275d0e212267
parent953d242de1254751747e7b9629babb906fe23ba2 (diff)
downloadopenbsd-c36ab1d6c3f604f1ed750698145963419ddabf36.tar.gz
openbsd-c36ab1d6c3f604f1ed750698145963419ddabf36.tar.bz2
openbsd-c36ab1d6c3f604f1ed750698145963419ddabf36.zip
new manual page X509at_get_attr(3)
documenting five X.501 Attribute read accessors
-rw-r--r--src/lib/libcrypto/man/Makefile3
-rw-r--r--src/lib/libcrypto/man/X509_ATTRIBUTE_new.37
-rw-r--r--src/lib/libcrypto/man/X509at_get_attr.3157
3 files changed, 163 insertions, 4 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 51c2cf45b7..e31e6992a2 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.196 2021/10/21 16:26:34 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.197 2021/10/22 11:24:45 schwarze Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -276,6 +276,7 @@ MAN= \
276 UI_new.3 \ 276 UI_new.3 \
277 X25519.3 \ 277 X25519.3 \
278 X509V3_get_d2i.3 \ 278 X509V3_get_d2i.3 \
279 X509at_get_attr.3 \
279 X509_ALGOR_dup.3 \ 280 X509_ALGOR_dup.3 \
280 X509_ATTRIBUTE_get0_object.3 \ 281 X509_ATTRIBUTE_get0_object.3 \
281 X509_ATTRIBUTE_new.3 \ 282 X509_ATTRIBUTE_new.3 \
diff --git a/src/lib/libcrypto/man/X509_ATTRIBUTE_new.3 b/src/lib/libcrypto/man/X509_ATTRIBUTE_new.3
index e0cff822da..c25144531a 100644
--- a/src/lib/libcrypto/man/X509_ATTRIBUTE_new.3
+++ b/src/lib/libcrypto/man/X509_ATTRIBUTE_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_ATTRIBUTE_new.3,v 1.11 2021/10/21 16:26:34 schwarze Exp $ 1.\" $OpenBSD: X509_ATTRIBUTE_new.3,v 1.12 2021/10/22 11:24:45 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2016, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2016, 2021 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: October 21 2021 $ 17.Dd $Mdocdate: October 22 2021 $
18.Dt X509_ATTRIBUTE_NEW 3 18.Dt X509_ATTRIBUTE_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -119,7 +119,8 @@ fails on
119.Xr X509_ATTRIBUTE_set1_object 3 , 119.Xr X509_ATTRIBUTE_set1_object 3 ,
120.Xr X509_EXTENSION_new 3 , 120.Xr X509_EXTENSION_new 3 ,
121.Xr X509_new 3 , 121.Xr X509_new 3 ,
122.Xr X509_REQ_new 3 122.Xr X509_REQ_new 3 ,
123.Xr X509at_get_attr 3
123.Sh STANDARDS 124.Sh STANDARDS
124.Bl -ohang 125.Bl -ohang
125.It Xo 126.It Xo
diff --git a/src/lib/libcrypto/man/X509at_get_attr.3 b/src/lib/libcrypto/man/X509at_get_attr.3
new file mode 100644
index 0000000000..8e1a65e2d1
--- /dev/null
+++ b/src/lib/libcrypto/man/X509at_get_attr.3
@@ -0,0 +1,157 @@
1.\" $OpenBSD: X509at_get_attr.3,v 1.1 2021/10/22 11:24:45 schwarze Exp $
2.\"
3.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: October 22 2021 $
18.Dt X509AT_GET_ATTR 3
19.Os
20.Sh NAME
21.Nm X509at_get_attr ,
22.Nm X509at_get_attr_count ,
23.Nm X509at_get_attr_by_OBJ ,
24.Nm X509at_get_attr_by_NID ,
25.Nm X509at_get0_data_by_OBJ
26.\" In the following line, "X.501" and "Attribute" are not typos.
27.\" The "Attribute" type is defined in X.501, not in X.509.
28.\" The type is called "Attribute" with capital "A", not "attribute".
29.Nd X.501 Attribute array read accessors
30.Sh SYNOPSIS
31.In openssl/x509.h
32.Ft X509_ATTRIBUTE *
33.Fo X509at_get_attr
34.Fa "const STACK_OF(X509_ATTRIBUTE) *attrs"
35.Fa "int index"
36.Fc
37.Ft int
38.Fo X509at_get_attr_count
39.Fa "const STACK_OF(X509_ATTRIBUTE) *attrs"
40.Fc
41.Ft int
42.Fo X509at_get_attr_by_OBJ
43.Fa "const STACK_OF(X509_ATTRIBUTE) *attrs"
44.Fa "const ASN1_OBJECT *obj"
45.Fa "int start_after"
46.Fc
47.Ft int
48.Fo X509at_get_attr_by_NID
49.Fa "const STACK_OF(X509_ATTRIBUTE) *attrs"
50.Fa "int nid"
51.Fa "int start_after"
52.Fc
53.Ft void *
54.Fo X509at_get0_data_by_OBJ
55.Fa "STACK_OF(X509_ATTRIBUTE) *attrs"
56.Fa "const ASN1_OBJECT *obj"
57.Fa "int start_after"
58.Fa "int type"
59.Fc
60.Sh DESCRIPTION
61These functions retrieve information from the
62.Fa attrs
63array of X.501 Attibute objects.
64They all fail if
65.Fa attrs
66is a
67.Dv NULL
68pointer.
69.Pp
70.Fn X509at_get_attr
71returns the array element at the zero-based
72.Fa index .
73It fails if the
74.Fa index
75is negative or greater than or equal to the number of objects in the array.
76.Pp
77.Fn X509at_get_attr_count
78returns the number of objects currently stored in the array.
79.Pp
80The three remaining functions search the array starting after the index
81.Fa start_after .
82They fail if no matching object is found.
83.Fn X509at_get0_data_by_OBJ
84also fails if the data is not of the requested
85.Fa type .
86.Pp
87Additionally, the
88.Fa start_after
89argument of
90.Fn X509at_get0_data_by_OBJ
91is interpreted in a special way.
92If
93.Fa start_after
94is \-2 or smaller,
95.Fn X509at_get0_data_by_OBJ
96also fails if
97.Fa attrs
98contains more than one matching object.
99If
100.Fa start_after
101is \-3 or smaller, it also fails unless the matching object
102contains exactly one value.
103.Sh RETURN VALUES
104.Fn X509at_get_attr
105returns an internal pointer or
106or
107.Dv NULL
108on failure.
109.Pp
110.Fn X509at_get_attr_count
111returns the number of array elements or \-1 on failure.
112.Pp
113.Fn X509at_get_attr_by_OBJ
114and
115.Fn X509at_get_attr_by_NID
116return the index of the first object in the array
117that has an index greater than
118.Fa start_after
119and a type matching
120.Fa obj
121or
122.Fa nid ,
123respectively, or \-1 on failure.
124In addition,
125.Fn X509at_get_attr_by_NID
126returns \-2
127if
128.Xr OBJ_nid2obj 3
129fails on the requested
130.Fa nid .
131.Pp
132.Fn X509at_get0_data_by_OBJ
133returns an internal pointer to the data contained in the value
134of the first object that has an index greater than
135.Fa start_after
136and a type matching
137.Fa obj ,
138or
139.Dv NULL
140on failure.
141.Sh SEE ALSO
142.Xr OBJ_nid2obj 3 ,
143.Xr STACK_OF 3 ,
144.Xr X509_ATTRIBUTE_get0_data 3 ,
145.Xr X509_ATTRIBUTE_new 3
146.Sh HISTORY
147.Fn X509at_get_attr ,
148.Fn X509at_get_attr_count ,
149.Fn X509at_get_attr_by_OBJ ,
150and
151.Fn X509at_get_attr_by_NID
152first appeared in OpenSSL 0.9.5 and have been available since
153.Ox 2.7 .
154.Pp
155.Fn X509at_get0_data_by_OBJ
156first appeared in OpenSSL 0.9.8h and has been available since
157.Ox 4.5 .