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 <lyle.zhu@nxp.com>
This commit is contained in:
Lyle Zhu 2025-03-27 14:54:15 +08:00 committed by Benjamin Cabé
commit 001397653b

View file

@ -844,7 +844,11 @@ static void sc_derive_link_key(struct bt_smp *smp)
bt_keys_link_key_clear(link_key);
}
link_key->flags |= BT_LINK_KEY_SC;
if (conn->le.keys->flags & BT_KEYS_SC) {
link_key->flags |= BT_LINK_KEY_SC;
} else {
link_key->flags &= ~BT_LINK_KEY_SC;
}
if (conn->le.keys->flags & BT_KEYS_AUTHENTICATED) {
link_key->flags |= BT_LINK_KEY_AUTHENTICATED;