aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/numbertheory
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-03-01 16:54:27 -0500
committerJack Lloyd <[email protected]>2018-03-01 16:54:27 -0500
commit2bea955063e1df520531339a9f7e39531f68a2ca (patch)
treeea31f94d7091dc334363171287370a519375bdff /src/lib/math/numbertheory
parent03e3d3dac4b50a6da3cfec2971460c1182cebd9d (diff)
Remove MP_WORD_BITS constant
Use the BOTAN_MP_WORD_BITS consistently
Diffstat (limited to 'src/lib/math/numbertheory')
-rw-r--r--src/lib/math/numbertheory/nistp_redc.cpp4
-rw-r--r--src/lib/math/numbertheory/reducer.cpp9
2 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/math/numbertheory/nistp_redc.cpp b/src/lib/math/numbertheory/nistp_redc.cpp
index 94a8d2872..36135f891 100644
--- a/src/lib/math/numbertheory/nistp_redc.cpp
+++ b/src/lib/math/numbertheory/nistp_redc.cpp
@@ -21,8 +21,8 @@ const BigInt& prime_p521()
void redc_p521(BigInt& x, secure_vector<word>& ws)
{
- const size_t p_full_words = 521 / MP_WORD_BITS;
- const size_t p_top_bits = 521 % MP_WORD_BITS;
+ const size_t p_full_words = 521 / BOTAN_MP_WORD_BITS;
+ const size_t p_top_bits = 521 % BOTAN_MP_WORD_BITS;
const size_t p_words = p_full_words + 1;
const size_t x_sw = x.sig_words();
diff --git a/src/lib/math/numbertheory/reducer.cpp b/src/lib/math/numbertheory/reducer.cpp
index 1d7c2259a..e9db7753b 100644
--- a/src/lib/math/numbertheory/reducer.cpp
+++ b/src/lib/math/numbertheory/reducer.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/reducer.h>
-#include <botan/internal/mp_core.h>
namespace Botan {
@@ -23,7 +22,7 @@ Modular_Reducer::Modular_Reducer(const BigInt& mod)
m_modulus_2 = Botan::square(m_modulus);
- m_mu = BigInt::power_of_2(2 * MP_WORD_BITS * m_mod_words) / m_modulus;
+ m_mu = BigInt::power_of_2(2 * BOTAN_MP_WORD_BITS * m_mod_words) / m_modulus;
}
/*
@@ -49,16 +48,16 @@ BigInt Modular_Reducer::reduce(const BigInt& x) const
BigInt t1(x.data() + m_mod_words - 1, x_sw - (m_mod_words - 1));
t1.mul(m_mu, ws);
- t1 >>= (MP_WORD_BITS * (m_mod_words + 1));
+ t1 >>= (BOTAN_MP_WORD_BITS * (m_mod_words + 1));
t1.mul(m_modulus, ws);
- t1.mask_bits(MP_WORD_BITS * (m_mod_words + 1));
+ t1.mask_bits(BOTAN_MP_WORD_BITS * (m_mod_words + 1));
t1.rev_sub(x.data(), std::min(x_sw, m_mod_words + 1), ws);
if(t1.is_negative())
{
- t1 += BigInt::power_of_2(MP_WORD_BITS * (m_mod_words + 1));
+ t1 += BigInt::power_of_2(BOTAN_MP_WORD_BITS * (m_mod_words + 1));
}
t1.reduce_below(m_modulus, ws);