Merge pull request #2401 from SparkiDev/aesni_null_iv

Set the IV to zero when NULL IV and using AESNI
This commit is contained in:
David Garske
2019-08-09 12:57:48 -07:00
committed by GitHub

View File

@ -2306,6 +2306,8 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
aes->use_aesni = 1; aes->use_aesni = 1;
if (iv) if (iv)
XMEMCPY(aes->reg, iv, AES_BLOCK_SIZE); XMEMCPY(aes->reg, iv, AES_BLOCK_SIZE);
else
XMEMSET(aes->reg, 0, AES_BLOCK_SIZE);
if (dir == AES_ENCRYPTION) if (dir == AES_ENCRYPTION)
return AES_set_encrypt_key(userKey, keylen * 8, aes); return AES_set_encrypt_key(userKey, keylen * 8, aes);
#ifdef HAVE_AES_DECRYPT #ifdef HAVE_AES_DECRYPT