diff options
Diffstat (limited to 'src/math/numbertheory')
-rw-r--r-- | src/math/numbertheory/point_gfp.cpp | 13 | ||||
-rw-r--r-- | src/math/numbertheory/point_gfp.h | 29 |
2 files changed, 9 insertions, 33 deletions
diff --git a/src/math/numbertheory/point_gfp.cpp b/src/math/numbertheory/point_gfp.cpp index db422c8aa..90885bc94 100644 --- a/src/math/numbertheory/point_gfp.cpp +++ b/src/math/numbertheory/point_gfp.cpp @@ -268,10 +268,15 @@ void PointGFp::swap(PointGFp& other) bool PointGFp::operator==(const PointGFp& other) const { - return (coord_x == other.coord_x && - coord_y == other.coord_y && - coord_z == other.coord_z && - get_curve() == other.get_curve()); + if(get_curve() != other.get_curve()) + return false; + + // If this is zero, only equal if other is also zero + if(is_zero()) + return other.is_zero(); + + return (get_affine_x() == other.get_affine_x() && + get_affine_y() == other.get_affine_y()); } // encoding and decoding diff --git a/src/math/numbertheory/point_gfp.h b/src/math/numbertheory/point_gfp.h index 2f31421fc..3417c7b7f 100644 --- a/src/math/numbertheory/point_gfp.h +++ b/src/math/numbertheory/point_gfp.h @@ -62,17 +62,6 @@ class BOTAN_DLL PointGFp const BigInt& x, const BigInt& y) : curve(curve), coord_x(x), coord_y(y), coord_z(1) {} - /** - * Construct a point given its jacobian projective coordinates - * @param curve the base curve - * @param x jacobian projective x coordinate - * @param y jacobian projective y coordinate - * @param z jacobian projective z coordinate - */ - PointGFp(const CurveGFp& curve, - const BigInt& x, const BigInt& y, const BigInt& z) : - curve(curve), coord_x(x), coord_y(y), coord_z(z) {} - //PointGFp(const PointGFp& other) = default; //PointGFp& operator=(const PointGFp& other) = default; @@ -129,24 +118,6 @@ class BOTAN_DLL PointGFp BigInt get_affine_y() const; /** - * get the jacobian projective x coordinate - * @result jacobian projective x coordinate - */ - const BigInt& get_x() const { return coord_x; } - - /** - * get the jacobian projective y coordinate - * @result jacobian projective y coordinate - */ - const BigInt& get_y() const { return coord_y; } - - /** - * get the jacobian projective z coordinate - * @result jacobian projective z coordinate - */ - const BigInt& get_z() const { return coord_z; } - - /** * Is this the point at infinity? * @result true, if this point is at infinity, false otherwise. */ |