Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8a46799 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

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
parent 4ee1dbcf
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -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: "