Skip to content

Commit 274a3b6

Browse files
committed
[nrf fromtree] Bluetooth: host: Elevate security to L4 when SC only ...
is enabled Elevate connections always to security mode 1 level 4 when Secure Connections Only Mode has been enabled in the Security Manager. Elevate connections always to security mode 1 level 3 when Legacy pairing with OOB only has been enabled in the Security Manager. Fixes: #27338 Signed-off-by: Joakim Andersson <[email protected]> (cherry picked from commit c7ad661) Signed-off-by: Joakim Andersson <[email protected]>
1 parent 0e47c9e commit 274a3b6

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

include/bluetooth/conn.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,9 @@ typedef enum __packed {
688688
* This function may return error if the pairing procedure has already been
689689
* initiated by the local device or the peer device.
690690
*
691+
* @note When :option:`CONFIG_BT_SMP_SC_ONLY` is enabled then the security
692+
* level will always be level 4.
693+
*
691694
* @param conn Connection object.
692695
* @param sec Requested security level.
693696
*

subsys/bluetooth/host/conn.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,14 +1126,8 @@ int bt_conn_set_security(struct bt_conn *conn, bt_security_t sec)
11261126
return -ENOTCONN;
11271127
}
11281128

1129-
if (IS_ENABLED(CONFIG_BT_SMP_SC_ONLY) &&
1130-
sec < BT_SECURITY_L4) {
1131-
return -EOPNOTSUPP;
1132-
}
1133-
1134-
if (IS_ENABLED(CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY) &&
1135-
sec > BT_SECURITY_L3) {
1136-
return -EOPNOTSUPP;
1129+
if (IS_ENABLED(CONFIG_BT_SMP_SC_ONLY)) {
1130+
sec = BT_SECURITY_L4;
11371131
}
11381132

11391133
/* nothing to do */

0 commit comments

Comments
 (0)