7#include <botan/ec_apoint.h>
9#include <botan/ec_group.h>
10#include <botan/ec_scalar.h>
11#include <botan/internal/ec_inner_data.h>
19EC_AffinePoint::EC_AffinePoint(
const EC_AffinePoint& other) : m_point(other.inner().clone()) {}
25 m_point = other.inner().
clone();
31 m_point.swap(other.m_point);
36 m_point = group.
_data()->point_deserialize(bytes);
38 throw Decoding_Error(
"Failed to deserialize elliptic curve point");
46 const uint8_t id_encoding[1] = {0};
63 std::vector<uint8_t> sec1(1 + 2 * fe_bytes);
80 std::string_view hash_fn,
81 std::span<const uint8_t> input,
82 std::span<const uint8_t> domain_sep) {
83 auto pt = group.
_data()->point_hash_to_curve_ro(hash_fn, input, domain_sep);
88 std::string_view hash_fn,
89 std::span<const uint8_t> input,
90 std::span<const uint8_t> domain_sep) {
91 auto pt = group.
_data()->point_hash_to_curve_nu(hash_fn, input, domain_sep);
98 if(
auto pt = group.
_data()->point_deserialize(bytes)) {
106 auto pt = scalar.
_inner().
group()->point_g_mul(scalar.inner(), rng, ws);
116 m_point->serialize_x_to(bytes);
121 m_point->serialize_y_to(bytes);
126 m_point->serialize_xy_to(bytes);
131 m_point->serialize_compressed_to(bytes);
136 m_point->serialize_uncompressed_to(bytes);
140 return m_point->to_legacy_point();
148 return inner().
group();
#define BOTAN_STATE_CHECK(expr)
#define BOTAN_ASSERT_NONNULL(ptr)
void serialize_to(std::span< uint8_t > out) const
virtual std::unique_ptr< EC_AffinePoint_Data > clone() const =0
virtual size_t field_element_bytes() const =0
virtual const std::shared_ptr< const EC_Group_Data > & group() const =0
virtual bool is_identity() const =0
static EC_AffinePoint hash_to_curve_ro(const EC_Group &group, std::string_view hash_fn, std::span< const uint8_t > input, std::span< const uint8_t > domain_sep)
size_t field_element_bytes() const
void serialize_xy_to(std::span< uint8_t > bytes) const
static EC_AffinePoint hash_to_curve_nu(const EC_Group &group, std::string_view hash_fn, std::span< const uint8_t > input, std::span< const uint8_t > domain_sep)
bool is_identity() const
Return true if this point is the identity element.
static EC_AffinePoint identity(const EC_Group &group)
Return the identity element.
static std::optional< EC_AffinePoint > from_bigint_xy(const EC_Group &group, const BigInt &x, const BigInt &y)
EC_AffinePoint(const EC_Group &group, std::span< const uint8_t > bytes)
static EC_AffinePoint _from_inner(std::unique_ptr< EC_AffinePoint_Data > inner)
const std::shared_ptr< const EC_Group_Data > & _group() const
static std::optional< EC_AffinePoint > deserialize(const EC_Group &group, std::span< const uint8_t > bytes)
void serialize_x_to(std::span< uint8_t > bytes) const
void serialize_compressed_to(std::span< uint8_t > bytes) const
void serialize_uncompressed_to(std::span< uint8_t > bytes) const
void serialize_y_to(std::span< uint8_t > bytes) const
EC_Point to_legacy_point() const
EC_AffinePoint & operator=(const EC_AffinePoint &other)
static EC_AffinePoint g_mul(const EC_Scalar &scalar, RandomNumberGenerator &rng, std::vector< BigInt > &ws)
static EC_AffinePoint generator(const EC_Group &group)
Return the standard group generator.
EC_AffinePoint mul(const EC_Scalar &scalar, RandomNumberGenerator &rng, std::vector< BigInt > &ws) const
const BigInt & get_p() const
const EC_Point & get_base_point() const
const std::shared_ptr< EC_Group_Data > & _data() const
size_t get_p_bytes() const
virtual const std::shared_ptr< const EC_Group_Data > & group() const =0
const EC_Scalar_Data & _inner() const