summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ec/ec_lib.c')
-rw-r--r--src/lib/libcrypto/ec/ec_lib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c
index 888f1edfcf..4ec17d5d5d 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.44 2022/03/29 14:03:12 tb Exp $ */ 1/* $OpenBSD: ec_lib.c,v 1.45 2022/04/07 17:37:25 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 */
@@ -348,10 +348,10 @@ EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator,
348 } 348 }
349 349
350 /* 350 /*
351 * Require order >= 1 and enforce an upper bound of at most one bit more 351 * Require order > 1 and enforce an upper bound of at most one bit more
352 * than the field cardinality due to Hasse's theorem. 352 * than the field cardinality due to Hasse's theorem.
353 */ 353 */
354 if (order == NULL || BN_is_zero(order) || BN_is_negative(order) || 354 if (order == NULL || BN_cmp(order, BN_value_one()) <= 0 ||
355 BN_num_bits(order) > BN_num_bits(&group->field) + 1) { 355 BN_num_bits(order) > BN_num_bits(&group->field) + 1) {
356 ECerror(EC_R_INVALID_GROUP_ORDER); 356 ECerror(EC_R_INVALID_GROUP_ORDER);
357 return 0; 357 return 0;