diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2009-07-14 04:06:54 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2009-07-14 04:06:54 -0400 |
commit | 7be380f7201064f704a128b78ac01a62dbd10162 (patch) | |
tree | 6a70a91767a0c98806e45d6baca66bc2ca7899c5 | |
parent | 01c2dece4316dadc0f9fad1ad0b56d493980e492 (diff) |
crypto: tcrypt - Add mask parameter
This patch adds a mask parameter to complement the existing type
parameter. This is useful when instantiating algorithms that
require a mask other than the default, e.g., ahash algorithms.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/tcrypt.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index a890a6792c7b..5a375e819d5d 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -47,6 +47,7 @@ static unsigned int sec; | |||
47 | 47 | ||
48 | static char *alg = NULL; | 48 | static char *alg = NULL; |
49 | static u32 type; | 49 | static u32 type; |
50 | static u32 mask; | ||
50 | static int mode; | 51 | static int mode; |
51 | static char *tvmem[TVMEMSIZE]; | 52 | static char *tvmem[TVMEMSIZE]; |
52 | 53 | ||
@@ -887,9 +888,10 @@ static int do_test(int m) | |||
887 | return ret; | 888 | return ret; |
888 | } | 889 | } |
889 | 890 | ||
890 | static int do_alg_test(const char *alg, u32 type) | 891 | static int do_alg_test(const char *alg, u32 type, u32 mask) |
891 | { | 892 | { |
892 | return crypto_has_alg(alg, type, CRYPTO_ALG_TYPE_MASK) ? 0 : -ENOENT; | 893 | return crypto_has_alg(alg, type, mask ?: CRYPTO_ALG_TYPE_MASK) ? |
894 | 0 : -ENOENT; | ||
893 | } | 895 | } |
894 | 896 | ||
895 | static int __init tcrypt_mod_init(void) | 897 | static int __init tcrypt_mod_init(void) |
@@ -904,7 +906,7 @@ static int __init tcrypt_mod_init(void) | |||
904 | } | 906 | } |
905 | 907 | ||
906 | if (alg) | 908 | if (alg) |
907 | err = do_alg_test(alg, type); | 909 | err = do_alg_test(alg, type, mask); |
908 | else | 910 | else |
909 | err = do_test(mode); | 911 | err = do_test(mode); |
910 | 912 | ||
@@ -941,6 +943,7 @@ module_exit(tcrypt_mod_fini); | |||
941 | 943 | ||
942 | module_param(alg, charp, 0); | 944 | module_param(alg, charp, 0); |
943 | module_param(type, uint, 0); | 945 | module_param(type, uint, 0); |
946 | module_param(mask, uint, 0); | ||
944 | module_param(mode, int, 0); | 947 | module_param(mode, int, 0); |
945 | module_param(sec, uint, 0); | 948 | module_param(sec, uint, 0); |
946 | MODULE_PARM_DESC(sec, "Length in seconds of speed tests " | 949 | MODULE_PARM_DESC(sec, "Length in seconds of speed tests " |