aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2015-01-31 02:20:55 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2015-01-31 02:59:45 -0500
commitf7697b1602d13ef80779caf23d13fa1511193144 (patch)
treee18e6976b1fad8ef90a67f37e4b1def196b2aeba /net/bluetooth
parentc33fb9b4ef6c8e2472405606f3f9850415980c96 (diff)
Bluetooth: Store OOB data present value for each set of remote OOB data
Instead of doing complex calculation every time the OOB data is used, just calculate the OOB data present value and store it with the OOB data raw values. 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_core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 5d4ac3fbbc08..f045c062f8f0 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2581,9 +2581,15 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
2581 if (hash192 && rand192) { 2581 if (hash192 && rand192) {
2582 memcpy(data->hash192, hash192, sizeof(data->hash192)); 2582 memcpy(data->hash192, hash192, sizeof(data->hash192));
2583 memcpy(data->rand192, rand192, sizeof(data->rand192)); 2583 memcpy(data->rand192, rand192, sizeof(data->rand192));
2584 if (hash256 && rand256)
2585 data->present = 0x03;
2584 } else { 2586 } else {
2585 memset(data->hash192, 0, sizeof(data->hash192)); 2587 memset(data->hash192, 0, sizeof(data->hash192));
2586 memset(data->rand192, 0, sizeof(data->rand192)); 2588 memset(data->rand192, 0, sizeof(data->rand192));
2589 if (hash256 && rand256)
2590 data->present = 0x02;
2591 else
2592 data->present = 0x00;
2587 } 2593 }
2588 2594
2589 if (hash256 && rand256) { 2595 if (hash256 && rand256) {
@@ -2592,6 +2598,8 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
2592 } else { 2598 } else {
2593 memset(data->hash256, 0, sizeof(data->hash256)); 2599 memset(data->hash256, 0, sizeof(data->hash256));
2594 memset(data->rand256, 0, sizeof(data->rand256)); 2600 memset(data->rand256, 0, sizeof(data->rand256));
2601 if (hash192 && rand192)
2602 data->present = 0x01;
2595 } 2603 }
2596 2604
2597 BT_DBG("%s for %pMR", hdev->name, bdaddr); 2605 BT_DBG("%s for %pMR", hdev->name, bdaddr);