public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: Corentin Labbe <clabbe.montjoie@gmail•com>
To: davem@davemloft•net, herbert@gondor•apana.org.au,
	mripard@kernel•org, wens@csie•org
Cc: linux-kernel@vger•kernel.org, stable@vger•kernel.org,
	linux-sunxi@googlegroups•com,
	Corentin Labbe <clabbe.montjoie@gmail•com>,
	linux-crypto@vger•kernel.org,
	linux-arm-kernel@lists•infradead.org
Subject: [PATCH] crypto: sun4i-ss: erase key after use
Date: Sun, 15 Sep 2019 20:35:36 +0200	[thread overview]
Message-ID: <20190915183536.3835-1-clabbe.montjoie@gmail.com> (raw)

When a TFM is unregistered, the sun4i-ss driver does not clean the key used,
leaking it in memory.
This patch adds this absent key cleaning.

Fixes: 6298e948215f ("crypto: sunxi-ss - Add Allwinner Security System crypto accelerator")
Cc: <stable@vger•kernel.org> # 4.3+
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail•com>
---
 drivers/crypto/sunxi-ss/sun4i-ss-cipher.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
index fa4b1b47822e..60d99370a4ec 100644
--- a/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
+++ b/drivers/crypto/sunxi-ss/sun4i-ss-cipher.c
@@ -503,6 +503,8 @@ int sun4i_ss_cipher_init(struct crypto_tfm *tfm)
 void sun4i_ss_cipher_exit(struct crypto_tfm *tfm)
 {
 	struct sun4i_tfm_ctx *op = crypto_tfm_ctx(tfm);
+
+	memzero_explicit(op->key, op->keylen);
 	crypto_free_sync_skcipher(op->fallback_tfm);
 }
 
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2019-09-15 18:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-15 18:35 Corentin Labbe [this message]
2019-09-15 20:16 ` [PATCH] crypto: sun4i-ss: erase key after use Eric Biggers
2019-09-16  8:30 ` Sasha Levin

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=20190915183536.3835-1-clabbe.montjoie@gmail.com \
    --to=clabbe.montjoie@gmail$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=herbert@gondor$(echo .)apana.org.au \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-crypto@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-sunxi@googlegroups$(echo .)com \
    --cc=mripard@kernel$(echo .)org \
    --cc=stable@vger$(echo .)kernel.org \
    --cc=wens@csie$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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