Botan  2.6.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
 
size_t get_p_words () const
 
size_t get_ws_size () const
 
BigInt invert_element (const BigInt &x, secure_vector< word > &ws) const
 
bool is_one (const BigInt &x) const
 
void mul (BigInt &z, const BigInt &x, const BigInt &y, secure_vector< word > &ws) const
 
void mul (BigInt &z, const word x_w[], size_t x_size, const BigInt &y, secure_vector< word > &ws) const
 
BigInt mul (const BigInt &x, const BigInt &y, secure_vector< word > &ws) const
 
BigInt mul_to_tmp (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
 
BigInt sqr_to_tmp (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)

There should not be any reason for applications to use this type. If you need EC primitives use the interfaces EC_Group and PointGFp

It is likely this class will be removed entirely in a future major release.

Definition at line 71 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 86 of file curve_gfp.h.

86  :
87  m_repr(choose_repr(p, a, b))
88  {
89  }

◆ 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 131 of file curve_gfp.h.

Referenced by Botan::PointGFp::get_affine_x(), Botan::PointGFp::get_affine_y(), and Botan::PointGFp::on_the_curve().

132  {
133  m_repr->from_curve_rep(x, ws);
134  }

◆ from_rep() [2/2]

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

Definition at line 136 of file curve_gfp.h.

137  {
138  BigInt xt(x);
139  m_repr->from_curve_rep(xt, ws);
140  return xt;
141  }

◆ get_a()

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

Definition at line 98 of file curve_gfp.h.

Referenced by Botan::operator==(), and Botan::OS2ECP().

98 { return m_repr->get_a(); }

◆ get_a_rep()

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

Definition at line 115 of file curve_gfp.h.

Referenced by Botan::PointGFp::mult2(), and Botan::PointGFp::on_the_curve().

115 { return m_repr->get_a_rep(); }

◆ get_b()

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

Definition at line 103 of file curve_gfp.h.

Referenced by Botan::operator==(), and Botan::OS2ECP().

103 { return m_repr->get_b(); }

◆ get_b_rep()

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

Definition at line 117 of file curve_gfp.h.

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

117 { 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 109 of file curve_gfp.h.

Referenced by Botan::PointGFp::add(), Botan::PointGFp::add_affine(), Botan::PointGFp::encode(), Botan::PointGFp::mult2(), Botan::operator==(), Botan::OS2ECP(), and Botan::PointGFp::PointGFp().

109 { return m_repr->get_p(); }

◆ get_p_words()

size_t Botan::CurveGFp::get_p_words ( ) const
inline

Definition at line 111 of file curve_gfp.h.

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

111 { return m_repr->get_p_words(); }

◆ get_ws_size()

size_t Botan::CurveGFp::get_ws_size ( ) const
inline

◆ invert_element()

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

Definition at line 121 of file curve_gfp.h.

Referenced by Botan::PointGFp::force_affine(), Botan::PointGFp::force_all_affine(), Botan::PointGFp::get_affine_x(), and Botan::PointGFp::get_affine_y().

122  {
123  return m_repr->invert_element(x, ws);
124  }

◆ is_one()

bool Botan::CurveGFp::is_one ( const BigInt x) const
inline

Definition at line 119 of file curve_gfp.h.

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

119 { return m_repr->is_one(x); }

◆ mul() [1/3]

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

◆ mul() [2/3]

void Botan::CurveGFp::mul ( BigInt z,
const word  x_w[],
size_t  x_size,
const BigInt y,
secure_vector< word > &  ws 
) const
inline

Definition at line 150 of file curve_gfp.h.

152  {
153  m_repr->curve_mul_words(z, x_w, x_size, y, ws);
154  }

◆ mul() [3/3]

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

Definition at line 161 of file curve_gfp.h.

162  {
163  return mul_to_tmp(x, y, ws);
164  }
BigInt mul_to_tmp(const BigInt &x, const BigInt &y, secure_vector< word > &ws) const
Definition: curve_gfp.h:171

◆ mul_to_tmp()

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

Definition at line 171 of file curve_gfp.h.

Referenced by Botan::PointGFp::force_affine(), Botan::PointGFp::force_all_affine(), Botan::PointGFp::get_affine_y(), Botan::PointGFp::on_the_curve(), and Botan::PointGFp::randomize_repr().

172  {
173  BigInt z;
174  m_repr->curve_mul(z, x, y, ws);
175  return z;
176  }

◆ 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 156 of file curve_gfp.h.

Referenced by Botan::PointGFp::add(), Botan::PointGFp::add_affine(), Botan::PointGFp::force_all_affine(), and Botan::PointGFp::mult2().

157  {
158  m_repr->curve_sqr(z, x, ws);
159  }

◆ sqr() [2/2]

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

Definition at line 166 of file curve_gfp.h.

167  {
168  return sqr_to_tmp(x, ws);
169  }
BigInt sqr_to_tmp(const BigInt &x, secure_vector< word > &ws) const
Definition: curve_gfp.h:178

◆ sqr_to_tmp()

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

Definition at line 178 of file curve_gfp.h.

Referenced by Botan::PointGFp::force_affine(), Botan::PointGFp::get_affine_x(), Botan::PointGFp::get_affine_y(), Botan::PointGFp::on_the_curve(), and Botan::PointGFp::randomize_repr().

179  {
180  BigInt z;
181  m_repr->curve_sqr(z, x, ws);
182  return z;
183  }

◆ swap()

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

Definition at line 185 of file curve_gfp.h.

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

186  {
187  std::swap(m_repr, other.m_repr);
188  }

◆ to_rep()

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

Definition at line 126 of file curve_gfp.h.

Referenced by Botan::PointGFp::add_affine(), Botan::PointGFp::force_affine(), Botan::PointGFp::force_all_affine(), and Botan::PointGFp::PointGFp().

127  {
128  m_repr->to_curve_rep(x, ws);
129  }

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