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