Botan 2.19.5 Crypto and TLS for C&

Public Member Functions | List of all members
Botan::CurveGFp Class Referencefinal

`#include <curve_gfp.h>`

## Public Member Functions
bool | a_is_minus_3 () const
bool | a_is_zero () const
| 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_to_tmp (const BigInt &x, secure_vector< word > &ws) const
const BigInt & | get_1_rep () const
const BigInt & | get_a () const
const BigInt & | get_a_rep () const
const BigInt & | get_b () const
const BigInt & | get_b_rep () const
const BigInt & | get_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
CurveGFp & | operator= (const CurveGFp &)=default
bool | operator== (const CurveGFp &other) const
void | sqr (BigInt &z, const BigInt &x, secure_vector< word > &ws) const
void | sqr (BigInt &z, const word x_w[], size_t x_size, 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 96 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

  p | prime number of the field
  a | first coefficient
  b | second coefficient

Definition at line 111 of file curve_gfp.h.

111 :
112 m_repr(choose_repr(p, a, b))
113 {
114 }

## ◆ CurveGFp() [3/3]

Botan::CurveGFp::CurveGFp | ( | const CurveGFp & |  | ) |
| default

## Member Function Documentation

## ◆ a_is_minus_3()

bool Botan::CurveGFp::a_is_minus_3 | ( |  | ) | const
| inline

Definition at line 146 of file curve_gfp.h.

146{ return m_repr->a_is_minus_3(); }

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

## ◆ a_is_zero()

bool Botan::CurveGFp::a_is_zero | ( |  | ) | const
| inline

Definition at line 147 of file curve_gfp.h.

147{ return m_repr->a_is_zero(); }

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

## ◆ from_rep()

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

Definition at line 161 of file curve_gfp.h.

162 {
163 m_repr->from_curve_rep(x, ws);
164 }

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

## ◆ from_rep_to_tmp()

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

Definition at line 166 of file curve_gfp.h.

167 {
168 BigInt xt(x);
169 m_repr->from_curve_rep(xt, ws);
170 return xt;
171 }

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

## ◆ get_1_rep()

const BigInt & Botan::CurveGFp::get_1_rep | ( |  | ) | const
| inline

Definition at line 144 of file curve_gfp.h.

144{ return m_repr->get_1_rep(); }

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

## ◆ get_a()

const BigInt & Botan::CurveGFp::get_a | ( |  | ) | const
| inline

Returns
  curve coefficient a

Definition at line 123 of file curve_gfp.h.

123{ return m_repr->get_a(); }

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

## ◆ get_a_rep()

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

Definition at line 140 of file curve_gfp.h.

140{ return m_repr->get_a_rep(); }

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

## ◆ get_b()

const BigInt & Botan::CurveGFp::get_b | ( |  | ) | const
| inline

Returns
  curve coefficient b

Definition at line 128 of file curve_gfp.h.

128{ return m_repr->get_b(); }

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

## ◆ get_b_rep()

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

Definition at line 142 of file curve_gfp.h.

142{ return m_repr->get_b_rep(); }

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

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

134{ return m_repr->get_p(); }

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

## ◆ get_p_words()

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

Definition at line 136 of file curve_gfp.h.

136{ return m_repr->get_p_words(); }

## ◆ get_ws_size()

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

Definition at line 138 of file curve_gfp.h.

138{ return m_repr->get_ws_size(); }

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

## ◆ invert_element()

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

Definition at line 151 of file curve_gfp.h.

152 {
153 return m_repr->invert_element(x, ws);
154 }

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

## ◆ is_one()

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

Definition at line 149 of file curve_gfp.h.

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

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

## ◆ mul() [1/3]

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

Definition at line 175 of file curve_gfp.h.

176 {
177 m_repr->curve_mul(z, x, y, ws);
178 }

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

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

182 {
183 m_repr->curve_mul_words(z, x_w, x_size, y, ws);
184 }

## ◆ mul() [3/3]

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

Definition at line 196 of file curve_gfp.h.

197 {
198 return mul_to_tmp(x, y, ws);
199 }
Botan::CurveGFp::mul_to_tmp
BigInt mul_to_tmp(const BigInt &x, const BigInt &y, secure_vector< word > &ws) const
Definition: curve_gfp.h:206

## ◆ mul_to_tmp()

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

Definition at line 206 of file curve_gfp.h.

207 {
208 BigInt z;
209 m_repr->curve_mul(z, x, y, ws);
210 return z;
211 }

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().

## ◆ operator=()

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

## ◆ operator==()

bool Botan::CurveGFp::operator== | ( | const CurveGFp & | other | ) | const
| inline

Equality operator

Parameters

  other | a curve

Returns
  true iff *this is the same as other

Definition at line 230 of file curve_gfp.h.

231 {
232 if(m_repr.get() == other.m_repr.get())
233 return true;
234
235 return (get_p() == other.get_p()) &&
236 (get_a() == other.get_a()) &&
237 (get_b() == other.get_b());
238 }
Botan::CurveGFp::get_a
const BigInt & get_a() const
Definition: curve_gfp.h:123
Botan::CurveGFp::get_p
const BigInt & get_p() const
Definition: curve_gfp.h:134
Botan::CurveGFp::get_b
const BigInt & get_b() const
Definition: curve_gfp.h:128

References get_a(), get_b(), and get_p().

## ◆ sqr() [1/3]

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

Definition at line 186 of file curve_gfp.h.

187 {
188 m_repr->curve_sqr(z, x, ws);
189 }

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

## ◆ sqr() [2/3]

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

Definition at line 191 of file curve_gfp.h.

192 {
193 m_repr->curve_sqr_words(z, x_w, x_size, ws);
194 }

## ◆ sqr() [3/3]

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

Definition at line 201 of file curve_gfp.h.

202 {
203 return sqr_to_tmp(x, ws);
204 }
Botan::CurveGFp::sqr_to_tmp
BigInt sqr_to_tmp(const BigInt &x, secure_vector< word > &ws) const
Definition: curve_gfp.h:213

## ◆ sqr_to_tmp()

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

Definition at line 213 of file curve_gfp.h.

214 {
215 BigInt z;
216 m_repr->curve_sqr(z, x, ws);
217 return z;
218 }

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().

## ◆ swap()

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

Definition at line 220 of file curve_gfp.h.

221 {
222 std::swap(m_repr, other.m_repr);
223 }

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

## ◆ to_rep()

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

Definition at line 156 of file curve_gfp.h.

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

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

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

- src/lib/pubkey/ec_group/curve_gfp.h
- src/lib/pubkey/ec_group/curve_gfp.cpp