Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/dh/dh.c')
-rw-r--r--crypto/dh/dh.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/crypto/dh/dh.c b/crypto/dh/dh.c
index 94eb3643..eea14325 100644
--- a/crypto/dh/dh.c
+++ b/crypto/dh/dh.c
@@ -275,11 +275,9 @@ int DH_generate_key(DH *dh) {
if (generate_new_key) {
if (dh->q) {
- do {
- if (!BN_rand_range(priv_key, dh->q)) {
- goto err;
- }
- } while (BN_is_zero(priv_key) || BN_is_one(priv_key));
+ if (!BN_rand_range_ex(priv_key, 2, dh->q)) {
+ goto err;
+ }
} else {
/* secret exponent length */
DH_check_standard_parameters(dh);