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;
299 std::
string PEM_encode() const;
304 size_t get_p_bits() const;
309 size_t get_p_bytes() const;
314 size_t get_order_bits() const;
319 size_t get_order_bytes() const;
368 std::unique_ptr<EC_Mul2Table_Data> m_tbl;
442 const std::shared_ptr<EC_Group_Data>&
_data()
const {
return m_data; }
444#if defined(BOTAN_HAS_LEGACY_EC_POINT)
451 bool verify_public_element(
const EC_Point& y)
const;
459 return EC_AffinePoint(*
this, std::span{bits, len}).to_legacy_point();
463 EC_Point OS2ECP(std::span<const uint8_t> encoded_point)
const {
464 return EC_AffinePoint(*
this, encoded_point).to_legacy_point();
471 BOTAN_DEPRECATED(
"Use EC_AffinePoint::generator") const EC_Point& get_base_point() const;
479 BOTAN_DEPRECATED(
"Use EC_AffinePoint::generator") const EC_Point& generator() const;
486 EC_Point point_multiply(const BigInt& x_bn, const EC_Point& h_pt, const BigInt& y_bn)
const {
487 auto x = EC_Scalar::from_bigint(*
this, x_bn);
488 auto y = EC_Scalar::from_bigint(*
this, y_bn);
489 auto h = EC_AffinePoint(*
this, h_pt);
493 if(
auto r = gh_mul.mul2_vartime(x, y)) {
494 return r->to_legacy_point();
496 return EC_AffinePoint::identity(*this).to_legacy_point();
509 blinded_base_point_multiply(const BigInt& k_bn, RandomNumberGenerator& rng, std::vector<BigInt>& ws)
const {
510 auto k = EC_Scalar::from_bigint(*
this, k_bn);
511 auto pt = EC_AffinePoint::g_mul(k, rng, ws);
512 return pt.to_legacy_point();
526 blinded_base_point_multiply_x(const BigInt& k_bn, RandomNumberGenerator& rng, std::vector<BigInt>& ws)
const {
527 auto k = EC_Scalar::from_bigint(*
this, k_bn);
528 return BigInt(EC_AffinePoint::g_mul(k, rng, ws).x_bytes());
540 EC_Point blinded_var_point_multiply(const EC_Point& point,
542 RandomNumberGenerator& rng,
543 std::vector<BigInt>& ws)
const {
544 auto k = EC_Scalar::from_bigint(*
this, k_bn);
545 auto pt = EC_AffinePoint(*
this, point);
546 return pt.mul(k, rng, ws).to_legacy_point();
552 BOTAN_DEPRECATED(
"Use EC_Scalar::random") BigInt random_scalar(RandomNumberGenerator& rng)
const {
553 return EC_Scalar::random(*
this, rng).to_bigint();
570 EC_Point hash_to_curve(std::string_view hash_fn,
571 const uint8_t input[],
573 const uint8_t domain_sep[],
574 size_t domain_sep_len,
575 bool random_oracle = true)
const {
576 auto inp = std::span{input, input_len};
577 auto dst = std::span{domain_sep, domain_sep_len};
580 return EC_AffinePoint::hash_to_curve_ro(*
this, hash_fn, inp, dst).to_legacy_point();
582 return EC_AffinePoint::hash_to_curve_nu(*
this, hash_fn, inp, dst).to_legacy_point();
599 EC_Point hash_to_curve(std::string_view hash_fn,
600 const uint8_t input[],
602 std::string_view domain_sep,
603 bool random_oracle = true)
const {
604 auto inp = std::span{input, input_len};
605 auto dst = std::span{
reinterpret_cast<const uint8_t*
>(domain_sep.data()), domain_sep.size()};
608 return EC_AffinePoint::hash_to_curve_ro(*
this, hash_fn, inp, dst).to_legacy_point();
610 return EC_AffinePoint::hash_to_curve_nu(*
this, hash_fn, inp, dst).to_legacy_point();
617 BOTAN_DEPRECATED(
"Deprecated - use EC_AffinePoint") EC_Point point(const BigInt& x, const BigInt& y)
const {
618 if(
auto pt = EC_AffinePoint::from_bigint_xy(*
this, x, y)) {
619 return pt->to_legacy_point();
621 throw Decoding_Error(
"Invalid x/y coordinates for elliptic curve point");
629 return EC_AffinePoint::identity(*this).to_legacy_point();
663 return xs.to_bigint();
672 return (xs * ys).to_bigint();
683 return (xs * ys * zs).to_bigint();
691 return (xs * xs * xs).to_bigint();
704 static EC_Group_Data_Map& ec_group_data();
706 EC_Group(std::shared_ptr<EC_Group_Data>&& data);
708 static std::pair<std::shared_ptr<EC_Group_Data>,
bool> BER_decode_EC_group(std::span<const uint8_t> ber,
711 static std::shared_ptr<EC_Group_Data> load_EC_group_info(
const char* p,
722 std::shared_ptr<EC_Group_Data> m_data;
723 bool m_explicit_encoding =
false;