Commit ef4177e2 authored by Waldemar Rymarkiewicz's avatar Waldemar Rymarkiewicz Committed by Gustavo F. Padovan

Bluetooth: Simplify hci_conn_accept_secure check

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: default avatarWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 14b12d0b
...@@ -643,9 +643,7 @@ int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level) ...@@ -643,9 +643,7 @@ int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level)
if (sec_level != BT_SECURITY_HIGH) if (sec_level != BT_SECURITY_HIGH)
return 1; /* Accept if non-secure is required */ return 1; /* Accept if non-secure is required */
if (conn->key_type == HCI_LK_AUTH_COMBINATION || if (conn->sec_level == BT_SECURITY_HIGH)
(conn->key_type == HCI_LK_COMBINATION &&
conn->pin_length == 16))
return 1; return 1;
return 0; /* Reject not secure link */ return 0; /* Reject not secure link */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment