diff options
author | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2003-07-04 00:17:37 +0000 |
---|---|---|
committer | weidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0> | 2003-07-04 00:17:37 +0000 |
commit | 572fe07633123ce38abf28c6426356e37aef3a99 (patch) | |
tree | 0536d87e504a82920156c239bc5ae6aa43e70ebc /ecp.h | |
parent | 3e8c979ddc194e043567c036321e67c89f847362 (diff) | |
download | cryptopp-572fe07633123ce38abf28c6426356e37aef3a99.tar.gz |
create DLL version, fix GetNextIV() bug in CTR and OFB modes
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@87 57ff6487-cd31-0410-9ec3-f628ee90f5f0
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: |