mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
crypto: omap-aes - reject invalid input sizes for block modes
Block modes such as ECB and CBC only support input sizes that are a round multiple of the block size, so align with the generic code which returns -EINVAL when encountering inputs that violate this rule. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Tero Kristo <t-kristo@ti.com> Tested-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
6585cd3683
commit
dbb326fd00
@ -525,6 +525,9 @@ static int omap_aes_crypt(struct skcipher_request *req, unsigned long mode)
|
||||
struct omap_aes_dev *dd;
|
||||
int ret;
|
||||
|
||||
if ((req->cryptlen % AES_BLOCK_SIZE) && !(mode & FLAGS_CTR))
|
||||
return -EINVAL;
|
||||
|
||||
pr_debug("nbytes: %d, enc: %d, cbc: %d\n", req->cryptlen,
|
||||
!!(mode & FLAGS_ENCRYPT),
|
||||
!!(mode & FLAGS_CBC));
|
||||
|
Loading…
Reference in New Issue
Block a user