Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9f84951f authored by Leilei Zhao's avatar Leilei Zhao Committed by Herbert Xu
Browse files

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: default avatarLeilei Zhao <leilei.zhao@atmel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e5d8c961
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -716,6 +716,12 @@ static int atmel_aes_crypt(struct ablkcipher_request *req, unsigned long mode)
			return -EINVAL;
		}
		ctx->block_size = CFB32_BLOCK_SIZE;
	} else if (mode & AES_FLAGS_CFB64) {
		if (!IS_ALIGNED(req->nbytes, CFB64_BLOCK_SIZE)) {
			pr_err("request size is not exact amount of CFB64 blocks\n");
			return -EINVAL;
		}
		ctx->block_size = CFB64_BLOCK_SIZE;
	} else {
		if (!IS_ALIGNED(req->nbytes, AES_BLOCK_SIZE)) {
			pr_err("request size is not exact amount of AES blocks\n");