Lines Matching refs:le

381 	if (!conn->le.keys) {  in smp_keys_check()
382 conn->le.keys = bt_keys_find(BT_KEYS_LTK_P256, in smp_keys_check()
383 conn->id, &conn->le.dst); in smp_keys_check()
384 if (!conn->le.keys) { in smp_keys_check()
385 conn->le.keys = bt_keys_find(BT_KEYS_LTK, in smp_keys_check()
387 &conn->le.dst); in smp_keys_check()
391 if (!conn->le.keys || in smp_keys_check()
392 !(conn->le.keys->keys & (BT_KEYS_LTK | BT_KEYS_LTK_P256))) { in smp_keys_check()
397 !(conn->le.keys->flags & BT_KEYS_AUTHENTICATED)) { in smp_keys_check()
402 !((conn->le.keys->flags & BT_KEYS_AUTHENTICATED) && in smp_keys_check()
403 (conn->le.keys->keys & BT_KEYS_LTK_P256) && in smp_keys_check()
404 (conn->le.keys->enc_size == BT_SMP_MAX_ENC_KEY_SIZE))) { in smp_keys_check()
662 if (!conn->le.keys) { in update_debug_keys_check()
663 conn->le.keys = bt_keys_get_addr(conn->id, &conn->le.dst); in update_debug_keys_check()
666 if (!conn->le.keys || in update_debug_keys_check()
667 !(conn->le.keys->keys & (BT_KEYS_LTK_P256 | BT_KEYS_LTK))) { in update_debug_keys_check()
671 if (conn->le.keys->flags & BT_KEYS_DEBUG) { in update_debug_keys_check()
762 link_key = bt_keys_get_link_key(&conn->le.dst.a); in sc_derive_link_key()
774 if (bt_crypto_h7(salt, conn->le.keys->ltk.val, ilk)) { in sc_derive_link_key()
782 if (bt_crypto_h6(conn->le.keys->ltk.val, tmp1, ilk)) { in sc_derive_link_key()
794 if (conn->le.keys->flags & BT_KEYS_AUTHENTICATED) { in sc_derive_link_key()
1738 if (conn->le.keys == NULL) { in smp_pairing_complete()
1762 bt_keys_show_sniffer_info(conn->le.keys, NULL); in smp_pairing_complete()
1765 if (bond_flag && conn->le.keys) { in smp_pairing_complete()
1766 bt_keys_store(conn->le.keys); in smp_pairing_complete()
1782 if (conn->le.keys && in smp_pairing_complete()
1783 (!conn->le.keys->enc_size || in smp_pairing_complete()
1785 bt_keys_clear(conn->le.keys); in smp_pairing_complete()
1786 conn->le.keys = NULL; in smp_pairing_complete()
2023 struct bt_keys *keys = conn->le.keys; in legacy_distribute_keys()
2089 struct bt_keys *keys = conn->le.keys; in bt_smp_distribute_keys()
2092 LOG_ERR("No keys space for %s", bt_addr_le_str(&conn->le.dst)); in bt_smp_distribute_keys()
2277 keys = bt_keys_find_addr(conn->id, &conn->le.dst); in legacy_request_tk()
2350 &conn->le.init_addr, &conn->le.resp_addr, req->val)) { in legacy_send_pairing_confirm()
2400 &conn->le.init_addr, &conn->le.resp_addr, tmp); in legacy_pairing_random()
2530 keys = bt_keys_get_type(BT_KEYS_LTK, conn->id, &conn->le.dst); in smp_encrypt_info()
2532 LOG_ERR("Unable to get keys for %s", bt_addr_le_str(&conn->le.dst)); in smp_encrypt_info()
2555 keys = bt_keys_get_type(BT_KEYS_LTK, conn->id, &conn->le.dst); in smp_central_ident()
2557 LOG_ERR("Unable to get keys for %s", bt_addr_le_str(&conn->le.dst)); in smp_central_ident()
2815 if (!conn->le.keys) { in bt_smp_request_ltk()
2816 conn->le.keys = bt_keys_find(BT_KEYS_LTK_P256, conn->id, in bt_smp_request_ltk()
2817 &conn->le.dst); in bt_smp_request_ltk()
2818 if (!conn->le.keys) { in bt_smp_request_ltk()
2819 conn->le.keys = bt_keys_find(BT_KEYS_PERIPH_LTK, in bt_smp_request_ltk()
2820 conn->id, &conn->le.dst); in bt_smp_request_ltk()
2825 conn->le.keys && (conn->le.keys->keys & BT_KEYS_LTK_P256)) { in bt_smp_request_ltk()
2826 enc_size = conn->le.keys->enc_size; in bt_smp_request_ltk()
2828 memcpy(ltk, conn->le.keys->ltk.val, enc_size); in bt_smp_request_ltk()
2839 if (conn->le.keys && (conn->le.keys->keys & BT_KEYS_PERIPH_LTK) && in bt_smp_request_ltk()
2840 !memcmp(conn->le.keys->periph_ltk.rand, &rand, 8) && in bt_smp_request_ltk()
2841 !memcmp(conn->le.keys->periph_ltk.ediv, &ediv, 2)) { in bt_smp_request_ltk()
2842 enc_size = conn->le.keys->enc_size; in bt_smp_request_ltk()
2844 memcpy(ltk, conn->le.keys->periph_ltk.val, enc_size); in bt_smp_request_ltk()
2900 if (!conn->le.keys) { in smp_send_security_req()
2901 conn->le.keys = bt_keys_get_addr(conn->id, &conn->le.dst); in smp_send_security_req()
2902 if (!conn->le.keys) { in smp_send_security_req()
2952 if (!conn->le.keys) { in smp_pairing_req()
2953 conn->le.keys = bt_keys_get_addr(conn->id, &conn->le.dst); in smp_pairing_req()
2954 if (!conn->le.keys) { in smp_pairing_req()
2955 LOG_DBG("Unable to get keys for %s", bt_addr_le_str(&conn->le.dst)); in smp_pairing_req()
3025 if (!update_keys_check(smp, conn->le.keys)) { in smp_pairing_req()
3146 if (!conn->le.keys) { in smp_send_pairing_req()
3147 conn->le.keys = bt_keys_get_addr(conn->id, &conn->le.dst); in smp_send_pairing_req()
3148 if (!conn->le.keys) { in smp_send_pairing_req()
3253 if (!update_keys_check(smp, conn->le.keys)) { in smp_pairing_rsp()
3417 if (bt_crypto_f5(smp->dhkey, smp->prnd, smp->rrnd, &smp->chan.chan.conn->le.init_addr, in compute_and_send_central_dhcheck()
3418 &smp->chan.chan.conn->le.resp_addr, smp->mackey, smp->tk)) { in compute_and_send_central_dhcheck()
3424 &smp->chan.chan.conn->le.init_addr, &smp->chan.chan.conn->le.resp_addr, in compute_and_send_central_dhcheck()
3462 if (bt_crypto_f5(smp->dhkey, smp->rrnd, smp->prnd, &smp->chan.chan.conn->le.init_addr, in compute_and_check_and_send_periph_dhcheck()
3463 &smp->chan.chan.conn->le.resp_addr, smp->mackey, smp->tk)) { in compute_and_check_and_send_periph_dhcheck()
3470 &smp->chan.chan.conn->le.resp_addr, &smp->chan.chan.conn->le.init_addr, in compute_and_check_and_send_periph_dhcheck()
3486 &smp->chan.chan.conn->le.init_addr, &smp->chan.chan.conn->le.resp_addr, in compute_and_check_and_send_periph_dhcheck()
3863 keys = bt_keys_get_type(BT_KEYS_IRK, conn->id, &conn->le.dst); in smp_ident_info()
3865 LOG_ERR("Unable to get keys for %s", bt_addr_le_str(&conn->le.dst)); in smp_ident_info()
3926 if (bt_addr_le_eq(&conn->le.dst, addr_match->rpa)) { in convert_to_id_on_match()
3927 bt_addr_le_copy(&conn->le.dst, addr_match->id_addr); in convert_to_id_on_match()
3943 LOG_ERR(" for %s", bt_addr_le_str(&conn->le.dst)); in smp_ident_addr_info()
3947 if (!bt_addr_le_eq(&conn->le.dst, &req->addr)) { in smp_ident_addr_info()
3963 keys = bt_keys_get_type(BT_KEYS_IRK, conn->id, &conn->le.dst); in smp_ident_addr_info()
3965 LOG_ERR("Unable to get keys for %s", bt_addr_le_str(&conn->le.dst)); in smp_ident_addr_info()
3976 dst = &conn->le.resp_addr; in smp_ident_addr_info()
3978 dst = &conn->le.init_addr; in smp_ident_addr_info()
3991 if (!bt_addr_le_is_identity(&conn->le.dst)) { in smp_ident_addr_info()
3993 .rpa = &conn->le.dst, in smp_ident_addr_info()
4045 &conn->le.dst); in smp_signing_info()
4047 LOG_ERR("Unable to get keys for %s", bt_addr_le_str(&conn->le.dst)); in smp_signing_info()
4123 if (conn->le.keys) { in smp_security_request()
4125 if (!(conn->le.keys->keys & (BT_KEYS_LTK_P256 | BT_KEYS_LTK))) { in smp_security_request()
4129 conn->le.keys = bt_keys_find(BT_KEYS_LTK_P256, conn->id, in smp_security_request()
4130 &conn->le.dst); in smp_security_request()
4131 if (!conn->le.keys) { in smp_security_request()
4132 conn->le.keys = bt_keys_find(BT_KEYS_LTK, conn->id, in smp_security_request()
4133 &conn->le.dst); in smp_security_request()
4137 if (!conn->le.keys) { in smp_security_request()
4143 !(conn->le.keys->flags & BT_KEYS_AUTHENTICATED)) { in smp_security_request()
4155 !(conn->le.keys->keys & BT_KEYS_LTK_P256)) { in smp_security_request()
4160 if (bt_conn_le_start_encryption(conn, conn->le.keys->ltk.rand, in smp_security_request()
4161 conn->le.keys->ltk.ediv, in smp_security_request()
4162 conn->le.keys->ltk.val, in smp_security_request()
4163 conn->le.keys->enc_size) < 0) { in smp_security_request()
4442 &smp->chan.chan.conn->le.resp_addr, in smp_dhkey_check()
4443 &smp->chan.chan.conn->le.init_addr, e)) { in smp_dhkey_check()
4697 struct bt_keys *keys = chan->conn->le.keys; in bt_smp_disconnected()
4822 smp_err = smp_id_add_replace(smp, conn->le.keys); in bt_smp_encrypt_change()
4904 keys = bt_keys_find(BT_KEYS_REMOTE_CSRK, conn->id, &conn->le.dst); in bt_smp_sign_verify()
4906 LOG_ERR("Unable to find Remote CSRK for %s", bt_addr_le_str(&conn->le.dst)); in bt_smp_sign_verify()
4920 LOG_ERR("Unable to create signature for %s", bt_addr_le_str(&conn->le.dst)); in bt_smp_sign_verify()
4925 LOG_ERR("Unable to verify signature for %s", bt_addr_le_str(&conn->le.dst)); in bt_smp_sign_verify()
4940 keys = bt_keys_find(BT_KEYS_LOCAL_CSRK, conn->id, &conn->le.dst); in bt_smp_sign()
4942 LOG_ERR("Unable to find local CSRK for %s", bt_addr_le_str(&conn->le.dst)); in bt_smp_sign()
4958 LOG_ERR("Unable to create signature for %s", bt_addr_le_str(&conn->le.dst)); in bt_smp_sign()
5940 conn->le.keys->ltk.rand, in bt_smp_start_security()
5941 conn->le.keys->ltk.ediv, in bt_smp_start_security()
5942 conn->le.keys->ltk.val, in bt_smp_start_security()
5943 conn->le.keys->enc_size); in bt_smp_start_security()
5979 if (conn->le.keys) { in bt_smp_update_keys()
5980 bt_keys_clear(conn->le.keys); in bt_smp_update_keys()
5983 conn->le.keys = bt_keys_get_addr(conn->id, &conn->le.dst); in bt_smp_update_keys()
5984 if (!conn->le.keys) { in bt_smp_update_keys()
5985 LOG_ERR("Unable to get keys for %s", bt_addr_le_str(&conn->le.dst)); in bt_smp_update_keys()
5992 conn->le.keys->flags |= BT_KEYS_DEBUG; in bt_smp_update_keys()
6003 conn->le.keys->flags |= BT_KEYS_OOB; in bt_smp_update_keys()
6008 conn->le.keys->flags |= BT_KEYS_AUTHENTICATED; in bt_smp_update_keys()
6013 conn->le.keys->flags &= ~BT_KEYS_OOB; in bt_smp_update_keys()
6014 conn->le.keys->flags &= ~BT_KEYS_AUTHENTICATED; in bt_smp_update_keys()
6018 conn->le.keys->enc_size = get_encryption_key_size(smp); in bt_smp_update_keys()
6026 conn->le.keys->flags |= BT_KEYS_SC; in bt_smp_update_keys()
6029 bt_keys_add_type(conn->le.keys, BT_KEYS_LTK_P256); in bt_smp_update_keys()
6030 memcpy(conn->le.keys->ltk.val, smp->tk, in bt_smp_update_keys()
6031 sizeof(conn->le.keys->ltk.val)); in bt_smp_update_keys()
6032 (void)memset(conn->le.keys->ltk.rand, 0, in bt_smp_update_keys()
6033 sizeof(conn->le.keys->ltk.rand)); in bt_smp_update_keys()
6034 (void)memset(conn->le.keys->ltk.ediv, 0, in bt_smp_update_keys()
6035 sizeof(conn->le.keys->ltk.ediv)); in bt_smp_update_keys()
6039 sys_memcpy_swap(ltk, smp->tk, conn->le.keys->enc_size); in bt_smp_update_keys()
6040 LOG_INF("SC LTK: 0x%s (No bonding)", bt_hex(ltk, conn->le.keys->enc_size)); in bt_smp_update_keys()
6043 conn->le.keys->flags &= ~BT_KEYS_SC; in bt_smp_update_keys()