yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | =pod |
| 2 | |
| 3 | =head1 NAME |
| 4 | |
| 5 | BN_zero, BN_one, BN_value_one, BN_set_word, BN_get_word - BIGNUM assignment |
| 6 | operations |
| 7 | |
| 8 | =head1 SYNOPSIS |
| 9 | |
| 10 | #include <openssl/bn.h> |
| 11 | |
| 12 | void BN_zero(BIGNUM *a); |
| 13 | int BN_one(BIGNUM *a); |
| 14 | |
| 15 | const BIGNUM *BN_value_one(void); |
| 16 | |
| 17 | int BN_set_word(BIGNUM *a, BN_ULONG w); |
| 18 | unsigned BN_ULONG BN_get_word(BIGNUM *a); |
| 19 | |
| 20 | =head1 DESCRIPTION |
| 21 | |
| 22 | B<BN_ULONG> is a macro that will be an unsigned integral type optimized |
| 23 | for the most efficient implementation on the local platform. |
| 24 | |
| 25 | BN_zero(), BN_one() and BN_set_word() set B<a> to the values 0, 1 and |
| 26 | B<w> respectively. BN_zero() and BN_one() are macros. |
| 27 | |
| 28 | BN_value_one() returns a B<BIGNUM> constant of value 1. This constant |
| 29 | is useful for use in comparisons and assignment. |
| 30 | |
| 31 | BN_get_word() returns B<a>, if it can be represented as a B<BN_ULONG>. |
| 32 | |
| 33 | =head1 RETURN VALUES |
| 34 | |
| 35 | BN_get_word() returns the value B<a>, or all-bits-set if B<a> cannot |
| 36 | be represented as a single integer. |
| 37 | |
| 38 | BN_one() and BN_set_word() return 1 on success, 0 otherwise. |
| 39 | BN_value_one() returns the constant. |
| 40 | BN_zero() never fails and returns no value. |
| 41 | |
| 42 | =head1 BUGS |
| 43 | |
| 44 | If a B<BIGNUM> is equal to the value of all-bits-set, it will collide |
| 45 | with the error condition returned by BN_get_word() which uses that |
| 46 | as an error value. |
| 47 | |
| 48 | B<BN_ULONG> should probably be a typedef. |
| 49 | |
| 50 | =head1 SEE ALSO |
| 51 | |
| 52 | L<BN_bn2bin(3)> |
| 53 | |
| 54 | =head1 HISTORY |
| 55 | |
| 56 | In OpenSSL 0.9.8, BN_zero() was changed to not return a value; previous |
| 57 | versions returned an int. |
| 58 | |
| 59 | =head1 COPYRIGHT |
| 60 | |
| 61 | Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. |
| 62 | |
| 63 | Licensed under the OpenSSL license (the "License"). You may not use |
| 64 | this file except in compliance with the License. You can obtain a copy |
| 65 | in the file LICENSE in the source distribution or at |
| 66 | L<https://www.openssl.org/source/license.html>. |
| 67 | |
| 68 | =cut |