summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_rand.c
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2004-03-13 23:57:20 +0000
committerGeoff Thorpe <geoff@openssl.org>2004-03-13 23:57:20 +0000
commitb6358c89a10128692875fb92921b663c4d079a1e (patch)
treed36362a84ee41209484b4b088c2b9d1728bfc613 /crypto/bn/bn_rand.c
parent5d735465d1b5b7853506979946ad5730cc3615bb (diff)
Convert openssl code not to assume the deprecated form of BN_zero().
Remove certain redundant BN_zero() initialisations, because BN_CTX_get(), BN_init(), [etc] already initialise to zero. Correct error checking in bn_sqr.c, and be less wishy-wash about how/why the result's 'top' value is set (note also, 'max' is always > 0 at this point).
Diffstat (limited to 'crypto/bn/bn_rand.c')
-rw-r--r--crypto/bn/bn_rand.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/bn/bn_rand.c b/crypto/bn/bn_rand.c
index de5a1f0c63..df45575f9a 100644
--- a/crypto/bn/bn_rand.c
+++ b/crypto/bn/bn_rand.c
@@ -244,9 +244,7 @@ static int bn_rand_range(int pseudo, BIGNUM *r, BIGNUM *range)
/* BN_is_bit_set(range, n - 1) always holds */
if (n == 1)
- {
- if (!BN_zero(r)) return 0;
- }
+ BN_zero(r);
else if (!BN_is_bit_set(range, n - 2) && !BN_is_bit_set(range, n - 3))
{
/* range = 100..._2,