summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2016-12-04 20:51:47 +0000
committerschwarze <>2016-12-04 20:51:47 +0000
commit3026ddc91c8d71307cb86d55887c07cc1873e217 (patch)
treee8730db6c9005964c21fa926ab1d0fa53a9893fc /src
parent86cc696af289e97b488987ddb9c9567f6e32a32c (diff)
downloadopenbsd-3026ddc91c8d71307cb86d55887c07cc1873e217.tar.gz
openbsd-3026ddc91c8d71307cb86d55887c07cc1873e217.tar.bz2
openbsd-3026ddc91c8d71307cb86d55887c07cc1873e217.zip
import five newish X509 pages from OpenSSL
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/Makefile7
-rw-r--r--src/lib/libcrypto/man/X509V3_get_d2i.3386
-rw-r--r--src/lib/libcrypto/man/X509_ALGOR_dup.3157
-rw-r--r--src/lib/libcrypto/man/X509_CRL_get0_by_serial.3192
-rw-r--r--src/lib/libcrypto/man/X509_EXTENSION_set_object.3221
-rw-r--r--src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3219
6 files changed, 1181 insertions, 1 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index f6dd178a0c..c8eb806169 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.61 2016/11/29 18:16:09 deraadt Exp $ 1# $OpenBSD: Makefile,v 1.62 2016/12/04 20:51:47 schwarze Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -170,6 +170,11 @@ MAN= \
170 SMIME_read_PKCS7.3 \ 170 SMIME_read_PKCS7.3 \
171 SMIME_write_PKCS7.3 \ 171 SMIME_write_PKCS7.3 \
172 UI_new.3 \ 172 UI_new.3 \
173 X509V3_get_d2i.3 \
174 X509_ALGOR_dup.3 \
175 X509_CRL_get0_by_serial.3 \
176 X509_EXTENSION_set_object.3 \
177 X509_LOOKUP_hash_dir.3 \
173 X509_NAME_ENTRY_get_object.3 \ 178 X509_NAME_ENTRY_get_object.3 \
174 X509_NAME_add_entry_by_txt.3 \ 179 X509_NAME_add_entry_by_txt.3 \
175 X509_NAME_get_index_by_NID.3 \ 180 X509_NAME_get_index_by_NID.3 \
diff --git a/src/lib/libcrypto/man/X509V3_get_d2i.3 b/src/lib/libcrypto/man/X509V3_get_d2i.3
new file mode 100644
index 0000000000..cd3bb844b5
--- /dev/null
+++ b/src/lib/libcrypto/man/X509V3_get_d2i.3
@@ -0,0 +1,386 @@
1.\" $OpenBSD: X509V3_get_d2i.3,v 1.1 2016/12/04 20:51:47 schwarze Exp $
2.\" OpenSSL 047dd81e Jul 4 23:03:17 2014 +0100
3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2014, 2016 The OpenSSL Project. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: December 4 2016 $
52.Dt X509V3_GET_D2I 3
53.Os
54.Sh NAME
55.Nm X509V3_get_d2i ,
56.Nm X509V3_add1_i2d ,
57.Nm X509V3_EXT_d2i ,
58.Nm X509V3_EXT_i2d ,
59.Nm X509_get_ext_d2i ,
60.Nm X509_add1_ext_i2d ,
61.Nm X509_CRL_get_ext_d2i ,
62.Nm X509_CRL_add1_ext_i2d ,
63.Nm X509_REVOKED_get_ext_d2i ,
64.Nm X509_REVOKED_add1_ext_i2d
65.Nd X509 extension decode and encode functions
66.Sh SYNOPSIS
67.In openssl/x509v3.h
68.Ft void *
69.Fo X509V3_get_d2i
70.Fa "const STACK_OF(X509_EXTENSION) *x"
71.Fa "int nid"
72.Fa "int *crit"
73.Fa "int *idx"
74.Fc
75.Ft int
76.Fo X509V3_add1_i2d
77.Fa "STACK_OF(X509_EXTENSION) **x"
78.Fa "int nid"
79.Fa "void *value"
80.Fa "int crit"
81.Fa "unsigned long flags"
82.Fc
83.Ft void *
84.Fo X509V3_EXT_d2i
85.Fa "X509_EXTENSION *ext"
86.Fc
87.Ft X509_EXTENSION *
88.Fo X509V3_EXT_i2d
89.Fa "int ext_nid"
90.Fa "int crit"
91.Fa "void *ext"
92.Fc
93.Ft void *
94.Fo X509_get_ext_d2i
95.Fa "const X509 *x"
96.Fa "int nid"
97.Fa "int *crit"
98.Fa "int *idx"
99.Fc
100.Ft int
101.Fo X509_add1_ext_i2d
102.Fa "X509 *x"
103.Fa "int nid"
104.Fa "void *value"
105.Fa "int crit"
106.Fa "unsigned long flags"
107.Fc
108.Ft void *
109.Fo X509_CRL_get_ext_d2i
110.Fa "const X509_CRL *crl"
111.Fa "int nid"
112.Fa "int *crit"
113.Fa "int *idx"
114.Fc
115.Ft int
116.Fo X509_CRL_add1_ext_i2d
117.Fa "X509_CRL *crl"
118.Fa "int nid"
119.Fa "void *value"
120.Fa "int crit"
121.Fa "unsigned long flags"
122.Fc
123.Ft void *
124.Fo X509_REVOKED_get_ext_d2i
125.Fa "const X509_REVOKED *r"
126.Fa "int nid"
127.Fa "int *crit"
128.Fa "int *idx"
129.Fc
130.Ft int
131.Fo X509_REVOKED_add1_ext_i2d
132.Fa "X509_REVOKED *r"
133.Fa "int nid"
134.Fa "void *value"
135.Fa "int crit"
136.Fa "unsigned long flags"
137.Fc
138.Sh DESCRIPTION
139.Fn X509V3_get_d2i
140looks for an extension with OID
141.Fa nid
142in the extensions
143.Fa x
144and, if found, decodes it.
145If
146.Fa idx
147is
148.Dv NULL ,
149then only one occurrence of an extension is permissible.
150Otherwise the first extension after index
151.Pf * Fa idx
152is returned and
153.Pf * Fa idx
154is updated to the location of the extension.
155If
156.Fa crit
157is not
158.Dv NULL ,
159then
160.Pf * Fa crit
161is set to a status value: -2 if the extension occurs multiple times
162(this is only returned if
163.Fa idx
164is
165.Dv NULL ) ,
166-1 if the extension could not be found, 0 if the extension is found
167and is not critical, and 1 if it is critical.
168A pointer to an extension specific structure or
169.Dv NULL
170is returned.
171.Pp
172.Fn X509V3_add1_i2d
173adds extension
174.Fa value
175to STACK
176.Pf * Fa x
177(allocating a new STACK if necessary) using OID
178.Fa nid
179and criticality
180.Fa crit
181according to
182.Fa flags .
183.Pp
184.Fn X509V3_EXT_d2i
185attempts to decode the ASN.1 data contained in extension
186.Fa ext
187and returns a pointer to an extension specific structure or
188.Dv NULL
189if the extension could not be decoded (invalid syntax or not supported).
190.Pp
191.Fn X509V3_EXT_i2d
192encodes the extension specific structure
193.Fa ext
194with OID
195.Fa ext_nid
196and criticality
197.Fa crit .
198.Pp
199.Fn X509_get_ext_d2i
200and
201.Fn X509_add1_ext_i2d
202operate on the extensions of certificate
203.Fa x ,
204they are otherwise identical to
205.Fn X509V3_get_d2i
206and
207.Fn X509V3_add1_i2d 3 .
208.Pp
209.Fn X509_CRL_get_ext_d2i
210and
211.Fn X509_CRL_add1_ext_i2d
212operate on the extensions of CRL
213.Fa crl ,
214they are otherwise identical to
215.Fn X509V3_get_d2i
216and
217.Fn X509V3_add1_i2d 3 .
218.Pp
219.Fn X509_REVOKED_get_ext_d2i
220and
221.Fn X509_REVOKED_add1_ext_i2d
222operate on the extensions of the
223.Vt X509_REVOKED
224structure
225.Fa r
226(i.e. for CRL entry extensions), they are otherwise identical to
227.Fn X509V3_get_d2i
228and
229.Fn X509V3_add1_i2d 3 .
230.Pp
231In almost all cases an extension can occur at most once and multiple
232occurrences is an error.
233Therefore the
234.Fa idx
235parameter is usually
236.Dv NULL .
237.Pp
238The
239.Fa flags
240parameter may be one of the following values.
241.Pp
242.Dv X509V3_ADD_DEFAULT
243appends a new extension only if the extension does not already exist.
244An error is returned if the extension does already exist.
245.Pp
246.Dv X509V3_ADD_APPEND
247appends a new extension, ignoring whether the extension already exists.
248.Pp
249.Dv X509V3_ADD_REPLACE
250replaces an extension if it exists otherwise appends a new extension.
251.Pp
252.Dv X509V3_ADD_REPLACE_EXISTING
253replaces an existing extension if it exists otherwise returns an error.
254.Pp
255.Dv X509V3_ADD_KEEP_EXISTING
256appends a new extension only if the extension does not already exist.
257An error
258.Sy is not
259returned if the extension does already exist.
260.Pp
261.Dv X509V3_ADD_DELETE
262deletes extension
263.Fa nid .
264No new extension is added.
265.Pp
266If
267.Dv X509V3_ADD_SILENT
268is ored with
269.Fa flags ,
270any error returned will not be added to the error queue.
271.Pp
272The function
273.Fn X509V3_get_d2i
274will return
275.Dv NULL
276if the extension is not found, occurs multiple times or cannot be
277decoded.
278It is possible to determine the precise reason by checking the value of
279.Pf * Fa crit .
280.Sh SUPPORTED EXTENSIONS
281The following sections contain a list of all supported extensions
282including their name and NID.
283.Ss PKIX Certificate Extensions
284The following certificate extensions are defined in PKIX standards such
285as RFC5280.
286.Bl -column 30n 30n
287.It Basic Constraints Ta Dv NID_basic_constraints
288.It Key Usage Ta Dv NID_key_usage
289.It Extended Key Usage Ta Dv NID_ext_key_usage
290.It Subject Key Identifier Ta Dv NID_subject_key_identifier
291.It Authority Key Identifier Ta Dv NID_authority_key_identifier
292.It Private Key Usage Period Ta Dv NID_private_key_usage_period
293.It Subject Alternative Name Ta Dv NID_subject_alt_name
294.It Issuer Alternative Name Ta Dv NID_issuer_alt_name
295.It Authority Information Access Ta Dv NID_info_access
296.It Subject Information Access Ta Dv NID_sinfo_access
297.It Name Constraints Ta Dv NID_name_constraints
298.It Certificate Policies Ta Dv NID_certificate_policies
299.It Policy Mappings Ta Dv NID_policy_mappings
300.It Policy Constraints Ta Dv NID_policy_constraints
301.It Inhibit Any Policy Ta Dv NID_inhibit_any_policy
302.El
303.Ss Netscape Certificate Extensions
304The following are (largely obsolete) Netscape certificate extensions.
305.Bl -column 30n 30n
306.It Netscape Cert Type Ta Dv NID_netscape_cert_type
307.It Netscape Base Url Ta Dv NID_netscape_base_url
308.It Netscape Revocation Url Ta Dv NID_netscape_revocation_url
309.It Netscape CA Revocation Url Ta Dv NID_netscape_ca_revocation_url
310.It Netscape Renewal Url Ta Dv NID_netscape_renewal_url
311.It Netscape CA Policy Url Ta Dv NID_netscape_ca_policy_url
312.It Netscape SSL Server Name Ta Dv NID_netscape_ssl_server_name
313.It Netscape Comment Ta Dv NID_netscape_comment
314.El
315.Ss Miscellaneous Certificate Extensions
316.Bl -column 30n 30n
317.It Strong Extranet ID Ta Dv NID_sxnet
318.It Proxy Certificate Information Ta Dv NID_proxyCertInfo
319.El
320.Ss PKIX CRL Extensions
321The following are CRL extensions from PKIX standards such as RFC5280.
322.Bl -column 30n 30n
323.It CRL Number Ta Dv NID_crl_number
324.It CRL Distribution Points Ta Dv NID_crl_distribution_points
325.It Delta CRL Indicator Ta Dv NID_delta_crl
326.It Freshest CRL Ta Dv NID_freshest_crl
327.It Invalidity Date Ta Dv NID_invalidity_date
328.It Issuing Distribution Point Ta Dv NID_issuing_distribution_point
329.El
330.Pp
331The following are CRL entry extensions from PKIX standards such as
332RFC5280.
333.Bl -column 30n 30n
334.It CRL Reason Code Ta Dv NID_crl_reason
335.It Certificate Issuer Ta Dv NID_certificate_issuer
336.El
337.Ss OCSP Extensions
338.Bl -column 30n 30n
339.It OCSP Nonce Ta Dv NID_id_pkix_OCSP_Nonce
340.It OCSP CRL ID Ta Dv NID_id_pkix_OCSP_CrlID
341.It Acceptable OCSP Responses Ta Dv NID_id_pkix_OCSP_acceptableResponses
342.It OCSP No Check Ta Dv NID_id_pkix_OCSP_noCheck
343.It OCSP Archive Cutoff Ta Dv NID_id_pkix_OCSP_archiveCutoff
344.It OCSP Service Locator Ta Dv NID_id_pkix_OCSP_serviceLocator
345.It Hold Instruction Code Ta Dv NID_hold_instruction_code
346.El
347.Ss Certificate Transparency Extensions
348The following extensions are used by certificate transparency, RFC6962
349.Bl -column 30n 30n
350.It CT Precertificate SCTs Ta Dv NID_ct_precert_scts
351.It CT Certificate SCTs Ta Dv NID_ct_cert_scts
352.El
353.Sh RETURN VALUES
354.Fn X509V3_get_d2i
355and
356.Fn X509V3_EXT_d2i
357return a pointer to an extension specific structure or
358.Dv NULL
359if an error occurs.
360.Pp
361.Fn X509V3_EXT_i2d
362returns a pointer to an
363.Vt X509_EXTENSION
364structure or
365.Dv NULL
366if an error occurs.
367.Pp
368.Fn X509V3_add1_i2d
369returns 1 if the operation is successful, 0 if it fails due to a
370non-fatal error (extension not found, already exists, cannot be encoded),
371or -1 due to a fatal error such as a memory allocation failure.
372.Sh SEE ALSO
373.Xr d2i_X509 3 ,
374.Xr ERR_get_error 3 ,
375.Xr X509_CRL_get0_by_serial 3 ,
376.Xr X509_get_ext_d2i 3 ,
377.Xr X509_get_pubkey 3 ,
378.Xr X509_get_subject_name 3 ,
379.Xr X509_get_version 3 ,
380.Xr X509_NAME_add_entry_by_txt 3 ,
381.Xr X509_NAME_ENTRY_get_object 3 ,
382.Xr X509_NAME_get_index_by_NID 3 ,
383.Xr X509_NAME_print_ex 3 ,
384.Xr X509_new 3 ,
385.Xr X509_sign 3 ,
386.Xr X509_verify_cert 3
diff --git a/src/lib/libcrypto/man/X509_ALGOR_dup.3 b/src/lib/libcrypto/man/X509_ALGOR_dup.3
new file mode 100644
index 0000000000..00d87592c7
--- /dev/null
+++ b/src/lib/libcrypto/man/X509_ALGOR_dup.3
@@ -0,0 +1,157 @@
1.\" $OpenBSD: X509_ALGOR_dup.3,v 1.1 2016/12/04 20:51:47 schwarze Exp $
2.\" OpenSSL 4692340e Jun 7 15:49:08 2016 -0400
3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2002, 2015 The OpenSSL Project. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: December 4 2016 $
52.Dt X509_ALGOR_DUP 3
53.Os
54.Sh NAME
55.Nm X509_ALGOR_dup ,
56.Nm X509_ALGOR_set0 ,
57.Nm X509_ALGOR_get0 ,
58.Nm X509_ALGOR_set_md ,
59.Nm X509_ALGOR_cmp
60.Nd AlgorithmIdentifier functions
61.Sh SYNOPSIS
62.In openssl/x509.h
63.Ft X509_ALGOR *
64.Fo X509_ALGOR_dup
65.Fa "X509_ALGOR *alg"
66.Fc
67.Ft int
68.Fo X509_ALGOR_set0
69.Fa "X509_ALGOR *alg"
70.Fa "ASN1_OBJECT *aobj"
71.Fa "int ptype"
72.Fa "void *pval"
73.Fc
74.Ft void
75.Fo X509_ALGOR_get0
76.Fa "ASN1_OBJECT **paobj"
77.Fa "int *pptype"
78.Fa "const void **ppval"
79.Fa "const X509_ALGOR *alg"
80.Fc
81.Ft void
82.Fo X509_ALGOR_set_md
83.Fa "X509_ALGOR *alg"
84.Fa "const EVP_MD *md"
85.Fc
86.Ft int
87.Fo X509_ALGOR_cmp
88.Fa "const X509_ALGOR *a"
89.Fa "const X509_ALGOR *b"
90.Fc
91.Sh DESCRIPTION
92.Fn X509_ALGOR_dup
93returns a copy of
94.Fa alg .
95.Pp
96.Fn X509_ALGOR_set0
97sets the algorithm OID of
98.Fa alg
99to
100.Fa aobj
101and the associated parameter type to
102.Fa ptype
103with value
104.Fa pval .
105If
106.Fa ptype
107is
108.Sy V_ASN1_UNDEF
109the parameter is omitted, otherwise
110.Fa ptype
111and
112.Fa pval
113have the same meaning as the
114.Sy type
115and
116.Sy value
117parameters to
118.Xr ASN1_TYPE_set 3 .
119All the supplied parameters are used internally so must
120.Sy NOT
121be freed after this call.
122.Pp
123.Fn X509_ALGOR_get0
124is the inverse of
125.Fn X509_ALGOR_set0 :
126it returns the algorithm OID in
127.Sy *paobj
128and the associated parameter in
129.Sy *pptype
130and
131.Sy *ppval
132from the
133.Sy AlgorithmIdentifier
134.Fa alg .
135.Pp
136.Fn X509_ALGOR_set_md
137sets the
138.Sy AlgorithmIdentifier
139.Fa alg
140to appropriate values for the message digest
141.Fa md .
142.Pp
143.Fn X509_ALGOR_cmp
144compares
145.Fa a
146and
147.Fa b
148and returns 0 if they have identical encodings and non-zero otherwise.
149.Sh COPYRIGHT
150Copyright 2002-2016 The OpenSSL Project Authors.
151All Rights Reserved.
152.Pp
153Licensed under the OpenSSL license (the "License").
154You may not use this file except in compliance with the License.
155You can obtain a copy in the file LICENSE in the source distribution or
156at
157.Lk https://www.openssl.org/source/license.html .
diff --git a/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3 b/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3
new file mode 100644
index 0000000000..fdfaf76beb
--- /dev/null
+++ b/src/lib/libcrypto/man/X509_CRL_get0_by_serial.3
@@ -0,0 +1,192 @@
1.\" $OpenBSD: X509_CRL_get0_by_serial.3,v 1.1 2016/12/04 20:51:47 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2015 The OpenSSL Project. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: December 4 2016 $
52.Dt X509_CRL_GET0_BY_SERIAL 3
53.Os
54.Sh NAME
55.Nm X509_CRL_get0_by_serial ,
56.Nm X509_CRL_get0_by_cert ,
57.Nm X509_CRL_get_REVOKED ,
58.Nm X509_REVOKED_set_serialNumber ,
59.Nm X509_REVOKED_set_revocationDate ,
60.Nm X509_CRL_add0_revoked ,
61.Nm X509_CRL_sort
62.Nd CRL revoked entry utility functions
63.Sh SYNOPSIS
64.In openssl/x509.h
65.Ft int
66.Fo X509_CRL_get0_by_serial
67.Fa "X509_CRL *crl"
68.Fa "X509_REVOKED **ret"
69.Fa "ASN1_INTEGER *serial"
70.Fc
71.Ft int
72.Fo X509_CRL_get0_by_cert
73.Fa "X509_CRL *crl"
74.Fa "X509_REVOKED **ret"
75.Fa "X509 *x"
76.Fc
77.Ft STACK_OF(X509_REVOKED) *
78.Fo X509_CRL_get_REVOKED
79.Fa "X509_CRL *crl"
80.Fc
81.Ft int
82.Fo X509_REVOKED_set_serialNumber
83.Fa "X509_REVOKED *r"
84.Fa "ASN1_INTEGER *serial"
85.Fc
86.Ft int
87.Fo X509_REVOKED_set_revocationDate
88.Fa "X509_REVOKED *r"
89.Fa "ASN1_TIME *tm"
90.Fc
91.Ft int
92.Fo X509_CRL_add0_revoked
93.Fa "X509_CRL *crl"
94.Fa "X509_REVOKED *rev"
95.Fc
96.Ft int
97.Fo X509_CRL_sort
98.Fa "X509_CRL *crl"
99.Fc
100.Sh DESCRIPTION
101.Fn X509_CRL_get0_by_serial
102attempts to find a revoked entry in
103.Fa crl
104for serial number
105.Fa serial .
106If it is successful, it sets
107.Pf * Fa ret
108to the internal pointer of the matching entry.
109Consequently,
110.Pf * Fa ret
111must not be freed up after the call.
112.Pp
113.Fn X509_CRL_get0_by_cert
114is similar to
115.Fn X509_CRL_get0_by_serial
116except that it looks for a revoked entry using the serial number
117of certificate
118.Fa x .
119.Pp
120.Fn X509_CRL_get_REVOKED
121returns an internal pointer to a stack of all revoked entries for
122.Fa crl .
123It is implemented as a macro.
124.Pp
125.Fn X509_REVOKED_set_serialNumber
126sets the serial number of
127.Fa r
128to
129.Fa serial .
130The supplied
131.Fa serial
132pointer is not used internally so it should be freed up after use.
133.Pp
134.Fn X509_REVOKED_set_revocationDate
135sets the revocation date of
136.Fa r
137to
138.Fa tm .
139The supplied
140.Fa tm
141pointer is not used internally so it should be freed up after use.
142.Pp
143.Fn X509_CRL_add0_revoked
144appends revoked entry
145.Fa rev
146to CRL
147.Fa crl .
148The pointer
149.Fa rev
150is used internally so it must not be freed up after the call: it is
151freed when the parent CRL is freed.
152.Pp
153.Fn X509_CRL_sort
154sorts the revoked entries of
155.Fa crl
156into ascending serial number order.
157.Pp
158Applications can determine the number of revoked entries returned by
159.Fn X509_CRL_get_revoked
160using
161.Xr sk_X509_REVOKED_num 3
162and examine each one in turn using
163.Xr sk_X509_REVOKED_value 3 .
164.Sh RETURN VALUES
165.Fn X509_CRL_get0_by_serial ,
166.Fn X509_CRL_get0_by_cert ,
167.Fn X509_REVOKED_set_serialNumber ,
168.Fn X509_REVOKED_set_revocationDate ,
169.Fn X509_CRL_add0_revoked ,
170and
171.Fn X509_CRL_sort
172return 1 for success or 0 for failure.
173.Pp
174.Fn X509_CRL_get_REVOKED
175returns a STACK of revoked entries.
176.Sh SEE ALSO
177.Xr d2i_X509 3 ,
178.Xr ERR_get_error 3 ,
179.Xr X509_get0_signature 3 ,
180.Xr X509_get_ext_d2i 3 ,
181.Xr X509_get_extension_flags 3 ,
182.Xr X509_get_pubkey 3 ,
183.Xr X509_get_subject_name 3 ,
184.Xr X509_get_version 3 ,
185.Xr X509_NAME_add_entry_by_txt 3 ,
186.Xr X509_NAME_ENTRY_get_object 3 ,
187.Xr X509_NAME_get_index_by_NID 3 ,
188.Xr X509_NAME_print_ex 3 ,
189.Xr X509_new 3 ,
190.Xr X509_sign 3 ,
191.Xr X509_verify_cert 3 ,
192.Xr X509V3_get_d2i 3
diff --git a/src/lib/libcrypto/man/X509_EXTENSION_set_object.3 b/src/lib/libcrypto/man/X509_EXTENSION_set_object.3
new file mode 100644
index 0000000000..32bb9c6828
--- /dev/null
+++ b/src/lib/libcrypto/man/X509_EXTENSION_set_object.3
@@ -0,0 +1,221 @@
1.\" $OpenBSD: X509_EXTENSION_set_object.3,v 1.1 2016/12/04 20:51:47 schwarze Exp $
2.\" OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400
3.\"
4.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
5.\" Copyright (c) 2015 The OpenSSL Project. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: December 4 2016 $
52.Dt X509_EXTENSION_SET_OBJECT 3
53.Os
54.Sh NAME
55.Nm X509_EXTENSION_set_object ,
56.Nm X509_EXTENSION_set_critical ,
57.Nm X509_EXTENSION_set_data ,
58.Nm X509_EXTENSION_create_by_NID ,
59.Nm X509_EXTENSION_create_by_OBJ ,
60.Nm X509_EXTENSION_get_object ,
61.Nm X509_EXTENSION_get_critical ,
62.Nm X509_EXTENSION_get_data
63.Nd extension utility functions
64.Sh SYNOPSIS
65.Ft int
66.Fo X509_EXTENSION_set_object
67.Fa "X509_EXTENSION *ex"
68.Fa "ASN1_OBJECT *obj"
69.Fc
70.Ft int
71.Fo X509_EXTENSION_set_critical
72.Fa "X509_EXTENSION *ex"
73.Fa "int crit"
74.Fc
75.Ft int
76.Fo X509_EXTENSION_set_data
77.Fa "X509_EXTENSION *ex"
78.Fa "ASN1_OCTET_STRING *data"
79.Fc
80.Ft X509_EXTENSION *
81.Fo X509_EXTENSION_create_by_NID
82.Fa "X509_EXTENSION **ex"
83.Fa "int nid"
84.Fa "int crit"
85.Fa "ASN1_OCTET_STRING *data"
86.Fc
87.Ft X509_EXTENSION *
88.Fo X509_EXTENSION_create_by_OBJ
89.Fa "X509_EXTENSION **ex"
90.Fa "ASN1_OBJECT *obj"
91.Fa "int crit"
92.Fa "ASN1_OCTET_STRING *data"
93.Fc
94.Ft ASN1_OBJECT *
95.Fo X509_EXTENSION_get_object
96.Fa "X509_EXTENSION *ex"
97.Fc
98.Ft int
99.Fo X509_EXTENSION_get_critical
100.Fa "X509_EXTENSION *ex"
101.Fc
102.Ft ASN1_OCTET_STRING *
103.Fo X509_EXTENSION_get_data
104.Fa "X509_EXTENSION *ne"
105.Fc
106.Sh DESCRIPTION
107.Fn X509_EXTENSION_set_object
108sets the extension type of
109.Fa ex
110to
111.Fa obj .
112The
113.Fa obj
114pointer is duplicated internally so
115.Fa obj
116should be freed up after use.
117.Pp
118.Fn X509_EXTENSION_set_critical
119sets the criticality of
120.Fa ex
121to
122.Fa crit .
123If
124.Fa crit
125is zero, the extension in non-critical, otherwise it is critical.
126.Pp
127.Fn X509_EXTENSION_set_data
128sets the data in extension
129.Fa ex
130to
131.Fa data .
132The
133.Fa data
134pointer is duplicated internally.
135.Pp
136.Fn X509_EXTENSION_create_by_NID
137creates an extension of type
138.Fa nid ,
139criticality
140.Fa crit
141using data
142.Fa data .
143The created extension is returned and written to
144.Pf * Fa ex
145reusing or allocating a new extension if necessary, so
146.Pf * Fa ex
147should either be
148.Dv NULL
149or a valid
150.Vt X509_EXTENSION
151structure.
152It must not be an uninitialised pointer.
153.Pp
154.Fn X509_EXTENSION_create_by_OBJ
155is identical to
156.Fn X509_EXTENSION_create_by_NID
157except that it creates an extension using
158.Fa obj
159instead of a NID.
160.Pp
161.Fn X509_EXTENSION_get_object
162returns the extension type of
163.Fa ex
164as an
165.Vt ASN1_OBJECT
166pointer.
167The returned pointer is an internal value which must not be freed up.
168.Pp
169.Fn X509_EXTENSION_get_critical
170returns the criticality of extension
171.Fa ex
172it returns 1 for critical and 0 for non-critical.
173.Pp
174.Fn X509_EXTENSION_get_data
175returns the data of extension
176.Fa ex .
177The returned pointer is an internal value which must not be freed up.
178.Pp
179These functions manipulate the contents of an extension directly.
180Most applications will want to parse or encode and add an extension:
181they should use the extension encode and decode functions instead
182such as
183.Xr X509_add1_ext_i2d 3
184and
185.Xr X509_get_ext_d2i 3 .
186.Pp
187The
188.Fa data
189associated with an extension is the extension encoding in an
190.Vt ASN1_OCTET_STRING
191structure.
192.Sh RETURN VALUES
193.Fn X509_EXTENSION_set_object ,
194.Fn X509_EXTENSION_set_critical ,
195and
196.Fn X509_EXTENSION_set_data
197return 1 for success or 0 for failure.
198.Pp
199.Fn X509_EXTENSION_create_by_NID
200and
201.Fn X509_EXTENSION_create_by_OBJ
202return an
203.Vt X509_EXTENSION
204pointer or
205.Dv NULL
206if an error occurs.
207.Pp
208.Fn X509_EXTENSION_get_object
209returns an
210.Vt ASN1_OBJECT
211pointer.
212.Pp
213.Fn X509_EXTENSION_get_critical
214returns 0 for non-critical or 1 for critical.
215.Pp
216.Fn X509_EXTENSION_get_data
217returns an
218.Vt ASN1_OCTET_STRING
219pointer.
220.Sh SEE ALSO
221.Xr X509V3_get_d2i 3
diff --git a/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3 b/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3
new file mode 100644
index 0000000000..4b06525994
--- /dev/null
+++ b/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3
@@ -0,0 +1,219 @@
1.\" $OpenBSD: X509_LOOKUP_hash_dir.3,v 1.1 2016/12/04 20:51:47 schwarze Exp $
2.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\"
4.\" This file was written by Victor B. Wagner <vitus@cryptocom.ru>
5.\" and Claus Assmann.
6.\" Copyright (c) 2015, 2016 The OpenSSL Project. All rights reserved.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\"
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\"
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\" notice, this list of conditions and the following disclaimer in
17.\" the documentation and/or other materials provided with the
18.\" distribution.
19.\"
20.\" 3. All advertising materials mentioning features or use of this
21.\" software must display the following acknowledgment:
22.\" "This product includes software developed by the OpenSSL Project
23.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24.\"
25.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26.\" endorse or promote products derived from this software without
27.\" prior written permission. For written permission, please contact
28.\" openssl-core@openssl.org.
29.\"
30.\" 5. Products derived from this software may not be called "OpenSSL"
31.\" nor may "OpenSSL" appear in their names without prior written
32.\" permission of the OpenSSL Project.
33.\"
34.\" 6. Redistributions of any form whatsoever must retain the following
35.\" acknowledgment:
36.\" "This product includes software developed by the OpenSSL Project
37.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38.\"
39.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\"
52.Dd $Mdocdate: December 4 2016 $
53.Dt X509_LOOKUP_HASH_DIR 3
54.Os
55.Sh NAME
56.Nm X509_LOOKUP_hash_dir ,
57.Nm X509_LOOKUP_file ,
58.Nm X509_load_cert_file ,
59.Nm X509_load_crl_file ,
60.Nm X509_load_cert_crl_file
61.Nd default OpenSSL certificate lookup methods
62.Sh SYNOPSIS
63.In openssl/x509_vfy.h
64.Ft X509_LOOKUP_METHOD *
65.Fn X509_LOOKUP_hash_dir void
66.Ft X509_LOOKUP_METHOD *
67.Fn X509_LOOKUP_file void
68.Ft int
69.Fo X509_load_cert_file
70.Fa "X509_LOOKUP *ctx"
71.Fa "const char *file"
72.Fa "int type"
73.Fc
74.Ft int
75.Fo X509_load_crl_file
76.Fa "X509_LOOKUP *ctx"
77.Fa "const char *file"
78.Fa "int type"
79.Fc
80.Ft int
81.Fo X509_load_cert_crl_file
82.Fa "X509_LOOKUP *ctx"
83.Fa "const char *file"
84.Fa "int type"
85.Fc
86.Sh DESCRIPTION
87.Fn X509_LOOKUP_hash_dir
88and
89.Fn X509_LOOKUP_file
90are two certificate lookup methods to use with
91.Vt X509_STORE ,
92provided by OpenSSL library.
93.Pp
94Users of the library typically do not need to create instances of these
95methods manually.
96They are created automatically by the
97.Xr X509_STORE_load_locations 3
98or
99.Xr SSL_CTX_load_verify_locations 3
100functions.
101.Pp
102Internally loading of certificates and CRLs is implemented via functions
103.Fn X509_load_cert_crl_file ,
104.Fn X509_load_cert_file
105and
106.Fn X509_load_crl_file .
107These functions support a parameter
108.Fa type ,
109which can be one of the constants
110.Dv FILETYPE_PEM ,
111.Dv FILETYPE_ASN1 ,
112and
113.Dv FILETYPE_DEFAULT .
114They load certificates and/or CRLs from the specified file into a
115memory cache of
116.Vt X509_STORE
117objects which the given
118.Fa ctx
119parameter is associated with.
120.Pp
121The functions
122.Fn X509_load_cert_file
123and
124.Fn X509_load_crl_file
125can load both PEM and DER formats depending on the
126.Fa type
127value.
128Because DER format cannot contain more than one certificate or CRL
129object (while PEM can contain several concatenated PEM objects),
130.Fn X509_load_cert_crl_file
131with
132.Dv FILETYPE_ASN1
133is equivalent to
134.Fn X509_load_cert_file .
135.Pp
136The constant
137.Dv FILETYPE_DEFAULT
138with
139.Dv NULL
140filename causes these functions to load default certificate
141store file (see
142.Xr X509_STORE_set_default_paths 3 ) .
143.Pp
144These functions return the number of objects loaded from file or 0
145in case of error.
146.Pp
147Both methods support adding several certificate locations into one
148.Sy X509_STORE .
149.Pp
150This page documents certificate store formats used by these methods and
151caching policy.
152.Ss File Method
153The
154.Fn X509_LOOKUP_file
155method loads all the certificates or CRLs present in a file into memory
156at the time the file is added as a lookup source.
157.Pp
158The file format is ASCII text which contains concatenated PEM
159certificates and CRLs.
160.Pp
161This method should be used by applications which work with a small set
162of CAs.
163.Ss Hashed Directory Method
164.Fa X509_LOOKUP_hash_dir
165is a more advanced method, which loads certificates and CRLs on demand,
166and caches them in memory once they are loaded.
167As of OpenSSL 1.0.0, it also checks for newer CRLs upon each lookup, so
168that newer CRLs are used as soon as they appear in the directory.
169.Pp
170The directory should contain one certificate or CRL per file in PEM
171format, with a file name of the form
172.Ar hash . Ns Ar N
173for a certificate, or
174.Ar hash . Ns Sy r Ns Ar N
175for a CRL.
176The
177.Ar hash
178is the value returned by the
179.Xr X509_NAME_hash 3
180function applied to the subject name for certificates or issuer
181name for CRLs.
182The hash can also be obtained via the
183.Fl hash
184option of the
185.Xr openssl
186.Cm x509
187or
188.Cm crl
189commands.
190.Pp
191The
192.Ar N
193suffix is a sequence number that starts at zero and is incremented
194consecutively for each certificate or CRL with the same
195.Ar hash
196value.
197Gaps in the sequence numbers are not supported.
198It is assumed that there are no more objects with the same hash
199beyond the first missing number in the sequence.
200.Pp
201Sequence numbers make it possible for the directory to contain multiple
202certificates with the same subject name hash value.
203For example, it is possible to have in the store several certificates
204with the same subject or several CRLs with the same issuer (and, for
205example, a different validity period).
206.Pp
207When checking for new CRLs, once one CRL for a given hash value is
208loaded, hash_dir lookup method checks only for certificates with
209sequence number greater than that of the already cached CRL.
210.Pp
211Note that the hash algorithm used for subject name hashing changed in
212OpenSSL 1.0.0, and all certificate stores have to be rehashed when
213moving from OpenSSL 0.9.8 to 1.0.0.
214.Sh SEE ALSO
215.Xr d2i_X509_bio 3 ,
216.Xr PEM_read_PrivateKey 3 ,
217.Xr SSL_CTX_load_verify_locations 3 ,
218.Xr X509_STORE_add_lookup 3 ,
219.Xr X509_STORE_load_locations 3