163 explicit EC_Group(std::span<const uint8_t> ber);
187 static
EC_Group from_PEM(std::string_view pem);
197 static
EC_Group from_name(std::string_view name);
242 static bool supports_application_specific_group();
249 static bool supports_application_specific_group_with_cofactor();
254 static bool supports_named_group(std::string_view name);
278 static const std::set<std::string>& known_named_groups();
292 std::vector<uint8_t> DER_encode() const;
308 size_t get_p_bits() const;
313 size_t get_p_bytes() const;
318 size_t get_order_bits() const;
323 size_t get_order_bytes() const;
376 std::unique_ptr<EC_Mul2Table_Data> m_tbl;
454 const std::shared_ptr<EC_Group_Data>&
_data()
const {
return m_data; }
456#if defined(BOTAN_HAS_LEGACY_EC_POINT)
463 bool verify_public_element(
const EC_Point& y)
const;
471 return EC_AffinePoint(*
this, std::span{bits, len}).to_legacy_point();
475 EC_Point OS2ECP(std::span<const uint8_t> encoded_point)
const {
476 return EC_AffinePoint(*
this, encoded_point).to_legacy_point();
483 BOTAN_DEPRECATED(
"Use EC_AffinePoint::generator") const EC_Point& get_base_point() const;
491 BOTAN_DEPRECATED(
"Use EC_AffinePoint::generator") const EC_Point& generator() const;
498 EC_Point point_multiply(const BigInt& x_bn, const EC_Point& h_pt, const BigInt& y_bn)
const {
499 auto x = EC_Scalar::from_bigint(*
this, x_bn);
500 auto y = EC_Scalar::from_bigint(*
this, y_bn);
501 auto h = EC_AffinePoint(*
this, h_pt);
503 const Mul2Table gh_mul(h);
505 if(
auto r = gh_mul.mul2_vartime(x, y)) {
506 return r->to_legacy_point();
508 return EC_AffinePoint::identity(*this).to_legacy_point();
519 EC_Point blinded_base_point_multiply(const BigInt& k_bn,
520 RandomNumberGenerator& rng,
521 std::vector<BigInt>& )
const {
522 auto k = EC_Scalar::from_bigint(*
this, k_bn);
523 auto pt = EC_AffinePoint::g_mul(k, rng);
524 return pt.to_legacy_point();
536 BigInt blinded_base_point_multiply_x(const BigInt& k_bn,
537 RandomNumberGenerator& rng,
538 std::vector<BigInt>& )
const {
539 auto k = EC_Scalar::from_bigint(*
this, k_bn);
540 return BigInt(EC_AffinePoint::g_mul(k, rng).x_bytes());
551 EC_Point blinded_var_point_multiply(const EC_Point& point,
553 RandomNumberGenerator& rng,
554 std::vector<BigInt>& )
const {
555 auto k = EC_Scalar::from_bigint(*
this, k_bn);
556 auto pt = EC_AffinePoint(*
this, point);
557 return pt.mul(k, rng).to_legacy_point();
563 BOTAN_DEPRECATED(
"Use EC_Scalar::random") BigInt random_scalar(RandomNumberGenerator& rng)
const {
564 return EC_Scalar::random(*
this, rng).to_bigint();
581 EC_Point hash_to_curve(std::string_view hash_fn,
582 const uint8_t input[],
584 const uint8_t domain_sep[],
585 size_t domain_sep_len,
586 bool random_oracle = true)
const {
587 auto inp = std::span{input, input_len};
588 auto dst = std::span{domain_sep, domain_sep_len};
591 return EC_AffinePoint::hash_to_curve_ro(*
this, hash_fn, inp, dst).to_legacy_point();
593 return EC_AffinePoint::hash_to_curve_nu(*
this, hash_fn, inp, dst).to_legacy_point();
610 EC_Point hash_to_curve(std::string_view hash_fn,
611 const uint8_t input[],
613 std::string_view domain_sep,
614 bool random_oracle = true)
const {
615 auto inp = std::span{input, input_len};
618 return EC_AffinePoint::hash_to_curve_ro(*
this, hash_fn, inp, domain_sep).to_legacy_point();
620 return EC_AffinePoint::hash_to_curve_nu(*
this, hash_fn, inp, domain_sep).to_legacy_point();
627 BOTAN_DEPRECATED(
"Deprecated - use EC_AffinePoint") EC_Point point(const BigInt& x, const BigInt& y)
const {
628 if(
auto pt = EC_AffinePoint::from_bigint_xy(*
this, x, y)) {
629 return pt->to_legacy_point();
631 throw Decoding_Error(
"Invalid x/y coordinates for elliptic curve point");
639 return EC_AffinePoint::identity(*this).to_legacy_point();
673 return xs.to_bigint();
682 return (xs * ys).to_bigint();
693 return (xs * ys * zs).to_bigint();
701 return (xs * xs * xs).to_bigint();
714 static EC_Group_Data_Map& ec_group_data();
716 explicit EC_Group(std::shared_ptr<EC_Group_Data>&& data);
718 static std::pair<std::shared_ptr<EC_Group_Data>,
bool> BER_decode_EC_group(std::span<const uint8_t> ber,
721 static std::shared_ptr<EC_Group_Data> load_EC_group_info(
const char* p,
732 std::shared_ptr<EC_Group_Data> m_data;
733 bool m_explicit_encoding =
false;