Botan  2.4.0
Crypto and TLS for C++11
Public Member Functions | List of all members
Botan::CurveGFp Class Referencefinal

#include <curve_gfp.h>

Public Member Functions

 CurveGFp ()=default
 
 CurveGFp (const BigInt &p, const BigInt &a, const BigInt &b)
 
 CurveGFp (const CurveGFp &)=default
 
void from_rep (BigInt &x, secure_vector< word > &ws) const
 
BigInt from_rep (const BigInt &x, secure_vector< word > &ws) const
 
const BigIntget_a () const
 
const BigIntget_a_rep () const
 
const BigIntget_b () const
 
const BigIntget_b_rep () const
 
const BigIntget_p () const
 
void mul (BigInt &z, const BigInt &x, const BigInt &y, secure_vector< word > &ws) const
 
BigInt mul (const BigInt &x, const BigInt &y, secure_vector< word > &ws) const
 
CurveGFpoperator= (const CurveGFp &)=default
 
void sqr (BigInt &z, const BigInt &x, secure_vector< word > &ws) const
 
BigInt sqr (const BigInt &x, secure_vector< word > &ws) const
 
void swap (CurveGFp &other)
 
void to_rep (BigInt &x, secure_vector< word > &ws) const
 

Detailed Description

This class represents an elliptic curve over GF(p)

Definition at line 53 of file curve_gfp.h.

Constructor & Destructor Documentation

◆ CurveGFp() [1/3]

Botan::CurveGFp::CurveGFp ( )
default

Create an uninitialized CurveGFp

◆ CurveGFp() [2/3]

Botan::CurveGFp::CurveGFp ( const BigInt p,
const BigInt a,
const BigInt b 
)
inline

Construct the elliptic curve E: y^2 = x^3 + ax + b over GF(p)

Parameters
pprime number of the field
afirst coefficient
bsecond coefficient

Definition at line 68 of file curve_gfp.h.

68  :
69  m_repr(choose_repr(p, a, b))
70  {
71  }

◆ CurveGFp() [3/3]

Botan::CurveGFp::CurveGFp ( const CurveGFp )
default

Member Function Documentation

◆ from_rep() [1/2]

void Botan::CurveGFp::from_rep ( BigInt x,
secure_vector< word > &  ws 
) const
inline

Definition at line 102 of file curve_gfp.h.

103  {
104  m_repr->from_curve_rep(x, ws);
105  }

◆ from_rep() [2/2]

BigInt Botan::CurveGFp::from_rep ( const BigInt x,
secure_vector< word > &  ws 
) const
inline

Definition at line 107 of file curve_gfp.h.

108  {
109  BigInt xt(x);
110  m_repr->from_curve_rep(xt, ws);
111  return xt;
112  }

◆ get_a()

const BigInt& Botan::CurveGFp::get_a ( ) const
inline
Returns
curve coefficient a

Definition at line 80 of file curve_gfp.h.

Referenced by Botan::EC_Group::DER_encode(), Botan::EC2OSP(), Botan::operator==(), Botan::sm2_compute_za(), and Botan::EC_Group::verify_group().

80 { return m_repr->get_a(); }

◆ get_a_rep()

const BigInt& Botan::CurveGFp::get_a_rep ( ) const
inline

Definition at line 93 of file curve_gfp.h.

Referenced by Botan::PointGFp::randomize_repr().

93 { return m_repr->get_a_rep(); }

◆ get_b()

const BigInt& Botan::CurveGFp::get_b ( ) const
inline
Returns
curve coefficient b

Definition at line 85 of file curve_gfp.h.

Referenced by Botan::EC_Group::DER_encode(), Botan::EC2OSP(), Botan::operator==(), Botan::sm2_compute_za(), and Botan::EC_Group::verify_group().

85 { return m_repr->get_b(); }

◆ get_b_rep()

const BigInt& Botan::CurveGFp::get_b_rep ( ) const
inline

Definition at line 95 of file curve_gfp.h.

95 { return m_repr->get_b_rep(); }

◆ get_p()

const BigInt& Botan::CurveGFp::get_p ( ) const
inline

Get prime modulus of the field of the curve

Returns
prime modulus of the field of the curve

Definition at line 91 of file curve_gfp.h.

Referenced by Botan::EC_Group::DER_encode(), Botan::EC2OSP(), Botan::ECIES_Decryptor::ECIES_Decryptor(), Botan::EC_PublicKey::key_length(), Botan::operator==(), Botan::PointGFp::PointGFp(), Botan::PointGFp::randomize_repr(), Botan::sm2_compute_za(), and Botan::EC_Group::verify_group().

91 { return m_repr->get_p(); }

◆ mul() [1/2]

void Botan::CurveGFp::mul ( BigInt z,
const BigInt x,
const BigInt y,
secure_vector< word > &  ws 
) const
inline

Definition at line 116 of file curve_gfp.h.

117  {
118  m_repr->curve_mul(z, x, y, ws);
119  }

◆ mul() [2/2]

BigInt Botan::CurveGFp::mul ( const BigInt x,
const BigInt y,
secure_vector< word > &  ws 
) const
inline

Definition at line 121 of file curve_gfp.h.

122  {
123  BigInt z;
124  m_repr->curve_mul(z, x, y, ws);
125  return z;
126  }

◆ operator=()

CurveGFp& Botan::CurveGFp::operator= ( const CurveGFp )
default

◆ sqr() [1/2]

void Botan::CurveGFp::sqr ( BigInt z,
const BigInt x,
secure_vector< word > &  ws 
) const
inline

Definition at line 128 of file curve_gfp.h.

129  {
130  m_repr->curve_sqr(z, x, ws);
131  }

◆ sqr() [2/2]

BigInt Botan::CurveGFp::sqr ( const BigInt x,
secure_vector< word > &  ws 
) const
inline

Definition at line 133 of file curve_gfp.h.

134  {
135  BigInt z;
136  m_repr->curve_sqr(z, x, ws);
137  return z;
138  }

◆ swap()

void Botan::CurveGFp::swap ( CurveGFp other)
inline

Definition at line 140 of file curve_gfp.h.

141  {
142  std::swap(m_repr, other.m_repr);
143  }

◆ to_rep()

void Botan::CurveGFp::to_rep ( BigInt x,
secure_vector< word > &  ws 
) const
inline

Definition at line 97 of file curve_gfp.h.

Referenced by Botan::PointGFp::PointGFp(), and Botan::PointGFp::randomize_repr().

98  {
99  m_repr->to_curve_rep(x, ws);
100  }

The documentation for this class was generated from the following files: