Skip to content

Commit 6290d9d

Browse files
holtmanngregkh
authored andcommitted
Bluetooth: Align minimum encryption key size for LE and BR/EDR connections
commit d5bb334 upstream. The minimum encryption key size for LE connections is 56 bits and to align LE with BR/EDR, enforce 56 bits of minimum encryption key size for BR/EDR connections as well. Signed-off-by: Marcel Holtmann <[email protected]> Signed-off-by: Johan Hedberg <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 00d409d commit 6290d9d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

include/net/bluetooth/hci_core.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ struct adv_info {
176176

177177
#define HCI_MAX_SHORT_NAME_LENGTH 10
178178

179+
/* Min encryption key size to match with SMP */
180+
#define HCI_MIN_ENC_KEY_SIZE 7
181+
179182
/* Default LE RPA expiry time, 15 minutes */
180183
#define HCI_DEFAULT_RPA_TIMEOUT (15 * 60)
181184

net/bluetooth/hci_conn.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,14 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
11651165
!test_bit(HCI_CONN_ENCRYPT, &conn->flags))
11661166
return 0;
11671167

1168+
/* The minimum encryption key size needs to be enforced by the
1169+
* host stack before establishing any L2CAP connections. The
1170+
* specification in theory allows a minimum of 1, but to align
1171+
* BR/EDR and LE transports, a minimum of 7 is chosen.
1172+
*/
1173+
if (conn->enc_key_size < HCI_MIN_ENC_KEY_SIZE)
1174+
return 0;
1175+
11681176
return 1;
11691177
}
11701178

0 commit comments

Comments
 (0)