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

Commit eefb027a authored by bidsharmag's avatar bidsharmag Committed by Bidhya Sharma
Browse files

BLE: Don't set SC bit in AuthReq for Legacy Device

In android 12, changes from aosp/557339 used to set
secure connection flag to false for legacy ble devices.

Restoring the changes to support legacy devices
as found in Android 12. https://cs.android.com/android/platform/superproject/+/android-12.1.0_r27:system/bt/stack/smp/smp_act.cc;l=180

Bug: 277308810
Tag: #refactor
Test: manual

Change-Id: I43cdca1bb1a2bddf1b343b2c7e94ceb17f4d15da
parent a6d7de9b
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -189,6 +189,27 @@ void smp_send_app_cback(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
                remote_lmp_version);
          }

          if (!p_cb->secure_connections_only_mode_required &&
              (!(p_cb->loc_auth_req & SMP_SC_SUPPORT_BIT) ||
               (remote_lmp_version &&
                remote_lmp_version < HCI_PROTO_VERSION_4_2) ||
               interop_match_addr(INTEROP_DISABLE_LE_SECURE_CONNECTIONS,
                                  (const RawAddress*)&p_cb->pairing_bda))) {
            LOG_DEBUG(
                "Setting SC, H7 and LinkKey bits to false to support "
                "legacy device with lmp version: %d",
                remote_lmp_version);
            p_cb->loc_auth_req &= ~SMP_SC_SUPPORT_BIT;
            p_cb->loc_auth_req &= ~SMP_KP_SUPPORT_BIT;
            p_cb->local_i_key &= ~SMP_SEC_KEY_TYPE_LK;
            p_cb->local_r_key &= ~SMP_SEC_KEY_TYPE_LK;
          }

          if (remote_lmp_version &&
              remote_lmp_version < HCI_PROTO_VERSION_5_0) {
            p_cb->loc_auth_req &= ~SMP_H7_SUPPORT_BIT;
          }

          LOG_DEBUG(
              "Remote request IO capabilities postcondition auth_req: 0x%02x,"
              " local_i_key: 0x%02x, local_r_key: 0x%02x",