aboutsummaryrefslogtreecommitdiffstats
path: root/src/block/aes_ssse3/aes_ssse3.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-05-25 02:11:10 +0000
committerlloyd <[email protected]>2012-05-25 02:11:10 +0000
commit113f4035f41cf3152832e1753d28b79a7ea811a4 (patch)
tree1e2071c1f7786972d268b727f52ee33225ad68d4 /src/block/aes_ssse3/aes_ssse3.cpp
parentee42784fee56c48f72ecf03d7b93765dac35edf5 (diff)
For block and stream ciphers, don't set the size of the key vectors
until we are actually setting a key. This avoids the problem of prototype objects consuming not just memory but the precious few bytes of mlock'able memory that we're given by Linux. Use clear_mem instead of a loop in BigInt::mask_bits If OS2ECP encounters an invalid format type, include what type it was in the exception message.
Diffstat (limited to 'src/block/aes_ssse3/aes_ssse3.cpp')
-rw-r--r--src/block/aes_ssse3/aes_ssse3.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/block/aes_ssse3/aes_ssse3.cpp b/src/block/aes_ssse3/aes_ssse3.cpp
index a9ab29863..648f96d67 100644
--- a/src/block/aes_ssse3/aes_ssse3.cpp
+++ b/src/block/aes_ssse3/aes_ssse3.cpp
@@ -378,6 +378,9 @@ void AES_128_SSSE3::key_schedule(const byte keyb[], size_t)
__m128i key = _mm_loadu_si128(reinterpret_cast<const __m128i*>(keyb));
+ EK.resize(11*4);
+ DK.resize(11*4);
+
__m128i* EK_mm = reinterpret_cast<__m128i*>(&EK[0]);
__m128i* DK_mm = reinterpret_cast<__m128i*>(&DK[0]);
@@ -445,6 +448,9 @@ void AES_192_SSSE3::key_schedule(const byte keyb[], size_t)
__m128i rcon = _mm_set_epi32(0x702A9808, 0x4D7C7D81,
0x1F8391B9, 0xAF9DEEB6);
+ EK.resize(13*4);
+ DK.resize(13*4);
+
__m128i* EK_mm = reinterpret_cast<__m128i*>(&EK[0]);
__m128i* DK_mm = reinterpret_cast<__m128i*>(&DK[0]);
@@ -544,6 +550,9 @@ void AES_256_SSSE3::key_schedule(const byte keyb[], size_t)
__m128i rcon = _mm_set_epi32(0x702A9808, 0x4D7C7D81,
0x1F8391B9, 0xAF9DEEB6);
+ EK.resize(15*4);
+ DK.resize(15*4);
+
__m128i* EK_mm = reinterpret_cast<__m128i*>(&EK[0]);
__m128i* DK_mm = reinterpret_cast<__m128i*>(&DK[0]);