summaryrefslogtreecommitdiffstats
path: root/crypto/bn
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2001-02-10 00:34:02 +0000
committerBodo Möller <bodo@openssl.org>2001-02-10 00:34:02 +0000
commite306892994a0f189089916d2ea66b3bdc0b2d777 (patch)
tree94199007669d4e72e954df3615b86bae9a3c742c /crypto/bn
parent836f996010d6a5f38d9a13279c37e84a42819966 (diff)
Simplify BN_rand_range
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/bn.h2
-rw-r--r--crypto/bn/bn_rand.c10
2 files changed, 4 insertions, 8 deletions
diff --git a/crypto/bn/bn.h b/crypto/bn/bn.h
index 8b2b970995..e2a17a0877 100644
--- a/crypto/bn/bn.h
+++ b/crypto/bn/bn.h
@@ -329,7 +329,7 @@ BIGNUM *BN_CTX_get(BN_CTX *ctx);
void BN_CTX_end(BN_CTX *ctx);
int BN_rand(BIGNUM *rnd, int bits, int top,int bottom);
int BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom);
-int BN_rand_range(BIGNUM *rnd, BIGNUM *min, BIGNUM *range);
+int BN_rand_range(BIGNUM *rnd, BIGNUM *range);
int BN_num_bits(const BIGNUM *a);
int BN_num_bits_word(BN_ULONG);
BIGNUM *BN_new(void);
diff --git a/crypto/bn/bn_rand.c b/crypto/bn/bn_rand.c
index c5c14130a3..54d622e6b4 100644
--- a/crypto/bn/bn_rand.c
+++ b/crypto/bn/bn_rand.c
@@ -169,8 +169,9 @@ int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
}
#endif
-/* random number r: min <= r < min+range */
-int BN_rand_range(BIGNUM *r, BIGNUM *min, BIGNUM *range)
+
+/* random number r: 0 <= r < range */
+int BN_rand_range(BIGNUM *r, BIGNUM *range)
{
int n;
@@ -217,10 +218,5 @@ int BN_rand_range(BIGNUM *r, BIGNUM *min, BIGNUM *range)
while (BN_cmp(r, range) >= 0);
}
- if (min != NULL)
- {
- if (!BN_add(r, r, min)) return 0;
- }
-
return 1;
}