Skip to content

Commit 69d415c

Browse files
lylezhu2012kartben
authored andcommitted
Bluetooth: SSP: Improve BR SC only mode
Actively disconnect the connection with error code `BT_HCI_ERR_AUTH_FAIL` when the notified link key type is not `BT_LK_AUTH_COMBINATION_P256` in BR SC only mode. Signed-off-by: Lyle Zhu <[email protected]>
1 parent bc086f5 commit 69d415c

File tree

1 file changed

+17
-0
lines changed
  • subsys/bluetooth/host/classic

1 file changed

+17
-0
lines changed

subsys/bluetooth/host/classic/ssp.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,23 @@ void bt_hci_link_key_notify(struct net_buf *buf)
447447

448448
LOG_DBG("%s, link type 0x%02x", bt_addr_str(&evt->bdaddr), evt->key_type);
449449

450+
if (IS_ENABLED(CONFIG_BT_SMP_SC_ONLY) && (evt->key_type != BT_LK_AUTH_COMBINATION_P256)) {
451+
/*
452+
* When in Secure Connections Only mode, all services
453+
* (except those allowed to have Security Mode 4, Level 0)
454+
* available on the BR/EDR physical transport require Security
455+
* Mode 4, Level 4.
456+
* Link key type should be P-256 based Secure Simple Pairing
457+
* and Secure Authentication.
458+
*/
459+
LOG_WRN("For SC only mode, link key type should be %d",
460+
BT_LK_AUTH_COMBINATION_P256);
461+
ssp_pairing_complete(conn, bt_security_err_get(BT_HCI_ERR_AUTH_FAIL));
462+
bt_conn_disconnect(conn, BT_HCI_ERR_AUTH_FAIL);
463+
bt_conn_unref(conn);
464+
return;
465+
}
466+
450467
if (!conn->br.link_key) {
451468
conn->br.link_key = bt_keys_get_link_key(&evt->bdaddr);
452469
}

0 commit comments

Comments
 (0)