提交 e5cb2603 编写于 作者: B Bodo Möller

DH key generation should not use a do ... while loop,

or bogus DH parameters can be used for launching DOS attacks
上级 6aecef81
...@@ -135,13 +135,9 @@ static int generate_key(DH *dh) ...@@ -135,13 +135,9 @@ static int generate_key(DH *dh)
l = dh->length ? dh->length : BN_num_bits(dh->p)-1; /* secret exponent length */ l = dh->length ? dh->length : BN_num_bits(dh->p)-1; /* secret exponent length */
do if (!BN_rand(priv_key, l, 0, 0)) goto err;
{ if (!ENGINE_get_DH(dh->engine)->bn_mod_exp(dh, pub_key, dh->g,
if (!BN_rand(priv_key, l, 0, 0)) goto err; priv_key,dh->p,ctx,mont)) goto err;
if (!ENGINE_get_DH(dh->engine)->bn_mod_exp(dh, pub_key, dh->g,
priv_key,dh->p,ctx,mont)) goto err;
}
while (BN_is_one(priv_key));
dh->pub_key=pub_key; dh->pub_key=pub_key;
dh->priv_key=priv_key; dh->priv_key=priv_key;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册