summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ec2_smpl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ec/ec2_smpl.c')
-rw-r--r--src/lib/libcrypto/ec/ec2_smpl.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/libcrypto/ec/ec2_smpl.c b/src/lib/libcrypto/ec/ec2_smpl.c
index 0031a161c7..b9c066c5c1 100644
--- a/src/lib/libcrypto/ec/ec2_smpl.c
+++ b/src/lib/libcrypto/ec/ec2_smpl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ec2_smpl.c,v 1.12 2014/07/12 16:03:37 miod Exp $ */ 1/* $OpenBSD: ec2_smpl.c,v 1.13 2015/02/08 22:25:03 miod Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. 3 * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
4 * 4 *
@@ -413,7 +413,7 @@ ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group,
413{ 413{
414 int ret = 0; 414 int ret = 0;
415 415
416 if (EC_POINT_is_at_infinity(group, point)) { 416 if (EC_POINT_is_at_infinity(group, point) > 0) {
417 ECerr(EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY); 417 ECerr(EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES, EC_R_POINT_AT_INFINITY);
418 return 0; 418 return 0;
419 } 419 }
@@ -448,12 +448,12 @@ ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
448 BIGNUM *x0, *y0, *x1, *y1, *x2, *y2, *s, *t; 448 BIGNUM *x0, *y0, *x1, *y1, *x2, *y2, *s, *t;
449 int ret = 0; 449 int ret = 0;
450 450
451 if (EC_POINT_is_at_infinity(group, a)) { 451 if (EC_POINT_is_at_infinity(group, a) > 0) {
452 if (!EC_POINT_copy(r, b)) 452 if (!EC_POINT_copy(r, b))
453 return 0; 453 return 0;
454 return 1; 454 return 1;
455 } 455 }
456 if (EC_POINT_is_at_infinity(group, b)) { 456 if (EC_POINT_is_at_infinity(group, b) > 0) {
457 if (!EC_POINT_copy(r, a)) 457 if (!EC_POINT_copy(r, a))
458 return 0; 458 return 0;
459 return 1; 459 return 1;
@@ -564,7 +564,7 @@ ec_GF2m_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a,
564int 564int
565ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) 565ec_GF2m_simple_invert(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx)
566{ 566{
567 if (EC_POINT_is_at_infinity(group, point) || BN_is_zero(&point->Y)) 567 if (EC_POINT_is_at_infinity(group, point) > 0 || BN_is_zero(&point->Y))
568 /* point is its own inverse */ 568 /* point is its own inverse */
569 return 1; 569 return 1;
570 570
@@ -595,7 +595,7 @@ ec_GF2m_simple_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX
595 int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *); 595 int (*field_mul) (const EC_GROUP *, BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *);
596 int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); 596 int (*field_sqr) (const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *);
597 597
598 if (EC_POINT_is_at_infinity(group, point)) 598 if (EC_POINT_is_at_infinity(group, point) > 0)
599 return 1; 599 return 1;
600 600
601 field_mul = group->meth->field_mul; 601 field_mul = group->meth->field_mul;
@@ -657,10 +657,10 @@ ec_GF2m_simple_cmp(const EC_GROUP * group, const EC_POINT * a, const EC_POINT *
657 BN_CTX *new_ctx = NULL; 657 BN_CTX *new_ctx = NULL;
658 int ret = -1; 658 int ret = -1;
659 659
660 if (EC_POINT_is_at_infinity(group, a)) { 660 if (EC_POINT_is_at_infinity(group, a) > 0) {
661 return EC_POINT_is_at_infinity(group, b) ? 0 : 1; 661 return EC_POINT_is_at_infinity(group, b) > 0 ? 0 : 1;
662 } 662 }
663 if (EC_POINT_is_at_infinity(group, b)) 663 if (EC_POINT_is_at_infinity(group, b) > 0)
664 return 1; 664 return 1;
665 665
666 if (a->Z_is_one && b->Z_is_one) { 666 if (a->Z_is_one && b->Z_is_one) {
@@ -701,7 +701,7 @@ ec_GF2m_simple_make_affine(const EC_GROUP * group, EC_POINT * point, BN_CTX * ct
701 BIGNUM *x, *y; 701 BIGNUM *x, *y;
702 int ret = 0; 702 int ret = 0;
703 703
704 if (point->Z_is_one || EC_POINT_is_at_infinity(group, point)) 704 if (point->Z_is_one || EC_POINT_is_at_infinity(group, point) > 0)
705 return 1; 705 return 1;
706 706
707 if (ctx == NULL) { 707 if (ctx == NULL) {