Add tests for AES CBC (mainly important for custom AESNI implementation).

This commit is contained in:
EinMByte 2015-07-31 13:01:49 +02:00
parent 59e081f41e
commit 5d0b24d696
3 changed files with 213 additions and 2 deletions

View file

@ -146,7 +146,7 @@ namespace crypto
{
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
@ -168,6 +168,13 @@ namespace crypto
CBCDecryption () { memset (m_IV.buf, 0, 16); };
CBCDecryption(const AESKey& key, const uint8_t* iv)
: CBCDecryption()
{
SetKey(key);
SetIV(iv);
}
void SetKey (const AESKey& key) { m_ECBDecryption.SetKey (key); }; // 32 bytes
void SetIV (const uint8_t * iv) { memcpy (m_IV.buf, iv, 16); }; // 16 bytes