Botan 3.7.1
Crypto and TLS for C&
|
#include <monty.h>
Public Member Functions | |
Montgomery_Params (const BigInt &p) | |
Montgomery_Params (const BigInt &p, const Modular_Reducer &mod_p) | |
void | mul (BigInt &z, const BigInt &x, const BigInt &y, secure_vector< word > &ws) const |
void | mul (BigInt &z, const BigInt &x, std::span< const word > y, secure_vector< word > &ws) const |
BigInt | mul (const BigInt &x, const BigInt &y, secure_vector< word > &ws) const |
BigInt | mul (const BigInt &x, std::span< const word > y, secure_vector< word > &ws) const |
void | mul_by (BigInt &x, const BigInt &y, secure_vector< word > &ws) const |
void | mul_by (BigInt &x, std::span< const word > y, secure_vector< word > &ws) const |
const BigInt & | p () const |
word | p_dash () const |
size_t | p_words () const |
const BigInt & | R1 () const |
const BigInt & | R2 () const |
const BigInt & | R3 () const |
BigInt | redc (const BigInt &x, secure_vector< word > &ws) const |
void | redc_in_place (BigInt &x, secure_vector< word > &ws) const |
void | sqr (BigInt &z, const BigInt &x, secure_vector< word > &ws) const |
void | sqr (BigInt &z, std::span< const word > x, secure_vector< word > &ws) const |
BigInt | sqr (const BigInt &x, secure_vector< word > &ws) const |
BigInt | sqr (std::span< const word > x, secure_vector< word > &ws) const |
void | square_this (BigInt &x, secure_vector< word > &ws) const |
Botan::Montgomery_Params::Montgomery_Params | ( | const BigInt & | p, |
const Modular_Reducer & | mod_p ) |
Initialize a set of Montgomery reduction parameters. These values can be shared by all values in a specific Montgomery domain.
Definition at line 17 of file monty.cpp.
References BOTAN_MP_WORD_BITS, Botan::BigInt::is_even(), Botan::monty_inverse(), Botan::Modular_Reducer::multiply(), p(), Botan::BigInt::power_of_2(), Botan::Modular_Reducer::reduce(), Botan::BigInt::sig_words(), Botan::Modular_Reducer::square(), and Botan::BigInt::word_at().
Botan::Montgomery_Params::Montgomery_Params | ( | const BigInt & | p | ) |
Initialize a set of Montgomery reduction parameters. These values can be shared by all values in a specific Montgomery domain.
Definition at line 33 of file monty.cpp.
References BOTAN_MP_WORD_BITS, Botan::Modular_Reducer::for_secret_modulus(), Botan::BigInt::is_even(), Botan::monty_inverse(), p(), Botan::BigInt::power_of_2(), Botan::BigInt::sig_words(), Botan::BigInt::square(), and Botan::BigInt::word_at().
void Botan::Montgomery_Params::mul | ( | BigInt & | z, |
const BigInt & | x, | ||
const BigInt & | y, | ||
secure_vector< word > & | ws ) const |
Definition at line 84 of file monty.cpp.
References Botan::BigInt::_data(), Botan::bigint_monty_redc(), Botan::bigint_mul(), BOTAN_DEBUG_ASSERT, Botan::BigInt::grow_to(), Botan::BigInt::mutable_data(), Botan::BigInt::sig_words(), and Botan::BigInt::size().
void Botan::Montgomery_Params::mul | ( | BigInt & | z, |
const BigInt & | x, | ||
std::span< const word > | y, | ||
secure_vector< word > & | ws ) const |
Definition at line 118 of file monty.cpp.
References Botan::BigInt::_data(), Botan::bigint_monty_redc(), Botan::bigint_mul(), BOTAN_DEBUG_ASSERT, Botan::BigInt::grow_to(), Botan::BigInt::mutable_data(), Botan::BigInt::sig_words(), and Botan::BigInt::size().
BigInt Botan::Montgomery_Params::mul | ( | const BigInt & | x, |
const BigInt & | y, | ||
secure_vector< word > & | ws ) const |
Definition at line 78 of file monty.cpp.
References mul(), and Botan::BigInt::with_capacity().
BigInt Botan::Montgomery_Params::mul | ( | const BigInt & | x, |
std::span< const word > | y, | ||
secure_vector< word > & | ws ) const |
Definition at line 112 of file monty.cpp.
References mul(), and Botan::BigInt::with_capacity().
void Botan::Montgomery_Params::mul_by | ( | BigInt & | x, |
const BigInt & | y, | ||
secure_vector< word > & | ws ) const |
Definition at line 174 of file monty.cpp.
References Botan::BigInt::_data(), Botan::bigint_monty_redc(), Botan::bigint_mul(), BOTAN_DEBUG_ASSERT, Botan::copy_mem(), Botan::BigInt::grow_to(), Botan::BigInt::mutable_data(), Botan::BigInt::sig_words(), and Botan::BigInt::size().
void Botan::Montgomery_Params::mul_by | ( | BigInt & | x, |
std::span< const word > | y, | ||
secure_vector< word > & | ws ) const |
Definition at line 143 of file monty.cpp.
References Botan::BigInt::_data(), Botan::bigint_monty_redc(), Botan::bigint_mul(), BOTAN_DEBUG_ASSERT, Botan::copy_mem(), Botan::BigInt::grow_to(), Botan::BigInt::mutable_data(), Botan::BigInt::sig_words(), and Botan::BigInt::size().
|
inline |
Definition at line 150 of file monty.h.
Referenced by Montgomery_Params(), and Montgomery_Params().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
BigInt Botan::Montgomery_Params::redc | ( | const BigInt & | x, |
secure_vector< word > & | ws ) const |
Definition at line 51 of file monty.cpp.
References Botan::BigInt::_data(), Botan::bigint_monty_redc(), Botan::BigInt::grow_to(), and Botan::BigInt::mutable_data().
void Botan::Montgomery_Params::redc_in_place | ( | BigInt & | x, |
secure_vector< word > & | ws ) const |
Definition at line 66 of file monty.cpp.
References Botan::BigInt::_data(), Botan::bigint_monty_redc(), Botan::BigInt::grow_to(), and Botan::BigInt::mutable_data().
void Botan::Montgomery_Params::sqr | ( | BigInt & | z, |
const BigInt & | x, | ||
secure_vector< word > & | ws ) const |
Definition at line 216 of file monty.cpp.
References Botan::BigInt::_data(), Botan::BigInt::size(), and sqr().
void Botan::Montgomery_Params::sqr | ( | BigInt & | z, |
std::span< const word > | x, | ||
secure_vector< word > & | ws ) const |
Definition at line 220 of file monty.cpp.
References Botan::BigInt::_data(), Botan::bigint_monty_redc(), Botan::bigint_sqr(), Botan::BigInt::grow_to(), Botan::BigInt::mutable_data(), and Botan::BigInt::size().
BigInt Botan::Montgomery_Params::sqr | ( | const BigInt & | x, |
secure_vector< word > & | ws ) const |
Definition at line 205 of file monty.cpp.
References Botan::BigInt::_data(), BOTAN_DEBUG_ASSERT, Botan::BigInt::sig_words(), Botan::BigInt::size(), and sqr().
BigInt Botan::Montgomery_Params::sqr | ( | std::span< const word > | x, |
secure_vector< word > & | ws ) const |
Definition at line 210 of file monty.cpp.
References sqr(), and Botan::BigInt::with_capacity().
void Botan::Montgomery_Params::square_this | ( | BigInt & | x, |
secure_vector< word > & | ws ) const |
Definition at line 236 of file monty.cpp.
References Botan::BigInt::_data(), Botan::bigint_monty_redc(), Botan::bigint_sqr(), BOTAN_DEBUG_ASSERT, Botan::copy_mem(), Botan::BigInt::grow_to(), Botan::BigInt::mutable_data(), Botan::BigInt::sig_words(), and Botan::BigInt::size().