summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-07-02 08:32:12 (GMT)
committerHerbert Xu <herbert@gondor.apana.org.au>2009-07-02 08:32:12 (GMT)
commita68f6610d4f1ebe61818f5926fa8fa9e75d06a95 (patch)
tree24c23aafabff2045996ed02fb5eae295f29d5e2a /crypto
parent0b67fb65d1b2ba1396de69112b8b9bc95d8d5feb (diff)
downloadlinux-a68f6610d4f1ebe61818f5926fa8fa9e75d06a95.tar.xz
crypto: testmgr - Allow implementation-specific tests
This patch adds the support for testing specific implementations. This should only be used in very specific situations. Right now this means specific implementations of random number generators. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/testmgr.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index f9bea9d..29b228d 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -2344,6 +2344,7 @@ static int alg_find_test(const char *alg)
int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
{
int i;
+ int j;
int rc;
if ((type & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_CIPHER) {
@@ -2365,14 +2366,22 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
}
i = alg_find_test(alg);
- if (i < 0)
+ j = alg_find_test(driver);
+ if (i < 0 && j < 0)
goto notest;
- if (fips_enabled && !alg_test_descs[i].fips_allowed)
+ if (fips_enabled && ((i >= 0 && !alg_test_descs[i].fips_allowed) ||
+ (j >= 0 && !alg_test_descs[j].fips_allowed)))
goto non_fips_alg;
- rc = alg_test_descs[i].test(alg_test_descs + i, driver,
- type, mask);
+ rc = 0;
+ if (i >= 0)
+ rc |= alg_test_descs[i].test(alg_test_descs + i, driver,
+ type, mask);
+ if (j >= 0)
+ rc |= alg_test_descs[j].test(alg_test_descs + j, driver,
+ type, mask);
+
test_done:
if (fips_enabled && rc)
panic("%s: %s alg self test failed in fips mode!\n", driver, alg);