diff options
author | Leilei Zhao <leilei.zhao@atmel.com> | 2014-04-22 03:23:24 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-04-28 06:21:19 -0400 |
commit | 9f84951fc6f30eff20567632131c38725705753d (patch) | |
tree | d49ac2c03a1adaf10592a4c31120633b5df5053e /drivers/crypto | |
parent | e5d8c961c52f6324fa15f9f7c1b76f409e759b96 (diff) |
crypto: atmel-aes - check alignment of cfb64 mode
The length shoule be 64 bit alignment and the block size shoule be 64 bit in aes cfb64 mode.
Signed-off-by: Leilei Zhao <leilei.zhao@atmel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/atmel-aes.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c index 12628a75fbcc..a083474991ab 100644 --- a/drivers/crypto/atmel-aes.c +++ b/drivers/crypto/atmel-aes.c | |||
@@ -716,6 +716,12 @@ static int atmel_aes_crypt(struct ablkcipher_request *req, unsigned long mode) | |||
716 | return -EINVAL; | 716 | return -EINVAL; |
717 | } | 717 | } |
718 | ctx->block_size = CFB32_BLOCK_SIZE; | 718 | ctx->block_size = CFB32_BLOCK_SIZE; |
719 | } else if (mode & AES_FLAGS_CFB64) { | ||
720 | if (!IS_ALIGNED(req->nbytes, CFB64_BLOCK_SIZE)) { | ||
721 | pr_err("request size is not exact amount of CFB64 blocks\n"); | ||
722 | return -EINVAL; | ||
723 | } | ||
724 | ctx->block_size = CFB64_BLOCK_SIZE; | ||
719 | } else { | 725 | } else { |
720 | if (!IS_ALIGNED(req->nbytes, AES_BLOCK_SIZE)) { | 726 | if (!IS_ALIGNED(req->nbytes, AES_BLOCK_SIZE)) { |
721 | pr_err("request size is not exact amount of AES blocks\n"); | 727 | pr_err("request size is not exact amount of AES blocks\n"); |