163 explicit EC_Group(std::span<const uint8_t> der);
192 static
EC_Group from_PEM(std::string_view pem);
202 static
EC_Group from_name(std::string_view name);
283 static bool supports_application_specific_group();
290 static bool supports_application_specific_group_with_cofactor();
297 static bool supports_named_group(std::string_view name);
323 static const std::set<std::string>& known_named_groups();
337 std::vector<uint8_t> DER_encode() const;
353 size_t get_p_bits() const;
358 size_t get_p_bytes() const;
363 size_t get_order_bits() const;
368 size_t get_order_bytes() const;
435 std::unique_ptr<EC_Mul2Table_Data> m_tbl;
545 const std::shared_ptr<EC_Group_Data>&
_data()
const {
return m_data; }
547#if defined(BOTAN_HAS_LEGACY_EC_POINT)
554 bool verify_public_element(
const EC_Point& y)
const;
562 return EC_AffinePoint(*
this, std::span{bits, len}).to_legacy_point();
574 EC_Point OS2ECP(std::span<const uint8_t> encoded_point)
const {
575 return EC_AffinePoint(*
this, encoded_point).to_legacy_point();
582 BOTAN_DEPRECATED(
"Use EC_AffinePoint::generator") const EC_Point& get_base_point() const;
590 BOTAN_DEPRECATED(
"Use EC_AffinePoint::generator") const EC_Point& generator() const;
597 EC_Point point_multiply(const BigInt& x_bn, const EC_Point& h_pt, const BigInt& y_bn)
const {
598 auto x = EC_Scalar::from_bigint(*
this, x_bn);
599 auto y = EC_Scalar::from_bigint(*
this, y_bn);
600 auto h = EC_AffinePoint(*
this, h_pt);
602 const Mul2Table gh_mul(h);
604 if(
auto r = gh_mul.mul2_vartime(x, y)) {
605 return r->to_legacy_point();
607 return EC_AffinePoint::identity(*this).to_legacy_point();
618 EC_Point blinded_base_point_multiply(const BigInt& k_bn,
619 RandomNumberGenerator& rng,
620 std::vector<BigInt>& )
const {
621 auto k = EC_Scalar::from_bigint(*
this, k_bn);
622 auto pt = EC_AffinePoint::g_mul(k, rng);
623 return pt.to_legacy_point();
635 BigInt blinded_base_point_multiply_x(const BigInt& k_bn,
636 RandomNumberGenerator& rng,
637 std::vector<BigInt>& )
const {
638 auto k = EC_Scalar::from_bigint(*
this, k_bn);
639 return BigInt(EC_AffinePoint::g_mul(k, rng).x_bytes());
650 EC_Point blinded_var_point_multiply(const EC_Point& point,
652 RandomNumberGenerator& rng,
653 std::vector<BigInt>& )
const {
654 auto k = EC_Scalar::from_bigint(*
this, k_bn);
655 auto pt = EC_AffinePoint(*
this, point);
656 return pt.mul(k, rng).to_legacy_point();
662 BOTAN_DEPRECATED(
"Use EC_Scalar::random") BigInt random_scalar(RandomNumberGenerator& rng)
const {
663 return EC_Scalar::random(*
this, rng).to_bigint();
680 EC_Point hash_to_curve(std::string_view hash_fn,
681 const uint8_t input[],
683 const uint8_t domain_sep[],
684 size_t domain_sep_len,
685 bool random_oracle = true)
const {
686 auto inp = std::span{input, input_len};
687 auto dst = std::span{domain_sep, domain_sep_len};
690 return EC_AffinePoint::hash_to_curve_ro(*
this, hash_fn, inp, dst).to_legacy_point();
692 return EC_AffinePoint::hash_to_curve_nu(*
this, hash_fn, inp, dst).to_legacy_point();
709 EC_Point hash_to_curve(std::string_view hash_fn,
710 const uint8_t input[],
712 std::string_view domain_sep,
713 bool random_oracle = true)
const {
714 auto inp = std::span{input, input_len};
717 return EC_AffinePoint::hash_to_curve_ro(*
this, hash_fn, inp, domain_sep).to_legacy_point();
719 return EC_AffinePoint::hash_to_curve_nu(*
this, hash_fn, inp, domain_sep).to_legacy_point();
726 BOTAN_DEPRECATED(
"Deprecated - use EC_AffinePoint") EC_Point point(const BigInt& x, const BigInt& y)
const {
727 if(
auto pt = EC_AffinePoint::from_bigint_xy(*
this, x, y)) {
728 return pt->to_legacy_point();
730 throw Decoding_Error(
"Invalid x/y coordinates for elliptic curve point");
738 return EC_AffinePoint::identity(*this).to_legacy_point();
778 return xs.to_bigint();
790 return (xs * ys).to_bigint();
805 return (xs * ys * zs).to_bigint();
815 return (xs * xs * xs).to_bigint();
833 static EC_Group_Data_Map& ec_group_data();
835 explicit EC_Group(std::shared_ptr<EC_Group_Data>&& data);
837 static std::pair<std::shared_ptr<EC_Group_Data>,
bool> DER_decode_EC_group(std::span<const uint8_t> der,
840 static std::shared_ptr<EC_Group_Data> load_EC_group_info(
const char* p,
851 std::shared_ptr<EC_Group_Data> m_data;
852 bool m_explicit_encoding =
false;