10#ifndef BOTAN_GFP_CURVE_H_
11#define BOTAN_GFP_CURVE_H_
13#include <botan/bigint.h>
62 curve_mul_words(z, x.
data(), x.
size(), y, ws);
70 curve_sqr_words(z, x.
data(), x.
size(), ws);
144 m_repr->from_curve_rep(xt, ws);
151 m_repr->curve_mul(z, x, y, ws);
155 m_repr->curve_mul_words(z, x_w, x_size, y, ws);
161 m_repr->curve_sqr_words(z, x_w, x_size, ws);
170 m_repr->curve_mul(z, x, y, ws);
176 m_repr->curve_sqr(z, x, ws);
190 if(m_repr.get() == other.m_repr.get()) {
194 return (get_p() == other.
get_p()) && (get_a() == other.
get_a()) && (get_b() == other.
get_b());
198 static std::shared_ptr<CurveGFp_Repr> choose_repr(
const BigInt& p,
const BigInt& a,
const BigInt& b);
200 std::shared_ptr<CurveGFp_Repr> m_repr;
204 return !(lhs == rhs);
#define BOTAN_DEBUG_ASSERT(expr)
const word * data() const
void curve_mul(BigInt &z, const BigInt &x, const BigInt &y, secure_vector< word > &ws) const
virtual size_t get_p_words() const =0
virtual BigInt invert_element(const BigInt &x, secure_vector< word > &ws) const =0
virtual ~CurveGFp_Repr()=default
virtual const BigInt & get_a() const =0
virtual void to_curve_rep(BigInt &x, secure_vector< word > &ws) const =0
virtual const BigInt & get_b() const =0
virtual bool is_one(const BigInt &x) const =0
virtual void curve_sqr_words(BigInt &z, const word x_words[], size_t x_size, secure_vector< word > &ws) const =0
virtual const BigInt & get_a_rep() const =0
virtual void curve_mul_words(BigInt &z, const word x_words[], size_t x_size, const BigInt &y, secure_vector< word > &ws) const =0
void curve_sqr(BigInt &z, const BigInt &x, secure_vector< word > &ws) const
virtual const BigInt & get_b_rep() const =0
virtual void from_curve_rep(BigInt &x, secure_vector< word > &ws) const =0
virtual const BigInt & get_p() const =0
virtual size_t get_ws_size() const =0
virtual bool a_is_minus_3() const =0
virtual const BigInt & get_1_rep() const =0
virtual bool a_is_zero() const =0
CurveGFp(const CurveGFp &)=default
bool a_is_minus_3() const
void mul(BigInt &z, const BigInt &x, const BigInt &y, secure_vector< word > &ws) const
void mul(BigInt &z, const word x_w[], size_t x_size, const BigInt &y, secure_vector< word > &ws) const
size_t get_ws_size() const
BigInt invert_element(const BigInt &x, secure_vector< word > &ws) const
friend void swap(CurveGFp &x, CurveGFp &y)
const BigInt & get_1_rep() const
const BigInt & get_b_rep() const
bool is_one(const BigInt &x) const
void sqr(BigInt &z, const BigInt &x, secure_vector< word > &ws) const
void swap(CurveGFp &other)
const BigInt & get_a_rep() const
BigInt from_rep_to_tmp(const BigInt &x, secure_vector< word > &ws) const
void sqr(BigInt &z, const word x_w[], size_t x_size, secure_vector< word > &ws) const
const BigInt & get_a() const
void to_rep(BigInt &x, secure_vector< word > &ws) const
CurveGFp(const BigInt &p, const BigInt &a, const BigInt &b)
BigInt mul(const BigInt &x, const BigInt &y, secure_vector< word > &ws) const
size_t get_p_words() const
CurveGFp & operator=(const CurveGFp &)=default
const BigInt & get_p() const
BigInt sqr_to_tmp(const BigInt &x, secure_vector< word > &ws) const
BigInt sqr(const BigInt &x, secure_vector< word > &ws) const
const BigInt & get_b() const
bool operator==(const CurveGFp &other) const
void from_rep(BigInt &x, secure_vector< word > &ws) const
BigInt mul_to_tmp(const BigInt &x, const BigInt &y, secure_vector< word > &ws) const
int(* final)(unsigned char *, CTX *)
#define BOTAN_UNSTABLE_API
bool operator!=(const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
std::vector< T, secure_allocator< T > > secure_vector