diff options
| author | schwarze <> | 2021-09-11 08:45:47 +0000 |
|---|---|---|
| committer | schwarze <> | 2021-09-11 08:45:47 +0000 |
| commit | b0b3e4e847df0c7cb16cc4610638c96e86735cd5 (patch) | |
| tree | c39b9fb227cb25ee3e95c9bccf3ee2044af70855 /src/lib/libcrypto/man | |
| parent | edb71847e4b064c69f7e2779246ba6107a148526 (diff) | |
| download | openbsd-b0b3e4e847df0c7cb16cc4610638c96e86735cd5.tar.gz openbsd-b0b3e4e847df0c7cb16cc4610638c96e86735cd5.tar.bz2 openbsd-b0b3e4e847df0c7cb16cc4610638c96e86735cd5.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.3 | 90 |
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 |
| 134 | bytes of memory. | 155 | bytes of memory. |
| 135 | .Pp | 156 | .Pp |
| 157 | .Fn BN_bn2binpad | ||
| 158 | also converts the absolute value of | ||
| 159 | .Fa a | ||
| 160 | into big-endian form and stores it at | ||
| 161 | .Fa to . | ||
| 162 | .Fa tolen | ||
| 163 | indicates the length of the output buffer | ||
| 164 | .Pf * Fa to . | ||
| 165 | The result is padded with zeros if necessary. | ||
| 166 | If | ||
| 167 | .Fa tolen | ||
| 168 | is less than | ||
| 169 | .Fn BN_num_bytes a , | ||
| 170 | an error is returned. | ||
| 171 | .Pp | ||
| 136 | .Fn BN_bin2bn | 172 | .Fn BN_bin2bn |
| 137 | converts the positive integer in big-endian form of length | 173 | converts 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 |
| 151 | is created. | 187 | is created. |
| 152 | .Pp | 188 | .Pp |
| 189 | .Fn BN_bn2lebinpad | ||
| 190 | and | ||
| 191 | .Fn BN_lebin2bn | ||
| 192 | are identical to | ||
| 193 | .Fn BN_bn2binpad | ||
| 194 | and | ||
| 195 | .Fn BN_bin2bn | ||
| 196 | except the buffer | ||
| 197 | .Pf * Fa to | ||
| 198 | is in little-endian format. | ||
| 199 | .Pp | ||
| 153 | .Fn BN_bn2hex | 200 | .Fn BN_bn2hex |
| 154 | and | 201 | and |
| 155 | .Fn BN_bn2dec | 202 | .Fn BN_bn2dec |
| @@ -170,16 +217,16 @@ Conversion stops at the first byte that is not a hexadecimal digit. | |||
| 170 | The number is converted to a | 217 | The number is converted to a |
| 171 | .Vt BIGNUM | 218 | .Vt BIGNUM |
| 172 | and stored in | 219 | and stored in |
| 173 | .Pf * Fa a . | 220 | .Pf ** Fa ap . |
| 174 | If | 221 | If |
| 175 | .Pf * Fa a | 222 | .Pf * Fa ap |
| 176 | is | 223 | is |
| 177 | .Dv NULL , | 224 | .Dv NULL , |
| 178 | a new | 225 | a new |
| 179 | .Vt BIGNUM | 226 | .Vt BIGNUM |
| 180 | is created. | 227 | is created. |
| 181 | If | 228 | If |
| 182 | .Fa a | 229 | .Fa ap |
| 183 | is | 230 | is |
| 184 | .Dv NULL , | 231 | .Dv NULL , |
| 185 | it only computes the number's length in hexadecimal digits, | 232 | it only computes the number's length in hexadecimal digits, |
| @@ -230,7 +277,7 @@ stores the representation of | |||
| 230 | at | 277 | at |
| 231 | .Fa to , | 278 | .Fa to , |
| 232 | where | 279 | where |
| 233 | .Fa to | 280 | .Pf * Fa to |
| 234 | must be large enough to hold the result. | 281 | must be large enough to hold the result. |
| 235 | The size can be determined by calling | 282 | The 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 |
| 255 | returns the length of the big-endian number placed at | 302 | returns the length of the big-endian number placed at |
| 256 | .Fa to . | 303 | .Fa to . |
| 304 | .Pp | ||
| 305 | .Fn BN_bn2binpad | ||
| 306 | and | ||
| 307 | .Fn BN_bn2lebinpad | ||
| 308 | return the number of bytes written | ||
| 309 | or \-1 if the supplied buffer is too small. | ||
| 310 | .Pp | ||
| 257 | .Fn BN_bin2bn | 311 | .Fn BN_bin2bn |
| 258 | returns the | 312 | and |
| 313 | .Fn BN_lebin2bn | ||
| 314 | return the | ||
| 259 | .Vt BIGNUM , | 315 | .Vt BIGNUM , |
| 260 | or | 316 | or |
| 261 | .Dv NULL | 317 | .Dv NULL |
| @@ -297,6 +353,7 @@ on error. | |||
| 297 | The error codes can be obtained by | 353 | The 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 |
| 323 | first appeared in OpenSSL 1.0.0 and has been available since | 380 | first 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 , | ||
| 385 | and | ||
| 386 | .Fn BN_lebin2bn | ||
| 387 | first appeared in OpenSSL 1.1.0 and have been available since | ||
| 388 | .Ox 7.0 . | ||
