18 #if CRYPTOPP_MSC_VERSION 19 # pragma warning(push) 20 # pragma warning(disable: 4231 4275) 46 ECP(
const ECP &ecp,
bool convertToMontgomeryRepresentation);
53 : m_fieldPtr(new
Field(modulus)), m_a(a.IsNegative() ? modulus+a : a), m_b(b) {}
71 bool Equal(
const Point &P,
const Point &Q)
const;
74 const Point& Inverse(
const Point &P)
const;
76 const Point& Add(
const Point &P,
const Point &Q)
const;
77 const Point& Double(
const Point &P)
const;
78 Point ScalarMultiply(
const Point &P,
const Integer &k)
const;
79 Point CascadeScalarMultiply(
const Point &P,
const Integer &k1,
const Point &Q,
const Integer &k2)
const;
80 void SimultaneousMultiply(Point *results,
const Point &base,
const Integer *exponents,
unsigned int exponentsCount)
const;
82 Point Multiply(
const Integer &k,
const Point &P)
const 83 {
return ScalarMultiply(P, k);}
84 Point CascadeMultiply(
const Integer &k1,
const Point &P,
const Integer &k2,
const Point &Q)
const 85 {
return CascadeScalarMultiply(P, k1, Q, k2);}
88 bool VerifyPoint(
const Point &P)
const;
91 {
return 1 + (compressed?1:2)*GetField().MaxElementByteLength();}
94 bool DecodePoint(Point &P,
const byte *encodedPoint,
size_t len)
const;
95 void EncodePoint(
byte *encodedPoint,
const Point &P,
bool compressed)
const;
101 Integer FieldSize()
const {
return GetField().GetModulus();}
102 const Field & GetField()
const {
return *m_fieldPtr;}
103 const FieldElement & GetA()
const {
return m_a;}
104 const FieldElement & GetB()
const {
return m_b;}
107 {
return GetField() == rhs.GetField() && m_a == rhs.m_a && m_b == rhs.m_b;}
111 FieldElement m_a, m_b;
136 {
return P.identity ? P :
ECP::Point(m_ec->GetField().ConvertIn(P.x), m_ec->GetField().ConvertIn(P.y));};
138 {
return P.identity ? P :
ECP::Point(m_ec->GetField().ConvertOut(P.x), m_ec->GetField().ConvertOut(P.y));}
148 m_ec.reset(
new ECP(ec,
true));
163 #if CRYPTOPP_MSC_VERSION 164 # pragma warning(pop) Elliptical Curve Point over GF(p), where p is prime.
This file contains helper classes/functions for implementing public key algorithms.
const char * Identity()
ConstByteArrayParameter.
Elliptic Curve over GF(p), where p is prime.
Abstract base classes that provide a uniform interface to this library.
bool InversionIsFast() const
Determine if inversion is fast.
Classes for automatic resource management.
Ring of congruence classes modulo n.
Interface for random number generators.
Element ConvertIn(const Element &P) const
Converts an element between representations.
Classes for Elliptic Curve points.
Classes for performing mathematics over different fields.
bool operator==(const OID &lhs, const OID &rhs)
Compare two OIDs for equality.
void DEREncodeElement(BufferedTransformation &bt, const Element &v) const
Encodes element in DER format.
A pointer which can be copied and cloned.
Multiple precision integer with arithmetic operations.
#define CRYPTOPP_DLL_TEMPLATE_CLASS
Instantiate templates in a dynamic library.
const AbstractGroup< Element > & GetGroup() const
Retrieves AbstractGroup interface.
Element BERDecodeElement(BufferedTransformation &bt) const
Decodes element in DER format.
unsigned char byte
8-bit unsigned datatype
Classes for precomputation in a group.
Abstract class for encoding and decoding ellicptic curve points.
Elliptic Curve precomputation.
Multiple precision integer with arithmetic operations.
bool NeedConversions() const
Determines if elements needs conversion.
unsigned int EncodedPointSize(bool compressed=false) const
Determines encoded point size.
Class file for performing modular arithmetic.
Crypto++ library namespace.
ECP(const Integer &modulus, const FieldElement &a, const FieldElement &b)
Construct an ECP.
const ECP & GetCurve() const
Get the elliptic curve.
Element ConvertOut(const Element &P) const
Converts an element between representations.
DL_FixedBasePrecomputation adapter class.
void SetCurve(const ECP &ec)
Set the elliptic curve.