diff options
| author | Marcel Holtmann <marcel@holtmann.org> | 2019-04-24 22:19:17 +0200 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2019-07-18 20:59:16 +0200 |
| commit | c84e2538daa1e52c324d169affb402666f368a8b (patch) | |
| tree | 405fbbf87dd7eeb93987e189b826d9a974f47a7f | |
| parent | 85e13798d1e0d76f2eec86fda6d986c83ac61d81 (diff) | |
Bluetooth: Align minimum encryption key size for LE and BR/EDR connections
commit d5bb334a8e171b262e48f378bd2096c0ea458265 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.
Change-Id: Iaa1e00cab1ca82f42098c461f91fe370e501d826
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>
| -rw-r--r-- | include/net/bluetooth/hci_core.h | 3 | ||||
| -rw-r--r-- | net/bluetooth/hci_conn.c | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index c5b343ada..f79d669ad 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -126,6 +126,9 @@ struct le_scan_params { #define HCI_MAX_SHORT_NAME_LENGTH 10 +/* Min encryption key size to match with SMP */ +#define HCI_MIN_ENC_KEY_SIZE 7 + struct amp_assoc { __u16 len; __u16 offset; diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 838b9f3b1..63c7060d9 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -650,6 +650,14 @@ int hci_conn_check_link_mode(struct hci_conn *conn) !test_bit(HCI_CONN_ENCRYPT, &conn->flags)) return 0; + /* The minimum encryption key size needs to be enforced by the + * host stack before establishing any L2CAP connections. The + * specification in theory allows a minimum of 1, but to align + * BR/EDR and LE transports, a minimum of 7 is chosen. + */ + if (conn->enc_key_size < HCI_MIN_ENC_KEY_SIZE) + return 0; + return 1; } |
