xref: /openbsd-src/lib/libcrypto/man/X509v3_addr_validate_path.3 (revision 1bdb880e17f651151823511550e5a1eda2b19350)
1*1bdb880eStb.\" $OpenBSD: X509v3_addr_validate_path.3,v 1.5 2023/09/30 19:07:38 tb Exp $
21f84f19bStb.\"
31f84f19bStb.\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
41f84f19bStb.\"
51f84f19bStb.\" Permission to use, copy, modify, and distribute this software for any
61f84f19bStb.\" purpose with or without fee is hereby granted, provided that the above
71f84f19bStb.\" copyright notice and this permission notice appear in all copies.
81f84f19bStb.\"
91f84f19bStb.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
101f84f19bStb.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
111f84f19bStb.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
121f84f19bStb.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
131f84f19bStb.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
141f84f19bStb.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
151f84f19bStb.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
161f84f19bStb.\"
17b8a10234Sschwarze.Dd $Mdocdate: September 30 2023 $
181f84f19bStb.Dt X509V3_ADDR_VALIDATE_PATH 3
191f84f19bStb.Os
201f84f19bStb.Sh NAME
211f84f19bStb.Nm X509v3_addr_validate_path ,
221f84f19bStb.Nm X509v3_addr_validate_resource_set ,
231f84f19bStb.Nm X509v3_asid_validate_path ,
241f84f19bStb.Nm X509v3_asid_validate_resource_set
251f84f19bStb.Nd RFC 3779 path validation for IP address and AS number delegation
261f84f19bStb.Sh SYNOPSIS
271f84f19bStb.In openssl/x509v3.h
281f84f19bStb.Ft int
291f84f19bStb.Fn X509v3_addr_validate_path "X509_STORE_CTX *ctx"
301f84f19bStb.Ft int
311f84f19bStb.Fo X509v3_addr_validate_resource_set
321f84f19bStb.Fa "STACK_OF(X509) *chain"
331f84f19bStb.Fa "IPAddrBlocks *addrblocks"
34b8a10234Sschwarze.Fa "int allow_inherit"
351f84f19bStb.Fc
361f84f19bStb.Ft int
371f84f19bStb.Fn X509v3_asid_validate_path "X509_STORE_CTX *ctx"
381f84f19bStb.Ft int
391f84f19bStb.Fo X509v3_asid_validate_resource_set
401f84f19bStb.Fa "STACK_OF(X509) *chain"
411f84f19bStb.Fa "ASIdentifiers *asid"
42b8a10234Sschwarze.Fa "int allow_inherit"
431f84f19bStb.Fc
441f84f19bStb.Sh DESCRIPTION
451f84f19bStbBoth RFC 3779 extensions require additional checking in the certification
461f84f19bStbpath validation.
471f84f19bStb.Bl -enum
481f84f19bStb.It
491f84f19bStbThe initial set of allowed IP address and AS number resources is defined in
50d32ef593Stbthe trust anchor, where inheritance is not allowed.
511f84f19bStb.It
52*1bdb880eStbAn issuer may only delegate subsets of resources present in its
53*1bdb880eStbRFC 3779 extensions or subsets of resources inherited from its issuer.
54*1bdb880eStb.It
55*1bdb880eStbIf an RFC 3779 extension is present in a certificate,
56*1bdb880eStbthe same type of extension must also be present in its issuer.
57*1bdb880eStb.It
58*1bdb880eStbAll RFC 3779 extensions
59d32ef593Stbappearing in the validation path must be in canonical form
60d32ef593Stbaccording to
611f84f19bStb.Xr X509v3_addr_is_canonical 3
621f84f19bStband
631f84f19bStb.Xr X509v3_asid_is_canonical 3 .
641f84f19bStb.El
651f84f19bStb.Pp
661f84f19bStb.Fn X509v3_addr_validate_path
671f84f19bStband
681f84f19bStb.Fn X509v3_asid_validate_path
691f84f19bStbare called from
701f84f19bStb.Xr X509_verify_cert 3
711f84f19bStbas part of the verification chain building.
721f84f19bStbOn encountering an error or a violation of the above rules,
731f84f19bStb.Fa error ,
741f84f19bStb.Fa error_depth ,
751f84f19bStband
761f84f19bStb.Fa current_cert
771f84f19bStbare set on
781f84f19bStb.Fa ctx
791f84f19bStband the verify callback is called with
801f84f19bStb.Fa ok
811f84f19bStbset to 0.
821f84f19bStb.Dv X509_V_ERR_INVALID_EXTENSION
831f84f19bStbindicates a non-canonical resource,
841f84f19bStb.Dv X509_V_ERR_UNNESTED_RESOURCE
851f84f19bStbindicates a violation of the other rules above.
861f84f19bStbIn rare circumstances, the error can be
871f84f19bStb.Dv X509_V_ERR_UNSPECIFIED
881f84f19bStband for IP address resources
891f84f19bStb.Dv X509_V_ERR_OUT_OF_MEM
901f84f19bStbis also possible.
911f84f19bStb.Pp
921f84f19bStb.Fn X509v3_addr_validate_resource_set
931f84f19bStbvalidates the resources in
941f84f19bStb.Fa addrblocks
951f84f19bStbagainst a specific certificate
961f84f19bStb.Fa chain .
971f84f19bStbAfter checking that
981f84f19bStb.Fa addrblocks
991f84f19bStbis canonical, its IP addresses are checked to be covered in
1001f84f19bStbthe certificate at depth 0,
1011f84f19bStbthen the chain is walked all the way to the trust anchor
1021f84f19bStbuntil an error or a violation of the above rules is encountered.
1031f84f19bStb.Fa addrblocks
1041f84f19bStbis allowed to use inheritance according to
1051f84f19bStb.Xr X509v3_addr_inherits 3
1061f84f19bStbif and only if
1071f84f19bStb.Fa allow_inherit
1081f84f19bStbis non-zero.
1091f84f19bStb.Pp
1101f84f19bStb.Fn X509v3_asid_validate_resource_set
1111f84f19bStbperforms similar checks as
1121f84f19bStb.Fn X509v3_addr_validate_resource_set
1131f84f19bStbfor
1141f84f19bStb.Fa asid .
1151f84f19bStb.Sh RETURN VALUES
1161f84f19bStbAll these functions return 1 on successful validation and 0 otherwise.
117eabb0bcfStb.Pp
1181f84f19bStbFor
1191f84f19bStb.Fn X509v3_addr_validate_path
1201f84f19bStband
1211f84f19bStb.Fn X509v3_asid_validate_path
1221f84f19bStba non-empty
1231f84f19bStb.Fa chain
1241f84f19bStband a
1251f84f19bStb.Fa verify_cb
1261f84f19bStbmust be present on
1271f84f19bStb.Fa ctx ,
1281f84f19bStbotherwise they fail and set the
1291f84f19bStb.Fa error
1301f84f19bStbon
1311f84f19bStb.Fa ctx
1321f84f19bStbto
1331f84f19bStb.Dv X509_V_ERR_UNSPECIFIED .
1341f84f19bStbThe
1351f84f19bStb.Fa verify_cb
1361f84f19bStbis called with the error codes described above
1371f84f19bStbon most errors encountered during validation.
1381f84f19bStbSome malformed extensions can lead to an error
1391f84f19bStbthat cannot be intercepted by the callback.
1401f84f19bStbWith the exception of an allocation error,
1411f84f19bStbno error codes are set on the error stack.
1421f84f19bStb.Pp
1431f84f19bStb.Fn X509v3_addr_validate_resource_set
144eabb0bcfStbaccepts a
1451f84f19bStb.Dv NULL
1461f84f19bStb.Fa addrblocks
147eabb0bcfStband
148eabb0bcfStb.Fn X509v3_asid_validate_resource_set
149eabb0bcfStbaccepts a
150eabb0bcfStb.Dv NULL
1511f84f19bStb.Fa asid
1521f84f19bStbas valid.
1531f84f19bStbThey fail if
1541f84f19bStb.Fa chain
1551f84f19bStbis
1561f84f19bStb.Dv NULL
1571f84f19bStbor empty.
1581f84f19bStbIf
159b8a10234Sschwarze.Fa allow_inherit
1601f84f19bStbis 0,
1611f84f19bStb.Fa addrblocks
1621f84f19bStbor
1631f84f19bStb.Fa asid
1641f84f19bStbis checked for inheritance with
1651f84f19bStb.Xr X509v3_addr_inherits 3
1661f84f19bStbor
1671f84f19bStb.Xr X509v3_asid_inherits 3 .
1681f84f19bStbThe remaining failure cases are the same as for
1691f84f19bStb.Fn X509v3_addr_validate_path
1701f84f19bStband
1711f84f19bStb.Fn X509v3_asid_validate_path .
1721f84f19bStbThey cannot and do not attempt to communicate
1731f84f19bStbthe cause of the error to the caller.
1741f84f19bStb.Sh SEE ALSO
1751f84f19bStb.Xr ASIdentifiers_new 3 ,
1761f84f19bStb.Xr crypto 3 ,
1771f84f19bStb.Xr IPAddressRange_new 3 ,
1781f84f19bStb.Xr X509_new 3 ,
1791f84f19bStb.Xr X509_STORE_CTX_get_error 3 ,
1801f84f19bStb.Xr X509_verify_cert 3 ,
1811f84f19bStb.Xr X509v3_addr_add_inherit 3 ,
1821f84f19bStb.Xr X509v3_addr_inherits 3 ,
1831f84f19bStb.Xr X509v3_asid_add_id_or_range 3
1841f84f19bStb.Sh STANDARDS
1851f84f19bStbRFC 3779: X.509 Extensions for IP Addresses and AS Identifiers:
1861f84f19bStb.Bl -dash -compact
1871f84f19bStb.It
1881f84f19bStbsection 2.3: IP Address Delegation Extension Certification Path Validation
1891f84f19bStb.It
1901f84f19bStbsection 3.3: Autonomous System Identifier Delegation Extension Certification
1911f84f19bStbPath Validation
1921f84f19bStb.El
1931f84f19bStb.Pp
1941f84f19bStbRFC 5280: Internet X.509 Public Key Infrastructure Certificate
1951f84f19bStband Certificate Revocation List (CRL) Profile
1961f84f19bStb.Bl -dash -compact
1971f84f19bStb.It
1981f84f19bStbsection 6: Certification Path Validation
1991f84f19bStb.El
2001f84f19bStb.Sh HISTORY
2011f84f19bStbThese functions first appeared in OpenSSL 0.9.8e
2021f84f19bStband have been available since
2031f84f19bStb.Ox 7.1 .
204