diff mbox series

[-next,1/4] crypto: starfive - Skip dma setup for zeroed message

Message ID 20240429060640.2451685-2-jiajie.ho@starfivetech.com
State Accepted
Commit 3d12d90efadf689b05280ebbb3fca870298d218f
Headers show
Series crypto: starfive - Minor fixes for AES and RSA | expand

Commit Message

Jia Jie Ho April 29, 2024, 6:06 a.m. UTC
Skip dma setup and mapping for AES driver if plaintext is empty.

Signed-off-by: Jia Jie Ho <jiajie.ho@starfivetech.com>
---
 drivers/crypto/starfive/jh7110-aes.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/crypto/starfive/jh7110-aes.c b/drivers/crypto/starfive/jh7110-aes.c
index 72b7d46150d5..9d6e2f936f03 100644
--- a/drivers/crypto/starfive/jh7110-aes.c
+++ b/drivers/crypto/starfive/jh7110-aes.c
@@ -590,12 +590,16 @@  static int starfive_aes_do_one_req(struct crypto_engine *engine, void *areq)
 	if (ret)
 		return ret;
 
+	if (!cryp->total_in)
+		goto finish_req;
+
 	starfive_aes_dma_init(cryp);
 
 	ret = starfive_aes_map_sg(cryp, rctx->in_sg, rctx->out_sg);
 	if (ret)
 		return ret;
 
+finish_req:
 	starfive_aes_finish_req(ctx);
 
 	return 0;