Botan 3.6.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 |
const BigInt & | b () const |
const EC_Point & | base_point () const |
const BigInt & | cofactor () const |
const CurveGFp & | curve () 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) | |
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 |
BigInt | inverse_mod_order (const BigInt &x) const |
std::unique_ptr< EC_Mul2Table_Data > | make_mul2_table (const EC_AffinePoint_Data &pt) const |
BigInt | mod_order (const BigInt &x) const |
BigInt | multiply_mod_order (const BigInt &x, const BigInt &y) const |
BigInt | multiply_mod_order (const BigInt &x, const BigInt &y, const BigInt &z) 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 |
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 |
BigInt | square_mod_order (const BigInt &x) const |
~EC_Group_Data () | |
Definition at line 114 of file ec_inner_data.h.
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 ) |
Definition at line 19 of file ec_inner_data.cpp.
References Botan::OID::empty().
|
default |
|
inline |
Definition at line 146 of file ec_inner_data.h.
References Botan::CurveGFp::get_a().
Referenced by params_match().
|
inline |
Definition at line 174 of file ec_inner_data.h.
|
inline |
Definition at line 176 of file ec_inner_data.h.
|
inline |
Definition at line 148 of file ec_inner_data.h.
References Botan::CurveGFp::get_b().
Referenced by params_match().
|
inline |
Definition at line 172 of file ec_inner_data.h.
|
inline |
Definition at line 152 of file ec_inner_data.h.
Referenced by params_match().
|
inline |
Definition at line 170 of file ec_inner_data.h.
|
inline |
Definition at line 142 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 167 of file ec_inner_data.cpp.
References BOTAN_STATE_CHECK.
|
inline |
Definition at line 156 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 265 of file ec_inner_data.cpp.
Definition at line 182 of file ec_inner_data.h.
References Botan::Modular_Reducer::multiply().
|
inline |
Definition at line 184 of file ec_inner_data.h.
References Botan::Modular_Reducer::multiply().
|
inline |
Definition at line 140 of file ec_inner_data.h.
|
inline |
Definition at line 150 of file ec_inner_data.h.
Referenced by params_match().
|
inline |
Definition at line 166 of file ec_inner_data.h.
|
inline |
Definition at line 168 of file ec_inner_data.h.
|
inline |
Definition at line 154 of file ec_inner_data.h.
|
inline |
Definition at line 144 of file ec_inner_data.h.
References Botan::CurveGFp::get_p().
Referenced by params_match().
|
inline |
Definition at line 162 of file ec_inner_data.h.
|
inline |
Definition at line 164 of file ec_inner_data.h.
bool Botan::EC_Group_Data::params_match | ( | const EC_Group_Data & | other | ) | const |
Definition at line 71 of file ec_inner_data.cpp.
References a(), b(), cofactor(), g_x(), g_y(), order(), and p().
|
inline |
Definition at line 251 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 209 of file ec_inner_data.cpp.
References Botan::OS2ECP().
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 248 of file ec_inner_data.cpp.
References BOTAN_STATE_CHECK, 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 237 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 226 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 187 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 155 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 114 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 84 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 147 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 130 of file ec_inner_data.cpp.
std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_zero | ( | ) | const |
Definition at line 139 of file ec_inner_data.cpp.
void Botan::EC_Group_Data::set_oid | ( | const OID & | oid | ) |
Definition at line 75 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 190 of file ec_inner_data.h.