|
Botan 3.13.0
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_Data (const EC_Group_Data &other)=delete | |
| EC_Group_Data (EC_Group_Data &&other)=delete | |
| 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 |
| bool | hash_to_curve_supported (std::string_view hash_fn) 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 |
| EC_Group_Data & | operator= (const EC_Group_Data &other)=delete |
| EC_Group_Data & | operator= (EC_Group_Data &&other)=delete |
| 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 BigInt &p, const BigInt &a, const BigInt &b, std::span< const uint8_t > base_pt, 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_compressed (std::span< const uint8_t > bytes) const |
| std::unique_ptr< EC_AffinePoint_Data > | point_deserialize_uncompressed (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_AffinePoint_Data > | point_identity () const |
| Return the identity element (aka the point at infinity). | |
| 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 127 of file ec_inner_data.h.
|
default |
|
delete |
References EC_Group_Data().
Referenced by EC_Group_Data(), EC_Group_Data(), operator=(), operator=(), and params_match().
|
delete |
References EC_Group_Data().
| 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 31 of file ec_inner_data.cpp.
References a(), b(), BOTAN_HAS_LEGACY_EC_POINT, cofactor(), Botan::DER_Encoder::encode(), Botan::fmt(), Botan::PCurve::PrimeOrderCurve::for_named_curve(), Botan::Barrett_Reduction::for_public_modulus(), Botan::PCurve::PrimeOrderCurve::from_params(), g_x(), g_y(), Botan::Generic, Botan::Legacy, oid(), Botan::Optimized, order(), p(), source(), and Botan::BigInt::square().
|
inline |
Definition at line 172 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), operator=(), params_match(), params_match(), and params_match().
|
inline |
Definition at line 212 of file ec_inner_data.h.
|
inline |
Definition at line 214 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 604 of file ec_inner_data.cpp.
References Botan::EC_AffinePoint_Data_PC::checked_ref(), and p().
| std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::affine_neg | ( | const EC_AffinePoint_Data & | p | ) | const |
Definition at line 621 of file ec_inner_data.cpp.
References Botan::EC_AffinePoint_Data_PC::checked_ref(), and p().
|
inline |
Definition at line 174 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), operator=(), params_match(), params_match(), and params_match().
|
inline |
Definition at line 178 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), operator=(), params_match(), params_match(), and params_match().
|
static |
Definition at line 113 of file ec_inner_data.cpp.
References a(), b(), cofactor(), g_x(), g_y(), oid(), order(), p(), and source().
|
inline |
Definition at line 168 of file ec_inner_data.h.
|
inline |
Definition at line 218 of file ec_inner_data.h.
|
inline |
Definition at line 198 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), operator=(), params_match(), params_match(), and params_match().
|
inline |
Definition at line 200 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), operator=(), params_match(), params_match(), and params_match().
| 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 334 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 196 of file ec_inner_data.h.
| bool Botan::EC_Group_Data::hash_to_curve_supported | ( | std::string_view | hash_fn | ) | const |
Return true if point_hash_to_curve_ro/point_hash_to_curve_nu will work for this group when using the specified hash function
Definition at line 486 of file ec_inner_data.cpp.
References BOTAN_UNUSED, Botan::HashFunction::create(), and order_bits().
| std::unique_ptr< EC_Mul2Table_Data > Botan::EC_Group_Data::make_mul2_table | ( | const EC_AffinePoint_Data & | pt | ) | const |
Definition at line 636 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 559 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(), order(), and p().
|
inline |
Definition at line 166 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), operator=(), and set_oid().
|
delete |
References EC_Group_Data().
|
delete |
References a(), b(), cofactor(), EC_Group_Data(), g_x(), g_y(), oid(), order(), and p().
|
inline |
Definition at line 176 of file ec_inner_data.h.
Referenced by create(), EC_Group_Data(), mul_px_qy(), operator=(), params_match(), params_match(), and params_match().
|
inline |
Definition at line 208 of file ec_inner_data.h.
Referenced by hash_to_curve_supported(), point_hash_to_curve_nu(), point_hash_to_curve_ro(), and scalar_from_bytes_with_trunc().
|
inline |
Definition at line 210 of file ec_inner_data.h.
Referenced by scalar_from_bytes_mod_order().
|
inline |
Definition at line 194 of file ec_inner_data.h.
|
inline |
Definition at line 170 of file ec_inner_data.h.
Referenced by affine_add(), affine_neg(), create(), EC_Group_Data(), mul_px_qy(), operator=(), params_match(), params_match(), and params_match().
|
inline |
Definition at line 204 of file ec_inner_data.h.
|
inline |
Definition at line 206 of file ec_inner_data.h.
Referenced by params_match(), point_deserialize_compressed(), and point_deserialize_uncompressed().
|
inline |
Definition at line 202 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 135 of file ec_inner_data.cpp.
References a(), b(), cofactor(), g_x(), g_y(), order(), and p().
Referenced by params_match().
| bool Botan::EC_Group_Data::params_match | ( | const BigInt & | p, |
| const BigInt & | a, | ||
| const BigInt & | b, | ||
| std::span< const uint8_t > | base_pt, | ||
| const BigInt & | order, | ||
| const BigInt & | cofactor ) const |
Definition at line 167 of file ec_inner_data.cpp.
References a(), b(), cofactor(), g_x(), g_y(), order(), p(), and p_bytes().
| bool Botan::EC_Group_Data::params_match | ( | const EC_Group_Data & | other | ) | const |
Definition at line 230 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 297 of file ec_inner_data.h.
References BOTAN_ASSERT_NONNULL.
| std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_deserialize_compressed | ( | std::span< const uint8_t > | bytes | ) | const |
Deserialize a point in the SEC1 compressed format
Returns nullptr if the encoding was not in the compressed format, or if the point is not on the curve
Definition at line 410 of file ec_inner_data.cpp.
References Botan::OS2ECP(), and p_bytes().
| std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_deserialize_uncompressed | ( | std::span< const uint8_t > | bytes | ) | const |
Deserialize a point in the SEC1 uncompressed format
Returns nullptr if the encoding was not in the uncompressed format, or if the point is not on the curve
Definition at line 384 of file ec_inner_data.cpp.
References Botan::OS2ECP(), and p_bytes().
| std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_g_mul | ( | const EC_Scalar_Data & | scalar, |
| RandomNumberGenerator & | rng ) const |
Definition at line 538 of file ec_inner_data.cpp.
References BOTAN_STATE_CHECK, Botan::EC_Scalar_Data_BN::checked_ref(), Botan::EC_Scalar_Data_PC::checked_ref(), 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 527 of file ec_inner_data.cpp.
References Botan::h2c_expand_message(), and order_bits().
| 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 516 of file ec_inner_data.cpp.
References Botan::h2c_expand_message(), and order_bits().
| std::unique_ptr< EC_AffinePoint_Data > Botan::EC_Group_Data::point_identity | ( | ) | const |
Return the identity element (aka the point at infinity).
Definition at line 435 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 358 of file ec_inner_data.cpp.
References Botan::BigInt::is_zero().
Referenced by 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 318 of file ec_inner_data.cpp.
References scalar_deserialize(), and 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 273 of file ec_inner_data.cpp.
References order_bytes().
Referenced by 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 truncation
This should always succeed
Definition at line 243 of file ec_inner_data.cpp.
References Botan::carry(), order_bits(), and scalar_from_bytes_mod_order().
| std::unique_ptr< EC_Scalar_Data > Botan::EC_Group_Data::scalar_one | ( | ) | const |
Definition at line 306 of file ec_inner_data.cpp.
References Botan::BigInt::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 293 of file ec_inner_data.cpp.
References Botan::BigInt::one(), and Botan::BigInt::random_integer().
| void Botan::EC_Group_Data::set_oid | ( | const OID & | oid | ) |
Definition at line 234 of file ec_inner_data.cpp.
References BOTAN_ARG_CHECK, BOTAN_STATE_CHECK, Botan::DER_Encoder::encode(), and oid().
|
inline |
Definition at line 216 of file ec_inner_data.h.
Referenced by create(), and EC_Group_Data().