10#ifndef BOTAN_EC_POINT_H_
11#define BOTAN_EC_POINT_H_
15#include <botan/curve_gfp.h>
16#include <botan/ec_point_format.h>
17#include <botan/exceptn.h>
42 enum { WORKSPACE_SIZE = 8 };
134 m_y = m_curve.get_p() - m_y;
156 bool is_affine()
const;
162 bool is_zero()
const {
return m_z.is_zero(); }
169 bool on_the_curve()
const;
190 BigInt get_affine_x()
const;
196 BigInt get_affine_y()
const;
220 void swap(
EC_Point& other)
noexcept;
225 bool _is_x_eq_to_v_mod_order(
const BigInt& v)
const;
227#if defined(BOTAN_DISABLE_DEPRECATED_FEATURES)
275 BOTAN_ARG_CHECK(m_curve == other.m_curve,
"cannot add points on different curves");
277 const size_t p_words = m_curve.get_p_words();
279 add(other.m_x.
_data(),
280 std::min(p_words, other.m_x.
size()),
282 std::min(p_words, other.m_y.
size()),
284 std::min(p_words, other.m_z.
size()),
299 void add(
const word x_words[],
301 const word y_words[],
303 const word z_words[],
305 std::vector<BigInt>& workspace);
320 const size_t p_words = m_curve.get_p_words();
321 add_affine(other.m_x.
_data(),
322 std::min(p_words, other.m_x.
size()),
324 std::min(p_words, other.m_y.
size()),
338 const word x_words[],
size_t x_size,
const word y_words[],
size_t y_size, std::vector<BigInt>& workspace);
344 void mult2(std::vector<BigInt>& workspace);
351 void mult2i(
size_t i, std::vector<BigInt>& workspace);
361 x.
add(other, workspace);
399 multi_exponentiate(const EC_Point& p1, const BigInt& z1, const EC_Point& p2, const BigInt& z2);
417 return point.
mul(scalar);
421 return point.
mul(scalar);
445 OS2ECP(const uint8_t data[],
size_t data_len, const BigInt& curve_p, const BigInt& curve_a, const BigInt& curve_b);
#define BOTAN_PUBLIC_API(maj, min)
#define BOTAN_UNSTABLE_API
#define BOTAN_DEPRECATED(msg)
#define BOTAN_ASSERT_NOMSG(expr)
#define BOTAN_DEBUG_ASSERT(expr)
#define BOTAN_ARG_CHECK(expr, msg)
const word * _data() const
void swap(EC_Point &other) noexcept
bool operator!=(const EC_Point &other) const =default
EC_Point & operator=(EC_Point &&other)
EC_Point plus(const EC_Point &other, std::vector< BigInt > &workspace) const
void add(const EC_Point &other, std::vector< BigInt > &workspace)
void add_affine(const EC_Point &other, std::vector< BigInt > &workspace)
void mult2(std::vector< BigInt > &workspace)
EC_Point double_of(std::vector< BigInt > &workspace) const
EC_Point mul(const BigInt &scalar) const
EC_Point & operator=(const EC_Point &)=default
friend void swap(EC_Point &x, EC_Point &y)
EC_Point_Format Compression_Type
int(* final)(unsigned char *, CTX *)
BigInt operator*(const BigInt &x, const BigInt &y)
OctetString operator+(const OctetString &k1, const OctetString &k2)
EC_Point multi_exponentiate(const EC_Point &p1, const BigInt &z1, const EC_Point &p2, const BigInt &z2)
BigInt operator-(const BigInt &x, const BigInt &y)
bool operator==(const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
std::vector< T, secure_allocator< T > > secure_vector
EC_Point OS2ECP(std::span< const uint8_t > data, const CurveGFp &curve)