Add check for PCLMUL instruction too. Virtually all CPUs with AES-NI have it but good to be sure.

This commit is contained in:
Adam Ierymenko 2019-08-26 19:48:56 -07:00
parent 012fba617d
commit 8faaaec710
No known key found for this signature in database
GPG Key ID: C8877CF2D7A5D7F3

View File

@ -62,7 +62,7 @@ static bool _zt_aesni_supported()
: "=a"(eax),"=b"(ebx),"=c"(ecx),"=d"(edx)
: "a"(1),"c"(0)
);
return ((ecx & (1 << 25)) != 0);
return (((ecx & (1 << 25)) != 0) && ((ecx & (1 << 1)) != 0)); // check for both AES-NI and PCLMUL
#endif
}
const bool AES::HW_ACCEL = _zt_aesni_supported();