summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2018-02-25 20:26:51 +0000
committerschwarze <>2018-02-25 20:26:51 +0000
commit8563c14fedd67e6d767175f2cf0815ef16997da6 (patch)
treedae2bebce16c52806aa63ea1b99ca97c88fb3121 /src
parent50c45943c56c5e51b769f1eaaae9b1b47aeb5328 (diff)
downloadopenbsd-8563c14fedd67e6d767175f2cf0815ef16997da6.tar.gz
openbsd-8563c14fedd67e6d767175f2cf0815ef16997da6.tar.bz2
openbsd-8563c14fedd67e6d767175f2cf0815ef16997da6.zip
In x509_vfy.h rev. 1.23 2018/02/22 17:17:09, jsing@ provided
X509_OBJECT_get0_X509(3) and X509_OBJECT_get0_X509_CRL(3). Since they are undocumented in OpenSSL, write a new manual page from scratch, also documenting five closely related public functions that have already been available before.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/Makefile3
-rw-r--r--src/lib/libcrypto/man/X509_OBJECT_get0_X509.3216
2 files changed, 218 insertions, 1 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 0de55209bb..248bd33c8d 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.134 2018/02/25 17:46:38 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.135 2018/02/25 20:26:51 schwarze Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -222,6 +222,7 @@ MAN= \
222 X509_NAME_get_index_by_NID.3 \ 222 X509_NAME_get_index_by_NID.3 \
223 X509_NAME_new.3 \ 223 X509_NAME_new.3 \
224 X509_NAME_print_ex.3 \ 224 X509_NAME_print_ex.3 \
225 X509_OBJECT_get0_X509.3 \
225 X509_PUBKEY_new.3 \ 226 X509_PUBKEY_new.3 \
226 X509_REQ_new.3 \ 227 X509_REQ_new.3 \
227 X509_REVOKED_new.3 \ 228 X509_REVOKED_new.3 \
diff --git a/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3 b/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3
new file mode 100644
index 0000000000..8d39028b8e
--- /dev/null
+++ b/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3
@@ -0,0 +1,216 @@
1.\" $OpenBSD: X509_OBJECT_get0_X509.3,v 1.1 2018/02/25 20:26:51 schwarze Exp $
2.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
3.\"
4.\" Permission to use, copy, modify, and distribute this software for any
5.\" purpose with or without fee is hereby granted, provided that the above
6.\" copyright notice and this permission notice appear in all copies.
7.\"
8.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15.\"
16.Dd $Mdocdate: February 25 2018 $
17.Dt X509_OBJECT_GET0_X509 3
18.Os
19.Sh NAME
20.Nm X509_OBJECT_up_ref_count ,
21.Nm X509_OBJECT_free_contents ,
22.Nm X509_OBJECT_get0_X509 ,
23.Nm X509_OBJECT_get0_X509_CRL ,
24.Nm X509_OBJECT_idx_by_subject ,
25.Nm X509_OBJECT_retrieve_by_subject ,
26.Nm X509_OBJECT_retrieve_match
27.Nd certificate, CRL, private key, and string wrapper for certificate stores
28.Sh SYNOPSIS
29.In openssl/x509_vfy.h
30.Ft void
31.Fo X509_OBJECT_up_ref_count
32.Fa "X509_OBJECT *obj"
33.Fc
34.Ft void
35.Fo X509_OBJECT_free_contents
36.Fa "X509_OBJECT *obj"
37.Fc
38.Ft X509 *
39.Fo X509_OBJECT_get0_X509
40.Fa "const X509_OBJECT *obj"
41.Fc
42.Ft X509_CRL *
43.Fo X509_OBJECT_get0_X509_CRL
44.Fa "X509_OBJECT *obj"
45.Fc
46.Ft int
47.Fo X509_OBJECT_idx_by_subject
48.Fa "STACK_OF(X509_OBJECT) *stack"
49.Fa "int type"
50.Fa "X509_NAME *name"
51.Fc
52.Ft X509_OBJECT *
53.Fo X509_OBJECT_retrieve_by_subject
54.Fa "STACK_OF(X509_OBJECT) *stack"
55.Fa "int type"
56.Fa "X509_NAME *name"
57.Fc
58.Ft X509_OBJECT *
59.Fo X509_OBJECT_retrieve_match
60.Fa "STACK_OF(X509_OBJECT) *stack"
61.Fa "X509_OBJECT *obj"
62.Fc
63.Sh DESCRIPTION
64The
65.Vt X509_OBJECT
66structure is a shallow wrapper around one
67.Vt X509
68certificate object, one
69.Vt X509_CRL
70certificate revocation list object, one
71.Vt EVP_PKEY
72private key object, or one
73.Vt char *
74string.
75It also remembers which type of object it contains at any given time.
76.Pp
77Each
78.Vt X509_STORE
79object uses one stack of
80.Vt X509_OBJECT
81structures as its main storage area.
82.Pp
83If
84.Fa obj
85contains an
86.Vt X509
87certificate or an
88.Vt X509_CRL
89certificate revocation list,
90.Fn X509_OBJECT_up_ref_count
91increments the reference count of that inner object by 1.
92Otherwise, no action occurs.
93.Pp
94If
95.Fa obj
96contains an
97.Vt X509
98certificate,
99.Fn X509_OBJECT_free_contents
100calls
101.Xr X509_free 3
102on that inner object.
103If
104.Fa obj
105contains an
106.Vt X509_CRL
107certificate revocation list, it calls
108.Xr X509_CRL_free 3
109on that inner list.
110Otherwise, no action occurs.
111.Fn X509_OBJECT_free_contents
112does not free
113.Fa obj
114itself.
115.Pp
116If
117.Fa type
118is
119.Dv X509_LU_X509 ,
120.Fn X509_OBJECT_idx_by_subject
121and
122.Fn X509_OBJECT_retrieve_by_subject
123search the given
124.Fa stack
125for a certificate with the subject
126.Fa name .
127If
128.Fa type
129is
130.Dv X509_LU_CRL ,
131they search for a certificate revocation list with the issuer
132.Fa name
133instead.
134.Pp
135If
136.Fa obj
137contains a certificate,
138.Fn X509_OBJECT_retrieve_match
139searches the given
140.Fa stack
141for a certificate with a matching subject name;
142if it contains a certificate revocation list, it searches for a
143certificate revocation list with a matching issuer name instead;
144otherwise, it searches for an
145.Vt X509_OBJECT
146with a matching type.
147.Sh RETURN VALUES
148.Fn X509_OBJECT_get0_X509
149returns an internal pointer to the certificate contained in
150.Fa obj
151or
152.Dv NULL
153if
154.Fa obj
155is
156.Dv NULL
157or contains no certificate.
158.Pp
159.Fn X509_OBJECT_get0_X509_CRL
160returns an internal pointer to the certificate revocation list contained in
161.Fa obj
162or
163.Dv NULL
164if
165.Fa obj
166is
167.Dv NULL
168or contains no certificate revocation list.
169.Pp
170.Fn X509_OBJECT_idx_by_subject
171returns the zero-based index of the first matching certificate
172or revocation list in the
173.Fa stack
174or \-1 if
175.Fa type
176is neither
177.Dv X509_LU_X509
178nor
179.Dv X509_LU_CRL
180or if no match is found.
181.Pp
182.Fn X509_OBJECT_retrieve_by_subject
183returns the first matching certificate or revocation list in the
184.Fa stack
185or
186.Dv NULL
187if
188.Fa type
189is neither
190.Dv X509_LU_X509
191nor
192.Dv X509_LU_CRL
193or if no match is found.
194.Pp
195.Fn X509_OBJECT_retrieve_match
196returns the first mathching
197.Vt X509_OBJECT
198or
199.Dv NULL
200if
201.Fa stack
202or
203.Fa obj
204is
205.Dv NULL
206or no match is found.
207.Sh SEE ALSO
208.Xr X509_STORE_load_locations 3 ,
209.Xr X509_STORE_new 3
210.\" The type X509_OBJECT is also used
211.\" by the following undocumented public functions:
212.\" X509_STORE_get_by_subject
213.\" X509_LOOKUP_by_subject
214.\" X509_LOOKUP_by_issuer_serial
215.\" X509_LOOKUP_by_fingerprint
216.\" X509_LOOKUP_by_alias