diff options
author | schwarze <> | 2021-07-24 14:33:14 +0000 |
---|---|---|
committer | schwarze <> | 2021-07-24 14:33:14 +0000 |
commit | 8e08483ba2fdedb74220d07afd52742b7e8af6bc (patch) | |
tree | a940d5698990f9ddd862c886f09f229234ee4437 /src/lib | |
parent | 6e182d448a0e438667357c83acce36b18a989e75 (diff) | |
download | openbsd-8e08483ba2fdedb74220d07afd52742b7e8af6bc.tar.gz openbsd-8e08483ba2fdedb74220d07afd52742b7e8af6bc.tar.bz2 openbsd-8e08483ba2fdedb74220d07afd52742b7e8af6bc.zip |
Two new manual pages X509_TRUST_set(3) and X509_check_trust(3)
documenting ten functions related to X509_TRUST objects,
trust identifiers, and trust indices.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 | 7 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_CINF_new.3 | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_TRUST_set.3 | 286 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_add1_trust_object.3 | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_check_purpose.3 | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_check_trust.3 | 208 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_new.3 | 8 |
8 files changed, 516 insertions, 12 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 300a37686a..c3dcaa06a3 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.185 2021/07/23 14:27:32 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.186 2021/07/24 14:33:14 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
@@ -305,6 +305,7 @@ MAN= \ | |||
305 | X509_STORE_new.3 \ | 305 | X509_STORE_new.3 \ |
306 | X509_STORE_set_verify_cb_func.3 \ | 306 | X509_STORE_set_verify_cb_func.3 \ |
307 | X509_STORE_set1_param.3 \ | 307 | X509_STORE_set1_param.3 \ |
308 | X509_TRUST_set.3 \ | ||
308 | X509_VERIFY_PARAM_set_flags.3 \ | 309 | X509_VERIFY_PARAM_set_flags.3 \ |
309 | X509_add1_trust_object.3 \ | 310 | X509_add1_trust_object.3 \ |
310 | X509_check_ca.3 \ | 311 | X509_check_ca.3 \ |
@@ -312,6 +313,7 @@ MAN= \ | |||
312 | X509_check_issued.3 \ | 313 | X509_check_issued.3 \ |
313 | X509_check_private_key.3 \ | 314 | X509_check_private_key.3 \ |
314 | X509_check_purpose.3 \ | 315 | X509_check_purpose.3 \ |
316 | X509_check_trust.3 \ | ||
315 | X509_cmp.3 \ | 317 | X509_cmp.3 \ |
316 | X509_cmp_time.3 \ | 318 | X509_cmp_time.3 \ |
317 | X509_digest.3 \ | 319 | X509_digest.3 \ |
diff --git a/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 b/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 index 89677a7cb3..b097bbbecc 100644 --- a/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 +++ b/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: PEM_read_bio_PrivateKey.3,v 1.19 2020/07/23 17:34:53 schwarze Exp $ | 1 | .\" $OpenBSD: PEM_read_bio_PrivateKey.3,v 1.20 2021/07/24 14:33:14 schwarze Exp $ |
2 | .\" full merge up to: | 2 | .\" full merge up to: |
3 | .\" OpenSSL man3/PEM_read_bio_PrivateKey.pod 18bad535 Apr 9 15:13:55 2019 +0100 | 3 | .\" OpenSSL man3/PEM_read_bio_PrivateKey.pod 18bad535 Apr 9 15:13:55 2019 +0100 |
4 | .\" OpenSSL man3/PEM_read_CMS.pod 83cf7abf May 29 13:07:08 2018 +0100 | 4 | .\" OpenSSL man3/PEM_read_CMS.pod 83cf7abf May 29 13:07:08 2018 +0100 |
@@ -51,7 +51,7 @@ | |||
51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
53 | .\" | 53 | .\" |
54 | .Dd $Mdocdate: July 23 2020 $ | 54 | .Dd $Mdocdate: July 24 2021 $ |
55 | .Dt PEM_READ_BIO_PRIVATEKEY 3 | 55 | .Dt PEM_READ_BIO_PRIVATEKEY 3 |
56 | .Os | 56 | .Os |
57 | .Sh NAME | 57 | .Sh NAME |
@@ -924,6 +924,9 @@ The | |||
924 | functions process a trusted X509 certificate using an | 924 | functions process a trusted X509 certificate using an |
925 | .Vt X509 | 925 | .Vt X509 |
926 | structure. | 926 | structure. |
927 | The | ||
928 | .Xr X509_check_trust 3 | ||
929 | manual explains how the auxiliary trust information is used. | ||
927 | .Pp | 930 | .Pp |
928 | The | 931 | The |
929 | .Sy X509_REQ | 932 | .Sy X509_REQ |
diff --git a/src/lib/libcrypto/man/X509_CINF_new.3 b/src/lib/libcrypto/man/X509_CINF_new.3 index 9b87aaa77b..f7de4d9524 100644 --- a/src/lib/libcrypto/man/X509_CINF_new.3 +++ b/src/lib/libcrypto/man/X509_CINF_new.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: X509_CINF_new.3,v 1.9 2021/07/12 15:56:54 schwarze Exp $ | 1 | .\" $OpenBSD: X509_CINF_new.3,v 1.10 2021/07/24 14:33:14 schwarze Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 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 12 2021 $ | 17 | .Dd $Mdocdate: July 24 2021 $ |
18 | .Dt X509_CINF_NEW 3 | 18 | .Dt X509_CINF_NEW 3 |
19 | .Os | 19 | .Os |
20 | .Sh NAME | 20 | .Sh NAME |
@@ -96,6 +96,7 @@ if an error occurs. | |||
96 | .Xr d2i_X509_CINF 3 , | 96 | .Xr d2i_X509_CINF 3 , |
97 | .Xr X509_add1_trust_object 3 , | 97 | .Xr X509_add1_trust_object 3 , |
98 | .Xr X509_CERT_AUX_print 3 , | 98 | .Xr X509_CERT_AUX_print 3 , |
99 | .Xr X509_check_trust 3 , | ||
99 | .Xr X509_keyid_set1 3 , | 100 | .Xr X509_keyid_set1 3 , |
100 | .Xr X509_new 3 | 101 | .Xr X509_new 3 |
101 | .Sh STANDARDS | 102 | .Sh STANDARDS |
diff --git a/src/lib/libcrypto/man/X509_TRUST_set.3 b/src/lib/libcrypto/man/X509_TRUST_set.3 new file mode 100644 index 0000000000..f363ead18b --- /dev/null +++ b/src/lib/libcrypto/man/X509_TRUST_set.3 | |||
@@ -0,0 +1,286 @@ | |||
1 | .\" $OpenBSD: X509_TRUST_set.3,v 1.1 2021/07/24 14:33:14 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 24 2021 $ | ||
18 | .Dt X509_TRUST_SET 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm X509_TRUST_set , | ||
22 | .Nm X509_TRUST_get_by_id , | ||
23 | .Nm X509_TRUST_add , | ||
24 | .Nm X509_TRUST_get_count , | ||
25 | .Nm X509_TRUST_cleanup , | ||
26 | .Nm X509_TRUST_get0 , | ||
27 | .Nm X509_TRUST_get_trust , | ||
28 | .Nm X509_TRUST_get0_name , | ||
29 | .Nm X509_TRUST_get_flags | ||
30 | .Nd trust objects, indices, and identifiers | ||
31 | .Sh SYNOPSIS | ||
32 | .In openssl/x509.h | ||
33 | .Ft int | ||
34 | .Fo X509_TRUST_set | ||
35 | .Fa "int *id_out" | ||
36 | .Fa "int id_in" | ||
37 | .Fc | ||
38 | .Ft int | ||
39 | .Fn X509_TRUST_get_by_id "int identifier" | ||
40 | .Ft int | ||
41 | .Fo X509_TRUST_add | ||
42 | .Fa "int identifier" | ||
43 | .Fa "int flags" | ||
44 | .Fa "int (*check_trust)(X509_TRUST *, X509 *, int)" | ||
45 | .Fa "const char *name" | ||
46 | .Fa "int arg1" | ||
47 | .Fa "void *arg2" | ||
48 | .Fc | ||
49 | .Ft int | ||
50 | .Fn X509_TRUST_get_count void | ||
51 | .Ft void | ||
52 | .Fn X509_TRUST_cleanup void | ||
53 | .Ft X509_TRUST * | ||
54 | .Fn X509_TRUST_get0 "int index" | ||
55 | .Ft int | ||
56 | .Fn X509_TRUST_get_trust "const X509_TRUST *object" | ||
57 | .Ft char * | ||
58 | .Fn X509_TRUST_get0_name "const X509_TRUST *object" | ||
59 | .Ft int | ||
60 | .Fn X509_TRUST_get_flags "const X509_TRUST *object" | ||
61 | .Sh DESCRIPTION | ||
62 | The purposes that an X.509 certificate is trusted for | ||
63 | can be identified in three equivalent ways: | ||
64 | .Bl -enum | ||
65 | .It | ||
66 | By trust identifiers, which are positive integer constants. | ||
67 | Standard trust identifiers lie in the range from | ||
68 | .Dv X509_TRUST_MIN | ||
69 | to | ||
70 | .Dv X509_TRUST_MAX , | ||
71 | inclusive. | ||
72 | User defined trust identifiers are larger than | ||
73 | .Dv X509_TRUST_MAX . | ||
74 | .It | ||
75 | By trust indices, which are non-negative integer constants but | ||
76 | differ from the trust identifiers expressing the same kind of trust. | ||
77 | Standard trust indices are smaller than | ||
78 | .Dv X509_TRUST_MAX . | ||
79 | User defined trust indices are larger than or equal to | ||
80 | .Dv X509_TRUST_MAX . | ||
81 | .It | ||
82 | By trust objects of the type | ||
83 | .Vt X509_TRUST . | ||
84 | Standard trust objects are available in static storage. | ||
85 | User defined trust objects can be created with | ||
86 | .Fn X509_TRUST_add . | ||
87 | .El | ||
88 | .Pp | ||
89 | Application programmers cannot choose the way to identify kinds of trust | ||
90 | that they like best; depending on the circumstances, all three ways | ||
91 | are needed. | ||
92 | Be warned that the naming of most functions is misleading. | ||
93 | .Pp | ||
94 | Most API functions documented outside the present manual page | ||
95 | use trust identifiers rather than trust indices. | ||
96 | .Pp | ||
97 | ASN.1 object identifiers and NIDs provide a fourth and a fifth way | ||
98 | to identify purposes that a certificate is trusted for. | ||
99 | These are almost, but not exactly, equivalent | ||
100 | to the three ways listed above; see the | ||
101 | .Xr X509_check_trust 3 | ||
102 | manual for details. | ||
103 | .Ss Using trust identifiers | ||
104 | .Fn X509_TRUST_set | ||
105 | validates the trust identifier | ||
106 | .Fa id_in . | ||
107 | If it is valid, it is copied to | ||
108 | .Pf * Fa id_out . | ||
109 | Otherwise, | ||
110 | .Pf * Fa id_out | ||
111 | remains unchanged. | ||
112 | .Pp | ||
113 | .Fn X509_TRUST_get_by_id | ||
114 | converts the trust | ||
115 | .Fa identifier | ||
116 | to the corresponding trust | ||
117 | .Fa index . | ||
118 | To find the corresponding trust object, pass the result to | ||
119 | .Fn X509_TRUST_get0 . | ||
120 | .Pp | ||
121 | .Fn X509_TRUST_add | ||
122 | defines a purpose certificates can be trusted for with the given | ||
123 | .Fa identifier | ||
124 | or modifies its properties if it already exists. | ||
125 | The trust | ||
126 | .Fa identifier , | ||
127 | the | ||
128 | .Fa flags , | ||
129 | the | ||
130 | .Fa check_trust | ||
131 | function, the | ||
132 | .Fa name , | ||
133 | the number | ||
134 | .Fa arg1 , | ||
135 | and the pointer | ||
136 | .Fa arg2 | ||
137 | are copied into the | ||
138 | .Vt X509_TRUST | ||
139 | object. | ||
140 | When modifying an existing trust object, previous | ||
141 | values of fields are overwritten and a previous | ||
142 | .Fa name | ||
143 | string is freed if it was dynamically allocated. | ||
144 | When creating a new trust object, | ||
145 | it is added to the global array of user-defined trust objects. | ||
146 | .Pp | ||
147 | .Dv X509_TRUST_DYNAMIC | ||
148 | and | ||
149 | .Dv X509_TRUST_DYNAMIC_NAME | ||
150 | are always ignored in the | ||
151 | .Fa flags | ||
152 | argument. | ||
153 | .Dv X509_TRUST_DYNAMIC | ||
154 | is automatically set if the object was created by the user. | ||
155 | It is never set for standard objects, | ||
156 | not even if they were modified by the user. | ||
157 | .Dv X509_trust_DYNAMIC_NAME | ||
158 | is automatically set if the object was created or modified by the user. | ||
159 | It is only unset for unmodified standard objects. | ||
160 | The library does not appear to define any other flags, | ||
161 | so the flags argument is probably useless | ||
162 | unless users define their own flags and use them in the | ||
163 | .Fa check_trust | ||
164 | function. | ||
165 | .Pp | ||
166 | The third and final argument of the | ||
167 | .Fa check_trust | ||
168 | function is the | ||
169 | .Fa flags | ||
170 | argument of | ||
171 | .Fn X509_check_trust . | ||
172 | .Pp | ||
173 | The built-in trust checking functions documented in the | ||
174 | .Xr X509_check_trust 3 | ||
175 | manual page use | ||
176 | .Fa arg1 | ||
177 | as the corresponding ASN.1 object NID and ignore | ||
178 | .Fa arg2 | ||
179 | and | ||
180 | .Fa flags , | ||
181 | but a user-supplied | ||
182 | .Fa check_trust | ||
183 | function can use these fields in any arbitrary way. | ||
184 | .Pp | ||
185 | .Fn X509_TRUST_get_count | ||
186 | returns the total number of trust objects currently existing, | ||
187 | including both standard and user-defined objects. | ||
188 | If no user-defined objects exist, the returned value is | ||
189 | .Dv X509_TRUST_MAX . | ||
190 | .Pp | ||
191 | .Fn X509_TRUST_cleanup | ||
192 | deletes all user-defined trust objects | ||
193 | and invalidates their trust identifiers and trust indices. | ||
194 | If any of the standard trust objects were modified by the user, | ||
195 | those changes are | ||
196 | .Em not | ||
197 | reverted. | ||
198 | .Ss Using trust indices | ||
199 | .Fn X509_TRUST_get0 | ||
200 | converts the trust | ||
201 | .Fa index | ||
202 | to a pointer to the corresponding trust object. | ||
203 | To find the corresponding trust identifier, pass the result to | ||
204 | .Fn X509_TRUST_get_trust . | ||
205 | .Ss Using trust objects | ||
206 | .Fn X509_TRUST_get_trust | ||
207 | converts a pointer to a trust | ||
208 | .Fa object | ||
209 | to the corresponding trust identifier. | ||
210 | To find the corresponding trust index, pass the result to | ||
211 | .Fn X509_TRUST_get_by_id . | ||
212 | .Pp | ||
213 | .Fn X509_TRUST_get0_name | ||
214 | and | ||
215 | .Fn X509_TRUST_get_flags | ||
216 | retrieve the name and flags from the | ||
217 | .Fa object , | ||
218 | respectively. | ||
219 | .Sh RETURN VALUES | ||
220 | .Fn X509_TRUST_set | ||
221 | returns 1 if | ||
222 | .Fa id_in | ||
223 | is valid or 0 otherwise. | ||
224 | .Pp | ||
225 | .Fn X509_TRUST_get_by_id | ||
226 | returns the corresponding trust index or -1 if the | ||
227 | .Fa identifier | ||
228 | is invalid. | ||
229 | .Pp | ||
230 | .Fn X509_TRUST_add | ||
231 | returns 1 for success or 0 for failure. | ||
232 | .Pp | ||
233 | .Fn X509_TRUST_get_count | ||
234 | returns the total number of trust objects currently existing. | ||
235 | .Pp | ||
236 | .Fn X509_TRUST_get0 | ||
237 | returns a standard or user-defined trust object or | ||
238 | .Dv NULL | ||
239 | if the | ||
240 | .Fa index | ||
241 | is invalid. | ||
242 | .Pp | ||
243 | .Fn X509_TRUST_get_trust | ||
244 | always returns a valid trust identifier. | ||
245 | .Pp | ||
246 | .Fn X509_TRUST_get0_name | ||
247 | returns a pointer to storage owned by the | ||
248 | .Fa object . | ||
249 | .Pp | ||
250 | .Fn X509_TRUST_get_flags | ||
251 | returns the flags associated with the | ||
252 | .Fa object . | ||
253 | .Sh ERRORS | ||
254 | The following diagnostics can be retrieved with | ||
255 | .Xr ERR_get_error 3 , | ||
256 | .Xr ERR_GET_REASON 3 , | ||
257 | and | ||
258 | .Xr ERR_reason_error_string 3 : | ||
259 | .Bl -tag -width Ds | ||
260 | .It Dv X509_R_INVALID_TRUST Qq "invalid trust" | ||
261 | .Fn X509_TRUST_set | ||
262 | was called with an invalid | ||
263 | .Fa id_in | ||
264 | argument. | ||
265 | .It Dv ERR_R_MALLOC_FAILURE Qq "malloc failure" | ||
266 | .Fn X509_TRUST_add | ||
267 | failed to allocate memory. | ||
268 | .El | ||
269 | .Pp | ||
270 | The other functions provide no diagnostics. | ||
271 | .Sh SEE ALSO | ||
272 | .Xr X509_check_trust 3 , | ||
273 | .Xr X509_new 3 , | ||
274 | .Xr X509_PURPOSE_set 3 , | ||
275 | .Xr X509_VERIFY_PARAM_set_trust 3 | ||
276 | .Sh HISTORY | ||
277 | .Fn X509_TRUST_set | ||
278 | first appeared in OpenSSL 0.9.7 and has been available since | ||
279 | .Ox 3.2 . | ||
280 | .Pp | ||
281 | The other functions first appeared in OpenSSL 0.9.5 | ||
282 | and have been available since | ||
283 | .Ox 2.7 . | ||
284 | .Sh CAVEATS | ||
285 | The difference between trust identifiers and trust indices | ||
286 | provides an ideal breeding ground for off-by-one bugs. | ||
diff --git a/src/lib/libcrypto/man/X509_add1_trust_object.3 b/src/lib/libcrypto/man/X509_add1_trust_object.3 index 3c1ae52e69..e1e3824208 100644 --- a/src/lib/libcrypto/man/X509_add1_trust_object.3 +++ b/src/lib/libcrypto/man/X509_add1_trust_object.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: X509_add1_trust_object.3,v 1.2 2021/07/08 13:07:00 schwarze Exp $ | 1 | .\" $OpenBSD: X509_add1_trust_object.3,v 1.3 2021/07/24 14:33:14 schwarze Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 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 8 2021 $ | 17 | .Dd $Mdocdate: July 24 2021 $ |
18 | .Dt X509_ADD1_TRUST_OBJECT 3 | 18 | .Dt X509_ADD1_TRUST_OBJECT 3 |
19 | .Os | 19 | .Os |
20 | .Sh NAME | 20 | .Sh NAME |
@@ -93,6 +93,7 @@ does not contain a sub-object that can hold non-standard auxiliary data. | |||
93 | .Xr EXTENDED_KEY_USAGE_new 3 , | 93 | .Xr EXTENDED_KEY_USAGE_new 3 , |
94 | .Xr OBJ_nid2obj 3 , | 94 | .Xr OBJ_nid2obj 3 , |
95 | .Xr X509_CERT_AUX_new 3 , | 95 | .Xr X509_CERT_AUX_new 3 , |
96 | .Xr X509_check_trust 3 , | ||
96 | .Xr X509_new 3 | 97 | .Xr X509_new 3 |
97 | .Sh HISTORY | 98 | .Sh HISTORY |
98 | These functions first appeared in OpenSSL 0.9.4 and have been available since | 99 | These functions first appeared in OpenSSL 0.9.4 and have been available since |
diff --git a/src/lib/libcrypto/man/X509_check_purpose.3 b/src/lib/libcrypto/man/X509_check_purpose.3 index b03eb5e469..56f6109541 100644 --- a/src/lib/libcrypto/man/X509_check_purpose.3 +++ b/src/lib/libcrypto/man/X509_check_purpose.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: X509_check_purpose.3,v 1.4 2021/07/23 16:22:59 schwarze Exp $ | 1 | .\" $OpenBSD: X509_check_purpose.3,v 1.5 2021/07/24 14:33:14 schwarze Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2019, 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 24 2021 $ |
18 | .Dt X509_CHECK_PURPOSE 3 | 18 | .Dt X509_CHECK_PURPOSE 3 |
19 | .Os | 19 | .Os |
20 | .Sh NAME | 20 | .Sh NAME |
@@ -380,6 +380,7 @@ can be used as a CA for the | |||
380 | .Sh SEE ALSO | 380 | .Sh SEE ALSO |
381 | .Xr BASIC_CONSTRAINTS_new 3 , | 381 | .Xr BASIC_CONSTRAINTS_new 3 , |
382 | .Xr EXTENDED_KEY_USAGE_new 3 , | 382 | .Xr EXTENDED_KEY_USAGE_new 3 , |
383 | .Xr X509_check_trust 3 , | ||
383 | .Xr X509_new 3 , | 384 | .Xr X509_new 3 , |
384 | .Xr X509_PURPOSE_set 3 , | 385 | .Xr X509_PURPOSE_set 3 , |
385 | .Xr X509V3_get_d2i 3 , | 386 | .Xr X509V3_get_d2i 3 , |
diff --git a/src/lib/libcrypto/man/X509_check_trust.3 b/src/lib/libcrypto/man/X509_check_trust.3 new file mode 100644 index 0000000000..4b625fdfd4 --- /dev/null +++ b/src/lib/libcrypto/man/X509_check_trust.3 | |||
@@ -0,0 +1,208 @@ | |||
1 | .\" $OpenBSD: X509_check_trust.3,v 1.1 2021/07/24 14:33:14 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 24 2021 $ | ||
18 | .Dt X509_CHECK_TRUST 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm X509_check_trust | ||
22 | .Nd check whether a certificate is trusted | ||
23 | .Sh SYNOPSIS | ||
24 | .In openssl/x509.h | ||
25 | .Ft int | ||
26 | .Fo X509_check_trust | ||
27 | .Fa "X509 *certificate" | ||
28 | .Fa "int trust" | ||
29 | .Fa "int flags" | ||
30 | .Fc | ||
31 | .Sh DESCRIPTION | ||
32 | .Fn X509_check_trust | ||
33 | checks whether the | ||
34 | .Fa certificate | ||
35 | is marked as trusted for the purpose corresponding to the requested | ||
36 | .Fa trust | ||
37 | identifier. | ||
38 | .Pp | ||
39 | The standard algorithm used by all built-in trust checking functions | ||
40 | performs the following tests in the following order. | ||
41 | The first matching test terminates the algorithm | ||
42 | and decides the return value. | ||
43 | .Bl -enum | ||
44 | .It | ||
45 | If | ||
46 | .Xr X509_add1_reject_object 3 | ||
47 | was previously called on the | ||
48 | .Fa certificate | ||
49 | with the ASN.1 object identifier corresponding to the requested | ||
50 | .Fa trust | ||
51 | identifier, | ||
52 | .Dv X509_TRUST_REJECTED | ||
53 | is returned. | ||
54 | .It | ||
55 | If | ||
56 | .Xr X509_add1_trust_object 3 | ||
57 | was previously called on the | ||
58 | .Fa certificate | ||
59 | with the ASN.1 object identifier corresponding to the requested | ||
60 | .Fa trust | ||
61 | identifier, | ||
62 | .Dv X509_TRUST_TRUSTED | ||
63 | is returned. | ||
64 | .It | ||
65 | If | ||
66 | .Xr X509_add1_reject_object 3 | ||
67 | or | ||
68 | .Xr X509_add1_trust_object 3 | ||
69 | were previously called on the | ||
70 | .Fa certificate , | ||
71 | but neither of them | ||
72 | with the ASN.1 object identifier corresponding to the requested | ||
73 | .Fa trust | ||
74 | identifier, | ||
75 | .Dv X509_TRUST_UNTRUSTED | ||
76 | is returned. | ||
77 | .It | ||
78 | This so-called | ||
79 | .Dq compatibility | ||
80 | step is skipped by some of the trust checking functions. | ||
81 | If neither | ||
82 | .Xr X509_add1_reject_object 3 | ||
83 | nor | ||
84 | .Xr X509_add1_trust_object 3 | ||
85 | was previously called on the | ||
86 | .Fa certificate | ||
87 | and if the | ||
88 | .Fa certificate | ||
89 | is a self-signed, | ||
90 | .Dv X509_TRUST_TRUSTED | ||
91 | is returned. | ||
92 | .It | ||
93 | Otherwise, | ||
94 | .Dv X509_TRUST_UNTRUSTED | ||
95 | is returned. | ||
96 | .El | ||
97 | .Pp | ||
98 | By default, the following | ||
99 | .Fa trust | ||
100 | identifiers are supported. | ||
101 | The | ||
102 | .Dq ASN.1 NID | ||
103 | column indicates the correspondig ASN.1 object identifier; | ||
104 | for the relationship between ASN.1 NIDs and OIDs, see the | ||
105 | .Xr OBJ_nid2obj 3 | ||
106 | manual page. | ||
107 | The | ||
108 | .Qq compat | ||
109 | column indicates whether the compatibility step in the standard algorithm | ||
110 | detailed above is used or skipped. | ||
111 | .Pp | ||
112 | .Bl -column X509_TRUST_OCSP_REQUEST NID_anyExtendedKeyUsage compat -compact | ||
113 | .It Fa trust No identifier Ta Em ASN.1 NID Ta Em compat | ||
114 | .It Dv X509_TRUST_SSL_CLIENT Ta Dv NID_client_auth Ta use | ||
115 | .It Dv X509_TRUST_SSL_SERVER Ta Dv NID_server_auth Ta use | ||
116 | .It Dv X509_TRUST_EMAIL Ta Dv NID_email_protect Ta use | ||
117 | .It Dv X509_TRUST_OBJECT_SIGN Ta Dv NID_code_sign Ta use | ||
118 | .It Dv X509_TRUST_OCSP_SIGN Ta Dv NID_OCSP_sign Ta skip | ||
119 | .It Dv X509_TRUST_OCSP_REQUEST Ta Dv NID_ad_OCSP Ta skip | ||
120 | .It Dv X509_TRUST_TSA Ta Dv NID_time_stamp Ta use | ||
121 | .It Dv X509_TRUST_COMPAT Ta none Ta only | ||
122 | .It 0 Ta Dv NID_anyExtendedKeyUsage Ta special | ||
123 | .It \-1 Ta none Ta trusted | ||
124 | .It invalid Ta Fa trust No argument Ta skip | ||
125 | .El | ||
126 | .Pp | ||
127 | For the following | ||
128 | .Fa trust | ||
129 | identifiers, the standard algorithm is modified: | ||
130 | .Bl -tag -width Ds | ||
131 | .It Dv X509_TRUST_COMPAT | ||
132 | .Xr X509_add1_reject_object 3 | ||
133 | and | ||
134 | .Xr X509_add1_trust_object 3 | ||
135 | settings are completely ignored | ||
136 | and all steps before the compatibility step are skippped. | ||
137 | The | ||
138 | .Fa certificate | ||
139 | is trusted if and only if it is self-signed. | ||
140 | .It 0 | ||
141 | The third step in the standard algorithm is skipped, and the | ||
142 | compatibility step is used even if | ||
143 | .Xr X509_add1_reject_object 3 | ||
144 | or | ||
145 | .Xr X509_add1_trust_object 3 | ||
146 | were called with ASN.1 object identifiers not corresponding to | ||
147 | .Dv NID_anyExtendedKeyUsage . | ||
148 | .It \-1 | ||
149 | The | ||
150 | .Fa certificate | ||
151 | is not inspected and | ||
152 | .Dv X509_TRUST_TRUSTED | ||
153 | is always returned. | ||
154 | .It invalid | ||
155 | If the | ||
156 | .Fa trust | ||
157 | argument is neither 0 nor \-1 nor valid as a trust identifier, | ||
158 | it is re-interpreted as an ASN.1 NID | ||
159 | and used itself for the standard algorithm. | ||
160 | The compatibility step is skipped in this case. | ||
161 | .El | ||
162 | .Pp | ||
163 | The | ||
164 | .Fa flags | ||
165 | argument is ignored by all built-in trust checking functions, | ||
166 | but user-specified trust checking functions might use it. | ||
167 | .Pp | ||
168 | If the function | ||
169 | .Xr X509_TRUST_add 3 | ||
170 | was called before | ||
171 | .Fn X509_check_trust , | ||
172 | it may have installed different, user-supplied checking functions | ||
173 | for some of the standard | ||
174 | .Fa trust | ||
175 | identifiers listed above, or it may have installed additional, | ||
176 | user-supplied checking functions for user-defined | ||
177 | .Fa trust | ||
178 | identifiers not listed above. | ||
179 | .Sh RETURN VALUES | ||
180 | .Fn X509_check_trust | ||
181 | returns the following values: | ||
182 | .Bl -tag -width Ds | ||
183 | .It Dv X509_TRUST_TRUSTED | ||
184 | The | ||
185 | .Fa certificate | ||
186 | is explicitly or implicitly trusted for the requested purpose. | ||
187 | .It Dv X509_TRUST_REJECTED | ||
188 | The | ||
189 | .Fa certificate | ||
190 | is explicitely rejected for the requested purpose. | ||
191 | .It Dv X509_TRUST_UNTRUSTED | ||
192 | The | ||
193 | .Fa certificate | ||
194 | is neither trusted nor explicitely rejected, | ||
195 | which implies that it is not trusted. | ||
196 | .El | ||
197 | .Sh SEE ALSO | ||
198 | .Xr PEM_read_X509_AUX 3 , | ||
199 | .Xr X509_add1_trust_object 3 , | ||
200 | .Xr X509_CERT_AUX_new 3 , | ||
201 | .Xr X509_check_purpose 3 , | ||
202 | .Xr X509_new 3 , | ||
203 | .Xr X509_TRUST_set 3 , | ||
204 | .Xr X509_VERIFY_PARAM_set_trust 3 | ||
205 | .Sh HISTORY | ||
206 | .Fn X509_check_trust | ||
207 | first appeared in OpenSSL 0.9.5 and has been available since | ||
208 | .Ox 2.7 . | ||
diff --git a/src/lib/libcrypto/man/X509_new.3 b/src/lib/libcrypto/man/X509_new.3 index ef99015ddb..e06203f87c 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.25 2021/07/23 14:27:32 schwarze Exp $ | 1 | .\" $OpenBSD: X509_new.3,v 1.26 2021/07/24 14:33:14 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 23 2021 $ | 69 | .Dd $Mdocdate: July 24 2021 $ |
70 | .Dt X509_NEW 3 | 70 | .Dt X509_NEW 3 |
71 | .Os | 71 | .Os |
72 | .Sh NAME | 72 | .Sh NAME |
@@ -176,6 +176,7 @@ if an error occurs. | |||
176 | .Xr X509_check_issued 3 , | 176 | .Xr X509_check_issued 3 , |
177 | .Xr X509_check_private_key 3 , | 177 | .Xr X509_check_private_key 3 , |
178 | .Xr X509_check_purpose 3 , | 178 | .Xr X509_check_purpose 3 , |
179 | .Xr X509_check_trust 3 , | ||
179 | .Xr X509_CINF_new 3 , | 180 | .Xr X509_CINF_new 3 , |
180 | .Xr X509_cmp 3 , | 181 | .Xr X509_cmp 3 , |
181 | .Xr X509_CRL_new 3 , | 182 | .Xr X509_CRL_new 3 , |
@@ -199,7 +200,8 @@ if an error occurs. | |||
199 | .Xr X509_SIG_new 3 , | 200 | .Xr X509_SIG_new 3 , |
200 | .Xr X509_sign 3 , | 201 | .Xr X509_sign 3 , |
201 | .Xr X509_STORE_CTX_new 3 , | 202 | .Xr X509_STORE_CTX_new 3 , |
202 | .Xr X509_STORE_new 3 | 203 | .Xr X509_STORE_new 3 , |
204 | .Xr X509_TRUST_set 3 | ||
203 | .Sh STANDARDS | 205 | .Sh STANDARDS |
204 | RFC 5280: Internet X.509 Public Key Infrastructure Certificate and | 206 | RFC 5280: Internet X.509 Public Key Infrastructure Certificate and |
205 | Certificate Revocation List (CRL) Profile | 207 | Certificate Revocation List (CRL) Profile |