diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-02-22 12:06:32 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-02-22 12:59:23 -0500 |
commit | 863efaf224d24705c0ffdc59f2a0ec68f2d85b4f (patch) | |
tree | b58c8d7eba9defd81c056dcb701435237031fa44 | |
parent | 524237cb4b566ae73ec24c56852489b85e426241 (diff) |
Bluetooth: Add initial code for distributing local IRK
This code adds a HCI_PRIVACY flag to track whether Privacy support is
enabled (meaning we have a local IRK) and makes sure the IRK is
distributed during SMP key distribution in case this flag is set.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | include/net/bluetooth/hci.h | 1 | ||||
-rw-r--r-- | include/net/bluetooth/hci_core.h | 2 | ||||
-rw-r--r-- | net/bluetooth/smp.c | 6 |
3 files changed, 7 insertions, 2 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index fe4b06bfc150..5ff885ff29df 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -126,6 +126,7 @@ enum { | |||
126 | HCI_SSP_ENABLED, | 126 | HCI_SSP_ENABLED, |
127 | HCI_SC_ENABLED, | 127 | HCI_SC_ENABLED, |
128 | HCI_SC_ONLY, | 128 | HCI_SC_ONLY, |
129 | HCI_PRIVACY, | ||
129 | HCI_RPA_RESOLVING, | 130 | HCI_RPA_RESOLVING, |
130 | HCI_HS_ENABLED, | 131 | HCI_HS_ENABLED, |
131 | HCI_LE_ENABLED, | 132 | HCI_LE_ENABLED, |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index c0fcc041fbb5..68bbcabdd9fd 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -303,6 +303,8 @@ struct hci_dev { | |||
303 | __u8 scan_rsp_data[HCI_MAX_AD_LENGTH]; | 303 | __u8 scan_rsp_data[HCI_MAX_AD_LENGTH]; |
304 | __u8 scan_rsp_data_len; | 304 | __u8 scan_rsp_data_len; |
305 | 305 | ||
306 | __u8 irk[16]; | ||
307 | |||
306 | int (*open)(struct hci_dev *hdev); | 308 | int (*open)(struct hci_dev *hdev); |
307 | int (*close)(struct hci_dev *hdev); | 309 | int (*close)(struct hci_dev *hdev); |
308 | int (*flush)(struct hci_dev *hdev); | 310 | int (*flush)(struct hci_dev *hdev); |
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 6355a460e9d0..8ef50c790b96 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -265,6 +265,9 @@ static void build_pairing_cmd(struct l2cap_conn *conn, | |||
265 | if (test_bit(HCI_RPA_RESOLVING, &hdev->dev_flags)) | 265 | if (test_bit(HCI_RPA_RESOLVING, &hdev->dev_flags)) |
266 | remote_dist |= SMP_DIST_ID_KEY; | 266 | remote_dist |= SMP_DIST_ID_KEY; |
267 | 267 | ||
268 | if (test_bit(HCI_PRIVACY, &hdev->dev_flags)) | ||
269 | local_dist |= SMP_DIST_ID_KEY; | ||
270 | |||
268 | if (rsp == NULL) { | 271 | if (rsp == NULL) { |
269 | req->io_capability = conn->hcon->io_capability; | 272 | req->io_capability = conn->hcon->io_capability; |
270 | req->oob_flag = SMP_OOB_NOT_PRESENT; | 273 | req->oob_flag = SMP_OOB_NOT_PRESENT; |
@@ -1189,8 +1192,7 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force) | |||
1189 | struct smp_cmd_ident_addr_info addrinfo; | 1192 | struct smp_cmd_ident_addr_info addrinfo; |
1190 | struct smp_cmd_ident_info idinfo; | 1193 | struct smp_cmd_ident_info idinfo; |
1191 | 1194 | ||
1192 | /* Send a dummy key */ | 1195 | memcpy(idinfo.irk, hdev->irk, sizeof(idinfo.irk)); |
1193 | get_random_bytes(idinfo.irk, sizeof(idinfo.irk)); | ||
1194 | 1196 | ||
1195 | smp_send_cmd(conn, SMP_CMD_IDENT_INFO, sizeof(idinfo), &idinfo); | 1197 | smp_send_cmd(conn, SMP_CMD_IDENT_INFO, sizeof(idinfo), &idinfo); |
1196 | 1198 | ||