From b9403bab4d88478014f8b45cfae49b9ad887172a Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Sat, 22 Aug 2020 16:30:34 -0700 Subject: [PATCH] Remove def BLE_PRIVACY_SPT Always TRUE; untested and unsupported when false Towards readable code Bug: 163134718 Tag: #refactor Test: compile & verify basic functions working Change-Id: I88e5466db12dfafbe9ed4ef66459b0c9da7f4fc1 --- stack/acl/btm_acl.cc | 21 ------------------- stack/btm/btm_ble.cc | 8 ------- stack/btm/btm_ble_addr.cc | 8 ------- stack/btm/btm_ble_adv_filter.cc | 2 -- stack/btm/btm_ble_bgconn.cc | 2 -- stack/btm/btm_ble_connection_establishment.cc | 10 --------- stack/btm/btm_ble_gap.cc | 30 --------------------------- stack/btm/btm_ble_int.h | 2 -- stack/btm/btm_ble_int_types.h | 2 -- stack/btm/btm_ble_privacy.cc | 2 -- stack/btm/btm_devctl.cc | 2 -- stack/btm/btm_sec.cc | 2 -- stack/btm/security_device_record.h | 2 -- stack/btu/btu_hcif.cc | 10 --------- stack/l2cap/l2c_ble.cc | 2 -- 15 files changed, 105 deletions(-) diff --git a/stack/acl/btm_acl.cc b/stack/acl/btm_acl.cc index 568ace915..882bac3cc 100644 --- a/stack/acl/btm_acl.cc +++ b/stack/acl/btm_acl.cc @@ -232,7 +232,6 @@ tACL_CONN* StackAclBtmAcl::acl_get_connection_from_handle(uint16_t hci_handle) { return &btm_cb.acl_cb_.acl_db[index]; } -#if (BLE_PRIVACY_SPT == TRUE) /******************************************************************************* * * Function btm_ble_get_acl_remote_addr @@ -278,7 +277,6 @@ bool btm_ble_get_acl_remote_addr(tBTM_SEC_DEV_REC* p_dev_rec, return st; } -#endif void btm_acl_process_sca_cmpl_pkt(uint8_t len, uint8_t* data) { uint16_t handle; @@ -357,15 +355,9 @@ void btm_acl_created(const RawAddress& bda, uint16_t hci_handle, btm_set_link_policy(p, btm_cb.acl_cb_.btm_def_link_policy); p->transport = transport; -#if (BLE_PRIVACY_SPT == TRUE) if (transport == BT_TRANSPORT_LE) btm_ble_refresh_local_resolvable_private_addr( bda, btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr); -#else - p->conn_addr_type = BLE_ADDR_PUBLIC; - p->conn_addr = *controller_get_interface()->get_address(); - -#endif p->switch_role_failed_attempts = 0; p->switch_role_state = BTM_ACL_SWKEY_STATE_IDLE; @@ -422,10 +414,8 @@ void btm_acl_created(const RawAddress& bda, uint16_t hci_handle, /* If here, features are not known yet */ if (p_dev_rec && transport == BT_TRANSPORT_LE) { -#if (BLE_PRIVACY_SPT == TRUE) btm_ble_get_acl_remote_addr(p_dev_rec, p->active_remote_addr, &p->active_remote_addr_type); -#endif if (controller_get_interface() ->supports_ble_peripheral_initiated_feature_exchange() || @@ -2605,7 +2595,6 @@ int btm_pm_find_acl_ind(const RawAddress& remote_bda) { ******************************************************************************/ void btm_ble_refresh_local_resolvable_private_addr( const RawAddress& pseudo_addr, const RawAddress& local_rpa) { -#if (BLE_PRIVACY_SPT == TRUE) tACL_CONN* p = internal_.btm_bda_to_acl(pseudo_addr, BT_TRANSPORT_LE); if (p != NULL) { @@ -2620,7 +2609,6 @@ void btm_ble_refresh_local_resolvable_private_addr( p->conn_addr = *controller_get_interface()->get_address(); } } -#endif } /******************************************************************************* @@ -2706,7 +2694,6 @@ bool BTM_ReadRemoteConnectionAddr(const RawAddress& pseudo_addr, p_addr_type); } bool st = true; -#if (BLE_PRIVACY_SPT == TRUE) tACL_CONN* p_acl = internal_.btm_bda_to_acl(pseudo_addr, BT_TRANSPORT_LE); if (p_acl == NULL) { @@ -2718,14 +2705,6 @@ bool BTM_ReadRemoteConnectionAddr(const RawAddress& pseudo_addr, conn_addr = p_acl->active_remote_addr; *p_addr_type = p_acl->active_remote_addr_type; -#else - tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(pseudo_addr); - - conn_addr = pseudo_addr; - if (p_dev_rec != NULL) { - *p_addr_type = p_dev_rec->ble.ble_addr_type; - } -#endif return st; } diff --git a/stack/btm/btm_ble.cc b/stack/btm/btm_ble.cc index 8edbc0b58..fbfd23301 100644 --- a/stack/btm/btm_ble.cc +++ b/stack/btm/btm_ble.cc @@ -161,10 +161,8 @@ bool BTM_SecAddBleKey(const RawAddress& bd_addr, tBTM_LE_KEY_VALUE* p_le_key, btm_sec_save_le_key(bd_addr, key_type, p_le_key, false); -#if (BLE_PRIVACY_SPT == TRUE) if (key_type == BTM_LE_KEY_PID || key_type == BTM_LE_KEY_LID) btm_ble_resolving_list_load_dev(p_dev_rec); -#endif return (true); } @@ -1767,12 +1765,10 @@ void btm_ble_connected(const RawAddress& bda, uint16_t handle, uint8_t enc_mode, p_dev_rec->role_master = false; if (role == HCI_ROLE_MASTER) p_dev_rec->role_master = true; -#if (BLE_PRIVACY_SPT == TRUE) if (!addr_matched) p_dev_rec->ble.active_addr_type = BTM_BLE_ADDR_PSEUDO; if (p_dev_rec->ble.ble_addr_type == BLE_ADDR_RANDOM && !addr_matched) p_dev_rec->ble.cur_rand_addr = bda; -#endif p_cb->inq_var.directed_conn = BTM_BLE_CONNECT_EVT; @@ -1888,10 +1884,8 @@ uint8_t btm_proc_smp_cback(tSMP_EVT event, const RawAddress& bd_addr, if (res == BTM_SUCCESS) { p_dev_rec->sec_state = BTM_SEC_STATE_IDLE; -#if (BLE_PRIVACY_SPT == TRUE) /* add all bonded device into resolving list if IRK is available*/ btm_ble_resolving_list_load_dev(p_dev_rec); -#endif } btm_sec_dev_rec_cback_event(p_dev_rec, res, true); @@ -2065,12 +2059,10 @@ static void btm_ble_reset_id_impl(const Octet16& rand1, const Octet16& rand2) { btm_notify_new_key(BTM_BLE_KEY_TYPE_ID); -#if (BLE_PRIVACY_SPT == TRUE) /* if privacy is enabled, new RPA should be calculated */ if (btm_cb.ble_ctr_cb.privacy_mode != BTM_PRIVACY_NONE) { btm_gen_resolvable_private_addr(base::Bind(&btm_gen_resolve_paddr_low)); } -#endif /* proceed generate ER */ btm_cb.devcb.ble_encryption_key_value = rand2; diff --git a/stack/btm/btm_ble_addr.cc b/stack/btm/btm_ble_addr.cc index 3eb12c09e..e548bd33f 100644 --- a/stack/btm/btm_ble_addr.cc +++ b/stack/btm/btm_ble_addr.cc @@ -222,7 +222,6 @@ tBTM_SEC_DEV_REC* btm_ble_resolve_random_addr(const RawAddress& random_bda) { /** Find the security record whose LE identity address is matching */ tBTM_SEC_DEV_REC* btm_find_dev_by_identity_addr(const RawAddress& bd_addr, uint8_t addr_type) { -#if (BLE_PRIVACY_SPT == TRUE) list_node_t* end = list_end(btm_cb.sec_dev_rec); for (list_node_t* node = list_begin(btm_cb.sec_dev_rec); node != end; node = list_next(node)) { @@ -239,7 +238,6 @@ tBTM_SEC_DEV_REC* btm_find_dev_by_identity_addr(const RawAddress& bd_addr, return p_dev_rec; } } -#endif return NULL; } @@ -254,7 +252,6 @@ tBTM_SEC_DEV_REC* btm_find_dev_by_identity_addr(const RawAddress& bd_addr, ******************************************************************************/ bool btm_identity_addr_to_random_pseudo(RawAddress* bd_addr, uint8_t* p_addr_type, bool refresh) { -#if (BLE_PRIVACY_SPT == TRUE) tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev_by_identity_addr(*bd_addr, *p_addr_type); @@ -273,7 +270,6 @@ bool btm_identity_addr_to_random_pseudo(RawAddress* bd_addr, *p_addr_type = p_dev_rec->ble.ble_addr_type; return true; } -#endif return false; } @@ -287,7 +283,6 @@ bool btm_identity_addr_to_random_pseudo(RawAddress* bd_addr, ******************************************************************************/ bool btm_random_pseudo_to_identity_addr(RawAddress* random_pseudo, uint8_t* p_identity_addr_type) { -#if (BLE_PRIVACY_SPT == TRUE) tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(*random_pseudo); if (p_dev_rec != NULL) { @@ -299,7 +294,6 @@ bool btm_random_pseudo_to_identity_addr(RawAddress* random_pseudo, return true; } } -#endif return false; } @@ -315,7 +309,6 @@ bool btm_random_pseudo_to_identity_addr(RawAddress* random_pseudo, void btm_ble_refresh_peer_resolvable_private_addr(const RawAddress& pseudo_bda, const RawAddress& rpa, uint8_t rra_type) { -#if (BLE_PRIVACY_SPT == TRUE) /* update security record here, in adv event or connection complete process */ tBTM_SEC_DEV_REC* p_sec_rec = btm_find_dev(pseudo_bda); if (p_sec_rec != NULL) { @@ -344,6 +337,5 @@ void btm_ble_refresh_peer_resolvable_private_addr(const RawAddress& pseudo_bda, BTM_TRACE_ERROR("%s Unknown device to refresh remote device", __func__); } } -#endif } diff --git a/stack/btm/btm_ble_adv_filter.cc b/stack/btm/btm_ble_adv_filter.cc index d38e04510..0c9e285aa 100644 --- a/stack/btm/btm_ble_adv_filter.cc +++ b/stack/btm/btm_ble_adv_filter.cc @@ -501,7 +501,6 @@ void BTM_LE_PF_addr_filter(tBTM_BLE_SCAN_COND_OP action, UINT8_TO_STREAM(p, filt_index); if (action != BTM_BLE_SCAN_COND_CLEAR) { -#if (BLE_PRIVACY_SPT == TRUE) if (addr.type == BLE_ADDR_PUBLIC_ID) { LOG(INFO) << __func__ << " Filter address " << addr.bda << " has type PUBLIC_ID, try to get identity address"; @@ -509,7 +508,6 @@ void BTM_LE_PF_addr_filter(tBTM_BLE_SCAN_COND_OP action, * this call will have no effect. */ btm_random_pseudo_to_identity_addr(&addr.bda, &addr.type); } -#endif LOG(INFO) << __func__ << " Adding scan filter with peer address: " << addr.bda; diff --git a/stack/btm/btm_ble_bgconn.cc b/stack/btm/btm_ble_bgconn.cc index 886eeb21d..3809c598d 100644 --- a/stack/btm/btm_ble_bgconn.cc +++ b/stack/btm/btm_ble_bgconn.cc @@ -379,14 +379,12 @@ bool btm_ble_start_auto_conn() { btm_execute_wl_dev_operation(); -#if (BLE_PRIVACY_SPT == TRUE) btm_ble_enable_resolving_list_for_platform(BTM_BLE_RL_INIT); if (btm_cb.ble_ctr_cb.rl_state != BTM_BLE_RL_IDLE && controller_get_interface()->supports_ble_privacy()) { own_addr_type |= BLE_ADDR_TYPE_ID_BIT; peer_addr_type |= BLE_ADDR_TYPE_ID_BIT; } -#endif btm_send_hci_create_connection( scan_int, /* uint16_t scan_int */ diff --git a/stack/btm/btm_ble_connection_establishment.cc b/stack/btm/btm_ble_connection_establishment.cc index 2237bfd48..f0e88b7ea 100644 --- a/stack/btm/btm_ble_connection_establishment.cc +++ b/stack/btm/btm_ble_connection_establishment.cc @@ -105,9 +105,7 @@ void btm_ble_create_ll_conn_complete(uint8_t status) { /** LE connection complete. */ void btm_ble_conn_complete(uint8_t* p, UNUSED_ATTR uint16_t evt_len, bool enhanced) { -#if (BLE_PRIVACY_SPT == TRUE) uint8_t peer_addr_type; -#endif RawAddress local_rpa, peer_rpa; uint8_t role, status, bda_type; uint16_t handle; @@ -134,7 +132,6 @@ void btm_ble_conn_complete(uint8_t* p, UNUSED_ATTR uint16_t evt_len, : android::bluetooth::hci::BLE_EVT_CONN_COMPLETE_EVT; if (status == HCI_SUCCESS) { -#if (BLE_PRIVACY_SPT == TRUE) peer_addr_type = bda_type; bool addr_is_rpa = (peer_addr_type == BLE_ADDR_RANDOM && BTM_BLE_IS_RESOLVE_BDA(bda)); @@ -168,7 +165,6 @@ void btm_ble_conn_complete(uint8_t* p, UNUSED_ATTR uint16_t evt_len, LOG(INFO) << __func__ << ": unable to match and resolve random address"; } } -#endif // Log for the HCI success case after resolving Bluetooth address bluetooth::common::LogLinkLayerConnectionEvent( &bda, handle, android::bluetooth::DIRECTION_UNKNOWN, @@ -187,7 +183,6 @@ void btm_ble_conn_complete(uint8_t* p, UNUSED_ATTR uint16_t evt_len, l2cble_conn_comp(handle, role, bda, bda_type, conn_interval, conn_latency, conn_timeout); -#if (BLE_PRIVACY_SPT == TRUE) if (enhanced) { btm_ble_refresh_local_resolvable_private_addr(bda, local_rpa); @@ -195,7 +190,6 @@ void btm_ble_conn_complete(uint8_t* p, UNUSED_ATTR uint16_t evt_len, btm_ble_refresh_peer_resolvable_private_addr(bda, peer_rpa, BLE_ADDR_RANDOM); } -#endif } else { // Log for non HCI success case bluetooth::common::LogLinkLayerConnectionEvent( @@ -207,14 +201,10 @@ void btm_ble_conn_complete(uint8_t* p, UNUSED_ATTR uint16_t evt_len, role = HCI_ROLE_UNKNOWN; if (status != HCI_ERR_ADVERTISING_TIMEOUT) { btm_ble_set_conn_st(BLE_CONN_IDLE); -#if (BLE_PRIVACY_SPT == TRUE) btm_ble_disable_resolving_list(BTM_BLE_RL_INIT, true); -#endif } else { -#if (BLE_PRIVACY_SPT == TRUE) btm_cb.ble_ctr_cb.inq_var.adv_mode = BTM_BLE_ADV_DISABLE; btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, true); -#endif } } diff --git a/stack/btm/btm_ble_gap.cc b/stack/btm/btm_ble_gap.cc index 905c912a1..e8ec77de9 100644 --- a/stack/btm/btm_ble_gap.cc +++ b/stack/btm/btm_ble_gap.cc @@ -413,10 +413,8 @@ tBTM_STATUS BTM_BleObserve(bool start, uint8_t duration, ? BTM_BLE_SCAN_MODE_ACTI : p_inq->scan_type; /* assume observe always not using white list */ -#if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE) /* enable resolving list */ btm_ble_enable_resolving_list_for_platform(BTM_BLE_RL_SCAN); -#endif btm_send_hci_set_scan_params( p_inq->scan_type, (uint16_t)scan_interval, (uint16_t)scan_window, @@ -509,12 +507,10 @@ static void btm_ble_vendor_capability_vsc_cmpl_cback( if (btm_cb.cmn_ble_vsc_cb.max_filter > 0) btm_ble_adv_filter_init(); -#if (BLE_PRIVACY_SPT == TRUE) /* VS capability included and non-4.2 device */ if (btm_cb.cmn_ble_vsc_cb.max_irk_list_sz > 0 && controller_get_interface()->get_ble_resolving_list_max_size() == 0) btm_ble_resolving_list_init(btm_cb.cmn_ble_vsc_cb.max_irk_list_sz); -#endif /* (BLE_PRIVACY_SPT == TRUE) */ if (btm_cb.cmn_ble_vsc_cb.tot_scan_results_strg > 0) btm_ble_batchscan_init(); @@ -583,7 +579,6 @@ extern void BTM_BleReadControllerFeatures( * ******************************************************************************/ bool BTM_BleConfigPrivacy(bool privacy_mode) { -#if (BLE_PRIVACY_SPT == TRUE) tBTM_BLE_CB* p_cb = &btm_cb.ble_ctr_cb; BTM_TRACE_EVENT("%s", __func__); @@ -618,9 +613,6 @@ bool BTM_BleConfigPrivacy(bool privacy_mode) { GAP_BleAttrDBUpdate(GATT_UUID_GAP_CENTRAL_ADDR_RESOL, &gap_ble_attr_value); return true; -#else - return false; -#endif } /******************************************************************************* @@ -652,17 +644,12 @@ extern uint8_t BTM_BleMaxMultiAdvInstanceCount(void) { * ******************************************************************************/ bool BTM_BleLocalPrivacyEnabled(void) { -#if (BLE_PRIVACY_SPT == TRUE) if (bluetooth::shim::is_gd_shim_enabled()) { return bluetooth::shim::BTM_BleLocalPrivacyEnabled(); } return (btm_cb.ble_ctr_cb.privacy_mode != BTM_PRIVACY_NONE); -#else - return false; -#endif } -#if (BLE_PRIVACY_SPT == TRUE) static bool is_resolving_list_bit_set(void* data, void* context) { tBTM_SEC_DEV_REC* p_dev_rec = static_cast(data); @@ -671,7 +658,6 @@ static bool is_resolving_list_bit_set(void* data, void* context) { return true; } -#endif /******************************************************************************* * @@ -686,9 +672,7 @@ static uint8_t btm_set_conn_mode_adv_init_addr( tBTM_BLE_INQ_CB* p_cb, RawAddress& p_peer_addr_ptr, tBLE_ADDR_TYPE* p_peer_addr_type, tBLE_ADDR_TYPE* p_own_addr_type) { uint8_t evt_type; -#if (BLE_PRIVACY_SPT == TRUE) tBTM_SEC_DEV_REC* p_dev_rec; -#endif evt_type = (p_cb->connectable_mode == BTM_BLE_NON_CONNECTABLE) @@ -700,7 +684,6 @@ static uint8_t btm_set_conn_mode_adv_init_addr( if (p_cb->directed_conn == BTM_BLE_CONNECT_DIR_EVT || p_cb->directed_conn == BTM_BLE_CONNECT_LO_DUTY_DIR_EVT) { -#if (BLE_PRIVACY_SPT == TRUE) /* for privacy 1.2, convert peer address as static, own address set as ID * addr */ if (btm_cb.ble_ctr_cb.privacy_mode == BTM_PRIVACY_1_2 || @@ -719,7 +702,6 @@ static uint8_t btm_set_conn_mode_adv_init_addr( btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, true); } } -#endif /* direct adv mode does not have privacy, if privacy is not enabled */ *p_peer_addr_type = p_cb->direct_bda.type; p_peer_addr_ptr = p_cb->direct_bda.bda; @@ -728,7 +710,6 @@ static uint8_t btm_set_conn_mode_adv_init_addr( } /* undirect adv mode or non-connectable mode*/ -#if (BLE_PRIVACY_SPT == TRUE) /* when privacy 1.2 privacy only mode is used, or mixed mode */ if ((btm_cb.ble_ctr_cb.privacy_mode == BTM_PRIVACY_1_2 && p_cb->afp != AP_SCAN_CONN_ALL) || @@ -755,7 +736,6 @@ static uint8_t btm_set_conn_mode_adv_init_addr( else if (btm_cb.ble_ctr_cb.privacy_mode != BTM_PRIVACY_NONE) { *p_own_addr_type = BLE_ADDR_RANDOM; } -#endif /* if no privacy,do not set any peer address,*/ /* local address type go by global privacy setting */ @@ -1027,9 +1007,7 @@ tBTM_STATUS btm_ble_set_discoverability(uint16_t combined_mode) { alarm_set_on_mloop(p_cb->fast_adv_timer, BTM_BLE_GAP_FAST_ADV_TIMEOUT_MS, btm_ble_fast_adv_timer_timeout, NULL); } else { -#if (BLE_PRIVACY_SPT == TRUE) btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, true); -#endif } /* set up stop advertising timer */ @@ -1114,9 +1092,7 @@ tBTM_STATUS btm_ble_set_connectability(uint16_t combined_mode) { alarm_set_on_mloop(p_cb->fast_adv_timer, BTM_BLE_GAP_FAST_ADV_TIMEOUT_MS, btm_ble_fast_adv_timer_timeout, NULL); } else { -#if (BLE_PRIVACY_SPT == TRUE) btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, true); -#endif } return status; } @@ -1189,10 +1165,8 @@ tBTM_STATUS btm_ble_start_inquiry(uint8_t mode, uint8_t duration) { BTM_BLE_SCAN_MODE_ACTI, BTM_BLE_LOW_LATENCY_SCAN_INT, BTM_BLE_LOW_LATENCY_SCAN_WIN, btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type, SP_ADV_ALL); -#if (BLE_PRIVACY_SPT == TRUE) /* enable IRK list */ btm_ble_enable_resolving_list_for_platform(BTM_BLE_RL_SCAN); -#endif p_ble_cb->inq_var.scan_type = BTM_BLE_SCAN_MODE_ACTI; p_ble_cb->inq_var.scan_duplicate_filter = BTM_BLE_DUPLICATE_DISABLE; status = btm_ble_start_scan(); @@ -1632,7 +1606,6 @@ void btm_clear_all_pending_le_entry(void) { } void btm_ble_process_adv_addr(RawAddress& bda, uint8_t* addr_type) { -#if (BLE_PRIVACY_SPT == TRUE) /* map address to security record */ bool match = btm_identity_addr_to_random_pseudo(&bda, addr_type, false); @@ -1653,7 +1626,6 @@ void btm_ble_process_adv_addr(RawAddress& bda, uint8_t* addr_type) { } } } -#endif } /** @@ -2103,14 +2075,12 @@ tBTM_STATUS btm_ble_start_adv(void) { if (!btm_ble_adv_states_operation(btm_ble_topology_check, p_cb->evt_type)) return BTM_WRONG_MODE; -#if (BLE_PRIVACY_SPT == TRUE) /* To relax resolving list, always have resolving list enabled, unless * directed adv */ if (p_cb->evt_type != BTM_BLE_CONNECT_LO_DUTY_DIR_EVT && p_cb->evt_type != BTM_BLE_CONNECT_DIR_EVT) /* enable resolving list is desired */ btm_ble_enable_resolving_list_for_platform(BTM_BLE_RL_ADV); -#endif btsnd_hcic_ble_set_adv_enable(BTM_BLE_ADV_ENABLE); p_cb->adv_mode = BTM_BLE_ADV_ENABLE; diff --git a/stack/btm/btm_ble_int.h b/stack/btm/btm_ble_int.h index 7d2288ced..a10880735 100644 --- a/stack/btm/btm_ble_int.h +++ b/stack/btm/btm_ble_int.h @@ -137,7 +137,6 @@ extern void btm_gen_resolve_paddr_low(const RawAddress& address); extern uint64_t btm_get_next_private_addrress_interval_ms(); /* privacy function */ -#if (BLE_PRIVACY_SPT == TRUE) /* BLE address mapping with CS feature */ extern bool btm_identity_addr_to_random_pseudo(RawAddress* bd_addr, uint8_t* p_addr_type, @@ -157,7 +156,6 @@ extern void btm_ble_enable_resolving_list(uint8_t); extern bool btm_ble_disable_resolving_list(uint8_t rl_mask, bool to_resume); extern void btm_ble_enable_resolving_list_for_platform(uint8_t rl_mask); extern void btm_ble_resolving_list_init(uint8_t max_irk_list_sz); -#endif extern void btm_ble_adv_init(void); extern void btm_ble_multi_adv_cleanup(void); diff --git a/stack/btm/btm_ble_int_types.h b/stack/btm/btm_ble_int_types.h index 08caa8bcc..a1ae62c78 100644 --- a/stack/btm/btm_ble_int_types.h +++ b/stack/btm/btm_ble_int_types.h @@ -256,7 +256,6 @@ typedef struct { bool enabled; -#if (BLE_PRIVACY_SPT == TRUE) bool mixed_mode; /* privacy 1.2 mixed mode is on or not */ tBTM_PRIVACY_MODE privacy_mode; /* privacy mode */ uint8_t resolving_list_avail_size; /* resolving list available size */ @@ -264,7 +263,6 @@ typedef struct { tBTM_BLE_RL_STATE suspended_rl_state; /* Suspended resolving list state */ uint8_t* irk_list_mask; /* IRK list availability mask, up to max entry bits */ tBTM_BLE_RL_STATE rl_state; /* Resolving list state */ -#endif /* current BLE link state */ tBTM_BLE_STATE_MASK cur_states; /* bit mask of tBTM_BLE_STATE */ diff --git a/stack/btm/btm_ble_privacy.cc b/stack/btm/btm_ble_privacy.cc index 152036d71..4af2d6369 100644 --- a/stack/btm/btm_ble_privacy.cc +++ b/stack/btm/btm_ble_privacy.cc @@ -24,7 +24,6 @@ #include #include "bt_target.h" -#if (BLE_PRIVACY_SPT == TRUE) #include "ble_advertiser.h" #include "bt_types.h" #include "btm_int.h" @@ -909,4 +908,3 @@ void btm_ble_resolving_list_init(uint8_t max_irk_list_sz) { btm_ble_clear_resolving_list(); btm_cb.ble_ctr_cb.resolving_list_avail_size = max_irk_list_sz; } -#endif diff --git a/stack/btm/btm_devctl.cc b/stack/btm/btm_devctl.cc index 355e4d562..b88bd0c0a 100644 --- a/stack/btm/btm_devctl.cc +++ b/stack/btm/btm_devctl.cc @@ -186,7 +186,6 @@ void BTM_reset_complete() { // setup the random number generator std::srand(std::time(nullptr)); -#if (BLE_PRIVACY_SPT == TRUE) /* Set up the BLE privacy settings */ if (controller->supports_ble() && controller->supports_ble_privacy() && controller->get_ble_resolving_list_max_size() > 0) { @@ -195,7 +194,6 @@ void BTM_reset_complete() { btsnd_hcic_ble_set_rand_priv_addr_timeout( btm_get_next_private_addrress_interval_ms() / 1000); } -#endif if (controller->supports_ble()) { btm_ble_white_list_init(controller->get_ble_white_list_size()); diff --git a/stack/btm/btm_sec.cc b/stack/btm/btm_sec.cc index 717f951bd..f02bf0def 100644 --- a/stack/btm/btm_sec.cc +++ b/stack/btm/btm_sec.cc @@ -5017,9 +5017,7 @@ void btm_sec_clear_ble_keys(tBTM_SEC_DEV_REC* p_dev_rec) { p_dev_rec->ble.key_type = BTM_LE_KEY_NONE; memset(&p_dev_rec->ble.keys, 0, sizeof(tBTM_SEC_BLE_KEYS)); -#if (BLE_PRIVACY_SPT == TRUE) btm_ble_resolving_list_remove_dev(p_dev_rec); -#endif } /******************************************************************************* diff --git a/stack/btm/security_device_record.h b/stack/btm/security_device_record.h index bb8e35706..a3266e92b 100644 --- a/stack/btm/security_device_record.h +++ b/stack/btm/security_device_record.h @@ -336,10 +336,8 @@ typedef struct { #define BTM_RESOLVING_LIST_BIT 0x02 uint8_t in_controller_list; /* in controller resolving list or not */ uint8_t resolving_list_index; -#if (BLE_PRIVACY_SPT == TRUE) RawAddress cur_rand_addr; /* current random address */ uint8_t active_addr_type; -#endif #define BTM_BLE_ADDR_PSEUDO 0 /* address index device record */ #define BTM_BLE_ADDR_RRA 1 /* cur_rand_addr */ #define BTM_BLE_ADDR_STATIC 2 /* static_addr */ diff --git a/stack/btu/btu_hcif.cc b/stack/btu/btu_hcif.cc index ea2a1de52..969dc6ca4 100644 --- a/stack/btu/btu_hcif.cc +++ b/stack/btu/btu_hcif.cc @@ -414,11 +414,9 @@ void btu_hcif_process_event(UNUSED_ATTR uint8_t controller_id, BT_HDR* p_msg) { case HCI_BLE_LTK_REQ_EVT: /* received only at slave device */ btu_ble_proc_ltk_req(p); break; -#if (BLE_PRIVACY_SPT == TRUE) case HCI_BLE_ENHANCED_CONN_COMPLETE_EVT: btm_ble_conn_complete(p, hci_evt_len, true); break; -#endif #if (BLE_LLT_INCLUDED == TRUE) case HCI_BLE_RC_PARAM_REQ_EVT: btu_ble_rc_param_req_evt(p); @@ -538,7 +536,6 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, uint8_t* p_cmd, const RawAddress* bd_addr_p = nullptr; if (initiator_filter_policy == 0x00) { bd_addr_p = &bd_addr; -#if (BLE_PRIVACY_SPT == TRUE) if (peer_address_type == BLE_ADDR_PUBLIC_ID || peer_address_type == BLE_ADDR_RANDOM_ID) { // if identity address is not matched, this address is invalid @@ -547,7 +544,6 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, uint8_t* p_cmd, bd_addr_p = nullptr; } } -#endif } if (initiator_filter_policy == 0x00 || (cmd_status != HCI_SUCCESS && !is_cmd_status)) { @@ -574,10 +570,8 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, uint8_t* p_cmd, const RawAddress* bd_addr_p = nullptr; if (initiator_filter_policy == 0x00) { bd_addr_p = &bd_addr; -#if (BLE_PRIVACY_SPT == TRUE) // if identity address is not matched, this should be a static address btm_identity_addr_to_random_pseudo(&bd_addr, &peer_addr_type, false); -#endif } if (initiator_filter_policy == 0x00 || (cmd_status != HCI_SUCCESS && !is_cmd_status)) { @@ -620,7 +614,6 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, uint8_t* p_cmd, // When peer_addr_type is 0xFF, bd_addr should be ignored per BT spec if (peer_addr_type != BLE_ADDR_ANONYMOUS) { bd_addr_p = &bd_addr; -#if (BLE_PRIVACY_SPT == TRUE) bool addr_is_rpa = peer_addr_type == BLE_ADDR_RANDOM && BTM_BLE_IS_RESOLVE_BDA(bd_addr); // Only try to match identity address for pseudo if address is not RPA @@ -628,7 +621,6 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, uint8_t* p_cmd, // if identity address is not matched, this should be a static address btm_identity_addr_to_random_pseudo(&bd_addr, &peer_addr_type, false); } -#endif } bluetooth::common::LogLinkLayerConnectionEvent( bd_addr_p, bluetooth::common::kUnknownConnectionHandle, @@ -1326,7 +1318,6 @@ static void btu_hcif_hdl_command_complete(uint16_t opcode, uint8_t* p, btm_ble_test_command_complete(p); break; -#if (BLE_PRIVACY_SPT == TRUE) case HCI_BLE_ADD_DEV_RESOLVING_LIST: btm_ble_add_resolving_list_entry_complete(p, evt_len); break; @@ -1347,7 +1338,6 @@ static void btu_hcif_hdl_command_complete(uint16_t opcode, uint8_t* p, case HCI_BLE_SET_ADDR_RESOLUTION_ENABLE: case HCI_BLE_SET_RAND_PRIV_ADDR_TIMOUT: break; -#endif default: if ((opcode & HCI_GRP_VENDOR_SPECIFIC) == HCI_GRP_VENDOR_SPECIFIC) btm_vsc_complete(p, opcode, evt_len, (tBTM_VSC_CMPL_CB*)p_cplt_cback); diff --git a/stack/l2cap/l2c_ble.cc b/stack/l2cap/l2c_ble.cc index a9200487c..f465f3240 100644 --- a/stack/l2cap/l2c_ble.cc +++ b/stack/l2cap/l2c_ble.cc @@ -321,9 +321,7 @@ void l2cble_conn_comp(uint16_t handle, uint8_t role, const RawAddress& bda, L2CAP_FIXED_CHNL_BLE_SIG_BIT | L2CAP_FIXED_CHNL_SMP_BIT; -#if (BLE_PRIVACY_SPT == TRUE) btm_ble_disable_resolving_list(BTM_BLE_RL_INIT, true); -#endif if (role == HCI_ROLE_SLAVE) { if (!controller_get_interface() -- 2.11.0