Messages in this thread Patch in this message | | | From | Andrei Botila <> | Subject | [PATCH 19/22] crypto: inside-secure - add check for xts input length equal to zero | Date | Fri, 7 Aug 2020 19:20:07 +0300 |
| |
From: Andrei Botila <andrei.botila@nxp.com>
Standardize the way input lengths equal to 0 are handled in all skcipher algorithms. All the algorithms return 0 for input lengths equal to zero.
Cc: Antoine Tenart <antoine.tenart@bootlin.com> Signed-off-by: Andrei Botila <andrei.botila@nxp.com> --- drivers/crypto/inside-secure/safexcel_cipher.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/drivers/crypto/inside-secure/safexcel_cipher.c b/drivers/crypto/inside-secure/safexcel_cipher.c index 1ac3253b7903..03d06556ea98 100644 --- a/drivers/crypto/inside-secure/safexcel_cipher.c +++ b/drivers/crypto/inside-secure/safexcel_cipher.c @@ -2533,6 +2533,9 @@ static int safexcel_skcipher_aes_xts_cra_init(struct crypto_tfm *tfm) static int safexcel_encrypt_xts(struct skcipher_request *req) { + if (!req->cryptlen) + return 0; + if (req->cryptlen < XTS_BLOCK_SIZE) return -EINVAL; return safexcel_queue_req(&req->base, skcipher_request_ctx(req), @@ -2541,6 +2544,9 @@ static int safexcel_encrypt_xts(struct skcipher_request *req) static int safexcel_decrypt_xts(struct skcipher_request *req) { + if (!req->cryptlen) + return 0; + if (req->cryptlen < XTS_BLOCK_SIZE) return -EINVAL; return safexcel_queue_req(&req->base, skcipher_request_ctx(req), -- 2.17.1
| |