Lines Matching defs:hdev

39 #define SMP_DEV(hdev) \
40 ((struct smp_dev *)((struct l2cap_chan *)((hdev)->smp_data))->data)
498 bool smp_irk_matches(struct hci_dev *hdev, const u8 irk[16],
501 struct l2cap_chan *chan = hdev->smp_data;
508 bt_dev_dbg(hdev, "RPA %pMR IRK %*phN", bdaddr, 16, irk);
517 int smp_generate_rpa(struct hci_dev *hdev, const u8 irk[16], bdaddr_t *rpa)
519 struct l2cap_chan *chan = hdev->smp_data;
534 bt_dev_dbg(hdev, "RPA %pMR", rpa);
539 int smp_generate_oob(struct hci_dev *hdev, u8 hash[16], u8 rand[16])
541 struct l2cap_chan *chan = hdev->smp_data;
550 if (hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS)) {
551 bt_dev_dbg(hdev, "Using debug keys");
600 bt_dev_dbg(conn->hcon->hdev, "code 0x%2.2x", code);
655 struct hci_dev *hdev = hcon->hdev;
658 if (hci_dev_test_flag(hdev, HCI_BONDABLE)) {
666 if (hci_dev_test_flag(hdev, HCI_RPA_RESOLVING))
669 if (hci_dev_test_flag(hdev, HCI_PRIVACY))
672 if (hci_dev_test_flag(hdev, HCI_SC_ENABLED) &&
677 if (hci_dev_test_flag(hdev, HCI_SSP_ENABLED)) {
687 oob_data = hci_find_remote_oob_data(hdev, &hcon->dst,
705 req->max_key_size = hdev->le_max_key_size;
708 req->auth_req = (authreq & AUTH_REQ_MASK(hdev));
716 rsp->max_key_size = hdev->le_max_key_size;
719 rsp->auth_req = (authreq & AUTH_REQ_MASK(hdev));
727 struct hci_dev *hdev = conn->hcon->hdev;
734 if (max_key_size > hdev->le_max_key_size ||
768 !hci_dev_test_flag(hcon->hdev, HCI_KEEP_DEBUG_KEYS)) {
864 bt_dev_dbg(hcon->hdev, "auth:%u lcl:%u rem:%u", auth, local_io,
891 ret = mgmt_user_confirm_request(hcon->hdev, &hcon->dst,
930 bt_dev_dbg(hcon->hdev, "PassKey: %u", passkey);
935 ret = mgmt_user_passkey_request(hcon->hdev, &hcon->dst,
938 ret = mgmt_user_confirm_request(hcon->hdev, &hcon->dst,
942 ret = mgmt_user_passkey_notify(hcon->hdev, &hcon->dst,
955 bt_dev_dbg(conn->hcon->hdev, "conn %p", conn);
983 bt_dev_dbg(conn->hcon->hdev, "conn %p %s", conn,
993 bt_dev_err(hcon->hdev, "pairing failed "
1030 hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
1042 struct hci_dev *hdev = hcon->hdev;
1064 mgmt_new_irk(hdev, smp->remote_irk, persistent);
1076 queue_delayed_work(hdev->workqueue,
1086 mgmt_new_csrk(hdev, smp->csrk, persistent);
1093 mgmt_new_csrk(hdev, smp->responder_csrk, persistent);
1100 mgmt_new_ltk(hdev, smp->ltk, persistent);
1107 mgmt_new_ltk(hdev, smp->responder_ltk, persistent);
1121 key = hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst,
1126 mgmt_new_link_key(hdev, key, persistent);
1131 if (!hci_dev_test_flag(hdev, HCI_KEEP_DEBUG_KEYS) &&
1155 smp->ltk = hci_add_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
1215 struct hci_dev *hdev = hcon->hdev;
1218 key = hci_find_link_key(hdev, &hcon->dst);
1220 bt_dev_err(hdev, "no Link Key found to generate LTK");
1252 struct hci_dev *hdev = hcon->hdev;
1255 bt_dev_dbg(hdev, "conn %p", conn);
1285 bt_dev_dbg(hdev, "keydist 0x%x", *keydist);
1309 ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type,
1327 memcpy(idinfo.irk, hdev->irk, sizeof(idinfo.irk));
1386 bt_dev_dbg(conn->hcon->hdev, "conn %p", conn);
1403 bt_dev_err(hcon->hdev, "Unable to create CMAC crypto context");
1409 bt_dev_err(hcon->hdev, "Unable to create ECDH crypto context");
1513 struct hci_dev *hdev = hcon->hdev;
1585 bt_dev_dbg(hdev, "Starting passkey round %u",
1649 bt_dev_dbg(conn->hcon->hdev, "");
1672 bt_dev_dbg(conn->hcon->hdev, "PassKey: %u", value);
1708 struct hci_dev *hdev = conn->hcon->hdev;
1711 if (hci_dev_test_flag(hdev, HCI_BONDABLE)) {
1716 if (hci_dev_test_flag(hdev, HCI_RPA_RESOLVING))
1719 if (hci_dev_test_flag(hdev, HCI_PRIVACY))
1749 struct hci_dev *hdev = conn->hcon->hdev;
1754 bt_dev_dbg(hdev, "conn %p", conn);
1771 auth = req->auth_req & AUTH_REQ_MASK(hdev);
1773 if (!hci_dev_test_flag(hdev, HCI_BONDABLE) &&
1777 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC))
1788 if (req->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob)
1795 !hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP))
1885 struct hci_dev *hdev = smp->conn->hcon->hdev;
1887 bt_dev_dbg(hdev, "");
1890 struct l2cap_chan *chan = hdev->smp_data;
1907 if (hci_dev_test_flag(hdev, HCI_USE_DEBUG_KEYS)) {
1908 bt_dev_dbg(hdev, "Using debug keys");
1941 struct hci_dev *hdev = conn->hcon->hdev;
1945 bt_dev_dbg(hdev, "conn %p", conn);
1961 auth = rsp->auth_req & AUTH_REQ_MASK(hdev);
1963 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC))
1970 if (rsp->oob_flag == SMP_OOB_PRESENT && SMP_DEV(hdev)->local_oob)
2040 bt_dev_dbg(conn->hcon->hdev, "");
2062 struct hci_dev *hdev = hcon->hdev;
2070 if (hci_dev_test_flag(hdev, HCI_SC_ONLY)) {
2071 bt_dev_err(hdev, "refusing legacy fallback in SC-only mode");
2075 bt_dev_err(hdev, "trying to fall back to legacy SMP");
2083 auth = req->auth_req & AUTH_REQ_MASK(hdev);
2086 bt_dev_err(hdev, "failed to fall back to legacy SMP");
2100 struct hci_dev *hdev = hcon->hdev;
2102 bt_dev_dbg(hdev, "conn %p %s", conn,
2118 bt_dev_err(hdev, "Unexpected SMP Pairing Confirm");
2149 bt_dev_dbg(hcon->hdev, "conn %p", conn);
2207 if (hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type,
2242 err = mgmt_user_confirm_request(hcon->hdev, &hcon->dst, hcon->type,
2257 key = hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, hcon->role);
2290 hci_find_ltk(hcon->hdev, &hcon->dst, hcon->dst_type, hcon->role))
2304 struct hci_dev *hdev = hcon->hdev;
2308 bt_dev_dbg(hdev, "conn %p", conn);
2316 auth = rp->auth_req & AUTH_REQ_MASK(hdev);
2318 if (hci_dev_test_flag(hdev, HCI_SC_ONLY) && !(auth & SMP_AUTH_SC))
2345 if (!hci_dev_test_flag(hdev, HCI_BONDABLE) &&
2371 bt_dev_dbg(hcon->hdev, "conn %p hcon %p level 0x%2.2x", conn, hcon,
2378 if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED))
2393 bt_dev_err(hcon->hdev, "security requested but not available");
2413 if (hci_dev_test_flag(hcon->hdev, HCI_SC_ENABLED)) {
2415 if (hci_dev_test_flag(hcon->hdev, HCI_SSP_ENABLED))
2422 if (!hci_dev_test_flag(hcon->hdev, HCI_FORCE_NO_MITM)) {
2455 int smp_cancel_and_remove_pairing(struct hci_dev *hdev, bdaddr_t *bdaddr,
2464 err = hci_remove_ltk(hdev, bdaddr, addr_type);
2465 hci_remove_irk(hdev, bdaddr, addr_type);
2467 hcon = hci_conn_hash_lookup_le(hdev, bdaddr, addr_type);
2508 bt_dev_dbg(conn->hcon->hdev, "conn %p", conn);
2514 if (hci_is_blocked_key(conn->hcon->hdev, HCI_BLOCKED_KEY_TYPE_LTK,
2516 bt_dev_warn_ratelimited(conn->hcon->hdev,
2536 struct hci_dev *hdev = conn->hcon->hdev;
2541 bt_dev_dbg(hdev, "conn %p", conn);
2557 ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type, SMP_LTK,
2573 bt_dev_dbg(conn->hcon->hdev, "");
2579 if (hci_is_blocked_key(conn->hcon->hdev, HCI_BLOCKED_KEY_TYPE_IRK,
2581 bt_dev_warn_ratelimited(conn->hcon->hdev,
2605 bt_dev_dbg(hcon->hdev, "");
2630 bt_dev_err(hcon->hdev, "ignoring IRK with no identity address");
2642 bt_dev_err(hcon->hdev,
2655 smp->remote_irk = hci_add_irk(conn->hcon->hdev, &smp->id_addr,
2672 bt_dev_dbg(conn->hcon->hdev, "conn %p", conn);
2747 struct hci_dev *hdev = hcon->hdev;
2752 bt_dev_dbg(hdev, "conn %p", conn);
2762 bt_dev_err(hdev, "Remote and local public keys are identical");
2794 struct l2cap_chan *hchan = hdev->smp_data;
2816 bt_dev_dbg(hdev, "selected method 0x%02x", smp->method);
2833 if (mgmt_user_passkey_notify(hdev, &hcon->dst, hcon->type,
2856 if (mgmt_user_passkey_request(hdev, &hcon->dst, hcon->type,
2891 bt_dev_dbg(hcon->hdev, "conn %p", conn);
2951 bt_dev_dbg(conn->hcon->hdev, "value 0x%02x", kp->value);
2967 if (!hci_dev_test_flag(hcon->hdev, HCI_LE_ENABLED)) {
3048 bt_dev_dbg(hcon->hdev, "Unknown command code 0x%2.2x", code);
3063 bt_dev_err(hcon->hdev, "unexpected SMP command 0x%02x from %pMR",
3073 bt_dev_dbg(conn->hcon->hdev, "chan %p", chan);
3086 struct hci_dev *hdev = hcon->hdev;
3090 bt_dev_dbg(hdev, "chan %p", chan);
3105 if (!hci_dev_test_flag(hdev, HCI_SC_ENABLED))
3110 !hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP))
3114 if (!hci_dev_test_flag(hdev, HCI_LE_ENABLED))
3131 bt_dev_err(hdev, "unable to create SMP context for BR/EDR");
3137 bt_dev_dbg(hdev, "starting SMP over BR/EDR");
3155 bt_dev_dbg(hcon->hdev, "chan %p", chan);
3178 bt_dev_dbg(hcon->hdev, "chan %p", chan);
3196 bt_dev_dbg(chan->conn->hcon->hdev, "chan %p", chan);
3292 static struct l2cap_chan *smp_add_cid(struct hci_dev *hdev, u16 cid)
3310 bt_dev_err(hdev, "Unable to create CMAC crypto context");
3317 bt_dev_err(hdev, "Unable to create ECDH crypto context");
3347 hci_copy_identity_address(hdev, &chan->src, &bdaddr_type);
3354 bacpy(&chan->src, &hdev->bdaddr);
3386 int smp_force_bredr(struct hci_dev *hdev, bool enable)
3388 if (enable == hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP))
3394 chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR);
3398 hdev->smp_bredr_data = chan;
3402 chan = hdev->smp_bredr_data;
3403 hdev->smp_bredr_data = NULL;
3407 hci_dev_change_flag(hdev, HCI_FORCE_BREDR_SMP);
3412 int smp_register(struct hci_dev *hdev)
3416 bt_dev_dbg(hdev, "");
3421 if (!lmp_le_capable(hdev))
3424 if (WARN_ON(hdev->smp_data)) {
3425 chan = hdev->smp_data;
3426 hdev->smp_data = NULL;
3430 chan = smp_add_cid(hdev, L2CAP_CID_SMP);
3434 hdev->smp_data = chan;
3436 if (!lmp_sc_capable(hdev)) {
3438 if (!hci_dev_test_flag(hdev, HCI_FORCE_BREDR_SMP))
3442 if (WARN_ON(hdev->smp_bredr_data)) {
3443 chan = hdev->smp_bredr_data;
3444 hdev->smp_bredr_data = NULL;
3448 chan = smp_add_cid(hdev, L2CAP_CID_SMP_BREDR);
3451 chan = hdev->smp_data;
3452 hdev->smp_data = NULL;
3457 hdev->smp_bredr_data = chan;
3462 void smp_unregister(struct hci_dev *hdev)
3466 if (hdev->smp_bredr_data) {
3467 chan = hdev->smp_bredr_data;
3468 hdev->smp_bredr_data = NULL;
3472 if (hdev->smp_data) {
3473 chan = hdev->smp_data;
3474 hdev->smp_data = NULL;