Skip to content

Commit

Permalink
Bluetooth: GAP: SMP: check sc feature before pairing request
Browse files Browse the repository at this point in the history
bug: v/54624

Secure authentication shall be performed when both
devices support the Secure Connections (Controller
Support) and Secure Connections (Host Support)
features.

Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
  • Loading branch information
Frozen935 committed Feb 26, 2025
1 parent 2a85c9b commit 3989d68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/zephyr/bluetooth/hci_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ struct bt_hci_cmd_hdr {
#define BT_FEAT_LE(feat) BT_FEAT_TEST(feat, 0, 4, 6)
#define BT_FEAT_EXT_FEATURES(feat) BT_FEAT_TEST(feat, 0, 7, 7)
#define BT_FEAT_HOST_SSP(feat) BT_FEAT_TEST(feat, 1, 0, 0)
#define BT_FEAT_HOST_SC(feat) BT_FEAT_TEST(feat, 1, 0, 3)
#define BT_FEAT_SC(feat) BT_FEAT_TEST(feat, 2, 1, 0)

#define BT_FEAT_LMP_SCO_CAPABLE(feat) BT_FEAT_TEST(feat, 0, 1, 3)
Expand Down
4 changes: 3 additions & 1 deletion subsys/bluetooth/host/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2235,7 +2235,9 @@ static void hci_encrypt_change(struct net_buf *buf)
* central on the link
*/
if (atomic_test_bit(conn->flags, BT_CONN_BR_PAIRED) &&
conn->role == BT_CONN_ROLE_CENTRAL) {
conn->role == BT_CONN_ROLE_CENTRAL &&
BT_FEAT_HOST_SC(conn->br.features) &&
BT_FEAT_SC(bt_dev.features)) {
bt_smp_br_send_pairing_req(conn);
}
}
Expand Down

0 comments on commit 3989d68

Please sign in to comment.