Loading system/stack/btm/btm_ble.cc +3 −7 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ void read_phy_cb( uint8_t status, tx_phy, rx_phy; uint16_t handle; LOG_ASSERT(len == 5) << "Received bad response length: " << len; ASSERT_LOG(len == 5, "Received bad response length:%d", len); uint8_t* pp = data; STREAM_TO_UINT8(status, pp); STREAM_TO_UINT16(handle, pp); Loading @@ -161,10 +161,8 @@ void read_phy_cb( void BTM_BleReadPhy( const RawAddress& bd_addr, base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb) { LOG_VERBOSE("%s", __func__); if (!BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) { LOG_ERROR("%s: Wrong mode: no LE link exist or LE not supported", __func__); LOG_ERROR("Wrong mode: no LE link exist or LE not supported"); cb.Run(0, 0, HCI_ERR_NO_CONNECTION); return; } Loading @@ -172,8 +170,7 @@ void BTM_BleReadPhy( // checking if local controller supports it! if (!controller_get_interface()->SupportsBle2mPhy() && !controller_get_interface()->SupportsBleCodedPhy()) { LOG_ERROR("%s failed, request not supported in local controller!", __func__); LOG_ERROR("request not supported in local controller!"); cb.Run(0, 0, GATT_REQ_NOT_SUPPORTED); return; } Loading @@ -186,7 +183,6 @@ void BTM_BleReadPhy( UINT16_TO_STREAM(pp, handle); btu_hcif_send_cmd_with_cb(FROM_HERE, HCI_BLE_READ_PHY, data, len, base::Bind(&read_phy_cb, std::move(cb))); return; } void doNothing(uint8_t* data, uint16_t len) {} Loading system/stack/btm/btm_ble_addr.cc +8 −7 Original line number Diff line number Diff line Loading @@ -205,9 +205,8 @@ static tBTM_SEC_DEV_REC* btm_find_dev_by_identity_addr( if (p_dev_rec->ble.identity_address_with_type.bda == bd_addr) { if ((p_dev_rec->ble.identity_address_with_type.type & (~BLE_ADDR_TYPE_ID_BIT)) != (addr_type & (~BLE_ADDR_TYPE_ID_BIT))) LOG_WARN("%s find pseudo->random match with diff addr type: %d vs %d", __func__, p_dev_rec->ble.identity_address_with_type.type, addr_type); LOG_WARN("pseudo->random match with diff addr type: %d vs %d", p_dev_rec->ble.identity_address_with_type.type, addr_type); /* found the match */ return p_dev_rec; Loading Loading @@ -294,7 +293,7 @@ void btm_ble_refresh_peer_resolvable_private_addr( tBLE_RAND_ADDR_TYPE rra_type) { tBTM_SEC_DEV_REC* p_sec_rec = btm_find_dev(pseudo_bda); if (p_sec_rec == nullptr) { LOG_WARN("%s No matching known device in record", __func__); LOG_WARN("No matching known device in record"); return; } Loading @@ -317,7 +316,7 @@ void btm_ble_refresh_peer_resolvable_private_addr( if (!acl_refresh_remote_address(identity_address, identity_address_type, p_sec_rec->ble.pseudo_addr, rra_type, rpa)) { LOG_ERROR("%s Unknown device to refresh remote device", __func__); LOG_ERROR("Unknown device to refresh remote device"); } } } Loading @@ -342,7 +341,8 @@ bool maybe_resolve_address(RawAddress* bda, tBLE_ADDR_TYPE* bda_type) { if (!is_in_security_db && addr_is_rpa) { tBTM_SEC_DEV_REC* match_rec = btm_ble_resolve_random_addr(*bda); if (match_rec) { LOG(INFO) << __func__ << ": matched and resolved random address"; LOG_INFO("matched/resolved random address:%s", ADDRESS_TO_LOGGABLE_CSTR(*bda)); is_in_security_db = true; match_rec->ble.active_addr_type = BTM_BLE_ADDR_RRA; match_rec->ble.cur_rand_addr = *bda; Loading @@ -354,7 +354,8 @@ bool maybe_resolve_address(RawAddress* bda, tBLE_ADDR_TYPE* bda_type) { *bda = match_rec->bd_addr; } } else { LOG(INFO) << __func__ << ": unable to match and resolve random address"; LOG_INFO("unable to match/resolve random address:%s", ADDRESS_TO_LOGGABLE_CSTR(*bda)); } } return is_in_security_db; Loading system/stack/btm/btm_ble_privacy.cc +12 −14 Original line number Diff line number Diff line Loading @@ -181,7 +181,7 @@ static uint8_t btm_ble_find_irk_index(void) { i++; } LOG_ERROR("%s failed, list full", __func__); LOG_ERROR("no index found"); return i; } Loading Loading @@ -239,7 +239,7 @@ void btm_ble_clear_resolving_list_complete(uint8_t* p, uint16_t evt_len) { STREAM_TO_UINT8(status, p); LOG_VERBOSE("%s status=%d", __func__, status); LOG_VERBOSE("status=%d", status); if (status == HCI_SUCCESS) { if (evt_len >= 3) { Loading @@ -262,7 +262,7 @@ void btm_ble_clear_resolving_list_complete(uint8_t* p, uint16_t evt_len) { btm_cb.ble_ctr_cb.resolving_list_avail_size = controller_get_interface()->get_ble_resolving_list_max_size(); LOG_VERBOSE("%s resolving_list_avail_size=%d", __func__, LOG_VERBOSE("resolving_list_avail_size=%d", btm_cb.ble_ctr_cb.resolving_list_avail_size); list_foreach(btm_sec_cb.sec_dev_rec, clear_resolving_list_bit, NULL); Loading @@ -289,7 +289,7 @@ void btm_ble_add_resolving_list_entry_complete(uint8_t* p, uint16_t evt_len) { STREAM_TO_UINT8(status, p); LOG_VERBOSE("%s status = %d", __func__, status); LOG_VERBOSE("status=%d", status); RawAddress pseudo_bda; if (!btm_ble_deq_resolving_pending(pseudo_bda)) { Loading @@ -310,7 +310,7 @@ void btm_ble_add_resolving_list_entry_complete(uint8_t* p, uint16_t evt_len) { HCI_ERR_MEMORY_FULL) /* BT_ERROR_CODE_MEMORY_CAPACITY_EXCEEDED */ { btm_cb.ble_ctr_cb.resolving_list_avail_size = 0; LOG_VERBOSE("%s Resolving list Full ", __func__); LOG_VERBOSE("Resolving list Full"); } } Loading @@ -331,10 +331,10 @@ void btm_ble_remove_resolving_list_entry_complete(uint8_t* p, STREAM_TO_UINT8(status, p); LOG_VERBOSE("%s status = %d", __func__, status); LOG_VERBOSE("status=%d", status); if (!btm_ble_deq_resolving_pending(pseudo_bda)) { LOG_ERROR("%s no pending resolving list operation", __func__); LOG_ERROR("no pending resolving list operation"); return; } Loading Loading @@ -365,7 +365,7 @@ void btm_ble_read_resolving_list_entry_complete(const uint8_t* p, STREAM_TO_UINT8(status, p); LOG_VERBOSE("%s status = %d", __func__, status); LOG_VERBOSE("status=%d", status); if (!btm_ble_deq_resolving_pending(pseudo_bda)) { LOG_ERROR("no pending resolving list operation"); Loading @@ -379,7 +379,7 @@ void btm_ble_read_resolving_list_entry_complete(const uint8_t* p, p += (2 + 16 + 1 + 6); STREAM_TO_BDADDR(rra, p); VLOG(2) << __func__ << " peer_addr: " << rra; LOG_INFO("peer_addr:%s", ADDRESS_TO_LOGGABLE_CSTR(rra)); } else { STREAM_TO_BDADDR(rra, p); } Loading Loading @@ -407,7 +407,7 @@ static void btm_ble_resolving_list_vsc_op_cmpl(tBTM_VSC_CMPL* p_params) { op_subcode = *(p + 1); LOG_VERBOSE("%s op_subcode = %d", __func__, op_subcode); LOG_VERBOSE("op_subcode=%d", op_subcode); if (op_subcode == BTM_BLE_META_CLEAR_IRK_LIST) { btm_ble_clear_resolving_list_complete(p, evt_len); Loading Loading @@ -500,8 +500,7 @@ bool btm_ble_read_resolving_list_entry(tBTM_SEC_DEV_REC* p_dev_rec) { return false; } if (!(p_dev_rec->ble.in_controller_list & BTM_RESOLVING_LIST_BIT)) { LOG_INFO("%s Unable to read resolving list entry as resolving bit not set", __func__); LOG_INFO("Unable to read resolving list entry as resolving bit not set"); return false; } Loading Loading @@ -618,7 +617,6 @@ void btm_ble_resolving_list_remove_dev(tBTM_SEC_DEV_REC* p_dev_rec) { LOG_DEBUG("Privacy 1.2 is not enabled"); return; } LOG_VERBOSE("%s", __func__); if ((p_dev_rec->ble.in_controller_list & BTM_RESOLVING_LIST_BIT) && !btm_ble_brcm_find_resolving_pending_entry( Loading Loading @@ -658,7 +656,7 @@ void btm_ble_resolving_list_init(uint8_t max_irk_list_sz) { // NOTE: This memory is never freed btm_cb.ble_ctr_cb.irk_list_mask = (uint8_t*)osi_malloc(irk_mask_size); LOG_VERBOSE("%s max_irk_list_sz = %d", __func__, max_irk_list_sz); LOG_VERBOSE("max_irk_list_sz=%d", max_irk_list_sz); } controller_get_interface()->set_ble_resolving_list_max_size(max_irk_list_sz); Loading system/stack/btm/btm_ble_sec.cc +3 −2 Original line number Diff line number Diff line Loading @@ -1360,7 +1360,7 @@ void btm_ble_ltk_request_reply(const RawAddress& bda, bool use_stk, tBTM_SEC_DEV_REC* p_rec = btm_find_dev(bda); tBTM_SEC_CB* p_cb = &btm_sec_cb; LOG_VERBOSE("bd_addr:%s, use_stk:%d", ADDRESS_TO_LOGGABLE_CSTR(bda), use_stk); LOG_DEBUG("bd_addr:%s,use_stk:%d", ADDRESS_TO_LOGGABLE_CSTR(bda), use_stk); if (p_rec == NULL) { LOG_ERROR("unknown device"); Loading Loading @@ -1395,7 +1395,8 @@ void btm_ble_ltk_request_reply(const RawAddress& bda, bool use_stk, * end up here. We will eventually consolidate both entries, this is to avoid * race conditions. */ LOG_ASSERT(p_rec->sec_rec.ble_keys.key_type & BTM_LE_KEY_LENC); ASSERT_LOG(p_rec->sec_rec.ble_keys.key_type & BTM_LE_KEY_LENC, "local enccryption key not present"); p_cb->key_size = p_rec->sec_rec.ble_keys.key_size; btsnd_hcic_ble_ltk_req_reply(btm_sec_cb.enc_handle, p_rec->sec_rec.ble_keys.lltk); Loading system/stack/btm/security_device_record.h +2 −6 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ #pragma once #include <base/logging.h> #include <base/strings/stringprintf.h> #include <cstdint> Loading @@ -26,15 +25,13 @@ #include "internal_include/bt_target.h" #include "macros.h" #include "os/logging/log_adapter.h" #include "os/log.h" #include "stack/include/bt_device_type.h" #include "stack/include/bt_name.h" #include "stack/include/bt_octets.h" #include "stack/include/btm_sec_api_types.h" #include "stack/include/btm_status.h" #include "stack/include/hci_error_code.h" #include "types/ble_address_with_type.h" #include "types/hci_role.h" #include "types/raw_address.h" #include "types/remote_version_type.h" Loading Loading @@ -116,8 +113,7 @@ class tBTM_BLE_ADDR_INFO { if (is_ble_addr_type_known(ble_addr_type)) { ble_addr_type_ = ble_addr_type; } else { LOG(ERROR) << "Please don't store illegal addresses into security record:" << AddressTypeText(ble_addr_type); LOG_ERROR("Unknown address type:0x%x", ble_addr_type); } } Loading Loading
system/stack/btm/btm_ble.cc +3 −7 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ void read_phy_cb( uint8_t status, tx_phy, rx_phy; uint16_t handle; LOG_ASSERT(len == 5) << "Received bad response length: " << len; ASSERT_LOG(len == 5, "Received bad response length:%d", len); uint8_t* pp = data; STREAM_TO_UINT8(status, pp); STREAM_TO_UINT16(handle, pp); Loading @@ -161,10 +161,8 @@ void read_phy_cb( void BTM_BleReadPhy( const RawAddress& bd_addr, base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb) { LOG_VERBOSE("%s", __func__); if (!BTM_IsAclConnectionUp(bd_addr, BT_TRANSPORT_LE)) { LOG_ERROR("%s: Wrong mode: no LE link exist or LE not supported", __func__); LOG_ERROR("Wrong mode: no LE link exist or LE not supported"); cb.Run(0, 0, HCI_ERR_NO_CONNECTION); return; } Loading @@ -172,8 +170,7 @@ void BTM_BleReadPhy( // checking if local controller supports it! if (!controller_get_interface()->SupportsBle2mPhy() && !controller_get_interface()->SupportsBleCodedPhy()) { LOG_ERROR("%s failed, request not supported in local controller!", __func__); LOG_ERROR("request not supported in local controller!"); cb.Run(0, 0, GATT_REQ_NOT_SUPPORTED); return; } Loading @@ -186,7 +183,6 @@ void BTM_BleReadPhy( UINT16_TO_STREAM(pp, handle); btu_hcif_send_cmd_with_cb(FROM_HERE, HCI_BLE_READ_PHY, data, len, base::Bind(&read_phy_cb, std::move(cb))); return; } void doNothing(uint8_t* data, uint16_t len) {} Loading
system/stack/btm/btm_ble_addr.cc +8 −7 Original line number Diff line number Diff line Loading @@ -205,9 +205,8 @@ static tBTM_SEC_DEV_REC* btm_find_dev_by_identity_addr( if (p_dev_rec->ble.identity_address_with_type.bda == bd_addr) { if ((p_dev_rec->ble.identity_address_with_type.type & (~BLE_ADDR_TYPE_ID_BIT)) != (addr_type & (~BLE_ADDR_TYPE_ID_BIT))) LOG_WARN("%s find pseudo->random match with diff addr type: %d vs %d", __func__, p_dev_rec->ble.identity_address_with_type.type, addr_type); LOG_WARN("pseudo->random match with diff addr type: %d vs %d", p_dev_rec->ble.identity_address_with_type.type, addr_type); /* found the match */ return p_dev_rec; Loading Loading @@ -294,7 +293,7 @@ void btm_ble_refresh_peer_resolvable_private_addr( tBLE_RAND_ADDR_TYPE rra_type) { tBTM_SEC_DEV_REC* p_sec_rec = btm_find_dev(pseudo_bda); if (p_sec_rec == nullptr) { LOG_WARN("%s No matching known device in record", __func__); LOG_WARN("No matching known device in record"); return; } Loading @@ -317,7 +316,7 @@ void btm_ble_refresh_peer_resolvable_private_addr( if (!acl_refresh_remote_address(identity_address, identity_address_type, p_sec_rec->ble.pseudo_addr, rra_type, rpa)) { LOG_ERROR("%s Unknown device to refresh remote device", __func__); LOG_ERROR("Unknown device to refresh remote device"); } } } Loading @@ -342,7 +341,8 @@ bool maybe_resolve_address(RawAddress* bda, tBLE_ADDR_TYPE* bda_type) { if (!is_in_security_db && addr_is_rpa) { tBTM_SEC_DEV_REC* match_rec = btm_ble_resolve_random_addr(*bda); if (match_rec) { LOG(INFO) << __func__ << ": matched and resolved random address"; LOG_INFO("matched/resolved random address:%s", ADDRESS_TO_LOGGABLE_CSTR(*bda)); is_in_security_db = true; match_rec->ble.active_addr_type = BTM_BLE_ADDR_RRA; match_rec->ble.cur_rand_addr = *bda; Loading @@ -354,7 +354,8 @@ bool maybe_resolve_address(RawAddress* bda, tBLE_ADDR_TYPE* bda_type) { *bda = match_rec->bd_addr; } } else { LOG(INFO) << __func__ << ": unable to match and resolve random address"; LOG_INFO("unable to match/resolve random address:%s", ADDRESS_TO_LOGGABLE_CSTR(*bda)); } } return is_in_security_db; Loading
system/stack/btm/btm_ble_privacy.cc +12 −14 Original line number Diff line number Diff line Loading @@ -181,7 +181,7 @@ static uint8_t btm_ble_find_irk_index(void) { i++; } LOG_ERROR("%s failed, list full", __func__); LOG_ERROR("no index found"); return i; } Loading Loading @@ -239,7 +239,7 @@ void btm_ble_clear_resolving_list_complete(uint8_t* p, uint16_t evt_len) { STREAM_TO_UINT8(status, p); LOG_VERBOSE("%s status=%d", __func__, status); LOG_VERBOSE("status=%d", status); if (status == HCI_SUCCESS) { if (evt_len >= 3) { Loading @@ -262,7 +262,7 @@ void btm_ble_clear_resolving_list_complete(uint8_t* p, uint16_t evt_len) { btm_cb.ble_ctr_cb.resolving_list_avail_size = controller_get_interface()->get_ble_resolving_list_max_size(); LOG_VERBOSE("%s resolving_list_avail_size=%d", __func__, LOG_VERBOSE("resolving_list_avail_size=%d", btm_cb.ble_ctr_cb.resolving_list_avail_size); list_foreach(btm_sec_cb.sec_dev_rec, clear_resolving_list_bit, NULL); Loading @@ -289,7 +289,7 @@ void btm_ble_add_resolving_list_entry_complete(uint8_t* p, uint16_t evt_len) { STREAM_TO_UINT8(status, p); LOG_VERBOSE("%s status = %d", __func__, status); LOG_VERBOSE("status=%d", status); RawAddress pseudo_bda; if (!btm_ble_deq_resolving_pending(pseudo_bda)) { Loading @@ -310,7 +310,7 @@ void btm_ble_add_resolving_list_entry_complete(uint8_t* p, uint16_t evt_len) { HCI_ERR_MEMORY_FULL) /* BT_ERROR_CODE_MEMORY_CAPACITY_EXCEEDED */ { btm_cb.ble_ctr_cb.resolving_list_avail_size = 0; LOG_VERBOSE("%s Resolving list Full ", __func__); LOG_VERBOSE("Resolving list Full"); } } Loading @@ -331,10 +331,10 @@ void btm_ble_remove_resolving_list_entry_complete(uint8_t* p, STREAM_TO_UINT8(status, p); LOG_VERBOSE("%s status = %d", __func__, status); LOG_VERBOSE("status=%d", status); if (!btm_ble_deq_resolving_pending(pseudo_bda)) { LOG_ERROR("%s no pending resolving list operation", __func__); LOG_ERROR("no pending resolving list operation"); return; } Loading Loading @@ -365,7 +365,7 @@ void btm_ble_read_resolving_list_entry_complete(const uint8_t* p, STREAM_TO_UINT8(status, p); LOG_VERBOSE("%s status = %d", __func__, status); LOG_VERBOSE("status=%d", status); if (!btm_ble_deq_resolving_pending(pseudo_bda)) { LOG_ERROR("no pending resolving list operation"); Loading @@ -379,7 +379,7 @@ void btm_ble_read_resolving_list_entry_complete(const uint8_t* p, p += (2 + 16 + 1 + 6); STREAM_TO_BDADDR(rra, p); VLOG(2) << __func__ << " peer_addr: " << rra; LOG_INFO("peer_addr:%s", ADDRESS_TO_LOGGABLE_CSTR(rra)); } else { STREAM_TO_BDADDR(rra, p); } Loading Loading @@ -407,7 +407,7 @@ static void btm_ble_resolving_list_vsc_op_cmpl(tBTM_VSC_CMPL* p_params) { op_subcode = *(p + 1); LOG_VERBOSE("%s op_subcode = %d", __func__, op_subcode); LOG_VERBOSE("op_subcode=%d", op_subcode); if (op_subcode == BTM_BLE_META_CLEAR_IRK_LIST) { btm_ble_clear_resolving_list_complete(p, evt_len); Loading Loading @@ -500,8 +500,7 @@ bool btm_ble_read_resolving_list_entry(tBTM_SEC_DEV_REC* p_dev_rec) { return false; } if (!(p_dev_rec->ble.in_controller_list & BTM_RESOLVING_LIST_BIT)) { LOG_INFO("%s Unable to read resolving list entry as resolving bit not set", __func__); LOG_INFO("Unable to read resolving list entry as resolving bit not set"); return false; } Loading Loading @@ -618,7 +617,6 @@ void btm_ble_resolving_list_remove_dev(tBTM_SEC_DEV_REC* p_dev_rec) { LOG_DEBUG("Privacy 1.2 is not enabled"); return; } LOG_VERBOSE("%s", __func__); if ((p_dev_rec->ble.in_controller_list & BTM_RESOLVING_LIST_BIT) && !btm_ble_brcm_find_resolving_pending_entry( Loading Loading @@ -658,7 +656,7 @@ void btm_ble_resolving_list_init(uint8_t max_irk_list_sz) { // NOTE: This memory is never freed btm_cb.ble_ctr_cb.irk_list_mask = (uint8_t*)osi_malloc(irk_mask_size); LOG_VERBOSE("%s max_irk_list_sz = %d", __func__, max_irk_list_sz); LOG_VERBOSE("max_irk_list_sz=%d", max_irk_list_sz); } controller_get_interface()->set_ble_resolving_list_max_size(max_irk_list_sz); Loading
system/stack/btm/btm_ble_sec.cc +3 −2 Original line number Diff line number Diff line Loading @@ -1360,7 +1360,7 @@ void btm_ble_ltk_request_reply(const RawAddress& bda, bool use_stk, tBTM_SEC_DEV_REC* p_rec = btm_find_dev(bda); tBTM_SEC_CB* p_cb = &btm_sec_cb; LOG_VERBOSE("bd_addr:%s, use_stk:%d", ADDRESS_TO_LOGGABLE_CSTR(bda), use_stk); LOG_DEBUG("bd_addr:%s,use_stk:%d", ADDRESS_TO_LOGGABLE_CSTR(bda), use_stk); if (p_rec == NULL) { LOG_ERROR("unknown device"); Loading Loading @@ -1395,7 +1395,8 @@ void btm_ble_ltk_request_reply(const RawAddress& bda, bool use_stk, * end up here. We will eventually consolidate both entries, this is to avoid * race conditions. */ LOG_ASSERT(p_rec->sec_rec.ble_keys.key_type & BTM_LE_KEY_LENC); ASSERT_LOG(p_rec->sec_rec.ble_keys.key_type & BTM_LE_KEY_LENC, "local enccryption key not present"); p_cb->key_size = p_rec->sec_rec.ble_keys.key_size; btsnd_hcic_ble_ltk_req_reply(btm_sec_cb.enc_handle, p_rec->sec_rec.ble_keys.lltk); Loading
system/stack/btm/security_device_record.h +2 −6 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ #pragma once #include <base/logging.h> #include <base/strings/stringprintf.h> #include <cstdint> Loading @@ -26,15 +25,13 @@ #include "internal_include/bt_target.h" #include "macros.h" #include "os/logging/log_adapter.h" #include "os/log.h" #include "stack/include/bt_device_type.h" #include "stack/include/bt_name.h" #include "stack/include/bt_octets.h" #include "stack/include/btm_sec_api_types.h" #include "stack/include/btm_status.h" #include "stack/include/hci_error_code.h" #include "types/ble_address_with_type.h" #include "types/hci_role.h" #include "types/raw_address.h" #include "types/remote_version_type.h" Loading Loading @@ -116,8 +113,7 @@ class tBTM_BLE_ADDR_INFO { if (is_ble_addr_type_known(ble_addr_type)) { ble_addr_type_ = ble_addr_type; } else { LOG(ERROR) << "Please don't store illegal addresses into security record:" << AddressTypeText(ble_addr_type); LOG_ERROR("Unknown address type:0x%x", ble_addr_type); } } Loading