aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.c
diff options
context:
space:
mode:
authorJarod Wilson <jarod@redhat.com>2009-05-15 01:17:05 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2009-06-02 00:04:49 -0400
commita3bef3a31a19bd943047ba8bf5b2cc7b5d164362 (patch)
treef6eff2b5a4053713ebe9f7812f351a938c2a880f /crypto/testmgr.c
parenta1915d51e8e7ee192d2101d621d425379088cbb0 (diff)
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/testmgr.c')
-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)
2308 if (i < 0) 2308 if (i < 0)
2309 goto notest; 2309 goto notest;
2310 2310
2311 if (fips_enabled && !alg_test_descs[i].fips_allowed)
2312 goto non_fips_alg;
2313
2311 rc = alg_test_cipher(alg_test_descs + i, driver, type, mask); 2314 rc = alg_test_cipher(alg_test_descs + i, driver, type, mask);
2312 goto test_done; 2315 goto test_done;
2313 } 2316 }
@@ -2316,6 +2319,9 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
2316 if (i < 0) 2319 if (i < 0)
2317 goto notest; 2320 goto notest;
2318 2321
2322 if (fips_enabled && !alg_test_descs[i].fips_allowed)
2323 goto non_fips_alg;
2324
2319 rc = alg_test_descs[i].test(alg_test_descs + i, driver, 2325 rc = alg_test_descs[i].test(alg_test_descs + i, driver,
2320 type, mask); 2326 type, mask);
2321test_done: 2327test_done:
@@ -2331,5 +2337,7 @@ test_done:
2331notest: 2337notest:
2332 printk(KERN_INFO "alg: No test for %s (%s)\n", alg, driver); 2338 printk(KERN_INFO "alg: No test for %s (%s)\n", alg, driver);
2333 return 0; 2339 return 0;
2340non_fips_alg:
2341 return -EINVAL;
2334} 2342}
2335EXPORT_SYMBOL_GPL(alg_test); 2343EXPORT_SYMBOL_GPL(alg_test);