mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
Bluetooth: SMP: Zeroize raw key data on the stack in smp_e()
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> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
00b201656d
commit
c930a69fec
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user