~ubuntu-branches/ubuntu/intrepid/libcrypto++/intrepid

« back to all changes in this revision

Viewing changes to ecp.h

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Machard
  • Date: 2004-08-27 12:35:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040827123505-7evgxiu7k8memiyk
Tags: 5.2.1a-1
* Urgency set to high because lastest upload was unclean
* Rename libcrypto++-5.2.1.orig.tar.gz in  libcrypto++-5.2.1a.orig.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
NAMESPACE_BEGIN(CryptoPP)
10
10
 
11
11
//! Elliptical Curve Point
12
 
struct ECPPoint
 
12
struct CRYPTOPP_DLL ECPPoint
13
13
{
14
14
        ECPPoint() : identity(true) {}
15
15
        ECPPoint(const Integer &x, const Integer &y)
24
24
        Integer x, y;
25
25
};
26
26
 
 
27
CRYPTOPP_DLL_TEMPLATE_CLASS AbstractGroup<ECPPoint>;
 
28
 
27
29
//! Elliptic Curve over GF(p), where p is prime
28
 
class ECP : public AbstractGroup<ECPPoint>
 
30
class CRYPTOPP_DLL ECP : public AbstractGroup<ECPPoint>
29
31
{
30
32
public:
31
33
        typedef ModularArithmetic Field;
77
79
        const FieldElement & GetA() const {return m_a;}
78
80
        const FieldElement & GetB() const {return m_b;}
79
81
 
 
82
        bool operator==(const ECP &rhs) const
 
83
                {return GetField() == rhs.GetField() && m_a == rhs.m_a && m_b == rhs.m_b;}
 
84
 
80
85
private:
81
86
        clonable_ptr<Field> m_fieldPtr;
82
87
        FieldElement m_a, m_b;
83
88
        mutable Point m_R;
84
89
};
85
90
 
 
91
CRYPTOPP_DLL_TEMPLATE_CLASS DL_FixedBasePrecomputationImpl<ECP::Point>;
 
92
CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupPrecomputation<ECP::Point>;
 
93
 
86
94
template <class T> class EcPrecomputation;
87
95
 
88
 
//! .
 
96
//! ECP precomputation
89
97
template<> class EcPrecomputation<ECP> : public DL_GroupPrecomputation<ECP::Point>
90
98
{
91
99
public:
102
110
        void DEREncodeElement(BufferedTransformation &bt, const Element &v) const {m_ec->DEREncodePoint(bt, v, false);}
103
111
 
104
112
        // non-inherited
105
 
        void SetCurve(const ECP &ec);
 
113
        void SetCurve(const ECP &ec)
 
114
        {
 
115
                m_ec.reset(new ECP(ec, true));
 
116
                m_ecOriginal = ec;
 
117
        }
106
118
        const ECP & GetCurve() const {return *m_ecOriginal;}
107
119
 
108
120
private: