Skip to content

Commit

Permalink
Bluetooth: Check key sizes only when Secure Simple Pairing is enabled
Browse files Browse the repository at this point in the history
The encryption is only mandatory to be enforced when both sides are using
Secure Simple Pairing and this means the key size check makes only sense
in that case.

On legacy Bluetooth 2.0 and earlier devices like mice the encryption was
optional and thus causing an issue if the key size check is not bound to
using Secure Simple Pairing.

Fixes: d5bb334 ("Bluetooth: Align minimum encryption key size for LE and BR/EDR connections")
Signed-off-by: Marcel Holtmann <[email protected]>
Cc: [email protected]
  • Loading branch information
holtmann authored and Phil Elwell committed May 24, 2019
1 parent b45a32b commit 00de9e4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions net/bluetooth/hci_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,8 +1272,13 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
return 0;
}

if (hci_conn_ssp_enabled(conn) &&
!test_bit(HCI_CONN_ENCRYPT, &conn->flags))
/* If Secure Simple Pairing is not enabled, then legacy connection
* setup is used and no encryption or key sizes can be enforced.
*/
if (!hci_conn_ssp_enabled(conn))
return 1;

if (!test_bit(HCI_CONN_ENCRYPT, &conn->flags))
return 0;

/* The minimum encryption key size needs to be enforced by the
Expand Down

0 comments on commit 00de9e4

Please sign in to comment.