diff options
| author | tb <> | 2018-11-06 07:02:33 +0000 |
|---|---|---|
| committer | tb <> | 2018-11-06 07:02:33 +0000 |
| commit | b1f2fa8da88f8be2fe7d6d9d2b8308537fcfb408 (patch) | |
| tree | 1f596901d57af99b215ca32a39768fc112724428 /src/lib/libcrypto/ec | |
| parent | 5733d08d40f3af89bccdede48bc95c6b840c337a (diff) | |
| download | openbsd-b1f2fa8da88f8be2fe7d6d9d2b8308537fcfb408.tar.gz openbsd-b1f2fa8da88f8be2fe7d6d9d2b8308537fcfb408.tar.bz2 openbsd-b1f2fa8da88f8be2fe7d6d9d2b8308537fcfb408.zip | |
unrevert the use of bn_rand_interval().
ok beck jsing
Diffstat (limited to 'src/lib/libcrypto/ec')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_key.c | 9 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_smpl.c | 8 |
3 files changed, 9 insertions, 12 deletions
diff --git a/src/lib/libcrypto/ec/ec_key.c b/src/lib/libcrypto/ec/ec_key.c index ca49c7676e..6ab4d3c9a4 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.20 2018/11/06 02:14:39 tb Exp $ */ | 1 | /* $OpenBSD: ec_key.c,v 1.21 2018/11/06 07:02:33 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,6 +65,7 @@ | |||
| 65 | 65 | ||
| 66 | #include <openssl/opensslconf.h> | 66 | #include <openssl/opensslconf.h> |
| 67 | 67 | ||
| 68 | #include "bn_lcl.h" | ||
| 68 | #include "ec_lcl.h" | 69 | #include "ec_lcl.h" |
| 69 | #include <openssl/err.h> | 70 | #include <openssl/err.h> |
| 70 | 71 | ||
| @@ -231,10 +232,8 @@ EC_KEY_generate_key(EC_KEY *eckey) | |||
| 231 | if (!EC_GROUP_get_order(eckey->group, order, ctx)) | 232 | if (!EC_GROUP_get_order(eckey->group, order, ctx)) |
| 232 | goto err; | 233 | goto err; |
| 233 | 234 | ||
| 234 | do | 235 | if (!bn_rand_interval(priv_key, BN_value_one(), order)) |
| 235 | if (!BN_rand_range(priv_key, order)) | 236 | goto err; |
| 236 | goto err; | ||
| 237 | while (BN_is_zero(priv_key)); | ||
| 238 | 237 | ||
| 239 | if (pub_key == NULL) { | 238 | if (pub_key == NULL) { |
| 240 | if ((pub_key = EC_POINT_new(eckey->group)) == NULL) | 239 | if ((pub_key = EC_POINT_new(eckey->group)) == NULL) |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index bf2f652fc7..e5d9620a00 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_lib.c,v 1.30 2018/11/05 20:18:21 tb Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.31 2018/11/06 07:02:33 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -547,7 +547,7 @@ ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx) | |||
| 547 | { | 547 | { |
| 548 | if (group->meth->blind_coordinates == NULL) | 548 | if (group->meth->blind_coordinates == NULL) |
| 549 | return 1; | 549 | return 1; |
| 550 | 550 | ||
| 551 | return group->meth->blind_coordinates(group, p, ctx); | 551 | return group->meth->blind_coordinates(group, p, ctx); |
| 552 | } | 552 | } |
| 553 | 553 | ||
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c index e379a74fb1..c64c41130a 100644 --- a/src/lib/libcrypto/ec/ecp_smpl.c +++ b/src/lib/libcrypto/ec/ecp_smpl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ecp_smpl.c,v 1.27 2018/11/06 06:59:25 tb Exp $ */ | 1 | /* $OpenBSD: ecp_smpl.c,v 1.28 2018/11/06 07:02:33 tb Exp $ */ |
| 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
| 3 | * for the OpenSSL project. | 3 | * for the OpenSSL project. |
| 4 | * Includes code written by Bodo Moeller for the OpenSSL project. | 4 | * Includes code written by Bodo Moeller for the OpenSSL project. |
| @@ -1434,10 +1434,8 @@ ec_GFp_simple_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx) | |||
| 1434 | goto err; | 1434 | goto err; |
| 1435 | 1435 | ||
| 1436 | /* Generate lambda in [1, group->field - 1] */ | 1436 | /* Generate lambda in [1, group->field - 1] */ |
| 1437 | do { | 1437 | if (!bn_rand_interval(lambda, BN_value_one(), &group->field)) |
| 1438 | if (!BN_rand_range(lambda, &group->field)) | 1438 | goto err; |
| 1439 | goto err; | ||
| 1440 | } while (BN_is_zero(lambda)); | ||
| 1441 | 1439 | ||
| 1442 | if (group->meth->field_encode != NULL && | 1440 | if (group->meth->field_encode != NULL && |
| 1443 | !group->meth->field_encode(group, lambda, lambda, ctx)) | 1441 | !group->meth->field_encode(group, lambda, lambda, ctx)) |
