X509V3_ADDR_GET_RANGE(3)
hey bestie π you found the X509V3_ADDR_GET_RANGE(3) page β yes, the manual name is right there in the title, and this is a Library Functions Manual moment. We're decoding the parse helpers for the IP address delegation extension, and they're lowkey iconic π
πΈ NAME πΈ
X509v3_addr_get_afi, X509v3_addr_get_range β parse helpers for the IP address delegation extension. These two are the duo we're obsessing over β¨
β¨ SYNOPSIS β¨
#include <openssl/x509v3.h>
unsigned
X509v3_addr_get_afi(const IPAddressFamily *af);
int
X509v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi,
unsigned char *min, unsigned char *max, const int length);
π DESCRIPTION π
okay so X509v3_addr_get_afi() is giving "tell me the address family identifier (AFI) of af" energy. That's it. It returns the AFI of af. π«
X509v3_addr_get_range() is the main character here: it converts the minimum and maximum addresses in the address prefix or range aor from internal encoding to IP addresses in network byte order, then places copies in the arrays min and max, of size length. The length must be large enough to accommodate an address for afi β that's at least 4 for IANA_AFI_IPV4 and at least 16 for IANA_AFI_IPV6. No cap. π«Ά
π RETURN VALUES π
X509v3_addr_get_afi() returns the AFI encoded in af, or 0 if af does not contain a valid AFI, or if the AFI is not IPv4 or IPv6. π¦
X509v3_addr_get_range() returns the number of bytes copied into min and max, or 0 on error. An error occurs if aor is malformed, if afi is not IANA_AFI_IPV4 or IANA_AFI_IPV6, if either min or max is NULL, or if length is smaller than 4 or 16, respectively. Periodt. π
π¦ SEE ALSO π¦
π STANDARDS π
RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers:
- section 2: IP Address delegation extension
- section 2.2.3.3: Element
addressFamily - section 2.2.3.7: Type
IPAddressOrRange - section 2.2.3.8: Element
addressPrefixand TypeIPAddress
Also: Address Family Numbers, https://www.iana.org/assignments/address-family-numbers. π
π HISTORY π
These functions first appeared in OpenSSL 0.9.8e and have been available since OpenBSD 7.1. history slay β¨
π BUGS π
okay bestie, the caveats are real:
- There is no accessor for the SAFI of
af. - An error from
X509v3_addr_get_afi()is indistinguishable from the reserved AFI0being set onaf. - It is not entirely clear how a caller is supposed to obtain an
IPAddressFamilyobject or anIPAddressOrRangeobject without reaching into various structs documented inIPAddressRange_new(3).
byeeee π«Ά this lovely little page is from Debian, dated September 30, 2023 β mwah π
π¦ where this page comes from
- opensuse-leap 16.0: libressl-devel-doc 4.1.0-bp160.1.1 Β· OpenSSL
- Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms