OSDN Git Service

Avoid skipping SDP after link key derivation
authorNitin Arora <niarora@codeaurora.org>
Wed, 13 Apr 2016 22:53:03 +0000 (15:53 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Fri, 21 Oct 2016 22:16:39 +0000 (22:16 +0000)
Use Case:
In case of cross key derivation of BR link key from a secure LTK,
the corresponding BR transport needs to go through the SDP routine
and alert the upper layers regarding the bond completion of the
BR transport. This specific procedure is currently getting skipped
in an attempt to prevent spurious link key notifications from causing
bond state changes

Fix:
Added an additional check to make sure that the LE pairing is not
ongoing before skipping the SDP. This uses the sequence of operations
where the LE LTK is generated first and link key is derived from the
LTK.

Test: mma -j32
Change-Id: Ife242c93c3adf90d581ac0bbf4896dd164b9f8e2

btif/src/btif_dm.cc

index 162e2c2..1f5c5ed 100644 (file)
@@ -1061,11 +1061,14 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) {
   }
 
   // We could have received a new link key without going through the pairing
-  // flow.
-  // If so, we don't want to perform SDP or any other operations on the
-  // authenticated
-  // device.
-  if (bdcmp(p_auth_cmpl->bd_addr, pairing_cb.bd_addr) != 0) {
+  // flow.  If so, we don't want to perform SDP or any other operations on the
+  // authenticated device. Also, make sure that the link key is not derived from
+  // secure LTK, because we will need to perform SDP in case of link key
+  // derivation to allow bond state change notification for the BR/EDR transport
+  // so that the subsequent BR/EDR connections to the remote can use the derived
+  // link key.
+  if ((bdcmp(p_auth_cmpl->bd_addr, pairing_cb.bd_addr) != 0) &&
+      (!pairing_cb.ble.is_penc_key_rcvd)) {
     char address[32];
     bt_bdaddr_t bt_bdaddr;