diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_key.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_smpl.c | 20 |
3 files changed, 15 insertions, 15 deletions
diff --git a/src/lib/libcrypto/ec/ec_key.c b/src/lib/libcrypto/ec/ec_key.c index 38a5582ba0..21c22823f9 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.41 2024/10/22 12:02:43 tb Exp $ */ | 1 | /* $OpenBSD: ec_key.c,v 1.42 2024/11/05 08:56:57 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
| 4 | */ | 4 | */ |
| @@ -287,7 +287,7 @@ EC_KEY_check_key(const EC_KEY *eckey) | |||
| 287 | goto err; | 287 | goto err; |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key) > 0) { | 290 | if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key)) { |
| 291 | ECerror(EC_R_POINT_AT_INFINITY); | 291 | ECerror(EC_R_POINT_AT_INFINITY); |
| 292 | goto err; | 292 | goto err; |
| 293 | } | 293 | } |
| @@ -313,7 +313,7 @@ EC_KEY_check_key(const EC_KEY *eckey) | |||
| 313 | ECerror(ERR_R_EC_LIB); | 313 | ECerror(ERR_R_EC_LIB); |
| 314 | goto err; | 314 | goto err; |
| 315 | } | 315 | } |
| 316 | if (EC_POINT_is_at_infinity(eckey->group, point) <= 0) { | 316 | if (!EC_POINT_is_at_infinity(eckey->group, point)) { |
| 317 | ECerror(EC_R_WRONG_ORDER); | 317 | ECerror(EC_R_WRONG_ORDER); |
| 318 | goto err; | 318 | goto err; |
| 319 | } | 319 | } |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 0d28df59ba..15e5055f34 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.78 2024/11/04 13:19:08 tb Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.79 2024/11/05 08:56:57 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 | */ |
| @@ -650,7 +650,7 @@ EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx_in) | |||
| 650 | } | 650 | } |
| 651 | if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx)) | 651 | if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx)) |
| 652 | goto err; | 652 | goto err; |
| 653 | if (EC_POINT_is_at_infinity(group, point) <= 0) { | 653 | if (!EC_POINT_is_at_infinity(group, point)) { |
| 654 | ECerror(EC_R_INVALID_GROUP_ORDER); | 654 | ECerror(EC_R_INVALID_GROUP_ORDER); |
| 655 | goto err; | 655 | goto err; |
| 656 | } | 656 | } |
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c index 37e2d50d64..6430857e0f 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.60 2024/11/03 15:47:11 tb Exp $ */ | 1 | /* $OpenBSD: ecp_smpl.c,v 1.61 2024/11/05 08:56:57 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. |
| @@ -577,9 +577,9 @@ ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const E | |||
| 577 | 577 | ||
| 578 | if (a == b) | 578 | if (a == b) |
| 579 | return EC_POINT_dbl(group, r, a, ctx); | 579 | return EC_POINT_dbl(group, r, a, ctx); |
| 580 | if (EC_POINT_is_at_infinity(group, a) > 0) | 580 | if (EC_POINT_is_at_infinity(group, a)) |
| 581 | return EC_POINT_copy(r, b); | 581 | return EC_POINT_copy(r, b); |
| 582 | if (EC_POINT_is_at_infinity(group, b) > 0) | 582 | if (EC_POINT_is_at_infinity(group, b)) |
| 583 | return EC_POINT_copy(r, a); | 583 | return EC_POINT_copy(r, a); |
| 584 | 584 | ||
| 585 | field_mul = group->meth->field_mul; | 585 | field_mul = group->meth->field_mul; |
| @@ -757,7 +757,7 @@ ec_GFp_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX | |||
| 757 | BIGNUM *n0, *n1, *n2, *n3; | 757 | BIGNUM *n0, *n1, *n2, *n3; |
| 758 | int ret = 0; | 758 | int ret = 0; |
| 759 | 759 | ||
| 760 | if (EC_POINT_is_at_infinity(group, a) > 0) | 760 | if (EC_POINT_is_at_infinity(group, a)) |
| 761 | return EC_POINT_set_to_infinity(group, r); | 761 | return EC_POINT_set_to_infinity(group, r); |
| 762 | 762 | ||
| 763 | field_mul = group->meth->field_mul; | 763 | field_mul = group->meth->field_mul; |
| @@ -885,7 +885,7 @@ ec_GFp_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX | |||
| 885 | int | 885 | int |
| 886 | ec_GFp_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | 886 | ec_GFp_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) |
| 887 | { | 887 | { |
| 888 | if (EC_POINT_is_at_infinity(group, point) > 0 || BN_is_zero(&point->Y)) | 888 | if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(&point->Y)) |
| 889 | /* point is its own inverse */ | 889 | /* point is its own inverse */ |
| 890 | return 1; | 890 | return 1; |
| 891 | 891 | ||
| @@ -907,7 +907,7 @@ ec_GFp_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX * | |||
| 907 | BIGNUM *rh, *tmp, *Z4, *Z6; | 907 | BIGNUM *rh, *tmp, *Z4, *Z6; |
| 908 | int ret = -1; | 908 | int ret = -1; |
| 909 | 909 | ||
| 910 | if (EC_POINT_is_at_infinity(group, point) > 0) | 910 | if (EC_POINT_is_at_infinity(group, point)) |
| 911 | return 1; | 911 | return 1; |
| 912 | 912 | ||
| 913 | field_mul = group->meth->field_mul; | 913 | field_mul = group->meth->field_mul; |
| @@ -1009,10 +1009,10 @@ ec_GFp_simple_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, B | |||
| 1009 | const BIGNUM *tmp1_, *tmp2_; | 1009 | const BIGNUM *tmp1_, *tmp2_; |
| 1010 | int ret = -1; | 1010 | int ret = -1; |
| 1011 | 1011 | ||
| 1012 | if (EC_POINT_is_at_infinity(group, a) > 0) | 1012 | if (EC_POINT_is_at_infinity(group, a)) |
| 1013 | return EC_POINT_is_at_infinity(group, b) > 0 ? 0 : 1; | 1013 | return !EC_POINT_is_at_infinity(group, b); |
| 1014 | 1014 | ||
| 1015 | if (EC_POINT_is_at_infinity(group, b) > 0) | 1015 | if (EC_POINT_is_at_infinity(group, b)) |
| 1016 | return 1; | 1016 | return 1; |
| 1017 | 1017 | ||
| 1018 | if (a->Z_is_one && b->Z_is_one) | 1018 | if (a->Z_is_one && b->Z_is_one) |
| @@ -1097,7 +1097,7 @@ ec_GFp_simple_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | |||
| 1097 | BIGNUM *x, *y; | 1097 | BIGNUM *x, *y; |
| 1098 | int ret = 0; | 1098 | int ret = 0; |
| 1099 | 1099 | ||
| 1100 | if (point->Z_is_one || EC_POINT_is_at_infinity(group, point) > 0) | 1100 | if (point->Z_is_one || EC_POINT_is_at_infinity(group, point)) |
| 1101 | return 1; | 1101 | return 1; |
| 1102 | 1102 | ||
| 1103 | BN_CTX_start(ctx); | 1103 | BN_CTX_start(ctx); |
