diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2018-11-06 02:14:40 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2018-11-06 02:14:40 +0000 |
commit | 9f7673536ad468defcde6c34b03ef75280c30115 (patch) | |
tree | ec2e66ec254c5ca9d3a1d5eb08bb8a2494080183 /lib/libcrypto/ec | |
parent | 5579f178d1907d804e7d7a10d9b4cb0564f5650e (diff) |
revert use of bn_rand_interval due to failures with ECDHE and TLS
Diffstat (limited to 'lib/libcrypto/ec')
-rw-r--r-- | lib/libcrypto/ec/ec_key.c | 9 | ||||
-rw-r--r-- | lib/libcrypto/ec/ecp_smpl.c | 8 |
2 files changed, 10 insertions, 7 deletions
diff --git a/lib/libcrypto/ec/ec_key.c b/lib/libcrypto/ec/ec_key.c index 8c6f3186ca9..ca49c7676ea 100644 --- a/lib/libcrypto/ec/ec_key.c +++ b/lib/libcrypto/ec/ec_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_key.c,v 1.19 2018/11/05 23:54:27 tb Exp $ */ +/* $OpenBSD: ec_key.c,v 1.20 2018/11/06 02:14:39 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -65,7 +65,6 @@ #include <openssl/opensslconf.h> -#include "bn_lcl.h" #include "ec_lcl.h" #include <openssl/err.h> @@ -232,8 +231,10 @@ EC_KEY_generate_key(EC_KEY *eckey) if (!EC_GROUP_get_order(eckey->group, order, ctx)) goto err; - if (!bn_rand_interval(priv_key, BN_value_one(), order)) - goto err; + do + if (!BN_rand_range(priv_key, order)) + goto err; + while (BN_is_zero(priv_key)); if (pub_key == NULL) { if ((pub_key = EC_POINT_new(eckey->group)) == NULL) diff --git a/lib/libcrypto/ec/ecp_smpl.c b/lib/libcrypto/ec/ecp_smpl.c index 96c1e8a2781..24054a51c5c 100644 --- a/lib/libcrypto/ec/ecp_smpl.c +++ b/lib/libcrypto/ec/ecp_smpl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecp_smpl.c,v 1.24 2018/11/05 23:54:27 tb Exp $ */ +/* $OpenBSD: ecp_smpl.c,v 1.25 2018/11/06 02:14:39 tb Exp $ */ /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> * for the OpenSSL project. * Includes code written by Bodo Moeller for the OpenSSL project. @@ -1434,8 +1434,10 @@ ec_GFp_simple_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx) goto err; /* Generate lambda in [1, group->field - 1] */ - if (!bn_rand_interval(lambda, BN_value_one(), &group->field)) - goto err; + do { + if (!BN_rand_range(lambda, &group->field)) + goto err; + } while (BN_is_zero(lambda)); if (group->meth->field_encode != NULL && !group->meth->field_encode(group, lambda, lambda, ctx)) |