From beaa1135df1655683d8521a7129bb03c55c432d6 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 29 Sep 2018 05:11:24 +0200 Subject: crypto: WARN_ON in module_init if selftest fails If it's a built-in and initcall fails, it won't be fatal. So we should at least be loud. Suggested-by: Ard Biesheuvel --- src/crypto/zinc/blake2s/blake2s.c | 2 +- src/crypto/zinc/chacha20/chacha20.c | 2 +- src/crypto/zinc/chacha20poly1305.c | 2 +- src/crypto/zinc/curve25519/curve25519.c | 2 +- src/crypto/zinc/poly1305/poly1305.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/crypto') diff --git a/src/crypto/zinc/blake2s/blake2s.c b/src/crypto/zinc/blake2s/blake2s.c index 8e22824..9517c33 100644 --- a/src/crypto/zinc/blake2s/blake2s.c +++ b/src/crypto/zinc/blake2s/blake2s.c @@ -291,7 +291,7 @@ static int __init mod_init(void) if (!nosimd) blake2s_fpu_init(); #ifdef CONFIG_ZINC_SELFTEST - if (!blake2s_selftest()) + if (WARN_ON(!blake2s_selftest())) return -ENOTRECOVERABLE; #endif return 0; diff --git a/src/crypto/zinc/chacha20/chacha20.c b/src/crypto/zinc/chacha20/chacha20.c index c767e02..e71e702 100644 --- a/src/crypto/zinc/chacha20/chacha20.c +++ b/src/crypto/zinc/chacha20/chacha20.c @@ -172,7 +172,7 @@ static int __init mod_init(void) if (!nosimd) chacha20_fpu_init(); #ifdef CONFIG_ZINC_SELFTEST - if (!chacha20_selftest()) + if (WARN_ON(!chacha20_selftest())) return -ENOTRECOVERABLE; #endif return 0; diff --git a/src/crypto/zinc/chacha20poly1305.c b/src/crypto/zinc/chacha20poly1305.c index 9860c3c..59f1d00 100644 --- a/src/crypto/zinc/chacha20poly1305.c +++ b/src/crypto/zinc/chacha20poly1305.c @@ -348,7 +348,7 @@ static int __init mod_init(void) #endif { #ifdef CONFIG_ZINC_SELFTEST - if (!chacha20poly1305_selftest()) + if (WARN_ON(!chacha20poly1305_selftest())) return -ENOTRECOVERABLE; #endif return 0; diff --git a/src/crypto/zinc/curve25519/curve25519.c b/src/crypto/zinc/curve25519/curve25519.c index 6b1b18e..87fe860 100644 --- a/src/crypto/zinc/curve25519/curve25519.c +++ b/src/crypto/zinc/curve25519/curve25519.c @@ -99,7 +99,7 @@ static int __init mod_init(void) if (!nosimd) curve25519_fpu_init(); #ifdef CONFIG_ZINC_SELFTEST - if (!curve25519_selftest()) + if (WARN_ON(!curve25519_selftest())) return -ENOTRECOVERABLE; #endif return 0; diff --git a/src/crypto/zinc/poly1305/poly1305.c b/src/crypto/zinc/poly1305/poly1305.c index ad758b5..064856b 100644 --- a/src/crypto/zinc/poly1305/poly1305.c +++ b/src/crypto/zinc/poly1305/poly1305.c @@ -147,7 +147,7 @@ static int __init mod_init(void) if (!nosimd) poly1305_fpu_init(); #ifdef CONFIG_ZINC_SELFTEST - if (!poly1305_selftest()) + if (WARN_ON(!poly1305_selftest())) return -ENOTRECOVERABLE; #endif return 0; -- cgit v1.2.3-59-g8ed1b