OSDN Git Service

L2cap sec: Remove the workaround for legacy device
authorHansong Zhang <hsz@google.com>
Mon, 31 Aug 2020 22:52:20 +0000 (15:52 -0700)
committerHansong Zhang <hsz@google.com>
Tue, 1 Sep 2020 23:45:27 +0000 (16:45 -0700)
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

index 43c49a5..142477c 100644 (file)
@@ -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: "