diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bn/bn.h | 2 | ||||
-rw-r--r-- | crypto/bn/bn_rand.c | 10 | ||||
-rw-r--r-- | crypto/dsa/dsa_ossl.c | 2 |
3 files changed, 5 insertions, 9 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; } diff --git a/crypto/dsa/dsa_ossl.c b/crypto/dsa/dsa_ossl.c index 1967290baf..7346817337 100644 --- a/crypto/dsa/dsa_ossl.c +++ b/crypto/dsa/dsa_ossl.c @@ -181,7 +181,7 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) /* Get random k */ do - if (!BN_rand_range(&k, NULL, dsa->q)) goto err; + if (!BN_rand_range(&k, dsa->q)) goto err; while (BN_is_zero(&k)); if ((dsa->method_mont_p == NULL) && (dsa->flags & DSA_FLAG_CACHE_MONT_P)) |