Skip to content

Commit f90d568

Browse files
author
schwarze
committed
document X509_STORE_load_mem(3) and X509_STORE_add_lookup(3)
1 parent 01ed8c6 commit f90d568

File tree

1 file changed

+67
-7
lines changed

1 file changed

+67
-7
lines changed

src/lib/libcrypto/man/X509_STORE_load_locations.3

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
.\" $OpenBSD: X509_STORE_load_locations.3,v 1.7 2021/03/12 05:18:00 jsg Exp $
1+
.\" $OpenBSD: X509_STORE_load_locations.3,v 1.8 2021/08/01 15:37:53 schwarze Exp $
22
.\" full merge up to:
33
.\" OpenSSL X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000
44
.\"
5-
.\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
5+
.\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org>
66
.\"
77
.\" Permission to use, copy, modify, and distribute this software for any
88
.\" purpose with or without fee is hereby granted, provided that the above
@@ -16,12 +16,14 @@
1616
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1717
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1818
.\"
19-
.Dd $Mdocdate: March 12 2021 $
19+
.Dd $Mdocdate: August 1 2021 $
2020
.Dt X509_STORE_LOAD_LOCATIONS 3
2121
.Os
2222
.Sh NAME
2323
.Nm X509_STORE_load_locations ,
24-
.Nm X509_STORE_set_default_paths
24+
.Nm X509_STORE_set_default_paths ,
25+
.Nm X509_STORE_load_mem ,
26+
.Nm X509_STORE_add_lookup
2527
.Nd configure files and directories used by a certificate store
2628
.Sh SYNOPSIS
2729
.In openssl/x509_vfy.h
@@ -35,11 +37,22 @@
3537
.Fo X509_STORE_set_default_paths
3638
.Fa "X509_STORE *store"
3739
.Fc
40+
.Ft int
41+
.Fo X509_STORE_load_mem
42+
.Fa "X509_STORE *store"
43+
.Fa "void *buffer"
44+
.Fa "int length"
45+
.Fc
46+
.Ft X509_LOOKUP *
47+
.Fo X509_STORE_add_lookup
48+
.Fa "X509_STORE *store"
49+
.Fa "X509_LOOKUP_METHOD *method"
50+
.Fc
3851
.Sh DESCRIPTION
3952
.Fn X509_STORE_load_locations
4053
instructs the
4154
.Fa store
42-
to use the PEM file
55+
to use the PEM
4356
.Fa file
4457
and all the PEM files in the directories
4558
contained in the colon-separated list
@@ -85,6 +98,35 @@ except that it operates directly on an
8598
.Vt X509_STORE
8699
object, rather than on the store used by an SSL context.
87100
See that manual page for more information.
101+
.Pp
102+
The above functions are wrappers around
103+
.Xr X509_LOOKUP_load_file 3
104+
and
105+
.Xr X509_LOOKUP_add_dir 3 .
106+
.Pp
107+
.Fn X509_STORE_load_mem
108+
instructs the
109+
.Fa store
110+
to use the certificates contained in the memory
111+
.Fa buffer
112+
of the given
113+
.Fa length
114+
for certificate lookup.
115+
It is a wrapper around
116+
.Xr X509_LOOKUP_add_mem 3 .
117+
.Pp
118+
.Fn X509_STORE_add_lookup
119+
checks whether the
120+
.Fa store
121+
already contains an
122+
.Vt X509_LOOKUP
123+
object using the given
124+
.Fa method ;
125+
if it does, no action occurs.
126+
Otherwise, a new
127+
.Vt X509_LOOKUP
128+
object is allocated, added, and returned.
129+
This function is used internally by all the functions listed above.
88130
.Sh RETURN VALUES
89131
.Fn X509_STORE_load_locations
90132
returns 1 if all files and directories specified were successfully
@@ -97,6 +139,18 @@ directories failed, or if both arguments were
97139
.Fn X509_STORE_set_default_paths
98140
returns 0 for some error conditions and 1 otherwise, not just for
99141
success, but also for various cases of failure.
142+
.Pp
143+
.Fn X509_STORE_load_mem
144+
returns 1 for success or 0 for failure.
145+
In particular, parse errors or lack of memory can cause failure.
146+
.Pp
147+
.Fn X509_STORE_add_lookup
148+
returns the existing or new lookup object or
149+
.Dv NULL
150+
on failure.
151+
When using the built-in
152+
.Vt X509_LOOKUP_METHOD
153+
objects, the only reason for failure is lack of memory.
100154
.Sh FILES
101155
.Bl -tag -width Ds
102156
.It Pa /etc/ssl/cert.pem
@@ -109,15 +163,21 @@ default directory for
109163
.Sh SEE ALSO
110164
.Xr SSL_CTX_load_verify_locations 3 ,
111165
.Xr X509_LOOKUP_hash_dir 3 ,
166+
.Xr X509_LOOKUP_new 3 ,
112167
.Xr X509_STORE_new 3 ,
113168
.Xr X509_STORE_set1_param 3 ,
114169
.Xr X509_STORE_set_verify_cb 3
115170
.Sh HISTORY
116-
.Fn X509_STORE_load_locations
171+
.Fn X509_STORE_load_locations ,
172+
.Fn X509_STORE_set_default_paths ,
117173
and
118-
.Fn X509_STORE_set_default_paths
174+
.Fn X509_STORE_add_lookup
119175
first appeared in SSLeay 0.8.0 and have been available since
120176
.Ox 2.4 .
177+
.Pp
178+
.Fn X509_STORE_load_mem
179+
first appeared in
180+
.Ox 5.7 .
121181
.Sh BUGS
122182
By the time that adding a directory is found to have failed,
123183
the file and some other directories may already have been successfully loaded,

0 commit comments

Comments
 (0)