Botan
1.11.15
|
#include <curve_gfp.h>
Public Member Functions | |
virtual void | curve_mul (BigInt &z, const BigInt &x, const BigInt &y, secure_vector< word > &ws) const =0 |
virtual void | curve_sqr (BigInt &z, const BigInt &x, secure_vector< word > &ws) const =0 |
virtual void | from_curve_rep (BigInt &x, secure_vector< word > &ws) const =0 |
virtual const BigInt & | get_a () const =0 |
virtual const BigInt & | get_a_rep () const =0 |
virtual const BigInt & | get_b () const =0 |
virtual const BigInt & | get_b_rep () const =0 |
virtual const BigInt & | get_p () const =0 |
virtual size_t | get_p_words () const =0 |
virtual void | normalize (BigInt &x, secure_vector< word > &ws, size_t bound) const |
virtual void | to_curve_rep (BigInt &x, secure_vector< word > &ws) const =0 |
virtual | ~CurveGFp_Repr () |
Definition at line 18 of file curve_gfp.h.
virtual Botan::CurveGFp_Repr::~CurveGFp_Repr | ( | ) | [inline, virtual] |
Definition at line 21 of file curve_gfp.h.
{}
virtual void Botan::CurveGFp_Repr::curve_mul | ( | BigInt & | z, |
const BigInt & | x, | ||
const BigInt & | y, | ||
secure_vector< word > & | ws | ||
) | const [pure virtual] |
Implemented in Botan::CurveGFp_NIST.
virtual void Botan::CurveGFp_Repr::curve_sqr | ( | BigInt & | z, |
const BigInt & | x, | ||
secure_vector< word > & | ws | ||
) | const [pure virtual] |
Implemented in Botan::CurveGFp_NIST.
virtual void Botan::CurveGFp_Repr::from_curve_rep | ( | BigInt & | x, |
secure_vector< word > & | ws | ||
) | const [pure virtual] |
Implemented in Botan::CurveGFp_NIST.
virtual const BigInt& Botan::CurveGFp_Repr::get_a | ( | ) | const [pure virtual] |
Implemented in Botan::CurveGFp_NIST.
virtual const BigInt& Botan::CurveGFp_Repr::get_a_rep | ( | ) | const [pure virtual] |
Implemented in Botan::CurveGFp_NIST.
virtual const BigInt& Botan::CurveGFp_Repr::get_b | ( | ) | const [pure virtual] |
Implemented in Botan::CurveGFp_NIST.
virtual const BigInt& Botan::CurveGFp_Repr::get_b_rep | ( | ) | const [pure virtual] |
Implemented in Botan::CurveGFp_NIST.
virtual const BigInt& Botan::CurveGFp_Repr::get_p | ( | ) | const [pure virtual] |
Implemented in Botan::CurveGFp_P521.
Referenced by normalize().
virtual size_t Botan::CurveGFp_Repr::get_p_words | ( | ) | const [pure virtual] |
Implemented in Botan::CurveGFp_NIST.
Referenced by normalize().
void Botan::CurveGFp_Repr::normalize | ( | BigInt & | x, |
secure_vector< word > & | ws, | ||
size_t | bound | ||
) | const [virtual] |
Definition at line 121 of file curve_gfp.cpp.
References Botan::BigInt::data(), get_p(), get_p_words(), Botan::BigInt::grow_to(), Botan::BigInt::is_negative(), Botan::BigInt::swap_reg(), and Botan::word_sub().
{ const BigInt& p = get_p(); const word* prime = p.data(); const size_t p_words = get_p_words(); while(x.is_negative()) x += p; x.grow_to(p_words + 1); if(ws.size() < p_words + 1) ws.resize(p_words + 1); for(size_t i = 0; bound == 0 || i < bound; ++i) { const word* xd = x.data(); word borrow = 0; for(size_t i = 0; i != p_words; ++i) ws[i] = word_sub(xd[i], prime[i], &borrow); ws[p_words] = word_sub(xd[p_words], 0, &borrow); if(borrow) break; x.swap_reg(ws); } }
virtual void Botan::CurveGFp_Repr::to_curve_rep | ( | BigInt & | x, |
secure_vector< word > & | ws | ||
) | const [pure virtual] |
Implemented in Botan::CurveGFp_NIST.