From 48f2ef8d004f1fa043238bd87b5976c53d278b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulf=20M=C3=B6ller?= Date: Tue, 20 Feb 2001 16:17:25 +0000 Subject: [PATCH] make it a loop as in dsa --- crypto/dh/dh_key.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crypto/dh/dh_key.c b/crypto/dh/dh_key.c index 7a0ace72f0..ad86048a36 100644 --- a/crypto/dh/dh_key.c +++ b/crypto/dh/dh_key.c @@ -111,7 +111,9 @@ static int generate_key(DH *dh) { priv_key=BN_new(); if (priv_key == NULL) goto err; - if (!BN_rand_range(priv_key, dh->p)) goto err; + do + if (!BN_rand_range(priv_key, dh->p)) goto err; + while (BN_is_zero(priv_key)); } else priv_key=dh->priv_key; -- GitLab