7#ifndef BOTAN_EC_APOINT_H_
8#define BOTAN_EC_APOINT_H_
10#include <botan/concepts.h>
11#include <botan/ec_point_format.h>
12#include <botan/secmem.h>
13#include <botan/types.h>
27#if defined(BOTAN_HAS_LEGACY_EC_POINT)
55 static std::optional<EC_AffinePoint>
deserialize(
const EC_Group& group, std::span<const uint8_t> bytes);
65 std::span<const uint8_t> bytes);
75 std::span<const uint8_t> bytes);
96 std::string_view hash_fn,
97 std::span<const uint8_t> input,
98 std::span<const uint8_t> domain_sep);
104 std::string_view hash_fn,
105 std::span<const uint8_t> input,
106 std::string_view domain_sep);
112 std::string_view hash_fn,
113 std::span<const uint8_t> input,
114 std::span<const uint8_t> domain_sep);
120 std::string_view hash_fn,
121 std::span<const uint8_t> input,
122 std::string_view domain_sep);
201 template <concepts::resizable_
byte_buffer T = secure_vector<u
int8_t>>
203 T bytes(this->field_element_bytes());
204 this->serialize_x_to(bytes);
211 template <concepts::resizable_
byte_buffer T = secure_vector<u
int8_t>>
213 T bytes(this->field_element_bytes());
214 this->serialize_y_to(bytes);
221 template <concepts::resizable_
byte_buffer T = secure_vector<u
int8_t>>
223 T bytes(2 * this->field_element_bytes());
224 this->serialize_xy_to(bytes);
231 template <concepts::resizable_
byte_buffer T = std::vector<u
int8_t>>
233 T bytes(1 + 2 * this->field_element_bytes());
234 this->serialize_uncompressed_to(bytes);
241 template <concepts::resizable_
byte_buffer T = std::vector<u
int8_t>>
243 T bytes(1 + this->field_element_bytes());
244 this->serialize_compressed_to(bytes);
291#if defined(BOTAN_HAS_LEGACY_EC_POINT)
322 return this->mul(scalar, rng);
328 std::vector<BigInt>& )
const {
329 return this->mul_x_only(scalar, rng);
342 static EC_AffinePoint _from_inner(std::unique_ptr<EC_AffinePoint_Data> inner);
347 const std::shared_ptr<const EC_Group_Data>& _group()
const;
352 explicit EC_AffinePoint(std::unique_ptr<EC_AffinePoint_Data> point);
356 std::unique_ptr<EC_AffinePoint_Data> m_point;
#define BOTAN_PUBLIC_API(maj, min)
#define BOTAN_DEPRECATED(msg)
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)
EC_AffinePoint negate() const
Point negation.
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 operator!=(const EC_AffinePoint &other) const
bool is_identity() const
Return true if this point is the identity element.
static std::optional< EC_AffinePoint > deserialize_uncompressed(const EC_Group &group, std::span< const uint8_t > bytes)
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)
static std::optional< EC_AffinePoint > mul_px_qy(const EC_AffinePoint &p, const EC_Scalar &x, const EC_AffinePoint &q, const EC_Scalar &y, RandomNumberGenerator &rng)
static EC_AffinePoint g_mul(const EC_Scalar &scalar, RandomNumberGenerator &rng)
Multiply by the group generator returning a complete point.
T serialize_uncompressed() const
EC_AffinePoint(const EC_Group &group, std::span< const uint8_t > bytes)
EC_AffinePoint mul(const EC_Scalar &scalar, RandomNumberGenerator &rng) const
Multiply a point by a scalar returning a complete point.
static std::optional< EC_AffinePoint > deserialize(const EC_Group &group, std::span< const uint8_t > bytes)
static std::optional< EC_AffinePoint > deserialize_compressed(const EC_Group &group, std::span< const uint8_t > bytes)
void serialize_x_to(std::span< uint8_t > bytes) const
T serialize_compressed() const
void serialize_compressed_to(std::span< uint8_t > bytes) const
secure_vector< uint8_t > mul_x_only(const EC_Scalar &scalar, RandomNumberGenerator &rng) const
Multiply a point by a scalar, returning the byte encoding of the x coordinate only.
const EC_AffinePoint_Data & _inner() const
secure_vector< uint8_t > mul_x_only(const EC_Scalar &scalar, RandomNumberGenerator &rng, std::vector< BigInt > &) const
Multiply a point by a scalar, returning the byte encoding of the x coordinate only.
void serialize_uncompressed_to(std::span< uint8_t > bytes) const
void serialize_y_to(std::span< uint8_t > bytes) const
EC_AffinePoint add(const EC_AffinePoint &q) const
friend class EC_Mul2Table
static EC_AffinePoint generator(const EC_Group &group)
Return the standard group generator.
std::vector< T, secure_allocator< T > > secure_vector
bool operator==(const AlgorithmIdentifier &x, const AlgorithmIdentifier &y)