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

Commit 9759a649 authored by Archie Pusaka's avatar Archie Pusaka Committed by Gerrit Code Review
Browse files

Merge "floss: Avoid extra authentication for a secure RFCOMM connection" into main

parents 803d3778 a8e99ffd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -380,6 +380,7 @@ cc_test {
        "liblog",
        "libprotobuf-cpp-lite",
        "libstatssocket",
        "server_configurable_flags",
    ],
    static_libs: [
        "libbluetooth-types",
@@ -434,8 +435,10 @@ cc_test {
        "libcrypto",
        "libcutils",
        "liblog",
        "server_configurable_flags",
    ],
    static_libs: [
        "bluetooth_flags_c_lib",
        "libbluetooth-types",
        "libbt-common",
        "libbt-platform-protos-lite",
+15 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include <cstdint>
#include <unordered_set>

#include "android_bluetooth_flags.h"
#include "bta/include/bta_jv_co.h"
#include "bta/include/bta_rfcomm_scn.h"
#include "bta/jv/bta_jv_int.h"
@@ -1372,6 +1373,20 @@ void bta_jv_rfcomm_connect(tBTA_SEC sec_mask, uint8_t remote_scn,
  tBTA_JV_RFCOMM_CL_INIT evt_data;
  memset(&evt_data, 0, sizeof(evt_data));
  evt_data.status = BTA_JV_SUCCESS;

#ifdef TARGET_FLOSS
  if (true)
#else
  if (IS_FLAG_ENABLED(rfcomm_always_use_mitm))
#endif
  {
    // Update security service record for RFCOMM client so that
    // secure RFCOMM connection will be authenticated with MTIM protection
    // while creating the L2CAP connection.
    BTM_SetSecurityLevel(true, "RFC_MUX", BTM_SEC_SERVICE_RFC_MUX, sec_mask,
                         BT_PSM_RFCOMM, BTM_SEC_PROTO_RFCOMM, 0);
  }

  if (evt_data.status == BTA_JV_SUCCESS &&
      RFCOMM_CreateConnectionWithSecurity(
          UUID_SERVCLASS_SERIAL_PORT, remote_scn, false, BTA_JV_DEF_RFC_MTU,