Botan 3.8.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) 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) 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 |
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 125 of file ec_inner_data.h.
|
default |
References a(), b(), cofactor(), EC_Group_Data(), g_x(), g_y(), oid(), order(), and p().
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 28 of file ec_inner_data.cpp.
References a(), b(), BOTAN_HAS_LEGACY_EC_POINT, cofactor(), g_x(), g_y(), oid(), order(), p(), and source().
Referenced by params_match(), and ~EC_Group_Data().
|
inline |
Definition at line 157 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), params_match(), params_match(), and ~EC_Group_Data().
|
inline |
Definition at line 197 of file ec_inner_data.h.
|
inline |
Definition at line 199 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 437 of file ec_inner_data.cpp.
References affine_add(), Botan::EC_AffinePoint_Data_PC::checked_ref(), and p().
Referenced by affine_add().
std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::affine_neg | ( | const EC_AffinePoint_Data & | p | ) | const |
Definition at line 454 of file ec_inner_data.cpp.
References affine_neg(), Botan::EC_AffinePoint_Data_PC::checked_ref(), and p().
Referenced by affine_neg().
|
inline |
Definition at line 159 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), params_match(), params_match(), and ~EC_Group_Data().
|
inline |
Definition at line 163 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), params_match(), params_match(), and ~EC_Group_Data().
|
static |
Definition at line 103 of file ec_inner_data.cpp.
References a(), b(), cofactor(), create(), g_x(), g_y(), oid(), order(), p(), and source().
Referenced by create().
|
inline |
Definition at line 153 of file ec_inner_data.h.
|
inline |
Definition at line 203 of file ec_inner_data.h.
|
inline |
Definition at line 183 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), params_match(), params_match(), and ~EC_Group_Data().
|
inline |
Definition at line 185 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), params_match(), params_match(), and ~EC_Group_Data().
std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::gk_x_mod_order | ( | const EC_Scalar_Data & | scalar, |
RandomNumberGenerator & | rng ) const |
Definition at line 240 of file ec_inner_data.cpp.
References BOTAN_STATE_CHECK, Botan::EC_Scalar_Data_BN::checked_ref(), Botan::EC_Scalar_Data_PC::checked_ref(), gk_x_mod_order(), and Botan::BigInt::zero().
Referenced by gk_x_mod_order().
|
inline |
Definition at line 181 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 469 of file ec_inner_data.cpp.
References make_mul2_table().
Referenced by make_mul2_table().
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 392 of file ec_inner_data.cpp.
References Botan::EC_AffinePoint_Data_PC::checked_ref(), Botan::EC_Scalar_Data_BN::checked_ref(), Botan::EC_Scalar_Data_PC::checked_ref(), Botan::EC_Point_Var_Point_Precompute::mul(), mul_px_qy(), order(), and p().
Referenced by mul_px_qy().
|
inline |
Definition at line 151 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), set_oid(), and ~EC_Group_Data().
|
inline |
Definition at line 161 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), mul_px_qy(), params_match(), params_match(), and ~EC_Group_Data().
|
inline |
Definition at line 193 of file ec_inner_data.h.
Referenced by scalar_from_bytes_with_trunc().
|
inline |
Definition at line 195 of file ec_inner_data.h.
Referenced by scalar_from_bytes_mod_order().
|
inline |
Definition at line 179 of file ec_inner_data.h.
|
inline |
Definition at line 155 of file ec_inner_data.h.
Referenced by affine_add(), affine_neg(), create(), EC_Group_Data(), mul_px_qy(), params_match(), params_match(), and ~EC_Group_Data().
|
inline |
Definition at line 189 of file ec_inner_data.h.
|
inline |
Definition at line 191 of file ec_inner_data.h.
|
inline |
Definition at line 187 of file ec_inner_data.h.
bool Botan::EC_Group_Data::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 |
Definition at line 125 of file ec_inner_data.cpp.
References a(), b(), cofactor(), g_x(), g_y(), order(), p(), and params_match().
Referenced by params_match(), and params_match().
bool Botan::EC_Group_Data::params_match | ( | const EC_Group_Data & | other | ) | const |
Definition at line 136 of file ec_inner_data.cpp.
References a(), b(), cofactor(), EC_Group_Data(), g_x(), g_y(), order(), p(), and params_match().
|
inline |
Definition at line 268 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 290 of file ec_inner_data.cpp.
References Botan::OS2ECP(), and point_deserialize().
Referenced by point_deserialize().
std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_g_mul | ( | const EC_Scalar_Data & | scalar, |
RandomNumberGenerator & | rng ) const |
Definition at line 371 of file ec_inner_data.cpp.
References BOTAN_STATE_CHECK, Botan::EC_Scalar_Data_BN::checked_ref(), Botan::EC_Scalar_Data_PC::checked_ref(), Botan::EC_Scalar_Data::group(), and point_g_mul().
Referenced by point_g_mul().
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 360 of file ec_inner_data.cpp.
References point_hash_to_curve_nu().
Referenced by point_hash_to_curve_nu().
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 349 of file ec_inner_data.cpp.
References point_hash_to_curve_ro().
Referenced by point_hash_to_curve_ro().
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 264 of file ec_inner_data.cpp.
References Botan::BigInt::is_zero(), and scalar_deserialize().
Referenced by scalar_deserialize(), and scalar_from_bigint().
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 224 of file ec_inner_data.cpp.
References scalar_deserialize(), scalar_from_bigint(), and Botan::BigInt::serialize().
Referenced by scalar_from_bigint().
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 179 of file ec_inner_data.cpp.
References order_bytes(), and scalar_from_bytes_mod_order().
Referenced by scalar_from_bytes_mod_order(), and scalar_from_bytes_with_trunc().
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 149 of file ec_inner_data.cpp.
References Botan::carry(), order_bits(), scalar_from_bytes_mod_order(), and scalar_from_bytes_with_trunc().
Referenced by scalar_from_bytes_with_trunc().
std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_one | ( | ) | const |
Definition at line 212 of file ec_inner_data.cpp.
References Botan::BigInt::one(), and scalar_one().
Referenced by scalar_one().
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 199 of file ec_inner_data.cpp.
References Botan::BigInt::one(), Botan::BigInt::random_integer(), and scalar_random().
Referenced by scalar_random().
void Botan::EC_Group_Data::set_oid | ( | const OID & | oid | ) |
Definition at line 140 of file ec_inner_data.cpp.
References BOTAN_ARG_CHECK, BOTAN_STATE_CHECK, Botan::DER_Encoder::encode(), oid(), and set_oid().
Referenced by set_oid().
|
inline |
Definition at line 201 of file ec_inner_data.h.
Referenced by create(), and EC_Group_Data().