summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec_key.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ec/ec_key.c')
-rw-r--r--src/lib/libcrypto/ec/ec_key.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libcrypto/ec/ec_key.c b/src/lib/libcrypto/ec/ec_key.c
index 8c6f3186ca..ca49c7676e 100644
--- a/src/lib/libcrypto/ec/ec_key.c
+++ b/src/lib/libcrypto/ec/ec_key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec_key.c,v 1.19 2018/11/05 23:54:27 tb Exp $ */ 1/* $OpenBSD: ec_key.c,v 1.20 2018/11/06 02:14:39 tb Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project. 3 * Written by Nils Larsch for the OpenSSL project.
4 */ 4 */
@@ -65,7 +65,6 @@
65 65
66#include <openssl/opensslconf.h> 66#include <openssl/opensslconf.h>
67 67
68#include "bn_lcl.h"
69#include "ec_lcl.h" 68#include "ec_lcl.h"
70#include <openssl/err.h> 69#include <openssl/err.h>
71 70
@@ -232,8 +231,10 @@ EC_KEY_generate_key(EC_KEY *eckey)
232 if (!EC_GROUP_get_order(eckey->group, order, ctx)) 231 if (!EC_GROUP_get_order(eckey->group, order, ctx))
233 goto err; 232 goto err;
234 233
235 if (!bn_rand_interval(priv_key, BN_value_one(), order)) 234 do
236 goto err; 235 if (!BN_rand_range(priv_key, order))
236 goto err;
237 while (BN_is_zero(priv_key));
237 238
238 if (pub_key == NULL) { 239 if (pub_key == NULL) {
239 if ((pub_key = EC_POINT_new(eckey->group)) == NULL) 240 if ((pub_key = EC_POINT_new(eckey->group)) == NULL)