Skip to content

Commit 40b10cc

Browse files
lylezhu2012kartben
authored andcommitted
Bluetooth: Classic: SSP: Only set MITM when sec level is more than 2
The local device shall only set the MITM protection required flag if the local device itself requires MITM protection. Only set MITM flag when the required security level is more than 2 and pairing method is not `JUST_WORKS`. Signed-off-by: Lyle Zhu <[email protected]>
1 parent 1e0af58 commit 40b10cc

File tree

1 file changed

+5
-13
lines changed
  • subsys/bluetooth/host/classic

1 file changed

+5
-13
lines changed

subsys/bluetooth/host/classic/ssp.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,23 +163,15 @@ static uint8_t ssp_pair_method(const struct bt_conn *conn)
163163
static uint8_t ssp_get_auth(const struct bt_conn *conn)
164164
{
165165
bt_security_t max_sec_level;
166-
uint8_t mitm = 0;
167166

168167
/* Check if the MITM is required by service */
169168
max_sec_level = bt_l2cap_br_get_max_sec_level();
170-
if ((max_sec_level > BT_SECURITY_L2) && (ssp_pair_method(conn) > JUST_WORKS)) {
171-
mitm = BT_MITM;
172-
}
173-
174-
/* Validate no bond auth request, and if valid use it. */
175-
if ((conn->br.remote_auth == BT_HCI_NO_BONDING) ||
176-
((conn->br.remote_auth == BT_HCI_NO_BONDING_MITM) &&
177-
(ssp_pair_method(conn) > JUST_WORKS))) {
178-
return conn->br.remote_auth | mitm;
179-
}
180169

181-
/* Local & remote have enough IO capabilities to get MITM protection. */
182-
if (ssp_pair_method(conn) > JUST_WORKS) {
170+
/*
171+
* The local device shall only set the MITM protection required flag
172+
* if the local device itself requires MITM protection.
173+
*/
174+
if ((max_sec_level > BT_SECURITY_L2) && (ssp_pair_method(conn) > JUST_WORKS)) {
183175
return conn->br.remote_auth | BT_MITM;
184176
}
185177

0 commit comments

Comments
 (0)