Botan 3.7.1
Crypto and TLS for C&
|
#include <monty.h>
Static Public Member Functions | |
static Montgomery_Int | from_wide_int (const std::shared_ptr< const Montgomery_Params > ¶ms, const BigInt &x) |
static Montgomery_Int | one (const std::shared_ptr< const Montgomery_Params > ¶ms) |
|
inline |
Create a zero-initialized Montgomery_Int
Definition at line 28 of file monty.h.
Referenced by additive_inverse(), cube(), from_wide_int(), mul(), one(), operator*(), operator+(), operator-(), and square().
Botan::Montgomery_Int::Montgomery_Int | ( | const std::shared_ptr< const Montgomery_Params > & | params, |
const BigInt & | v, | ||
bool | redc_needed = true ) |
Create a Montgomery_Int
Definition at line 270 of file monty.cpp.
References BOTAN_ASSERT_NOMSG.
Botan::Montgomery_Int::Montgomery_Int | ( | const std::shared_ptr< const Montgomery_Params > & | params, |
const uint8_t | bits[], | ||
size_t | len, | ||
bool | redc_needed = true ) |
Create a Montgomery_Int
Definition at line 283 of file monty.cpp.
References BOTAN_ASSERT_NOMSG.
Botan::Montgomery_Int::Montgomery_Int | ( | std::shared_ptr< const Montgomery_Params > | params, |
const word | words[], | ||
size_t | len, | ||
bool | redc_needed = true ) |
Create a Montgomery_Int
Definition at line 295 of file monty.cpp.
References BOTAN_ASSERT_NOMSG, and Botan::BigInt::set_words().
|
inline |
Definition at line 122 of file monty.h.
|
inline |
Definition at line 124 of file monty.h.
|
inline |
Montgomery_Int & Botan::Montgomery_Int::add | ( | const Montgomery_Int & | other, |
secure_vector< word > & | ws ) |
Definition at line 362 of file monty.cpp.
References BOTAN_STATE_CHECK, and Botan::BigInt::mod_add().
Referenced by operator+=().
Montgomery_Int Botan::Montgomery_Int::additive_inverse | ( | ) | const |
Definition at line 433 of file monty.cpp.
References Montgomery_Int().
Montgomery_Int Botan::Montgomery_Int::cube | ( | secure_vector< word > & | ws | ) | const |
Definition at line 429 of file monty.cpp.
References Montgomery_Int().
void Botan::Montgomery_Int::fix_size | ( | ) |
Definition at line 309 of file monty.cpp.
References BOTAN_DEBUG_ASSERT, Botan::BigInt::grow_to(), and Botan::BigInt::sig_words().
|
static |
Wide reduction - input can be at most 2*bytes long
Definition at line 262 of file monty.cpp.
References Montgomery_Int(), and mul().
bool Botan::Montgomery_Int::is_one | ( | ) | const |
bool Botan::Montgomery_Int::is_zero | ( | ) | const |
Montgomery_Int Botan::Montgomery_Int::mul | ( | const Montgomery_Int & | other, |
secure_vector< word > & | ws ) const |
Definition at line 386 of file monty.cpp.
References BOTAN_STATE_CHECK, and Montgomery_Int().
Referenced by from_wide_int(), and Botan::monty_multi_exp().
Montgomery_Int & Botan::Montgomery_Int::mul_by | ( | const Montgomery_Int & | other, |
secure_vector< word > & | ws ) |
Definition at line 391 of file monty.cpp.
References BOTAN_STATE_CHECK.
Referenced by Botan::monty_multi_exp(), operator*=(), and operator*=().
Montgomery_Int & Botan::Montgomery_Int::mul_by | ( | const secure_vector< word > & | other, |
secure_vector< word > & | ws ) |
Montgomery_Int & Botan::Montgomery_Int::mul_by_2 | ( | secure_vector< word > & | ws | ) |
Definition at line 437 of file monty.cpp.
References Botan::BigInt::mod_mul().
Montgomery_Int & Botan::Montgomery_Int::mul_by_3 | ( | secure_vector< word > & | ws | ) |
Definition at line 442 of file monty.cpp.
References Botan::BigInt::mod_mul().
Montgomery_Int & Botan::Montgomery_Int::mul_by_4 | ( | secure_vector< word > & | ws | ) |
Definition at line 447 of file monty.cpp.
References Botan::BigInt::mod_mul().
Montgomery_Int & Botan::Montgomery_Int::mul_by_8 | ( | secure_vector< word > & | ws | ) |
Definition at line 452 of file monty.cpp.
References Botan::BigInt::mod_mul().
|
static |
Definition at line 258 of file monty.cpp.
References Montgomery_Int().
|
inline |
Montgomery_Int Botan::Montgomery_Int::operator* | ( | const Montgomery_Int & | other | ) | const |
Definition at line 380 of file monty.cpp.
References BOTAN_STATE_CHECK, and Montgomery_Int().
Montgomery_Int & Botan::Montgomery_Int::operator*= | ( | const Montgomery_Int & | other | ) |
Definition at line 402 of file monty.cpp.
References BOTAN_STATE_CHECK, and mul_by().
Montgomery_Int & Botan::Montgomery_Int::operator*= | ( | const secure_vector< word > & | other | ) |
Montgomery_Int Botan::Montgomery_Int::operator+ | ( | const Montgomery_Int & | other | ) | const |
Definition at line 340 of file monty.cpp.
References BOTAN_STATE_CHECK, Botan::BigInt::mod_add(), and Montgomery_Int().
Montgomery_Int & Botan::Montgomery_Int::operator+= | ( | const Montgomery_Int & | other | ) |
Definition at line 356 of file monty.cpp.
References add(), and BOTAN_STATE_CHECK.
Montgomery_Int Botan::Montgomery_Int::operator- | ( | const Montgomery_Int & | other | ) | const |
Definition at line 348 of file monty.cpp.
References BOTAN_STATE_CHECK, Botan::BigInt::mod_sub(), and Montgomery_Int().
Montgomery_Int & Botan::Montgomery_Int::operator-= | ( | const Montgomery_Int & | other | ) |
Definition at line 368 of file monty.cpp.
References BOTAN_STATE_CHECK, and sub().
bool Botan::Montgomery_Int::operator== | ( | const Montgomery_Int & | other | ) | const |
|
inline |
std::vector< uint8_t > Botan::Montgomery_Int::serialize | ( | ) | const |
Definition at line 319 of file monty.cpp.
References Botan::BigInt::serialize(), and value().
size_t Botan::Montgomery_Int::size | ( | ) | const |
Montgomery_Int Botan::Montgomery_Int::square | ( | secure_vector< word > & | ws | ) | const |
Definition at line 425 of file monty.cpp.
References Montgomery_Int().
Referenced by Botan::monty_multi_exp().
Montgomery_Int & Botan::Montgomery_Int::square_this | ( | secure_vector< word > & | ws | ) |
Definition at line 420 of file monty.cpp.
Referenced by Botan::monty_multi_exp().
Montgomery_Int & Botan::Montgomery_Int::square_this_n_times | ( | secure_vector< word > & | ws, |
size_t | n ) |
Montgomery_Int & Botan::Montgomery_Int::sub | ( | const Montgomery_Int & | other, |
secure_vector< word > & | ws ) |
Definition at line 374 of file monty.cpp.
References BOTAN_STATE_CHECK, and Botan::BigInt::mod_sub().
Referenced by operator-=().
BigInt Botan::Montgomery_Int::value | ( | ) | const |
Return the value to normal mod-p space
Definition at line 335 of file monty.cpp.
Referenced by Botan::DL_Group::multi_exponentiate(), Botan::passes_miller_rabin_test(), Botan::power_mod(), serialize(), and Botan::sqrt_modulo_prime().