aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-12-06 11:05:16 -0500
committerJack Lloyd <[email protected]>2019-12-06 11:11:56 -0500
commitbbc71ebaa1573290f38273ca80b563d272c0917c (patch)
tree33e5a0eecb8db399b259d19283e3c8364cd27e02 /src/lib
parent9f3dbac2eb28906e53808682222aef4eb90f4c15 (diff)
Fix MSVC "optimization" warning about bool conversions
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/math/numbertheory/numthry.cpp2
-rw-r--r--src/lib/math/numbertheory/primality.cpp2
-rw-r--r--src/lib/modes/aead/gcm/ghash.cpp2
-rw-r--r--src/lib/modes/cfb/cfb.cpp6
4 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/math/numbertheory/numthry.cpp b/src/lib/math/numbertheory/numthry.cpp
index 0d21f0237..90f1279b6 100644
--- a/src/lib/math/numbertheory/numthry.cpp
+++ b/src/lib/math/numbertheory/numthry.cpp
@@ -93,7 +93,7 @@ BigInt gcd(const BigInt& a, const BigInt& b)
f.shrink_to_fit();
sub_abs(newg, f, g);
- const uint8_t need_swap = (g.is_odd() && delta > 0);
+ const bool need_swap = (g.is_odd() && delta > 0);
// if(need_swap) delta *= -1
delta *= CT::Mask<uint8_t>::expand(need_swap).select(0, 2) - 1;
diff --git a/src/lib/math/numbertheory/primality.cpp b/src/lib/math/numbertheory/primality.cpp
index 5e683c1ff..028e2a7ef 100644
--- a/src/lib/math/numbertheory/primality.cpp
+++ b/src/lib/math/numbertheory/primality.cpp
@@ -62,7 +62,7 @@ bool is_lucas_probable_prime(const BigInt& C, const Modular_Reducer& mod_C)
for(size_t i = 0; i != K_bits; ++i)
{
- const uint8_t k_bit = K.get_bit(K_bits - 1 - i);
+ const bool k_bit = K.get_bit(K_bits - 1 - i);
Ut = mod_C.multiply(U, V);
diff --git a/src/lib/modes/aead/gcm/ghash.cpp b/src/lib/modes/aead/gcm/ghash.cpp
index 3a4301113..43772803b 100644
--- a/src/lib/modes/aead/gcm/ghash.cpp
+++ b/src/lib/modes/aead/gcm/ghash.cpp
@@ -96,7 +96,7 @@ void GHASH::gcm_multiply(secure_vector<uint8_t>& x,
void GHASH::ghash_update(secure_vector<uint8_t>& ghash,
const uint8_t input[], size_t length)
{
- verify_key_set(m_HM.size());
+ verify_key_set(!m_HM.empty());
/*
This assumes if less than block size input then we're just on the
diff --git a/src/lib/modes/cfb/cfb.cpp b/src/lib/modes/cfb/cfb.cpp
index e1bee0427..0c619e322 100644
--- a/src/lib/modes/cfb/cfb.cpp
+++ b/src/lib/modes/cfb/cfb.cpp
@@ -82,7 +82,7 @@ void CFB_Mode::start_msg(const uint8_t nonce[], size_t nonce_len)
if(!valid_nonce_length(nonce_len))
throw Invalid_IV_Length(name(), nonce_len);
- verify_key_set(m_keystream.size());
+ verify_key_set(!m_keystream.empty());
if(nonce_len == 0)
{
@@ -116,7 +116,7 @@ void CFB_Mode::shift_register()
size_t CFB_Encryption::process(uint8_t buf[], size_t sz)
{
- verify_key_set(m_keystream.size());
+ verify_key_set(!m_keystream.empty());
BOTAN_STATE_CHECK(m_state.empty() == false);
const size_t shift = feedback();
@@ -181,7 +181,7 @@ inline void xor_copy(uint8_t buf[], uint8_t key_buf[], size_t len)
size_t CFB_Decryption::process(uint8_t buf[], size_t sz)
{
- verify_key_set(m_keystream.size());
+ verify_key_set(!m_keystream.empty());
BOTAN_STATE_CHECK(m_state.empty() == false);
const size_t shift = feedback();