Botan 3.7.1
Crypto and TLS for C&
|
#include <ec_inner_data.h>
Public Member Functions | |
const BigInt & | a () const |
bool | a_is_minus_3 () const |
bool | a_is_zero () const |
std::unique_ptr< EC_AffinePoint_Data > | affine_add (const EC_AffinePoint_Data &p, const EC_AffinePoint_Data &q) const |
std::unique_ptr< EC_AffinePoint_Data > | affine_neg (const EC_AffinePoint_Data &p) const |
const BigInt & | b () const |
const BigInt & | cofactor () const |
const std::vector< uint8_t > & | der_named_curve () const |
EC_Group_Data (const BigInt &p, const BigInt &a, const BigInt &b, const BigInt &g_x, const BigInt &g_y, const BigInt &order, const BigInt &cofactor, const OID &oid, EC_Group_Source source) | |
EC_Group_Engine | engine () const |
const BigInt & | g_x () const |
const BigInt & | g_y () const |
std::unique_ptr< EC_Scalar_Data > | gk_x_mod_order (const EC_Scalar_Data &scalar, RandomNumberGenerator &rng, std::vector< BigInt > &ws) const |
bool | has_cofactor () const |
std::unique_ptr< EC_Mul2Table_Data > | make_mul2_table (const EC_AffinePoint_Data &pt) const |
std::unique_ptr< EC_AffinePoint_Data > | mul_px_qy (const EC_AffinePoint_Data &p, const EC_Scalar_Data &x, const EC_AffinePoint_Data &q, const EC_Scalar_Data &y, RandomNumberGenerator &rng) const |
const OID & | oid () const |
const BigInt & | order () const |
size_t | order_bits () const |
size_t | order_bytes () const |
bool | order_is_less_than_p () const |
const BigInt & | p () const |
size_t | p_bits () const |
size_t | p_bytes () const |
size_t | p_words () const |
bool | params_match (const BigInt &p, const BigInt &a, const BigInt &b, const BigInt &g_x, const BigInt &g_y, const BigInt &order, const BigInt &cofactor) const |
bool | params_match (const EC_Group_Data &other) const |
const PCurve::PrimeOrderCurve & | pcurve () const |
std::unique_ptr< EC_AffinePoint_Data > | point_deserialize (std::span< const uint8_t > bytes) const |
std::unique_ptr< EC_AffinePoint_Data > | point_g_mul (const EC_Scalar_Data &scalar, RandomNumberGenerator &rng, std::vector< BigInt > &ws) const |
std::unique_ptr< EC_AffinePoint_Data > | point_hash_to_curve_nu (std::string_view hash_fn, std::span< const uint8_t > input, std::span< const uint8_t > domain_sep) const |
std::unique_ptr< EC_AffinePoint_Data > | point_hash_to_curve_ro (std::string_view hash_fn, std::span< const uint8_t > input, std::span< const uint8_t > domain_sep) const |
std::unique_ptr< EC_Scalar_Data > | scalar_deserialize (std::span< const uint8_t > bytes) const |
std::unique_ptr< EC_Scalar_Data > | scalar_from_bigint (const BigInt &bn) const |
std::unique_ptr< EC_Scalar_Data > | scalar_from_bytes_mod_order (std::span< const uint8_t > bytes) const |
std::unique_ptr< EC_Scalar_Data > | scalar_from_bytes_with_trunc (std::span< const uint8_t > bytes) const |
std::unique_ptr< EC_Scalar_Data > | scalar_one () const |
std::unique_ptr< EC_Scalar_Data > | scalar_random (RandomNumberGenerator &rng) const |
std::unique_ptr< EC_Scalar_Data > | scalar_zero () const |
void | set_oid (const OID &oid) |
EC_Group_Source | source () const |
~EC_Group_Data () | |
Static Public Member Functions | |
static std::shared_ptr< EC_Group_Data > | create (const BigInt &p, const BigInt &a, const BigInt &b, const BigInt &g_x, const BigInt &g_y, const BigInt &order, const BigInt &cofactor, const OID &oid, EC_Group_Source source) |
Definition at line 128 of file ec_inner_data.h.
|
default |
Botan::EC_Group_Data::EC_Group_Data | ( | const BigInt & | p, |
const BigInt & | a, | ||
const BigInt & | b, | ||
const BigInt & | g_x, | ||
const BigInt & | g_y, | ||
const BigInt & | order, | ||
const BigInt & | cofactor, | ||
const OID & | oid, | ||
EC_Group_Source | source ) |
Note this constructor should only be called by EC_Group_Data::create.
It is only public to allow use of std::make_shared
Definition at line 24 of file ec_inner_data.cpp.
References Botan::OID::empty().
|
inline |
|
inline |
Definition at line 200 of file ec_inner_data.h.
|
inline |
Definition at line 202 of file ec_inner_data.h.
std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::affine_add | ( | const EC_AffinePoint_Data & | p, |
const EC_AffinePoint_Data & | q ) const |
Definition at line 397 of file ec_inner_data.cpp.
std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::affine_neg | ( | const EC_AffinePoint_Data & | p | ) | const |
Definition at line 415 of file ec_inner_data.cpp.
|
inline |
|
inline |
Definition at line 166 of file ec_inner_data.h.
Referenced by params_match().
|
static |
Definition at line 88 of file ec_inner_data.cpp.
References Botan::b.
|
inline |
Definition at line 156 of file ec_inner_data.h.
|
inline |
Definition at line 206 of file ec_inner_data.h.
|
inline |
|
inline |
std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::gk_x_mod_order | ( | const EC_Scalar_Data & | scalar, |
RandomNumberGenerator & | rng, | ||
std::vector< BigInt > & | ws ) const |
Definition at line 237 of file ec_inner_data.cpp.
References BOTAN_STATE_CHECK, and BOTAN_UNUSED.
|
inline |
Definition at line 184 of file ec_inner_data.h.
std::unique_ptr< EC_Mul2Table_Data > Botan::EC_Group_Data::make_mul2_table | ( | const EC_AffinePoint_Data & | pt | ) | const |
Definition at line 430 of file ec_inner_data.cpp.
std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::mul_px_qy | ( | const EC_AffinePoint_Data & | p, |
const EC_Scalar_Data & | x, | ||
const EC_AffinePoint_Data & | q, | ||
const EC_Scalar_Data & | y, | ||
RandomNumberGenerator & | rng ) const |
Definition at line 352 of file ec_inner_data.cpp.
References Botan::EC_AffinePoint_Data::group(), and Botan::EC_Point_Var_Point_Precompute::mul().
|
inline |
Definition at line 154 of file ec_inner_data.h.
|
inline |
Definition at line 164 of file ec_inner_data.h.
Referenced by params_match().
|
inline |
Definition at line 196 of file ec_inner_data.h.
|
inline |
Definition at line 198 of file ec_inner_data.h.
|
inline |
Definition at line 182 of file ec_inner_data.h.
|
inline |
|
inline |
Definition at line 192 of file ec_inner_data.h.
|
inline |
Definition at line 194 of file ec_inner_data.h.
Referenced by Botan::EC_Point::encode(), Botan::EC_Point::x_bytes(), Botan::EC_Point::xy_bytes(), and Botan::EC_Point::y_bytes().
|
inline |
Definition at line 190 of file ec_inner_data.h.
bool Botan::EC_Group_Data::params_match | ( | const EC_Group_Data & | other | ) | const |
Definition at line 121 of file ec_inner_data.cpp.
References a(), b(), cofactor(), g_x(), g_y(), order(), and p().
|
inline |
Definition at line 277 of file ec_inner_data.h.
References BOTAN_ASSERT_NONNULL.
std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_deserialize | ( | std::span< const uint8_t > | bytes | ) | const |
Deserialize a point
Returns nullptr if the point encoding was invalid or not on the curve
Definition at line 288 of file ec_inner_data.cpp.
std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_g_mul | ( | const EC_Scalar_Data & | scalar, |
RandomNumberGenerator & | rng, | ||
std::vector< BigInt > & | ws ) const |
Definition at line 330 of file ec_inner_data.cpp.
References BOTAN_STATE_CHECK, BOTAN_UNUSED, and Botan::EC_Scalar_Data::group().
std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_hash_to_curve_nu | ( | std::string_view | hash_fn, |
std::span< const uint8_t > | input, | ||
std::span< const uint8_t > | domain_sep ) const |
Definition at line 319 of file ec_inner_data.cpp.
std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_hash_to_curve_ro | ( | std::string_view | hash_fn, |
std::span< const uint8_t > | input, | ||
std::span< const uint8_t > | domain_sep ) const |
Definition at line 308 of file ec_inner_data.cpp.
std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_deserialize | ( | std::span< const uint8_t > | bytes | ) | const |
Scalar from bytes
This returns a value only if the bytes represent (in big-endian encoding) an integer that is less than n, where n is the group order. It requires that the fixed length encoding (with zero prefix) be used. It also rejects inputs that encode zero. Thus the accepted range is [1,n)
If the input is rejected then nullptr is returned
Definition at line 262 of file ec_inner_data.cpp.
References Botan::BigInt::is_zero().
std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_from_bigint | ( | const BigInt & | bn | ) | const |
Scalar from BigInt
This returns a value only if bn is in [1,n) where n is the group order. Otherwise it returns nullptr
Definition at line 221 of file ec_inner_data.cpp.
References Botan::BigInt::serialize().
std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_from_bytes_mod_order | ( | std::span< const uint8_t > | bytes | ) | const |
Scalar from bytes with modular reduction
This returns a value only if bytes represents (in big-endian encoding) an integer that is at most the square of the scalar group size. Otherwise it returns nullptr.
Definition at line 164 of file ec_inner_data.cpp.
std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_from_bytes_with_trunc | ( | std::span< const uint8_t > | bytes | ) | const |
Scalar from bytes with ECDSA style trunction
This should always succeed
Definition at line 134 of file ec_inner_data.cpp.
References Botan::carry().
std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_one | ( | ) | const |
Definition at line 209 of file ec_inner_data.cpp.
std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_random | ( | RandomNumberGenerator & | rng | ) | const |
Return a random scalar
This will be in the range [1,n) where n is the group order
Definition at line 184 of file ec_inner_data.cpp.
std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_zero | ( | ) | const |
Definition at line 197 of file ec_inner_data.cpp.
void Botan::EC_Group_Data::set_oid | ( | const OID & | oid | ) |
Definition at line 125 of file ec_inner_data.cpp.
References BOTAN_ARG_CHECK, BOTAN_STATE_CHECK, Botan::OID::empty(), and Botan::DER_Encoder::encode().
|
inline |
Definition at line 204 of file ec_inner_data.h.