summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-09-29 08:57:49 +0000
committertb <>2023-09-29 08:57:49 +0000
commit748670f0a586443321b54a6e511fef277ae0d07f (patch)
tree829c3398edd47a208c282b5783404c084f76787c /src
parenta13dfa624381df2e77f5ca31d1187e39a82f9196 (diff)
downloadopenbsd-748670f0a586443321b54a6e511fef277ae0d07f.tar.gz
openbsd-748670f0a586443321b54a6e511fef277ae0d07f.tar.bz2
openbsd-748670f0a586443321b54a6e511fef277ae0d07f.zip
Document X509v3_{addr,asid}_validate_{path,resource_set}(3)
These were the last four RFC 3779 things that check_complete.pl x509v3 complained about. I will surely tweak and try to improve a few things in the coming days, but the pages should now be stable enough that review efforts will likely not be wasted. Any feedback appreciated.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/ASIdentifiers_new.35
-rw-r--r--src/lib/libcrypto/man/Makefile3
-rw-r--r--src/lib/libcrypto/man/X509_new.35
-rw-r--r--src/lib/libcrypto/man/X509v3_addr_add_inherit.35
-rw-r--r--src/lib/libcrypto/man/X509v3_addr_validate_path.3202
-rw-r--r--src/lib/libcrypto/man/X509v3_asid_add_id_or_range.37
6 files changed, 217 insertions, 10 deletions
diff --git a/src/lib/libcrypto/man/ASIdentifiers_new.3 b/src/lib/libcrypto/man/ASIdentifiers_new.3
index ae5795c9a3..c67a7c3f17 100644
--- a/src/lib/libcrypto/man/ASIdentifiers_new.3
+++ b/src/lib/libcrypto/man/ASIdentifiers_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASIdentifiers_new.3,v 1.8 2023/09/28 12:35:31 tb Exp $ 1.\" $OpenBSD: ASIdentifiers_new.3,v 1.9 2023/09/29 08:57:49 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2021 Theo Buehler <tb@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: September 28 2023 $ 17.Dd $Mdocdate: September 29 2023 $
18.Dt ASIDENTIFIERS_NEW 3 18.Dt ASIDENTIFIERS_NEW 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -116,6 +116,7 @@ or a value <= 0 if an error occurs.
116.Xr X509v3_addr_get_range 3 , 116.Xr X509v3_addr_get_range 3 ,
117.Xr X509v3_addr_inherits 3 , 117.Xr X509v3_addr_inherits 3 ,
118.Xr X509v3_addr_subset 3 , 118.Xr X509v3_addr_subset 3 ,
119.Xr X509v3_addr_validate_path 3 ,
119.Xr X509v3_asid_add_id_or_range 3 120.Xr X509v3_asid_add_id_or_range 3
120.Sh STANDARDS 121.Sh STANDARDS
121RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers: 122RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers:
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index e6a97f3004..f42e9327ae 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.275 2023/09/28 12:35:31 tb Exp $ 1# $OpenBSD: Makefile,v 1.276 2023/09/29 08:57:49 tb Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -396,6 +396,7 @@ MAN= \
396 X509v3_addr_get_range.3 \ 396 X509v3_addr_get_range.3 \
397 X509v3_addr_inherits.3 \ 397 X509v3_addr_inherits.3 \
398 X509v3_addr_subset.3 \ 398 X509v3_addr_subset.3 \
399 X509v3_addr_validate_path.3 \
399 X509v3_asid_add_id_or_range.3 \ 400 X509v3_asid_add_id_or_range.3 \
400 X509v3_asid_add_id_or_range.3 \ 401 X509v3_asid_add_id_or_range.3 \
401 X509v3_get_ext_by_NID.3 \ 402 X509v3_get_ext_by_NID.3 \
diff --git a/src/lib/libcrypto/man/X509_new.3 b/src/lib/libcrypto/man/X509_new.3
index a669bf0608..3e7fb0a79f 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.42 2023/09/28 12:35:31 tb Exp $ 1.\" $OpenBSD: X509_new.3,v 1.43 2023/09/29 08:57:49 tb 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: September 28 2023 $ 69.Dd $Mdocdate: September 29 2023 $
70.Dt X509_NEW 3 70.Dt X509_NEW 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -246,6 +246,7 @@ if an error occurs.
246.Xr X509v3_addr_get_range 3 , 246.Xr X509v3_addr_get_range 3 ,
247.Xr X509v3_addr_inherits 3 , 247.Xr X509v3_addr_inherits 3 ,
248.Xr X509v3_addr_subset 3 , 248.Xr X509v3_addr_subset 3 ,
249.Xr X509v3_addr_validate_path 3 ,
249.Xr X509v3_asid_add_id_or_range 3 250.Xr X509v3_asid_add_id_or_range 3
250.Sh STANDARDS 251.Sh STANDARDS
251RFC 5280: Internet X.509 Public Key Infrastructure Certificate and 252RFC 5280: Internet X.509 Public Key Infrastructure Certificate and
diff --git a/src/lib/libcrypto/man/X509v3_addr_add_inherit.3 b/src/lib/libcrypto/man/X509v3_addr_add_inherit.3
index 81e73f76e5..bdfb5c757d 100644
--- a/src/lib/libcrypto/man/X509v3_addr_add_inherit.3
+++ b/src/lib/libcrypto/man/X509v3_addr_add_inherit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509v3_addr_add_inherit.3,v 1.6 2023/09/28 12:35:31 tb Exp $ 1.\" $OpenBSD: X509v3_addr_add_inherit.3,v 1.7 2023/09/29 08:57:49 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2023 Theo Buehler <tb@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: September 28 2023 $ 17.Dd $Mdocdate: September 29 2023 $
18.Dt X509V3_ADDR_ADD_INHERIT 3 18.Dt X509V3_ADDR_ADD_INHERIT 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -400,6 +400,7 @@ is desired.
400.Xr IPAddressRange_new 3 , 400.Xr IPAddressRange_new 3 ,
401.Xr X509_new 3 , 401.Xr X509_new 3 ,
402.Xr X509v3_addr_get_range 3 , 402.Xr X509v3_addr_get_range 3 ,
403.Xr X509v3_addr_validate_path 3 ,
403.Xr X509v3_asid_add_id_or_range 3 404.Xr X509v3_asid_add_id_or_range 3
404.Sh STANDARDS 405.Sh STANDARDS
405RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers: 406RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers:
diff --git a/src/lib/libcrypto/man/X509v3_addr_validate_path.3 b/src/lib/libcrypto/man/X509v3_addr_validate_path.3
new file mode 100644
index 0000000000..1315e2013e
--- /dev/null
+++ b/src/lib/libcrypto/man/X509v3_addr_validate_path.3
@@ -0,0 +1,202 @@
1.\" $OpenBSD: X509v3_addr_validate_path.3,v 1.1 2023/09/29 08:57:49 tb Exp $
2.\"
3.\" Copyright (c) 2023 Theo Buehler <tb@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: September 29 2023 $
18.Dt X509V3_ADDR_VALIDATE_PATH 3
19.Os
20.Sh NAME
21.Nm X509v3_addr_validate_path ,
22.Nm X509v3_addr_validate_resource_set ,
23.Nm X509v3_asid_validate_path ,
24.Nm X509v3_asid_validate_resource_set
25.Nd RFC 3779 path validation for IP address and AS number delegation
26.Sh SYNOPSIS
27.In openssl/x509v3.h
28.Ft int
29.Fn X509v3_addr_validate_path "X509_STORE_CTX *ctx"
30.Ft int
31.Fo X509v3_addr_validate_resource_set
32.Fa "STACK_OF(X509) *chain"
33.Fa "IPAddrBlocks *addrblocks"
34.Fa "int allow_inheritance"
35.Fc
36.Ft int
37.Fn X509v3_asid_validate_path "X509_STORE_CTX *ctx"
38.Ft int
39.Fo X509v3_asid_validate_resource_set
40.Fa "STACK_OF(X509) *chain"
41.Fa "ASIdentifiers *asid"
42.Fa "int allow_inheritance"
43.Fc
44.Sh DESCRIPTION
45Both RFC 3779 extensions require additional checking in the certification
46path validation.
47.Bl -enum
48.It
49The initial set of allowed IP address and AS number resources is defined in
50the trust anchor; inheritance is not allowed in the trust anchor.
51.It
52All IP address delegation or AS number delegation extensions
53must be in canonical form according to
54.Xr X509v3_addr_is_canonical 3
55and
56.Xr X509v3_asid_is_canonical 3 .
57.It
58If the IP address delegation extension is present in a certificate,
59it must also be present in its issuer.
60Similarly for AS identifiers.
61.It
62An issuer may only delegate resources present in its
63RFC 3779 extensions.
64.El
65.Pp
66.Fn X509v3_addr_validate_path
67and
68.Fn X509v3_asid_validate_path
69are called from
70.Xr X509_verify_cert 3
71as part of the verification chain building.
72On encountering an error or a violation of the above rules,
73.Fa error ,
74.Fa error_depth ,
75and
76.Fa current_cert
77are set on
78.Fa ctx
79and the verify callback is called with
80.Fa ok
81set to 0.
82.Dv X509_V_ERR_INVALID_EXTENSION
83indicates a non-canonical resource,
84.Dv X509_V_ERR_UNNESTED_RESOURCE
85indicates a violation of the other rules above.
86In rare circumstances, the error can be
87.Dv X509_V_ERR_UNSPECIFIED
88and for IP address resources
89.Dv X509_V_ERR_OUT_OF_MEM
90is also possible.
91.Pp
92.Fn X509v3_addr_validate_resource_set
93validates the resources in
94.Fa addrblocks
95against a specific certificate
96.Fa chain .
97After checking that
98.Fa addrblocks
99is canonical, its IP addresses are checked to be covered in
100the certificate at depth 0,
101then the chain is walked all the way to the trust anchor
102until an error or a violation of the above rules is encountered.
103.Fa addrblocks
104is allowed to use inheritance according to
105.Xr X509v3_addr_inherits 3
106if and only if
107.Fa allow_inherit
108is non-zero.
109.Pp
110.Fn X509v3_asid_validate_resource_set
111performs similar checks as
112.Fn X509v3_addr_validate_resource_set
113for
114.Fa asid .
115.Sh RETURN VALUES
116All these functions return 1 on successful validation and 0 otherwise.
117.Pa
118For
119.Fn X509v3_addr_validate_path
120and
121.Fn X509v3_asid_validate_path
122a non-empty
123.Fa chain
124and a
125.Fa verify_cb
126must be present on
127.Fa ctx ,
128otherwise they fail and set the
129.Fa error
130on
131.Fa ctx
132to
133.Dv X509_V_ERR_UNSPECIFIED .
134The
135.Fa verify_cb
136is called with the error codes described above
137on most errors encountered during validation.
138Some malformed extensions can lead to an error
139that cannot be intercepted by the callback.
140With the exception of an allocation error,
141no error codes are set on the error stack.
142.Pp
143.Fn X509v3_addr_validate_resource_set
144and
145.Fn X509v3_asid_validate_resource_set
146accept a
147.Dv NULL
148.Fa addrblocks
149or
150.Fa asid
151as valid.
152They fail if
153.Fa chain
154is
155.Dv NULL
156or empty.
157If
158.Fa allow_inheritance
159is 0 ,
160.Fa addrblocks
161or
162.Fa asid
163is checked for inheritance with
164.Xr X509v3_addr_inherits 3
165or
166.Xr X509v3_asid_inherits 3 .
167The remaining failure cases are the same as for
168.Fn X509v3_addr_validate_path
169and
170.Fn X509v3_asid_validate_path .
171They cannot and do not attempt to communicate
172the cause of the error to the caller.
173.Sh SEE ALSO
174.Xr ASIdentifiers_new 3 ,
175.Xr crypto 3 ,
176.Xr IPAddressRange_new 3 ,
177.Xr X509_new 3 ,
178.Xr X509_STORE_CTX_get_error 3 ,
179.Xr X509_verify_cert 3 ,
180.Xr X509v3_addr_add_inherit 3 ,
181.Xr X509v3_addr_inherits 3 ,
182.Xr X509v3_asid_add_id_or_range 3
183.Sh STANDARDS
184RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers:
185.Bl -dash -compact
186.It
187section 2.3: IP Address Delegation Extension Certification Path Validation
188.It
189section 3.3: Autonomous System Identifier Delegation Extension Certification
190Path Validation
191.El
192.Pp
193RFC 5280: Internet X.509 Public Key Infrastructure Certificate
194and Certificate Revocation List (CRL) Profile
195.Bl -dash -compact
196.It
197section 6: Certification Path Validation
198.El
199.Sh HISTORY
200These functions first appeared in OpenSSL 0.9.8e
201and have been available since
202.Ox 7.1 .
diff --git a/src/lib/libcrypto/man/X509v3_asid_add_id_or_range.3 b/src/lib/libcrypto/man/X509v3_asid_add_id_or_range.3
index 1b42a449e1..f6b1c0347f 100644
--- a/src/lib/libcrypto/man/X509v3_asid_add_id_or_range.3
+++ b/src/lib/libcrypto/man/X509v3_asid_add_id_or_range.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: X509v3_asid_add_id_or_range.3,v 1.6 2023/09/28 12:35:31 tb Exp $ 1.\" $OpenBSD: X509v3_asid_add_id_or_range.3,v 1.7 2023/09/29 08:57:49 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2021-2023 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2021-2023 Theo Buehler <tb@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: September 28 2023 $ 17.Dd $Mdocdate: September 29 2023 $
18.Dt X509V3_ASID_ADD_ID_OR_RANGE 3 18.Dt X509V3_ASID_ADD_ID_OR_RANGE 3
19.Os 19.Os
20.Sh NAME 20.Sh NAME
@@ -242,7 +242,8 @@ failure.
242.Xr crypto 3 , 242.Xr crypto 3 ,
243.Xr s2i_ASN1_INTEGER 3 , 243.Xr s2i_ASN1_INTEGER 3 ,
244.Xr X509_new 3 , 244.Xr X509_new 3 ,
245.Xr X509v3_addr_add_inherit 3 245.Xr X509v3_addr_add_inherit 3 ,
246.Xr X509v3_addr_validate_path 3
246.Sh STANDARDS 247.Sh STANDARDS
247RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers, 248RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers,
248.Bl -dash -compact 249.Bl -dash -compact