Restore ECP ABI (GH #869)

Placing AdditionFunction as an inner class of ECP broke the ABI. We need to maintain the ABI so distros can patch Crypto++ 8.2.
pull/877/head
Jeffrey Walton 2019-08-09 17:34:14 -04:00
parent 7ac5791199
commit 04b2a20c5d
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 493 additions and 515 deletions

972
ecp.cpp

File diff suppressed because it is too large Load Diff

36
ecp.h
View File

@ -106,42 +106,6 @@ public:
bool operator==(const ECP &rhs) const bool operator==(const ECP &rhs) const
{return GetField() == rhs.GetField() && m_a == rhs.m_a && m_b == rhs.m_b;} {return GetField() == rhs.GetField() && m_a == rhs.m_a && m_b == rhs.m_b;}
protected:
/// \brief Addition and Double functions
/// \sa <A HREF="https://eprint.iacr.org/2015/1060.pdf">Complete
/// addition formulas for prime order elliptic curves</A>
class AdditionFunction
{
public:
explicit AdditionFunction(const ECP& ecp);
// Double(P)
Point operator()(const Point& P) const;
// Add(P, Q)
Point operator()(const Point& P, const Point& Q) const;
protected:
/// \brief Parameters and representation for Addition
/// \details Addition and Doubling will use different algorithms,
/// depending on the <tt>A</tt> coefficient and the representation
/// (Affine or Montgomery with precomputation).
enum Alpha {
/// \brief Coefficient A is 0
A_0=1,
/// \brief Coefficient A is -3
A_3=2,
/// \brief Coefficient A is arbitrary
A_Star=4,
/// \brief Representation is Montgomery
A_Montgomery=8
};
const ECP& m_ecp;
Alpha m_alpha;
private:
AdditionFunction(const AdditionFunction&);
};
private: private:
clonable_ptr<Field> m_fieldPtr; clonable_ptr<Field> m_fieldPtr;
FieldElement m_a, m_b; FieldElement m_a, m_b;