summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man
diff options
context:
space:
mode:
authorschwarze <>2021-09-11 08:45:47 +0000
committerschwarze <>2021-09-11 08:45:47 +0000
commite229cb2ecc1a40f65ec831ad9c77bc069d327da1 (patch)
treec39b9fb227cb25ee3e95c9bccf3ee2044af70855 /src/lib/libcrypto/man
parent17f49947eecf556f26f6f114a537b2e9d990dd7f (diff)
downloadopenbsd-e229cb2ecc1a40f65ec831ad9c77bc069d327da1.tar.gz
openbsd-e229cb2ecc1a40f65ec831ad9c77bc069d327da1.tar.bz2
openbsd-e229cb2ecc1a40f65ec831ad9c77bc069d327da1.zip
Merge documentation for BN_bn2binpad(3), BN_bn2lebinpad(3),
and BN_lebin2bn(3) from the OpenSSL 1.1.1 branch, which is still under a free license. While here, tweak a number of details for clarity. OK tb@
Diffstat (limited to 'src/lib/libcrypto/man')
-rw-r--r--src/lib/libcrypto/man/BN_bn2bin.390
1 files changed, 77 insertions, 13 deletions
diff --git a/src/lib/libcrypto/man/BN_bn2bin.3 b/src/lib/libcrypto/man/BN_bn2bin.3
index 9569d111b5..48d350ab48 100644
--- a/src/lib/libcrypto/man/BN_bn2bin.3
+++ b/src/lib/libcrypto/man/BN_bn2bin.3
@@ -1,8 +1,8 @@
1.\" $OpenBSD: BN_bn2bin.3,v 1.13 2019/06/10 14:58:48 schwarze Exp $ 1.\" $OpenBSD: BN_bn2bin.3,v 1.14 2021/09/11 08:45:47 schwarze Exp $
2.\" full merge up to: OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400 2.\" full merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
3.\" selective merge up to: OpenSSL 1212818e Sep 11 13:22:14 2018 +0100
4.\" 3.\"
5.\" This file was written by Ulf Moeller <ulf@openssl.org>. 4.\" This file was written by Ulf Moeller <ulf@openssl.org>
5.\" and Dr. Stephen Henson <steve@openssl.org>.
6.\" Copyright (c) 2000, 2002, 2016 The OpenSSL Project. All rights reserved. 6.\" Copyright (c) 2000, 2002, 2016 The OpenSSL Project. All rights reserved.
7.\" 7.\"
8.\" Redistribution and use in source and binary forms, with or without 8.\" Redistribution and use in source and binary forms, with or without
@@ -49,12 +49,15 @@
49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" OF THE POSSIBILITY OF SUCH DAMAGE.
51.\" 51.\"
52.Dd $Mdocdate: June 10 2019 $ 52.Dd $Mdocdate: September 11 2021 $
53.Dt BN_BN2BIN 3 53.Dt BN_BN2BIN 3
54.Os 54.Os
55.Sh NAME 55.Sh NAME
56.Nm BN_bn2bin , 56.Nm BN_bn2bin ,
57.Nm BN_bn2binpad ,
57.Nm BN_bin2bn , 58.Nm BN_bin2bn ,
59.Nm BN_bn2lebinpad ,
60.Nm BN_lebin2bn ,
58.Nm BN_bn2hex , 61.Nm BN_bn2hex ,
59.Nm BN_bn2dec , 62.Nm BN_bn2dec ,
60.Nm BN_hex2bn , 63.Nm BN_hex2bn ,
@@ -72,12 +75,30 @@
72.Fa "const BIGNUM *a" 75.Fa "const BIGNUM *a"
73.Fa "unsigned char *to" 76.Fa "unsigned char *to"
74.Fc 77.Fc
78.Ft int
79.Fo BN_bn2binpad
80.Fa "const BIGNUM *a"
81.Fa "unsigned char *to"
82.Fa "int tolen"
83.Fc
75.Ft BIGNUM * 84.Ft BIGNUM *
76.Fo BN_bin2bn 85.Fo BN_bin2bn
77.Fa "const unsigned char *s" 86.Fa "const unsigned char *s"
78.Fa "int len" 87.Fa "int len"
79.Fa "BIGNUM *ret" 88.Fa "BIGNUM *ret"
80.Fc 89.Fc
90.Ft int
91.Fo BN_bn2lebinpad
92.Fa "const BIGNUM *a"
93.Fa "unsigned char *to"
94.Fa "int tolen"
95.Fc
96.Ft BIGNUM *
97.Fo BN_lebin2bn
98.Fa "const unsigned char *s"
99.Fa "int len"
100.Fa "BIGNUM *ret"
101.Fc
81.Ft char * 102.Ft char *
82.Fo BN_bn2hex 103.Fo BN_bn2hex
83.Fa "const BIGNUM *a" 104.Fa "const BIGNUM *a"
@@ -88,17 +109,17 @@
88.Fc 109.Fc
89.Ft int 110.Ft int
90.Fo BN_hex2bn 111.Fo BN_hex2bn
91.Fa "BIGNUM **a" 112.Fa "BIGNUM **ap"
92.Fa "const char *str" 113.Fa "const char *str"
93.Fc 114.Fc
94.Ft int 115.Ft int
95.Fo BN_dec2bn 116.Fo BN_dec2bn
96.Fa "BIGNUM **a" 117.Fa "BIGNUM **ap"
97.Fa "const char *str" 118.Fa "const char *str"
98.Fc 119.Fc
99.Ft int 120.Ft int
100.Fo BN_asc2bn 121.Fo BN_asc2bn
101.Fa "BIGNUM **a" 122.Fa "BIGNUM **ap"
102.Fa "const char *str" 123.Fa "const char *str"
103.Fc 124.Fc
104.Ft int 125.Ft int
@@ -133,6 +154,21 @@ must point to
133.Fn BN_num_bytes a 154.Fn BN_num_bytes a
134bytes of memory. 155bytes of memory.
135.Pp 156.Pp
157.Fn BN_bn2binpad
158also converts the absolute value of
159.Fa a
160into big-endian form and stores it at
161.Fa to .
162.Fa tolen
163indicates the length of the output buffer
164.Pf * Fa to .
165The result is padded with zeros if necessary.
166If
167.Fa tolen
168is less than
169.Fn BN_num_bytes a ,
170an error is returned.
171.Pp
136.Fn BN_bin2bn 172.Fn BN_bin2bn
137converts the positive integer in big-endian form of length 173converts the positive integer in big-endian form of length
138.Fa len 174.Fa len
@@ -150,6 +186,17 @@ a new
150.Vt BIGNUM 186.Vt BIGNUM
151is created. 187is created.
152.Pp 188.Pp
189.Fn BN_bn2lebinpad
190and
191.Fn BN_lebin2bn
192are identical to
193.Fn BN_bn2binpad
194and
195.Fn BN_bin2bn
196except the buffer
197.Pf * Fa to
198is in little-endian format.
199.Pp
153.Fn BN_bn2hex 200.Fn BN_bn2hex
154and 201and
155.Fn BN_bn2dec 202.Fn BN_bn2dec
@@ -170,16 +217,16 @@ Conversion stops at the first byte that is not a hexadecimal digit.
170The number is converted to a 217The number is converted to a
171.Vt BIGNUM 218.Vt BIGNUM
172and stored in 219and stored in
173.Pf * Fa a . 220.Pf ** Fa ap .
174If 221If
175.Pf * Fa a 222.Pf * Fa ap
176is 223is
177.Dv NULL , 224.Dv NULL ,
178a new 225a new
179.Vt BIGNUM 226.Vt BIGNUM
180is created. 227is created.
181If 228If
182.Fa a 229.Fa ap
183is 230is
184.Dv NULL , 231.Dv NULL ,
185it only computes the number's length in hexadecimal digits, 232it only computes the number's length in hexadecimal digits,
@@ -230,7 +277,7 @@ stores the representation of
230at 277at
231.Fa to , 278.Fa to ,
232where 279where
233.Fa to 280.Pf * Fa to
234must be large enough to hold the result. 281must be large enough to hold the result.
235The size can be determined by calling 282The size can be determined by calling
236.Fn BN_bn2mpi a NULL . 283.Fn BN_bn2mpi a NULL .
@@ -254,8 +301,17 @@ is
254.Fn BN_bn2bin 301.Fn BN_bn2bin
255returns the length of the big-endian number placed at 302returns the length of the big-endian number placed at
256.Fa to . 303.Fa to .
304.Pp
305.Fn BN_bn2binpad
306and
307.Fn BN_bn2lebinpad
308return the number of bytes written
309or \-1 if the supplied buffer is too small.
310.Pp
257.Fn BN_bin2bn 311.Fn BN_bin2bn
258returns the 312and
313.Fn BN_lebin2bn
314return the
259.Vt BIGNUM , 315.Vt BIGNUM ,
260or 316or
261.Dv NULL 317.Dv NULL
@@ -297,6 +353,7 @@ on error.
297The error codes can be obtained by 353The error codes can be obtained by
298.Xr ERR_get_error 3 . 354.Xr ERR_get_error 3 .
299.Sh SEE ALSO 355.Sh SEE ALSO
356.Xr ASN1_INTEGER_to_BN 3 ,
300.Xr BN_new 3 , 357.Xr BN_new 3 ,
301.Xr BN_num_bytes 3 , 358.Xr BN_num_bytes 3 ,
302.Xr BN_zero 3 359.Xr BN_zero 3
@@ -322,3 +379,10 @@ All these functions have been available since
322.Fn BN_asc2bin 379.Fn BN_asc2bin
323first appeared in OpenSSL 1.0.0 and has been available since 380first appeared in OpenSSL 1.0.0 and has been available since
324.Ox 4.9 . 381.Ox 4.9 .
382.Pp
383.Fn BN_bn2binpad ,
384.Fn BN_bn2lebinpad ,
385and
386.Fn BN_lebin2bn
387first appeared in OpenSSL 1.1.0 and have been available since
388.Ox 7.0 .