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 $
2
2
.\" full merge up to:
3
3
.\" OpenSSL X509_STORE_add_cert b0edda11 Mar 20 13:00:17 2018 +0000
4
4
.\"
5
- .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
5
+ .\" Copyright (c) 2017, 2021 Ingo Schwarze <schwarze@openbsd.org>
6
6
.\"
7
7
.\" Permission to use, copy, modify, and distribute this software for any
8
8
.\" purpose with or without fee is hereby granted, provided that the above
16
16
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
17
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
18
.\"
19
- .Dd $Mdocdate : March 12 2021 $
19
+ .Dd $Mdocdate : August 1 2021 $
20
20
.Dt X509_STORE_LOAD_LOCATIONS 3
21
21
.Os
22
22
.Sh NAME
23
23
.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
25
27
.Nd configure files and directories used by a certificate store
26
28
.Sh SYNOPSIS
27
29
.In openssl/x509_vfy.h
35
37
.Fo X509_STORE_set_default_paths
36
38
.Fa " X509_STORE *store"
37
39
.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
38
51
.Sh DESCRIPTION
39
52
.Fn X509_STORE_load_locations
40
53
instructs the
41
54
.Fa store
42
- to use the PEM file
55
+ to use the PEM
43
56
.Fa file
44
57
and all the PEM files in the directories
45
58
contained in the colon-separated list
@@ -85,6 +98,35 @@ except that it operates directly on an
85
98
.Vt X509_STORE
86
99
object, rather than on the store used by an SSL context.
87
100
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.
88
130
.Sh RETURN VALUES
89
131
.Fn X509_STORE_load_locations
90
132
returns 1 if all files and directories specified were successfully
@@ -97,6 +139,18 @@ directories failed, or if both arguments were
97
139
.Fn X509_STORE_set_default_paths
98
140
returns 0 for some error conditions and 1 otherwise, not just for
99
141
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.
100
154
.Sh FILES
101
155
.Bl -tag -width Ds
102
156
.It Pa /etc/ssl/cert.pem
@@ -109,15 +163,21 @@ default directory for
109
163
.Sh SEE ALSO
110
164
.Xr SSL_CTX_load_verify_locations 3 ,
111
165
.Xr X509_LOOKUP_hash_dir 3 ,
166
+ .Xr X509_LOOKUP_new 3 ,
112
167
.Xr X509_STORE_new 3 ,
113
168
.Xr X509_STORE_set1_param 3 ,
114
169
.Xr X509_STORE_set_verify_cb 3
115
170
.Sh HISTORY
116
- .Fn X509_STORE_load_locations
171
+ .Fn X509_STORE_load_locations ,
172
+ .Fn X509_STORE_set_default_paths ,
117
173
and
118
- .Fn X509_STORE_set_default_paths
174
+ .Fn X509_STORE_add_lookup
119
175
first appeared in SSLeay 0.8.0 and have been available since
120
176
.Ox 2.4 .
177
+ .Pp
178
+ .Fn X509_STORE_load_mem
179
+ first appeared in
180
+ .Ox 5.7 .
121
181
.Sh BUGS
122
182
By the time that adding a directory is found to have failed,
123
183
the file and some other directories may already have been successfully loaded,
0 commit comments