summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorJarod Wilson <jarod@redhat.com>2009-05-15 09:17:05 +0400
committerHerbert Xu <herbert@gondor.apana.org.au>2009-06-02 08:04:49 +0400
commita3bef3a31a19bd943047ba8bf5b2cc7b5d164362 (patch)
treef6eff2b5a4053713ebe9f7812f351a938c2a880f /crypto
parenta1915d51e8e7ee192d2101d621d425379088cbb0 (diff)
downloadlinux-a3bef3a31a19bd943047ba8bf5b2cc7b5d164362.tar.xz
crypto: testmgr - Skip algs not flagged fips_allowed in fips mode
Because all fips-allowed algorithms must be self-tested before they can be used, they will all have entries in testmgr.c's alg_test_descs[]. Skip self-tests for any algs not flagged as fips_approved and return -EINVAL when in fips mode. Signed-off-by: Jarod Wilson <jarod@redhat.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/testmgr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 51bae62c332a..f93b26d0fcfb 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2308,6 +2308,9 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
if (i < 0)
goto notest;
+ if (fips_enabled && !alg_test_descs[i].fips_allowed)
+ goto non_fips_alg;
+
rc = alg_test_cipher(alg_test_descs + i, driver, type, mask);
goto test_done;
}
@@ -2316,6 +2319,9 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
if (i < 0)
goto notest;
+ if (fips_enabled && !alg_test_descs[i].fips_allowed)
+ goto non_fips_alg;
+
rc = alg_test_descs[i].test(alg_test_descs + i, driver,
type, mask);
test_done:
@@ -2331,5 +2337,7 @@ test_done:
notest:
printk(KERN_INFO "alg: No test for %s (%s)\n", alg, driver);
return 0;
+non_fips_alg:
+ return -EINVAL;
}
EXPORT_SYMBOL_GPL(alg_test);