Botan
2.1.0
Crypto and TLS for C++11
|
#include <point_gfp.h>
Public Types | |
enum | Compression_Type { UNCOMPRESSED = 0, COMPRESSED = 1, HYBRID = 2 } |
Public Member Functions | |
BigInt | get_affine_x () const |
BigInt | get_affine_y () const |
const CurveGFp & | get_curve () const |
bool | is_zero () const |
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 ()=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 | swap (PointGFp &other) |
Static Public Member Functions | |
static PointGFp | zero_of (const CurveGFp &curve) |
Friends | |
class | Blinded_Point_Multiply |
BOTAN_DLL PointGFp | multi_exponentiate (const PointGFp &p1, const BigInt &z1, const PointGFp &p2, const BigInt &z2) |
BOTAN_DLL PointGFp | operator* (const BigInt &scalar, const PointGFp &point) |
This class represents one point on a curve of GF(p)
Definition at line 41 of file point_gfp.h.
Enumerator | |
---|---|
UNCOMPRESSED | |
COMPRESSED | |
HYBRID |
Definition at line 44 of file point_gfp.h.
|
default |
Construct an uninitialized PointGFp
Referenced by operator-=().
|
explicit |
Construct the zero point
curve | The base curve |
Definition at line 18 of file point_gfp.cpp.
References Botan::CurveGFp::to_rep().
|
default |
Copy constructor
|
inline |
Construct a point from its affine coordinates
curve | the base curve |
x | affine x coordinate |
y | affine y coordinate |
Definition at line 29 of file point_gfp.cpp.
References Botan::CurveGFp::get_p(), and Botan::CurveGFp::to_rep().
BigInt Botan::PointGFp::get_affine_x | ( | ) | const |
get affine x coordinate
Definition at line 390 of file point_gfp.cpp.
References Botan::CurveGFp::from_rep(), Botan::CurveGFp::get_p(), Botan::inverse_mod(), and is_zero().
Referenced by Botan::EC2OSP(), operator==(), and Botan::GOST_3410_PublicKey::public_key_bits().
BigInt Botan::PointGFp::get_affine_y | ( | ) | const |
get affine y coordinate
Definition at line 402 of file point_gfp.cpp.
References Botan::CurveGFp::get_p(), Botan::inverse_mod(), is_zero(), and Botan::CurveGFp::to_rep().
Referenced by Botan::EC2OSP(), operator==(), and Botan::GOST_3410_PublicKey::public_key_bits().
|
inline |
Return base curve of this point
Definition at line 159 of file point_gfp.h.
References m_curve.
Referenced by Botan::Blinded_Point_Multiply::Blinded_Point_Multiply(), Botan::EC2OSP(), Botan::multi_exponentiate(), Botan::operator*(), and operator==().
|
inline |
Is this the point at infinity?
Definition at line 177 of file point_gfp.h.
Referenced by Botan::EC_PublicKey::check_key(), Botan::ECIES_KA_Operation::derive_secret(), Botan::EC2OSP(), get_affine_x(), get_affine_y(), on_the_curve(), operator-=(), and operator==().
|
inline |
Negate this point
Definition at line 148 of file point_gfp.h.
References Botan::CT::is_zero(), and m_curve.
Referenced by 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 414 of file point_gfp.cpp.
References Botan::CurveGFp::from_rep(), Botan::CurveGFp::get_a_rep(), Botan::CurveGFp::get_b_rep(), and is_zero().
Referenced by Botan::EC_PublicKey::check_key(), Botan::EC_PrivateKey::EC_PrivateKey(), Botan::GOST_3410_PublicKey::GOST_3410_PublicKey(), Botan::OS2ECP(), and Botan::EC_Group::verify_group().
*= Operator
scalar | the PointGFp to multiply with *this |
Definition at line 242 of file point_gfp.cpp.
+= Operator
rhs | the PointGFp to add to the local value |
Definition at line 223 of file point_gfp.cpp.
-= Operator
rhs | the PointGFp to subtract from the local value |
Definition at line 230 of file point_gfp.cpp.
References is_zero(), and PointGFp().
bool Botan::PointGFp::operator== | ( | const PointGFp & | other | ) | const |
Equality operator
Definition at line 456 of file point_gfp.cpp.
References get_affine_x(), get_affine_y(), get_curve(), and is_zero().
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 45 of file point_gfp.cpp.
References Botan::BigInt::is_zero(), Botan::BigInt::randomize(), and Botan::CurveGFp::to_rep().
Referenced by Botan::Blinded_Point_Multiply::blinded_multiply().
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 447 of file point_gfp.cpp.
References Botan::BigInt::swap(), and Botan::CurveGFp::swap().
Definition at line 61 of file point_gfp.h.
Referenced by Botan::Blinded_Point_Multiply::Blinded_Point_Multiply().
|
friend |
Definition at line 204 of file point_gfp.h.
|
friend |
Multiexponentiation
p1 | a point |
z1 | a scalar |
p2 | a point |
z2 | a scalar |
Definition at line 248 of file point_gfp.cpp.
Multiplication Operator
scalar | the scalar value |
point | the point value |
Definition at line 281 of file point_gfp.cpp.