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

Commit 7605a365 authored by Myles Watson's avatar Myles Watson
Browse files

Remove unused btm_ble_rand_enc_complete

LE Rand only gets sent with its own callback.

LE Encrypt (0x2017) never gets sent. It has been
replaced by Enable Encryption (0x2019).

Bug: 283254594
Test: mma -j32
Change-Id: Ibb3fede282adab261ed0fb7035e470e370029e63
Merged-In: I763c759f5e89b6edb5c269a6024e254ed0d5d77b
parent 049cc061
Loading
Loading
Loading
Loading
+0 −56
Original line number Diff line number Diff line
@@ -1019,62 +1019,6 @@ tL2CAP_LE_RESULT_CODE btm_ble_start_sec_check(const RawAddress& bd_addr,
  return L2CAP_LE_RESULT_CONN_OK;
}

/*******************************************************************************
 *
 * Function         btm_ble_rand_enc_complete
 *
 * Description      This function is the callback functions for HCI_Rand command
 *                  and HCI_Encrypt command is completed.
 *                  This message is received from the HCI.
 *
 * Returns          void
 *
 ******************************************************************************/
void btm_ble_rand_enc_complete(uint8_t* p, uint16_t evt_len,
                               uint16_t op_code,
                               tBTM_RAND_ENC_CB* p_enc_cplt_cback) {
  tBTM_RAND_ENC params;
  uint8_t* p_dest = params.param_buf;

  BTM_TRACE_DEBUG("btm_ble_rand_enc_complete");

  memset(&params, 0, sizeof(tBTM_RAND_ENC));

  /* If there was a callback address for vcs complete, call it */
  if (p_enc_cplt_cback && p) {

    if (evt_len < 1) {
      goto err_out;
    }

    /* Pass paramters to the callback function */
    STREAM_TO_UINT8(params.status, p); /* command status */

    if (params.status == HCI_SUCCESS) {
      params.opcode = op_code;

      if (op_code == HCI_BLE_RAND)
        params.param_len = BT_OCTET8_LEN;
      else
        params.param_len = OCTET16_LEN;

      if (evt_len < 1 + params.param_len) {
        goto err_out;
      }

      /* Fetch return info from HCI event message */
      memcpy(p_dest, p, params.param_len);
    }
    if (p_enc_cplt_cback) /* Call the Encryption complete callback function */
      (*p_enc_cplt_cback)(&params);
  }

  return;

err_out:
  BTM_TRACE_ERROR("%s malformatted event packet, too short", __func__);
}

/*******************************************************************************
 *
 * Function         btm_ble_get_enc_key_type
+0 −6
Original line number Diff line number Diff line
@@ -1112,12 +1112,6 @@ static void btu_hcif_hdl_command_complete(uint16_t opcode, uint8_t* p,
    case HCI_READ_INQ_TX_POWER_LEVEL:
      break;

    /* BLE Commands sComplete*/
    case HCI_BLE_RAND:
    case HCI_BLE_ENCRYPT:
      btm_ble_rand_enc_complete(p, evt_len, opcode, (tBTM_RAND_ENC_CB*)p_cplt_cback);
      break;

    case HCI_BLE_READ_ADV_CHNL_TX_POWER:
      btm_read_tx_power_complete(p, evt_len, true);
      break;
+0 −2
Original line number Diff line number Diff line
@@ -35,8 +35,6 @@ void btm_ble_write_adv_enable_complete(uint8_t* p, uint16_t evt_len);
void btm_ble_create_ll_conn_complete(tHCI_STATUS status);
void btm_ble_ltk_request(uint16_t handle, uint8_t rand[8], uint16_t ediv);
void btm_ble_test_command_complete(uint8_t* p);
void btm_ble_rand_enc_complete(uint8_t* p, uint16_t evt_len, uint16_t op_code,
                               tBTM_RAND_ENC_CB* p_enc_cplt_cback);
bool btm_identity_addr_to_random_pseudo(RawAddress* bd_addr,
                                        tBLE_ADDR_TYPE* p_addr_type,
                                        bool refresh);
+0 −7
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ struct btm_ble_link_encrypted btm_ble_link_encrypted;
struct btm_ble_link_sec_check btm_ble_link_sec_check;
struct btm_ble_ltk_request btm_ble_ltk_request;
struct btm_ble_ltk_request_reply btm_ble_ltk_request_reply;
struct btm_ble_rand_enc_complete btm_ble_rand_enc_complete;
struct btm_ble_read_sec_key_size btm_ble_read_sec_key_size;
struct btm_ble_reset_id btm_ble_reset_id;
struct btm_ble_set_encryption btm_ble_set_encryption;
@@ -319,12 +318,6 @@ void btm_ble_ltk_request_reply(const RawAddress& bda, bool use_stk,
  inc_func_call_count(__func__);
  test::mock::stack_btm_ble::btm_ble_ltk_request_reply(bda, use_stk, stk);
}
void btm_ble_rand_enc_complete(uint8_t* p, uint16_t evt_len, uint16_t op_code,
                               tBTM_RAND_ENC_CB* p_enc_cplt_cback) {
  inc_func_call_count(__func__);
  test::mock::stack_btm_ble::btm_ble_rand_enc_complete(p, op_code,
                                                       p_enc_cplt_cback);
}
uint8_t btm_ble_read_sec_key_size(const RawAddress& bd_addr) {
  inc_func_call_count(__func__);
  return test::mock::stack_btm_ble::btm_ble_read_sec_key_size(bd_addr);
+0 −15
Original line number Diff line number Diff line
@@ -564,21 +564,6 @@ struct btm_ble_ltk_request_reply {
};
extern struct btm_ble_ltk_request_reply btm_ble_ltk_request_reply;

// Name: btm_ble_rand_enc_complete
// Params: uint8_t* p, uint16_t op_code, tBTM_RAND_ENC_CB* p_enc_cplt_cback
// Return: void
struct btm_ble_rand_enc_complete {
  std::function<void(uint8_t* p, uint16_t op_code,
                     tBTM_RAND_ENC_CB* p_enc_cplt_cback)>
      body{[](uint8_t* p, uint16_t op_code,
              tBTM_RAND_ENC_CB* p_enc_cplt_cback) {}};
  void operator()(uint8_t* p, uint16_t op_code,
                  tBTM_RAND_ENC_CB* p_enc_cplt_cback) {
    body(p, op_code, p_enc_cplt_cback);
  };
};
extern struct btm_ble_rand_enc_complete btm_ble_rand_enc_complete;

// Name: btm_ble_read_sec_key_size
// Params: const RawAddress& bd_addr
// Return: uint8_t