Botan 3.7.1
Crypto and TLS for C&
|
#include <reducer.h>
Public Member Functions | |
BigInt | cube (const BigInt &x) const |
const BigInt & | get_modulus () const |
bool | initialized () const |
Modular_Reducer () | |
Modular_Reducer (const BigInt &mod) | |
BigInt | multiply (const BigInt &x, const BigInt &y) const |
BigInt | multiply (const BigInt &x, const BigInt &y, const BigInt &z) const |
void | reduce (BigInt &out, const BigInt &x, secure_vector< word > &ws) const |
BigInt | reduce (const BigInt &x) const |
BigInt | square (const BigInt &x) const |
Static Public Member Functions | |
static Modular_Reducer | for_public_modulus (const BigInt &m) |
static Modular_Reducer | for_secret_modulus (const BigInt &m) |
|
inline |
Definition at line 67 of file reducer.h.
Referenced by for_public_modulus(), and for_secret_modulus().
|
explicit |
Accepts m == 0 and leaves the Modular_Reducer in an uninitialized state
Definition at line 19 of file reducer.cpp.
References for_secret_modulus().
Cube mod p
x | the value to cube |
Definition at line 52 of file reducer.h.
References Botan::square().
|
static |
Requires that m > 0
Definition at line 43 of file reducer.cpp.
References BOTAN_ARG_CHECK, BOTAN_MP_WORD_BITS, Botan::BigInt::is_negative(), Botan::BigInt::is_zero(), Modular_Reducer(), Botan::BigInt::power_of_2(), and Botan::BigInt::sig_words().
Referenced by Botan::DL_Group::DL_Group(), Botan::EC_Group::EC_Group(), Botan::FPE_FE1::FPE_FE1(), Botan::generate_dsa_primes(), Botan::sqrt_modulo_prime(), and Botan::EC_Group::verify_group().
|
static |
Requires that m > 0
Definition at line 32 of file reducer.cpp.
References BOTAN_ARG_CHECK, BOTAN_MP_WORD_BITS, Botan::ct_divide_pow2k(), Botan::BigInt::is_negative(), Botan::BigInt::is_zero(), Modular_Reducer(), and Botan::BigInt::sig_words().
Referenced by botan_mp_mod_mul(), Botan::generate_rsa_prime(), Botan::is_prime(), Modular_Reducer(), Botan::Montgomery_Params::Montgomery_Params(), Botan::power_mod(), and Botan::random_prime().
|
inline |
Definition at line 22 of file reducer.h.
Referenced by Botan::EC_Point_Base_Point_Precompute::EC_Point_Base_Point_Precompute().
|
inline |
Multiply mod p
x | the first operand |
y | the second operand |
Definition at line 32 of file reducer.h.
References Botan::reduce().
Referenced by Botan::Blinder::blind(), Botan::is_lucas_probable_prime(), Botan::Montgomery_Params::Montgomery_Params(), and Botan::Blinder::unblind().
|
inline |
Multiply mod p
Definition at line 38 of file reducer.h.
References multiply().
Referenced by multiply().
void Botan::Modular_Reducer::reduce | ( | BigInt & | out, |
const BigInt & | x, | ||
secure_vector< word > & | ws ) const |
Low level reduction function. Mostly for internal use. Sometimes useful for performance by reducing temporaries Reduce x mod p and place the output in out.
ws is a temporary workspace.
Definition at line 95 of file reducer.cpp.
References Botan::BigInt::_data(), Botan::BigInt::add(), BOTAN_MP_WORD_BITS, Botan::clear_mem(), Botan::ct_modulo(), Botan::BigInt::ct_reduce_below(), Botan::BigInt::is_negative(), Botan::BigInt::is_nonzero(), Botan::BigInt::mask_bits(), Botan::BigInt::mul(), Botan::BigInt::Positive, Botan::BigInt::rev_sub(), Botan::BigInt::set_sign(), Botan::BigInt::sig_words(), and Botan::BigInt::size().
Definition at line 54 of file reducer.cpp.
References reduce().
Referenced by Botan::is_lucas_probable_prime(), Botan::Montgomery_Params::Montgomery_Params(), Botan::EC_Point_Base_Point_Precompute::mul(), reduce(), and square().
Square mod p
x | the value to square |
Definition at line 61 of file reducer.cpp.
References reduce(), and Botan::BigInt::square().
Referenced by Botan::Blinder::blind(), Botan::is_lucas_probable_prime(), Botan::Montgomery_Params::Montgomery_Params(), and Botan::passes_miller_rabin_test().