From c72d15f9e0c6cf2142eb5439f8ad571d69220eb7 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 31 Aug 2020 15:52:20 -0700 Subject: [PATCH] L2cap sec: Remove the workaround for legacy device We don't enforce security when we need to open an L2cap channel for a legacy device (pre 2.1, simple pairing not supported), and let upper layer enforce security. However, now we always enforce security in L2cap, except for RFCOMM (which is additional), so there is no other upper layer can enforce security. Moreover, supporting pre 2.1 devices (either local or remote) can give us additional complexity, and GD doesn't support it. Bug: 159815595 Tag: #refactor Test: compile & verify basic functions working Change-Id: I8bfaa30bb211275aa37122fab991c776a132abcd --- stack/btm/btm_sec.cc | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/stack/btm/btm_sec.cc b/stack/btm/btm_sec.cc index 43c49a50e..142477c93 100644 --- a/stack/btm/btm_sec.cc +++ b/stack/btm/btm_sec.cc @@ -1660,26 +1660,6 @@ tBTM_STATUS btm_sec_l2cap_access_req(const RawAddress& bd_addr, uint16_t psm, } } - /* if the originator is using dynamic PSM in legacy mode, do not start any - * security process now - * The layer above L2CAP needs to carry out the security requirement after - * L2CAP connect - * response is received */ - if (is_originator && - ((btm_cb.security_mode == BTM_SEC_MODE_SERVICE) || - !BTM_SEC_IS_SM4(p_dev_rec->sm4)) && - (psm >= 0x1001)) { - BTM_TRACE_EVENT( - "dynamic PSM:0x%x in legacy mode - postponed for upper layer", psm); - /* restore the old settings */ - p_dev_rec->security_required = old_security_required; - p_dev_rec->is_originator = old_is_originator; - - (*p_callback)(&bd_addr, transport, p_ref_data, BTM_SUCCESS); - - return (BTM_SUCCESS); - } - if (chk_acp_auth_done) { BTM_TRACE_DEBUG( "(SM4 to SM4) btm_sec_l2cap_access_req rspd. authenticated: x%x, enc: " -- 2.11.0