aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-09-08 19:59:18 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-12-03 10:51:20 -0500
commit903b71c78d56af56a5f4d53a8dbef8032d1949bf (patch)
treef7dc4f122bc89255962345070d3e1e70b2d9e17b /net/bluetooth
parentb5ae344d4c0f69ae6526565b55d52b64bc127087 (diff)
Bluetooth: Add SC-only mode support for SMP
When Secure Connections-only mode is enabled we should reject any pairing command that does not have Secure Connections set in the authentication requirements. This patch adds the appropriate logic for this to the command handlers of Pairing Request/Response and Security Request. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/smp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 2c6edf1b6669..589e015c5125 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -1608,6 +1608,9 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
1608 (auth & SMP_AUTH_BONDING)) 1608 (auth & SMP_AUTH_BONDING))
1609 return SMP_PAIRING_NOTSUPP; 1609 return SMP_PAIRING_NOTSUPP;
1610 1610
1611 if (test_bit(HCI_SC_ONLY, &hdev->dev_flags) && !(auth & SMP_AUTH_SC))
1612 return SMP_AUTH_REQUIREMENTS;
1613
1611 smp->preq[0] = SMP_CMD_PAIRING_REQ; 1614 smp->preq[0] = SMP_CMD_PAIRING_REQ;
1612 memcpy(&smp->preq[1], req, sizeof(*req)); 1615 memcpy(&smp->preq[1], req, sizeof(*req));
1613 skb_pull(skb, sizeof(*req)); 1616 skb_pull(skb, sizeof(*req));
@@ -1752,6 +1755,9 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
1752 1755
1753 auth = rsp->auth_req & AUTH_REQ_MASK(hdev); 1756 auth = rsp->auth_req & AUTH_REQ_MASK(hdev);
1754 1757
1758 if (test_bit(HCI_SC_ONLY, &hdev->dev_flags) && !(auth & SMP_AUTH_SC))
1759 return SMP_AUTH_REQUIREMENTS;
1760
1755 smp->prsp[0] = SMP_CMD_PAIRING_RSP; 1761 smp->prsp[0] = SMP_CMD_PAIRING_RSP;
1756 memcpy(&smp->prsp[1], rsp, sizeof(*rsp)); 1762 memcpy(&smp->prsp[1], rsp, sizeof(*rsp));
1757 1763
@@ -2008,6 +2014,9 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
2008 2014
2009 auth = rp->auth_req & AUTH_REQ_MASK(hdev); 2015 auth = rp->auth_req & AUTH_REQ_MASK(hdev);
2010 2016
2017 if (test_bit(HCI_SC_ONLY, &hdev->dev_flags) && !(auth & SMP_AUTH_SC))
2018 return SMP_AUTH_REQUIREMENTS;
2019
2011 if (hcon->io_capability == HCI_IO_NO_INPUT_OUTPUT) 2020 if (hcon->io_capability == HCI_IO_NO_INPUT_OUTPUT)
2012 sec_level = BT_SECURITY_MEDIUM; 2021 sec_level = BT_SECURITY_MEDIUM;
2013 else 2022 else