Botan
1.10.16
|
#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) |
bool | operator== (const PointGFp &other) const |
PointGFp () | |
PointGFp (const CurveGFp &curve) | |
PointGFp (const CurveGFp &curve, const BigInt &x, const BigInt &y) | |
void | swap (PointGFp &other) |
Friends | |
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.
|
inline |
Construct an uninitialized PointGFp
Definition at line 53 of file point_gfp.h.
References Botan::multi_exponentiate(), Botan::operator*(), and Botan::operator+=().
Referenced by Botan::operator*(), operator-=(), and Botan::OS2ECP().
Botan::PointGFp::PointGFp | ( | const CurveGFp & | curve | ) |
Construct the zero point
curve | The base curve |
Definition at line 18 of file point_gfp.cpp.
References Botan::CurveGFp::get_r2().
Construct a point from its affine coordinates
curve | the base curve |
x | affine x coordinate |
y | affine y coordinate |
Definition at line 26 of file point_gfp.cpp.
References Botan::bigint_monty_mul(), Botan::bigint_monty_sqr(), BOTAN_ASSERT, Botan::BigInt::data(), Botan::CurveGFp::get_p(), Botan::CurveGFp::get_p_dash(), Botan::CurveGFp::get_p_words(), Botan::CurveGFp::get_r2(), Botan::BigInt::get_reg(), is_zero(), Botan::BigInt::is_zero(), Botan::MemoryRegion< T >::resize(), Botan::BigInt::sig_words(), Botan::MemoryRegion< T >::size(), Botan::BigInt::size(), and Botan::zeroise().
BigInt Botan::PointGFp::get_affine_x | ( | ) | const |
get affine x coordinate
Definition at line 400 of file point_gfp.cpp.
References Botan::CurveGFp::get_p(), Botan::CurveGFp::get_r2(), Botan::inverse_mod(), and is_zero().
Referenced by Botan::ECDH_KA_Operation::agree(), Botan::EC2OSP(), and operator==().
BigInt Botan::PointGFp::get_affine_y | ( | ) | const |
get affine y coordinate
Definition at line 414 of file point_gfp.cpp.
References Botan::CurveGFp::get_p(), Botan::CurveGFp::get_r2(), Botan::inverse_mod(), and is_zero().
Referenced by Botan::EC2OSP(), and operator==().
|
inline |
Return base curve of this point
Definition at line 128 of file point_gfp.h.
Referenced by Botan::EC2OSP(), Botan::operator*(), and operator==().
|
inline |
Is this the point at infinity?
Definition at line 146 of file point_gfp.h.
References Botan::operator==(), and std::swap().
Referenced by Botan::EC2OSP(), get_affine_x(), get_affine_y(), on_the_curve(), operator-=(), operator==(), and PointGFp().
|
inline |
Negate this point
Definition at line 117 of file point_gfp.h.
References Botan::CurveGFp::get_p(), and Botan::CT::is_zero().
Referenced by Botan::multi_exponentiate(), Botan::operator*(), 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 427 of file point_gfp.cpp.
References Botan::CurveGFp::get_a_r(), Botan::CurveGFp::get_b_r(), and is_zero().
Referenced by Botan::ECDH_KA_Operation::agree(), Botan::EC_PublicKey::check_key(), Botan::EC_PrivateKey::EC_PrivateKey(), and Botan::OS2ECP().
*= Operator
scalar | the PointGFp to multiply with *this |
Definition at line 259 of file point_gfp.cpp.
+= Operator
rhs | the PointGFp to add to the local value |
Definition at line 240 of file point_gfp.cpp.
-= Operator
rhs | the PointGFp to subtract from the local value |
Definition at line 247 of file point_gfp.cpp.
References is_zero(), and PointGFp().
bool Botan::PointGFp::operator== | ( | const PointGFp & | other | ) | const |
Equality operator
Definition at line 476 of file point_gfp.cpp.
References get_affine_x(), get_affine_y(), get_curve(), and is_zero().
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 467 of file point_gfp.cpp.
References Botan::CurveGFp::swap(), Botan::MemoryRegion< T >::swap(), and Botan::BigInt::swap().
|
friend |
Multiexponentiation
p1 | a point |
z1 | a scalar |
p2 | a point |
z2 | a scalar |
Definition at line 265 of file point_gfp.cpp.
Multiplication Operator
scalar | the scalar value |
point | the point value |
Definition at line 298 of file point_gfp.cpp.