The efforts to eliminate the dual-representation of zero and to ensure
authorGeoff Thorpe <geoff@openssl.org>
Sat, 13 Mar 2004 23:04:15 +0000 (23:04 +0000)
committerGeoff Thorpe <geoff@openssl.org>
Sat, 13 Mar 2004 23:04:15 +0000 (23:04 +0000)
commit5d735465d1b5b7853506979946ad5730cc3615bb
tree36cb4ab497280280a9a8f163853c9362b0ca424c
parent9e051bac139ce07f846d88b90f3ec514c39ea416
The efforts to eliminate the dual-representation of zero and to ensure
bignums are passed in and out of functions and APIs in a consistent form
has highlighted that zero-valued bignums don't need any allocated word
data. The use of BN_set_word() to initialise a bignum to zero causes
needless allocation and gives it a return value that must be checked. This
change converts BN_zero() to a self-contained macro that has no
return/expression value and does not cause any expansion of bignum data.

Note, it would be tempting to rewrite the deprecated version as a
success-valued comma expression, such as;
   #define BN_zero(a) ((a)->top = (a)->neg = 0, 1)
However, this evaluates 'a' twice and would confuse initialisation loops
(eg. while(..) { BN_zero(bn++) } ). As such, the deprecated version
continues to use BN_set_word().
crypto/bn/bn.h