Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6665d057 authored by Marcel Holtmann's avatar Marcel Holtmann
Browse files

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: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent d25b78e2
Loading
Loading
Loading
Loading
+26 −20
Original line number Original line Diff line number Diff line
@@ -4163,13 +4163,26 @@ static void hci_remote_oob_data_request_evt(struct hci_dev *hdev,
		goto unlock;
		goto unlock;


	data = hci_find_remote_oob_data(hdev, &ev->bdaddr, BDADDR_BREDR);
	data = hci_find_remote_oob_data(hdev, &ev->bdaddr, BDADDR_BREDR);
	if (data) {
	if (!data) {
		struct hci_cp_remote_oob_data_neg_reply cp;

		bacpy(&cp.bdaddr, &ev->bdaddr);
		hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_NEG_REPLY,
			     sizeof(cp), &cp);
		goto unlock;
	}

	if (bredr_sc_enabled(hdev)) {
	if (bredr_sc_enabled(hdev)) {
		struct hci_cp_remote_oob_ext_data_reply cp;
		struct hci_cp_remote_oob_ext_data_reply cp;


		bacpy(&cp.bdaddr, &ev->bdaddr);
		bacpy(&cp.bdaddr, &ev->bdaddr);
		if (test_bit(HCI_SC_ONLY, &hdev->dev_flags)) {
			memset(cp.hash192, 0, sizeof(cp.hash192));
			memset(cp.rand192, 0, sizeof(cp.rand192));
		} else {
			memcpy(cp.hash192, data->hash192, sizeof(cp.hash192));
			memcpy(cp.hash192, data->hash192, sizeof(cp.hash192));
			memcpy(cp.rand192, data->rand192, sizeof(cp.rand192));
			memcpy(cp.rand192, data->rand192, sizeof(cp.rand192));
		}
		memcpy(cp.hash256, data->hash256, sizeof(cp.hash256));
		memcpy(cp.hash256, data->hash256, sizeof(cp.hash256));
		memcpy(cp.rand256, data->rand256, sizeof(cp.rand256));
		memcpy(cp.rand256, data->rand256, sizeof(cp.rand256));


@@ -4185,13 +4198,6 @@ static void hci_remote_oob_data_request_evt(struct hci_dev *hdev,
		hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_REPLY,
		hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_REPLY,
			     sizeof(cp), &cp);
			     sizeof(cp), &cp);
	}
	}
	} else {
		struct hci_cp_remote_oob_data_neg_reply cp;

		bacpy(&cp.bdaddr, &ev->bdaddr);
		hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_NEG_REPLY,
			     sizeof(cp), &cp);
	}


unlock:
unlock:
	hci_dev_unlock(hdev);
	hci_dev_unlock(hdev);