mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: SMP: Zeroize raw key data on the stack in smp_e()
@ 2026-09-10 12:32 Thomas Huth
  2026-09-10 20:50 ` patchwork-bot+bluetooth
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2026-09-10 12:32 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz; +Cc: linux-bluetooth, linux-kernel

smp_e() already clears the AES key in its "struct aes_enckey aes"
on the stack before leaving the function - but the very same
information is also available as raw key data in the tmp[] array,
so this should get cleared, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 net/bluetooth/smp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 6091c47cb0028..637bf134dfbd9 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -366,7 +366,7 @@ static int smp_e(const u8 *k, u8 *r)
 	err = aes_prepareenckey(&aes, tmp, 16);
 	if (err) {
 		BT_ERR("cipher setkey failed: %d", err);
-		return err;
+		goto out_clear;
 	}
 
 	/* Most significant octet of plaintextData corresponds to data[0] */
@@ -379,6 +379,8 @@ static int smp_e(const u8 *k, u8 *r)
 
 	SMP_DBG("r %16phN", r);
 
+out_clear:
+	memzero_explicit(tmp, sizeof(tmp));
 	memzero_explicit(&aes, sizeof(aes));
 	return err;
 }
-- 
2.55.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Bluetooth: SMP: Zeroize raw key data on the stack in smp_e()
  2026-09-10 12:32 [PATCH] Bluetooth: SMP: Zeroize raw key data on the stack in smp_e() Thomas Huth
@ 2026-09-10 20:50 ` patchwork-bot+bluetooth
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2026-09-10 20:50 UTC (permalink / raw)
  To: Thomas Huth; +Cc: marcel, luiz.dentz, linux-bluetooth, linux-kernel

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu, 10 Sep 2026 14:32:54 +0200 you wrote:
> smp_e() already clears the AES key in its "struct aes_enckey aes"
> on the stack before leaving the function - but the very same
> information is also available as raw key data in the tmp[] array,
> so this should get cleared, too.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> 
> [...]

Here is the summary with links:
  - Bluetooth: SMP: Zeroize raw key data on the stack in smp_e()
    https://git.kernel.org/bluetooth/bluetooth-next/c/e40edfa049b9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-10 20:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10 12:32 [PATCH] Bluetooth: SMP: Zeroize raw key data on the stack in smp_e() Thomas Huth
2026-09-10 20:50 ` patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®