From 9fe67d92c844ca96428126668ee46195c6fdb009 Mon Sep 17 00:00:00 2001 From: tb <> Date: Mon, 5 Nov 2018 23:54:27 +0000 Subject: Make use of bn_rand_interval() where appropriate. ok beck jsing --- src/lib/libcrypto/dsa/dsa_key.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/lib/libcrypto/dsa/dsa_key.c') diff --git a/src/lib/libcrypto/dsa/dsa_key.c b/src/lib/libcrypto/dsa/dsa_key.c index 520b980983..7ead1f30cc 100644 --- a/src/lib/libcrypto/dsa/dsa_key.c +++ b/src/lib/libcrypto/dsa/dsa_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_key.c,v 1.25 2018/11/05 23:50:05 tb Exp $ */ +/* $OpenBSD: dsa_key.c,v 1.26 2018/11/05 23:54:27 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -92,10 +92,8 @@ dsa_builtin_keygen(DSA *dsa) goto err; } - do { - if (!BN_rand_range(priv_key, dsa->q)) - goto err; - } while (BN_is_zero(priv_key)); + if (!bn_rand_interval(priv_key, BN_value_one(), dsa->q)) + goto err; if (pub_key == NULL) { if ((pub_key = BN_new()) == NULL) -- cgit v1.2.3-55-g6feb