summaryrefslogtreecommitdiffstats
path: root/btif
diff options
context:
space:
mode:
authorRavi Nagarajan <nravi@broadcom.com>2012-05-02 17:21:37 +0530
committerMatthew Xie <mattx@google.com>2012-07-14 11:19:19 -0700
commitdefb69c3b383ad0f9b5d6329be625fafc2e3c931 (patch)
tree1d13985bb9ca12b943aa70474a9a42243e6040a4 /btif
parentcff2b2b29bd9083f0b92e628b225a72a7ef52332 (diff)
downloadexternal_bluetooth_bluedroid-defb69c3b383ad0f9b5d6329be625fafc2e3c931.zip
external_bluetooth_bluedroid-defb69c3b383ad0f9b5d6329be625fafc2e3c931.tar.gz
external_bluetooth_bluedroid-defb69c3b383ad0f9b5d6329be625fafc2e3c931.tar.bz2
Resolve JustWorks related pairing issues
1. Per the spec, if both sides are using "No Bonding" for auth requirements, then the key could be considered a session key. Updated the pairing logic to handle this 2. If incoming JustWorks pairing is initiated, prompt the user for consent if the peer's io capabilities reflects DisplayOnly or NoInputNoOutput Change-Id: If592c96203e7a4b25af3d87056d534131b606e58
Diffstat (limited to 'btif')
-rw-r--r--btif/src/btif_dm.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index df4998d..65de159 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -533,6 +533,7 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
bt_bdname_t bd_name;
UINT32 cod;
btif_dm_remote_name_t remote_param;
+ BOOLEAN is_incoming = !(pairing_cb.state == BT_BOND_STATE_BONDING);
BTIF_TRACE_DEBUG1("%s", __FUNCTION__);
@@ -546,21 +547,36 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
/* Set the pairing_cb based on the local & remote authentication requirements */
bond_state_changed(BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_BONDING);
- if ((p_ssp_cfm_req->loc_auth_req >= BTM_AUTH_AP_NO && p_ssp_cfm_req->rmt_auth_req >= BTM_AUTH_AP_NO) ||
- (p_ssp_cfm_req->loc_auth_req == BTM_AUTH_AP_NO || p_ssp_cfm_req->loc_auth_req == BTM_AUTH_AP_YES) ||
- (p_ssp_cfm_req->rmt_auth_req == BTM_AUTH_AP_NO || p_ssp_cfm_req->rmt_auth_req == BTM_AUTH_AP_YES))
- pairing_cb.is_temp = FALSE;
- else
+
+ /* if just_works and bonding bit is not set treat this as temporary */
+ if (p_ssp_cfm_req->just_works && !(p_ssp_cfm_req->loc_auth_req & BTM_AUTH_BONDS) &&
+ !(p_ssp_cfm_req->rmt_auth_req & BTM_AUTH_BONDS))
pairing_cb.is_temp = TRUE;
+ else
+ pairing_cb.is_temp = FALSE;
pairing_cb.is_ssp = TRUE;
/* If JustWorks auto-accept */
if (p_ssp_cfm_req->just_works)
{
- BTIF_TRACE_EVENT1("%s: Auto-accept JustWorks pairing", __FUNCTION__);
- btif_dm_ssp_reply(&bd_addr, BT_SSP_VARIANT_CONSENT, TRUE, 0);
- return;
+ /* Pairing consent for JustWorks needed if:
+ * 1. Incoming pairing is detected AND
+ * 2. local IO capabilities are DisplayYesNo AND
+ * 3. remote IO capabiltiies are DisplayOnly or NoInputNoOutput;
+ */
+ if ((is_incoming) && ((p_ssp_cfm_req->loc_io_caps == 0x01) &&
+ (p_ssp_cfm_req->rmt_io_caps == 0x00 || p_ssp_cfm_req->rmt_io_caps == 0x03)))
+ {
+ BTIF_TRACE_EVENT3("%s: User consent needed for incoming pairing request. loc_io_caps: %d, rmt_io_caps: %d",
+ __FUNCTION__, p_ssp_cfm_req->loc_io_caps, p_ssp_cfm_req->rmt_io_caps);
+ }
+ else
+ {
+ BTIF_TRACE_EVENT1("%s: Auto-accept JustWorks pairing", __FUNCTION__);
+ btif_dm_ssp_reply(&bd_addr, BT_SSP_VARIANT_CONSENT, TRUE, 0);
+ return;
+ }
}
cod = devclass2uint(p_ssp_cfm_req->dev_class);
@@ -570,8 +586,8 @@ static void btif_dm_ssp_cfm_req_evt(tBTA_DM_SP_CFM_REQ *p_ssp_cfm_req)
cod = COD_UNCLASSIFIED;
}
- HAL_CBACK(bt_hal_cbacks, ssp_request_cb, &bd_addr, &bd_name,
- cod, BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+ HAL_CBACK(bt_hal_cbacks, ssp_request_cb, &bd_addr, &bd_name, cod,
+ (p_ssp_cfm_req->just_works ? BT_SSP_VARIANT_CONSENT : BT_SSP_VARIANT_PASSKEY_CONFIRMATION),
p_ssp_cfm_req->num_val);
}