Ensure zero-inialization, add TODO update gitignore.

This commit is contained in:
EinMByte 2015-07-16 17:39:24 +02:00
parent c939dec26a
commit 62ac53563c
8 changed files with 35 additions and 19 deletions

8
aes.h
View file

@ -140,7 +140,13 @@ namespace crypto
{
public:
CBCEncryption () { memset (m_LastBlock.buf, 0, 16); };
CBCEncryption () { memset (m_LastBlock.buf, 0, 16); };
CBCEncryption(const AESKey& key, const uint8_t* iv)
: CBCEncryption()
{
SetKey(key);
SetIV(iv);
};
void SetKey (const AESKey& key) { m_ECBEncryption.SetKey (key); }; // 32 bytes
void SetIV (const uint8_t * iv) { memcpy (m_LastBlock.buf, iv, 16); }; // 16 bytes