OpenSSL 1.1.1-pre2
This commit is contained in:
+6
-6
@@ -111,14 +111,14 @@ static int generate_key(DH *dh)
|
||||
if (generate_new_key) {
|
||||
if (dh->q) {
|
||||
do {
|
||||
if (!BN_rand_range(priv_key, dh->q))
|
||||
if (!BN_priv_rand_range(priv_key, dh->q))
|
||||
goto err;
|
||||
}
|
||||
while (BN_is_zero(priv_key) || BN_is_one(priv_key));
|
||||
} else {
|
||||
/* secret exponent length */
|
||||
l = dh->length ? dh->length : BN_num_bits(dh->p) - 1;
|
||||
if (!BN_rand(priv_key, l, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY))
|
||||
if (!BN_priv_rand(priv_key, l, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ static int generate_key(DH *dh)
|
||||
if (priv_key != dh->priv_key)
|
||||
BN_free(priv_key);
|
||||
BN_CTX_free(ctx);
|
||||
return (ok);
|
||||
return ok;
|
||||
}
|
||||
|
||||
static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
|
||||
@@ -204,7 +204,7 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
|
||||
BN_CTX_end(ctx);
|
||||
BN_CTX_free(ctx);
|
||||
}
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dh_bn_mod_exp(const DH *dh, BIGNUM *r,
|
||||
@@ -217,11 +217,11 @@ static int dh_bn_mod_exp(const DH *dh, BIGNUM *r,
|
||||
static int dh_init(DH *dh)
|
||||
{
|
||||
dh->flags |= DH_FLAG_CACHE_MONT_P;
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int dh_finish(DH *dh)
|
||||
{
|
||||
BN_MONT_CTX_free(dh->method_mont_p);
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user