diff options
author | Ulf Möller <ulf@openssl.org> | 2001-02-20 00:43:59 +0000 |
---|---|---|
committer | Ulf Möller <ulf@openssl.org> | 2001-02-20 00:43:59 +0000 |
commit | 12c2fe8d53fd43559ea862c9babfc2abf3c65299 (patch) | |
tree | af83ab96c9aad2bc15a07e4e1a44dfe0e0b0f3e2 /crypto/dh | |
parent | 28143c66e138b843b41280c0b9763f28553dc355 (diff) | |
download | openssl-12c2fe8d53fd43559ea862c9babfc2abf3c65299.tar.gz |
Use BN_rand_range().
Diffstat (limited to 'crypto/dh')
-rw-r--r-- | crypto/dh/dh_key.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/crypto/dh/dh_key.c b/crypto/dh/dh_key.c index 0e4fee101f..7a0ace72f0 100644 --- a/crypto/dh/dh_key.c +++ b/crypto/dh/dh_key.c @@ -101,7 +101,6 @@ const DH_METHOD *DH_OpenSSL(void) static int generate_key(DH *dh) { int ok=0; - unsigned int i; BN_CTX ctx; BN_MONT_CTX *mont; BIGNUM *pub_key=NULL,*priv_key=NULL; @@ -110,15 +109,9 @@ static int generate_key(DH *dh) if (dh->priv_key == NULL) { - i=dh->length; - if (i == 0) - { - /* Make the number p-1 bits long */ - i=BN_num_bits(dh->p)-1; - } priv_key=BN_new(); if (priv_key == NULL) goto err; - if (!BN_rand(priv_key,i,0,0)) goto err; + if (!BN_rand_range(priv_key, dh->p)) goto err; } else priv_key=dh->priv_key; |