Skip to content

Commit a18dc7f

Browse files
committed
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.
1 parent 40b5982 commit a18dc7f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

wolfcrypt/src/aes.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3129,6 +3129,12 @@ static WARN_UNUSED_RESULT int wc_AesDecrypt(
31293129
checkAESNI = 1;
31303130
}
31313131
if (haveAESNI) {
3132+
#ifdef WOLFSSL_LINUXKM
3133+
/* runtime alignment check */
3134+
if ((unsigned long)&aes->key & 0xf) {
3135+
return BAD_ALIGN_E;
3136+
}
3137+
#endif
31323138
aes->use_aesni = 1;
31333139
if (iv)
31343140
XMEMCPY(aes->reg, iv, AES_BLOCK_SIZE);

0 commit comments

Comments
 (0)