summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJia Jie Ho <jiajie.ho@starfivetech.com>2024-03-05 10:10:02 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2024-04-02 05:49:38 +0300
commita05c821e42e6b6fd265270a6b6b9413fee1d4221 (patch)
tree04545a0b8cd145a7ef671c9e67aba392059ee253
parentb6e9eb69a19562cd8d8b09f76593884e4c69ffc7 (diff)
downloadlinux-a05c821e42e6b6fd265270a6b6b9413fee1d4221.tar.xz
crypto: starfive - Skip unneeded key free
Skip unneeded kfree_sensitive if RSA module is using falback algo. Signed-off-by: Jia Jie Ho <jiajie.ho@starfivetech.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/starfive/jh7110-rsa.c3
1 files changed, 3 insertions, 0 deletions
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);