diff options
Diffstat (limited to 'src/lib/libcrypto/man')
| -rw-r--r-- | src/lib/libcrypto/man/ASN1_INTEGER_get.3 | 98 |
1 files changed, 93 insertions, 5 deletions
diff --git a/src/lib/libcrypto/man/ASN1_INTEGER_get.3 b/src/lib/libcrypto/man/ASN1_INTEGER_get.3 index 72342ec1e0..1ed993efa6 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.3 2019/08/26 12:45:27 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_INTEGER_get.3,v 1.4 2021/11/20 13:06:26 schwarze Exp $ |
| 2 | .\" selective merge up to: | 2 | .\" selective merge up to: |
| 3 | .\" OpenSSL man3/ASN1_INTEGER_get_int64 df75c2bf Dec 9 01:02:36 2018 +0100 | 3 | .\" OpenSSL man3/ASN1_INTEGER_get_int64 df75c2bf Dec 9 01:02:36 2018 +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, 2019 Ingo Schwarze <schwarze@openbsd.org> | 8 | .\" Copyright (c) 2018, 2019, 2021 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,12 +66,14 @@ | |||
| 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: August 26 2019 $ | 69 | .Dd $Mdocdate: November 20 2021 $ |
| 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 , | 73 | .Nm ASN1_INTEGER_get , |
| 74 | .Nm ASN1_INTEGER_set , | 74 | .Nm ASN1_INTEGER_set , |
| 75 | .Nm ASN1_INTEGER_cmp , | ||
| 76 | .Nm ASN1_INTEGER_dup , | ||
| 75 | .Nm BN_to_ASN1_INTEGER , | 77 | .Nm BN_to_ASN1_INTEGER , |
| 76 | .Nm ASN1_INTEGER_to_BN , | 78 | .Nm ASN1_INTEGER_to_BN , |
| 77 | .Nm i2a_ASN1_INTEGER , | 79 | .Nm i2a_ASN1_INTEGER , |
| @@ -91,6 +93,15 @@ | |||
| 91 | .Fa "ASN1_INTEGER *a" | 93 | .Fa "ASN1_INTEGER *a" |
| 92 | .Fa "long v" | 94 | .Fa "long v" |
| 93 | .Fc | 95 | .Fc |
| 96 | .Ft int | ||
| 97 | .Fo ASN1_INTEGER_cmp | ||
| 98 | .Fa "const ASN1_INTEGER *a1" | ||
| 99 | .Fa "const ASN1_INTEGER *a2" | ||
| 100 | .Fc | ||
| 101 | .Ft ASN1_INTEGER * | ||
| 102 | .Fo ASN1_INTEGER_dup | ||
| 103 | .Fa "const ASN1_INTEGER *a" | ||
| 104 | .Fc | ||
| 94 | .Ft ASN1_INTEGER * | 105 | .Ft ASN1_INTEGER * |
| 95 | .Fo BN_to_ASN1_INTEGER | 106 | .Fo BN_to_ASN1_INTEGER |
| 96 | .Fa "const BIGNUM *bn" | 107 | .Fa "const BIGNUM *bn" |
| @@ -140,11 +151,35 @@ to the | |||
| 140 | type. | 151 | type. |
| 141 | .Pp | 152 | .Pp |
| 142 | .Fn ASN1_INTEGER_set | 153 | .Fn ASN1_INTEGER_set |
| 143 | sets the value of | 154 | sets the type of |
| 155 | .Fa a | ||
| 156 | to | ||
| 157 | .Dv V_ASN1_INTEGER | ||
| 158 | or | ||
| 159 | .Dv V_ASN1_NEG_INTEGER | ||
| 160 | depending on the sign of | ||
| 161 | .Fa v | ||
| 162 | and sets the value of | ||
| 144 | .Fa a | 163 | .Fa a |
| 145 | to | 164 | to |
| 146 | .Fa v . | 165 | .Fa v . |
| 147 | .Pp | 166 | .Pp |
| 167 | .Fn ASN1_INTEGER_cmp | ||
| 168 | compares the signed integer numbers represented by | ||
| 169 | .Fa a1 | ||
| 170 | and | ||
| 171 | .Fa a2 . | ||
| 172 | .Pp | ||
| 173 | .Fn ASN1_INTEGER_dup | ||
| 174 | does exactly the same as | ||
| 175 | .Xr ASN1_STRING_dup 3 | ||
| 176 | without providing any type safety, | ||
| 177 | except that it fails if the | ||
| 178 | .Xr ASN1_STRING_length 3 | ||
| 179 | of | ||
| 180 | .Fa a | ||
| 181 | is 0. | ||
| 182 | .Pp | ||
| 148 | .Fn BN_to_ASN1_INTEGER | 183 | .Fn BN_to_ASN1_INTEGER |
| 149 | converts | 184 | converts |
| 150 | .Fa bn | 185 | .Fa bn |
| @@ -215,6 +250,28 @@ and | |||
| 215 | return 1 for success or 0 for failure. | 250 | return 1 for success or 0 for failure. |
| 216 | They only fail if a memory allocation error occurs. | 251 | They only fail if a memory allocation error occurs. |
| 217 | .Pp | 252 | .Pp |
| 253 | .Fn ASN1_INTEGER_cmp | ||
| 254 | returns a value greater than, equal to, or less than 0 | ||
| 255 | if the signed integer number represented by | ||
| 256 | .Fa a1 | ||
| 257 | is greater than, equal to, or less than | ||
| 258 | the signed integer number represented by | ||
| 259 | .Fa a2 , | ||
| 260 | respectively. | ||
| 261 | .Pp | ||
| 262 | .Fn ASN1_INTEGER_dup | ||
| 263 | returns a pointer to a newly allocated | ||
| 264 | .Vt ASN1_STRING | ||
| 265 | structure or | ||
| 266 | .Dv NULL | ||
| 267 | if | ||
| 268 | .Fa a | ||
| 269 | is a | ||
| 270 | .Dv NULL | ||
| 271 | pointer, if the length of | ||
| 272 | .Fa a | ||
| 273 | is 0, or if memory allocation fails. | ||
| 274 | .Pp | ||
| 218 | .Fn BN_to_ASN1_INTEGER | 275 | .Fn BN_to_ASN1_INTEGER |
| 219 | and | 276 | and |
| 220 | .Fn BN_to_ASN1_ENUMERATED | 277 | .Fn BN_to_ASN1_ENUMERATED |
| @@ -249,7 +306,8 @@ or -1 if | |||
| 249 | .Xr BIO_write 3 | 306 | .Xr BIO_write 3 |
| 250 | fails. | 307 | fails. |
| 251 | .Sh SEE ALSO | 308 | .Sh SEE ALSO |
| 252 | .Xr ASN1_INTEGER_new 3 | 309 | .Xr ASN1_INTEGER_new 3 , |
| 310 | .Xr ASN1_STRING_length 3 | ||
| 253 | .Sh HISTORY | 311 | .Sh HISTORY |
| 254 | .Fn ASN1_INTEGER_set | 312 | .Fn ASN1_INTEGER_set |
| 255 | first appeared in SSLeay 0.5.1. | 313 | first appeared in SSLeay 0.5.1. |
| @@ -259,6 +317,10 @@ first appeared in SSLeay 0.5.1. | |||
| 259 | and | 317 | and |
| 260 | .Fn i2a_ASN1_INTEGER | 318 | .Fn i2a_ASN1_INTEGER |
| 261 | first appeared in SSLeay 0.6.0. | 319 | first appeared in SSLeay 0.6.0. |
| 320 | .Fn ASN1_INTEGER_cmp | ||
| 321 | and | ||
| 322 | .Fn ASN1_INTEGER_dup | ||
| 323 | first appeared in SSLeay 0.6.5. | ||
| 262 | These functions have been available since | 324 | These functions have been available since |
| 263 | .Ox 2.3 . | 325 | .Ox 2.3 . |
| 264 | .Pp | 326 | .Pp |
| @@ -283,3 +345,29 @@ The ambiguous return values of | |||
| 283 | and | 345 | and |
| 284 | .Fn ASN1_ENUMERATED_get | 346 | .Fn ASN1_ENUMERATED_get |
| 285 | imply that these functions should be avoided if possible. | 347 | imply that these functions should be avoided if possible. |
| 348 | .Sh BUGS | ||
| 349 | .Fn ASN1_INTEGER_cmp , | ||
| 350 | .Fn ASN1_INTEGER_dup , | ||
| 351 | .Fn ASN1_INTEGER_to_BN , | ||
| 352 | and | ||
| 353 | .Fn i2a_ASN1_INTEGER | ||
| 354 | do not check whether their arguments are really of the type | ||
| 355 | .Dv V_ASN1_INTEGER | ||
| 356 | or | ||
| 357 | .Dv V_ASN1_NEG_INTEGER . | ||
| 358 | They may report success even if their arguments are of a wrong type. | ||
| 359 | Consequently, even in case of success, the return value of | ||
| 360 | .Fn ASN1_INTEGER_dup | ||
| 361 | is not guaranteed to be of the type | ||
| 362 | .Dv V_ASN1_INTEGER | ||
| 363 | or | ||
| 364 | .Dv V_ASN1_NEG_INTEGER | ||
| 365 | either. | ||
| 366 | .Pp | ||
| 367 | Similarly, | ||
| 368 | .Fn ASN1_ENUMERATED_to_BN | ||
| 369 | does not check whether its argument is really of the type | ||
| 370 | .Dv V_ASN1_ENUMERATED | ||
| 371 | or | ||
| 372 | .Dv V_ASN1_NEG_ENUMERATED | ||
| 373 | and may report success even if the argument is of a wrong type. | ||
