summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-09-25 11:59:10 +0000
committertb <>2023-09-25 11:59:10 +0000
commit3f17bba4834b5a146a55e937d801550cb1bc510e (patch)
tree13e2fe28314a3129ede1c7a60a4d98312f7ba20f /src
parentd1e214b52051a9544479371367628d05cb9b7a1f (diff)
downloadopenbsd-3f17bba4834b5a146a55e937d801550cb1bc510e.tar.gz
openbsd-3f17bba4834b5a146a55e937d801550cb1bc510e.tar.bz2
openbsd-3f17bba4834b5a146a55e937d801550cb1bc510e.zip
New manual page documenting the usual four ASN.1 functions for both
ASRange and ASIdOrRange
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/ASIdentifiers_new.33
-rw-r--r--src/lib/libcrypto/man/ASRange_new.3257
-rw-r--r--src/lib/libcrypto/man/Makefile3
-rw-r--r--src/lib/libcrypto/man/X509_new.33
4 files changed, 263 insertions, 3 deletions
diff --git a/src/lib/libcrypto/man/ASIdentifiers_new.3 b/src/lib/libcrypto/man/ASIdentifiers_new.3
index 262c760f17..f6ab5e5aaf 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.2 2023/09/25 11:12:08 tb Exp $ 1.\" $OpenBSD: ASIdentifiers_new.3,v 1.3 2023/09/25 11:59:10 tb Exp $
2.\" 2.\"
3.\" Copyright (c) 2021 Theo Buehler <tb@openbsd.org> 3.\" Copyright (c) 2021 Theo Buehler <tb@openbsd.org>
4.\" 4.\"
@@ -105,6 +105,7 @@ on if a decoding or memory allocation error occurs.
105returns the number of bytes successfully encoded 105returns the number of bytes successfully encoded
106or a value <= 0 if an error occurs. 106or a value <= 0 if an error occurs.
107.Sh SEE ALSO 107.Sh SEE ALSO
108.Xr ASRange_new 3 ,
108.Xr crypto 3 , 109.Xr crypto 3 ,
109.Xr X509_new 3 , 110.Xr X509_new 3 ,
110.Xr X509v3_asid_add_id_or_range 3 , 111.Xr X509v3_asid_add_id_or_range 3 ,
diff --git a/src/lib/libcrypto/man/ASRange_new.3 b/src/lib/libcrypto/man/ASRange_new.3
new file mode 100644
index 0000000000..6aa33f2c79
--- /dev/null
+++ b/src/lib/libcrypto/man/ASRange_new.3
@@ -0,0 +1,257 @@
1.\" $OpenBSD: ASRange_new.3,v 1.1 2023/09/25 11:59:10 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 25 2023 $
18.Dt ASRANGE_NEW 3
19.Os
20.Sh NAME
21.Nm ASRange_new ,
22.Nm ASRange_free ,
23.Nm d2i_ASRange ,
24.Nm i2d_ASRange ,
25.Nm ASIdOrRange_new ,
26.Nm ASIdOrRange_free ,
27.Nm d2i_ASIdOrRange ,
28.Nm i2d_ASIdOrRange
29.Nd Autonomous system identifiers and ranges
30.Sh SYNOPSIS
31.In openssl/x509v3.h
32.Ft "ASRange *"
33.Fn ASRange_new void
34.Ft void
35.Fn ASRange_free "ASRange *"
36.Ft ASRange *
37.Fo d2i_ASRange
38.Fa "ASRange **asrange"
39.Fa "const unsigned char **der_in"
40.Fa "long length"
41.Fc
42.Ft int
43.Fo i2d_ASRange
44.Fa "ASRange *asrange"
45.Fa "unsigned char **der_out"
46.Fc
47.Ft "ASIdOrRange *"
48.Fn ASIdOrRange_new void
49.Ft void
50.Fn ASIdOrRange_free "ASIdOrRange *aor"
51.Ft ASIdOrRange *
52.Fo d2i_ASIdOrRange
53.Fa "ASIdOrRange **aor"
54.Fa "const unsigned char **der_in"
55.Fa "long length"
56.Fc
57.Ft int
58.Fo i2d_ASIdOrRange
59.Fa "ASIdOrRange *aor"
60.Fa "unsigned char **der_out"
61.Fc
62.Sh DESCRIPTION
63.Vt ASRange
64and
65.Vt ASIdOrRange
66are building blocks of the RFC 3779
67.Vt ASIdentifiers
68type representing the autonomous system identifier delegation extension.
69See
70.Xr ASIdentifiers_new 3
71and
72.Xr X509v3_asid_add_id_or_range 3
73for more details.
74.Pp
75All
76.Vt ASN1_INTEGER Ns s
77in this manual should be representable as unsigned 32-bit integers.
78The library provides no convenient way of setting the value of an
79.Vt ASN1_INTEGER
80directly.
81A detour via a
82.Vt BIGNUM
83or a string is unavoidable.
84.Pp
85The
86.Vt ASRange
87type defined in RFC 3779 section 3.2.3.8 is implemented as
88.Bd -literal -offset indent
89typedef struct ASRange_st {
90 ASN1_INTEGER *min;
91 ASN1_INTEGER *max;
92} ASRange;
93.Ed
94.Pp
95It represents the closed range [min,max] of AS identifiers between
96.Fa min
97and
98.Fa max ,
99where
100.Fa min
101should be strictly smaller than
102.Fa max .
103.Pp
104.Fn ASRange_new
105allocates a new
106.Vt ASRange
107object with allocated, empty
108.Fa min
109and
110.Fa max ,
111thus representing the invalid range [0,0].
112.Pp
113.Fn ASRange_free
114frees
115.Fa asrange
116including any data contained in it.
117If
118.Fa asrange
119is
120.Dv NULL ,
121no action occurs.
122.Pp
123The
124.Vt ASIdOrRange
125type defined in RFC 3779 section 3.2.3.5 is implemented as
126.Bd -literal -offset indent
127typedef struct ASIdOrRange_st {
128 int type;
129 union {
130 ASN1_INTEGER *id;
131 ASRange *range;
132 } u;
133} ASIdOrRange;
134.Ed
135.Pp
136representing an individual AS identifier or a range.
137When populating an
138.Vt ASIdOrRange
139object by hand, its
140.Fa type
141should be set to
142.Dv ASIdOrRange_id
143or
144.Dv ASIdOrRange_range
145to indicate which member of the union
146.Fa u
147is valid.
148.Pp
149.Fn ASIdOrRange_new
150returns a new
151.Vt ASIdOrRange
152object with invalid type and
153.Dv NULL
154members of the union
155.Fa u .
156.Pp
157.Fn ASIdOrRange_free
158frees
159.Fa aor
160including any data contained in it,
161provided
162.Fa type
163is set correctly.
164If
165.Fa asrange
166is
167.Dv NULL ,
168no action occurs.
169.Pp
170.Fn d2i_ASRange ,
171.Fn i2d_ASRange ,
172.Fn d2i_ASIdOrRange ,
173and
174.Fn i2d_ASIdOrRange
175decode and encode ASN.1
176.Vt ASRange
177and
178.Vt ASIdOrRange
179objects.
180For details about the semantics, examples, caveats, and bugs, see
181.Xr ASN1_item_d2i 3 .
182In order for the encoding produced by
183.Fn i2d_ASRange
184to be correct,
185.Fa min
186must be strictly less than
187.Fa max .
188Similarly for
189.Fn i2d_ASIdOrRange
190and an
191.Fa ASIdOrRange
192object of
193.Fa type
194.Dv ASIdOrRange_range .
195.Sh RETURN VALUES
196.Fn ASRange_new
197returns a new
198.Vt ASRange
199object or
200.Dv NULL
201if an error occurs.
202.Pp
203.Fn ASIdOrRange_new
204returns a new, empty
205.Vt ASIdOrRange
206object or
207.Dv NULL
208if an error occurs.
209.Pp
210The encoding functions
211.Fn d2i_ASRange
212and
213.Fn d2i_ASIdOrRange
214return an
215.Vt ASRange
216or an
217.Vt ASIdOrRange
218object, respectively,
219or
220.Dv NULL
221if an error occurs.
222.Pp
223The encoding functions
224.Fn i2d_ASRange
225and
226.Fn i2d_ASIdOrRange
227return the number of bytes successfully encoded
228or a value <= 0 if an error occurs.
229.Sh SEE ALSO
230.Xr ASIdentifiers_new 3 ,
231.Xr BN_set_word 3 ,
232.Xr BN_to_ASN1_INTEGER 3 ,
233.Xr crypto 3 ,
234.Xr s2i_ASN1_INTEGER 3 ,
235.Xr X509_new 3 ,
236.Xr X509v3_asid_add_id_or_range 3 ,
237.Xr X509v3_asid_is_canonical 3
238.Sh STANDARDS
239RFC 3779: X.509 Extensions for IP Addresses and AS Identifiers:
240.Bl -dash -compact
241.It
242section 3.2.3: Syntax
243.It
244section 3.2.3.5: Type ASIdOrRange
245.It
246section 3.2.3.6: Element id
247.It
248section 3.2.3.7: Element range
249.It
250section 3.2.3.8: Type ASRange
251.It
252section 3.2.3.9: Elements min and max
253.El
254.Sh HISTORY
255These functions first appeared in OpenSSL 0.9.8e
256and have been available since
257.Ox 7.1 .
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index ccf0be63fe..2ccc06895f 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.269 2023/09/25 01:14:34 tb Exp $ 1# $OpenBSD: Makefile,v 1.270 2023/09/25 11:59:10 tb Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -6,6 +6,7 @@ MAN= \
6 ACCESS_DESCRIPTION_new.3 \ 6 ACCESS_DESCRIPTION_new.3 \
7 AES_encrypt.3 \ 7 AES_encrypt.3 \
8 ASIdentifiers_new.3 \ 8 ASIdentifiers_new.3 \
9 ASRange_new.3 \
9 ASN1_BIT_STRING_set.3 \ 10 ASN1_BIT_STRING_set.3 \
10 ASN1_INTEGER_get.3 \ 11 ASN1_INTEGER_get.3 \
11 ASN1_NULL_new.3 \ 12 ASN1_NULL_new.3 \
diff --git a/src/lib/libcrypto/man/X509_new.3 b/src/lib/libcrypto/man/X509_new.3
index f2615cd5bd..42a29a0183 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.38 2023/09/25 01:14:34 tb Exp $ 1.\" $OpenBSD: X509_new.3,v 1.39 2023/09/25 11:59:10 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.
@@ -194,6 +194,7 @@ or
194if an error occurs. 194if an error occurs.
195.Sh SEE ALSO 195.Sh SEE ALSO
196.Xr ASIdentifiers_new 3 , 196.Xr ASIdentifiers_new 3 ,
197.Xr ASRange_new 3 ,
197.Xr AUTHORITY_KEYID_new 3 , 198.Xr AUTHORITY_KEYID_new 3 ,
198.Xr BASIC_CONSTRAINTS_new 3 , 199.Xr BASIC_CONSTRAINTS_new 3 ,
199.Xr crypto 3 , 200.Xr crypto 3 ,