diff mbox series

[v2,01/14] crypto: sahara - handle zero-length aes requests

Message ID 20231224082144.3894863-2-ovidiu.panait@windriver.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series crypto: sahara - bugfixes and small improvements | expand

Commit Message

Ovidiu Panait Dec. 24, 2023, 8:21 a.m. UTC
From: Ovidiu Panait <ovidiu.panait@windriver.com>

In case of a zero-length input, exit gracefully from sahara_aes_crypt().

Fixes: 5de8875281e1 ("crypto: sahara - Add driver for SAHARA2 accelerator.")
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
---
 drivers/crypto/sahara.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index 27ed66cb761f..1f78dfe84c51 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -674,6 +674,9 @@  static int sahara_aes_crypt(struct skcipher_request *req, unsigned long mode)
 	struct sahara_dev *dev = dev_ptr;
 	int err = 0;
 
+	if (!req->cryptlen)
+		return 0;
+
 	if (unlikely(ctx->keylen != AES_KEYSIZE_128))
 		return sahara_aes_fallback(req, mode);