2007-12-17 10:31:15

by Herbert Xu

[permalink] [raw]
Subject: [PATCH 1/8] [CRYPTO] ccm: Fix construction of rfc4309 algorithm

[CRYPTO] ccm: Fix construction of rfc4309 algorithm

There is a silly typo in the rfc4309 construction that refers to a
blkcipher when it should be aead. This broke the allocation of rfc4309
algorithms.

This patch fixes that and removes a duplicate type checking at the
start of that same function.

Signed-off-by: Herbert Xu <[email protected]>
---

crypto/ccm.c | 6 +-----
1 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/crypto/ccm.c b/crypto/ccm.c
index 7ca2519..8c7d3b7 100644
--- a/crypto/ccm.c
+++ b/crypto/ccm.c
@@ -728,10 +728,6 @@ static struct crypto_instance *crypto_rfc4309_alloc(struct rtattr **tb)
if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask)
return ERR_PTR(-EINVAL);

- err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_AEAD);
- if (err)
- return ERR_PTR(err);
-
ccm_name = crypto_attr_alg_name(tb[1]);
err = PTR_ERR(ccm_name);
if (IS_ERR(ccm_name))
@@ -753,7 +749,7 @@ static struct crypto_instance *crypto_rfc4309_alloc(struct rtattr **tb)
err = -EINVAL;

/* We only support 16-byte blocks. */
- if (alg->cra_blkcipher.ivsize != 16)
+ if (alg->cra_aead.ivsize != 16)
goto out_drop_alg;

/* Not a stream cipher? */