diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2009-07-11 16:17:39 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2009-07-12 04:46:02 +0200 |
commit | 57cfe44bccb0e38ddb44a34a42f517deef1f4e82 (patch) | |
tree | 76407ea6aa11d7441aa4bb6811eb6e398554f041 /crypto | |
parent | crypto: padlock - Use shash fallback for sha (diff) | |
download | linux-57cfe44bccb0e38ddb44a34a42f517deef1f4e82.tar.xz linux-57cfe44bccb0e38ddb44a34a42f517deef1f4e82.zip |
crypto: shash - Move null setkey check to registration time
This patch moves the run-time null setkey check to shash_prepare_alg
just like we did for finup/digest.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/shash.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/shash.c b/crypto/shash.c index f7fcc652ff32..131e14d2b572 100644 --- a/crypto/shash.c +++ b/crypto/shash.c @@ -22,6 +22,12 @@ static const struct crypto_type crypto_shash_type; +static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, + unsigned int keylen) +{ + return -ENOSYS; +} + static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) { @@ -50,9 +56,6 @@ int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key, struct shash_alg *shash = crypto_shash_alg(tfm); unsigned long alignmask = crypto_shash_alignmask(tfm); - if (!shash->setkey) - return -ENOSYS; - if ((unsigned long)key & alignmask) return shash_setkey_unaligned(tfm, key, keylen); @@ -494,6 +497,8 @@ static int shash_prepare_alg(struct shash_alg *alg) alg->import = shash_no_import; if (!alg->export) alg->export = shash_no_export; + if (!alg->setkey) + alg->setkey = shash_no_setkey; return 0; } |