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