aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/bluetooth/hci.h12
-rw-r--r--include/net/bluetooth/hci_core.h14
-rw-r--r--include/net/bluetooth/mgmt.h12
-rw-r--r--net/bluetooth/hci_core.c14
-rw-r--r--net/bluetooth/hci_event.c17
-rw-r--r--net/bluetooth/mgmt.c23
6 files changed, 42 insertions, 50 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index d5f85d7746bc..e56f9099f8e3 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -639,7 +639,7 @@ struct hci_cp_user_passkey_reply {
639struct hci_cp_remote_oob_data_reply { 639struct hci_cp_remote_oob_data_reply {
640 bdaddr_t bdaddr; 640 bdaddr_t bdaddr;
641 __u8 hash[16]; 641 __u8 hash[16];
642 __u8 randomizer[16]; 642 __u8 rand[16];
643} __packed; 643} __packed;
644 644
645#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 645#define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433
@@ -731,9 +731,9 @@ struct hci_rp_set_csb {
731struct hci_cp_remote_oob_ext_data_reply { 731struct hci_cp_remote_oob_ext_data_reply {
732 bdaddr_t bdaddr; 732 bdaddr_t bdaddr;
733 __u8 hash192[16]; 733 __u8 hash192[16];
734 __u8 randomizer192[16]; 734 __u8 rand192[16];
735 __u8 hash256[16]; 735 __u8 hash256[16];
736 __u8 randomizer256[16]; 736 __u8 rand256[16];
737} __packed; 737} __packed;
738 738
739#define HCI_OP_SNIFF_MODE 0x0803 739#define HCI_OP_SNIFF_MODE 0x0803
@@ -940,7 +940,7 @@ struct hci_cp_write_ssp_mode {
940struct hci_rp_read_local_oob_data { 940struct hci_rp_read_local_oob_data {
941 __u8 status; 941 __u8 status;
942 __u8 hash[16]; 942 __u8 hash[16];
943 __u8 randomizer[16]; 943 __u8 rand[16];
944} __packed; 944} __packed;
945 945
946#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 946#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
@@ -1024,9 +1024,9 @@ struct hci_cp_write_sc_support {
1024struct hci_rp_read_local_oob_ext_data { 1024struct hci_rp_read_local_oob_ext_data {
1025 __u8 status; 1025 __u8 status;
1026 __u8 hash192[16]; 1026 __u8 hash192[16];
1027 __u8 randomizer192[16]; 1027 __u8 rand192[16];
1028 __u8 hash256[16]; 1028 __u8 hash256[16];
1029 __u8 randomizer256[16]; 1029 __u8 rand256[16];
1030} __packed; 1030} __packed;
1031 1031
1032#define HCI_OP_READ_LOCAL_VERSION 0x1001 1032#define HCI_OP_READ_LOCAL_VERSION 0x1001
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index fe2d5f299e12..a805b3d97c0b 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -140,9 +140,9 @@ struct oob_data {
140 struct list_head list; 140 struct list_head list;
141 bdaddr_t bdaddr; 141 bdaddr_t bdaddr;
142 u8 hash192[16]; 142 u8 hash192[16];
143 u8 randomizer192[16]; 143 u8 rand192[16];
144 u8 hash256[16]; 144 u8 hash256[16];
145 u8 randomizer256[16]; 145 u8 rand256[16];
146}; 146};
147 147
148#define HCI_MAX_SHORT_NAME_LENGTH 10 148#define HCI_MAX_SHORT_NAME_LENGTH 10
@@ -943,10 +943,10 @@ void hci_remote_oob_data_clear(struct hci_dev *hdev);
943struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, 943struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev,
944 bdaddr_t *bdaddr); 944 bdaddr_t *bdaddr);
945int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, 945int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
946 u8 *hash, u8 *randomizer); 946 u8 *hash, u8 *rand);
947int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr, 947int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
948 u8 *hash192, u8 *randomizer192, 948 u8 *hash192, u8 *rand192,
949 u8 *hash256, u8 *randomizer256); 949 u8 *hash256, u8 *rand256);
950int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); 950int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
951 951
952void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 952void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
@@ -1374,8 +1374,8 @@ void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1374 u8 status); 1374 u8 status);
1375void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1375void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1376void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192, 1376void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
1377 u8 *randomizer192, u8 *hash256, 1377 u8 *rand192, u8 *hash256, u8 *rand256,
1378 u8 *randomizer256, u8 status); 1378 u8 status);
1379void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1379void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1380 u8 addr_type, u8 *dev_class, s8 rssi, u32 flags, 1380 u8 addr_type, u8 *dev_class, s8 rssi, u32 flags,
1381 u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len); 1381 u8 *eir, u16 eir_len, u8 *scan_rsp, u8 scan_rsp_len);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 414cd2f9a437..b391fd663468 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -299,28 +299,28 @@ struct mgmt_cp_user_passkey_neg_reply {
299#define MGMT_READ_LOCAL_OOB_DATA_SIZE 0 299#define MGMT_READ_LOCAL_OOB_DATA_SIZE 0
300struct mgmt_rp_read_local_oob_data { 300struct mgmt_rp_read_local_oob_data {
301 __u8 hash[16]; 301 __u8 hash[16];
302 __u8 randomizer[16]; 302 __u8 rand[16];
303} __packed; 303} __packed;
304struct mgmt_rp_read_local_oob_ext_data { 304struct mgmt_rp_read_local_oob_ext_data {
305 __u8 hash192[16]; 305 __u8 hash192[16];
306 __u8 randomizer192[16]; 306 __u8 rand192[16];
307 __u8 hash256[16]; 307 __u8 hash256[16];
308 __u8 randomizer256[16]; 308 __u8 rand256[16];
309} __packed; 309} __packed;
310 310
311#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021 311#define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0021
312struct mgmt_cp_add_remote_oob_data { 312struct mgmt_cp_add_remote_oob_data {
313 struct mgmt_addr_info addr; 313 struct mgmt_addr_info addr;
314 __u8 hash[16]; 314 __u8 hash[16];
315 __u8 randomizer[16]; 315 __u8 rand[16];
316} __packed; 316} __packed;
317#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32) 317#define MGMT_ADD_REMOTE_OOB_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 32)
318struct mgmt_cp_add_remote_oob_ext_data { 318struct mgmt_cp_add_remote_oob_ext_data {
319 struct mgmt_addr_info addr; 319 struct mgmt_addr_info addr;
320 __u8 hash192[16]; 320 __u8 hash192[16];
321 __u8 randomizer192[16]; 321 __u8 rand192[16];
322 __u8 hash256[16]; 322 __u8 hash256[16];
323 __u8 randomizer256[16]; 323 __u8 rand256[16];
324} __packed; 324} __packed;
325#define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64) 325#define MGMT_ADD_REMOTE_OOB_EXT_DATA_SIZE (MGMT_ADDR_INFO_SIZE + 64)
326 326
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 90ea0b7670d2..bbefb4eea36e 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3469,7 +3469,7 @@ void hci_remote_oob_data_clear(struct hci_dev *hdev)
3469} 3469}
3470 3470
3471int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, 3471int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
3472 u8 *hash, u8 *randomizer) 3472 u8 *hash, u8 *rand)
3473{ 3473{
3474 struct oob_data *data; 3474 struct oob_data *data;
3475 3475
@@ -3484,10 +3484,10 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
3484 } 3484 }
3485 3485
3486 memcpy(data->hash192, hash, sizeof(data->hash192)); 3486 memcpy(data->hash192, hash, sizeof(data->hash192));
3487 memcpy(data->randomizer192, randomizer, sizeof(data->randomizer192)); 3487 memcpy(data->rand192, rand, sizeof(data->rand192));
3488 3488
3489 memset(data->hash256, 0, sizeof(data->hash256)); 3489 memset(data->hash256, 0, sizeof(data->hash256));
3490 memset(data->randomizer256, 0, sizeof(data->randomizer256)); 3490 memset(data->rand256, 0, sizeof(data->rand256));
3491 3491
3492 BT_DBG("%s for %pMR", hdev->name, bdaddr); 3492 BT_DBG("%s for %pMR", hdev->name, bdaddr);
3493 3493
@@ -3495,8 +3495,8 @@ int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
3495} 3495}
3496 3496
3497int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr, 3497int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
3498 u8 *hash192, u8 *randomizer192, 3498 u8 *hash192, u8 *rand192,
3499 u8 *hash256, u8 *randomizer256) 3499 u8 *hash256, u8 *rand256)
3500{ 3500{
3501 struct oob_data *data; 3501 struct oob_data *data;
3502 3502
@@ -3511,10 +3511,10 @@ int hci_add_remote_oob_ext_data(struct hci_dev *hdev, bdaddr_t *bdaddr,
3511 } 3511 }
3512 3512
3513 memcpy(data->hash192, hash192, sizeof(data->hash192)); 3513 memcpy(data->hash192, hash192, sizeof(data->hash192));
3514 memcpy(data->randomizer192, randomizer192, sizeof(data->randomizer192)); 3514 memcpy(data->rand192, rand192, sizeof(data->rand192));
3515 3515
3516 memcpy(data->hash256, hash256, sizeof(data->hash256)); 3516 memcpy(data->hash256, hash256, sizeof(data->hash256));
3517 memcpy(data->randomizer256, randomizer256, sizeof(data->randomizer256)); 3517 memcpy(data->rand256, rand256, sizeof(data->rand256));
3518 3518
3519 BT_DBG("%s for %pMR", hdev->name, bdaddr); 3519 BT_DBG("%s for %pMR", hdev->name, bdaddr);
3520 3520
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 09d76547d985..844f7d1ff1cd 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -994,8 +994,8 @@ static void hci_cc_read_local_oob_data(struct hci_dev *hdev,
994 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); 994 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
995 995
996 hci_dev_lock(hdev); 996 hci_dev_lock(hdev);
997 mgmt_read_local_oob_data_complete(hdev, rp->hash, rp->randomizer, 997 mgmt_read_local_oob_data_complete(hdev, rp->hash, rp->rand, NULL, NULL,
998 NULL, NULL, rp->status); 998 rp->status);
999 hci_dev_unlock(hdev); 999 hci_dev_unlock(hdev);
1000} 1000}
1001 1001
@@ -1007,8 +1007,8 @@ static void hci_cc_read_local_oob_ext_data(struct hci_dev *hdev,
1007 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); 1007 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
1008 1008
1009 hci_dev_lock(hdev); 1009 hci_dev_lock(hdev);
1010 mgmt_read_local_oob_data_complete(hdev, rp->hash192, rp->randomizer192, 1010 mgmt_read_local_oob_data_complete(hdev, rp->hash192, rp->rand192,
1011 rp->hash256, rp->randomizer256, 1011 rp->hash256, rp->rand256,
1012 rp->status); 1012 rp->status);
1013 hci_dev_unlock(hdev); 1013 hci_dev_unlock(hdev);
1014} 1014}
@@ -3996,11 +3996,9 @@ static void hci_remote_oob_data_request_evt(struct hci_dev *hdev,
3996 3996
3997 bacpy(&cp.bdaddr, &ev->bdaddr); 3997 bacpy(&cp.bdaddr, &ev->bdaddr);
3998 memcpy(cp.hash192, data->hash192, sizeof(cp.hash192)); 3998 memcpy(cp.hash192, data->hash192, sizeof(cp.hash192));
3999 memcpy(cp.randomizer192, data->randomizer192, 3999 memcpy(cp.rand192, data->rand192, sizeof(cp.rand192));
4000 sizeof(cp.randomizer192));
4001 memcpy(cp.hash256, data->hash256, sizeof(cp.hash256)); 4000 memcpy(cp.hash256, data->hash256, sizeof(cp.hash256));
4002 memcpy(cp.randomizer256, data->randomizer256, 4001 memcpy(cp.rand256, data->rand256, sizeof(cp.rand256));
4003 sizeof(cp.randomizer256));
4004 4002
4005 hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_EXT_DATA_REPLY, 4003 hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_EXT_DATA_REPLY,
4006 sizeof(cp), &cp); 4004 sizeof(cp), &cp);
@@ -4009,8 +4007,7 @@ static void hci_remote_oob_data_request_evt(struct hci_dev *hdev,
4009 4007
4010 bacpy(&cp.bdaddr, &ev->bdaddr); 4008 bacpy(&cp.bdaddr, &ev->bdaddr);
4011 memcpy(cp.hash, data->hash192, sizeof(cp.hash)); 4009 memcpy(cp.hash, data->hash192, sizeof(cp.hash));
4012 memcpy(cp.randomizer, data->randomizer192, 4010 memcpy(cp.rand, data->rand192, sizeof(cp.rand));
4013 sizeof(cp.randomizer));
4014 4011
4015 hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_REPLY, 4012 hci_send_cmd(hdev, HCI_OP_REMOTE_OOB_DATA_REPLY,
4016 sizeof(cp), &cp); 4013 sizeof(cp), &cp);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 258c9826e78c..cbeef5f62f3b 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3598,7 +3598,7 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
3598 } 3598 }
3599 3599
3600 err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr, 3600 err = hci_add_remote_oob_data(hdev, &cp->addr.bdaddr,
3601 cp->hash, cp->randomizer); 3601 cp->hash, cp->rand);
3602 if (err < 0) 3602 if (err < 0)
3603 status = MGMT_STATUS_FAILED; 3603 status = MGMT_STATUS_FAILED;
3604 else 3604 else
@@ -3619,10 +3619,8 @@ static int add_remote_oob_data(struct sock *sk, struct hci_dev *hdev,
3619 } 3619 }
3620 3620
3621 err = hci_add_remote_oob_ext_data(hdev, &cp->addr.bdaddr, 3621 err = hci_add_remote_oob_ext_data(hdev, &cp->addr.bdaddr,
3622 cp->hash192, 3622 cp->hash192, cp->rand192,
3623 cp->randomizer192, 3623 cp->hash256, cp->rand256);
3624 cp->hash256,
3625 cp->randomizer256);
3626 if (err < 0) 3624 if (err < 0)
3627 status = MGMT_STATUS_FAILED; 3625 status = MGMT_STATUS_FAILED;
3628 else 3626 else
@@ -6771,8 +6769,8 @@ void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status)
6771} 6769}
6772 6770
6773void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192, 6771void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
6774 u8 *randomizer192, u8 *hash256, 6772 u8 *rand192, u8 *hash256, u8 *rand256,
6775 u8 *randomizer256, u8 status) 6773 u8 status)
6776{ 6774{
6777 struct pending_cmd *cmd; 6775 struct pending_cmd *cmd;
6778 6776
@@ -6787,16 +6785,14 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
6787 mgmt_status(status)); 6785 mgmt_status(status));
6788 } else { 6786 } else {
6789 if (test_bit(HCI_SC_ENABLED, &hdev->dev_flags) && 6787 if (test_bit(HCI_SC_ENABLED, &hdev->dev_flags) &&
6790 hash256 && randomizer256) { 6788 hash256 && rand256) {
6791 struct mgmt_rp_read_local_oob_ext_data rp; 6789 struct mgmt_rp_read_local_oob_ext_data rp;
6792 6790
6793 memcpy(rp.hash192, hash192, sizeof(rp.hash192)); 6791 memcpy(rp.hash192, hash192, sizeof(rp.hash192));
6794 memcpy(rp.randomizer192, randomizer192, 6792 memcpy(rp.rand192, rand192, sizeof(rp.rand192));
6795 sizeof(rp.randomizer192));
6796 6793
6797 memcpy(rp.hash256, hash256, sizeof(rp.hash256)); 6794 memcpy(rp.hash256, hash256, sizeof(rp.hash256));
6798 memcpy(rp.randomizer256, randomizer256, 6795 memcpy(rp.rand256, rand256, sizeof(rp.rand256));
6799 sizeof(rp.randomizer256));
6800 6796
6801 cmd_complete(cmd->sk, hdev->id, 6797 cmd_complete(cmd->sk, hdev->id,
6802 MGMT_OP_READ_LOCAL_OOB_DATA, 0, 6798 MGMT_OP_READ_LOCAL_OOB_DATA, 0,
@@ -6805,8 +6801,7 @@ void mgmt_read_local_oob_data_complete(struct hci_dev *hdev, u8 *hash192,
6805 struct mgmt_rp_read_local_oob_data rp; 6801 struct mgmt_rp_read_local_oob_data rp;
6806 6802
6807 memcpy(rp.hash, hash192, sizeof(rp.hash)); 6803 memcpy(rp.hash, hash192, sizeof(rp.hash));
6808 memcpy(rp.randomizer, randomizer192, 6804 memcpy(rp.rand, rand192, sizeof(rp.rand));
6809 sizeof(rp.randomizer));
6810 6805
6811 cmd_complete(cmd->sk, hdev->id, 6806 cmd_complete(cmd->sk, hdev->id,
6812 MGMT_OP_READ_LOCAL_OOB_DATA, 0, 6807 MGMT_OP_READ_LOCAL_OOB_DATA, 0,