diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2015-01-27 19:04:31 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-01-28 15:26:20 -0500 |
commit | 6665d057fba3376351346abe7bd1ebcaafc48a34 (patch) | |
tree | 82ce214d009d40eae1a49065f2d885323a15a0de /net/bluetooth | |
parent | d25b78e2ed60ea33dc1008d0f50b3410b73212a0 (diff) |
Bluetooth: Clear P-192 values for OOB when in Secure Connections Only mode
When Secure Connections Only mode has been enabled and remote OOB data
is requested, then only provide P-256 hash and randomizer vaulues. The
fields for P-192 hash and randomizer should be set to zero.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_event.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index e2b81adc232f..0850cad8c368 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -4163,33 +4163,39 @@ static void hci_remote_oob_data_request_evt(struct hci_dev *hdev, | |||
4163 | goto unlock; | 4163 | goto unlock; |
4164 | 4164 | ||
4165 | data = hci_find_remote_oob_data(hdev, &ev->bdaddr, BDADDR_BREDR); | 4165 | data = hci_find_remote_oob_data(hdev, &ev->bdaddr, BDADDR_BREDR); |
4166 | if (data) { | 4166 | if (!data) { |
4167 | if (bredr_sc_enabled(hdev)) { | 4167 | struct hci_cp_remote_oob_data_neg_reply cp; |
4168 | struct hci_cp_remote_oob_ext_data_reply cp; | ||
4169 | |||
4170 | bacpy(&cp.bdaddr, &ev->bdaddr); | ||
4171 | memcpy(cp.hash192, data->hash192, sizeof(cp.hash192)); | ||
4172 | memcpy(cp.rand192, data->rand192, sizeof(cp.rand192)); | ||
4173 | memcpy(cp.hash256, data->hash256, sizeof(cp.hash256)); | ||
4174 | memcpy(cp.rand256, data->rand256, sizeof(cp.rand256)); | ||
4175 | 4168 | ||
4176 | hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_EXT_DATA_REPLY, | 4169 | bacpy(&cp.bdaddr, &ev->bdaddr); |
4177 | sizeof(cp), &cp); | 4170 | hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_NEG_REPLY, |
4178 | } else { | 4171 | sizeof(cp), &cp); |
4179 | struct hci_cp_remote_oob_data_reply cp; | 4172 | goto unlock; |
4173 | } | ||
4180 | 4174 | ||
4181 | bacpy(&cp.bdaddr, &ev->bdaddr); | 4175 | if (bredr_sc_enabled(hdev)) { |
4182 | memcpy(cp.hash, data->hash192, sizeof(cp.hash)); | 4176 | struct hci_cp_remote_oob_ext_data_reply cp; |
4183 | memcpy(cp.rand, data->rand192, sizeof(cp.rand)); | ||
4184 | 4177 | ||
4185 | hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_REPLY, | 4178 | bacpy(&cp.bdaddr, &ev->bdaddr); |
4186 | sizeof(cp), &cp); | 4179 | if (test_bit(HCI_SC_ONLY, &hdev->dev_flags)) { |
4180 | memset(cp.hash192, 0, sizeof(cp.hash192)); | ||
4181 | memset(cp.rand192, 0, sizeof(cp.rand192)); | ||
4182 | } else { | ||
4183 | memcpy(cp.hash192, data->hash192, sizeof(cp.hash192)); | ||
4184 | memcpy(cp.rand192, data->rand192, sizeof(cp.rand192)); | ||
4187 | } | 4185 | } |
4186 | memcpy(cp.hash256, data->hash256, sizeof(cp.hash256)); | ||
4187 | memcpy(cp.rand256, data->rand256, sizeof(cp.rand256)); | ||
4188 | |||
4189 | hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_EXT_DATA_REPLY, | ||
4190 | sizeof(cp), &cp); | ||
4188 | } else { | 4191 | } else { |
4189 | struct hci_cp_remote_oob_data_neg_reply cp; | 4192 | struct hci_cp_remote_oob_data_reply cp; |
4190 | 4193 | ||
4191 | bacpy(&cp.bdaddr, &ev->bdaddr); | 4194 | bacpy(&cp.bdaddr, &ev->bdaddr); |
4192 | hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_NEG_REPLY, | 4195 | memcpy(cp.hash, data->hash192, sizeof(cp.hash)); |
4196 | memcpy(cp.rand, data->rand192, sizeof(cp.rand)); | ||
4197 | |||
4198 | hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_REPLY, | ||
4193 | sizeof(cp), &cp); | 4199 | sizeof(cp), &cp); |
4194 | } | 4200 | } |
4195 | 4201 | ||