xref: /freebsd/crypto/openssl/doc/man3/BN_zero.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
5e71b7053SJung-uk KimBN_zero, BN_one, BN_value_one, BN_set_word, BN_get_word - BIGNUM assignment
6e71b7053SJung-uk Kimoperations
7e71b7053SJung-uk Kim
8e71b7053SJung-uk Kim=head1 SYNOPSIS
9e71b7053SJung-uk Kim
10e71b7053SJung-uk Kim #include <openssl/bn.h>
11e71b7053SJung-uk Kim
12e71b7053SJung-uk Kim void BN_zero(BIGNUM *a);
13e71b7053SJung-uk Kim int BN_one(BIGNUM *a);
14e71b7053SJung-uk Kim
15e71b7053SJung-uk Kim const BIGNUM *BN_value_one(void);
16e71b7053SJung-uk Kim
17e71b7053SJung-uk Kim int BN_set_word(BIGNUM *a, BN_ULONG w);
18e71b7053SJung-uk Kim unsigned BN_ULONG BN_get_word(BIGNUM *a);
19e71b7053SJung-uk Kim
20e71b7053SJung-uk Kim=head1 DESCRIPTION
21e71b7053SJung-uk Kim
22e71b7053SJung-uk KimB<BN_ULONG> is a macro that will be an unsigned integral type optimized
23e71b7053SJung-uk Kimfor the most efficient implementation on the local platform.
24e71b7053SJung-uk Kim
25e71b7053SJung-uk KimBN_zero(), BN_one() and BN_set_word() set B<a> to the values 0, 1 and
26e71b7053SJung-uk KimB<w> respectively.  BN_zero() and BN_one() are macros.
27e71b7053SJung-uk Kim
28e71b7053SJung-uk KimBN_value_one() returns a B<BIGNUM> constant of value 1. This constant
29e71b7053SJung-uk Kimis useful for use in comparisons and assignment.
30e71b7053SJung-uk Kim
31e71b7053SJung-uk KimBN_get_word() returns B<a>, if it can be represented as a B<BN_ULONG>.
32e71b7053SJung-uk Kim
33e71b7053SJung-uk Kim=head1 RETURN VALUES
34e71b7053SJung-uk Kim
35e71b7053SJung-uk KimBN_get_word() returns the value B<a>, or all-bits-set if B<a> cannot
36e71b7053SJung-uk Kimbe represented as a single integer.
37e71b7053SJung-uk Kim
38e71b7053SJung-uk KimBN_one() and BN_set_word() return 1 on success, 0 otherwise.
39e71b7053SJung-uk KimBN_value_one() returns the constant.
40e71b7053SJung-uk KimBN_zero() never fails and returns no value.
41e71b7053SJung-uk Kim
42e71b7053SJung-uk Kim=head1 BUGS
43e71b7053SJung-uk Kim
44e71b7053SJung-uk KimIf a B<BIGNUM> is equal to the value of all-bits-set, it will collide
45e71b7053SJung-uk Kimwith the error condition returned by BN_get_word() which uses that
46e71b7053SJung-uk Kimas an error value.
47e71b7053SJung-uk Kim
48e71b7053SJung-uk KimB<BN_ULONG> should probably be a typedef.
49e71b7053SJung-uk Kim
50e71b7053SJung-uk Kim=head1 SEE ALSO
51e71b7053SJung-uk Kim
52e71b7053SJung-uk KimL<BN_bn2bin(3)>
53e71b7053SJung-uk Kim
54e71b7053SJung-uk Kim=head1 HISTORY
55e71b7053SJung-uk Kim
56e71b7053SJung-uk KimIn OpenSSL 0.9.8, BN_zero() was changed to not return a value; previous
57e71b7053SJung-uk Kimversions returned an int.
58e71b7053SJung-uk Kim
59e71b7053SJung-uk Kim=head1 COPYRIGHT
60e71b7053SJung-uk Kim
61e71b7053SJung-uk KimCopyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
62e71b7053SJung-uk Kim
63*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
64e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
65e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
66e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
67e71b7053SJung-uk Kim
68e71b7053SJung-uk Kim=cut
69