summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_prime.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2016-08-08 22:12:28 -0400
committerRich Salz <rsalz@openssl.org>2016-08-10 10:07:37 -0400
commit2301d91dd58d9827865e360d616291f2549ec5bf (patch)
tree0b60f1e481fbf8c4afc49f493d59a3c8961febb8 /crypto/bn/bn_prime.c
parentf67cbb74437842a0f88f84f43a0faa968ca77b35 (diff)
Change callers to use the new constants.
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1429)
Diffstat (limited to 'crypto/bn/bn_prime.c')
-rw-r--r--crypto/bn/bn_prime.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c
index 8e7f4f5676..51969583e7 100644
--- a/crypto/bn/bn_prime.c
+++ b/crypto/bn/bn_prime.c
@@ -310,7 +310,7 @@ int bn_probable_prime_dh_retry(BIGNUM *rnd, int bits, BN_CTX *ctx)
int ret = 0;
loop:
- if (!BN_rand(rnd, bits, 0, 1))
+ if (!BN_rand(rnd, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD))
goto err;
/* we now have a random number 'rand' to test. */
@@ -350,7 +350,8 @@ int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx)
goto err;
loop:
- if (!BN_rand(rnd, bits - prime_multiplier_bits, 0, 1))
+ if (!BN_rand(rnd, bits - prime_multiplier_bits,
+ BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD))
goto err;
if (BN_is_bit_set(rnd, bits))
goto loop;
@@ -415,7 +416,7 @@ static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods)
char is_single_word = bits <= BN_BITS2;
again:
- if (!BN_rand(rnd, bits, 1, 1))
+ if (!BN_rand(rnd, bits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ODD))
return (0);
/* we now have a random number 'rnd' to test. */
for (i = 1; i < NUMPRIMES; i++) {
@@ -499,7 +500,7 @@ int bn_probable_prime_dh(BIGNUM *rnd, int bits,
if ((t1 = BN_CTX_get(ctx)) == NULL)
goto err;
- if (!BN_rand(rnd, bits, 0, 1))
+ if (!BN_rand(rnd, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD))
goto err;
/* we need ((rnd-rem) % add) == 0 */
@@ -555,7 +556,7 @@ static int probable_prime_dh_safe(BIGNUM *p, int bits, const BIGNUM *padd,
if (!BN_rshift1(qadd, padd))
goto err;
- if (!BN_rand(q, bits, 0, 1))
+ if (!BN_rand(q, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD))
goto err;
/* we need ((rnd-rem) % add) == 0 */