summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2021-07-31 14:54:34 +0000
committerschwarze <>2021-07-31 14:54:34 +0000
commit423bef53cfd7915a03c5008c18e313a77bd5d1ac (patch)
tree5b402a43e1c9d87dd0cfe0a55343f7c816610fb2 /src
parent6b4cb95d17ea02c148cb13d001279ae95a192b62 (diff)
downloadopenbsd-423bef53cfd7915a03c5008c18e313a77bd5d1ac.tar.gz
openbsd-423bef53cfd7915a03c5008c18e313a77bd5d1ac.tar.bz2
openbsd-423bef53cfd7915a03c5008c18e313a77bd5d1ac.zip
document X509_LOOKUP_mem(3) in X509_LOOKUP_hash_dir(3)
and add a new manual page X509_LOOKUP_new(3)
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/Makefile3
-rw-r--r--src/lib/libcrypto/man/PEM_X509_INFO_read.35
-rw-r--r--src/lib/libcrypto/man/X509_LOOKUP_hash_dir.367
-rw-r--r--src/lib/libcrypto/man/X509_LOOKUP_new.3566
-rw-r--r--src/lib/libcrypto/man/X509_NAME_hash.35
-rw-r--r--src/lib/libcrypto/man/X509_OBJECT_get0_X509.311
-rw-r--r--src/lib/libcrypto/man/X509_STORE_set1_param.35
-rw-r--r--src/lib/libcrypto/man/X509_new.36
8 files changed, 636 insertions, 32 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index f605de5dbc..666ef63aaf 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.188 2021/07/27 13:27:46 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.189 2021/07/31 14:54:33 schwarze Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -284,6 +284,7 @@ MAN= \
284 X509_EXTENSION_set_object.3 \ 284 X509_EXTENSION_set_object.3 \
285 X509_INFO_new.3 \ 285 X509_INFO_new.3 \
286 X509_LOOKUP_hash_dir.3 \ 286 X509_LOOKUP_hash_dir.3 \
287 X509_LOOKUP_new.3 \
287 X509_NAME_ENTRY_get_object.3 \ 288 X509_NAME_ENTRY_get_object.3 \
288 X509_NAME_add_entry_by_txt.3 \ 289 X509_NAME_add_entry_by_txt.3 \
289 X509_NAME_get_index_by_NID.3 \ 290 X509_NAME_get_index_by_NID.3 \
diff --git a/src/lib/libcrypto/man/PEM_X509_INFO_read.3 b/src/lib/libcrypto/man/PEM_X509_INFO_read.3
index 4a9dc97148..0e908b7988 100644
--- a/src/lib/libcrypto/man/PEM_X509_INFO_read.3
+++ b/src/lib/libcrypto/man/PEM_X509_INFO_read.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PEM_X509_INFO_read.3,v 1.2 2021/03/12 05:18:00 jsg Exp $ 1.\" $OpenBSD: PEM_X509_INFO_read.3,v 1.3 2021/07/31 14:54:33 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2020 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: March 12 2021 $ 17.Dd $Mdocdate: July 31 2021 $
18.Dt PEM_X509_INFO_READ 3 18.Dt PEM_X509_INFO_READ 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -161,6 +161,7 @@ may sometimes return 0 anyway.
161.Xr STACK_OF 3 , 161.Xr STACK_OF 3 ,
162.Xr X509_CRL_new 3 , 162.Xr X509_CRL_new 3 ,
163.Xr X509_INFO_new 3 , 163.Xr X509_INFO_new 3 ,
164.Xr X509_LOOKUP_new 3 ,
164.Xr X509_new 3 165.Xr X509_new 3
165.Sh HISTORY 166.Sh HISTORY
166.Fn PEM_X509_INFO_read 167.Fn PEM_X509_INFO_read
diff --git a/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3 b/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3
index c59706d6c4..14e49f3a77 100644
--- a/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3
+++ b/src/lib/libcrypto/man/X509_LOOKUP_hash_dir.3
@@ -1,7 +1,24 @@
1.\" $OpenBSD: X509_LOOKUP_hash_dir.3,v 1.9 2019/06/06 01:06:59 schwarze Exp $ 1.\" $OpenBSD: X509_LOOKUP_hash_dir.3,v 1.10 2021/07/31 14:54:33 schwarze Exp $
2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
3.\" 3.\"
4.\" This file was written by Victor B. Wagner <vitus@cryptocom.ru> 4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license:
6.\"
7.\" Copyright (c) 2021 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 Victor B. Wagner <vitus@cryptocom.ru>
5.\" and Claus Assmann. 22.\" and Claus Assmann.
6.\" Copyright (c) 2015, 2016, 2017 The OpenSSL Project. All rights reserved. 23.\" Copyright (c) 2015, 2016, 2017 The OpenSSL Project. All rights reserved.
7.\" 24.\"
@@ -49,22 +66,25 @@
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: June 6 2019 $ 69.Dd $Mdocdate: July 31 2021 $
53.Dt X509_LOOKUP_HASH_DIR 3 70.Dt X509_LOOKUP_HASH_DIR 3
54.Os 71.Os
55.Sh NAME 72.Sh NAME
56.Nm X509_LOOKUP_hash_dir , 73.Nm X509_LOOKUP_hash_dir ,
57.Nm X509_LOOKUP_file , 74.Nm X509_LOOKUP_file ,
75.Nm X509_LOOKUP_mem ,
58.Nm X509_load_cert_file , 76.Nm X509_load_cert_file ,
59.Nm X509_load_crl_file , 77.Nm X509_load_crl_file ,
60.Nm X509_load_cert_crl_file 78.Nm X509_load_cert_crl_file
61.Nd default OpenSSL certificate lookup methods 79.Nd default certificate lookup methods
62.Sh SYNOPSIS 80.Sh SYNOPSIS
63.In openssl/x509_vfy.h 81.In openssl/x509_vfy.h
64.Ft X509_LOOKUP_METHOD * 82.Ft X509_LOOKUP_METHOD *
65.Fn X509_LOOKUP_hash_dir void 83.Fn X509_LOOKUP_hash_dir void
66.Ft X509_LOOKUP_METHOD * 84.Ft X509_LOOKUP_METHOD *
67.Fn X509_LOOKUP_file void 85.Fn X509_LOOKUP_file void
86.Ft X509_LOOKUP_METHOD *
87.Fn X509_LOOKUP_mem void
68.Ft int 88.Ft int
69.Fo X509_load_cert_file 89.Fo X509_load_cert_file
70.Fa "X509_LOOKUP *ctx" 90.Fa "X509_LOOKUP *ctx"
@@ -84,16 +104,17 @@
84.Fa "int type" 104.Fa "int type"
85.Fc 105.Fc
86.Sh DESCRIPTION 106.Sh DESCRIPTION
87.Fn X509_LOOKUP_hash_dir 107.Fn X509_LOOKUP_hash_dir ,
108.Fn X509_LOOKUP_file ,
88and 109and
89.Fn X509_LOOKUP_file 110.Fn X509_LOOKUP_mem
90are two certificate lookup methods to use with 111return pointers to static certificate lookup method objects
91.Vt X509_STORE , 112built into the library, for use with
92provided by the OpenSSL library. 113.Vt X509_STORE .
93.Pp 114.Pp
94Users of the library typically do not need to create instances of these 115Users of the library typically do not need
95methods manually. 116to retrieve pointers to these method objects manually.
96They are created automatically by the 117They are automatically used by the
97.Xr X509_STORE_load_locations 3 118.Xr X509_STORE_load_locations 3
98or 119or
99.Xr SSL_CTX_load_verify_locations 3 120.Xr SSL_CTX_load_verify_locations 3
@@ -141,7 +162,7 @@ filename causes these functions to load the default certificate
141store file (see 162store file (see
142.Xr X509_STORE_set_default_paths 3 ) . 163.Xr X509_STORE_set_default_paths 3 ) .
143.Pp 164.Pp
144Both methods support adding several certificate locations into one 165All three methods support adding several certificate locations into one
145.Sy X509_STORE . 166.Sy X509_STORE .
146.Pp 167.Pp
147This page documents certificate store formats used by these methods and 168This page documents certificate store formats used by these methods and
@@ -208,13 +229,22 @@ sequence number greater than that of the already cached CRL.
208Note that the hash algorithm used for subject name hashing changed in 229Note that the hash algorithm used for subject name hashing changed in
209OpenSSL 1.0.0, and all certificate stores have to be rehashed when 230OpenSSL 1.0.0, and all certificate stores have to be rehashed when
210moving from OpenSSL 0.9.8 to 1.0.0. 231moving from OpenSSL 0.9.8 to 1.0.0.
232.Ss Memory Method
233The
234.Fn X509_LOOKUP_mem
235method supports loading PEM-encoded certificates and revocation lists
236that are already stored in memory, using the function
237.Xr X509_LOOKUP_add_mem 3 .
238This is particularly useful in processes using
239.Xr chroot 2 .
211.Sh RETURN VALUES 240.Sh RETURN VALUES
212.Fn X509_LOOKUP_hash_dir 241.Fn X509_LOOKUP_hash_dir ,
242.Fn X509_LOOKUP_file ,
213and 243and
214.Fn X509_LOOKUP_file 244.Fn X509_LOOKUP_mem
215always return a pointer to a static 245always return a pointer to a static
216.Vt X509_LOOKUP_METHOD 246.Vt X509_LOOKUP_METHOD
217structure. 247object.
218.Pp 248.Pp
219.Fn X509_load_cert_file , 249.Fn X509_load_cert_file ,
220.Fn X509_load_crl_file , 250.Fn X509_load_crl_file ,
@@ -227,6 +257,7 @@ or 0 on error.
227.Xr d2i_X509_bio 3 , 257.Xr d2i_X509_bio 3 ,
228.Xr PEM_read_PrivateKey 3 , 258.Xr PEM_read_PrivateKey 3 ,
229.Xr SSL_CTX_load_verify_locations 3 , 259.Xr SSL_CTX_load_verify_locations 3 ,
260.Xr X509_LOOKUP_new 3 ,
230.Xr X509_OBJECT_get0_X509 3 , 261.Xr X509_OBJECT_get0_X509 3 ,
231.Xr X509_STORE_load_locations 3 , 262.Xr X509_STORE_load_locations 3 ,
232.Xr X509_STORE_new 3 263.Xr X509_STORE_new 3
@@ -244,3 +275,7 @@ These functions have been available since
244.Fn X509_load_cert_crl_file 275.Fn X509_load_cert_crl_file
245first appeared in OpenSSL 0.9.5 and has been available since 276first appeared in OpenSSL 0.9.5 and has been available since
246.Ox 2.7 . 277.Ox 2.7 .
278.Pp
279.Fn X509_LOOKUP_mem
280first appeared in
281.Ox 5.7 .
diff --git a/src/lib/libcrypto/man/X509_LOOKUP_new.3 b/src/lib/libcrypto/man/X509_LOOKUP_new.3
new file mode 100644
index 0000000000..02fe4c9f4e
--- /dev/null
+++ b/src/lib/libcrypto/man/X509_LOOKUP_new.3
@@ -0,0 +1,566 @@
1.\" $OpenBSD: X509_LOOKUP_new.3,v 1.1 2021/07/31 14:54:33 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: July 31 2021 $
18.Dt X509_LOOKUP_NEW 3
19.Os
20.Sh NAME
21.Nm X509_LOOKUP_new ,
22.Nm X509_LOOKUP_free ,
23.Nm X509_LOOKUP_ctrl ,
24.Nm X509_LOOKUP_add_dir ,
25.Nm X509_LOOKUP_load_file ,
26.Nm X509_LOOKUP_add_mem ,
27.Nm X509_LOOKUP_by_subject ,
28.Nm X509_LOOKUP_init ,
29.Nm X509_LOOKUP_shutdown ,
30.Nm X509_LOOKUP_by_issuer_serial ,
31.Nm X509_LOOKUP_by_fingerprint ,
32.Nm X509_LOOKUP_by_alias ,
33.Nm X509_get_default_cert_dir ,
34.Nm X509_get_default_cert_file
35.Nd certificate lookup object
36.Sh SYNOPSIS
37.In openssl/x509_vfy.h
38.Ft X509_LOOKUP *
39.Fn X509_LOOKUP_new "X509_LOOKUP_METHOD *method"
40.Ft void
41.Fn X509_LOOKUP_free "X509_LOOKUP *lookup"
42.Ft int
43.Fo X509_LOOKUP_ctrl
44.Fa "X509_LOOKUP *lookup"
45.Fa "int command"
46.Fa "const char *source"
47.Fa "long type"
48.Fa "char **ret"
49.Fc
50.Ft int
51.Fo X509_LOOKUP_add_dir
52.Fa "X509_LOOKUP *lookup"
53.Fa "const char *source"
54.Fa "long type"
55.Fc
56.Ft int
57.Fo X509_LOOKUP_load_file
58.Fa "X509_LOOKUP *lookup"
59.Fa "const char *source"
60.Fa "long type"
61.Fc
62.Ft int
63.Fo X509_LOOKUP_add_mem
64.Fa "X509_LOOKUP *lookup"
65.Fa "const struct iovec *source"
66.Fa "long type"
67.Fc
68.Ft int
69.Fo X509_LOOKUP_by_subject
70.Fa "X509_LOOKUP *lookup"
71.Fa "int type"
72.Fa "X509_NAME *name"
73.Fa "X509_OBJECT *ret"
74.Fc
75.Ft int
76.Fn X509_LOOKUP_init "X509_LOOKUP *lookup"
77.Ft int
78.Fn X509_LOOKUP_shutdown "X509_LOOKUP *lookup"
79.Ft int
80.Fo X509_LOOKUP_by_issuer_serial
81.Fa "X509_LOOKUP *lookup"
82.Fa "int type"
83.Fa "X509_NAME *name"
84.Fa "ASN1_INTEGER *serial"
85.Fa "X509_OBJECT *ret"
86.Fc
87.Ft int
88.Fo X509_LOOKUP_by_fingerprint
89.Fa "X509_LOOKUP *lookup"
90.Fa "int type"
91.Fa "const unsigned char *bytes"
92.Fa "int length"
93.Fa "X509_OBJECT *ret"
94.Fc
95.Ft int
96.Fo X509_LOOKUP_by_alias
97.Fa "X509_LOOKUP *lookup"
98.Fa "int type"
99.Fa "const char *string"
100.Fa "int length"
101.Fa "X509_OBJECT *ret"
102.Fc
103.In openssl/x509.h
104.Ft const char *
105.Fn X509_get_default_cert_dir void
106.Ft const char *
107.Fn X509_get_default_cert_file void
108.Sh DESCRIPTION
109.Fn X509_LOOKUP_new
110allocates a new, empty
111.Vt X509_LOOKUP
112object and associates it with the
113.Fa method
114which is a static objects returned from either
115.Xr X509_LOOKUP_hash_dir 3
116or
117.Xr X509_LOOKUP_file 3
118or
119.Xr X509_LOOKUP_mem 3 .
120.Pp
121.Fn X509_LOOKUP_free
122releases the memory used by
123.Fa lookup .
124If
125.Fa lookup
126is a
127.Dv NULL
128pointer, no action occurs.
129.Pp
130The operation of
131.Fn X509_LOOKUP_ctrl
132depends on the
133.Vt X509_LOOKUP_METHOD
134used by
135.Fa lookup :
136.Bl -tag -width 4n
137.It Xr X509_LOOKUP_hash_dir 3
138The
139.Fa command
140is required to be
141.Dv X509_L_ADD_DIR
142and the
143.Fa source
144argument is interpreted
145as a colon-separated, NUL-terminated list of directory names.
146These directories are added to an internal list of directories to search
147for certificate files of the given
148.Fa type .
149.Pp
150If
151.Fa type
152is
153.Dv X509_FILETYPE_DEFAULT ,
154the
155.Fa source
156argument is ignored and
157.Pa /etc/ssl/certs
158and a type of
159.Dv X509_FILETYPE_PEM
160are used instead.
161.Pp
162.Fn X509_LOOKUP_add_dir
163is a macro that calls
164.Fn X509_LOOKUP_ctrl
165with a
166.Fa command
167of
168.Dv X509_L_ADD_DIR
169and
170.Fa ret
171set to
172.Dv NULL .
173.It Xr X509_LOOKUP_file 3
174The
175.Fa command
176is required to be
177.Dv X509_L_FILE_LOAD
178and the
179.Fa source
180argument is interpreted as a NUL-terminated file name.
181If the
182.Fa type
183is
184.Dv X509_FILETYPE_PEM ,
185the file is read with
186.Xr BIO_new_file 3
187and
188.Xr PEM_X509_INFO_read_bio 3
189and the certificates and revocation lists found are added to the
190.Vt X509_STORE
191object associated with
192.Fa lookup
193using
194.Xr X509_STORE_add_cert 3
195and
196.Xr X509_STORE_add_crl 3 .
197If
198.Fa type
199is
200.Dv X509_FILETYPE_DEFAULT ,
201the
202.Fa source
203argument is ignored and
204.Pa /etc/ssl/certs.pem
205and a type of
206.Dv X509_FILETYPE_PEM
207are used instead.
208If
209.Fa type
210is
211.Dv X509_FILETYPE_ASN1 ,
212the file is read with
213.Xr d2i_X509_bio 3
214and the single certificate is added to the
215.Vt X509_STORE
216object associated with
217.Fa lookup
218using
219.Xr X509_STORE_add_cert 3 .
220.Pp
221.Fn X509_LOOKUP_load_file
222is a macro calling
223.Fn X509_LOOKUP_ctrl
224with a
225.Fa command
226of
227.Dv X509_L_FILE_LOAD
228and
229.Fa ret
230set to
231.Dv NULL .
232.It Xr X509_LOOKUP_mem 3
233The
234.Fa command
235and
236.Fa type
237are required to be
238.Dv X509_L_MEM
239and
240.Dv X509_FILETYPE_PEM ,
241respectively.
242The
243.Fa source
244argument is interpreted as a pointer to an
245.Vt iovec
246structure defined in
247.In sys/uio.h .
248The memory area described by that structure is read with
249.Xr BIO_new_mem_buf 3
250and
251.Xr PEM_X509_INFO_read_bio 3
252and the certificates and revocation lists found are added to the
253.Vt X509_STORE
254object associated with
255.Fa lookup
256using
257.Xr X509_STORE_add_cert 3
258and
259.Xr X509_STORE_add_crl 3 .
260.Pp
261.Fn X509_LOOKUP_add_mem
262is a macro calling
263.Fn X509_LOOKUP_ctrl
264with a command of
265.Dv X509_L_MEM
266and
267.Fa ret
268set to
269.Dv NULL .
270.El
271.Pp
272.Fn X509_LOOKUP_ctrl
273always ignores the
274.Fa ret
275argument when the built-in
276.Vt X509_LOOKUP_METHOD
277objects are used.
278.Pp
279When using built-in
280.Vt X509_LOOKUP_METHOD
281objects,
282.Fn X509_LOOKUP_by_subject
283is only useful if
284.Fa lookup
285uses
286.Xr X509_LOOKUP_hash_dir 3 .
287It passes the
288.Fa name
289to
290.Xr X509_NAME_hash 3
291and converts the resulting hash to an eight-digit lower-case
292hexadecimal number.
293If the
294.Fa type
295is
296.Dv X509_LU_X509 ,
297it searches the configured directories for files having that name,
298with a file name extension that is a small, non-negative decimal integer
299starting at
300.Qq ".0" .
301These files are read with
302.Xr X509_load_cert_file 3 .
303In each directory, the search is ended once a file with the expected name
304and extension does not exists.
305.Pp
306If the
307.Fa type
308is
309.Dv X509_LU_CRL ,
310the file name extensions are expected to have a prefix of
311.Qq "r" ,
312i.e. they start with
313.Qq ".r0" ,
314and the files are read with
315.Xr X509_load_crl_file 3 .
316.Pp
317Unless an application program manually constructs its own
318.Vt X509_LOOKUP_METHOD
319object containing its own callback functions,
320.Fn X509_LOOKUP_init ,
321.Fn X509_LOOKUP_shutdown ,
322.Fn X509_LOOKUP_by_issuer_serial ,
323.Fn X509_LOOKUP_by_fingerprint ,
324and
325.Fn X509_LOOKUP_by_alias
326have no effect.
327.Fn X509_LOOKUP_init
328is supposed to be called after
329.Fn X509_LOOKUP_new
330and before using the
331.Fa lookup
332object,
333.Fn X509_LOOKUP_shutdown
334after using it and before
335.Fn X509_LOOKUP_free .
336.Sh RETURN VALUES
337.Fn X509_LOOKUP_new
338returns the new object or
339.Dv NULL
340if memory allocation fails.
341.Pp
342.Fn X509_LOOKUP_ctrl
343returns 1 for success or 0 for failure.
344If
345.Fa lookup
346uses a user-defined
347.Vt X509_LOOKUP_METHOD
348object, it might also return \-1 for internal errors.
349.Pp
350.Fn X509_LOOKUP_by_subject
351returns
352.Dv X509_LU_X509
353for success or
354.Dv X509_LU_FAIL
355for failure.
356In particular, it fails if
357.Fa lookup
358uses
359.Xr X509_LOOKUP_file 3
360or
361.Xr X509_LOOKUP_mem 3 ,
362if
363.Fa name
364is
365.Dv NULL ,
366if
367.Fa type
368is neither
369.Dv X509_LU_X509
370nor
371.Dv X509_LU_CRL ,
372or if memory allocation fails.
373.Pp
374.Fn X509_LOOKUP_init
375and
376.Fn X509_LOOKUP_shutdown
377are supposed to return 1 for success and 0 for failure.
378When using the built-in
379.Vt X509_LOOKUP_METHOD
380objects, they always return 1.
381.Pp
382.Fn X509_LOOKUP_by_issuer_serial ,
383.Fn X509_LOOKUP_by_fingerprint ,
384and
385.Fn X509_LOOKUP_by_alias
386always return
387.Dv X509_LU_FAIL
388when using the built-in
389.Vt X509_LOOKUP_METHOD
390objects.
391.Pp
392.Fn X509_get_default_cert_dir
393returns a pointer to the constant string
394.Qq /etc/ssl/certs ,
395and
396.Fn X509_get_default_cert_file
397to the constant string
398.Qq /etc/ssl/certs.pem .
399.Sh FILES
400.Bl -tag -width /etc/ssl/certs.pem -compact
401.It Pa /etc/ssl/certs/
402default directory for storing trusted certificates
403.It Pa /etc/ssl/certs.pem
404default file for storing trusted certificates
405.El
406.Sh ERRORS
407The following diagnostics can be retrieved with
408.Xr ERR_get_error 3 ,
409.Xr ERR_GET_REASON 3 ,
410and
411.Xr ERR_reason_error_string 3 :
412.Bl -tag -width Ds
413.It Dv ERR_R_ASN1_LIB Qq "ASN1 lib"
414.Xr d2i_X509_bio 3
415failed in
416.Fn X509_LOOKUP_ctrl .
417.It Dv X509_R_BAD_X509_FILETYPE Qq "bad x509 filetype"
418.Fn X509_LOOKUP_ctrl
419was called with an invalid
420.Fa type .
421.It Dv ERR_R_BUF_LIB Qq "BUF lib"
422Memory allocation failed in
423.Fn X509_LOOKUP_by_subject .
424.It Dv X509_R_INVALID_DIRECTORY Qq "invalid directory"
425The
426.Fa source
427argument of
428.Fn X509_LOOKUP_ctrl
429with
430.Dv X509_L_ADD_DIR
431or
432.Fn X509_LOOKUP_add_dir
433was
434.Dv NULL
435or an empty string.
436.It Dv X509_R_LOADING_CERT_DIR Qq "loading cert dir"
437.Fn X509_LOOKUP_ctrl
438with
439.Dv X509_L_ADD_DIR
440or
441.Fn X509_LOOKUP_add_dir
442was called with
443.Dv X509_FILETYPE_DEFAULT
444and adding the default directories failed.
445This error is added after and in addition to a more specific diagnostic.
446.It Dv X509_R_LOADING_DEFAULTS Qq "loading defaults"
447.Fn X509_LOOKUP_ctrl
448with
449.Dv X509_L_FILE_LOAD
450or
451.Fn X509_LOOKUP_load_file
452was called with
453.Dv X509_FILETYPE_DEFAULT
454and adding the certificates and revocation lists failed.
455This error is added after and in addition to a more specific diagnostic.
456.It Dv ERR_R_MALLOC_FAILURE Qq "malloc failure"
457Memory allocation failed in
458.Fn X509_LOOKUP_ctrl
459or
460.Fn X509_LOOKUP_by_subject .
461.It Dv ERR_R_PEM_LIB Qq "PEM lib"
462.Xr PEM_X509_INFO_read_bio 3 ,
463.Xr PEM_read_bio_X509_AUX 3 ,
464or
465.Xr PEM_read_bio_X509_CRL 3
466failed in
467.Fn X509_LOOKUP_ctrl .
468.It Dv ERR_R_SYS_LIB Qq "system lib"
469.Xr BIO_new 3 ,
470.Xr BIO_new_file 3 ,
471or
472.Xr BIO_read_filename 3
473failed in
474.Fn X509_LOOKUP_ctrl .
475.It Dv X509_R_WRONG_LOOKUP_TYPE Qq "wrong lookup type"
476.Fn X509_LOOKUP_by_subject
477was called with an invalid
478.Fa type .
479.El
480.Pp
481Passing an invalid
482.Fa command
483to
484.Fn X509_LOOKUP_ctrl
485or calling
486.Fn X509_LOOKUP_by_subject
487with a
488.Dv NULL
489.Fa name
490causes failure but provides no diagnostics.
491.Sh SEE ALSO
492.Xr d2i_X509_bio 3 ,
493.Xr PEM_read_bio_X509_AUX 3 ,
494.Xr PEM_X509_INFO_read_bio 3 ,
495.Xr X509_LOOKUP_hash_dir 3 ,
496.Xr X509_NAME_hash 3 ,
497.Xr X509_NAME_new 3 ,
498.Xr X509_new 3 ,
499.Xr X509_OBJECT_get_type 3 ,
500.Xr X509_STORE_add_cert 3
501.Sh HISTORY
502.Fn X509_get_default_cert_dir
503and
504.Fn X509_get_default_cert_file
505first appeared in SSLeay 0.4.1 and have been available since
506.Ox 2.4 .
507.Pp
508.Fn X509_LOOKUP_add_mem
509first appeared in
510.Ox 5.7 .
511.Pp
512The other functions first appeared in SSLeay 0.8.0
513and have been available since
514.Ox 2.4 .
515.Sh BUGS
516If the
517.Fa type
518is
519.Dv X509_FILETYPE_DEFAULT
520or
521.Dv X509_FILETYPE_PEM ,
522.Fn X509_LOOKUP_ctrl
523with
524.Dv X509_L_FILE_LOAD
525and
526.Fn X509_LOOKUP_load_file
527silently ignore failure of
528.Xr X509_STORE_add_cert 3
529and
530.Xr X509_STORE_add_crl 3
531and indicate success anyway.
532.Pp
533Handling of a
534.Dv NULL
535.Fa source
536is inconsistent for
537.Fn X509_LOOKUP_ctrl
538with
539.Dv X509_L_FILE_LOAD
540and for
541.Fn X509_LOOKUP_load_file .
542With
543.Dv X509_FILETYPE_PEM ,
544it causes failure, but with
545.Dv X509_FILETYPE_ASN1 ,
546no action occurs and success is indicated.
547.Pp
548When called on a
549.Fa lookup
550object using
551.Xr X509_LOOKUP_mem 3 ,
552.Fn X509_LOOKUP_ctrl
553raises
554.Dv ERR_R_PEM_LIB
555when called with an invalid
556.Fa command
557or
558.Fa type ,
559when
560.Xr BIO_new_mem_buf 3
561fails, when
562.Fa source
563contains zero objects, or when
564.Xr X509_STORE_add_cert 3
565fails on the first object encountered, which is all inconsistent
566with the behaviour of the other lookup methods.
diff --git a/src/lib/libcrypto/man/X509_NAME_hash.3 b/src/lib/libcrypto/man/X509_NAME_hash.3
index 917fa65463..8766109525 100644
--- a/src/lib/libcrypto/man/X509_NAME_hash.3
+++ b/src/lib/libcrypto/man/X509_NAME_hash.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_NAME_hash.3,v 1.2 2021/07/23 20:25:36 schwarze Exp $ 1.\" $OpenBSD: X509_NAME_hash.3,v 1.3 2021/07/31 14:54:33 schwarze Exp $
2.\" 2.\"
3.\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org> 3.\" Copyright (c) 2017, 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: July 23 2021 $ 17.Dd $Mdocdate: July 31 2021 $
18.Dt X509_NAME_HASH 3 18.Dt X509_NAME_HASH 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -71,6 +71,7 @@ These functions return the hash value or 0 if an error occurs.
71.Sh SEE ALSO 71.Sh SEE ALSO
72.Xr i2d_X509_NAME 3 , 72.Xr i2d_X509_NAME 3 ,
73.Xr X509_get_subject_name 3 , 73.Xr X509_get_subject_name 3 ,
74.Xr X509_LOOKUP_new 3 ,
74.Xr X509_NAME_digest 3 , 75.Xr X509_NAME_digest 3 ,
75.Xr X509_NAME_new 3 76.Xr X509_NAME_new 3
76.Sh HISTORY 77.Sh HISTORY
diff --git a/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3 b/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3
index 07dd3e5568..fc51696ac8 100644
--- a/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3
+++ b/src/lib/libcrypto/man/X509_OBJECT_get0_X509.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_OBJECT_get0_X509.3,v 1.9 2019/06/06 01:06:59 schwarze Exp $ 1.\" $OpenBSD: X509_OBJECT_get0_X509.3,v 1.10 2021/07/31 14:54:34 schwarze Exp $
2.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> 2.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
3.\" 3.\"
4.\" Permission to use, copy, modify, and distribute this software for any 4.\" Permission to use, copy, modify, and distribute this software for any
@@ -13,7 +13,7 @@
13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15.\" 15.\"
16.Dd $Mdocdate: June 6 2019 $ 16.Dd $Mdocdate: July 31 2021 $
17.Dt X509_OBJECT_GET0_X509 3 17.Dt X509_OBJECT_GET0_X509 3
18.Os 18.Os
19.Sh NAME 19.Sh NAME
@@ -225,17 +225,14 @@ is
225or no match is found. 225or no match is found.
226.Sh SEE ALSO 226.Sh SEE ALSO
227.Xr X509_CRL_new 3 , 227.Xr X509_CRL_new 3 ,
228.Xr X509_LOOKUP_new 3 ,
228.Xr X509_NAME_new 3 , 229.Xr X509_NAME_new 3 ,
229.Xr X509_STORE_get0_objects 3 , 230.Xr X509_STORE_get0_objects 3 ,
230.Xr X509_STORE_load_locations 3 , 231.Xr X509_STORE_load_locations 3 ,
231.Xr X509_STORE_new 3 232.Xr X509_STORE_new 3
232.\" The type X509_OBJECT is also used 233.\" The type X509_OBJECT is also used
233.\" by the following undocumented public functions: 234.\" by the following undocumented public function:
234.\" X509_STORE_get_by_subject 235.\" X509_STORE_get_by_subject
235.\" X509_LOOKUP_by_subject
236.\" X509_LOOKUP_by_issuer_serial
237.\" X509_LOOKUP_by_fingerprint
238.\" X509_LOOKUP_by_alias
239.Sh HISTORY 236.Sh HISTORY
240.Fn X509_OBJECT_up_ref_count 237.Fn X509_OBJECT_up_ref_count
241and 238and
diff --git a/src/lib/libcrypto/man/X509_STORE_set1_param.3 b/src/lib/libcrypto/man/X509_STORE_set1_param.3
index 36d4d4f115..b44293966b 100644
--- a/src/lib/libcrypto/man/X509_STORE_set1_param.3
+++ b/src/lib/libcrypto/man/X509_STORE_set1_param.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_STORE_set1_param.3,v 1.16 2019/06/06 01:06:59 schwarze Exp $ 1.\" $OpenBSD: X509_STORE_set1_param.3,v 1.17 2021/07/31 14:54:34 schwarze Exp $
2.\" content checked up to: 2.\" content checked up to:
3.\" OpenSSL man3/X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000 3.\" OpenSSL man3/X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000
4.\" OpenSSL man3/X509_STORE_get0_param e90fc053 Jul 15 09:39:45 2017 -0400 4.\" OpenSSL man3/X509_STORE_get0_param e90fc053 Jul 15 09:39:45 2017 -0400
@@ -17,7 +17,7 @@
17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19.\" 19.\"
20.Dd $Mdocdate: June 6 2019 $ 20.Dd $Mdocdate: July 31 2021 $
21.Dt X509_STORE_SET1_PARAM 3 21.Dt X509_STORE_SET1_PARAM 3
22.Os 22.Os
23.Sh NAME 23.Sh NAME
@@ -192,6 +192,7 @@ on failure.
192.Sh SEE ALSO 192.Sh SEE ALSO
193.Xr RSA_get_ex_new_index 3 , 193.Xr RSA_get_ex_new_index 3 ,
194.Xr SSL_set1_param 3 , 194.Xr SSL_set1_param 3 ,
195.Xr X509_LOOKUP_new 3 ,
195.Xr X509_OBJECT_get0_X509 3 , 196.Xr X509_OBJECT_get0_X509 3 ,
196.Xr X509_STORE_CTX_set0_param 3 , 197.Xr X509_STORE_CTX_set0_param 3 ,
197.Xr X509_STORE_load_locations 3 , 198.Xr X509_STORE_load_locations 3 ,
diff --git a/src/lib/libcrypto/man/X509_new.3 b/src/lib/libcrypto/man/X509_new.3
index 8a1da448c4..efd4db5359 100644
--- a/src/lib/libcrypto/man/X509_new.3
+++ b/src/lib/libcrypto/man/X509_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509_new.3,v 1.28 2021/07/27 13:27:46 schwarze Exp $ 1.\" $OpenBSD: X509_new.3,v 1.29 2021/07/31 14:54:34 schwarze Exp $
2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 2.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -66,7 +66,7 @@
66.\" 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
67.\" OF THE POSSIBILITY OF SUCH DAMAGE. 67.\" OF THE POSSIBILITY OF SUCH DAMAGE.
68.\" 68.\"
69.Dd $Mdocdate: July 27 2021 $ 69.Dd $Mdocdate: July 31 2021 $
70.Dt X509_NEW 3 70.Dt X509_NEW 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -192,6 +192,8 @@ if an error occurs.
192.Xr X509_get_subject_name 3 , 192.Xr X509_get_subject_name 3 ,
193.Xr X509_get_version 3 , 193.Xr X509_get_version 3 ,
194.Xr X509_INFO_new 3 , 194.Xr X509_INFO_new 3 ,
195.Xr X509_LOOKUP_hash_dir 3 ,
196.Xr X509_LOOKUP_new 3 ,
195.Xr X509_NAME_new 3 , 197.Xr X509_NAME_new 3 ,
196.Xr X509_policy_check 3 , 198.Xr X509_policy_check 3 ,
197.Xr X509_policy_tree_level_count 3 , 199.Xr X509_policy_tree_level_count 3 ,