Botan 3.6.1
Crypto and TLS for C&
|
#include <ec_apoint.h>
Public Member Functions | |
const std::shared_ptr< const EC_Group_Data > & | _group () const |
const EC_AffinePoint_Data & | _inner () const |
EC_AffinePoint (const EC_AffinePoint &other) | |
EC_AffinePoint (const EC_Group &group, const EC_Point &pt) | |
EC_AffinePoint (const EC_Group &group, std::span< const uint8_t > bytes) | |
EC_AffinePoint (EC_AffinePoint &&other) noexcept | |
size_t | field_element_bytes () const |
bool | is_identity () const |
Return true if this point is the identity element. | |
EC_AffinePoint | mul (const EC_Scalar &scalar, RandomNumberGenerator &rng, std::vector< BigInt > &ws) const |
EC_AffinePoint & | operator= (const EC_AffinePoint &other) |
EC_AffinePoint & | operator= (EC_AffinePoint &&other) noexcept |
template<concepts::resizable_byte_buffer T = std::vector<uint8_t>> | |
T | serialize_compressed () const |
void | serialize_compressed_to (std::span< uint8_t > bytes) const |
template<concepts::resizable_byte_buffer T = std::vector<uint8_t>> | |
T | serialize_uncompressed () const |
void | serialize_uncompressed_to (std::span< uint8_t > bytes) const |
void | serialize_x_to (std::span< uint8_t > bytes) const |
void | serialize_xy_to (std::span< uint8_t > bytes) const |
void | serialize_y_to (std::span< uint8_t > bytes) const |
EC_Point | to_legacy_point () const |
template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>> | |
T | x_bytes () const |
template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>> | |
T | xy_bytes () const |
template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>> | |
T | y_bytes () const |
~EC_AffinePoint () | |
Static Public Member Functions | |
static EC_AffinePoint | _from_inner (std::unique_ptr< EC_AffinePoint_Data > inner) |
static std::optional< EC_AffinePoint > | deserialize (const EC_Group &group, std::span< const uint8_t > bytes) |
static std::optional< EC_AffinePoint > | from_bigint_xy (const EC_Group &group, const BigInt &x, const BigInt &y) |
static EC_AffinePoint | g_mul (const EC_Scalar &scalar, RandomNumberGenerator &rng, std::vector< BigInt > &ws) |
static EC_AffinePoint | generator (const EC_Group &group) |
Return the standard group generator. | |
static EC_AffinePoint | hash_to_curve_nu (const EC_Group &group, std::string_view hash_fn, std::span< const uint8_t > input, std::span< const uint8_t > domain_sep) |
static EC_AffinePoint | hash_to_curve_ro (const EC_Group &group, std::string_view hash_fn, std::span< const uint8_t > input, std::span< const uint8_t > domain_sep) |
static EC_AffinePoint | identity (const EC_Group &group) |
Return the identity element. | |
Friends | |
class | EC_Mul2Table |
Definition at line 29 of file ec_apoint.h.
Botan::EC_AffinePoint::EC_AffinePoint | ( | const EC_Group & | group, |
std::span< const uint8_t > | bytes ) |
Point deserialization. Throws if wrong length or not a valid point
This accepts SEC1 compressed or uncompressed formats
Definition at line 35 of file ec_apoint.cpp.
References Botan::EC_Group::_data().
Referenced by _from_inner(), deserialize(), g_mul(), generator(), hash_to_curve_nu(), hash_to_curve_ro(), identity(), and mul().
Botan::EC_AffinePoint::EC_AffinePoint | ( | const EC_AffinePoint & | other | ) |
Definition at line 19 of file ec_apoint.cpp.
|
noexcept |
Definition at line 21 of file ec_apoint.cpp.
Deprecated conversion
Definition at line 42 of file ec_apoint.cpp.
|
default |
|
static |
Definition at line 143 of file ec_apoint.cpp.
References EC_AffinePoint().
Referenced by Botan::EC_Group::Mul2Table::mul2_vartime().
const std::shared_ptr< const EC_Group_Data > & Botan::EC_AffinePoint::_group | ( | ) | const |
Definition at line 147 of file ec_apoint.cpp.
References Botan::EC_AffinePoint_Data::group().
|
inline |
Definition at line 190 of file ec_apoint.h.
|
static |
Point deserialization. Returns nullopt if wrong length or not a valid point
This accepts SEC1 compressed or uncompressed formats
Definition at line 97 of file ec_apoint.cpp.
References Botan::EC_Group::_data(), and EC_AffinePoint().
Referenced by from_bigint_xy().
size_t Botan::EC_AffinePoint::field_element_bytes | ( | ) | const |
Return the number of bytes of a field element
A point consists of two field elements, plus possibly a header
Definition at line 71 of file ec_apoint.cpp.
References Botan::EC_AffinePoint_Data::field_element_bytes().
|
static |
Create a point from a pair (x,y) of integers
The integers must be within the field - in the range [0,p) and must satisfy the curve equation
Definition at line 54 of file ec_apoint.cpp.
References deserialize(), Botan::EC_Group::get_p(), Botan::EC_Group::get_p_bytes(), Botan::BigInt::is_negative(), and Botan::BigInt::serialize_to().
|
static |
Multiply by the group generator returning a complete point
Workspace argument is transitional
Definition at line 105 of file ec_apoint.cpp.
References Botan::EC_Scalar::_inner(), EC_AffinePoint(), and Botan::EC_Scalar_Data::group().
Referenced by Botan::EC_PrivateKey_Data::public_key().
|
static |
Return the standard group generator.
Definition at line 50 of file ec_apoint.cpp.
References EC_AffinePoint(), and Botan::EC_Group::get_base_point().
|
static |
Hash to curve (RFC 9380), non uniform variant
Only supported for specific groups
Definition at line 87 of file ec_apoint.cpp.
References Botan::EC_Group::_data(), and EC_AffinePoint().
|
static |
Hash to curve (RFC 9380), random oracle variant
Only supported for specific groups
Definition at line 79 of file ec_apoint.cpp.
References Botan::EC_Group::_data(), and EC_AffinePoint().
|
static |
Return the identity element.
Definition at line 45 of file ec_apoint.cpp.
References EC_AffinePoint().
bool Botan::EC_AffinePoint::is_identity | ( | ) | const |
Return true if this point is the identity element.
Definition at line 75 of file ec_apoint.cpp.
References Botan::EC_AffinePoint_Data::is_identity().
Referenced by serialize_compressed_to(), serialize_uncompressed_to(), serialize_x_to(), serialize_xy_to(), and serialize_y_to().
EC_AffinePoint Botan::EC_AffinePoint::mul | ( | const EC_Scalar & | scalar, |
RandomNumberGenerator & | rng, | ||
std::vector< BigInt > & | ws ) const |
Multiply a point by a scalar returning a complete point
Workspace argument is transitional
Definition at line 110 of file ec_apoint.cpp.
References Botan::EC_Scalar::_inner(), EC_AffinePoint(), and mul().
Referenced by mul().
EC_AffinePoint & Botan::EC_AffinePoint::operator= | ( | const EC_AffinePoint & | other | ) |
Definition at line 23 of file ec_apoint.cpp.
References Botan::EC_AffinePoint_Data::clone().
|
noexcept |
Definition at line 30 of file ec_apoint.cpp.
|
inline |
Return the bytes of the affine x and y coordinates in a container
This function will fail if this point is the identity element
Definition at line 166 of file ec_apoint.h.
References T.
void Botan::EC_AffinePoint::serialize_compressed_to | ( | std::span< uint8_t > | bytes | ) | const |
Write the fixed length SEC1 compressed encoding
The output span must be exactly 1 + field_element_bytes long
This function will fail if this point is the identity element
Definition at line 129 of file ec_apoint.cpp.
References BOTAN_STATE_CHECK, and is_identity().
|
inline |
Return the bytes of the affine x and y coordinates in a container
This function will fail if this point is the identity element
Definition at line 156 of file ec_apoint.h.
References T.
void Botan::EC_AffinePoint::serialize_uncompressed_to | ( | std::span< uint8_t > | bytes | ) | const |
Return the fixed length encoding of SEC1 uncompressed encoding
The output span must be exactly 1 + 2*field_element_bytes long
This function will fail if this point is the identity element
Definition at line 134 of file ec_apoint.cpp.
References BOTAN_STATE_CHECK, and is_identity().
void Botan::EC_AffinePoint::serialize_x_to | ( | std::span< uint8_t > | bytes | ) | const |
Write the fixed length encoding of affine x coordinate
The output span must be exactly field_element_bytes long
This function will fail if this point is the identity element
Definition at line 114 of file ec_apoint.cpp.
References BOTAN_STATE_CHECK, and is_identity().
void Botan::EC_AffinePoint::serialize_xy_to | ( | std::span< uint8_t > | bytes | ) | const |
Write the fixed length encoding of affine x and y coordinates
The output span must be exactly 2*field_element_bytes long
This function will fail if this point is the identity element
Definition at line 124 of file ec_apoint.cpp.
References BOTAN_STATE_CHECK, and is_identity().
void Botan::EC_AffinePoint::serialize_y_to | ( | std::span< uint8_t > | bytes | ) | const |
Write the fixed length encoding of affine y coordinate
The output span must be exactly field_element_bytes long
This function will fail if this point is the identity element
Definition at line 119 of file ec_apoint.cpp.
References BOTAN_STATE_CHECK, and is_identity().
EC_Point Botan::EC_AffinePoint::to_legacy_point | ( | ) | const |
Deprecated conversion
Definition at line 139 of file ec_apoint.cpp.
Referenced by Botan::EC_Group::OS2ECP().
|
inline |
Return the bytes of the affine x coordinate in a container
This function will fail if this point is the identity element
Definition at line 126 of file ec_apoint.h.
References T.
|
inline |
Return the bytes of the affine x and y coordinates in a container
This function will fail if this point is the identity element
Definition at line 146 of file ec_apoint.h.
References T.
|
inline |
Return the bytes of the affine y coordinate in a container
This function will fail if this point is the identity element
Definition at line 136 of file ec_apoint.h.
References T.
|
friend |
Definition at line 197 of file ec_apoint.h.