Skip to content

Commit

Permalink
crypto: camellia_aesni_avx - Fix CPU feature checks
Browse files Browse the repository at this point in the history
We need to explicitly check the AVX and AES CPU features, as we can't
infer them from the related XSAVE feature flags.  For example, the
Core i3 2310M passes the XSAVE feature test but does not implement
AES-NI.

Reported-and-tested-by: Stéphane Glondu <[email protected]>
References: https://bugs.debian.org/800934
Fixes: ce4f5f9 ("x86/fpu, crypto x86/camellia_aesni_avx: Simplify...")
Signed-off-by: Ben Hutchings <[email protected]>
Cc: stable <[email protected]> # 4.2
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
bwhacks authored and herbertx committed Oct 8, 2015
1 parent a66d7f7 commit 92b2790
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/x86/crypto/camellia_aesni_avx_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,11 @@ static int __init camellia_aesni_init(void)
{
const char *feature_name;

if (!cpu_has_avx || !cpu_has_aes || !cpu_has_osxsave) {
pr_info("AVX or AES-NI instructions are not detected.\n");
return -ENODEV;
}

if (!cpu_has_xfeatures(XSTATE_SSE | XSTATE_YMM, &feature_name)) {
pr_info("CPU feature '%s' is not supported.\n", feature_name);
return -ENODEV;
Expand Down

0 comments on commit 92b2790

Please sign in to comment.