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

Commit ae73a197 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Move rfcomm security requirement to rfcomm module

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I2b0a15e887da8d3b5e022deaf600a99448976487
parent 21282e3b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include "sdp_api.h"
#include "stack/btm/btm_sec.h"
#include "stack/include/btu.h"
#include "stack/include/port_api.h"
#include "utl.h"

using bluetooth::Uuid;
@@ -273,7 +274,7 @@ void bta_ag_del_records(tBTA_AG_SCB* p_scb) {
        bta_ag_cb.profile[i].sdp_handle = 0;
      }
      BTM_FreeSCN(bta_ag_cb.profile[i].scn);
      BTM_ClearRfcommSecurity(bta_ag_cb.profile[i].scn);
      RFCOMM_ClearSecurityRecord(bta_ag_cb.profile[i].scn);
      bta_sys_remove_uuid(bta_ag_uuid[i]);
    }
  }
+2 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include "osi/include/osi.h"
#include "osi/include/properties.h"
#include "stack/btm/btm_sec.h"
#include "stack/include/port_api.h"

using bluetooth::Uuid;

@@ -205,7 +206,7 @@ void bta_hf_client_del_record(tBTA_HF_CLIENT_CB_ARR* client_cb) {
    SDP_DeleteRecord(client_cb->sdp_handle);
    client_cb->sdp_handle = 0;
    BTM_FreeSCN(client_cb->scn);
    BTM_ClearRfcommSecurity(client_cb->scn);
    RFCOMM_ClearSecurityRecord(client_cb->scn);
    bta_sys_remove_uuid(UUID_SERVCLASS_HF_HANDSFREE);
  }
}
+4 −1
Original line number Diff line number Diff line
@@ -117,7 +117,6 @@ static void bta_jv_free_sec_id(uint8_t* p_sec_id) {
  uint8_t sec_id = *p_sec_id;
  *p_sec_id = 0;
  if (sec_id >= BTA_JV_FIRST_SERVICE_ID && sec_id <= BTA_JV_LAST_SERVICE_ID) {
    BTM_SecClrService(sec_id);
    bta_jv_cb.sec_id[sec_id - BTA_JV_FIRST_SERVICE_ID] = 0;
  }
}
@@ -292,6 +291,7 @@ static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB* p_cb,
    p_pcb->handle = 0;
    p_cb->curr_sess--;
    if (p_cb->curr_sess == 0) {
      RFCOMM_ClearSecurityRecord(p_cb->scn);
      p_cb->scn = 0;
      bta_jv_free_sec_id(&p_cb->sec_id);
      p_cb->p_cback = NULL;
@@ -299,6 +299,7 @@ static tBTA_JV_STATUS bta_jv_free_rfc_cb(tBTA_JV_RFC_CB* p_cb,
      p_cb->curr_sess = -1;
    }
    if (remove_server) {
      RFCOMM_ClearSecurityRecord(p_cb->scn);
      bta_jv_free_sec_id(&p_cb->sec_id);
    }
  }
@@ -1323,6 +1324,7 @@ void bta_jv_rfcomm_connect(tBTA_SEC sec_mask, uint8_t remote_scn,
  p_cback(BTA_JV_RFCOMM_CL_INIT_EVT, &bta_jv, rfcomm_slot_id);
  if (bta_jv.rfc_cl_init.status == BTA_JV_FAILURE) {
    if (sec_id) bta_jv_free_sec_id(&sec_id);
    RFCOMM_ClearSecurityRecord(remote_scn);
    if (handle) RFCOMM_RemoveConnection(handle);
  }
}
@@ -1634,6 +1636,7 @@ void bta_jv_rfcomm_start_server(tBTA_SEC sec_mask, uint8_t local_scn,
    PORT_SetDataCOCallback(handle, bta_jv_port_data_co_cback);
  } else {
    if (sec_id) bta_jv_free_sec_id(&sec_id);
    RFCOMM_ClearSecurityRecord(local_scn);
    if (handle) RFCOMM_RemoveConnection(handle);
  }
}
+2 −2
Original line number Diff line number Diff line
@@ -970,8 +970,8 @@ void bluetooth::shim::SendRemoteNameRequest(const RawAddress& raw_address) {
}

tBTM_STATUS bluetooth::shim::btm_sec_mx_access_request(
    const RawAddress& bd_addr, uint16_t psm, bool is_originator,
    uint32_t mx_proto_id, uint32_t mx_chan_id, tBTM_SEC_CALLBACK* p_callback,
    const RawAddress& bd_addr, bool is_originator,
    uint16_t security_requirement, tBTM_SEC_CALLBACK* p_callback,
    void* p_ref_data) {
  // Security has already been fulfilled by the l2cap connection, so reply back
  // that everything is totally fine and legit and definitely not two kids in a
+3 −3
Original line number Diff line number Diff line
@@ -1986,9 +1986,9 @@ tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK* p_ener_cback);
 */
void SendRemoteNameRequest(const RawAddress& raw_address);

tBTM_STATUS btm_sec_mx_access_request(const RawAddress& bd_addr, uint16_t psm,
                                      bool is_originator, uint32_t mx_proto_id,
                                      uint32_t mx_chan_id,
tBTM_STATUS btm_sec_mx_access_request(const RawAddress& bd_addr,
                                      bool is_originator,
                                      uint16_t security_requirement,
                                      tBTM_SEC_CALLBACK* p_callback,
                                      void* p_ref_data);

Loading