aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_event.c5
-rw-r--r--net/bluetooth/smp.c2
-rw-r--r--net/bluetooth/smp.h8
3 files changed, 10 insertions, 5 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 3a8381ab992f..603a17cc52ac 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -4506,10 +4506,7 @@ static void hci_le_ltk_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
4506 memcpy(cp.ltk, ltk->val, sizeof(ltk->val)); 4506 memcpy(cp.ltk, ltk->val, sizeof(ltk->val));
4507 cp.handle = cpu_to_le16(conn->handle); 4507 cp.handle = cpu_to_le16(conn->handle);
4508 4508
4509 if (ltk->authenticated) 4509 conn->pending_sec_level = smp_ltk_sec_level(ltk);
4510 conn->pending_sec_level = BT_SECURITY_HIGH;
4511 else
4512 conn->pending_sec_level = BT_SECURITY_MEDIUM;
4513 4510
4514 conn->enc_key_size = ltk->enc_size; 4511 conn->enc_key_size = ltk->enc_size;
4515 4512
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index a08b077cb725..3700dd8d9d0b 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -1114,7 +1114,7 @@ static bool smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level)
1114 if (!key) 1114 if (!key)
1115 return false; 1115 return false;
1116 1116
1117 if (sec_level > BT_SECURITY_MEDIUM && !key->authenticated) 1117 if (smp_ltk_sec_level(key) < sec_level)
1118 return false; 1118 return false;
1119 1119
1120 if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags)) 1120 if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags))
diff --git a/net/bluetooth/smp.h b/net/bluetooth/smp.h
index 5240537efde3..86a683a8b491 100644
--- a/net/bluetooth/smp.h
+++ b/net/bluetooth/smp.h
@@ -125,6 +125,14 @@ enum {
125 SMP_LTK_SLAVE, 125 SMP_LTK_SLAVE,
126}; 126};
127 127
128static inline u8 smp_ltk_sec_level(struct smp_ltk *key)
129{
130 if (key->authenticated)
131 return BT_SECURITY_HIGH;
132
133 return BT_SECURITY_MEDIUM;
134}
135
128/* SMP Commands */ 136/* SMP Commands */
129bool smp_sufficient_security(struct hci_conn *hcon, u8 sec_level); 137bool smp_sufficient_security(struct hci_conn *hcon, u8 sec_level);
130int smp_conn_security(struct hci_conn *hcon, __u8 sec_level); 138int smp_conn_security(struct hci_conn *hcon, __u8 sec_level);