wolfcrypt/src/aes.c: in wc_AesSetKeyLocal(), add an alignment check in the haveAESNI path for WOLFSSL_LINUXKM, because the failure mode is module crash.

This commit is contained in:
Daniel Pouzzner
2023-05-17 01:07:47 -05:00
parent 40b598289f
commit a18dc7f10a

View File

@@ -3129,6 +3129,12 @@ static WARN_UNUSED_RESULT int wc_AesDecrypt(
checkAESNI = 1;
}
if (haveAESNI) {
#ifdef WOLFSSL_LINUXKM
/* runtime alignment check */
if ((unsigned long)&aes->key & 0xf) {
return BAD_ALIGN_E;
}
#endif
aes->use_aesni = 1;
if (iv)
XMEMCPY(aes->reg, iv, AES_BLOCK_SIZE);