Skip to content

Commit f5608c1

Browse files
committed
crypto: atmel-aes: Add XTS input length constraint
Input length smaller than block size does not make sense for XTS. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
1 parent 47294fd commit f5608c1

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/crypto/atmel-aes.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,9 @@ static int atmel_aes_crypt(struct skcipher_request *req, unsigned long mode)
10911091
struct atmel_aes_dev *dd;
10921092
u32 opmode = mode & AES_FLAGS_OPMODE_MASK;
10931093

1094+
if (opmode == AES_FLAGS_XTS && req->cryptlen < XTS_BLOCK_SIZE)
1095+
return -EINVAL;
1096+
10941097
if ((opmode == AES_FLAGS_ECB || opmode == AES_FLAGS_CBC) &&
10951098
!IS_ALIGNED(req->cryptlen, crypto_skcipher_blocksize(skcipher)))
10961099
return -EINVAL;

0 commit comments

Comments
 (0)