diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/man/ASIdentifiers_new.3 | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/ASRange_new.3 | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/IPAddressRange_new.3 | 514 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/X509_new.3 | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/X509v3_addr_add_inherit.3 | 8 |
6 files changed, 534 insertions, 13 deletions
diff --git a/src/lib/libcrypto/man/ASIdentifiers_new.3 b/src/lib/libcrypto/man/ASIdentifiers_new.3 index f95b258cae..a67c54434c 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.4 2023/09/26 08:56:18 tb Exp $ | 1 | .\" $OpenBSD: ASIdentifiers_new.3,v 1.5 2023/09/26 15:34:23 tb Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2021 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -110,9 +110,9 @@ or a value <= 0 if an error occurs. | |||
| 110 | .Sh SEE ALSO | 110 | .Sh SEE ALSO |
| 111 | .Xr ASRange_new 3 , | 111 | .Xr ASRange_new 3 , |
| 112 | .Xr crypto 3 , | 112 | .Xr crypto 3 , |
| 113 | .Xr IPAddressRange_new 3 , | ||
| 113 | .Xr X509_new 3 , | 114 | .Xr X509_new 3 , |
| 114 | .Xr X509v3_asid_add_id_or_range 3 , | 115 | .Xr X509v3_asid_add_id_or_range 3 |
| 115 | .Xr X509v3_asid_is_canonical 3 | ||
| 116 | .Sh STANDARDS | 116 | .Sh STANDARDS |
| 117 | RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers: | 117 | RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers: |
| 118 | .Bl -dash -compact | 118 | .Bl -dash -compact |
diff --git a/src/lib/libcrypto/man/ASRange_new.3 b/src/lib/libcrypto/man/ASRange_new.3 index e7aafbcc3f..75b911c588 100644 --- a/src/lib/libcrypto/man/ASRange_new.3 +++ b/src/lib/libcrypto/man/ASRange_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASRange_new.3,v 1.3 2023/09/26 13:02:47 tb Exp $ | 1 | .\" $OpenBSD: ASRange_new.3,v 1.4 2023/09/26 15:34:23 tb Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> | 3 | .\" Copyright (c) 2023 Theo Buehler <tb@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -83,9 +83,10 @@ | |||
| 83 | .Vt ASIdOrRange , | 83 | .Vt ASIdOrRange , |
| 84 | and | 84 | and |
| 85 | .Vt ASIdentifierChoice | 85 | .Vt ASIdentifierChoice |
| 86 | are building blocks of the RFC 3779 | 86 | are building blocks of the |
| 87 | .Vt ASIdentifiers | 87 | .Vt ASIdentifiers |
| 88 | type representing the autonomous system identifier delegation extension. | 88 | type representing the RFC 3779 |
| 89 | autonomous system identifier delegation extension. | ||
| 89 | See | 90 | See |
| 90 | .Xr ASIdentifiers_new 3 | 91 | .Xr ASIdentifiers_new 3 |
| 91 | and | 92 | and |
| @@ -355,10 +356,10 @@ or a value <= 0 if an error occurs. | |||
| 355 | .Xr BN_set_word 3 , | 356 | .Xr BN_set_word 3 , |
| 356 | .Xr BN_to_ASN1_INTEGER 3 , | 357 | .Xr BN_to_ASN1_INTEGER 3 , |
| 357 | .Xr crypto 3 , | 358 | .Xr crypto 3 , |
| 359 | .Xr IPAddressRange_new 3 , | ||
| 358 | .Xr s2i_ASN1_INTEGER 3 , | 360 | .Xr s2i_ASN1_INTEGER 3 , |
| 359 | .Xr X509_new 3 , | 361 | .Xr X509_new 3 , |
| 360 | .Xr X509v3_asid_add_id_or_range 3 , | 362 | .Xr X509v3_asid_add_id_or_range 3 |
| 361 | .Xr X509v3_asid_is_canonical 3 | ||
| 362 | .Sh STANDARDS | 363 | .Sh STANDARDS |
| 363 | RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers: | 364 | RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers: |
| 364 | .Bl -dash -compact | 365 | .Bl -dash -compact |
diff --git a/src/lib/libcrypto/man/IPAddressRange_new.3 b/src/lib/libcrypto/man/IPAddressRange_new.3 new file mode 100644 index 0000000000..7a71ac7ffa --- /dev/null +++ b/src/lib/libcrypto/man/IPAddressRange_new.3 | |||
| @@ -0,0 +1,514 @@ | |||
| 1 | .\" $OpenBSD: IPAddressRange_new.3,v 1.1 2023/09/26 15:34:23 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 26 2023 $ | ||
| 18 | .Dt IPADDRESSRANGE_NEW 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm IPAddressRange_new , | ||
| 22 | .Nm IPAddressRange_free , | ||
| 23 | .Nm d2i_IPAddressRange , | ||
| 24 | .Nm i2d_IPAddressRange , | ||
| 25 | .Nm IPAddressOrRange_new , | ||
| 26 | .Nm IPAddressOrRange_free , | ||
| 27 | .Nm d2i_IPAddressOrRange , | ||
| 28 | .Nm i2d_IPAddressOrRange , | ||
| 29 | .Nm IPAddressChoice_new , | ||
| 30 | .Nm IPAddressChoice_free , | ||
| 31 | .Nm d2i_IPAddressChoice , | ||
| 32 | .Nm i2d_IPAddressChoice , | ||
| 33 | .Nm IPAddressFamily_new , | ||
| 34 | .Nm IPAddressFamily_free , | ||
| 35 | .Nm d2i_IPAddressFamily , | ||
| 36 | .Nm i2d_IPAddressFamily | ||
| 37 | .Nd IP address prefixes and ranges | ||
| 38 | .Sh SYNOPSIS | ||
| 39 | .In openssl/x509v3.h | ||
| 40 | .Ft "IPAddressRange *" | ||
| 41 | .Fn IPAddressRange_new void | ||
| 42 | .Ft void | ||
| 43 | .Fn IPAddressRange_free "IPAddressRange *range" | ||
| 44 | .Ft IPAddressRange * | ||
| 45 | .Fo d2i_IPAddressRange | ||
| 46 | .Fa "IPAddressRange **range" | ||
| 47 | .Fa "const unsigned char **der_in" | ||
| 48 | .Fa "long length" | ||
| 49 | .Fc | ||
| 50 | .Ft int | ||
| 51 | .Fo i2d_IPAddressRange | ||
| 52 | .Fa "IPAddressRange *range" | ||
| 53 | .Fa "unsigned char **der_out" | ||
| 54 | .Fc | ||
| 55 | .Ft "IPAddressOrRange *" | ||
| 56 | .Fn IPAddressOrRange_new void | ||
| 57 | .Ft void | ||
| 58 | .Fn IPAddressOrRange_free "IPAddressOrRange *aor" | ||
| 59 | .Ft IPAddressOrRange * | ||
| 60 | .Fo d2i_IPAddressOrRange | ||
| 61 | .Fa "IPAddressOrRange **aor" | ||
| 62 | .Fa "const unsigned char **der_in" | ||
| 63 | .Fa "long length" | ||
| 64 | .Fc | ||
| 65 | .Ft int | ||
| 66 | .Fo i2d_IPAddressOrRange | ||
| 67 | .Fa "IPAddressOrRange *aor" | ||
| 68 | .Fa "unsigned char **der_out" | ||
| 69 | .Fc | ||
| 70 | .Ft "IPAddressChoice *" | ||
| 71 | .Fn IPAddressChoice_new void | ||
| 72 | .Ft void | ||
| 73 | .Fn IPAddressChoice_free "IPAddressChoice *ac" | ||
| 74 | .Ft IPAddressChoice * | ||
| 75 | .Fo d2i_IPAddressChoice | ||
| 76 | .Fa "IPAddressChoice **ac" | ||
| 77 | .Fa "const unsigned char **der_in" | ||
| 78 | .Fa "long length" | ||
| 79 | .Fc | ||
| 80 | .Ft int | ||
| 81 | .Fo i2d_IPAddressChoice | ||
| 82 | .Fa "IPAddressChoice *ac" | ||
| 83 | .Fa "unsigned char **der_out" | ||
| 84 | .Fc | ||
| 85 | .Ft "IPAddressFamily *" | ||
| 86 | .Fn IPAddressFamily_new void | ||
| 87 | .Ft void | ||
| 88 | .Fn IPAddressFamily_free "IPAddressFamily *af" | ||
| 89 | .Ft IPAddressFamily * | ||
| 90 | .Fo d2i_IPAddressFamily | ||
| 91 | .Fa "IPAddressFamily **af" | ||
| 92 | .Fa "const unsigned char **der_in" | ||
| 93 | .Fa "long length" | ||
| 94 | .Fc | ||
| 95 | .Ft int | ||
| 96 | .Fo i2d_IPAddressFamily | ||
| 97 | .Fa "IPAddressFamily *af" | ||
| 98 | .Fa "unsigned char **der_out" | ||
| 99 | .Fc | ||
| 100 | .Sh DESCRIPTION | ||
| 101 | .Vt IPAddressRange , | ||
| 102 | .Vt IPAddressOrRange , | ||
| 103 | .Vt IPAddressChoice , | ||
| 104 | and | ||
| 105 | .Vt IPAddressFamily | ||
| 106 | are building blocks of the RFC 3779 | ||
| 107 | .Vt IPAddrBlocks | ||
| 108 | type representing the IP address delegation extension. | ||
| 109 | See | ||
| 110 | .Xr X509v3_addr_add_inherit 3 | ||
| 111 | for more details. | ||
| 112 | .Pp | ||
| 113 | Per RFC 3779, section 2.1.1, | ||
| 114 | an IPv4 or an IPv6 address is encoded in network byte order in an | ||
| 115 | ASN.1 BIT STRING of bit size 32 or 128 bits, respectively. | ||
| 116 | The bit size of a prefix is its prefix length, | ||
| 117 | in other words, all insignificant zero bits are omitted. | ||
| 118 | An address range is expressed as a pair of BIT STRINGs | ||
| 119 | where all least significant zero bits of the lower bound | ||
| 120 | and the all least significant one bits of the upper bound are omitted. | ||
| 121 | Whether a prefix or a range represents a range of IPv4 address or | ||
| 122 | an IPv6 address must be derived from the context. | ||
| 123 | .Pp | ||
| 124 | The library provides no API for directly converting an IP address or | ||
| 125 | prefix (in any form) to and from an | ||
| 126 | .Vt ASN1_BIT_STRING | ||
| 127 | and it also provides no API for directly handling ranges. | ||
| 128 | The | ||
| 129 | .Vt ASN1_BIT_STRING | ||
| 130 | internals are subtle and directly manipulating them in the | ||
| 131 | context of the RFC 3779 API is discouraged. | ||
| 132 | The bit size of an | ||
| 133 | .Vt ASN1_BIT_STRING | ||
| 134 | representing an IP address prefix or range is eight times its length | ||
| 135 | member minus the lowest three bits of its flags, provided the | ||
| 136 | .Dv ASN1_STRING_FLAG_BITS_LEFT | ||
| 137 | flag is set. | ||
| 138 | .Pp | ||
| 139 | The | ||
| 140 | .Vt IPAddressRange | ||
| 141 | type defined in RFC 3779 section 2.2.3.9 is implemented as | ||
| 142 | .Bd -literal -offset indent | ||
| 143 | typedef struct IPAddressRange_st { | ||
| 144 | ASN1_BIT_STRING *min; | ||
| 145 | ASN1_BIT_STRING *max; | ||
| 146 | } IPAddressRange; | ||
| 147 | .Ed | ||
| 148 | .Pp | ||
| 149 | It represents the closed range [min,max] of IP addresses between | ||
| 150 | .Fa min | ||
| 151 | and | ||
| 152 | .Fa max , | ||
| 153 | where | ||
| 154 | .Fa min | ||
| 155 | should be strictly smaller than | ||
| 156 | .Fa max | ||
| 157 | and the range should not be expressible as a prefix. | ||
| 158 | .Pp | ||
| 159 | .Fn IPAddressRange_new | ||
| 160 | allocates a new | ||
| 161 | .Vt IPAddressRange | ||
| 162 | object with allocated, empty | ||
| 163 | .Fa min | ||
| 164 | and | ||
| 165 | .Fa max , | ||
| 166 | thus representing the entire address space. | ||
| 167 | .Pp | ||
| 168 | .Fn IPAddressRange_free | ||
| 169 | frees | ||
| 170 | .Fa range | ||
| 171 | including any data contained in it. | ||
| 172 | If | ||
| 173 | .Fa range | ||
| 174 | is | ||
| 175 | .Dv NULL , | ||
| 176 | no action occurs. | ||
| 177 | .Pp | ||
| 178 | There is no dedicated type to represent the | ||
| 179 | .Vt IPAddress | ||
| 180 | type defined in RFC 3779 section 2.2.3.8. | ||
| 181 | The API uses | ||
| 182 | .Vt ASN1_BIT_STRING | ||
| 183 | for this. | ||
| 184 | .Pp | ||
| 185 | The | ||
| 186 | .Vt IpAddressOrRange | ||
| 187 | type defined in RFC 3779 section 2.2.3.7 is implemented as | ||
| 188 | .Bd -literal -offset indent | ||
| 189 | typedef struct IPAddressOrRange_st { | ||
| 190 | int type; | ||
| 191 | union { | ||
| 192 | ASN1_BIT_STRING *addressPrefix; | ||
| 193 | IPAddressRange *addressRange; | ||
| 194 | } u; | ||
| 195 | } IPAddressOrRange; | ||
| 196 | .Ed | ||
| 197 | .Pp | ||
| 198 | representing an individual address prefix or an address range. | ||
| 199 | The | ||
| 200 | .Fa type | ||
| 201 | member should be set to | ||
| 202 | .Dv IPAddressOrRange_addressPrefix | ||
| 203 | or | ||
| 204 | .Dv IPAddressOrRange_addressRange | ||
| 205 | to indicate which member of the union | ||
| 206 | .Fa u | ||
| 207 | is valid. | ||
| 208 | .Pp | ||
| 209 | .Fn IPAddressOrRange_new | ||
| 210 | returns a new | ||
| 211 | .Vt IPAddressOrRange | ||
| 212 | object with invalid type and | ||
| 213 | .Dv NULL | ||
| 214 | members of the union | ||
| 215 | .Fa u . | ||
| 216 | .Pp | ||
| 217 | .Fn IPAddressOrRange_free | ||
| 218 | frees | ||
| 219 | .Fa aor | ||
| 220 | including any data contained in it, | ||
| 221 | provided | ||
| 222 | .Fa type | ||
| 223 | is set correctly. | ||
| 224 | If | ||
| 225 | .Fa aor | ||
| 226 | is | ||
| 227 | .Dv NULL , | ||
| 228 | no action occurs. | ||
| 229 | .Pp | ||
| 230 | In order to express a list of address prefixes and address ranges, | ||
| 231 | RFC 3779 section 2.2.3.6 | ||
| 232 | uses an ASN.1 SEQUENCE, | ||
| 233 | which is implemented via a | ||
| 234 | .Xr STACK_OF 3 | ||
| 235 | construction over | ||
| 236 | .Vt IPAddressOrRange : | ||
| 237 | .Bd -literal -offset indent | ||
| 238 | typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges; | ||
| 239 | .Ed | ||
| 240 | .Pp | ||
| 241 | Since an | ||
| 242 | .Vt IPAddressOrRanges | ||
| 243 | object should be sorted in a specific way (see | ||
| 244 | .Xr X509v3_addr_canonize 3 Ns ), | ||
| 245 | a comparison function is needed for a correct instantiation | ||
| 246 | with | ||
| 247 | .Xr sk_new 3 . | ||
| 248 | The | ||
| 249 | .Fn v4IPAddressOrRange_cmp | ||
| 250 | and | ||
| 251 | .Fn v6IPAddressOrRange_cmp | ||
| 252 | functions are not directly exposed and not easily accessible | ||
| 253 | from outside the library, | ||
| 254 | and they are non-trivial to implement. | ||
| 255 | It is therefore discouraged to use | ||
| 256 | .Vt IPAddressOrRanges | ||
| 257 | objects that are not part of an | ||
| 258 | .Vt IPAddrBlocks | ||
| 259 | object. | ||
| 260 | .Pp | ||
| 261 | The | ||
| 262 | .Dq inherit | ||
| 263 | marker from RFC 3779 section 2.2.3.5 is implemented as | ||
| 264 | .Vt ASN1_NULL . | ||
| 265 | It has no dedicated type or API and can be instantiated with | ||
| 266 | .Xr ASN1_NULL_new 3 . | ||
| 267 | .Pp | ||
| 268 | The | ||
| 269 | .Vt IPAddressChoice | ||
| 270 | type defined in RFC 3779 section 2.2.3.4 is implemented as | ||
| 271 | .Bd -literal -offset indent | ||
| 272 | typedef struct IPAddressChoice_st { | ||
| 273 | int type; | ||
| 274 | union { | ||
| 275 | ASN1_NULL *inherit; | ||
| 276 | IPAddressOrRanges *addressesOrRanges; | ||
| 277 | } u; | ||
| 278 | } IPAddressChoice; | ||
| 279 | .Ed | ||
| 280 | .Pp | ||
| 281 | where the | ||
| 282 | .Fa type | ||
| 283 | member should be set to | ||
| 284 | .Dv IPAddressChoice_inherit | ||
| 285 | or | ||
| 286 | .Dv IPAddressChoice_addressesOrRanges | ||
| 287 | to indicate whether a given | ||
| 288 | .Vt IPAddressChoice | ||
| 289 | object represents an inherited list or an explicit list. | ||
| 290 | .Pp | ||
| 291 | .Fn IPAddressChoice_new | ||
| 292 | returns a new | ||
| 293 | .Vt IPAddressChoice | ||
| 294 | object with invalid type and | ||
| 295 | .Dv NULL | ||
| 296 | members of the union | ||
| 297 | .Fa u . | ||
| 298 | .Pp | ||
| 299 | .Fn IPAddressChoice_free | ||
| 300 | frees | ||
| 301 | .Fa ac | ||
| 302 | including any data contained in it, | ||
| 303 | provided | ||
| 304 | .Fa type | ||
| 305 | is set correctly. | ||
| 306 | .Pp | ||
| 307 | The | ||
| 308 | .Fa addressFamily | ||
| 309 | element defined in RFC 3779 section 2.2.3.3 is implemented as an | ||
| 310 | .Vt ASN1_OCTET_STRING | ||
| 311 | and it contains two or three octets. | ||
| 312 | The first two octets are always present and represent the | ||
| 313 | address family identifier (AFI) | ||
| 314 | in network byte order. | ||
| 315 | The optional subsequent address family identifier (SAFI) | ||
| 316 | occupies the third octet. | ||
| 317 | For IPv4 and IPv6, | ||
| 318 | .Dv IANA_AFI_IPV4 | ||
| 319 | and | ||
| 320 | .Dv IANA_AFI_IPV6 | ||
| 321 | are predefined. | ||
| 322 | Other AFIs are not supported by this implementation. | ||
| 323 | .Pp | ||
| 324 | The | ||
| 325 | .Vt IPAddressFamily | ||
| 326 | type defined in RFC 3779 section 2.2.3.2 is implemented as | ||
| 327 | .Bd -literal -offset indent | ||
| 328 | typedef struct IPAddressFamily_st { | ||
| 329 | ASN1_OCTET_STRING *addressFamily; | ||
| 330 | IPAddressChoice *ipAddressChoice; | ||
| 331 | } IPAddressFamily; | ||
| 332 | .Ed | ||
| 333 | .Pp | ||
| 334 | The | ||
| 335 | .Fa addressFamily | ||
| 336 | member indicates the address family the | ||
| 337 | .Fa ipAddressChoice | ||
| 338 | represents. | ||
| 339 | .Pp | ||
| 340 | .Fn IPAddressFamily_new | ||
| 341 | returns a new | ||
| 342 | .Vt IPAddressFamily | ||
| 343 | object with empty | ||
| 344 | .Fa addressFamily | ||
| 345 | and invalid | ||
| 346 | .Fa ipAddressChoice | ||
| 347 | members. | ||
| 348 | .Pp | ||
| 349 | .Fn IPAddressFamily_free | ||
| 350 | frees | ||
| 351 | .Fa af | ||
| 352 | including any data contained in it. | ||
| 353 | If | ||
| 354 | .Fa af | ||
| 355 | is | ||
| 356 | .Dv NULL , | ||
| 357 | no action occurs. | ||
| 358 | .Pp | ||
| 359 | The | ||
| 360 | .Vt IPAddrBlocks | ||
| 361 | type defined in RFC 3779 section 2.2.3.1 | ||
| 362 | uses an ASN.1 SEQUENCE, | ||
| 363 | which is implemented via a | ||
| 364 | .Xr STACK_OF 3 | ||
| 365 | construction over | ||
| 366 | .Vt IPAddressFamily : | ||
| 367 | .Bd -literal -offset indent | ||
| 368 | typedef STACK_OF(IPAddressFamily) IPAddrBlocks; | ||
| 369 | .Ed | ||
| 370 | .Pp | ||
| 371 | It can be instantiated with | ||
| 372 | .Fn sk_IPAddressFamily_new_null | ||
| 373 | and the correct sorting function can be installed with | ||
| 374 | .Xr X509v3_addr_canonize 3 . | ||
| 375 | To populate it, use | ||
| 376 | .Xr X509v3_addr_add_prefix 3 | ||
| 377 | and related functions. | ||
| 378 | .Pp | ||
| 379 | .Fn d2i_IPAddressRange , | ||
| 380 | .Fn i2d_IPAddressRange , | ||
| 381 | .Fn d2i_IPAddressOrRange , | ||
| 382 | .Fn i2d_IPAddressOrRange , | ||
| 383 | .Fn d2i_IPAddressChoice , | ||
| 384 | .Fn i2d_IPAddressChoice , | ||
| 385 | .Fn d2i_IPAddressFamily , | ||
| 386 | and | ||
| 387 | .Fn i2d_IPAddressFamily , | ||
| 388 | decode and encode ASN.1 | ||
| 389 | .Vt IPAddressRange , | ||
| 390 | .Vt IPAddressOrRange , | ||
| 391 | .Vt IPAddressChoice , | ||
| 392 | and | ||
| 393 | .Vt IPAddressFamily | ||
| 394 | objects. | ||
| 395 | For details about the semantics, examples, caveats, and bugs, see | ||
| 396 | .Xr ASN1_item_d2i 3 . | ||
| 397 | There is no easy way of ensuring that the encodings generated by | ||
| 398 | these functions are correct, unless they are applied to objects | ||
| 399 | that are part of a canonical | ||
| 400 | .Vt IPAddrBlocks | ||
| 401 | structure, see | ||
| 402 | .Xr X509v3_addr_is_canonical 3 . | ||
| 403 | .Sh RETURN VALUES | ||
| 404 | .Fn IPAddressRange_new | ||
| 405 | returns a new | ||
| 406 | .Vt IPAddressRange | ||
| 407 | object or | ||
| 408 | .Dv NULL | ||
| 409 | if an error occurs. | ||
| 410 | .Pp | ||
| 411 | .Fn IPAddressRange_new | ||
| 412 | returns a new, empty | ||
| 413 | .Vt IPAddressOrRange | ||
| 414 | object or | ||
| 415 | .Dv NULL | ||
| 416 | if an error occurs. | ||
| 417 | .Pp | ||
| 418 | .Fn IPAddressChoice_new | ||
| 419 | returns a new, empty | ||
| 420 | .Vt IPAddressChoice | ||
| 421 | object or | ||
| 422 | .Dv NULL | ||
| 423 | if an error occurs. | ||
| 424 | .Pp | ||
| 425 | .Fn IPAddressFamily_new | ||
| 426 | returns a new, | ||
| 427 | .Vt IPAddressChoice | ||
| 428 | object with allocated, empty members, or | ||
| 429 | .Dv NULL | ||
| 430 | if an error occurs. | ||
| 431 | .Pp | ||
| 432 | The encoding functions | ||
| 433 | .Fn d2i_IPAddressRange , | ||
| 434 | .Fn d2i_IPAddressOrRange , | ||
| 435 | .Fn d2i_IPAddressChoice , | ||
| 436 | and | ||
| 437 | .Fn d2i_IPAddressFamily , | ||
| 438 | return an | ||
| 439 | .Vt IPAddressRange , | ||
| 440 | an | ||
| 441 | .Vt IPAddressOrRange , | ||
| 442 | an | ||
| 443 | .Vt IPAddressChoice , | ||
| 444 | or an | ||
| 445 | .Vt IPAddressFamily | ||
| 446 | object, respectively, | ||
| 447 | or | ||
| 448 | .Dv NULL | ||
| 449 | if an error occurs. | ||
| 450 | .Pp | ||
| 451 | The encoding functions | ||
| 452 | .Fn i2d_IPAddressRange , | ||
| 453 | .Fn i2d_IPAddressOrRange , | ||
| 454 | .Fn i2d_IPAddressChoice , | ||
| 455 | and | ||
| 456 | .Fn i2d_IPAddressFamily , | ||
| 457 | return the number of bytes successfully encoded | ||
| 458 | or a value <= 0 if an error occurs. | ||
| 459 | .Sh SEE ALSO | ||
| 460 | .Xr ASIdentifiers_new 3 , | ||
| 461 | .Xr ASN1_BIT_STRING_new 3 , | ||
| 462 | .Xr ASN1_OCTET_STRING_new 3 , | ||
| 463 | .Xr ASN1_OCTET_STRING_set 3 , | ||
| 464 | .Xr crypto 3 , | ||
| 465 | .Xr X509_new 3 , | ||
| 466 | .Xr X509v3_addr_add_inherit 3 | ||
| 467 | .Sh STANDARDS | ||
| 468 | RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers: | ||
| 469 | .Bl -dash -compact | ||
| 470 | .It | ||
| 471 | section 2.2.3: Syntax | ||
| 472 | .It | ||
| 473 | section 2.2.3.1: Type IPAddrBlocks | ||
| 474 | .It | ||
| 475 | section 2.2.3.2: Type IPAddressFamily | ||
| 476 | .It | ||
| 477 | section 2.2.3.3: Element addressFamily | ||
| 478 | .It | ||
| 479 | section 2.2.3.4: Element ipAddressChoice and Type IPAddressChoice | ||
| 480 | .It | ||
| 481 | section 2.2.3.5: Element inherit | ||
| 482 | .It | ||
| 483 | section 2.2.3.6: Element addressesOrRanges | ||
| 484 | .It | ||
| 485 | section 2.2.3.7: Type IPAddressOrRange | ||
| 486 | .It | ||
| 487 | section 2.2.3.8: Element addressPrefix and Type IPAddress | ||
| 488 | .It | ||
| 489 | section 2.2.3.9: Elements addressRange and Type IPAddressRange | ||
| 490 | .El | ||
| 491 | .Pp | ||
| 492 | ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: | ||
| 493 | Information technology - ASN.1 encoding rules: | ||
| 494 | Specification of Basic Encoding Rules (BER), Canonical Encoding | ||
| 495 | Rules (CER) and Distinguished Encoding Rules (DER), | ||
| 496 | section 8.6: Encoding of a bitstring value | ||
| 497 | .Sh HISTORY | ||
| 498 | These functions first appeared in OpenSSL 0.9.8e | ||
| 499 | and have been available since | ||
| 500 | .Ox 7.1 . | ||
| 501 | .Sh BUGS | ||
| 502 | .\" The internals do not seem to consistently apply and check | ||
| 503 | .\" .Dv ASN1_STRING_FLAG_BITS_LEFT | ||
| 504 | .\" which may lead to incorrect encoding and misinterpretation | ||
| 505 | As it stands, the API is barely usable | ||
| 506 | due to missing convenience accessors, constructors and destructors | ||
| 507 | and due to the complete absence of API that checks that the | ||
| 508 | individual building blocks are correct. | ||
| 509 | Extracting information from a given object can be done relatively | ||
| 510 | safely. | ||
| 511 | However, constructing objects is very error prone, be it | ||
| 512 | by hand or using the bug-ridden | ||
| 513 | .Xr X509v3_addr_add_inherit 3 | ||
| 514 | API. | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 957e8a4cef..0f501ceb83 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.271 2023/09/25 12:00:49 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.272 2023/09/26 15:34:23 tb Exp $ |
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
| 4 | 4 | ||
| @@ -222,6 +222,7 @@ MAN= \ | |||
| 222 | EXTENDED_KEY_USAGE_new.3 \ | 222 | EXTENDED_KEY_USAGE_new.3 \ |
| 223 | GENERAL_NAME_new.3 \ | 223 | GENERAL_NAME_new.3 \ |
| 224 | HMAC.3 \ | 224 | HMAC.3 \ |
| 225 | IPAddressRange_new.3 \ | ||
| 225 | MD5.3 \ | 226 | MD5.3 \ |
| 226 | NAME_CONSTRAINTS_new.3 \ | 227 | NAME_CONSTRAINTS_new.3 \ |
| 227 | OBJ_NAME_add.3 \ | 228 | OBJ_NAME_add.3 \ |
diff --git a/src/lib/libcrypto/man/X509_new.3 b/src/lib/libcrypto/man/X509_new.3 index 42a29a0183..ebffc7e69b 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.39 2023/09/25 11:59:10 tb Exp $ | 1 | .\" $OpenBSD: X509_new.3,v 1.40 2023/09/26 15:34:23 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 25 2023 $ | 69 | .Dd $Mdocdate: September 26 2023 $ |
| 70 | .Dt X509_NEW 3 | 70 | .Dt X509_NEW 3 |
| 71 | .Os | 71 | .Os |
| 72 | .Sh NAME | 72 | .Sh NAME |
| @@ -199,6 +199,7 @@ if an error occurs. | |||
| 199 | .Xr BASIC_CONSTRAINTS_new 3 , | 199 | .Xr BASIC_CONSTRAINTS_new 3 , |
| 200 | .Xr crypto 3 , | 200 | .Xr crypto 3 , |
| 201 | .Xr d2i_X509 3 , | 201 | .Xr d2i_X509 3 , |
| 202 | .Xr IPAddressRange_new 3 , | ||
| 202 | .Xr PKCS8_PRIV_KEY_INFO_new 3 , | 203 | .Xr PKCS8_PRIV_KEY_INFO_new 3 , |
| 203 | .Xr X509_ALGOR_new 3 , | 204 | .Xr X509_ALGOR_new 3 , |
| 204 | .Xr X509_ATTRIBUTE_new 3 , | 205 | .Xr X509_ATTRIBUTE_new 3 , |
diff --git a/src/lib/libcrypto/man/X509v3_addr_add_inherit.3 b/src/lib/libcrypto/man/X509v3_addr_add_inherit.3 index 98de5a01f0..8d30475181 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.2 2023/09/25 10:34:44 tb Exp $ | 1 | .\" $OpenBSD: X509v3_addr_add_inherit.3,v 1.3 2023/09/26 15:34:23 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 25 2023 $ | 17 | .Dd $Mdocdate: September 26 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 |
| @@ -65,6 +65,9 @@ an X509v3 IP address blocks delegation extension | |||
| 65 | as defined in RFC 3779, section 2.2.3.1. | 65 | as defined in RFC 3779, section 2.2.3.1. |
| 66 | It can hold lists of delegated IP address prefixes and | 66 | It can hold lists of delegated IP address prefixes and |
| 67 | IP address ranges. | 67 | IP address ranges. |
| 68 | It can be instantiated as explained in the EXAMPLES section | ||
| 69 | and its internals are documented in | ||
| 70 | .Xr IPAddressRange_new 3 . | ||
| 68 | Each list is uniquely identified by | 71 | Each list is uniquely identified by |
| 69 | an address family identifier (AFI) and | 72 | an address family identifier (AFI) and |
| 70 | an optional subsequent address family identifier (SAFI). | 73 | an optional subsequent address family identifier (SAFI). |
| @@ -391,6 +394,7 @@ is desired. | |||
| 391 | .Xr crypto 3 , | 394 | .Xr crypto 3 , |
| 392 | .Xr inet_net_ntop 3 , | 395 | .Xr inet_net_ntop 3 , |
| 393 | .Xr inet_ntop 3 , | 396 | .Xr inet_ntop 3 , |
| 397 | .Xr IPAddressRange_new 3 , | ||
| 394 | .Xr X509_new 3 , | 398 | .Xr X509_new 3 , |
| 395 | .Xr X509v3_asid_add_id_or_range 3 | 399 | .Xr X509v3_asid_add_id_or_range 3 |
| 396 | .Sh STANDARDS | 400 | .Sh STANDARDS |
