summaryrefslogtreecommitdiff
path: root/ec2n.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2016-10-17 22:00:31 -0400
committerJeffrey Walton <noloader@gmail.com>2016-10-17 22:00:31 -0400
commit54d17c7361dc97313ca0ad54bf07420e33a735c0 (patch)
treee61a6f7451df5f1bb280d7e0bab21b7100551ac3 /ec2n.h
parentb7423a3bf73aef511ff310631955ff378c6fee7e (diff)
downloadcryptopp-git-54d17c7361dc97313ca0ad54bf07420e33a735c0.tar.gz
Updated CRYPTOPP_ASSERT based on comments
Also see https://github.com/weidai11/cryptopp/commit/399a1546de71f41598c15edada28e7f0d616f541#commitcomment-19448453
Diffstat (limited to 'ec2n.h')
-rw-r--r--ec2n.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/ec2n.h b/ec2n.h
index 959c1e92..da783734 100644
--- a/ec2n.h
+++ b/ec2n.h
@@ -21,21 +21,21 @@ NAMESPACE_BEGIN(CryptoPP)
//! Elliptic Curve Point
struct CRYPTOPP_DLL EC2NPoint
{
+#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
+ virtual ~EC2NPoint() {}
+#endif
+
EC2NPoint() : identity(true) {}
EC2NPoint(const PolynomialMod2 &x, const PolynomialMod2 &y)
- : identity(false), x(x), y(y) {}
+ : x(x), y(y), identity(false) {}
bool operator==(const EC2NPoint &t) const
{return (identity && t.identity) || (!identity && !t.identity && x==t.x && y==t.y);}
bool operator< (const EC2NPoint &t) const
{return identity ? !t.identity : (!t.identity && (x<t.x || (x==t.x && y<t.y)));}
-#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
- virtual ~EC2NPoint() {}
-#endif
-
- bool identity;
PolynomialMod2 x, y;
+ bool identity;
};
CRYPTOPP_DLL_TEMPLATE_CLASS AbstractGroup<EC2NPoint>;
@@ -48,6 +48,10 @@ public:
typedef Field::Element FieldElement;
typedef EC2NPoint Point;
+#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
+ virtual ~EC2N() {}
+#endif
+
EC2N() {}
EC2N(const Field &field, const Field::Element &a, const Field::Element &b)
: m_field(field), m_a(a), m_b(b) {}
@@ -92,10 +96,6 @@ public:
bool operator==(const EC2N &rhs) const
{return GetField() == rhs.GetField() && m_a == rhs.m_a && m_b == rhs.m_b;}
-#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
- virtual ~EC2N() {}
-#endif
-
private:
clonable_ptr<Field> m_field;
FieldElement m_a, m_b;
@@ -113,6 +113,10 @@ template<> class EcPrecomputation<EC2N> : public DL_GroupPrecomputation<EC2N::Po
public:
typedef EC2N EllipticCurve;
+#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
+ virtual ~EcPrecomputation() {}
+#endif
+
// DL_GroupPrecomputation
const AbstractGroup<Element> & GetGroup() const {return m_ec;}
Element BERDecodeElement(BufferedTransformation &bt) const {return m_ec.BERDecodePoint(bt);}
@@ -122,10 +126,6 @@ public:
void SetCurve(const EC2N &ec) {m_ec = ec;}
const EC2N & GetCurve() const {return m_ec;}
-#ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
- virtual ~EcPrecomputation() {}
-#endif
-
private:
EC2N m_ec;
};