Skip to content

Commit 0013976

Browse files
lylezhu2012kartben
authored andcommitted
Bluetooth: Classic: SMP: Set BT_LINK_KEY_SC only if BT_KEYS_SC is set
The flag `BT_LINK_KEY_SC` of LK will also be set when derive LK from LTK. It is a incorrect behavior. The flag `BT_LINK_KEY_SC` should only be set if the flag `BT_KEYS_SC` of LTK has been set. Signed-off-by: Lyle Zhu <[email protected]>
1 parent 2695d22 commit 0013976

File tree

1 file changed

+5
-1
lines changed
  • subsys/bluetooth/host

1 file changed

+5
-1
lines changed

subsys/bluetooth/host/smp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,11 @@ static void sc_derive_link_key(struct bt_smp *smp)
844844
bt_keys_link_key_clear(link_key);
845845
}
846846

847-
link_key->flags |= BT_LINK_KEY_SC;
847+
if (conn->le.keys->flags & BT_KEYS_SC) {
848+
link_key->flags |= BT_LINK_KEY_SC;
849+
} else {
850+
link_key->flags &= ~BT_LINK_KEY_SC;
851+
}
848852

849853
if (conn->le.keys->flags & BT_KEYS_AUTHENTICATED) {
850854
link_key->flags |= BT_LINK_KEY_AUTHENTICATED;

0 commit comments

Comments
 (0)