summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/man/Makefile4
-rw-r--r--src/lib/libcrypto/man/PEM_read_bio_PrivateKey.37
-rw-r--r--src/lib/libcrypto/man/X509_CINF_new.35
-rw-r--r--src/lib/libcrypto/man/X509_TRUST_set.3286
-rw-r--r--src/lib/libcrypto/man/X509_add1_trust_object.35
-rw-r--r--src/lib/libcrypto/man/X509_check_purpose.35
-rw-r--r--src/lib/libcrypto/man/X509_check_trust.3208
-rw-r--r--src/lib/libcrypto/man/X509_new.38
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
924functions process a trusted X509 certificate using an 924functions process a trusted X509 certificate using an
925.Vt X509 925.Vt X509
926structure. 926structure.
927The
928.Xr X509_check_trust 3
929manual explains how the auxiliary trust information is used.
927.Pp 930.Pp
928The 931The
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
62The purposes that an X.509 certificate is trusted for
63can be identified in three equivalent ways:
64.Bl -enum
65.It
66By trust identifiers, which are positive integer constants.
67Standard trust identifiers lie in the range from
68.Dv X509_TRUST_MIN
69to
70.Dv X509_TRUST_MAX ,
71inclusive.
72User defined trust identifiers are larger than
73.Dv X509_TRUST_MAX .
74.It
75By trust indices, which are non-negative integer constants but
76differ from the trust identifiers expressing the same kind of trust.
77Standard trust indices are smaller than
78.Dv X509_TRUST_MAX .
79User defined trust indices are larger than or equal to
80.Dv X509_TRUST_MAX .
81.It
82By trust objects of the type
83.Vt X509_TRUST .
84Standard trust objects are available in static storage.
85User defined trust objects can be created with
86.Fn X509_TRUST_add .
87.El
88.Pp
89Application programmers cannot choose the way to identify kinds of trust
90that they like best; depending on the circumstances, all three ways
91are needed.
92Be warned that the naming of most functions is misleading.
93.Pp
94Most API functions documented outside the present manual page
95use trust identifiers rather than trust indices.
96.Pp
97ASN.1 object identifiers and NIDs provide a fourth and a fifth way
98to identify purposes that a certificate is trusted for.
99These are almost, but not exactly, equivalent
100to the three ways listed above; see the
101.Xr X509_check_trust 3
102manual for details.
103.Ss Using trust identifiers
104.Fn X509_TRUST_set
105validates the trust identifier
106.Fa id_in .
107If it is valid, it is copied to
108.Pf * Fa id_out .
109Otherwise,
110.Pf * Fa id_out
111remains unchanged.
112.Pp
113.Fn X509_TRUST_get_by_id
114converts the trust
115.Fa identifier
116to the corresponding trust
117.Fa index .
118To find the corresponding trust object, pass the result to
119.Fn X509_TRUST_get0 .
120.Pp
121.Fn X509_TRUST_add
122defines a purpose certificates can be trusted for with the given
123.Fa identifier
124or modifies its properties if it already exists.
125The trust
126.Fa identifier ,
127the
128.Fa flags ,
129the
130.Fa check_trust
131function, the
132.Fa name ,
133the number
134.Fa arg1 ,
135and the pointer
136.Fa arg2
137are copied into the
138.Vt X509_TRUST
139object.
140When modifying an existing trust object, previous
141values of fields are overwritten and a previous
142.Fa name
143string is freed if it was dynamically allocated.
144When creating a new trust object,
145it is added to the global array of user-defined trust objects.
146.Pp
147.Dv X509_TRUST_DYNAMIC
148and
149.Dv X509_TRUST_DYNAMIC_NAME
150are always ignored in the
151.Fa flags
152argument.
153.Dv X509_TRUST_DYNAMIC
154is automatically set if the object was created by the user.
155It is never set for standard objects,
156not even if they were modified by the user.
157.Dv X509_trust_DYNAMIC_NAME
158is automatically set if the object was created or modified by the user.
159It is only unset for unmodified standard objects.
160The library does not appear to define any other flags,
161so the flags argument is probably useless
162unless users define their own flags and use them in the
163.Fa check_trust
164function.
165.Pp
166The third and final argument of the
167.Fa check_trust
168function is the
169.Fa flags
170argument of
171.Fn X509_check_trust .
172.Pp
173The built-in trust checking functions documented in the
174.Xr X509_check_trust 3
175manual page use
176.Fa arg1
177as the corresponding ASN.1 object NID and ignore
178.Fa arg2
179and
180.Fa flags ,
181but a user-supplied
182.Fa check_trust
183function can use these fields in any arbitrary way.
184.Pp
185.Fn X509_TRUST_get_count
186returns the total number of trust objects currently existing,
187including both standard and user-defined objects.
188If no user-defined objects exist, the returned value is
189.Dv X509_TRUST_MAX .
190.Pp
191.Fn X509_TRUST_cleanup
192deletes all user-defined trust objects
193and invalidates their trust identifiers and trust indices.
194If any of the standard trust objects were modified by the user,
195those changes are
196.Em not
197reverted.
198.Ss Using trust indices
199.Fn X509_TRUST_get0
200converts the trust
201.Fa index
202to a pointer to the corresponding trust object.
203To 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
207converts a pointer to a trust
208.Fa object
209to the corresponding trust identifier.
210To find the corresponding trust index, pass the result to
211.Fn X509_TRUST_get_by_id .
212.Pp
213.Fn X509_TRUST_get0_name
214and
215.Fn X509_TRUST_get_flags
216retrieve the name and flags from the
217.Fa object ,
218respectively.
219.Sh RETURN VALUES
220.Fn X509_TRUST_set
221returns 1 if
222.Fa id_in
223is valid or 0 otherwise.
224.Pp
225.Fn X509_TRUST_get_by_id
226returns the corresponding trust index or -1 if the
227.Fa identifier
228is invalid.
229.Pp
230.Fn X509_TRUST_add
231returns 1 for success or 0 for failure.
232.Pp
233.Fn X509_TRUST_get_count
234returns the total number of trust objects currently existing.
235.Pp
236.Fn X509_TRUST_get0
237returns a standard or user-defined trust object or
238.Dv NULL
239if the
240.Fa index
241is invalid.
242.Pp
243.Fn X509_TRUST_get_trust
244always returns a valid trust identifier.
245.Pp
246.Fn X509_TRUST_get0_name
247returns a pointer to storage owned by the
248.Fa object .
249.Pp
250.Fn X509_TRUST_get_flags
251returns the flags associated with the
252.Fa object .
253.Sh ERRORS
254The following diagnostics can be retrieved with
255.Xr ERR_get_error 3 ,
256.Xr ERR_GET_REASON 3 ,
257and
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
262was called with an invalid
263.Fa id_in
264argument.
265.It Dv ERR_R_MALLOC_FAILURE Qq "malloc failure"
266.Fn X509_TRUST_add
267failed to allocate memory.
268.El
269.Pp
270The 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
278first appeared in OpenSSL 0.9.7 and has been available since
279.Ox 3.2 .
280.Pp
281The other functions first appeared in OpenSSL 0.9.5
282and have been available since
283.Ox 2.7 .
284.Sh CAVEATS
285The difference between trust identifiers and trust indices
286provides 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
98These functions first appeared in OpenSSL 0.9.4 and have been available since 99These 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
33checks whether the
34.Fa certificate
35is marked as trusted for the purpose corresponding to the requested
36.Fa trust
37identifier.
38.Pp
39The standard algorithm used by all built-in trust checking functions
40performs the following tests in the following order.
41The first matching test terminates the algorithm
42and decides the return value.
43.Bl -enum
44.It
45If
46.Xr X509_add1_reject_object 3
47was previously called on the
48.Fa certificate
49with the ASN.1 object identifier corresponding to the requested
50.Fa trust
51identifier,
52.Dv X509_TRUST_REJECTED
53is returned.
54.It
55If
56.Xr X509_add1_trust_object 3
57was previously called on the
58.Fa certificate
59with the ASN.1 object identifier corresponding to the requested
60.Fa trust
61identifier,
62.Dv X509_TRUST_TRUSTED
63is returned.
64.It
65If
66.Xr X509_add1_reject_object 3
67or
68.Xr X509_add1_trust_object 3
69were previously called on the
70.Fa certificate ,
71but neither of them
72with the ASN.1 object identifier corresponding to the requested
73.Fa trust
74identifier,
75.Dv X509_TRUST_UNTRUSTED
76is returned.
77.It
78This so-called
79.Dq compatibility
80step is skipped by some of the trust checking functions.
81If neither
82.Xr X509_add1_reject_object 3
83nor
84.Xr X509_add1_trust_object 3
85was previously called on the
86.Fa certificate
87and if the
88.Fa certificate
89is a self-signed,
90.Dv X509_TRUST_TRUSTED
91is returned.
92.It
93Otherwise,
94.Dv X509_TRUST_UNTRUSTED
95is returned.
96.El
97.Pp
98By default, the following
99.Fa trust
100identifiers are supported.
101The
102.Dq ASN.1 NID
103column indicates the correspondig ASN.1 object identifier;
104for the relationship between ASN.1 NIDs and OIDs, see the
105.Xr OBJ_nid2obj 3
106manual page.
107The
108.Qq compat
109column indicates whether the compatibility step in the standard algorithm
110detailed 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
127For the following
128.Fa trust
129identifiers, the standard algorithm is modified:
130.Bl -tag -width Ds
131.It Dv X509_TRUST_COMPAT
132.Xr X509_add1_reject_object 3
133and
134.Xr X509_add1_trust_object 3
135settings are completely ignored
136and all steps before the compatibility step are skippped.
137The
138.Fa certificate
139is trusted if and only if it is self-signed.
140.It 0
141The third step in the standard algorithm is skipped, and the
142compatibility step is used even if
143.Xr X509_add1_reject_object 3
144or
145.Xr X509_add1_trust_object 3
146were called with ASN.1 object identifiers not corresponding to
147.Dv NID_anyExtendedKeyUsage .
148.It \-1
149The
150.Fa certificate
151is not inspected and
152.Dv X509_TRUST_TRUSTED
153is always returned.
154.It invalid
155If the
156.Fa trust
157argument is neither 0 nor \-1 nor valid as a trust identifier,
158it is re-interpreted as an ASN.1 NID
159and used itself for the standard algorithm.
160The compatibility step is skipped in this case.
161.El
162.Pp
163The
164.Fa flags
165argument is ignored by all built-in trust checking functions,
166but user-specified trust checking functions might use it.
167.Pp
168If the function
169.Xr X509_TRUST_add 3
170was called before
171.Fn X509_check_trust ,
172it may have installed different, user-supplied checking functions
173for some of the standard
174.Fa trust
175identifiers listed above, or it may have installed additional,
176user-supplied checking functions for user-defined
177.Fa trust
178identifiers not listed above.
179.Sh RETURN VALUES
180.Fn X509_check_trust
181returns the following values:
182.Bl -tag -width Ds
183.It Dv X509_TRUST_TRUSTED
184The
185.Fa certificate
186is explicitly or implicitly trusted for the requested purpose.
187.It Dv X509_TRUST_REJECTED
188The
189.Fa certificate
190is explicitely rejected for the requested purpose.
191.It Dv X509_TRUST_UNTRUSTED
192The
193.Fa certificate
194is neither trusted nor explicitely rejected,
195which 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
207first 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
204RFC 5280: Internet X.509 Public Key Infrastructure Certificate and 206RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
205Certificate Revocation List (CRL) Profile 207Certificate Revocation List (CRL) Profile