Skip to content

Commit 2424bfd

Browse files
lylezhu2012kartben
authored andcommitted
Bluetooth: BR: improve br_sufficient_key_size
Currently, the minimum value of encryption key size is `BT_HCI_ENCRYPTION_KEY_SIZE_MIN`. Add a new Kconfig `BT_BR_MIN_ENC_KEY_SIZE`. It is used to set the specific minimum encryption key size. The default value is `BT_SMP_MIN_ENC_KEY_SIZE`. And it can be configured if `BT_SMP_SC_ONLY` is not enabled. Use `CONFIG_BT_BR_MIN_ENC_KEY_SIZE` as minimum encryption key size in `br_sufficient_key_size`. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
1 parent f756d0d commit 2424bfd

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

subsys/bluetooth/host/classic/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ config BT_CLASSIC
1818
This option enables Bluetooth BR/EDR support
1919

2020
if BT_CLASSIC
21+
config BT_BR_MIN_ENC_KEY_SIZE
22+
int
23+
prompt "Minimum encryption key size accepted in octets" if !BT_SMP_SC_ONLY
24+
default BT_SMP_MIN_ENC_KEY_SIZE
25+
range 7 16
26+
help
27+
This option sets the minimum encryption key size accepted during pairing
28+
for classic.
29+
2130
config BT_MAX_SCO_CONN
2231
int "Maximum number of simultaneous SCO connections"
2332
default 1

subsys/bluetooth/host/classic/br.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static bool br_sufficient_key_size(struct bt_conn *conn)
141141
return key_size == BT_HCI_ENCRYPTION_KEY_SIZE_MAX;
142142
}
143143

144-
return key_size >= BT_HCI_ENCRYPTION_KEY_SIZE_MIN;
144+
return key_size >= CONFIG_BT_BR_MIN_ENC_KEY_SIZE;
145145
}
146146

147147
bool bt_br_update_sec_level(struct bt_conn *conn)

0 commit comments

Comments
 (0)