aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/ec_group/curve_gfp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/pubkey/ec_group/curve_gfp.h')
-rw-r--r--src/lib/pubkey/ec_group/curve_gfp.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/lib/pubkey/ec_group/curve_gfp.h b/src/lib/pubkey/ec_group/curve_gfp.h
index 865bb68f8..888f87d46 100644
--- a/src/lib/pubkey/ec_group/curve_gfp.h
+++ b/src/lib/pubkey/ec_group/curve_gfp.h
@@ -201,6 +201,22 @@ class BOTAN_UNSTABLE_API CurveGFp final
std::swap(m_repr, other.m_repr);
}
+ /**
+ * Equality operator
+ * @param lhs a curve
+ * @param rhs a curve
+ * @return true iff lhs is the same as rhs
+ */
+ inline bool operator==(const CurveGFp& other) const
+ {
+ if(m_repr.get() == other.m_repr.get())
+ return true;
+
+ return (get_p() == other.get_p()) &&
+ (get_a() == other.get_a()) &&
+ (get_b() == other.get_b());
+ }
+
private:
static std::shared_ptr<CurveGFp_Repr>
choose_repr(const BigInt& p, const BigInt& a, const BigInt& b);
@@ -208,19 +224,6 @@ class BOTAN_UNSTABLE_API CurveGFp final
std::shared_ptr<CurveGFp_Repr> m_repr;
};
-/**
-* Equality operator
-* @param lhs a curve
-* @param rhs a curve
-* @return true iff lhs is the same as rhs
-*/
-inline bool operator==(const CurveGFp& lhs, const CurveGFp& rhs)
- {
- return (lhs.get_p() == rhs.get_p()) &&
- (lhs.get_a() == rhs.get_a()) &&
- (lhs.get_b() == rhs.get_b());
- }
-
inline bool operator!=(const CurveGFp& lhs, const CurveGFp& rhs)
{
return !(lhs == rhs);