diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2009-06-19 07:46:53 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2009-06-19 07:46:53 -0400 |
commit | a873a5f1c4eda125f506c059a4f8ea48b9f42eff (patch) | |
tree | ee1410f5d24ee86ce4c6f32d723699799c024426 | |
parent | 03b56ce54143a3a69d4fea6ff8130b1c903a47ce (diff) |
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>
-rw-r--r-- | crypto/tcrypt.c | 15 |
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 @@ | |||
45 | */ | 45 | */ |
46 | static unsigned int sec; | 46 | static unsigned int sec; |
47 | 47 | ||
48 | static char *alg = NULL; | ||
49 | static u32 type; | ||
48 | static int mode; | 50 | static int mode; |
49 | static char *tvmem[TVMEMSIZE]; | 51 | static char *tvmem[TVMEMSIZE]; |
50 | 52 | ||
@@ -885,6 +887,11 @@ static int do_test(int m) | |||
885 | return ret; | 887 | return ret; |
886 | } | 888 | } |
887 | 889 | ||
890 | static int do_alg_test(const char *alg, u32 type) | ||
891 | { | ||
892 | return crypto_has_alg(alg, type, CRYPTO_ALG_TYPE_MASK); | ||
893 | } | ||
894 | |||
888 | static int __init tcrypt_mod_init(void) | 895 | static int __init tcrypt_mod_init(void) |
889 | { | 896 | { |
890 | int err = -ENOMEM; | 897 | int err = -ENOMEM; |
@@ -896,7 +903,11 @@ static int __init tcrypt_mod_init(void) | |||
896 | goto err_free_tv; | 903 | goto err_free_tv; |
897 | } | 904 | } |
898 | 905 | ||
899 | err = do_test(mode); | 906 | if (alg) |
907 | err = do_alg_test(alg, type); | ||
908 | else | ||
909 | err = do_test(mode); | ||
910 | |||
900 | if (err) { | 911 | if (err) { |
901 | printk(KERN_ERR "tcrypt: one or more tests failed!\n"); | 912 | printk(KERN_ERR "tcrypt: one or more tests failed!\n"); |
902 | goto err_free_tv; | 913 | goto err_free_tv; |
@@ -928,6 +939,8 @@ static void __exit tcrypt_mod_fini(void) { } | |||
928 | module_init(tcrypt_mod_init); | 939 | module_init(tcrypt_mod_init); |
929 | module_exit(tcrypt_mod_fini); | 940 | module_exit(tcrypt_mod_fini); |
930 | 941 | ||
942 | module_param(alg, charp, 0); | ||
943 | module_param(type, uint, 0); | ||
931 | module_param(mode, int, 0); | 944 | module_param(mode, int, 0); |
932 | module_param(sec, uint, 0); | 945 | module_param(sec, uint, 0); |
933 | MODULE_PARM_DESC(sec, "Length in seconds of speed tests " | 946 | MODULE_PARM_DESC(sec, "Length in seconds of speed tests " |