diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-05 03:13:30 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-06 02:19:47 +0200 |
commit | 15278beaa6f5a416725f9be9212323e8c19e57c4 (patch) | |
tree | 4020d614248eb3fb95ac4cab11feeaddfafd4cb0 /src/crypto/zinc/chacha20 | |
parent | ff0f6e667ff877cd605d2b107c897b039f9829d9 (diff) |
crypto: test all SIMD combinations
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto/zinc/chacha20')
-rw-r--r-- | src/crypto/zinc/chacha20/chacha20-arm-glue.c | 2 | ||||
-rw-r--r-- | src/crypto/zinc/chacha20/chacha20-mips-glue.c | 2 | ||||
-rw-r--r-- | src/crypto/zinc/chacha20/chacha20-x86_64-glue.c | 3 | ||||
-rw-r--r-- | src/crypto/zinc/chacha20/chacha20.c | 7 |
4 files changed, 9 insertions, 5 deletions
diff --git a/src/crypto/zinc/chacha20/chacha20-arm-glue.c b/src/crypto/zinc/chacha20/chacha20-arm-glue.c index a397d84..a0da95d 100644 --- a/src/crypto/zinc/chacha20/chacha20-arm-glue.c +++ b/src/crypto/zinc/chacha20/chacha20-arm-glue.c @@ -17,7 +17,7 @@ asmlinkage void chacha20_neon(u8 *out, const u8 *in, const size_t len, const u32 key[8], const u32 counter[4]); static bool chacha20_use_neon __ro_after_init; - +static bool *const chacha20_nobs[] __initconst = { &chacha20_use_neon }; static void __init chacha20_fpu_init(void) { #if defined(CONFIG_ZINC_ARCH_ARM64) diff --git a/src/crypto/zinc/chacha20/chacha20-mips-glue.c b/src/crypto/zinc/chacha20/chacha20-mips-glue.c index 04235ca..917d8fa 100644 --- a/src/crypto/zinc/chacha20/chacha20-mips-glue.c +++ b/src/crypto/zinc/chacha20/chacha20-mips-glue.c @@ -5,7 +5,7 @@ asmlinkage void chacha20_mips(u32 state[16], u8 *out, const u8 *in, const size_t len); - +static bool *const chacha20_nobs[] __initconst = { }; static void __init chacha20_fpu_init(void) { } diff --git a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.c b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.c index b89d5e1..f5a9c21 100644 --- a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.c +++ b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.c @@ -23,6 +23,9 @@ static bool chacha20_use_ssse3 __ro_after_init; static bool chacha20_use_avx2 __ro_after_init; static bool chacha20_use_avx512 __ro_after_init; static bool chacha20_use_avx512vl __ro_after_init; +static bool *const chacha20_nobs[] __initconst = { + &chacha20_use_ssse3, &chacha20_use_avx2, &chacha20_use_avx512, + &chacha20_use_avx512vl }; static void __init chacha20_fpu_init(void) { diff --git a/src/crypto/zinc/chacha20/chacha20.c b/src/crypto/zinc/chacha20/chacha20.c index bc7e9be..971391c 100644 --- a/src/crypto/zinc/chacha20/chacha20.c +++ b/src/crypto/zinc/chacha20/chacha20.c @@ -8,6 +8,7 @@ */ #include <zinc/chacha20.h> +#include "../selftest/run.h" #include <linux/kernel.h> #include <linux/module.h> @@ -22,6 +23,7 @@ #elif defined(CONFIG_ZINC_ARCH_MIPS) #include "chacha20-mips-glue.c" #else +static bool *const chacha20_nobs[] __initconst = { }; static void __init chacha20_fpu_init(void) { } @@ -171,10 +173,9 @@ static int __init mod_init(void) { if (!nosimd) chacha20_fpu_init(); -#ifdef CONFIG_ZINC_SELFTEST - if (WARN_ON(!chacha20_selftest())) + if (!selftest_run("chacha20", chacha20_selftest, chacha20_nobs, + ARRAY_SIZE(chacha20_nobs))) return -ENOTRECOVERABLE; -#endif return 0; } |