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

Commit cc89a6e2 authored by Hui Peng's avatar Hui Peng Committed by Gerrit Code Review
Browse files

Merge "[Invisalign2] Define BTM_SetSecurityLevel in SecurityClientInterface" into main

parents bd898c9e ba4e084e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@
#include "stack/include/bt_psm_types.h"
#include "stack/include/bt_types.h"
#include "stack/include/bt_uuid16.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/gap_api.h"
#include "stack/include/l2cdefs.h"
#include "stack/include/port_api.h"
@@ -1384,8 +1385,9 @@ void bta_jv_rfcomm_connect(tBTA_SEC sec_mask, uint8_t remote_scn,
    // 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);
    get_btm_client_interface().security.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 &&
+1 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ static SecurityClientInterface security = {
    .BTM_SecIsSecurityPending = BTM_SecIsSecurityPending,
    .BTM_IsLinkKeyKnown = BTM_IsLinkKeyKnown,

    .BTM_SetSecurityLevel = BTM_SetSecurityLevel,
    .BTM_SecClrService = BTM_SecClrService,
    .BTM_SecClrServiceByPsm = BTM_SecClrServiceByPsm,

+5 −1
Original line number Diff line number Diff line
@@ -126,7 +126,11 @@ typedef struct {
  bool (*BTM_IsLinkKeyKnown)(const RawAddress& bd_addr,
                             tBT_TRANSPORT transport);

  // Securre service management
  // Secure service management
  bool (*BTM_SetSecurityLevel)(bool is_originator, const char* p_name,
                               uint8_t service_id, uint16_t sec_level,
                               uint16_t psm, uint32_t mx_proto_id,
                               uint32_t mx_chan_id);
  uint8_t (*BTM_SecClrService)(uint8_t service_id);
  uint8_t (*BTM_SecClrServiceByPsm)(uint16_t psm);

+9 −4
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@
#include "stack/include/bt_hdr.h"
#include "stack/include/bt_psm_types.h"
#include "stack/include/btm_api.h"
#include "stack/include/btm_client_interface.h"
#include "stack/include/l2c_api.h"
#include "stack/include/main_thread.h"
#include "stack/l2cap/l2c_int.h"
@@ -72,7 +73,8 @@ uint16_t L2CA_Register2(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
                        uint16_t sec_level) {
  auto ret = L2CA_Register(psm, p_cb_info, enable_snoop, p_ertm_info, my_mtu,
                           required_remote_mtu, sec_level);
  BTM_SetSecurityLevel(false, "", 0, sec_level, psm, 0, 0);
  get_btm_client_interface().security.BTM_SetSecurityLevel(
      false, "", 0, sec_level, psm, 0, 0);
  return ret;
}

@@ -296,7 +298,8 @@ void L2CA_FreeLePSM(uint16_t psm) {

uint16_t L2CA_ConnectReq2(uint16_t psm, const RawAddress& p_bd_addr,
                          uint16_t sec_level) {
  BTM_SetSecurityLevel(true, "", 0, sec_level, psm, 0, 0);
  get_btm_client_interface().security.BTM_SetSecurityLevel(
      true, "", 0, sec_level, psm, 0, 0);
  return L2CA_ConnectReq(psm, p_bd_addr);
}

@@ -399,7 +402,8 @@ uint16_t L2CA_RegisterLECoc(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
  if (p_cb_info.pL2CA_ConnectInd_Cb != nullptr || psm < LE_DYNAMIC_PSM_START) {
    //  If we register LE COC for outgoing connection only, don't register with
    //  BTM_Sec, because it's handled by L2CA_ConnectLECocReq.
    BTM_SetSecurityLevel(false, "", 0, sec_level, psm, 0, 0);
    get_btm_client_interface().security.BTM_SetSecurityLevel(
        false, "", 0, sec_level, psm, 0, 0);
  }

  /* Verify that the required callback info has been filled in
@@ -509,7 +513,8 @@ void L2CA_DeregisterLECoc(uint16_t psm) {
 ******************************************************************************/
uint16_t L2CA_ConnectLECocReq(uint16_t psm, const RawAddress& p_bd_addr,
                              tL2CAP_LE_CFG_INFO* p_cfg, uint16_t sec_level) {
  BTM_SetSecurityLevel(true, "", 0, sec_level, psm, 0, 0);
  get_btm_client_interface().security.BTM_SetSecurityLevel(
      true, "", 0, sec_level, psm, 0, 0);

  VLOG(1) << __func__ << " BDA: " << ADDRESS_TO_LOGGABLE_STR(p_bd_addr)
          << StringPrintf(" PSM: 0x%04x", psm);