summaryrefslogtreecommitdiffstats
path: root/crypto/tcrypt.c
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2009-06-19 13:46:53 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2009-06-19 13:46:53 +0200
commita873a5f1c4eda125f506c059a4f8ea48b9f42eff (patch)
treeee1410f5d24ee86ce4c6f32d723699799c024426 /crypto/tcrypt.c
parentcrypto: des_s390 - Permit weak keys unless REQ_WEAK_KEY set (diff)
downloadlinux-a873a5f1c4eda125f506c059a4f8ea48b9f42eff.tar.xz
linux-a873a5f1c4eda125f506c059a4f8ea48b9f42eff.zip
crypto: tcrypt - Test algorithms by name
This adds the 'alg' module parameter to be able to test an algorithm by name. If the algorithm type is not ad-hoc clear for a algorithm (e.g. pcrypt, cryptd) it is possilbe to set the algorithm type with the 'type' module parameter. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--crypto/tcrypt.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index d59ba5079d14..dfeec0c544cb 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -45,6 +45,8 @@
*/
static unsigned int sec;
+static char *alg = NULL;
+static u32 type;
static int mode;
static char *tvmem[TVMEMSIZE];
@@ -885,6 +887,11 @@ static int do_test(int m)
return ret;
}
+static int do_alg_test(const char *alg, u32 type)
+{
+ return crypto_has_alg(alg, type, CRYPTO_ALG_TYPE_MASK);
+}
+
static int __init tcrypt_mod_init(void)
{
int err = -ENOMEM;
@@ -896,7 +903,11 @@ static int __init tcrypt_mod_init(void)
goto err_free_tv;
}
- err = do_test(mode);
+ if (alg)
+ err = do_alg_test(alg, type);
+ else
+ err = do_test(mode);
+
if (err) {
printk(KERN_ERR "tcrypt: one or more tests failed!\n");
goto err_free_tv;
@@ -928,6 +939,8 @@ static void __exit tcrypt_mod_fini(void) { }
module_init(tcrypt_mod_init);
module_exit(tcrypt_mod_fini);
+module_param(alg, charp, 0);
+module_param(type, uint, 0);
module_param(mode, int, 0);
module_param(sec, uint, 0);
MODULE_PARM_DESC(sec, "Length in seconds of speed tests "