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/poly1305 | |
parent | ff0f6e667ff877cd605d2b107c897b039f9829d9 (diff) |
crypto: test all SIMD combinations
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto/zinc/poly1305')
-rw-r--r-- | src/crypto/zinc/poly1305/poly1305-arm-glue.c | 1 | ||||
-rw-r--r-- | src/crypto/zinc/poly1305/poly1305-mips-glue.c | 1 | ||||
-rw-r--r-- | src/crypto/zinc/poly1305/poly1305-x86_64-glue.c | 2 | ||||
-rw-r--r-- | src/crypto/zinc/poly1305/poly1305.c | 7 |
4 files changed, 8 insertions, 3 deletions
diff --git a/src/crypto/zinc/poly1305/poly1305-arm-glue.c b/src/crypto/zinc/poly1305/poly1305-arm-glue.c index f91066f..f4f08ec 100644 --- a/src/crypto/zinc/poly1305/poly1305-arm-glue.c +++ b/src/crypto/zinc/poly1305/poly1305-arm-glue.c @@ -15,6 +15,7 @@ asmlinkage void poly1305_blocks_neon(void *ctx, const u8 *inp, const size_t len, asmlinkage void poly1305_emit_neon(void *ctx, u8 mac[16], const u32 nonce[4]); static bool poly1305_use_neon __ro_after_init; +static bool *const poly1305_nobs[] __initconst = { &poly1305_use_neon }; static void __init poly1305_fpu_init(void) { diff --git a/src/crypto/zinc/poly1305/poly1305-mips-glue.c b/src/crypto/zinc/poly1305/poly1305-mips-glue.c index 3a72d61..1eba951 100644 --- a/src/crypto/zinc/poly1305/poly1305-mips-glue.c +++ b/src/crypto/zinc/poly1305/poly1305-mips-glue.c @@ -8,6 +8,7 @@ asmlinkage void poly1305_blocks_mips(void *ctx, const u8 *inp, const size_t len, const u32 padbit); asmlinkage void poly1305_emit_mips(void *ctx, u8 mac[16], const u32 nonce[4]); +static bool *const poly1305_nobs[] __initconst = { }; static void __init poly1305_fpu_init(void) { } diff --git a/src/crypto/zinc/poly1305/poly1305-x86_64-glue.c b/src/crypto/zinc/poly1305/poly1305-x86_64-glue.c index 3641dc8..0229aca 100644 --- a/src/crypto/zinc/poly1305/poly1305-x86_64-glue.c +++ b/src/crypto/zinc/poly1305/poly1305-x86_64-glue.c @@ -25,6 +25,8 @@ asmlinkage void poly1305_blocks_avx512(void *ctx, const u8 *inp, static bool poly1305_use_avx __ro_after_init; static bool poly1305_use_avx2 __ro_after_init; static bool poly1305_use_avx512 __ro_after_init; +static bool *const poly1305_nobs[] __initconst = { + &poly1305_use_avx, &poly1305_use_avx2, &poly1305_use_avx512 }; static void __init poly1305_fpu_init(void) { diff --git a/src/crypto/zinc/poly1305/poly1305.c b/src/crypto/zinc/poly1305/poly1305.c index 88f94cd..6da8bf1 100644 --- a/src/crypto/zinc/poly1305/poly1305.c +++ b/src/crypto/zinc/poly1305/poly1305.c @@ -8,6 +8,7 @@ */ #include <zinc/poly1305.h> +#include "../selftest/run.h" #include <asm/unaligned.h> #include <linux/kernel.h> @@ -39,6 +40,7 @@ static inline bool poly1305_emit_arch(void *ctx, u8 mac[POLY1305_MAC_SIZE], { return false; } +static bool *const poly1305_nobs[] __initconst = { }; static void __init poly1305_fpu_init(void) { } @@ -146,10 +148,9 @@ static int __init mod_init(void) { if (!nosimd) poly1305_fpu_init(); -#ifdef CONFIG_ZINC_SELFTEST - if (WARN_ON(!poly1305_selftest())) + if (!selftest_run("poly1305", poly1305_selftest, poly1305_nobs, + ARRAY_SIZE(poly1305_nobs))) return -ENOTRECOVERABLE; -#endif return 0; } |