Skip to content

Commit

Permalink
crypto: tcrypt - Add mask parameter
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
herbertx committed Jul 14, 2009
1 parent 01c2dec commit 7be380f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crypto/tcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ static unsigned int sec;

static char *alg = NULL;
static u32 type;
static u32 mask;
static int mode;
static char *tvmem[TVMEMSIZE];

Expand Down Expand Up @@ -887,9 +888,10 @@ static int do_test(int m)
return ret;
}

static int do_alg_test(const char *alg, u32 type)
static int do_alg_test(const char *alg, u32 type, u32 mask)
{
return crypto_has_alg(alg, type, CRYPTO_ALG_TYPE_MASK) ? 0 : -ENOENT;
return crypto_has_alg(alg, type, mask ?: CRYPTO_ALG_TYPE_MASK) ?
0 : -ENOENT;
}

static int __init tcrypt_mod_init(void)
Expand All @@ -904,7 +906,7 @@ static int __init tcrypt_mod_init(void)
}

if (alg)
err = do_alg_test(alg, type);
err = do_alg_test(alg, type, mask);
else
err = do_test(mode);

Expand Down Expand Up @@ -941,6 +943,7 @@ module_exit(tcrypt_mod_fini);

module_param(alg, charp, 0);
module_param(type, uint, 0);
module_param(mask, uint, 0);
module_param(mode, int, 0);
module_param(sec, uint, 0);
MODULE_PARM_DESC(sec, "Length in seconds of speed tests "
Expand Down

0 comments on commit 7be380f

Please sign in to comment.