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

Commit db27dd22 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "SMP: Set pairing parameters for CTKD by properties" into tm-qpr-dev am: 7dce1d06

parents 56308bdc 7dce1d06
Loading
Loading
Loading
Loading
+28 −5
Original line number Diff line number Diff line
@@ -62,6 +62,22 @@ extern void gatt_notify_phy_updated(tGATT_STATUS status, uint16_t handle,
#define PROPERTY_BLE_PRIVACY_ENABLED "bluetooth.core.gap.le.privacy.enabled"
#endif

// Pairing parameters defined in Vol 3, Part H, Chapter 3.5.1 - 3.5.2
// All present in the exact decimal values, not hex
// Ex: bluetooth.core.smp.le.ctkd.initiator_key_distribution 15(0x0f)
static const char kPropertyCtkdAuthRequest[] =
    "bluetooth.core.smp.le.ctkd.auth_request";
static const char kPropertyCtkdIoCapabilities[] =
    "bluetooth.core.smp.le.ctkd.io_capabilities";
// Vol 3, Part H, Chapter 3.6.1, Figure 3.11
// |EncKey(1)|IdKey(1)|SignKey(1)|LinkKey(1)|Reserved(4)|
static const char kPropertyCtkdInitiatorKeyDistribution[] =
    "bluetooth.core.smp.le.ctkd.initiator_key_distribution";
static const char kPropertyCtkdResponderKeyDistribution[] =
    "bluetooth.core.smp.le.ctkd.responder_key_distribution";
static const char kPropertyCtkdMaxKeySize[] =
    "bluetooth.core.smp.le.ctkd.max_key_size";

/******************************************************************************/
/* External Function to be called by other modules                            */
/******************************************************************************/
@@ -1731,11 +1747,18 @@ uint8_t btm_ble_br_keys_req(tBTM_SEC_DEV_REC* p_dev_rec,
                            tBTM_LE_IO_REQ* p_data) {
  uint8_t callback_rc = BTM_SUCCESS;
  BTM_TRACE_DEBUG("%s", __func__);
  if (btm_cb.api.p_le_callback) {
    /* the callback function implementation may change the IO capability... */
    callback_rc = (*btm_cb.api.p_le_callback)(
        BTM_LE_IO_REQ_EVT, p_dev_rec->bd_addr, (tBTM_LE_EVT_DATA*)p_data);
  }
  p_data->io_cap =
      osi_property_get_int32(kPropertyCtkdIoCapabilities, BTM_IO_CAP_UNKNOWN);
  p_data->auth_req = osi_property_get_int32(kPropertyCtkdAuthRequest,
                                            BTM_LE_AUTH_REQ_SC_MITM_BOND);
  p_data->init_keys = osi_property_get_int32(
      kPropertyCtkdInitiatorKeyDistribution, SMP_BR_SEC_DEFAULT_KEY);
  p_data->resp_keys = osi_property_get_int32(
      kPropertyCtkdResponderKeyDistribution, SMP_BR_SEC_DEFAULT_KEY);
  p_data->max_key_size =
      osi_property_get_int32(kPropertyCtkdMaxKeySize, BTM_BLE_MAX_KEY_SIZE);
  // No OOB data for BR/EDR
  p_data->oob_data = false;

  return callback_rc;
}