aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-09-30 16:45:20 -0400
committerJack Lloyd <[email protected]>2018-09-30 16:45:20 -0400
commit38f053a5f8cb1ca351ba52d76c15491d63fd3eb0 (patch)
tree13c06b095059af302b8e0d9562a4aa7a9a6e73b1 /src/lib/math
parente9ba0d9cdf0726b357d7aeca14ef43f1d10be1e8 (diff)
Fix some MSVC warnings
Diffstat (limited to 'src/lib/math')
-rw-r--r--src/lib/math/numbertheory/monty_exp.cpp8
-rw-r--r--src/lib/math/numbertheory/nistp_redc.cpp2
-rw-r--r--src/lib/math/numbertheory/powm_fw.cpp2
3 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/math/numbertheory/monty_exp.cpp b/src/lib/math/numbertheory/monty_exp.cpp
index 567492091..2b5bbd81d 100644
--- a/src/lib/math/numbertheory/monty_exp.cpp
+++ b/src/lib/math/numbertheory/monty_exp.cpp
@@ -44,7 +44,7 @@ Montgomery_Exponentation_State::Montgomery_Exponentation_State(std::shared_ptr<c
if(m_window_bits < 1 || m_window_bits > 12) // really even 8 is too large ...
throw Invalid_Argument("Invalid window bits for Montgomery exponentiation");
- const size_t window_size = (1U << m_window_bits);
+ const size_t window_size = (static_cast<size_t>(1) << m_window_bits);
m_g.reserve(window_size);
@@ -233,10 +233,10 @@ BigInt monty_multi_exp(std::shared_ptr<const Montgomery_Params> params_p,
H.square_this(ws);
}
- const uint8_t z1_b = z1.get_substring(z_bits - i - 2, 2);
- const uint8_t z2_b = z2.get_substring(z_bits - i - 2, 2);
+ const uint32_t z1_b = z1.get_substring(z_bits - i - 2, 2);
+ const uint32_t z2_b = z2.get_substring(z_bits - i - 2, 2);
- const uint8_t z12 = (4*z2_b) + z1_b;
+ const uint32_t z12 = (4*z2_b) + z1_b;
H.mul_by(*M[z12], ws);
}
diff --git a/src/lib/math/numbertheory/nistp_redc.cpp b/src/lib/math/numbertheory/nistp_redc.cpp
index 1c2855784..ba0c5142d 100644
--- a/src/lib/math/numbertheory/nistp_redc.cpp
+++ b/src/lib/math/numbertheory/nistp_redc.cpp
@@ -43,7 +43,7 @@ void redc_p521(BigInt& x, secure_vector<word>& ws)
BOTAN_ASSERT_EQUAL(carry, 0, "Final carry in P-521 reduction");
// Now find the actual carry in bit 522
- const uint8_t bit_522_set = x.word_at(p_full_words) >> (p_top_bits);
+ const word bit_522_set = x.word_at(p_full_words) >> p_top_bits;
#if (BOTAN_MP_WORD_BITS == 64)
static const word p521_words[9] = {
diff --git a/src/lib/math/numbertheory/powm_fw.cpp b/src/lib/math/numbertheory/powm_fw.cpp
index 85a0364b5..c326ffa44 100644
--- a/src/lib/math/numbertheory/powm_fw.cpp
+++ b/src/lib/math/numbertheory/powm_fw.cpp
@@ -25,7 +25,7 @@ void Fixed_Window_Exponentiator::set_base(const BigInt& base)
{
m_window_bits = Power_Mod::window_bits(m_exp.bits(), base.bits(), m_hints);
- m_g.resize(1U << m_window_bits);
+ m_g.resize(static_cast<size_t>(1) << m_window_bits);
m_g[0] = 1;
m_g[1] = base;