|
Botan
2.13.0
Crypto and TLS for C++11
|
#include <point_gfp.h>
Public Types | |
| enum | { WORKSPACE_SIZE = 8 } |
| enum | Compression_Type { UNCOMPRESSED = 0, COMPRESSED = 1, HYBRID = 2 } |
Public Member Functions | |
| void | add (const PointGFp &other, std::vector< BigInt > &workspace) |
| void | add (const word x_words[], size_t x_size, const word y_words[], size_t y_size, const word z_words[], size_t z_size, std::vector< BigInt > &workspace) |
| void | add_affine (const PointGFp &other, std::vector< BigInt > &workspace) |
| void | add_affine (const word x_words[], size_t x_size, const word y_words[], size_t y_size, std::vector< BigInt > &workspace) |
| PointGFp | double_of (std::vector< BigInt > &workspace) const |
| std::vector< uint8_t > | encode (PointGFp::Compression_Type format) const |
| void | force_affine () |
| BigInt | get_affine_x () const |
| BigInt | get_affine_y () const |
| const CurveGFp & | get_curve () const |
| const BigInt & | get_x () const |
| const BigInt & | get_y () const |
| const BigInt & | get_z () const |
| bool | is_affine () const |
| bool | is_zero () const |
| void | mult2 (std::vector< BigInt > &workspace) |
| void | mult2i (size_t i, std::vector< BigInt > &workspace) |
| PointGFp & | negate () |
| bool | on_the_curve () const |
| PointGFp & | operator*= (const BigInt &scalar) |
| PointGFp & | operator+= (const PointGFp &rhs) |
| PointGFp & | operator-= (const PointGFp &rhs) |
| PointGFp & | operator= (const PointGFp &)=default |
| PointGFp & | operator= (PointGFp &&other) |
| bool | operator== (const PointGFp &other) const |
| PointGFp | plus (const PointGFp &other, std::vector< BigInt > &workspace) const |
| PointGFp ()=default | |
| PointGFp (const CurveGFp &curve) | |
| PointGFp (const PointGFp &)=default | |
| PointGFp (PointGFp &&other) | |
| PointGFp (const CurveGFp &curve, const BigInt &x, const BigInt &y) | |
| void | randomize_repr (RandomNumberGenerator &rng) |
| void | randomize_repr (RandomNumberGenerator &rng, secure_vector< word > &ws) |
| void | swap (PointGFp &other) |
| void | swap_coords (BigInt &new_x, BigInt &new_y, BigInt &new_z) |
| PointGFp | zero () const |
Static Public Member Functions | |
| static void | force_all_affine (std::vector< PointGFp > &points, secure_vector< word > &ws) |
This class represents one point on a curve of GF(p)
Definition at line 47 of file point_gfp.h.
| anonymous enum |
| Enumerator | |
|---|---|
| UNCOMPRESSED | |
| COMPRESSED | |
| HYBRID | |
Definition at line 50 of file point_gfp.h.
|
default |
Construct an uninitialized PointGFp
Referenced by mult2(), mult2i(), and operator-=().
|
explicit |
Construct the zero point
| curve | The base curve |
Definition at line 18 of file point_gfp.cpp.
|
default |
Copy constructor
|
inline |
Construct a point from its affine coordinates Prefer EC_Group::point(x,y) for this operation.
| curve | the base curve |
| x | affine x coordinate |
| y | affine y coordinate |
Definition at line 27 of file point_gfp.cpp.
References Botan::CurveGFp::get_p(), Botan::CurveGFp::get_ws_size(), and Botan::CurveGFp::to_rep().
Point addition
| other | the point to add to *this |
| workspace | temp space, at least WORKSPACE_SIZE elements |
Definition at line 221 of file point_gfp.h.
References BOTAN_ASSERT_NOMSG, Botan::BigInt::data(), and Botan::BigInt::size().
Referenced by Botan::operator*(), operator+=(), and plus().
| void Botan::PointGFp::add | ( | const word | x_words[], |
| size_t | x_size, | ||
| const word | y_words[], | ||
| size_t | y_size, | ||
| const word | z_words[], | ||
| size_t | z_size, | ||
| std::vector< BigInt > & | workspace | ||
| ) |
Point addition. Array version.
| x_words | the words of the x coordinate of the other point |
| x_size | size of x_words |
| y_words | the words of the y coordinate of the other point |
| y_size | size of y_words |
| z_words | the words of the z coordinate of the other point |
| z_size | size of z_words |
| workspace | temp space, at least WORKSPACE_SIZE elements |
Definition at line 173 of file point_gfp.cpp.
References Botan::BigInt::clear(), Botan::CurveGFp::get_1_rep(), Botan::CurveGFp::get_p(), Botan::CurveGFp::get_ws_size(), is_zero(), Botan::BigInt::is_zero(), Botan::BigInt::mod_sub(), Botan::CurveGFp::mul(), mult2(), Botan::BigInt::set_words(), and Botan::CurveGFp::sqr().
|
inline |
Point addition - mixed J+A
| other | affine point to add - assumed to be affine! |
| workspace | temp space, at least WORKSPACE_SIZE elements |
Definition at line 254 of file point_gfp.h.
References BOTAN_ASSERT_NOMSG, BOTAN_DEBUG_ASSERT, Botan::BigInt::data(), is_affine(), and Botan::BigInt::size().
Referenced by Botan::PointGFp_Base_Point_Precompute::mul(), and Botan::PointGFp_Multi_Point_Precompute::multi_exp().
| void Botan::PointGFp::add_affine | ( | const word | x_words[], |
| size_t | x_size, | ||
| const word | y_words[], | ||
| size_t | y_size, | ||
| std::vector< BigInt > & | workspace | ||
| ) |
Point addition - mixed J+A. Array version.
| x_words | the words of the x coordinate of the other point |
| x_size | size of x_words |
| y_words | the words of the y coordinate of the other point |
| y_size | size of y_words |
| workspace | temp space, at least WORKSPACE_SIZE elements |
Definition at line 90 of file point_gfp.cpp.
References Botan::BigInt::clear(), Botan::CurveGFp::get_1_rep(), Botan::CurveGFp::get_p(), Botan::BigInt::get_word_vector(), Botan::CurveGFp::get_ws_size(), is_zero(), Botan::BigInt::is_zero(), Botan::BigInt::mod_sub(), Botan::CurveGFp::mul(), mult2(), Botan::BigInt::set_words(), Botan::CurveGFp::sqr(), and Botan::BigInt::swap().
Point doubling
| workspace | temp space, at least WORKSPACE_SIZE elements |
Definition at line 309 of file point_gfp.h.
References mult2().
Referenced by Botan::PointGFp_Var_Point_Precompute::PointGFp_Var_Point_Precompute().
| std::vector< uint8_t > Botan::PointGFp::encode | ( | PointGFp::Compression_Type | format | ) | const |
EC2OSP - elliptic curve to octet string primitive
| format | which format to encode using |
Definition at line 595 of file point_gfp.cpp.
References Botan::BigInt::bytes(), COMPRESSED, Botan::BigInt::encode_1363(), get_affine_x(), get_affine_y(), Botan::BigInt::get_bit(), Botan::CurveGFp::get_p(), HYBRID, is_zero(), and UNCOMPRESSED.
Referenced by Botan::ECIES_Encryptor::ECIES_Encryptor(), Botan::EC_PrivateKey::private_key_bits(), and Botan::EC_PublicKey::public_key_bits().
| void Botan::PointGFp::force_affine | ( | ) |
Force this point to affine coordinates
Definition at line 479 of file point_gfp.cpp.
References Botan::CurveGFp::get_1_rep(), Botan::CurveGFp::invert_element(), is_zero(), Botan::CurveGFp::mul_to_tmp(), and Botan::CurveGFp::sqr_to_tmp().
Referenced by force_all_affine().
|
static |
Force all points on the list to affine coordinates
Definition at line 420 of file point_gfp.cpp.
References force_affine(), Botan::CurveGFp::get_1_rep(), Botan::CurveGFp::get_ws_size(), Botan::CurveGFp::invert_element(), Botan::CurveGFp::mul(), Botan::CurveGFp::mul_to_tmp(), Botan::BigInt::resize(), and Botan::CurveGFp::sqr().
Referenced by Botan::PointGFp_Base_Point_Precompute::PointGFp_Base_Point_Precompute(), and Botan::PointGFp_Multi_Point_Precompute::PointGFp_Multi_Point_Precompute().
| BigInt Botan::PointGFp::get_affine_x | ( | ) | const |
get affine x coordinate
Definition at line 499 of file point_gfp.cpp.
References Botan::CurveGFp::from_rep(), Botan::CurveGFp::from_rep_to_tmp(), Botan::CurveGFp::invert_element(), is_affine(), is_zero(), Botan::CurveGFp::mul(), and Botan::CurveGFp::sqr_to_tmp().
Referenced by Botan::EC_Group::blinded_base_point_multiply_x(), encode(), operator==(), Botan::GOST_3410_PublicKey::public_key_bits(), and Botan::sm2_compute_za().
| BigInt Botan::PointGFp::get_affine_y | ( | ) | const |
get affine y coordinate
Definition at line 518 of file point_gfp.cpp.
References Botan::CurveGFp::from_rep(), Botan::CurveGFp::from_rep_to_tmp(), Botan::CurveGFp::invert_element(), is_affine(), is_zero(), Botan::CurveGFp::mul(), Botan::CurveGFp::mul_to_tmp(), and Botan::CurveGFp::sqr_to_tmp().
Referenced by encode(), operator==(), Botan::GOST_3410_PublicKey::public_key_bits(), and Botan::sm2_compute_za().
|
inline |
Return base curve of this point
You should not need to use this
Definition at line 327 of file point_gfp.h.
Referenced by Botan::EC_PublicKey::EC_PublicKey(), and Botan::PointGFp_Base_Point_Precompute::PointGFp_Base_Point_Precompute().
|
inline |
Definition at line 156 of file point_gfp.h.
|
inline |
Definition at line 157 of file point_gfp.h.
|
inline |
Definition at line 158 of file point_gfp.h.
| bool Botan::PointGFp::is_affine | ( | ) | const |
Definition at line 494 of file point_gfp.cpp.
References Botan::CurveGFp::is_one().
Referenced by add_affine(), get_affine_x(), and get_affine_y().
|
inline |
Is this the point at infinity?
Definition at line 184 of file point_gfp.h.
Referenced by add(), add_affine(), Botan::EC_Group::blinded_base_point_multiply_x(), Botan::ECIES_KA_Operation::derive_secret(), encode(), force_affine(), get_affine_x(), get_affine_y(), mult2(), on_the_curve(), operator-=(), operator==(), and Botan::EC_Group::verify_public_element().
| void Botan::PointGFp::mult2 | ( | std::vector< BigInt > & | workspace | ) |
Point doubling
| workspace | temp space, at least WORKSPACE_SIZE elements |
Definition at line 279 of file point_gfp.cpp.
References Botan::CurveGFp::a_is_minus_3(), Botan::CurveGFp::a_is_zero(), Botan::CurveGFp::get_a_rep(), Botan::CurveGFp::get_p(), Botan::CurveGFp::get_ws_size(), is_zero(), Botan::BigInt::is_zero(), Botan::BigInt::mod_add(), Botan::BigInt::mod_mul(), Botan::BigInt::mod_sub(), Botan::CurveGFp::mul(), PointGFp(), Botan::CurveGFp::sqr(), and Botan::BigInt::swap().
Referenced by add(), add_affine(), double_of(), mult2i(), Botan::operator*(), Botan::PointGFp_Base_Point_Precompute::PointGFp_Base_Point_Precompute(), and Botan::PointGFp_Multi_Point_Precompute::PointGFp_Multi_Point_Precompute().
| void Botan::PointGFp::mult2i | ( | size_t | i, |
| std::vector< BigInt > & | workspace | ||
| ) |
Repeated point doubling
| i | number of doublings to perform |
| workspace | temp space, at least WORKSPACE_SIZE elements |
Definition at line 259 of file point_gfp.cpp.
References Botan::BigInt::is_zero(), mult2(), and PointGFp().
Referenced by Botan::PointGFp_Multi_Point_Precompute::multi_exp().
|
inline |
Negate this point
Definition at line 137 of file point_gfp.h.
Referenced by Botan::PointGFp_Multi_Point_Precompute::multi_exp(), and Botan::operator-().
| bool Botan::PointGFp::on_the_curve | ( | ) | const |
Checks whether the point is to be found on the underlying curve; used to prevent fault attacks.
Definition at line 538 of file point_gfp.cpp.
References Botan::CurveGFp::from_rep_to_tmp(), Botan::CurveGFp::get_a_rep(), Botan::CurveGFp::get_b_rep(), is_zero(), Botan::CurveGFp::mul_to_tmp(), and Botan::CurveGFp::sqr_to_tmp().
Referenced by Botan::EC_PrivateKey::EC_PrivateKey(), Botan::GOST_3410_PublicKey::GOST_3410_PublicKey(), Botan::PointGFp_Base_Point_Precompute::mul(), Botan::operator*(), Botan::EC_Group::verify_group(), and Botan::EC_Group::verify_public_element().
*= Operator
| scalar | the PointGFp to multiply with *this |
Definition at line 388 of file point_gfp.cpp.
+= Operator
| rhs | the PointGFp to add to the local value |
Definition at line 369 of file point_gfp.cpp.
References add(), and WORKSPACE_SIZE.
-= Operator
| rhs | the PointGFp to subtract from the local value |
Definition at line 376 of file point_gfp.cpp.
References is_zero(), and PointGFp().
| bool Botan::PointGFp::operator== | ( | const PointGFp & | other | ) | const |
Equality operator
Definition at line 581 of file point_gfp.cpp.
References get_affine_x(), get_affine_y(), and is_zero().
|
inline |
Point addition
| other | the point to add to *this |
| workspace | temp space, at least WORKSPACE_SIZE elements |
Definition at line 297 of file point_gfp.h.
References add().
Referenced by Botan::PointGFp_Base_Point_Precompute::PointGFp_Base_Point_Precompute(), Botan::PointGFp_Multi_Point_Precompute::PointGFp_Multi_Point_Precompute(), and Botan::PointGFp_Var_Point_Precompute::PointGFp_Var_Point_Precompute().
| void Botan::PointGFp::randomize_repr | ( | RandomNumberGenerator & | rng | ) |
Randomize the point representation The actual value (get_affine_x, get_affine_y) does not change
Definition at line 43 of file point_gfp.cpp.
References Botan::CurveGFp::get_ws_size().
Referenced by Botan::PointGFp_Base_Point_Precompute::mul().
| void Botan::PointGFp::randomize_repr | ( | RandomNumberGenerator & | rng, |
| secure_vector< word > & | ws | ||
| ) |
Randomize the point representation The actual value (get_affine_x, get_affine_y) does not change
Definition at line 49 of file point_gfp.cpp.
References Botan::CurveGFp::get_p(), Botan::CurveGFp::mul_to_tmp(), Botan::BigInt::random_integer(), and Botan::CurveGFp::sqr_to_tmp().
| void Botan::PointGFp::swap | ( | PointGFp & | other | ) |
swaps the states of *this and other, does not throw!
| other | the object to swap values with |
Definition at line 573 of file point_gfp.cpp.
References Botan::BigInt::swap(), and Botan::CurveGFp::swap().
Referenced by Botan::PointGFp_Base_Point_Precompute::PointGFp_Base_Point_Precompute().
Definition at line 160 of file point_gfp.h.
|
inline |
Return the zero (aka infinite) point associated with this curve
Definition at line 319 of file point_gfp.h.
Referenced by Botan::PointGFp_Base_Point_Precompute::mul(), Botan::operator*(), and Botan::PointGFp_Var_Point_Precompute::PointGFp_Var_Point_Precompute().
1.8.9.1