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

Commit 1dbff51c authored by Hansong Zhang's avatar Hansong Zhang
Browse files

ACL: Move some security flag change to Security

Moving BTM_SEC_LE_LINK_KEY_AUTHED and BTM_SEC_ROLE_SWITCHED.

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ib8440b6956d7424d3c9f722d6705deefb619679d
parent 83cd357b
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -487,18 +487,6 @@ void btm_acl_removed(uint16_t handle) {
    BTA_dm_acl_down(bda, transport);
  }

  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bda);
  if (p_dev_rec == nullptr) {
    LOG_WARN("Device security record not found");
  } else {
    if (p_acl->transport == BT_TRANSPORT_LE) {
      p_dev_rec->sec_flags &= ~(BTM_SEC_LE_ENCRYPTED | BTM_SEC_ROLE_SWITCHED);
      if ((p_dev_rec->sec_flags & BTM_SEC_LE_LINK_KEY_KNOWN) == 0) {
        p_dev_rec->sec_flags &=
            ~(BTM_SEC_LE_LINK_KEY_AUTHED | BTM_SEC_LE_AUTHENTICATED);
      }
    }
  }
  memset(p_acl, 0, sizeof(tACL_CONN));
}

+7 −1
Original line number Diff line number Diff line
@@ -3722,9 +3722,15 @@ void btm_sec_disconnected(uint16_t handle, tHCI_STATUS reason) {

  if (transport == BT_TRANSPORT_LE) {
    p_dev_rec->ble_hci_handle = HCI_INVALID_HANDLE;
    p_dev_rec->sec_flags &= ~(BTM_SEC_LE_AUTHENTICATED | BTM_SEC_LE_ENCRYPTED);
    p_dev_rec->sec_flags &= ~(BTM_SEC_LE_AUTHENTICATED | BTM_SEC_LE_ENCRYPTED |
                              BTM_SEC_ROLE_SWITCHED);
    p_dev_rec->enc_key_size = 0;

    if ((p_dev_rec->sec_flags & BTM_SEC_LE_LINK_KEY_KNOWN) == 0) {
      p_dev_rec->sec_flags &=
          ~(BTM_SEC_LE_LINK_KEY_AUTHED | BTM_SEC_LE_AUTHENTICATED);
    }

    // This is for chips that don't support being in connected and advertising
    // state at same time.
    if (!p_dev_rec->is_originator) {