summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ecp_smpl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ec/ecp_smpl.c')
-rw-r--r--src/lib/libcrypto/ec/ecp_smpl.c20
1 files changed, 10 insertions, 10 deletions
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
885int 885int
886ec_GFp_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) 886ec_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);