From 2ac116ea7185763f17f5af2fea92f33c3c87f415 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Tue, 11 Mar 2025 11:42:46 +0800 Subject: [PATCH] Bluetooth: SMP_BR: Derive LTK after LK refreshed When the link key of BR is upgraded, the encrypt key refresh event will be notified. The link key is upgraded from weak to strong. The LTK of LE should be derived from strong link key. Start SMP pairing procedure to try to derive LTK from LK. Signed-off-by: Lyle Zhu --- subsys/bluetooth/host/hci_core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 713b6145ac6..1e4dd743c8d 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -2272,6 +2272,17 @@ static void hci_encrypt_key_refresh_complete(struct net_buf *buf) bt_conn_unref(conn); return; } + + if (IS_ENABLED(CONFIG_BT_SMP)) { + /* + * Start SMP over BR/EDR if we are pairing and are + * central on the link + */ + if (atomic_test_bit(conn->flags, BT_CONN_BR_PAIRED) && + conn->role == BT_CONN_ROLE_CENTRAL) { + bt_smp_br_send_pairing_req(conn); + } + } } #endif /* CONFIG_BT_CLASSIC */