From c11dead17c0808e1a312ca02a849ed5cdd74c535 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ulf=20M=C3=B6ller?= Date: Wed, 13 Sep 2000 01:45:54 +0000 Subject: [PATCH] Don't set the two top bits to one when generating a random number < q.:wq --- crypto/dsa/dsa_key.c | 2 +- crypto/dsa/dsa_ossl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crypto/dsa/dsa_key.c b/crypto/dsa/dsa_key.c index 5aef2d5fcf..af3c56d770 100644 --- a/crypto/dsa/dsa_key.c +++ b/crypto/dsa/dsa_key.c @@ -84,7 +84,7 @@ int DSA_generate_key(DSA *dsa) i=BN_num_bits(dsa->q); for (;;) { - if (!BN_rand(priv_key,i,1,0)) + if (!BN_rand(priv_key,i,0,0)) goto err; if (BN_cmp(priv_key,dsa->q) >= 0) BN_sub(priv_key,priv_key,dsa->q); diff --git a/crypto/dsa/dsa_ossl.c b/crypto/dsa/dsa_ossl.c index b51cf6ad8d..094356518f 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 */ for (;;) { - if (!BN_rand(&k, BN_num_bits(dsa->q), 1, 0)) goto err; + if (!BN_rand(&k, BN_num_bits(dsa->q), 0, 0)) goto err; if (BN_cmp(&k,dsa->q) >= 0) BN_sub(&k,&k,dsa->q); if (!BN_is_zero(&k)) break; -- 2.25.1