Lines Matching refs:hdev

490 bool smp_irk_matches(struct hci_dev *hdev, const u8 irk[16],  in smp_irk_matches()  argument
493 struct l2cap_chan *chan = hdev->smp_data; in smp_irk_matches()
512 int smp_generate_rpa(struct hci_dev *hdev, const u8 irk[16], bdaddr_t *rpa) in smp_generate_rpa() argument
514 struct l2cap_chan *chan = hdev->smp_data; in smp_generate_rpa()
537 int smp_generate_oob(struct hci_dev *hdev, u8 hash[16], u8 rand[16]) in smp_generate_oob() argument
539 struct l2cap_chan *chan = hdev->smp_data; in smp_generate_oob()
548 if (hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS)) { in smp_generate_oob()
649 struct hci_dev *hdev = hcon->hdev; in build_pairing_cmd() local
652 if (hci_dev_test_flag(hdev, HCI_BONDABLE)) { in build_pairing_cmd()
660 if (hci_dev_test_flag(hdev, HCI_RPA_RESOLVING)) in build_pairing_cmd()
663 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) in build_pairing_cmd()
666 if (hci_dev_test_flag(hdev, HCI_SC_ENABLED) && in build_pairing_cmd()
671 if (hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) { in build_pairing_cmd()
681 oob_data = hci_find_remote_oob_data(hdev, &hcon->dst, in build_pairing_cmd()
702 req->auth_req = (authreq & AUTH_REQ_MASK(hdev)); in build_pairing_cmd()
713 rsp->auth_req = (authreq & AUTH_REQ_MASK(hdev)); in build_pairing_cmd()
757 !hci_dev_test_flag(hcon->hdev, HCI_KEEP_DEBUG_KEYS)) { in smp_chan_destroy()
917 ret = mgmt_user_passkey_request(hcon->hdev, &hcon->dst, in tk_request()
920 ret = mgmt_user_confirm_request(hcon->hdev, &hcon->dst, in tk_request()
924 ret = mgmt_user_passkey_notify(hcon->hdev, &hcon->dst, in tk_request()
1019 hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, in smp_random()
1031 struct hci_dev *hdev = hcon->hdev; in smp_notify_keys() local
1037 mgmt_new_irk(hdev, smp->remote_irk); in smp_notify_keys()
1045 queue_work(hdev->workqueue, &conn->id_addr_update_work); in smp_notify_keys()
1083 mgmt_new_csrk(hdev, smp->csrk, persistent); in smp_notify_keys()
1089 mgmt_new_csrk(hdev, smp->slave_csrk, persistent); in smp_notify_keys()
1095 mgmt_new_ltk(hdev, smp->ltk, persistent); in smp_notify_keys()
1101 mgmt_new_ltk(hdev, smp->slave_ltk, persistent); in smp_notify_keys()
1115 key = hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst, in smp_notify_keys()
1118 mgmt_new_link_key(hdev, key, persistent); in smp_notify_keys()
1123 if (!hci_dev_test_flag(hdev, HCI_KEEP_DEBUG_KEYS) && in smp_notify_keys()
1150 smp->ltk = hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, in sc_add_ltk()
1202 struct hci_dev *hdev = hcon->hdev; in sc_generate_ltk() local
1205 key = hci_find_link_key(hdev, &hcon->dst); in sc_generate_ltk()
1207 BT_ERR("%s No Link Key found to generate LTK", hdev->name); in sc_generate_ltk()
1228 struct hci_dev *hdev = hcon->hdev; in smp_distribute_keys() local
1278 ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, in smp_distribute_keys()
1295 memcpy(idinfo.irk, hdev->irk, sizeof(idinfo.irk)); in smp_distribute_keys()
1477 struct hci_dev *hdev = hcon->hdev; in sc_passkey_round() local
1549 BT_DBG("%s Starting passkey round %u", hdev->name, in sc_passkey_round()
1672 struct hci_dev *hdev = conn->hcon->hdev; in build_bredr_pairing_cmd() local
1675 if (hci_dev_test_flag(hdev, HCI_BONDABLE)) { in build_bredr_pairing_cmd()
1680 if (hci_dev_test_flag(hdev, HCI_RPA_RESOLVING)) in build_bredr_pairing_cmd()
1683 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) in build_bredr_pairing_cmd()
1711 struct hci_dev *hdev = conn->hcon->hdev; in smp_cmd_pairing_req() local
1733 auth = req->auth_req & AUTH_REQ_MASK(hdev); in smp_cmd_pairing_req()
1735 if (!hci_dev_test_flag(hdev, HCI_BONDABLE) && in smp_cmd_pairing_req()
1739 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC)) in smp_cmd_pairing_req()
1757 !hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) in smp_cmd_pairing_req()
1840 struct hci_dev *hdev = smp->conn->hcon->hdev; in sc_send_public_key() local
1845 struct l2cap_chan *chan = hdev->smp_data; in sc_send_public_key()
1863 if (hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS)) { in sc_send_public_key()
1897 struct hci_dev *hdev = conn->hcon->hdev; in smp_cmd_pairing_rsp() local
1917 auth = rsp->auth_req & AUTH_REQ_MASK(hdev); in smp_cmd_pairing_rsp()
1919 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC)) in smp_cmd_pairing_rsp()
2015 struct hci_dev *hdev = hcon->hdev; in fixup_sc_false_positive() local
2023 if (hci_dev_test_flag(hdev, HCI_SC_ONLY)) { in fixup_sc_false_positive()
2036 auth = req->auth_req & AUTH_REQ_MASK(hdev); in fixup_sc_false_positive()
2168 err = mgmt_user_confirm_request(hcon->hdev, &hcon->dst, hcon->type, in smp_cmd_pairing_random()
2183 key = hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, hcon->role); in smp_ltk_encrypt()
2216 hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, hcon->role)) in smp_sufficient_security()
2230 struct hci_dev *hdev = hcon->hdev; in smp_cmd_security_req() local
2242 auth = rp->auth_req & AUTH_REQ_MASK(hdev); in smp_cmd_security_req()
2244 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC)) in smp_cmd_security_req()
2265 if (!hci_dev_test_flag(hdev, HCI_BONDABLE) && in smp_cmd_security_req()
2297 if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED)) in smp_conn_security()
2332 if (hci_dev_test_flag(hcon->hdev, HCI_SC_ENABLED)) in smp_conn_security()
2391 struct hci_dev *hdev = conn->hcon->hdev; in smp_cmd_master_ident() local
2412 ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, SMP_LTK, in smp_cmd_master_ident()
2488 smp->remote_irk = hci_add_irk(conn->hcon->hdev, &smp->id_addr, in smp_cmd_ident_addr_info()
2580 struct hci_dev *hdev = hcon->hdev; in smp_cmd_public_key() local
2622 BT_DBG("%s selected method 0x%02x", hdev->name, smp->method); in smp_cmd_public_key()
2639 if (mgmt_user_passkey_notify(hdev, &hcon->dst, hcon->type, in smp_cmd_public_key()
2662 if (mgmt_user_passkey_request(hdev, &hcon->dst, hcon->type, in smp_cmd_public_key()
2773 if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED)) { in smp_sig_channel()
2869 BT_ERR("%s unexpected SMP command 0x%02x from %pMR", hcon->hdev->name, in smp_sig_channel()
2892 struct hci_dev *hdev = hcon->hdev; in bredr_pairing() local
2911 if (!hci_dev_test_flag(hdev, HCI_SC_ENABLED)) in bredr_pairing()
2916 !hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) in bredr_pairing()
2920 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) in bredr_pairing()
2938 hdev->name); in bredr_pairing()
2944 BT_DBG("%s starting SMP over BR/EDR", hdev->name); in bredr_pairing()
3094 static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid) in smp_add_cid() argument
3148 hci_copy_identity_address(hdev, &chan->src, &bdaddr_type); in smp_add_cid()
3155 bacpy(&chan->src, &hdev->bdaddr); in smp_add_cid()
3193 struct hci_dev *hdev = file->private_data; in force_bredr_smp_read() local
3196 buf[0] = hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP) ? 'Y': 'N'; in force_bredr_smp_read()
3206 struct hci_dev *hdev = file->private_data; in force_bredr_smp_write() local
3218 if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) in force_bredr_smp_write()
3224 chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR); in force_bredr_smp_write()
3228 hdev->smp_bredr_data = chan; in force_bredr_smp_write()
3232 chan = hdev->smp_bredr_data; in force_bredr_smp_write()
3233 hdev->smp_bredr_data = NULL; in force_bredr_smp_write()
3237 hci_dev_change_flag(hdev, HCI_FORCE_BREDR_SMP); in force_bredr_smp_write()
3249 int smp_register(struct hci_dev *hdev) in smp_register() argument
3253 BT_DBG("%s", hdev->name); in smp_register()
3258 if (!lmp_le_capable(hdev)) in smp_register()
3261 if (WARN_ON(hdev->smp_data)) { in smp_register()
3262 chan = hdev->smp_data; in smp_register()
3263 hdev->smp_data = NULL; in smp_register()
3267 chan = smp_add_cid(hdev, L2CAP_CID_SMP); in smp_register()
3271 hdev->smp_data = chan; in smp_register()
3280 if (!lmp_sc_capable(hdev)) { in smp_register()
3281 debugfs_create_file("force_bredr_smp", 0644, hdev->debugfs, in smp_register()
3282 hdev, &force_bredr_smp_fops); in smp_register()
3286 if (WARN_ON(hdev->smp_bredr_data)) { in smp_register()
3287 chan = hdev->smp_bredr_data; in smp_register()
3288 hdev->smp_bredr_data = NULL; in smp_register()
3292 chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR); in smp_register()
3295 chan = hdev->smp_data; in smp_register()
3296 hdev->smp_data = NULL; in smp_register()
3301 hdev->smp_bredr_data = chan; in smp_register()
3306 void smp_unregister(struct hci_dev *hdev) in smp_unregister() argument
3310 if (hdev->smp_bredr_data) { in smp_unregister()
3311 chan = hdev->smp_bredr_data; in smp_unregister()
3312 hdev->smp_bredr_data = NULL; in smp_unregister()
3316 if (hdev->smp_data) { in smp_unregister()
3317 chan = hdev->smp_data; in smp_unregister()
3318 hdev->smp_data = NULL; in smp_unregister()