Lines Matching refs:hdev
36 #define SMP_DEV(hdev) \ argument
37 ((struct smp_dev *)((struct l2cap_chan *)((hdev)->smp_data))->data)
508 bool smp_irk_matches(struct hci_dev *hdev, const u8 irk[16], in smp_irk_matches() argument
511 struct l2cap_chan *chan = hdev->smp_data; in smp_irk_matches()
530 int smp_generate_rpa(struct hci_dev *hdev, const u8 irk[16], bdaddr_t *rpa) in smp_generate_rpa() argument
532 struct l2cap_chan *chan = hdev->smp_data; in smp_generate_rpa()
555 int smp_generate_oob(struct hci_dev *hdev, u8 hash[16], u8 rand[16]) in smp_generate_oob() argument
557 struct l2cap_chan *chan = hdev->smp_data; in smp_generate_oob()
566 if (hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS)) { in smp_generate_oob()
667 struct hci_dev *hdev = hcon->hdev; in build_pairing_cmd() local
670 if (hci_dev_test_flag(hdev, HCI_BONDABLE)) { in build_pairing_cmd()
678 if (hci_dev_test_flag(hdev, HCI_RPA_RESOLVING)) in build_pairing_cmd()
681 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) in build_pairing_cmd()
684 if (hci_dev_test_flag(hdev, HCI_SC_ENABLED) && in build_pairing_cmd()
689 if (hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) { in build_pairing_cmd()
699 oob_data = hci_find_remote_oob_data(hdev, &hcon->dst, in build_pairing_cmd()
717 req->max_key_size = SMP_DEV(hdev)->max_key_size; in build_pairing_cmd()
720 req->auth_req = (authreq & AUTH_REQ_MASK(hdev)); in build_pairing_cmd()
728 rsp->max_key_size = SMP_DEV(hdev)->max_key_size; in build_pairing_cmd()
731 rsp->auth_req = (authreq & AUTH_REQ_MASK(hdev)); in build_pairing_cmd()
739 struct hci_dev *hdev = conn->hcon->hdev; in check_enc_key_size() local
742 if (max_key_size > SMP_DEV(hdev)->max_key_size || in check_enc_key_size()
776 !hci_dev_test_flag(hcon->hdev, HCI_KEEP_DEBUG_KEYS)) { in smp_chan_destroy()
935 ret = mgmt_user_passkey_request(hcon->hdev, &hcon->dst, in tk_request()
938 ret = mgmt_user_confirm_request(hcon->hdev, &hcon->dst, in tk_request()
942 ret = mgmt_user_passkey_notify(hcon->hdev, &hcon->dst, in tk_request()
1031 hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, in smp_random()
1043 struct hci_dev *hdev = hcon->hdev; in smp_notify_keys() local
1064 mgmt_new_irk(hdev, smp->remote_irk, persistent); in smp_notify_keys()
1073 queue_work(hdev->workqueue, &conn->id_addr_update_work); in smp_notify_keys()
1080 mgmt_new_csrk(hdev, smp->csrk, persistent); in smp_notify_keys()
1086 mgmt_new_csrk(hdev, smp->slave_csrk, persistent); in smp_notify_keys()
1092 mgmt_new_ltk(hdev, smp->ltk, persistent); in smp_notify_keys()
1098 mgmt_new_ltk(hdev, smp->slave_ltk, persistent); in smp_notify_keys()
1112 key = hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst, in smp_notify_keys()
1115 mgmt_new_link_key(hdev, key, persistent); in smp_notify_keys()
1120 if (!hci_dev_test_flag(hdev, HCI_KEEP_DEBUG_KEYS) && in smp_notify_keys()
1144 smp->ltk = hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, in sc_add_ltk()
1196 struct hci_dev *hdev = hcon->hdev; in sc_generate_ltk() local
1199 key = hci_find_link_key(hdev, &hcon->dst); in sc_generate_ltk()
1201 BT_ERR("%s No Link Key found to generate LTK", hdev->name); in sc_generate_ltk()
1222 struct hci_dev *hdev = hcon->hdev; in smp_distribute_keys() local
1279 ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, in smp_distribute_keys()
1296 memcpy(idinfo.irk, hdev->irk, sizeof(idinfo.irk)); in smp_distribute_keys()
1478 struct hci_dev *hdev = hcon->hdev; in sc_passkey_round() local
1550 BT_DBG("%s Starting passkey round %u", hdev->name, in sc_passkey_round()
1673 struct hci_dev *hdev = conn->hcon->hdev; in build_bredr_pairing_cmd() local
1676 if (hci_dev_test_flag(hdev, HCI_BONDABLE)) { in build_bredr_pairing_cmd()
1681 if (hci_dev_test_flag(hdev, HCI_RPA_RESOLVING)) in build_bredr_pairing_cmd()
1684 if (hci_dev_test_flag(hdev, HCI_PRIVACY)) in build_bredr_pairing_cmd()
1712 struct hci_dev *hdev = conn->hcon->hdev; in smp_cmd_pairing_req() local
1734 auth = req->auth_req & AUTH_REQ_MASK(hdev); in smp_cmd_pairing_req()
1736 if (!hci_dev_test_flag(hdev, HCI_BONDABLE) && in smp_cmd_pairing_req()
1740 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC)) in smp_cmd_pairing_req()
1758 !hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) in smp_cmd_pairing_req()
1841 struct hci_dev *hdev = smp->conn->hcon->hdev; in sc_send_public_key() local
1846 struct l2cap_chan *chan = hdev->smp_data; in sc_send_public_key()
1864 if (hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS)) { in sc_send_public_key()
1898 struct hci_dev *hdev = conn->hcon->hdev; in smp_cmd_pairing_rsp() local
1918 auth = rsp->auth_req & AUTH_REQ_MASK(hdev); in smp_cmd_pairing_rsp()
1920 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC)) in smp_cmd_pairing_rsp()
2016 struct hci_dev *hdev = hcon->hdev; in fixup_sc_false_positive() local
2024 if (hci_dev_test_flag(hdev, HCI_SC_ONLY)) { in fixup_sc_false_positive()
2037 auth = req->auth_req & AUTH_REQ_MASK(hdev); in fixup_sc_false_positive()
2169 err = mgmt_user_confirm_request(hcon->hdev, &hcon->dst, hcon->type, in smp_cmd_pairing_random()
2184 key = hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, hcon->role); in smp_ltk_encrypt()
2217 hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, hcon->role)) in smp_sufficient_security()
2231 struct hci_dev *hdev = hcon->hdev; in smp_cmd_security_req() local
2243 auth = rp->auth_req & AUTH_REQ_MASK(hdev); in smp_cmd_security_req()
2245 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC)) in smp_cmd_security_req()
2266 if (!hci_dev_test_flag(hdev, HCI_BONDABLE) && in smp_cmd_security_req()
2298 if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED)) in smp_conn_security()
2333 if (hci_dev_test_flag(hcon->hdev, HCI_SC_ENABLED)) in smp_conn_security()
2418 struct hci_dev *hdev = conn->hcon->hdev; in smp_cmd_master_ident() local
2439 ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, SMP_LTK, in smp_cmd_master_ident()
2515 smp->remote_irk = hci_add_irk(conn->hcon->hdev, &smp->id_addr, in smp_cmd_ident_addr_info()
2607 struct hci_dev *hdev = hcon->hdev; in smp_cmd_public_key() local
2649 BT_DBG("%s selected method 0x%02x", hdev->name, smp->method); in smp_cmd_public_key()
2666 if (mgmt_user_passkey_notify(hdev, &hcon->dst, hcon->type, in smp_cmd_public_key()
2689 if (mgmt_user_passkey_request(hdev, &hcon->dst, hcon->type, in smp_cmd_public_key()
2800 if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED)) { in smp_sig_channel()
2896 BT_ERR("%s unexpected SMP command 0x%02x from %pMR", hcon->hdev->name, in smp_sig_channel()
2919 struct hci_dev *hdev = hcon->hdev; in bredr_pairing() local
2938 if (!hci_dev_test_flag(hdev, HCI_SC_ENABLED)) in bredr_pairing()
2943 !hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) in bredr_pairing()
2947 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED)) in bredr_pairing()
2965 hdev->name); in bredr_pairing()
2971 BT_DBG("%s starting SMP over BR/EDR", hdev->name); in bredr_pairing()
3126 static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid) in smp_add_cid() argument
3182 hci_copy_identity_address(hdev, &chan->src, &bdaddr_type); in smp_add_cid()
3189 bacpy(&chan->src, &hdev->bdaddr); in smp_add_cid()
3227 struct hci_dev *hdev = file->private_data; in force_bredr_smp_read() local
3230 buf[0] = hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP) ? 'Y': 'N'; in force_bredr_smp_read()
3240 struct hci_dev *hdev = file->private_data; in force_bredr_smp_write() local
3252 if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP)) in force_bredr_smp_write()
3258 chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR); in force_bredr_smp_write()
3262 hdev->smp_bredr_data = chan; in force_bredr_smp_write()
3266 chan = hdev->smp_bredr_data; in force_bredr_smp_write()
3267 hdev->smp_bredr_data = NULL; in force_bredr_smp_write()
3271 hci_dev_change_flag(hdev, HCI_FORCE_BREDR_SMP); in force_bredr_smp_write()
3287 struct hci_dev *hdev = file->private_data; in le_min_key_size_read() local
3290 snprintf(buf, sizeof(buf), "%2u\n", SMP_DEV(hdev)->min_key_size); in le_min_key_size_read()
3299 struct hci_dev *hdev = file->private_data; in le_min_key_size_write() local
3311 if (key_size > SMP_DEV(hdev)->max_key_size || in le_min_key_size_write()
3315 SMP_DEV(hdev)->min_key_size = key_size; in le_min_key_size_write()
3331 struct hci_dev *hdev = file->private_data; in le_max_key_size_read() local
3334 snprintf(buf, sizeof(buf), "%2u\n", SMP_DEV(hdev)->max_key_size); in le_max_key_size_read()
3343 struct hci_dev *hdev = file->private_data; in le_max_key_size_write() local
3356 key_size < SMP_DEV(hdev)->min_key_size) in le_max_key_size_write()
3359 SMP_DEV(hdev)->max_key_size = key_size; in le_max_key_size_write()
3371 int smp_register(struct hci_dev *hdev) in smp_register() argument
3375 BT_DBG("%s", hdev->name); in smp_register()
3380 if (!lmp_le_capable(hdev)) in smp_register()
3383 if (WARN_ON(hdev->smp_data)) { in smp_register()
3384 chan = hdev->smp_data; in smp_register()
3385 hdev->smp_data = NULL; in smp_register()
3389 chan = smp_add_cid(hdev, L2CAP_CID_SMP); in smp_register()
3393 hdev->smp_data = chan; in smp_register()
3395 debugfs_create_file("le_min_key_size", 0644, hdev->debugfs, hdev, in smp_register()
3397 debugfs_create_file("le_max_key_size", 0644, hdev->debugfs, hdev, in smp_register()
3407 if (!lmp_sc_capable(hdev)) { in smp_register()
3408 debugfs_create_file("force_bredr_smp", 0644, hdev->debugfs, in smp_register()
3409 hdev, &force_bredr_smp_fops); in smp_register()
3413 if (WARN_ON(hdev->smp_bredr_data)) { in smp_register()
3414 chan = hdev->smp_bredr_data; in smp_register()
3415 hdev->smp_bredr_data = NULL; in smp_register()
3419 chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR); in smp_register()
3422 chan = hdev->smp_data; in smp_register()
3423 hdev->smp_data = NULL; in smp_register()
3428 hdev->smp_bredr_data = chan; in smp_register()
3433 void smp_unregister(struct hci_dev *hdev) in smp_unregister() argument
3437 if (hdev->smp_bredr_data) { in smp_unregister()
3438 chan = hdev->smp_bredr_data; in smp_unregister()
3439 hdev->smp_bredr_data = NULL; in smp_unregister()
3443 if (hdev->smp_data) { in smp_unregister()
3444 chan = hdev->smp_data; in smp_unregister()
3445 hdev->smp_data = NULL; in smp_unregister()