[openssl-commits] [openssl] master update
Rich Salz
rsalz at openssl.org
Thu Feb 4 13:03:18 UTC 2016
The branch master has been updated
via 3a6a4a93518fbb3d96632bfdcb538d340f29c56b (commit)
from b1413d9bd9d2222823ca1ba2d6cdf4849e635231 (commit)
- Log -----------------------------------------------------------------
commit 3a6a4a93518fbb3d96632bfdcb538d340f29c56b
Author: Billy Brumley <bbrumley at gmail.com>
Date: Wed Jan 20 13:18:21 2016 +0200
Fix BN_gcd errors for some curves
Those even order that do not play nicely with Montgomery arithmetic
Signed-off-by: Rich Salz <rsalz at openssl.org>
Reviewed-by: Emilia Käsper <emilia at openssl.org>
-----------------------------------------------------------------------
Summary of changes:
crypto/ec/ec_lib.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c
index abb15a5..a34113c 100644
--- a/crypto/ec/ec_lib.c
+++ b/crypto/ec/ec_lib.c
@@ -327,13 +327,18 @@ int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
} else
BN_zero(group->cofactor);
+
/*
- * We ignore the return value because some groups have an order with
+ * Some groups have an order with
* factors of two, which makes the Montgomery setup fail.
* |group->mont_data| will be NULL in this case.
*/
- ec_precompute_mont_data(group);
+ if (BN_is_odd(group->order)) {
+ return ec_precompute_mont_data(group);
+ }
+ BN_MONT_CTX_free(group->mont_data);
+ group->mont_data = NULL;
return 1;
}
More information about the openssl-commits
mailing list