summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/X509_policy_check.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/X509_policy_check.3')
-rw-r--r--src/lib/libcrypto/man/X509_policy_check.3192
1 files changed, 0 insertions, 192 deletions
diff --git a/src/lib/libcrypto/man/X509_policy_check.3 b/src/lib/libcrypto/man/X509_policy_check.3
deleted file mode 100644
index 5ea774a3ef..0000000000
--- a/src/lib/libcrypto/man/X509_policy_check.3
+++ /dev/null
@@ -1,192 +0,0 @@
1.\" $OpenBSD: X509_policy_check.3,v 1.6 2021/11/11 12:06:25 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: November 11 2021 $
18.Dt X509_POLICY_CHECK 3
19.Os
20.Sh NAME
21.Nm X509_policy_check ,
22.Nm X509_policy_tree_free
23.Nd construct X.509 valid policy tree
24.Sh SYNOPSIS
25.In openssl/x509_vfy.h
26.Ft int
27.Fo X509_policy_check
28.Fa "X509_POLICY_TREE **ptree"
29.Fa "int *pexplicit_policy"
30.Fa "STACK_OF(X509) *certs"
31.Fa "STACK_OF(ASN1_OBJECT) *policy_oids"
32.Fa "unsigned int flags"
33.Fc
34.Ft void
35.Fn X509_policy_tree_free "X509_POLICY_TREE *tree"
36.Sh DESCRIPTION
37.Fn X509_policy_check
38performs those parts of Basic Certification Path Validation
39described in RFC 5280 section 6.1 that are related to the
40construction of the valid policy tree.
41.Pp
42The
43.Fa certs
44input argument contains the prospective certification path
45according to RFC 5280 paragraph 6.1.1(a), starting with the
46target certificate and ending with the trust anchor.
47.Pp
48The
49.Fa policy_oids
50input argument contains the
51.Va user-initial-policy-set
52according to RFC 5280 section 6.1.1(c).
53It specifies a set of certificate policies acceptable to the certificate user.
54.Pp
55The
56.Fa flags
57argument can contain zero or more of the following constants, OR'ed together:
58.Bl -tag -width Ds
59.It Dv X509_V_FLAG_EXPLICIT_POLICY
60Set
61.Va initial-explicit-policy
62as defined by RFC 5280 paragraph 6.1.1(f).
63It requires the path to be valid for at least one of the
64.Fa policy_oids .
65.It Dv X509_V_FLAG_INHIBIT_ANY
66Set
67.Va initial-any-policy-inhibit
68as defined by RFC 5280 paragraph 6.1.1(g).
69It causes the
70.Sy anyPolicy
71OID to be skipped if it is encountered in a certificate.
72.It Dv X509_V_FLAG_INHIBIT_MAP
73Set
74.Va initial-policy-mapping-inhibit
75as defined by RFC 5280 paragraph 6.1.1(e).
76It disables policy mapping in the certification path.
77.El
78.Pp
79Upon success and in some cases of failure, the storage location pointed to by
80.Fa pexplicit_policy
81is set to 1 if
82.Dv X509_V_FLAG_EXPLICIT_POLICY
83was requested.
84Otherwise, it is set to 0.
85.Pp
86In many cases of success and in a few cases of failure, a pointer to the
87.Vt valid_policy_tree
88output value mentioned in RFC 5280 section 6.1.6 is returned in
89.Pf * Fa ptree .
90It contains one level for each of the
91.Fa certs ,
92in reverse order: level 0 corresponds to the trust anchor,
93the last level corresponds to the target certificate.
94Level 0 is initialized to contain a single node with a
95.Fa valid_policy
96of
97.Sy anyPolicy
98and an empty
99.Fa qualifier_set .
100.Pp
101If a policy tree is returned, the reference count of each of the
102.Fa certs
103is incremented by 1.
104In that case, the caller is responsible for calling
105.Fn X509_policy_tree_free
106to release all memory used by the
107.Fa tree
108and to decrement the reference counts
109of the certificates referenced from it by 1.
110If
111.Fa tree
112is a
113.Dv NULL
114pointer,
115.Fn X509_policy_tree_free
116has no effect.
117.Sh RETURN VALUES
118.Fn X509_policy_check
119returns these values:
120.Bl -tag -width 2n
121.It \-2
122Validation failed because
123.Dv X509_V_FLAG_EXPLICIT_POLICY
124was requested but the resulting policy tree
125or the resulting user policy set would have been empty.
126In this case,
127.Pf * Fa pexplicit_policy
128is set to 1.
129If the resulting tree is empty,
130.Pf * Fa ptree
131is set to
132.Dv NULL ;
133otherwise, it is set to the resulting tree.
134.It \-1
135At least one of the
136.Fa certs
137contains invalid or inconsistent extensions.
138.Pf * Fa ptree
139is set to
140.Dv NULL
141and
142.Pf * Fa pexplicit_policy
143to 0.
144.It 0
145Internal error.
146For example, setting up the policy caches failed, or memory allocation
147failed while constructing the tree.
148.Pf * Fa ptree
149is set to
150.Dv NULL
151and
152.Pf * Fa pexplicit_policy
153may or may not be set.
154.It 1
155Validation succeeded and
156.Pf * Fa ptree
157and
158.Pf * Fa pexplicit_policy
159have been set.
160In the special cases that the
161.Fa certs
162argument contains exactly one certificate or that
163.Dv X509_V_FLAG_EXPLICIT_POLICY
164was not requested and at least one of the certificates contains no
165certificate policies or the resulting policy tree would have been empty,
166.Pf * Fa ptree
167is set to
168.Dv NULL
169and
170.Pf * Fa pexplicit_policy
171to 0.
172.El
173.Sh SEE ALSO
174.Xr ASN1_OBJECT_new 3 ,
175.Xr OBJ_nid2obj 3 ,
176.Xr STACK_OF 3 ,
177.Xr X509_check_purpose 3 ,
178.Xr X509_check_trust 3 ,
179.Xr X509_new 3 ,
180.Xr X509_policy_tree_get0_policies 3 ,
181.Xr X509_policy_tree_level_count 3 ,
182.Xr X509_verify_cert 3
183.Sh STANDARDS
184RFC 5280: Internet X.509 Public Key Infrastructure Certificate
185and Certificate Revocation List (CRL) Profile,
186section 6.1: Basic Path Validation
187.Sh HISTORY
188.Fn X509_policy_check
189and
190.Fn X509_policy_tree_free
191first appeared in OpenSSL 0.9.8 and have been available since
192.Ox 4.5 .