summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2022-07-09 13:13:34 +0000
committerschwarze <>2022-07-09 13:13:34 +0000
commitb3533f0db329dca3c235838096f69f63de1db987 (patch)
tree2b2cde19dfcf1fb26350ca6eccf290e3881fdbd3 /src
parentcb24f9e1a781685c6b9db82c9a7865049be3b133 (diff)
downloadopenbsd-b3533f0db329dca3c235838096f69f63de1db987.tar.gz
openbsd-b3533f0db329dca3c235838096f69f63de1db987.tar.bz2
openbsd-b3533f0db329dca3c235838096f69f63de1db987.zip
Document ASN1_INTEGER_get_uint64(3), ASN1_INTEGER_get_int64(3),
ASN1_INTEGER_set_uint64(3), ASN1_INTEGER_set_int64(3), ASN1_ENUMERATED_get_int64(3), and ASN1_ENUMERATED_set_int64(3) recently provided by tb@. Even though Dr. Steven Henson also documented these functions in OpenSSL, the text over there is excessively verbose, repetitive, very badly ordered, and incomplete, so i chose to instead write this patch from scratch, also adding some precision in a few places.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/ASN1_INTEGER_get.396
1 files changed, 90 insertions, 6 deletions
diff --git a/src/lib/libcrypto/man/ASN1_INTEGER_get.3 b/src/lib/libcrypto/man/ASN1_INTEGER_get.3
index df5a3bc821..b7737393ca 100644
--- a/src/lib/libcrypto/man/ASN1_INTEGER_get.3
+++ b/src/lib/libcrypto/man/ASN1_INTEGER_get.3
@@ -1,11 +1,11 @@
1.\" $OpenBSD: ASN1_INTEGER_get.3,v 1.5 2021/11/23 13:52:27 schwarze Exp $ 1.\" $OpenBSD: ASN1_INTEGER_get.3,v 1.6 2022/07/09 13:13:34 schwarze Exp $
2.\" selective merge up to: 2.\" selective merge up to:
3.\" OpenSSL man3/ASN1_INTEGER_get_int64 24a535ea Sep 22 13:14:20 2020 +0100 3.\" OpenSSL man3/ASN1_INTEGER_get_int64 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
5.\" This file is a derived work. 5.\" This file is a derived work.
6.\" The changes are covered by the following Copyright and license: 6.\" The changes are covered by the following Copyright and license:
7.\" 7.\"
8.\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org> 8.\" Copyright (c) 2018, 2021, 2022 Ingo Schwarze <schwarze@openbsd.org>
9.\" 9.\"
10.\" Permission to use, copy, modify, and distribute this software for any 10.\" Permission to use, copy, modify, and distribute this software for any
11.\" purpose with or without fee is hereby granted, provided that the above 11.\" purpose with or without fee is hereby granted, provided that the above
@@ -66,28 +66,54 @@
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: November 23 2021 $ 69.Dd $Mdocdate: July 9 2022 $
70.Dt ASN1_INTEGER_GET 3 70.Dt ASN1_INTEGER_GET 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
73.Nm ASN1_INTEGER_get_uint64 ,
74.Nm ASN1_INTEGER_get_int64 ,
73.Nm ASN1_INTEGER_get , 75.Nm ASN1_INTEGER_get ,
76.Nm ASN1_INTEGER_set_uint64 ,
77.Nm ASN1_INTEGER_set_int64 ,
74.Nm ASN1_INTEGER_set , 78.Nm ASN1_INTEGER_set ,
75.Nm ASN1_INTEGER_cmp , 79.Nm ASN1_INTEGER_cmp ,
76.Nm ASN1_INTEGER_dup , 80.Nm ASN1_INTEGER_dup ,
77.Nm BN_to_ASN1_INTEGER , 81.Nm BN_to_ASN1_INTEGER ,
78.Nm ASN1_INTEGER_to_BN , 82.Nm ASN1_INTEGER_to_BN ,
83.Nm ASN1_ENUMERATED_get_int64 ,
79.Nm ASN1_ENUMERATED_get , 84.Nm ASN1_ENUMERATED_get ,
85.Nm ASN1_ENUMERATED_set_int64 ,
80.Nm ASN1_ENUMERATED_set , 86.Nm ASN1_ENUMERATED_set ,
81.Nm BN_to_ASN1_ENUMERATED , 87.Nm BN_to_ASN1_ENUMERATED ,
82.Nm ASN1_ENUMERATED_to_BN 88.Nm ASN1_ENUMERATED_to_BN
83.Nd ASN.1 INTEGER and ENUMERATED utilities 89.Nd ASN.1 INTEGER and ENUMERATED utilities
84.Sh SYNOPSIS 90.Sh SYNOPSIS
85.In openssl/asn1.h 91.In openssl/asn1.h
92.Ft int
93.Fo ASN1_INTEGER_get_uint64
94.Fa "uint64_t *out_val"
95.Fa "const ASN1_INTEGER *a"
96.Fc
97.Ft int
98.Fo ASN1_INTEGER_get_int64
99.Fa "int64_t *out_val"
100.Fa "const ASN1_INTEGER *a"
101.Fc
86.Ft long 102.Ft long
87.Fo ASN1_INTEGER_get 103.Fo ASN1_INTEGER_get
88.Fa "const ASN1_INTEGER *a" 104.Fa "const ASN1_INTEGER *a"
89.Fc 105.Fc
90.Ft int 106.Ft int
107.Fo ASN1_INTEGER_set_uint64
108.Fa "ASN1_INTEGER *a"
109.Fa "uint64_t v"
110.Fc
111.Ft int
112.Fo ASN1_INTEGER_set_int64
113.Fa "ASN1_INTEGER *a"
114.Fa "int64_t v";
115.Fc
116.Ft int
91.Fo ASN1_INTEGER_set 117.Fo ASN1_INTEGER_set
92.Fa "ASN1_INTEGER *a" 118.Fa "ASN1_INTEGER *a"
93.Fa "long v" 119.Fa "long v"
@@ -111,11 +137,21 @@
111.Fa "const ASN1_INTEGER *ai" 137.Fa "const ASN1_INTEGER *ai"
112.Fa "BIGNUM *bn" 138.Fa "BIGNUM *bn"
113.Fc 139.Fc
140.Ft int
141.Fo ASN1_ENUMERATED_get_int64
142.Fa "int64_t *out_val"
143.Fa "const ASN1_ENUMERATED *a"
144.Fc
114.Ft long 145.Ft long
115.Fo ASN1_ENUMERATED_get 146.Fo ASN1_ENUMERATED_get
116.Fa "const ASN1_ENUMERATED *a" 147.Fa "const ASN1_ENUMERATED *a"
117.Fc 148.Fc
118.Ft int 149.Ft int
150.Fo ASN1_ENUMERATED_set_int64
151.Fa "ASN1_ENUMERATED *a"
152.Fa "int64_t v"
153.Fc
154.Ft int
119.Fo ASN1_ENUMERATED_set 155.Fo ASN1_ENUMERATED_set
120.Fa "ASN1_ENUMERATED *a" 156.Fa "ASN1_ENUMERATED *a"
121.Fa "long v" 157.Fa "long v"
@@ -137,6 +173,16 @@ and
137.Vt ASN1_ENUMERATED 173.Vt ASN1_ENUMERATED
138objects. 174objects.
139.Pp 175.Pp
176.Fn ASN1_INTEGER_get_uint64
177and
178.Fn ASN1_INTEGER_get_int64
179store the value of
180.Fa a
181in
182.Pf * Fa out_val
183if successful.
184.Pp
185The deprecated function
140.Fn ASN1_INTEGER_get 186.Fn ASN1_INTEGER_get
141converts 187converts
142.Fa a 188.Fa a
@@ -144,8 +190,11 @@ to the
144.Vt long 190.Vt long
145type. 191type.
146.Pp 192.Pp
193.Fn ASN1_INTEGER_set_uint64 ,
194.Fn ASN1_INTEGER_set_int64 ,
195and
147.Fn ASN1_INTEGER_set 196.Fn ASN1_INTEGER_set
148sets the type of 197set the type of
149.Fa a 198.Fa a
150to 199to
151.Dv V_ASN1_INTEGER 200.Dv V_ASN1_INTEGER
@@ -153,7 +202,7 @@ or
153.Dv V_ASN1_NEG_INTEGER 202.Dv V_ASN1_NEG_INTEGER
154depending on the sign of 203depending on the sign of
155.Fa v 204.Fa v
156and sets the value of 205and set the value of
157.Fa a 206.Fa a
158to 207to
159.Fa v . 208.Fa v .
@@ -206,7 +255,9 @@ Otherwise, the existing object
206.Fa bn 255.Fa bn
207is used instead. 256is used instead.
208.Pp 257.Pp
258.Fn ASN1_ENUMERATED_get_int64 ,
209.Fn ASN1_ENUMERATED_get , 259.Fn ASN1_ENUMERATED_get ,
260.Fn ASN1_ENUMERATED_set_int64 ,
210.Fn ASN1_ENUMERATED_set , 261.Fn ASN1_ENUMERATED_set ,
211.Fn BN_to_ASN1_ENUMERATED , 262.Fn BN_to_ASN1_ENUMERATED ,
212and 263and
@@ -217,6 +268,26 @@ counterparts except that they operate on an
217.Vt ASN1_ENUMERATED 268.Vt ASN1_ENUMERATED
218object. 269object.
219.Sh RETURN VALUES 270.Sh RETURN VALUES
271.Fn ASN1_INTEGER_get_uint64
272returns 1 in case of success or 0 if
273.Fa a
274is not of the type
275.Dv V_ASN1_INTEGER
276or greater than
277.Dv UINT64_MAX .
278.Pp
279.Fn ASN1_INTEGER_get_int64
280returns 1 in case of success or 0 if
281.Fa a
282is not of the type
283.Dv V_ASN1_INTEGER
284or
285.Dv V_ASN1_NEG_INTEGER ,
286less than
287.Dv INT64_MIN ,
288or greater than
289.Dv INT64_MAX .
290.Pp
220.Fn ASN1_INTEGER_get 291.Fn ASN1_INTEGER_get
221and 292and
222.Fn ASN1_ENUMERATED_get 293.Fn ASN1_ENUMERATED_get
@@ -228,7 +299,10 @@ or \-1 on error, which is ambiguous because \-1 is a legitimate
228value for an 299value for an
229.Vt ASN1_INTEGER . 300.Vt ASN1_INTEGER .
230.Pp 301.Pp
231.Fn ASN1_INTEGER_set 302.Fn ASN1_INTEGER_set_uint64 ,
303.Fn ASN1_INTEGER_set_int64 ,
304.Fn ASN1_INTEGER_set ,
305.Fn ASN1_ENUMERATED_set_int64 ,
232and 306and
233.Fn ASN1_ENUMERATED_set 307.Fn ASN1_ENUMERATED_set
234return 1 for success or 0 for failure. 308return 1 for success or 0 for failure.
@@ -303,6 +377,16 @@ and
303.Fn ASN1_ENUMERATED_to_BN 377.Fn ASN1_ENUMERATED_to_BN
304first appeared in OpenSSL 0.9.2b and have been available since 378first appeared in OpenSSL 0.9.2b and have been available since
305.Ox 2.6 . 379.Ox 2.6 .
380.Pp
381.Fn ASN1_INTEGER_get_uint64 ,
382.Fn ASN1_INTEGER_get_int64 ,
383.Fn ASN1_INTEGER_set_uint64 ,
384.Fn ASN1_INTEGER_set_int64 ,
385.Fn ASN1_ENUMERATED_get_int64 ,
386and
387.Fn ASN1_ENUMERATED_set_int64
388first appeared in OpenSSL 1.1.0 and have been available since
389.Ox 7.2 .
306.Sh CAVEATS 390.Sh CAVEATS
307In general an 391In general an
308.Vt ASN1_INTEGER 392.Vt ASN1_INTEGER