Skip to content

Commit

Permalink
Bluetooth: Simplify hci_conn_accept_secure check
Browse files Browse the repository at this point in the history
If the link key is secure (authenticated or combination 16 digit)
the sec_level will be always BT_SECURITY_HIGH. Therefore, instead
of checking the link key type simply check the sec_level on the link.

Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
  • Loading branch information
Waldemar Rymarkiewicz authored and Gustavo F. Padovan committed Jun 8, 2011
1 parent 14b12d0 commit ef4177e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/bluetooth/hci_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,7 @@ int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level)
if (sec_level != BT_SECURITY_HIGH)
return 1; /* Accept if non-secure is required */

if (conn->key_type == HCI_LK_AUTH_COMBINATION ||
(conn->key_type == HCI_LK_COMBINATION &&
conn->pin_length == 16))
if (conn->sec_level == BT_SECURITY_HIGH)
return 1;

return 0; /* Reject not secure link */
Expand Down

0 comments on commit ef4177e

Please sign in to comment.