diff options
author | weidai <weidai11@users.noreply.github.com> | 2003-07-04 00:17:37 +0000 |
---|---|---|
committer | weidai <weidai11@users.noreply.github.com> | 2003-07-04 00:17:37 +0000 |
commit | f278895908e663a6a5a2c1f63e5523c5004f5d20 (patch) | |
tree | 0536d87e504a82920156c239bc5ae6aa43e70ebc /ecp.h | |
parent | e43f74604744291d3a99b8bfe81d94af4ba6abbd (diff) | |
download | cryptopp-git-f278895908e663a6a5a2c1f63e5523c5004f5d20.tar.gz |
create DLL version, fix GetNextIV() bug in CTR and OFB modes
Diffstat (limited to 'ecp.h')
-rw-r--r-- | ecp.h | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -9,7 +9,7 @@ NAMESPACE_BEGIN(CryptoPP) //! Elliptical Curve Point -struct ECPPoint +struct CRYPTOPP_DLL ECPPoint { ECPPoint() : identity(true) {} ECPPoint(const Integer &x, const Integer &y) @@ -24,8 +24,10 @@ struct ECPPoint Integer x, y; }; +CRYPTOPP_DLL_TEMPLATE_CLASS AbstractGroup<ECPPoint>; + //! Elliptic Curve over GF(p), where p is prime -class ECP : public AbstractGroup<ECPPoint> +class CRYPTOPP_DLL ECP : public AbstractGroup<ECPPoint> { public: typedef ModularArithmetic Field; @@ -77,12 +79,18 @@ public: const FieldElement & GetA() const {return m_a;} const FieldElement & GetB() const {return m_b;} + bool operator==(const ECP &rhs) const + {return GetField() == rhs.GetField() && m_a == rhs.m_a && m_b == rhs.m_b;} + private: clonable_ptr<Field> m_fieldPtr; FieldElement m_a, m_b; mutable Point m_R; }; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl<ECP::Point>; +CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupPrecomputation<ECP::Point>; + template <class T> class EcPrecomputation; //! . @@ -102,7 +110,11 @@ public: void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {m_ec->DEREncodePoint(bt, v, false);} // non-inherited - void SetCurve(const ECP &ec); + void SetCurve(const ECP &ec) + { + m_ec.reset(new ECP(ec, true)); + m_ecOriginal = ec; + } const ECP & GetCurve() const {return *m_ecOriginal;} private: |