If it is enabled, the logic makes no sense.
The security flags are stored in 2 bytes.
The upper byte is LE security flags, and the lower byte is classic flags.
It is checking the classic flags to determine whether to start
BLE encryption.
It was false by default.
Bug:
159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ifabf514e20c2bc95d2f81a94158b8b63c5e2db6d
* Encrypted link map handling
******************************************************************************/
-#if (BLE_DELAY_REQUEST_ENC == FALSE)
static bool btif_gatt_is_link_encrypted(const RawAddress& bd_addr) {
return BTM_IsEncrypted(bd_addr, BT_TRANSPORT_BR_EDR) ||
BTM_IsEncrypted(bd_addr, BT_TRANSPORT_LE);
BTIF_TRACE_WARNING("%s() - Encryption failed (%d)", __func__, result);
}
}
-#endif
-#if (BLE_DELAY_REQUEST_ENC == FALSE)
void btif_gatt_check_encrypted_link(RawAddress bd_addr,
tBT_TRANSPORT transport_link) {
tBTM_LE_PENC_KEYS key;
BTM_BLE_SEC_ENCRYPT);
}
}
-#else
-void btif_gatt_check_encrypted_link(UNUSED_ATTR RawAddress bd_addr,
- UNUSED_ATTR tBT_TRANSPORT transport_link) {}
-#endif
void btif_gatt_move_track_adv_data(btgatt_track_adv_info_t* p_dest,
btgatt_track_adv_info_t* p_src) {
* ATT/GATT Protocol/Profile Settings
*
*****************************************************************************/
-#ifndef BLE_DELAY_REQUEST_ENC
-/* This flag is to work around IPHONE problem, We need to wait for iPhone ready
- before send encryption request to iPhone */
-#define BLE_DELAY_REQUEST_ENC FALSE
-#endif
-
#ifndef GATT_MAX_SR_PROFILES
#define GATT_MAX_SR_PROFILES 32 /* max is 32 */
#endif
}
}
-#if (BLE_DELAY_REQUEST_ENC == TRUE)
- uint8_t flag = 0;
- if (BTM_GetSecurityFlags(tcb.peer_bda, &flag)) {
- if ((tcb.att_lcid == L2CAP_ATT_CID) && (status == GATT_PENDING) &&
- (type.As16Bit() == GATT_UUID_GAP_DEVICE_NAME)) {
- if ((flag & (BTM_SEC_LINK_KEY_KNOWN | BTM_SEC_FLAG_ENCRYPTED)) ==
- BTM_SEC_LINK_KEY_KNOWN) {
- tHCI_ROLE role = HCI_ROLE_UNKNOWN;
- BTM_GetRole(tcb.peer_bda, &role);
- if (role == HCI_ROLE_CENTRAL) {
- btm_ble_set_encryption(tcb.peer_bda, BTM_BLE_SEC_ENCRYPT,
- HCI_ROLE_CENTRAL);
- }
- }
- }
- }
-#endif
return status;
}