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

Commit 998cc9f9 authored by Brian Delwiche's avatar Brian Delwiche Committed by Automerger Merge Worker
Browse files

Disallow connect with Secure Connections downgrade am: f20fdd9b

parents 57bc47c4 f20fdd9b
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -4128,6 +4128,13 @@ void btm_sec_link_key_notification(const RawAddress& p_bda,
    }
  }

  if (p_dev_rec->is_bond_type_persistent() &&
      (p_dev_rec->is_device_type_br_edr() ||
       p_dev_rec->is_device_type_dual_mode())) {
    btm_sec_store_device_sc_support(p_dev_rec->get_br_edr_hci_handle(),
                                    p_dev_rec->SupportsSecureConnections());
  }

  /* If name is not known at this point delay calling callback until the name is
   */
  /* resolved. Unless it is a HID Device and we really need to send all link
@@ -5214,6 +5221,16 @@ void btm_sec_set_peer_sec_caps(uint16_t hci_handle, bool ssp_supported,
  tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev_by_handle(hci_handle);
  if (p_dev_rec == nullptr) return;

  // Drop the connection here if the remote attempts to downgrade from Secure
  // Connections mode.
  if (btm_sec_is_device_sc_downgrade(hci_handle, sc_supported)) {
    acl_set_disconnect_reason(HCI_ERR_HOST_REJECT_SECURITY);
    btm_sec_send_hci_disconnect(
        p_dev_rec, HCI_ERR_AUTH_FAILURE, hci_handle,
        "attempted to downgrade from Secure Connections mode");
    return;
  }

  p_dev_rec->remote_feature_received = true;
  p_dev_rec->remote_supports_hci_role_switch = hci_role_switch_supported;