OSDN Git Service

DO NOT MERGE Store BLE keys using the address from the ble_auth_cmpl_evt
authorUgo Yu <ugoyu@google.com>
Thu, 11 Jul 2019 12:12:42 +0000 (20:12 +0800)
committerVasyl Gello <vasek.gello@gmail.com>
Tue, 5 Nov 2019 21:09:26 +0000 (21:09 +0000)
Reading the peer address from btif_dm_ble_auth_cmpl_evt, instead
of using the value from the pairing control block in
btif_dm_save_ble_bonding_keys, ensures that BLE keys are stored with
the correct address.

Bug: 133234174
Bug: 79703832
Test: 1. Initiate crosskey pairing from BLE
      2. Check whether BLE keys are stored correctly
Change-Id: I18b4a1d8e2cdcd6dd4a300f1dc9e6d3892a3baff
(cherry picked from commit 0d95651e8b22b1012f1ee103e4a0b8665a0c17d4)
(cherry picked from commit b2334f05895e9926666904c41f13821210cbd6e9)

btif/include/btif_dm.h
btif/src/btif_dm.c

index 2e40348..0bca270 100644 (file)
@@ -98,7 +98,7 @@ typedef struct
 void btif_dm_load_ble_local_keys(void);
 void btif_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET16 er,
                                    tBTA_BLE_LOCAL_ID_KEYS *p_id_keys);
-void btif_dm_save_ble_bonding_keys(void);
+void btif_dm_save_ble_bonding_keys(bt_bdaddr_t bd_addr);
 void btif_dm_remove_ble_bonding_keys(void);
 void btif_dm_ble_sec_req_evt(tBTA_DM_BLE_SEC_REQ *p_ble_req);
 
index 73c9305..489c572 100644 (file)
@@ -3423,7 +3423,7 @@ static void btif_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
             btif_storage_remove_bonded_device(&bdaddr);
             state = BT_BOND_STATE_NONE;
         } else {
-            btif_dm_save_ble_bonding_keys();
+            btif_dm_save_ble_bonding_keys(bdaddr);
             BTA_GATTC_Refresh(bd_addr.address);
             btif_dm_get_remote_services_by_transport(&bd_addr, BTA_GATT_TRANSPORT_LE);
         }
@@ -3494,15 +3494,11 @@ void    btif_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OC
     BTIF_TRACE_DEBUG("%s  *p_key_mask=0x%02x",__FUNCTION__,   *p_key_mask);
 }
 
-void btif_dm_save_ble_bonding_keys(void)
+void btif_dm_save_ble_bonding_keys(bt_bdaddr_t bd_addr)
 {
 
-    bt_bdaddr_t bd_addr;
-
     BTIF_TRACE_DEBUG("%s",__FUNCTION__ );
 
-    bdcpy(bd_addr.address, pairing_cb.bd_addr);
-
     if (pairing_cb.ble.is_penc_key_rcvd)
     {
         btif_storage_add_ble_bonding_key(&bd_addr,