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

Commit 6dd1ab52 authored by Myles Watson's avatar Myles Watson
Browse files

Security: Move parsing to HCI: SP complete

The security code should not have to parse packets.

Bug: 301661850
Test: mma -j32
Change-Id: I941ca006afd6a5e2f77dbd8222a8cbf81dbebc20
parent ffb197c5
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -2988,15 +2988,10 @@ void btm_proc_sp_req_evt(tBTM_SP_EVT event, const uint8_t* p) {
 * Returns          void
 *
 ******************************************************************************/
void btm_simple_pair_complete(const uint8_t* p) {
  RawAddress bd_addr;
void btm_simple_pair_complete(const RawAddress bd_addr, uint8_t status) {
  tBTM_SEC_DEV_REC* p_dev_rec;
  uint8_t status;
  bool disc = false;

  status = *p++;
  STREAM_TO_BDADDR(bd_addr, p);

  p_dev_rec = btm_find_dev(bd_addr);
  if (p_dev_rec == NULL) {
    LOG(ERROR) << __func__ << " with unknown BDA: " << bd_addr;
+1 −1
Original line number Diff line number Diff line
@@ -570,7 +570,7 @@ void btm_proc_sp_req_evt(tBTM_SP_EVT event, uint8_t* p);
 * Returns          void
 *
 ******************************************************************************/
void btm_simple_pair_complete(const uint8_t* p);
void btm_simple_pair_complete(const RawAddress bd_addr, uint8_t status);

/*******************************************************************************
 *
+9 −1
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ static void btu_hcif_esco_connection_chg_evt(uint8_t* p);

/* Parsing functions for btm functions */

static void btu_hcif_simple_pair_complete(const uint8_t* p);
static void btu_hcif_create_conn_cancel_complete(const uint8_t* p,
                                                 uint16_t evt_len);

@@ -312,7 +313,7 @@ void btu_hcif_process_event(UNUSED_ATTR uint8_t controller_id,
      btm_rem_oob_req(p);
      break;
    case HCI_SIMPLE_PAIRING_COMPLETE_EVT:
      btm_simple_pair_complete(p);
      btu_hcif_simple_pair_complete(p);
      break;
    case HCI_USER_PASSKEY_NOTIFY_EVT:
      btm_proc_sp_req_evt(BTM_SP_KEY_NOTIF_EVT, p);
@@ -1420,6 +1421,13 @@ static void btu_hcif_mode_change_evt(uint8_t* p) {

/* Parsing functions for btm functions */

void btu_hcif_simple_pair_complete(const uint8_t* p) {
  RawAddress bd_addr;
  uint8_t status;
  status = *p++;
  STREAM_TO_BDADDR(bd_addr, p);
  btm_simple_pair_complete(bd_addr, status);
}
void btu_hcif_create_conn_cancel_complete(const uint8_t* p, uint16_t evt_len) {
  uint8_t status;

+1 −1
Original line number Diff line number Diff line
@@ -44,4 +44,4 @@ void btm_sec_rmt_name_request_complete(const RawAddress* bd_addr,
                                       const uint8_t* bd_name,
                                       tHCI_STATUS status);
void btm_sec_update_clock_offset(uint16_t handle, uint16_t clock_offset);
void btm_simple_pair_complete(const uint8_t* p);
void btm_simple_pair_complete(const RawAddress bd_addr, uint8_t status);
+2 −2
Original line number Diff line number Diff line
@@ -470,9 +470,9 @@ void btm_sec_update_clock_offset(uint16_t handle, uint16_t clock_offset) {
  inc_func_call_count(__func__);
  test::mock::stack_btm_sec::btm_sec_update_clock_offset(handle, clock_offset);
}
void btm_simple_pair_complete(const uint8_t* p) {
void btm_simple_pair_complete(const RawAddress bd_addr, uint8_t status) {
  inc_func_call_count(__func__);
  test::mock::stack_btm_sec::btm_simple_pair_complete(p);
  test::mock::stack_btm_sec::btm_simple_pair_complete(bd_addr, status);
}
bool is_sec_state_equal(void* data, void* context) {
  inc_func_call_count(__func__);
Loading