181 explicit EC_Group(std::span<const uint8_t> ber);
205 static
EC_Group from_PEM(std::string_view pem);
215 static
EC_Group from_name(std::string_view name);
250 static bool supports_application_specific_group();
255 static bool supports_named_group(std::string_view name);
279 static const std::set<std::string>& known_named_groups();
293 std::vector<uint8_t> DER_encode() const;
309 size_t get_p_bits() const;
314 size_t get_p_bytes() const;
319 size_t get_order_bits() const;
324 size_t get_order_bytes() const;
373 std::unique_ptr<EC_Mul2Table_Data> m_tbl;
451 const std::shared_ptr<EC_Group_Data>&
_data()
const {
return m_data; }
453#if defined(BOTAN_HAS_LEGACY_EC_POINT)
460 bool verify_public_element(
const EC_Point& y)
const;
468 return EC_AffinePoint(*
this, std::span{bits, len}).to_legacy_point();
472 EC_Point OS2ECP(std::span<const uint8_t> encoded_point)
const {
473 return EC_AffinePoint(*
this, encoded_point).to_legacy_point();
480 BOTAN_DEPRECATED(
"Use EC_AffinePoint::generator") const EC_Point& get_base_point() const;
488 BOTAN_DEPRECATED(
"Use EC_AffinePoint::generator") const EC_Point& generator() const;
495 EC_Point point_multiply(const BigInt& x_bn, const EC_Point& h_pt, const BigInt& y_bn)
const {
496 auto x = EC_Scalar::from_bigint(*
this, x_bn);
497 auto y = EC_Scalar::from_bigint(*
this, y_bn);
498 auto h = EC_AffinePoint(*
this, h_pt);
502 if(
auto r = gh_mul.mul2_vartime(x, y)) {
503 return r->to_legacy_point();
505 return EC_AffinePoint::identity(*this).to_legacy_point();
516 EC_Point blinded_base_point_multiply(const BigInt& k_bn, RandomNumberGenerator& rng, std::vector<BigInt>&)
const {
517 auto k = EC_Scalar::from_bigint(*
this, k_bn);
518 auto pt = EC_AffinePoint::g_mul(k, rng);
519 return pt.to_legacy_point();
531 BigInt blinded_base_point_multiply_x(const BigInt& k_bn, RandomNumberGenerator& rng, std::vector<BigInt>&)
const {
532 auto k = EC_Scalar::from_bigint(*
this, k_bn);
533 return BigInt(EC_AffinePoint::g_mul(k, rng).x_bytes());
544 EC_Point blinded_var_point_multiply(const EC_Point& point,
546 RandomNumberGenerator& rng,
547 std::vector<BigInt>&)
const {
548 auto k = EC_Scalar::from_bigint(*
this, k_bn);
549 auto pt = EC_AffinePoint(*
this, point);
550 return pt.mul(k, rng).to_legacy_point();
556 BOTAN_DEPRECATED(
"Use EC_Scalar::random") BigInt random_scalar(RandomNumberGenerator& rng)
const {
557 return EC_Scalar::random(*
this, rng).to_bigint();
574 EC_Point hash_to_curve(std::string_view hash_fn,
575 const uint8_t input[],
577 const uint8_t domain_sep[],
578 size_t domain_sep_len,
579 bool random_oracle = true)
const {
580 auto inp = std::span{input, input_len};
581 auto dst = std::span{domain_sep, domain_sep_len};
584 return EC_AffinePoint::hash_to_curve_ro(*
this, hash_fn, inp, dst).to_legacy_point();
586 return EC_AffinePoint::hash_to_curve_nu(*
this, hash_fn, inp, dst).to_legacy_point();
603 EC_Point hash_to_curve(std::string_view hash_fn,
604 const uint8_t input[],
606 std::string_view domain_sep,
607 bool random_oracle = true)
const {
608 auto inp = std::span{input, input_len};
609 auto dst = std::span{
reinterpret_cast<const uint8_t*
>(domain_sep.data()), domain_sep.size()};
612 return EC_AffinePoint::hash_to_curve_ro(*
this, hash_fn, inp, dst).to_legacy_point();
614 return EC_AffinePoint::hash_to_curve_nu(*
this, hash_fn, inp, dst).to_legacy_point();
621 BOTAN_DEPRECATED(
"Deprecated - use EC_AffinePoint") EC_Point point(const BigInt& x, const BigInt& y)
const {
622 if(
auto pt = EC_AffinePoint::from_bigint_xy(*
this, x, y)) {
623 return pt->to_legacy_point();
625 throw Decoding_Error(
"Invalid x/y coordinates for elliptic curve point");
633 return EC_AffinePoint::identity(*this).to_legacy_point();
667 return xs.to_bigint();
676 return (xs * ys).to_bigint();
687 return (xs * ys * zs).to_bigint();
695 return (xs * xs * xs).to_bigint();
708 static EC_Group_Data_Map& ec_group_data();
710 EC_Group(std::shared_ptr<EC_Group_Data>&& data);
712 static std::pair<std::shared_ptr<EC_Group_Data>,
bool> BER_decode_EC_group(std::span<const uint8_t> ber,
715 static std::shared_ptr<EC_Group_Data> load_EC_group_info(
const char* p,
726 std::shared_ptr<EC_Group_Data> m_data;
727 bool m_explicit_encoding =
false;