Skip to content

Commit 5e9a6c6

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 <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 64e3702 commit 5e9a6c6

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

include/net/bluetooth/hci_core.h

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

183183
#define HCI_MAX_SHORT_NAME_LENGTH 10
184184

185+
/* Min encryption key size to match with SMP */
186+
#define HCI_MIN_ENC_KEY_SIZE 7
187+
185188
/* Default LE RPA expiry time, 15 minutes */
186189
#define HCI_DEFAULT_RPA_TIMEOUT (15 * 60)
187190

net/bluetooth/hci_conn.c

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

1279+
/* The minimum encryption key size needs to be enforced by the
1280+
* host stack before establishing any L2CAP connections. The
1281+
* specification in theory allows a minimum of 1, but to align
1282+
* BR/EDR and LE transports, a minimum of 7 is chosen.
1283+
*/
1284+
if (conn->enc_key_size < HCI_MIN_ENC_KEY_SIZE)
1285+
return 0;
1286+
12791287
return 1;
12801288
}
12811289

0 commit comments

Comments
 (0)