diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/smp.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 35f57090ddd0..6ce7785a2708 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -859,6 +859,17 @@ static bool smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level) | |||
859 | return true; | 859 | return true; |
860 | } | 860 | } |
861 | 861 | ||
862 | bool smp_sufficient_security(struct hci_conn *hcon, u8 sec_level) | ||
863 | { | ||
864 | if (sec_level == BT_SECURITY_LOW) | ||
865 | return true; | ||
866 | |||
867 | if (hcon->sec_level >= sec_level) | ||
868 | return true; | ||
869 | |||
870 | return false; | ||
871 | } | ||
872 | |||
862 | static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | 873 | static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) |
863 | { | 874 | { |
864 | struct smp_cmd_security_req *rp = (void *) skb->data; | 875 | struct smp_cmd_security_req *rp = (void *) skb->data; |
@@ -876,6 +887,9 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
876 | return SMP_CMD_NOTSUPP; | 887 | return SMP_CMD_NOTSUPP; |
877 | 888 | ||
878 | sec_level = authreq_to_seclevel(rp->auth_req); | 889 | sec_level = authreq_to_seclevel(rp->auth_req); |
890 | if (smp_sufficient_security(hcon, sec_level)) | ||
891 | return 0; | ||
892 | |||
879 | if (sec_level > hcon->pending_sec_level) | 893 | if (sec_level > hcon->pending_sec_level) |
880 | hcon->pending_sec_level = sec_level; | 894 | hcon->pending_sec_level = sec_level; |
881 | 895 | ||
@@ -904,17 +918,6 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
904 | return 0; | 918 | return 0; |
905 | } | 919 | } |
906 | 920 | ||
907 | bool smp_sufficient_security(struct hci_conn *hcon, u8 sec_level) | ||
908 | { | ||
909 | if (sec_level == BT_SECURITY_LOW) | ||
910 | return true; | ||
911 | |||
912 | if (hcon->sec_level >= sec_level) | ||
913 | return true; | ||
914 | |||
915 | return false; | ||
916 | } | ||
917 | |||
918 | int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) | 921 | int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) |
919 | { | 922 | { |
920 | struct l2cap_conn *conn = hcon->l2cap_data; | 923 | struct l2cap_conn *conn = hcon->l2cap_data; |