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.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c
index dabc5af899..7b3bb2364d 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.13 2014/07/12 16:03:37 miod Exp $ */ 1/* $OpenBSD: ecp_smpl.c,v 1.14 2015/02/08 22:25:03 miod 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.
@@ -529,7 +529,7 @@ ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP * group, const EC_POIN
529 const BIGNUM *Z_; 529 const BIGNUM *Z_;
530 int ret = 0; 530 int ret = 0;
531 531
532 if (EC_POINT_is_at_infinity(group, point)) { 532 if (EC_POINT_is_at_infinity(group, point) > 0) {
533 ECerr(EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY); 533 ECerr(EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY);
534 return 0; 534 return 0;
535 } 535 }
@@ -637,9 +637,9 @@ ec_GFp_simple_add(const EC_GROUP * group, EC_POINT * r, const EC_POINT * a, cons
637 637
638 if (a == b) 638 if (a == b)
639 return EC_POINT_dbl(group, r, a, ctx); 639 return EC_POINT_dbl(group, r, a, ctx);
640 if (EC_POINT_is_at_infinity(group, a)) 640 if (EC_POINT_is_at_infinity(group, a) > 0)
641 return EC_POINT_copy(r, b); 641 return EC_POINT_copy(r, b);
642 if (EC_POINT_is_at_infinity(group, b)) 642 if (EC_POINT_is_at_infinity(group, b) > 0)
643 return EC_POINT_copy(r, a); 643 return EC_POINT_copy(r, a);
644 644
645 field_mul = group->meth->field_mul; 645 field_mul = group->meth->field_mul;
@@ -819,7 +819,7 @@ ec_GFp_simple_dbl(const EC_GROUP * group, EC_POINT * r, const EC_POINT * a, BN_C
819 BIGNUM *n0, *n1, *n2, *n3; 819 BIGNUM *n0, *n1, *n2, *n3;
820 int ret = 0; 820 int ret = 0;
821 821
822 if (EC_POINT_is_at_infinity(group, a)) { 822 if (EC_POINT_is_at_infinity(group, a) > 0) {
823 BN_zero(&r->Z); 823 BN_zero(&r->Z);
824 r->Z_is_one = 0; 824 r->Z_is_one = 0;
825 return 1; 825 return 1;
@@ -952,7 +952,7 @@ err:
952int 952int
953ec_GFp_simple_invert(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx) 953ec_GFp_simple_invert(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx)
954{ 954{
955 if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(&point->Y)) 955 if (EC_POINT_is_at_infinity(group, point) > 0 || BN_is_zero(&point->Y))
956 /* point is its own inverse */ 956 /* point is its own inverse */
957 return 1; 957 return 1;
958 958
@@ -977,7 +977,7 @@ ec_GFp_simple_is_on_curve(const EC_GROUP * group, const EC_POINT * point, BN_CTX
977 BIGNUM *rh, *tmp, *Z4, *Z6; 977 BIGNUM *rh, *tmp, *Z4, *Z6;
978 int ret = -1; 978 int ret = -1;
979 979
980 if (EC_POINT_is_at_infinity(group, point)) 980 if (EC_POINT_is_at_infinity(group, point) > 0)
981 return 1; 981 return 1;
982 982
983 field_mul = group->meth->field_mul; 983 field_mul = group->meth->field_mul;
@@ -1083,10 +1083,10 @@ ec_GFp_simple_cmp(const EC_GROUP * group, const EC_POINT * a, const EC_POINT * b
1083 const BIGNUM *tmp1_, *tmp2_; 1083 const BIGNUM *tmp1_, *tmp2_;
1084 int ret = -1; 1084 int ret = -1;
1085 1085
1086 if (EC_POINT_is_at_infinity(group, a)) { 1086 if (EC_POINT_is_at_infinity(group, a) > 0) {
1087 return EC_POINT_is_at_infinity(group, b) ? 0 : 1; 1087 return EC_POINT_is_at_infinity(group, b) > 0 ? 0 : 1;
1088 } 1088 }
1089 if (EC_POINT_is_at_infinity(group, b)) 1089 if (EC_POINT_is_at_infinity(group, b) > 0)
1090 return 1; 1090 return 1;
1091 1091
1092 if (a->Z_is_one && b->Z_is_one) { 1092 if (a->Z_is_one && b->Z_is_one) {
@@ -1175,7 +1175,7 @@ ec_GFp_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ctx
1175 BIGNUM *x, *y; 1175 BIGNUM *x, *y;
1176 int ret = 0; 1176 int ret = 0;
1177 1177
1178 if (point->Z_is_one || EC_POINT_is_at_infinity(group, point)) 1178 if (point->Z_is_one || EC_POINT_is_at_infinity(group, point) > 0)
1179 return 1; 1179 return 1;
1180 1180
1181 if (ctx == NULL) { 1181 if (ctx == NULL) {