aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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));
}