diff options
author | Jack Lloyd <[email protected]> | 2018-02-01 10:25:38 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-02-01 10:25:38 -0500 |
commit | 5213f9a5ed5c39b28d5226183231cf1121c59235 (patch) | |
tree | 0a8d5e0344a8ad1eb309cb99f7badce662e2d0fb /src | |
parent | a0d7b60d5f95475793ee627cedf71d6a2f1d624b (diff) |
Fix deprecation warnings
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/pubkey/ec_group/ec_group.cpp | 21 | ||||
-rw-r--r-- | src/lib/pubkey/ec_group/ec_group.h | 10 |
2 files changed, 20 insertions, 11 deletions
diff --git a/src/lib/pubkey/ec_group/ec_group.cpp b/src/lib/pubkey/ec_group/ec_group.cpp index 978e59985..93747a166 100644 --- a/src/lib/pubkey/ec_group/ec_group.cpp +++ b/src/lib/pubkey/ec_group/ec_group.cpp @@ -270,17 +270,17 @@ const OID& EC_Group::get_curve_oid() const PointGFp EC_Group::OS2ECP(const uint8_t bits[], size_t len) const { - return Botan::OS2ECP(bits, len, get_curve()); + return Botan::OS2ECP(bits, len, data().m_curve); } PointGFp EC_Group::point(const BigInt& x, const BigInt& y) const { - return PointGFp(get_curve(), x, y); + return PointGFp(data().m_curve, x, y); } PointGFp EC_Group::zero_point() const { - return PointGFp(get_curve()); + return PointGFp(data().m_curve); } std::vector<uint8_t> @@ -333,6 +333,21 @@ std::string EC_Group::PEM_encode() const return PEM_Code::encode(der, "EC PARAMETERS"); } +bool EC_Group::operator==(const EC_Group& other) const + { + if(m_data == other.m_data) + return true; // same shared rep + + /* + * No point comparing order/cofactor as they are uniquely determined + * by the curve equation (p,a,b) and the base point. + */ + return (get_p() == other.get_p() && + get_a() == other.get_a() && + get_b() == other.get_b() && + get_base_point() == other.get_base_point()); + } + bool EC_Group::verify_group(RandomNumberGenerator& rng, bool) const { diff --git a/src/lib/pubkey/ec_group/ec_group.h b/src/lib/pubkey/ec_group/ec_group.h index f1a3f8fff..0e6b57b5a 100644 --- a/src/lib/pubkey/ec_group/ec_group.h +++ b/src/lib/pubkey/ec_group/ec_group.h @@ -112,7 +112,7 @@ class BOTAN_PUBLIC_API(2,0) EC_Group final * Return domain parameter curve * @result domain parameter curve */ - const CurveGFp& BOTAN_DEPRECATED("Avoid CurveGFp") get_curve() const; + BOTAN_DEPRECATED("Avoid CurveGFp") const CurveGFp& get_curve() const; /** * Return the size of p in bits (same as get_p().bits()) @@ -196,13 +196,7 @@ class BOTAN_PUBLIC_API(2,0) EC_Group final bool verify_group(RandomNumberGenerator& rng, bool strong = false) const; - bool operator==(const EC_Group& other) const - { - return ((get_curve() == other.get_curve()) && - (get_base_point() == other.get_base_point()) && - (get_order() == other.get_order()) && - (get_cofactor() == other.get_cofactor())); - } + bool operator==(const EC_Group& other) const; /** * Return PEM representation of named EC group |