crypto: starfive - Skip dma setup for zeroed message
authorJia Jie Ho <jiajie.ho@starfivetech.com>
Mon, 29 Apr 2024 06:06:37 +0000 (14:06 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 10 May 2024 09:15:24 +0000 (17:15 +0800)
Skip dma setup and mapping for AES driver if plaintext is empty.

Signed-off-by: Jia Jie Ho <jiajie.ho@starfivetech.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/starfive/jh7110-aes.c

index 72b7d46150d57cd9a8bf68d140413cd2b49fb09e..9d6e2f936f03939f250d8c9ecb7ef2569ba3ea9b 100644 (file)
@@ -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;