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