diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2006-08-13 00:16:39 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2006-09-20 21:41:02 -0400 |
commit | 560c06ae1ab7c677002ea3b6ac83521bf12ee07d (patch) | |
tree | 374ed69a7e23ba9d07458d20672aac6ae552ae51 /crypto/crc32c.c | |
parent | 25cdbcd9e5d20e431f829cafce48a418830011f4 (diff) |
[CRYPTO] api: Get rid of flags argument to setkey
Now that the tfm is passed directly to setkey instead of the ctx, we no
longer need to pass the &tfm->crt_flags pointer.
This patch also gets rid of a few unnecessary checks on the key length
for ciphers as the cipher layer guarantees that the key length is within
the bounds specified by the algorithm.
Rather than testing dia_setkey every time, this patch does it only once
during crypto_alloc_tfm. The redundant check from crypto_digest_setkey
is also removed.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/crc32c.c')
-rw-r--r-- | crypto/crc32c.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crypto/crc32c.c b/crypto/crc32c.c index 91ecd895e957..0fa744392a4c 100644 --- a/crypto/crc32c.c +++ b/crypto/crc32c.c | |||
@@ -44,13 +44,12 @@ static void chksum_init(struct crypto_tfm *tfm) | |||
44 | * the seed. | 44 | * the seed. |
45 | */ | 45 | */ |
46 | static int chksum_setkey(struct crypto_tfm *tfm, const u8 *key, | 46 | static int chksum_setkey(struct crypto_tfm *tfm, const u8 *key, |
47 | unsigned int keylen, u32 *flags) | 47 | unsigned int keylen) |
48 | { | 48 | { |
49 | struct chksum_ctx *mctx = crypto_tfm_ctx(tfm); | 49 | struct chksum_ctx *mctx = crypto_tfm_ctx(tfm); |
50 | 50 | ||
51 | if (keylen != sizeof(mctx->crc)) { | 51 | if (keylen != sizeof(mctx->crc)) { |
52 | if (flags) | 52 | tfm->crt_flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; |
53 | *flags = CRYPTO_TFM_RES_BAD_KEY_LEN; | ||
54 | return -EINVAL; | 53 | return -EINVAL; |
55 | } | 54 | } |
56 | mctx->key = le32_to_cpu(*(__le32 *)key); | 55 | mctx->key = le32_to_cpu(*(__le32 *)key); |