aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-03-06 05:48:37 -0500
committerJack Lloyd <[email protected]>2016-03-06 05:48:37 -0500
commit27c9aeb85849b0b2808e95f50656d0a3c0aa6371 (patch)
tree161156fdfe168253dd9ade3f24f0f2934b3f2142 /src/lib
parent2f7225c5f56feab172978a0182ac27c20b02c080 (diff)
parent464e9eccbb61738582f85a81dd4b586bd3d6898e (diff)
Merge GH #441 Clang analyzer fixes
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/block/aes/aes.cpp6
-rw-r--r--src/lib/block/aes_ssse3/aes_ssse3.cpp2
-rw-r--r--src/lib/pubkey/mce/polyn_gf2m.cpp4
3 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp
index 6cca701af..aac277b4f 100644
--- a/src/lib/block/aes/aes.cpp
+++ b/src/lib/block/aes/aes.cpp
@@ -345,6 +345,12 @@ void aes_key_schedule(const byte key[], size_t length,
secure_vector<byte>& ME,
secure_vector<byte>& MD)
{
+
+ // if length is < 4, X = 0, the first for loop is not entered and in
+ // the second for loop "RC[(i-X)/X]" = division by zero
+ // But obviously valid aes length values are only 16, 24 and 32
+ BOTAN_ASSERT( length >= 4, "aes key length has valid size" );
+
static const u32bit RC[10] = {
0x01000000, 0x02000000, 0x04000000, 0x08000000, 0x10000000,
0x20000000, 0x40000000, 0x80000000, 0x1B000000, 0x36000000 };
diff --git a/src/lib/block/aes_ssse3/aes_ssse3.cpp b/src/lib/block/aes_ssse3/aes_ssse3.cpp
index fa0cb787c..54e8fcbd8 100644
--- a/src/lib/block/aes_ssse3/aes_ssse3.cpp
+++ b/src/lib/block/aes_ssse3/aes_ssse3.cpp
@@ -59,8 +59,6 @@ __m128i aes_schedule_transform(__m128i input,
__m128i i_1 = _mm_and_si128(low_nibs, input);
__m128i i_2 = _mm_srli_epi32(_mm_andnot_si128(low_nibs, input), 4);
- input = _mm_and_si128(low_nibs, input);
-
return _mm_xor_si128(
_mm_shuffle_epi8(table_1, i_1),
_mm_shuffle_epi8(table_2, i_2));
diff --git a/src/lib/pubkey/mce/polyn_gf2m.cpp b/src/lib/pubkey/mce/polyn_gf2m.cpp
index a957b8cc1..e0d1c5a65 100644
--- a/src/lib/pubkey/mce/polyn_gf2m.cpp
+++ b/src/lib/pubkey/mce/polyn_gf2m.cpp
@@ -644,13 +644,11 @@ polyn_gf2m::polyn_gf2m(int t, Botan::RandomNumberGenerator& rng, std::shared_ptr
coeff(t+1),
msp_field(sp_field)
{
- int i;
(*this).set_coef( t, 1);
- i = 0;
int degree = 0;
do
{
- for (i = 0; i < t; ++i)
+ for (int i = 0; i < t; ++i)
{
(*this).set_coef( i, random_code_element(sp_field->get_cardinality(), rng));
}