crypto: talitos - Work around SEC6 ERRATA (AES-CTR mode data size error)
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Wed, 20 Jan 2021 18:57:24 +0000 (18:57 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 10:37:45 +0000 (11:37 +0100)
commit62aa24d2b7be2839141e0b7d6b18a3e0ee0cacf8
tree6497608960e8b45fd26456bc431d4db86929b07d
parentda7a5e73cdd1210bb085e7dab9ce985fb2ddc64f
crypto: talitos - Work around SEC6 ERRATA (AES-CTR mode data size error)

[ Upstream commit 416b846757bcea20006a9197e67ba3a8b5b2a680 ]

Talitos Security Engine AESU considers any input
data size that is not a multiple of 16 bytes to be an error.
This is not a problem in general, except for Counter mode
that is a stream cipher and can have an input of any size.

Test Manager for ctr(aes) fails on 4th test vector which has
a length of 499 while all previous vectors which have a 16 bytes
multiple length succeed.

As suggested by Freescale, round up the input data length to the
nearest 16 bytes.

Fixes: 5e75ae1b3cef ("crypto: talitos - add new crypto modes")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/talitos.c
drivers/crypto/talitos.h