From 2e8e9f42132d0297a94c0852a1fbf45c9bc348e5 Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Mon, 14 Nov 2016 16:45:15 -0800 Subject: [PATCH] Remove SMP_INCLUDED define Test: Connect to a BLE Keyboard Change-Id: I785692cb61f4ca5ccccab7424aa03f50c54523c9 --- bta/dm/bta_dm_act.cc | 24 +++++++++--------------- bta/include/bta_api.h | 10 ++++------ btif/co/bta_dm_co.cc | 4 ---- include/bt_target.h | 4 ---- include/bte_appl.h | 2 -- main/bte_init.cc | 2 -- stack/btm/btm_ble.cc | 29 ----------------------------- stack/btm/btm_ble_addr.cc | 6 ------ stack/btm/btm_ble_int.h | 6 ------ stack/btm/btm_ble_multi_adv.cc | 2 -- stack/btm/btm_int.h | 6 +----- stack/btm/btm_int_types.h | 2 -- stack/btm/btm_sec.cc | 34 +++------------------------------- stack/btu/btu_hcif.cc | 2 -- stack/btu/btu_init.cc | 7 ++----- stack/btu/btu_task.cc | 3 --- stack/include/btm_api_types.h | 10 ---------- stack/include/smp_api.h | 2 -- stack/include/smp_api_types.h | 2 -- stack/smp/smp_act.cc | 4 ---- stack/smp/smp_api.cc | 19 ++++++++----------- stack/smp/smp_cmac.cc | 14 +++++--------- stack/smp/smp_keys.cc | 4 ---- stack/smp/smp_l2c.cc | 3 --- stack/smp/smp_main.cc | 5 ----- stack/smp/smp_utils.cc | 6 ------ 26 files changed, 32 insertions(+), 180 deletions(-) diff --git a/bta/dm/bta_dm_act.cc b/bta/dm/bta_dm_act.cc index 5e4825756..f5314a150 100644 --- a/bta/dm/bta_dm_act.cc +++ b/bta/dm/bta_dm_act.cc @@ -101,10 +101,8 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr); static void bta_dm_sys_hw_cback(tBTA_SYS_HW_EVT status); static void bta_dm_disable_search_and_disc(void); -#if (SMP_INCLUDED == TRUE) static uint8_t bta_dm_ble_smp_cback(tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_DATA* p_data); -#endif static void bta_dm_ble_id_key_cback(uint8_t key_type, tBTM_BLE_LOCAL_KEYS* p_key); #if (BTA_GATT_INCLUDED == TRUE) @@ -235,20 +233,18 @@ const uint32_t bta_service_id_to_btm_srv_id_lkup_tbl[BTA_MAX_SERVICE_ID] = { }; /* bta security callback */ -const tBTM_APPL_INFO bta_security = { - &bta_dm_authorize_cback, &bta_dm_pin_cback, &bta_dm_new_link_key_cback, - &bta_dm_authentication_complete_cback, &bta_dm_bond_cancel_complete_cback, +const tBTM_APPL_INFO bta_security = {&bta_dm_authorize_cback, + &bta_dm_pin_cback, + &bta_dm_new_link_key_cback, + &bta_dm_authentication_complete_cback, + &bta_dm_bond_cancel_complete_cback, #if (BTM_LOCAL_IO_CAPS != BTM_IO_CAP_NONE) - &bta_dm_sp_cback + &bta_dm_sp_cback, #else - NULL -#endif -#if (SMP_INCLUDED == TRUE) - , - &bta_dm_ble_smp_cback + NULL #endif - , - &bta_dm_ble_id_key_cback}; + &bta_dm_ble_smp_cback, + &bta_dm_ble_id_key_cback}; #define MAX_DISC_RAW_DATA_BUF (4096) uint8_t g_disc_raw_data_buf[MAX_DISC_RAW_DATA_BUF]; @@ -4034,7 +4030,6 @@ static void bta_dm_observe_cmpl_cb(void* p_result) { } } -#if (SMP_INCLUDED == TRUE) /******************************************************************************* * * Function bta_dm_ble_smp_cback @@ -4150,7 +4145,6 @@ static uint8_t bta_dm_ble_smp_cback(tBTM_LE_EVT event, BD_ADDR bda, } return status; } -#endif /* SMP_INCLUDED == TRUE */ /******************************************************************************* * diff --git a/bta/include/bta_api.h b/bta/include/bta_api.h index f7845b7dd..e2a011501 100644 --- a/bta/include/bta_api.h +++ b/bta/include/bta_api.h @@ -679,13 +679,11 @@ typedef struct { uint8_t level_flags; /* indicates individual flags */ } tBTA_DM_BUSY_LEVEL; -#define BTA_IO_CAP_OUT BTM_IO_CAP_OUT /* 0 DisplayOnly */ -#define BTA_IO_CAP_IO BTM_IO_CAP_IO /* 1 DisplayYesNo */ -#define BTA_IO_CAP_IN BTM_IO_CAP_IN /* 2 KeyboardOnly */ -#define BTA_IO_CAP_NONE BTM_IO_CAP_NONE /* 3 NoInputNoOutput */ -#if (SMP_INCLUDED == TRUE) +#define BTA_IO_CAP_OUT BTM_IO_CAP_OUT /* 0 DisplayOnly */ +#define BTA_IO_CAP_IO BTM_IO_CAP_IO /* 1 DisplayYesNo */ +#define BTA_IO_CAP_IN BTM_IO_CAP_IN /* 2 KeyboardOnly */ +#define BTA_IO_CAP_NONE BTM_IO_CAP_NONE /* 3 NoInputNoOutput */ #define BTA_IO_CAP_KBDISP BTM_IO_CAP_KBDISP /* 4 Keyboard display */ -#endif typedef tBTM_IO_CAP tBTA_IO_CAP; #define BTA_AUTH_SP_NO \ diff --git a/btif/co/bta_dm_co.cc b/btif/co/bta_dm_co.cc index 94c1e6fda..82b92fabe 100644 --- a/btif/co/bta_dm_co.cc +++ b/btif/co/bta_dm_co.cc @@ -28,11 +28,7 @@ #include "bte_appl.h" tBTE_APPL_CFG bte_appl_cfg = { -#if (SMP_INCLUDED == TRUE) BTA_LE_AUTH_REQ_SC_MITM_BOND, // Authentication requirements -#else - BTM_AUTH_SPGB_YES, // Authentication requirements -#endif BTM_LOCAL_IO_CAPS_BLE, BTM_BLE_INITIATOR_KEY_SIZE, BTM_BLE_RESPONDER_KEY_SIZE, BTM_BLE_MAX_KEY_SIZE}; diff --git a/include/bt_target.h b/include/bt_target.h index 8f6ee4b79..feca61544 100644 --- a/include/bt_target.h +++ b/include/bt_target.h @@ -775,10 +775,6 @@ * SMP * *****************************************************************************/ -#ifndef SMP_INCLUDED -#define SMP_INCLUDED TRUE -#endif - #ifndef SMP_DEBUG #define SMP_DEBUG FALSE #endif diff --git a/include/bte_appl.h b/include/bte_appl.h index 0dd2ad1cc..40cc75b10 100644 --- a/include/bte_appl.h +++ b/include/bte_appl.h @@ -29,13 +29,11 @@ extern "C" { #endif typedef struct { -#if (SMP_INCLUDED == TRUE) uint8_t ble_auth_req; uint8_t ble_io_cap; uint8_t ble_init_key; uint8_t ble_resp_key; uint8_t ble_max_key_size; -#endif } tBTE_APPL_CFG; extern tBTE_APPL_CFG bte_appl_cfg; diff --git a/main/bte_init.cc b/main/bte_init.cc index 63b22016e..4a6444b66 100644 --- a/main/bte_init.cc +++ b/main/bte_init.cc @@ -60,9 +60,7 @@ #endif #include "gatt_api.h" -#if (SMP_INCLUDED == TRUE) #include "smp_api.h" -#endif /***************************************************************************** ** F U N C T I O N S * diff --git a/stack/btm/btm_ble.cc b/stack/btm/btm_ble.cc index ebc49b1bd..275c1875d 100644 --- a/stack/btm/btm_ble.cc +++ b/stack/btm/btm_ble.cc @@ -43,10 +43,8 @@ #include "osi/include/osi.h" #include "smp_api.h" -#if (SMP_INCLUDED == TRUE) extern bool aes_cipher_msg_auth_code(BT_OCTET16 key, uint8_t *input, uint16_t length, uint16_t tlen, uint8_t *p_signature); -#endif /*******************************************************************************/ /* External Function to be called by other modules */ @@ -132,7 +130,6 @@ bool BTM_SecAddBleDevice (const BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_ *******************************************************************************/ bool BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key, tBTM_LE_KEY_TYPE key_type) { -#if (SMP_INCLUDED == TRUE) tBTM_SEC_DEV_REC *p_dev_rec; BTM_TRACE_DEBUG ("BTM_SecAddBleKey"); p_dev_rec = btm_find_dev (bd_addr); @@ -159,8 +156,6 @@ bool BTM_SecAddBleKey (BD_ADDR bd_addr, tBTM_LE_KEY_VALUE *p_le_key, tBTM_LE_ btm_ble_resolving_list_load_dev (p_dev_rec); #endif -#endif - return(true); } @@ -359,11 +354,9 @@ bool BTM_ReadRemoteConnectionAddr(BD_ADDR pseudo_addr, BD_ADDR conn_addr, *******************************************************************************/ void BTM_SecurityGrant(BD_ADDR bd_addr, uint8_t res) { -#if (SMP_INCLUDED == TRUE) tSMP_STATUS res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_REPEATED_ATTEMPTS; BTM_TRACE_DEBUG ("BTM_SecurityGrant"); SMP_SecurityGrant(bd_addr, res_smp); -#endif } /******************************************************************************* @@ -382,7 +375,6 @@ void BTM_SecurityGrant(BD_ADDR bd_addr, uint8_t res) *******************************************************************************/ void BTM_BlePasskeyReply (BD_ADDR bd_addr, uint8_t res, uint32_t passkey) { -#if (SMP_INCLUDED == TRUE) tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr); tSMP_STATUS res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_PASSKEY_ENTRY_FAIL; @@ -395,7 +387,6 @@ void BTM_BlePasskeyReply (BD_ADDR bd_addr, uint8_t res, uint32_t passkey) p_dev_rec->sec_flags |= BTM_SEC_LE_AUTHENTICATED; BTM_TRACE_DEBUG ("BTM_BlePasskeyReply"); SMP_PasskeyReply(bd_addr, res_smp, passkey); -#endif } /******************************************************************************* @@ -442,7 +433,6 @@ void BTM_BleConfirmReply (BD_ADDR bd_addr, uint8_t res) *******************************************************************************/ void BTM_BleOobDataReply(BD_ADDR bd_addr, uint8_t res, uint8_t len, uint8_t *p_data) { -#if (SMP_INCLUDED == TRUE) tSMP_STATUS res_smp = (res == BTM_SUCCESS) ? SMP_SUCCESS : SMP_OOB_FAIL; tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr); @@ -455,7 +445,6 @@ void BTM_BleOobDataReply(BD_ADDR bd_addr, uint8_t res, uint8_t len, uint8_t *p_d p_dev_rec->sec_flags |= BTM_SEC_LE_AUTHENTICATED; SMP_OobDataReply(bd_addr, res_smp, len, p_data); -#endif } /******************************************************************************* @@ -474,7 +463,6 @@ void BTM_BleOobDataReply(BD_ADDR bd_addr, uint8_t res, uint8_t len, uint8_t *p_d void BTM_BleSecureConnectionOobDataReply(BD_ADDR bd_addr, uint8_t *p_c, uint8_t *p_r) { -#if SMP_INCLUDED == TRUE tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (bd_addr); BTM_TRACE_DEBUG ("%s:", __func__); @@ -496,7 +484,6 @@ void BTM_BleSecureConnectionOobDataReply(BD_ADDR bd_addr, memcpy(&oob.peer_oob_data.addr_rcvd_from.bda, bd_addr, sizeof(BD_ADDR)); SMP_SecureConnectionOobDataReply((uint8_t*)&oob); -#endif } /****************************************************************************** @@ -513,7 +500,6 @@ void BTM_BleSecureConnectionOobDataReply(BD_ADDR bd_addr, *******************************************************************************/ void BTM_BleSetConnScanParams (uint32_t scan_interval, uint32_t scan_window) { -#if (SMP_INCLUDED == TRUE) tBTM_BLE_CB *p_ble_cb = &btm_cb.ble_ctr_cb; bool new_param = false; @@ -541,7 +527,6 @@ void BTM_BleSetConnScanParams (uint32_t scan_interval, uint32_t scan_window) { BTM_TRACE_ERROR("Illegal Connection Scan Parameters"); } -#endif } /******************************************************** @@ -1075,8 +1060,6 @@ void btm_ble_rand_enc_complete (uint8_t *p, uint16_t op_code, tBTM_RAND_ENC_CB * } } - #if (SMP_INCLUDED == true) - /******************************************************************************* ** ** Function btm_ble_get_enc_key_type @@ -2144,8 +2127,6 @@ uint8_t btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_dat return 0; } - #endif /* SMP_INCLUDED */ - /******************************************************************************* ** ** Function BTM_BleDataSignature @@ -2224,7 +2205,6 @@ bool BTM_BleVerifySignature (BD_ADDR bd_addr, uint8_t *p_orig, uint16_t len, uint8_t *p_comp) { bool verified = false; -#if (SMP_INCLUDED == TRUE) tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bd_addr); uint8_t p_mac[BTM_CMAC_TLEN_SIZE]; @@ -2254,7 +2234,6 @@ bool BTM_BleVerifySignature (BD_ADDR bd_addr, uint8_t *p_orig, uint16_t len, } } } -#endif /* SMP_INCLUDED */ return verified; } @@ -2276,7 +2255,6 @@ bool BTM_GetLeSecurityState (BD_ADDR bd_addr, uint8_t *p_le_dev_sec_flags, ui *p_le_dev_sec_flags = 0; *p_le_key_size = 0; -#if (SMP_INCLUDED == TRUE) if ((p_dev_rec = btm_find_dev (bd_addr)) == NULL) { BTM_TRACE_ERROR ("%s fails", __func__); @@ -2314,9 +2292,6 @@ bool BTM_GetLeSecurityState (BD_ADDR bd_addr, uint8_t *p_le_dev_sec_flags, ui __func__, *p_le_dev_sec_flags, *p_le_key_size); return true; -#else - return false; -#endif } /******************************************************************************* @@ -2535,7 +2510,6 @@ static void btm_ble_process_irk(tSMP_ENC *p) *******************************************************************************/ static void btm_ble_process_dhk(tSMP_ENC *p) { -#if (SMP_INCLUDED == TRUE) uint8_t btm_ble_irk_pt = 0x01; tSMP_ENC output; @@ -2563,7 +2537,6 @@ static void btm_ble_process_dhk(tSMP_ENC *p) /* reset all identity root related key */ memset(&btm_cb.devcb.id_keys, 0, sizeof(tBTM_BLE_LOCAL_ID_KEYS)); } -#endif } /******************************************************************************* @@ -2579,7 +2552,6 @@ static void btm_ble_process_dhk(tSMP_ENC *p) *******************************************************************************/ static void btm_ble_process_ir2(tBTM_RAND_ENC *p) { -#if (SMP_INCLUDED == TRUE) uint8_t btm_ble_dhk_pt = 0x03; tSMP_ENC output; @@ -2601,7 +2573,6 @@ static void btm_ble_process_ir2(tBTM_RAND_ENC *p) { memset(&btm_cb.devcb.id_keys, 0, sizeof(tBTM_BLE_LOCAL_ID_KEYS)); } -#endif } /******************************************************************************* diff --git a/stack/btm/btm_ble_addr.cc b/stack/btm/btm_ble_addr.cc index 3401f5f61..38d40467d 100644 --- a/stack/btm/btm_ble_addr.cc +++ b/stack/btm/btm_ble_addr.cc @@ -90,7 +90,6 @@ static void btm_gen_resolve_paddr_cmpl(tSMP_ENC *p) *******************************************************************************/ void btm_gen_resolve_paddr_low(tBTM_RAND_ENC *p) { -#if (SMP_INCLUDED == TRUE) tBTM_LE_RANDOM_CB *p_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb; tSMP_ENC output; @@ -114,7 +113,6 @@ void btm_gen_resolve_paddr_low(tBTM_RAND_ENC *p) btm_gen_resolve_paddr_cmpl(&output); } } -#endif } /******************************************************************************* ** @@ -195,7 +193,6 @@ void btm_gen_non_resolvable_private_addr (tBTM_BLE_ADDR_CBACK *p_cback, void *p) btsnd_hcic_ble_rand((void *)btm_gen_non_resolve_paddr_cmpl); } -#if (SMP_INCLUDED == TRUE) /******************************************************************************* ** Utility functions for Random address resolving *******************************************************************************/ @@ -311,7 +308,6 @@ bool btm_ble_addr_resolvable (BD_ADDR rpa, tBTM_SEC_DEV_REC *p_dev_rec) *******************************************************************************/ static bool btm_ble_match_random_bda(void *data, void *context) { -#if (SMP_INCLUDED == TRUE) /* use the 3 MSB of bd address as prand */ tBTM_LE_RANDOM_CB *p_mgnt_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb; @@ -337,7 +333,6 @@ static bool btm_ble_match_random_bda(void *data, void *context) &rand[0], 3, &output); // if it was match, finish iteration, otherwise continue return !btm_ble_proc_resolve_x(&output); -#endif } /******************************************************************************* @@ -375,7 +370,6 @@ void btm_ble_resolve_random_addr(BD_ADDR random_bda, tBTM_BLE_RESOLVE_CBACK * p_ (*p_cback)(NULL, p); } } -#endif /******************************************************************************* ** address mapping between pseudo address and real connection address diff --git a/stack/btm/btm_ble_int.h b/stack/btm/btm_ble_int.h index 26601a43d..28b6ce139 100644 --- a/stack/btm/btm_ble_int.h +++ b/stack/btm/btm_ble_int.h @@ -31,11 +31,7 @@ #include "hcidefs.h" #include "btm_ble_api.h" #include "btm_int.h" - -#if (SMP_INCLUDED == TRUE) #include "smp_api.h" -#endif - #include "btm_ble_int_types.h" #ifdef __cplusplus @@ -73,7 +69,6 @@ extern tBTM_STATUS btm_ble_start_scan(void); extern void btm_ble_create_ll_conn_complete (uint8_t status); /* LE security function from btm_sec.cc */ -#if (SMP_INCLUDED == TRUE) extern void btm_ble_link_sec_check(BD_ADDR bd_addr, tBTM_LE_AUTH_REQ auth_req, tBTM_BLE_SEC_REQ_ACT *p_sec_req_act); extern void btm_ble_ltk_request_reply(BD_ADDR bda, bool use_stk, BT_OCTET16 stk); extern uint8_t btm_proc_smp_cback(tSMP_EVT event, BD_ADDR bd_addr, tSMP_EVT_DATA *p_data); @@ -81,7 +76,6 @@ extern tBTM_STATUS btm_ble_set_encryption (BD_ADDR bd_addr, tBTM_BLE_SEC_ACT sec extern void btm_ble_ltk_request(uint16_t handle, uint8_t rand[8], uint16_t ediv); extern tBTM_STATUS btm_ble_start_encrypt(BD_ADDR bda, bool use_stk, BT_OCTET16 stk); extern void btm_ble_link_encrypted(BD_ADDR bd_addr, uint8_t encr_enable); -#endif /* LE device management functions */ extern void btm_ble_reset_id( void ); diff --git a/stack/btm/btm_ble_multi_adv.cc b/stack/btm/btm_ble_multi_adv.cc index 8e4570b50..7ee1a73e5 100644 --- a/stack/btm/btm_ble_multi_adv.cc +++ b/stack/btm/btm_ble_multi_adv.cc @@ -105,7 +105,6 @@ class BleAdvertisingManagerImpl } void OnRpaGenerationComplete(uint8_t inst_id, tBTM_RAND_ENC *p) { -#if (SMP_INCLUDED == TRUE) LOG(INFO) << "inst_id = " << +inst_id; AdvertisingInstance *p_inst = &adv_inst[inst_id]; @@ -133,7 +132,6 @@ class BleAdvertisingManagerImpl /* set it to controller */ GetHciInterface()->SetRandomAddress(p_inst->rpa, p_inst->inst_id, Bind(DoNothing)); -#endif } void ConfigureRpa(uint8_t inst_id) { diff --git a/stack/btm/btm_int.h b/stack/btm/btm_int.h index 33bd83ca1..7ab5e5eeb 100644 --- a/stack/btm/btm_int.h +++ b/stack/btm/btm_int.h @@ -35,13 +35,9 @@ #include "osi/include/fixed_queue.h" #include "btm_api.h" - #include "btm_ble_int.h" -#if (SMP_INCLUDED == TRUE) -#include "smp_api.h" -#endif - #include "btm_int_types.h" +#include "smp_api.h" #ifdef __cplusplus extern "C" { diff --git a/stack/btm/btm_int_types.h b/stack/btm/btm_int_types.h index 50d211c3b..691c6d74c 100644 --- a/stack/btm/btm_int_types.h +++ b/stack/btm/btm_int_types.h @@ -461,10 +461,8 @@ typedef struct uint8_t active_addr_type; #endif -#if (SMP_INCLUDED == TRUE) tBTM_LE_KEY_TYPE key_type; /* bit mask of valid key types in record */ tBTM_SEC_BLE_KEYS keys; /* LE device security info in slave rode */ -#endif } tBTM_SEC_BLE; /* Peering bond type */ diff --git a/stack/btm/btm_sec.cc b/stack/btm/btm_sec.cc index 457ffed15..f484b64f0 100644 --- a/stack/btm/btm_sec.cc +++ b/stack/btm/btm_sec.cc @@ -228,7 +228,6 @@ bool BTM_SecRegister(tBTM_APPL_INFO *p_cb_info) BTM_TRACE_EVENT("%s application registered", __func__); -#if (SMP_INCLUDED == TRUE) LOG_INFO(LOG_TAG, "%s p_cb_info->p_le_callback == 0x%p", __func__, p_cb_info->p_le_callback); if (p_cb_info->p_le_callback) { @@ -244,12 +243,9 @@ bool BTM_SecRegister(tBTM_APPL_INFO *p_cb_info) { LOG_WARN(LOG_TAG, "%s p_cb_info->p_le_callback == NULL", __func__); } -#endif /* (SMP_INCLUDED == TRUE) */ btm_cb.api = *p_cb_info; -#if (SMP_INCLUDED == TRUE) - LOG_INFO(LOG_TAG, "%s btm_cb.api.p_le_callback = 0x%p ", __func__, btm_cb.api.p_le_callback); -#endif + LOG_INFO(LOG_TAG, "%s btm_cb.api.p_le_callback = 0x%p ", __func__, btm_cb.api.p_le_callback); BTM_TRACE_EVENT("%s application registered", __func__); return(true); } @@ -1022,7 +1018,6 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport, if (trusted_mask) BTM_SEC_COPY_TRUSTED_DEVICE(trusted_mask, p_dev_rec->trusted_mask); -#if (SMP_INCLUDED == TRUE) if (transport == BT_TRANSPORT_LE) { btm_ble_init_pseudo_addr (p_dev_rec, bd_addr); @@ -1039,7 +1034,6 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport, btm_cb.pairing_flags = 0; return(BTM_NO_RESOURCES); } -#endif p_dev_rec->sec_flags &= ~(BTM_SEC_LINK_KEY_KNOWN | BTM_SEC_AUTHENTICATED | BTM_SEC_ENCRYPTED | BTM_SEC_ROLE_SWITCHED | BTM_SEC_LINK_KEY_AUTHED); @@ -1147,7 +1141,6 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport, tBTM_STATUS BTM_SecBondByTransport (BD_ADDR bd_addr, tBT_TRANSPORT transport, uint8_t pin_len, uint8_t *p_pin, uint32_t trusted_mask[]) { -#if (SMP_INCLUDED == TRUE) tBT_DEVICE_TYPE dev_type; tBLE_ADDR_TYPE addr_type; @@ -1158,7 +1151,6 @@ tBTM_STATUS BTM_SecBondByTransport (BD_ADDR bd_addr, tBT_TRANSPORT transport, { return BTM_ILLEGAL_ACTION; } -#endif return btm_sec_bond_by_transport(bd_addr, transport, pin_len, p_pin, trusted_mask); } @@ -1206,7 +1198,6 @@ tBTM_STATUS BTM_SecBondCancel (BD_ADDR bd_addr) || (memcmp (btm_cb.pairing_bda, bd_addr, BD_ADDR_LEN) != 0) ) return BTM_UNKNOWN_ADDR; -#if (SMP_INCLUDED == TRUE) if (btm_cb.pairing_flags & BTM_PAIR_FLAGS_LE_ACTIVE) { if (p_dev_rec->sec_state == BTM_SEC_STATE_AUTHENTICATING) @@ -1220,7 +1211,6 @@ tBTM_STATUS BTM_SecBondCancel (BD_ADDR bd_addr) return BTM_WRONG_MODE; } -#endif BTM_TRACE_DEBUG ("hci_handle:0x%x sec_state:%d", p_dev_rec->hci_handle, p_dev_rec->sec_state ); if (BTM_PAIR_STATE_WAIT_LOCAL_PIN == btm_cb.pairing_state && BTM_PAIR_FLAGS_WE_STARTED_DD & btm_cb.pairing_flags) @@ -1405,7 +1395,6 @@ tBTM_STATUS BTM_SetEncryption (BD_ADDR bd_addr, tBT_TRANSPORT transport, tBTM_SE p_dev_rec->hci_handle, p_dev_rec->sec_state, p_dev_rec->sec_flags, p_dev_rec->security_required); -#if (SMP_INCLUDED == TRUE) if (transport == BT_TRANSPORT_LE) { tACL_CONN *p = btm_bda_to_acl(bd_addr, transport); @@ -1420,8 +1409,9 @@ tBTM_STATUS BTM_SetEncryption (BD_ADDR bd_addr, tBT_TRANSPORT transport, tBTM_SE } } else -#endif + { rc = btm_sec_execute_procedure (p_dev_rec); + } if (rc != BTM_CMD_STARTED && rc != BTM_BUSY) { @@ -1456,7 +1446,6 @@ static tBTM_STATUS btm_sec_send_hci_disconnect (tBTM_SEC_DEV_REC *p_dev_rec, uin p_dev_rec->sec_state = BTM_SEC_STATE_DISCONNECTING_BOTH; break; -#if (SMP_INCLUDED == TRUE) case BTM_SEC_STATE_DISCONNECTING_BLE: if (conn_handle == p_dev_rec->ble_hci_handle) return status; @@ -1466,7 +1455,6 @@ static tBTM_STATUS btm_sec_send_hci_disconnect (tBTM_SEC_DEV_REC *p_dev_rec, uin case BTM_SEC_STATE_DISCONNECTING_BOTH: return status; -#endif default: p_dev_rec->sec_state = (conn_handle == p_dev_rec->hci_handle) ? @@ -4155,10 +4143,8 @@ void btm_sec_auth_complete (uint16_t handle, uint8_t status) void btm_sec_encrypt_change (uint16_t handle, uint8_t status, uint8_t encr_enable) { tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev_by_handle (handle); -#if (SMP_INCLUDED == TRUE) tACL_CONN *p_acl = NULL; uint8_t acl_idx = btm_handle_to_acl_index(handle); -#endif BTM_TRACE_EVENT ("Security Manager: encrypt_change status:%d State:%d, encr_enable = %d", status, (p_dev_rec) ? p_dev_rec->sec_state : 0, encr_enable); BTM_TRACE_DEBUG ("before update p_dev_rec->sec_flags=0x%x", (p_dev_rec) ? p_dev_rec->sec_flags : 0 ); @@ -4204,7 +4190,6 @@ void btm_sec_encrypt_change (uint16_t handle, uint8_t status, uint8_t encr_enabl BTM_TRACE_DEBUG ("after update p_dev_rec->sec_flags=0x%x", p_dev_rec->sec_flags ); -#if (SMP_INCLUDED == TRUE) if (acl_idx != MAX_L2CAP_LINKS) p_acl = &btm_cb.acl_db[acl_idx]; @@ -4283,9 +4268,6 @@ void btm_sec_encrypt_change (uint16_t handle, uint8_t status, uint8_t encr_enabl } } } -#else - btm_sec_check_pending_enc_req (p_dev_rec, BT_TRANSPORT_BR_EDR, encr_enable); -#endif /* SMP_INCLUDED == TRUE */ /* If this encryption was started by peer do not need to do anything */ if (p_dev_rec->sec_state != BTM_SEC_STATE_ENCRYPTING) @@ -4756,7 +4738,6 @@ void btm_sec_disconnected (uint16_t handle, uint8_t reason) } } -#if (SMP_INCLUDED == TRUE) btm_ble_update_mode_operation(HCI_ROLE_UNKNOWN, p_dev_rec->bd_addr, HCI_SUCCESS); /* see sec_flags processing in btm_acl_removed */ @@ -4767,21 +4748,18 @@ void btm_sec_disconnected (uint16_t handle, uint8_t reason) p_dev_rec->enc_key_size = 0; } else -#endif { p_dev_rec->hci_handle = BTM_SEC_INVALID_HANDLE; p_dev_rec->sec_flags &= ~(BTM_SEC_AUTHORIZED | BTM_SEC_AUTHENTICATED | BTM_SEC_ENCRYPTED | BTM_SEC_ROLE_SWITCHED | BTM_SEC_16_DIGIT_PIN_AUTHED); } -#if (SMP_INCLUDED == TRUE) if (p_dev_rec->sec_state == BTM_SEC_STATE_DISCONNECTING_BOTH) { p_dev_rec->sec_state = (transport == BT_TRANSPORT_LE) ? BTM_SEC_STATE_DISCONNECTING : BTM_SEC_STATE_DISCONNECTING_BLE; return; } -#endif p_dev_rec->sec_state = BTM_SEC_STATE_IDLE; p_dev_rec->security_required = BTM_SEC_NONE; @@ -6149,14 +6127,12 @@ void btm_sec_clear_ble_keys (tBTM_SEC_DEV_REC *p_dev_rec) { BTM_TRACE_DEBUG ("%s() Clearing BLE Keys", __func__); -#if (SMP_INCLUDED == TRUE) 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 -#endif } /******************************************************************************* @@ -6175,11 +6151,7 @@ bool btm_sec_is_a_bonded_dev (BD_ADDR bda) bool is_bonded= false; if (p_dev_rec && -#if (SMP_INCLUDED == TRUE) ((p_dev_rec->ble.key_type && (p_dev_rec->sec_flags & BTM_SEC_LE_LINK_KEY_KNOWN))|| -#else - ( -#endif (p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_KNOWN))) { is_bonded = true; diff --git a/stack/btu/btu_hcif.cc b/stack/btu/btu_hcif.cc index d4660ec8a..7c9e9df4b 100644 --- a/stack/btu/btu_hcif.cc +++ b/stack/btu/btu_hcif.cc @@ -1740,9 +1740,7 @@ static void btu_ble_proc_ltk_req (uint8_t *p) STREAM_TO_UINT16(handle, p); pp = p + 8; STREAM_TO_UINT16(ediv, pp); -#if (SMP_INCLUDED == TRUE) btm_ble_ltk_request(handle, p, ediv); -#endif /* This is empty until an upper layer cares about returning event */ } diff --git a/stack/btu/btu_init.cc b/stack/btu/btu_init.cc index f026da2de..5babc101f 100644 --- a/stack/btu/btu_init.cc +++ b/stack/btu/btu_init.cc @@ -34,10 +34,7 @@ #include "osi/include/log.h" #include "osi/include/thread.h" #include "sdpint.h" - -#if (SMP_INCLUDED == TRUE) #include "smp_int.h" -#endif // Increase BTU task thread priority to avoid pre-emption // of audio realated tasks. @@ -87,9 +84,9 @@ void btu_init_core(void) sdp_init(); gatt_init(); -#if (SMP_INCLUDED == TRUE) + SMP_Init(); -#endif + btm_ble_init(); } diff --git a/stack/btu/btu_task.cc b/stack/btu/btu_task.cc index 0be39bd1e..e0f662bf9 100644 --- a/stack/btu/btu_task.cc +++ b/stack/btu/btu_task.cc @@ -75,10 +75,7 @@ extern void avdt_rcv_sync_info (BT_HDR *p_buf); /* this is for hci_test */ #include "bta_sys.h" #include "btm_ble_int.h" #include "gatt_int.h" - -#if (SMP_INCLUDED == TRUE) #include "smp_int.h" -#endif diff --git a/stack/include/btm_api_types.h b/stack/include/btm_api_types.h index af0d3925c..d61d326cd 100644 --- a/stack/include/btm_api_types.h +++ b/stack/include/btm_api_types.h @@ -1349,12 +1349,8 @@ typedef uint8_t tBTM_SP_EVT; #define BTM_IO_CAP_IO 1 /* DisplayYesNo */ #define BTM_IO_CAP_IN 2 /* KeyboardOnly */ #define BTM_IO_CAP_NONE 3 /* NoInputNoOutput */ -#if (SMP_INCLUDED == TRUE) #define BTM_IO_CAP_KBDISP 4 /* Keyboard display */ #define BTM_IO_CAP_MAX 5 -#else -#define BTM_IO_CAP_MAX 4 -#endif typedef uint8_t tBTM_IO_CAP; @@ -1590,7 +1586,6 @@ typedef struct tBTM_LE_KEY_TYPE resp_keys; /* keys to be distributed, bit mask */ } tBTM_LE_IO_REQ; -#if (SMP_INCLUDED == TRUE) /* data type for tBTM_LE_COMPLT */ typedef struct { @@ -1599,7 +1594,6 @@ typedef struct bool is_pair_cancel; bool smp_over_br; }tBTM_LE_COMPLT; -#endif /* BLE encryption keys */ typedef struct @@ -1666,10 +1660,8 @@ typedef union /* BTM_LE_NC_REQ_EVT */ /* no callback data for BTM_LE_KEY_REQ_EVT */ /* and BTM_LE_OOB_REQ_EVT */ -#if (SMP_INCLUDED == TRUE) tBTM_LE_COMPLT complt; /* BTM_LE_COMPLT_EVT */ tSMP_OOB_DATA_TYPE req_oob_type; -#endif tBTM_LE_KEY key; } tBTM_LE_EVT_DATA; @@ -1714,9 +1706,7 @@ typedef struct tBTM_AUTH_COMPLETE_CALLBACK *p_auth_complete_callback; tBTM_BOND_CANCEL_CMPL_CALLBACK *p_bond_cancel_cmpl_callback; tBTM_SP_CALLBACK *p_sp_callback; -#if (SMP_INCLUDED == TRUE) tBTM_LE_CALLBACK *p_le_callback; -#endif tBTM_LE_KEY_CALLBACK *p_le_key_callback; } tBTM_APPL_INFO; diff --git a/stack/include/smp_api.h b/stack/include/smp_api.h index fc843fb82..fae0b7fe3 100644 --- a/stack/include/smp_api.h +++ b/stack/include/smp_api.h @@ -221,14 +221,12 @@ extern void SMP_KeypressNotification (BD_ADDR bd_addr, uint8_t value); *******************************************************************************/ extern bool SMP_CreateLocalSecureConnectionsOobData(tBLE_BD_ADDR *addr_to_send_to); -#if (SMP_INCLUDED == TRUE) // Called when LTK request is received from controller. extern bool smp_proc_ltk_request(BD_ADDR bda); // Called when link is encrypted and notified to slave device. // Proceed to send LTK, DIV and ER to master if bonding the devices. extern void smp_link_encrypted(BD_ADDR bda, uint8_t encr_enable); -#endif /* SMP_INCLUDED == TRUE */ // // The AES-CMAC Generation Function with tlen implemented. diff --git a/stack/include/smp_api_types.h b/stack/include/smp_api_types.h index 49c750978..e3f08f762 100644 --- a/stack/include/smp_api_types.h +++ b/stack/include/smp_api_types.h @@ -28,7 +28,6 @@ extern "C" { #define SMP_PIN_CODE_LEN_MAX PIN_CODE_LEN #define SMP_PIN_CODE_LEN_MIN 6 -#if (SMP_INCLUDED == TRUE) /* SMP command code */ #define SMP_OPCODE_PAIRING_REQ 0x01 #define SMP_OPCODE_PAIRING_RSP 0x02 @@ -47,7 +46,6 @@ extern "C" { #define SMP_OPCODE_MAX SMP_OPCODE_PAIR_KEYPR_NOTIF #define SMP_OPCODE_MIN SMP_OPCODE_PAIRING_REQ #define SMP_OPCODE_PAIR_COMMITM 0x0F -#endif /* SMP event type */ #define SMP_IO_CAP_REQ_EVT 1 /* IO capability request event */ diff --git a/stack/smp/smp_act.cc b/stack/smp/smp_act.cc index 4a1455506..ad4dbfb4b 100644 --- a/stack/smp/smp_act.cc +++ b/stack/smp/smp_act.cc @@ -26,8 +26,6 @@ extern fixed_queue_t *btu_general_alarm_queue; -#if (SMP_INCLUDED == TRUE) - #define SMP_KEY_DIST_TYPE_MAX 4 const tSMP_ACT smp_distribute_act [] = { @@ -2187,5 +2185,3 @@ void smp_br_pairing_complete(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) smp_proc_pairing_cmpl(p_cb); } } - -#endif diff --git a/stack/smp/smp_api.cc b/stack/smp/smp_api.cc index 7fcda6367..03646f2b1 100644 --- a/stack/smp/smp_api.cc +++ b/stack/smp/smp_api.cc @@ -28,16 +28,15 @@ #include "bt_utils.h" #include "stack_config.h" -#if (SMP_INCLUDED == TRUE) - #include "smp_int.h" - #include "smp_api.h" - #include "l2cdefs.h" - #include "l2c_int.h" - #include "btm_int.h" - #include "hcimsgs.h" +#include "smp_int.h" +#include "smp_api.h" +#include "l2cdefs.h" +#include "l2c_int.h" +#include "btm_int.h" +#include "hcimsgs.h" - #include "btu.h" - #include "p_256_ecc_pp.h" +#include "btu.h" +#include "p_256_ecc_pp.h" /******************************************************************************* ** @@ -618,5 +617,3 @@ bool SMP_CreateLocalSecureConnectionsOobData (tBLE_BD_ADDR *addr_to_send_to) return true; } - -#endif /* SMP_INCLUDED */ diff --git a/stack/smp/smp_cmac.cc b/stack/smp/smp_cmac.cc index 30beb7b11..acc798149 100644 --- a/stack/smp/smp_cmac.cc +++ b/stack/smp/smp_cmac.cc @@ -24,13 +24,12 @@ #include "bt_target.h" -#if (SMP_INCLUDED == TRUE) - #include - #include +#include +#include - #include "btm_ble_api.h" - #include "smp_int.h" - #include "hcimsgs.h" +#include "btm_ble_api.h" +#include "smp_int.h" +#include "hcimsgs.h" typedef struct { @@ -323,6 +322,3 @@ bool aes_cipher_msg_auth_code(BT_OCTET16 key, uint8_t *input, uint16_t length return ret; } - -#endif - diff --git a/stack/smp/smp_keys.cc b/stack/smp/smp_keys.cc index 1d65f74ca..566ff2a49 100644 --- a/stack/smp/smp_keys.cc +++ b/stack/smp/smp_keys.cc @@ -23,7 +23,6 @@ ******************************************************************************/ #include "bt_target.h" -#if (SMP_INCLUDED == TRUE) #if (SMP_DEBUG == TRUE) #include #endif @@ -2249,6 +2248,3 @@ static void smp_rand_back(tBTM_RAND_ENC *p) SMP_TRACE_ERROR("%s key generation failed: (%d)", __func__, p_cb->rand_enc_proc_state); smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &failure); } - -#endif - diff --git a/stack/smp/smp_l2c.cc b/stack/smp/smp_l2c.cc index a7a8e6d01..6bc2ab04e 100644 --- a/stack/smp/smp_l2c.cc +++ b/stack/smp/smp_l2c.cc @@ -24,8 +24,6 @@ #include "bt_target.h" -#if (SMP_INCLUDED == TRUE) - #include #include "btm_ble_api.h" #include "l2c_api.h" @@ -342,4 +340,3 @@ static void smp_br_data_received(uint16_t channel, BD_ADDR bd_addr, BT_HDR *p_bu osi_free(p_buf); } -#endif /* SMP_INCLUDED == TRUE */ diff --git a/stack/smp/smp_main.cc b/stack/smp/smp_main.cc index 87c1f7480..203d29980 100644 --- a/stack/smp/smp_main.cc +++ b/stack/smp/smp_main.cc @@ -18,8 +18,6 @@ #include "bt_target.h" -#if (SMP_INCLUDED == TRUE) - #include #include "smp_int.h" @@ -856,6 +854,3 @@ const char * smp_get_event_name(tSMP_EVENT event) } return p_str; } - -#endif - diff --git a/stack/smp/smp_utils.cc b/stack/smp/smp_utils.cc index 3b2cc7e98..649e8328b 100644 --- a/stack/smp/smp_utils.cc +++ b/stack/smp/smp_utils.cc @@ -23,8 +23,6 @@ ******************************************************************************/ #include "bt_target.h" -#if (SMP_INCLUDED == TRUE) - #include "bt_types.h" #include "bt_utils.h" #include @@ -1555,7 +1553,3 @@ bool smp_request_oob_data(tSMP_CB *p_cb) return true; } - - -#endif - -- 2.11.0