aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2014-03-19 17:10:25 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2014-03-19 17:30:32 -0400
commit40b552aa5a0bfa785bc7ddb5c2d7965b1e0bb08d (patch)
tree3ea70beb7e49dd1e890efdc6a068756dd7e6d744
parent4e7b2030c452e5d885d36d4f44ef33d6ceb9759a (diff)
Bluetooth: Enforce strict Secure Connections Only mode security
In Secure Connections Only mode, it is required that Secure Connections is used for pairing and that the link key is encrypted with AES-CCM using a P-256 authenticated combination key. If this is not the case, then new connection shall be refused or existing connections shall be dropped. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r--net/bluetooth/hci_conn.c11
-rw-r--r--net/bluetooth/hci_event.c12
2 files changed, 23 insertions, 0 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index b4809e473a19..d958e2dca52f 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -781,6 +781,17 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
781{ 781{
782 BT_DBG("hcon %p", conn); 782 BT_DBG("hcon %p", conn);
783 783
784 /* In Secure Connections Only mode, it is required that Secure
785 * Connections is used and the link is encrypted with AES-CCM
786 * using a P-256 authenticated combination key.
787 */
788 if (test_bit(HCI_SC_ONLY, &conn->hdev->flags)) {
789 if (!hci_conn_sc_enabled(conn) ||
790 !test_bit(HCI_CONN_AES_CCM, &conn->flags) ||
791 conn->key_type != HCI_LK_AUTH_COMBINATION_P256)
792 return 0;
793 }
794
784 if (hci_conn_ssp_enabled(conn) && !(conn->link_mode & HCI_LM_ENCRYPT)) 795 if (hci_conn_ssp_enabled(conn) && !(conn->link_mode & HCI_LM_ENCRYPT))
785 return 0; 796 return 0;
786 797
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index e97f1905aa5c..a6a3d32553c5 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2183,6 +2183,18 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb)
2183 if (!ev->status) 2183 if (!ev->status)
2184 conn->state = BT_CONNECTED; 2184 conn->state = BT_CONNECTED;
2185 2185
2186 /* In Secure Connections Only mode, do not allow any
2187 * connections that are not encrypted with AES-CCM
2188 * using a P-256 authenticated combination key.
2189 */
2190 if (test_bit(HCI_SC_ONLY, &hdev->dev_flags) &&
2191 (!test_bit(HCI_CONN_AES_CCM, &conn->flags) ||
2192 conn->key_type != HCI_LK_AUTH_COMBINATION_P256)) {
2193 hci_proto_connect_cfm(conn, HCI_ERROR_AUTH_FAILURE);
2194 hci_conn_drop(conn);
2195 goto unlock;
2196 }
2197
2186 hci_proto_connect_cfm(conn, ev->status); 2198 hci_proto_connect_cfm(conn, ev->status);
2187 hci_conn_drop(conn); 2199 hci_conn_drop(conn);
2188 } else 2200 } else