From: Jia Jie Ho <jiajie.ho@starfivetech.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
"David S . Miller" <davem@davemloft.net>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>,
Vinod Koul <vkoul@kernel.org>,
linux-crypto@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org
Subject: [PATCH v4 3/7] crypto: starfive: Skip unneeded key free
Date: Tue, 5 Mar 2024 15:10:02 +0800 [thread overview]
Message-ID: <20240305071006.2181158-4-jiajie.ho@starfivetech.com> (raw)
In-Reply-To: <20240305071006.2181158-1-jiajie.ho@starfivetech.com>
Skip unneeded kfree_sensitive if RSA module is using falback algo.
Signed-off-by: Jia Jie Ho <jiajie.ho@starfivetech.com>
---
drivers/crypto/starfive/jh7110-rsa.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/starfive/jh7110-rsa.c b/drivers/crypto/starfive/jh7110-rsa.c
index cf8bda7f0855..e642e948d747 100644
--- a/drivers/crypto/starfive/jh7110-rsa.c
+++ b/drivers/crypto/starfive/jh7110-rsa.c
@@ -45,6 +45,9 @@ static inline int starfive_pka_wait_done(struct starfive_cryp_ctx *ctx)
static void starfive_rsa_free_key(struct starfive_rsa_key *key)
{
+ if (!key->key_sz)
+ return;
+
kfree_sensitive(key->d);
kfree_sensitive(key->e);
kfree_sensitive(key->n);
--
2.34.1
next prev parent reply other threads:[~2024-03-05 7:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 7:09 [PATCH v4 0/7] crypto: starfive: Add support for JH8100 Jia Jie Ho
2024-03-05 7:10 ` [PATCH v4 1/7] dt-bindings: crypto: starfive: Add jh8100 support Jia Jie Ho
2024-03-05 7:10 ` [PATCH v4 2/7] crypto: starfive: Update hash dma usage Jia Jie Ho
2024-03-05 7:10 ` Jia Jie Ho [this message]
2024-03-05 7:10 ` [PATCH v4 4/7] crypto: starfive: Use dma for aes requests Jia Jie Ho
2024-03-05 7:10 ` [PATCH v4 5/7] dmaengine: dw-axi-dmac: Support hardware quirks Jia Jie Ho
2024-05-08 2:12 ` JiaJie Ho
2024-06-11 18:13 ` Vinod Koul
2024-03-05 7:10 ` [PATCH v4 6/7] crypto: starfive: Add sm3 support for JH8100 Jia Jie Ho
2024-03-05 7:10 ` [PATCH v4 7/7] crypto: starfive: Add sm4 " Jia Jie Ho
2024-03-27 1:55 ` [PATCH v4 0/7] crypto: starfive: Add " JiaJie Ho
2024-03-28 10:45 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240305071006.2181158-4-jiajie.ho@starfivetech.com \
--to=jiajie.ho@starfivetech.com \
--cc=Eugeniy.Paltsev@synopsys.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox