component bt: 1.modified the btu buffer size from 15 to 60;

2.change the smp method
This commit is contained in:
yulong 2016-10-15 05:46:10 -04:00
parent 982b90e77d
commit 02ad223eea
20 changed files with 978 additions and 976 deletions

View File

@ -983,7 +983,7 @@ void BTA_DmSetBleAdvParams (UINT16 adv_int_min, UINT16 adv_int_max,
#if BLE_INCLUDED == TRUE
tBTA_DM_API_BLE_ADV_PARAMS *p_msg;
APPL_TRACE_API ("BTA_DmSetBleAdvParam: %d, %d", adv_int_min, adv_int_max);
APPL_TRACE_API ("BTA_DmSetBleAdvParam: %d, %d\n", adv_int_min, adv_int_max);
if ((p_msg = (tBTA_DM_API_BLE_ADV_PARAMS *) GKI_getbuf(sizeof(tBTA_DM_API_BLE_ADV_PARAMS))) != NULL)
{

View File

@ -636,7 +636,6 @@ static void bta_dm_pm_set_mode(BD_ADDR peer_addr, tBTA_DM_PM_ACTION pm_request,
remaining_ticks = bta_dm_pm_get_remaining_ticks(&bta_dm_cb.pm_timer[i].timer[timer_idx]);
if (remaining_ticks < timeout)
{
ets_printf("remain 00\n");
/* Cancel and restart the timer */
/*
* TODO: The value of pm_action[timer_idx] is

View File

@ -620,7 +620,7 @@ void bta_gatts_send_rsp (tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA * p_msg)
p_msg->api_rsp.status,
(tGATTS_RSP *)p_msg->api_rsp.p_rsp) != GATT_SUCCESS)
{
APPL_TRACE_ERROR("Sending response failed");
APPL_TRACE_ERROR("Sending response failed\n");
}
}

View File

@ -14,7 +14,7 @@
#define UNUSED(x) (void)(x)
#ifndef SIZE_MAX
#define SIZE_MAX 128
#define SIZE_MAX 254
#endif
/*Timer Related Defination*/

View File

@ -105,7 +105,7 @@ tACL_CONN *btm_bda_to_acl (BD_ADDR bda, tBT_TRANSPORT transport)
#endif
)
{
BTM_TRACE_DEBUG ("btm_bda_to_acl found");
BTM_TRACE_DEBUG ("btm_bda_to_acl found\n");
return(p);
}
}

View File

@ -56,19 +56,19 @@ extern fixed_queue_t *btu_hci_msg_queue;
fixed_queue_t *btu_general_alarm_queue;
hash_map_t *btu_general_alarm_hash_map;
pthread_mutex_t btu_general_alarm_lock;
static const size_t BTU_GENERAL_ALARM_HASH_MAP_SIZE = 17;
static const size_t BTU_GENERAL_ALARM_HASH_MAP_SIZE = 34;
// Oneshot timer queue.
fixed_queue_t *btu_oneshot_alarm_queue;
hash_map_t *btu_oneshot_alarm_hash_map;
pthread_mutex_t btu_oneshot_alarm_lock;
static const size_t BTU_ONESHOT_ALARM_HASH_MAP_SIZE = 17;
static const size_t BTU_ONESHOT_ALARM_HASH_MAP_SIZE = 34;
// l2cap timer queue.
fixed_queue_t *btu_l2cap_alarm_queue;
hash_map_t *btu_l2cap_alarm_hash_map;
pthread_mutex_t btu_l2cap_alarm_lock;
static const size_t BTU_L2CAP_ALARM_HASH_MAP_SIZE = 17;
static const size_t BTU_L2CAP_ALARM_HASH_MAP_SIZE = 34;
//thread_t *bt_workqueue_thread;
//static const char *BT_WORKQUEUE_NAME = "bt_workqueue";
@ -193,7 +193,7 @@ void BTU_StartUp(void)
if (btu_l2cap_alarm_queue == NULL)
goto error_exit;
xBtuQueue = xQueueCreate(15, sizeof(void *));
xBtuQueue = xQueueCreate(60, sizeof(void *));
xTaskCreate(btu_task_thread_handler, "BtuT", 8192, NULL, configMAX_PRIORITIES - 1, &xBtuTaskHandle);
btu_task_post(SIG_BTU_START_UP);
/*

View File

@ -192,7 +192,7 @@ void l2c_rcv_acl_data (BT_HDR *p_msg)
/* only process fixed channel data as channel open indication when link is not in disconnecting mode */
l2cble_notify_le_connection(p_lcb->remote_bd_addr);
#endif
L2CAP_TRACE_WARNING ("L2CAP - rcv_cid CID: 0x%04x\n", rcv_cid);
/* Find the CCB for this CID */
if (rcv_cid >= L2CAP_BASE_APPL_CID)
{

View File

@ -69,7 +69,7 @@ static bool lmp_version_below(BD_ADDR bda, uint8_t version)
*******************************************************************************/
static void smp_update_key_mask (tSMP_CB *p_cb, UINT8 key_type, BOOLEAN recv)
{
SMP_TRACE_DEBUG("%s before update role=%d recv=%d local_i_key = %02x, local_r_key = %02x",
SMP_TRACE_DEBUG("%s before update role=%d recv=%d local_i_key = %02x, local_r_key = %02x\n",
__func__, p_cb->role, recv, p_cb->local_i_key, p_cb->local_r_key);
if (((p_cb->le_secure_connections_mode_is_used) ||
@ -97,7 +97,7 @@ static void smp_update_key_mask (tSMP_CB *p_cb, UINT8 key_type, BOOLEAN recv)
p_cb->local_i_key &= ~key_type;
}
SMP_TRACE_DEBUG("updated local_i_key = %02x, local_r_key = %02x", p_cb->local_i_key,
SMP_TRACE_DEBUG("updated local_i_key = %02x, local_r_key = %02x\n", p_cb->local_i_key,
p_cb->local_r_key);
}
@ -109,7 +109,7 @@ void smp_send_app_cback(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
tSMP_EVT_DATA cb_data;
tSMP_STATUS callback_rc;
SMP_TRACE_DEBUG("%s p_cb->cb_evt=%d", __func__, p_cb->cb_evt);
SMP_TRACE_DEBUG("%s p_cb->cb_evt=%d\n", __func__, p_cb->cb_evt);
if (p_cb->p_callback && p_cb->cb_evt != 0)
{
switch (p_cb->cb_evt)
@ -149,7 +149,7 @@ void smp_send_app_cback(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
callback_rc = (*p_cb->p_callback)(p_cb->cb_evt, p_cb->pairing_bda, &cb_data);
SMP_TRACE_DEBUG("callback_rc=%d p_cb->cb_evt=%d",callback_rc, p_cb->cb_evt );
SMP_TRACE_DEBUG("callback_rc=%d p_cb->cb_evt=%d\n",callback_rc, p_cb->cb_evt );
if (callback_rc == SMP_SUCCESS)
{
@ -172,7 +172,7 @@ void smp_send_app_cback(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
SMP_TRACE_WARNING ( "rcvd auth_req: 0x%02x, io_cap: %d \
loc_oob_flag: %d loc_enc_size: %d,"
"local_i_key: 0x%02x, local_r_key: 0x%02x",
"local_i_key: 0x%02x, local_r_key: 0x%02x\n",
p_cb->loc_auth_req, p_cb->local_io_capability, p_cb->loc_oob_flag,
p_cb->loc_enc_size, p_cb->local_i_key, p_cb->local_r_key);
@ -194,7 +194,7 @@ void smp_send_app_cback(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
p_cb->local_r_key &= ~SMP_SEC_KEY_TYPE_LK;
}
SMP_TRACE_WARNING("set auth_req: 0x%02x, local_i_key: 0x%02x, local_r_key: 0x%02x",
SMP_TRACE_WARNING("set auth_req: 0x%02x, local_i_key: 0x%02x, local_r_key: 0x%02x\n",
p_cb->loc_auth_req, p_cb->local_i_key, p_cb->local_r_key);
smp_sm_event(p_cb, SMP_IO_RSP_EVT, NULL);
@ -209,7 +209,7 @@ void smp_send_app_cback(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
p_cb->local_r_key &= ~SMP_SEC_KEY_TYPE_LK;
SMP_TRACE_WARNING ( "for SMP over BR max_key_size: 0x%02x,\
local_i_key: 0x%02x, local_r_key: 0x%02x",
local_i_key: 0x%02x, local_r_key: 0x%02x\n",
p_cb->loc_enc_size, p_cb->local_i_key, p_cb->local_r_key);
smp_br_state_machine_event(p_cb, SMP_BR_KEYS_RSP_EVT, NULL);
@ -224,7 +224,7 @@ void smp_send_app_cback(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
smp_sm_event(p_cb, SMP_DISCARD_SEC_REQ_EVT, NULL);
}
SMP_TRACE_DEBUG("%s return", __func__);
SMP_TRACE_DEBUG("%s return\n", __func__);
}
/*******************************************************************************
@ -252,7 +252,7 @@ void smp_send_pair_fail(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
void smp_send_pair_req(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (p_cb->pairing_bda);
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
/* erase all keys when master sends pairing req*/
if (p_dev_rec)
@ -268,7 +268,7 @@ void smp_send_pair_req(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_send_pair_rsp(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
p_cb->local_i_key &= p_cb->peer_i_key;
p_cb->local_r_key &= p_cb->peer_r_key;
@ -288,7 +288,7 @@ void smp_send_pair_rsp(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_send_confirm(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
smp_send_cmd(SMP_OPCODE_CONFIRM, p_cb);
}
@ -298,7 +298,7 @@ void smp_send_confirm(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_send_init(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
smp_send_cmd(SMP_OPCODE_INIT, p_cb);
}
@ -308,7 +308,7 @@ void smp_send_init(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_send_rand(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
smp_send_cmd(SMP_OPCODE_RAND, p_cb);
}
@ -318,7 +318,7 @@ void smp_send_rand(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_send_pair_public_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
smp_send_cmd(SMP_OPCODE_PAIR_PUBLIC_KEY, p_cb);
}
@ -360,7 +360,7 @@ void smp_send_enc_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
tBTM_LE_LENC_KEYS le_key;
SMP_TRACE_DEBUG("%s p_cb->loc_enc_size = %d", __func__, p_cb->loc_enc_size);
SMP_TRACE_DEBUG("%s p_cb->loc_enc_size = %d\n", __func__, p_cb->loc_enc_size);
smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, FALSE);
smp_send_cmd(SMP_OPCODE_ENCRYPT_INFO, p_cb);
@ -376,7 +376,7 @@ void smp_send_enc_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LENC,
(tBTM_LE_KEY_VALUE *)&le_key, TRUE);
SMP_TRACE_WARNING ("%s", __func__);
SMP_TRACE_WARNING ("%s\n", __func__);
smp_key_distribution(p_cb, NULL);
}
@ -388,7 +388,7 @@ void smp_send_enc_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
void smp_send_id_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
tBTM_LE_KEY_VALUE le_key;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ID, FALSE);
smp_send_cmd(SMP_OPCODE_IDENTITY_INFO, p_cb);
@ -398,7 +398,7 @@ void smp_send_id_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LID,
&le_key, TRUE);
SMP_TRACE_WARNING ("%s", __func__);
SMP_TRACE_WARNING ("%s\n", __func__);
smp_key_distribution_by_transport(p_cb, NULL);
}
@ -409,7 +409,7 @@ void smp_send_id_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
void smp_send_csrk_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
tBTM_LE_LCSRK_KEYS key;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_CSRK, FALSE);
if (smp_send_cmd(SMP_OPCODE_SIGN_INFO, p_cb))
@ -529,7 +529,7 @@ void smp_proc_pair_cmd(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
UINT8 reason = SMP_ENC_KEY_SIZE;
tBTM_SEC_DEV_REC *p_dev_rec = btm_find_dev (p_cb->pairing_bda);
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
/* erase all keys if it is slave proc pairing req*/
if (p_dev_rec && (p_cb->role == HCI_ROLE_SLAVE))
btm_sec_clear_ble_keys(p_dev_rec);
@ -623,7 +623,7 @@ void smp_proc_confirm(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
UINT8 *p = (UINT8 *)p_data;
UINT8 reason = SMP_INVALID_PARAMETERS;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (smp_command_has_invalid_parameters(p_cb))
{
@ -670,7 +670,7 @@ void smp_proc_rand(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
UINT8 *p = (UINT8 *)p_data;
UINT8 reason = SMP_INVALID_PARAMETERS;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (smp_command_has_invalid_parameters(p_cb))
{
@ -953,7 +953,7 @@ void smp_proc_enc_info(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UINT8 *p = (UINT8 *)p_data;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
STREAM_TO_ARRAY(p_cb->ltk, p, BT_OCTET16_LEN);
smp_key_distribution(p_cb, NULL);
@ -967,7 +967,8 @@ void smp_proc_master_id(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
UINT8 *p = (UINT8 *)p_data;
tBTM_LE_PENC_KEYS le_key;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\np_cb->peer_auth_req = %d,p_cb->loc_auth_req= %d\n", __func__,
p_cb->peer_auth_req,p_cb->loc_auth_req);
smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, TRUE);
STREAM_TO_UINT16(le_key.ediv, p);
@ -1058,7 +1059,7 @@ void smp_proc_compare(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UINT8 reason;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (!memcmp(p_cb->rconfirm, p_data->key.p_data, BT_OCTET16_LEN))
{
/* compare the max encryption key size, and save the smaller one for the link */
@ -1092,7 +1093,7 @@ void smp_proc_sl_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UINT8 key_type = p_data->key.key_type;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (key_type == SMP_KEY_TYPE_TK)
{
smp_generate_srand_mrand_confirm(p_cb, NULL);
@ -1115,7 +1116,7 @@ void smp_start_enc(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
tBTM_STATUS cmd;
UINT8 reason = SMP_ENC_FAIL;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (p_data != NULL)
cmd = btm_ble_start_encrypt(p_cb->pairing_bda, TRUE, p_data->key.p_data);
else
@ -1131,7 +1132,7 @@ void smp_start_enc(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_proc_discard(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (!(p_cb->flags & SMP_PAIR_FLAGS_WE_STARTED_DD))
smp_reset_control_value(p_cb);
}
@ -1145,7 +1146,7 @@ void smp_enc_cmpl(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
UINT8 enc_enable = *(UINT8 *)p_data;
UINT8 reason = enc_enable ? SMP_SUCCESS : SMP_ENC_FAIL;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
}
@ -1159,7 +1160,7 @@ void smp_check_auth_req(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
UINT8 reason = enc_enable ? SMP_SUCCESS : SMP_ENC_FAIL;
SMP_TRACE_DEBUG("%s rcvs enc_enable=%d i_keys=0x%x r_keys=0x%x "
"(i-initiator r-responder)",
"(i-initiator r-responder)\n",
__func__, enc_enable, p_cb->local_i_key, p_cb->local_r_key);
if (enc_enable == 1)
{
@ -1192,7 +1193,7 @@ void smp_check_auth_req(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
p_cb->local_r_key &= ~SMP_SEC_KEY_TYPE_LK;
}
SMP_TRACE_DEBUG("%s rcvs upgrades: i_keys=0x%x r_keys=0x%x "
"(i-initiator r-responder)",
"(i-initiator r-responder)\n",
__func__, p_cb->local_i_key, p_cb->local_r_key);
if (/*((p_cb->peer_auth_req & SMP_AUTH_BOND) ||
@ -1227,14 +1228,14 @@ void smp_key_pick_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
UINT8 key_to_dist = (p_cb->role == HCI_ROLE_SLAVE) ? p_cb->local_r_key : p_cb->local_i_key;
UINT8 i = 0;
SMP_TRACE_DEBUG("%s key_to_dist=0x%x", __func__, key_to_dist);
SMP_TRACE_DEBUG("%s key_to_dist=0x%x\n", __func__, key_to_dist);
while (i < SMP_KEY_DIST_TYPE_MAX)
{
SMP_TRACE_DEBUG("key to send = %02x, i = %d", key_to_dist, i);
SMP_TRACE_DEBUG("key to send = %02x, i = %d\n", key_to_dist, i);
if (key_to_dist & (1 << i))
{
SMP_TRACE_DEBUG("smp_distribute_act[%d]", i);
SMP_TRACE_DEBUG("smp_distribute_act[%d]\n", i);
(* smp_distribute_act[i])(p_cb, p_data);
break;
}
@ -1248,7 +1249,7 @@ void smp_key_pick_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
void smp_key_distribution(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UINT8 reason = SMP_SUCCESS;
SMP_TRACE_DEBUG("%s role=%d (0-master) r_keys=0x%x i_keys=0x%x",
SMP_TRACE_DEBUG("\n%s role=%d (0-master) r_keys=0x%x i_keys=0x%x\n",
__func__, p_cb->role, p_cb->local_r_key, p_cb->local_i_key);
if (p_cb->role == HCI_ROLE_SLAVE ||
@ -1289,7 +1290,7 @@ void smp_decide_association_model(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
tSMP_KEY key;
tSMP_INT_DATA *p = NULL;
SMP_TRACE_DEBUG("%s Association Model = %d", __func__, p_cb->selected_association_model);
SMP_TRACE_DEBUG("%s Association Model = %d\n", __func__, p_cb->selected_association_model);
switch (p_cb->selected_association_model)
{
@ -1298,7 +1299,7 @@ void smp_decide_association_model(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
((p_cb->peer_auth_req & SMP_AUTH_YN_BIT) != 0) &&
((p_cb->loc_auth_req & SMP_AUTH_YN_BIT) == 0))
{
SMP_TRACE_ERROR ("IO capability does not meet authentication requirement");
SMP_TRACE_ERROR ("IO capability does not meet authentication requirement\n");
failure = SMP_PAIR_AUTH_FAIL;
p = (tSMP_INT_DATA *)&failure;
int_evt = SMP_AUTH_CMPL_EVT;
@ -1306,7 +1307,7 @@ void smp_decide_association_model(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
else
{
p_cb->sec_level = SMP_SEC_UNAUTHENTICATE;
SMP_TRACE_EVENT ("p_cb->sec_level =%d (SMP_SEC_UNAUTHENTICATE) ", p_cb->sec_level );
SMP_TRACE_EVENT ("p_cb->sec_level =%d (SMP_SEC_UNAUTHENTICATE) \n", p_cb->sec_level );
key.key_type = SMP_KEY_TYPE_TK;
key.p_data = p_cb->tk;
@ -1320,16 +1321,16 @@ void smp_decide_association_model(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
case SMP_MODEL_PASSKEY:
p_cb->sec_level = SMP_SEC_AUTHENTICATED;
SMP_TRACE_EVENT ("p_cb->sec_level =%d (SMP_SEC_AUTHENTICATED) ", p_cb->sec_level );
SMP_TRACE_EVENT ("p_cb->sec_level =%d (SMP_SEC_AUTHENTICATED) \n", p_cb->sec_level );
p_cb->cb_evt = SMP_PASSKEY_REQ_EVT;
int_evt = SMP_TK_REQ_EVT;
break;
case SMP_MODEL_OOB:
SMP_TRACE_ERROR ("Association Model = SMP_MODEL_OOB");
SMP_TRACE_ERROR ("Association Model = SMP_MODEL_OOB\n");
p_cb->sec_level = SMP_SEC_AUTHENTICATED;
SMP_TRACE_EVENT ("p_cb->sec_level =%d (SMP_SEC_AUTHENTICATED) ", p_cb->sec_level );
SMP_TRACE_EVENT ("p_cb->sec_level =%d (SMP_SEC_AUTHENTICATED) \n", p_cb->sec_level );
p_cb->cb_evt = SMP_OOB_REQ_EVT;
int_evt = SMP_TK_REQ_EVT;
@ -1337,7 +1338,7 @@ void smp_decide_association_model(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
case SMP_MODEL_KEY_NOTIF:
p_cb->sec_level = SMP_SEC_AUTHENTICATED;
SMP_TRACE_DEBUG("Need to generate Passkey");
SMP_TRACE_DEBUG("Need to generate Passkey\n");
/* generate passkey and notify application */
smp_generate_passkey(p_cb, NULL);
@ -1352,19 +1353,19 @@ void smp_decide_association_model(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
break;
case SMP_MODEL_OUT_OF_RANGE:
SMP_TRACE_ERROR("Association Model = SMP_MODEL_OUT_OF_RANGE (failed)");
SMP_TRACE_ERROR("Association Model = SMP_MODEL_OUT_OF_RANGE (failed)\n");
p = (tSMP_INT_DATA *)&failure;
int_evt = SMP_AUTH_CMPL_EVT;
break;
default:
SMP_TRACE_ERROR("Association Model = %d (SOMETHING IS WRONG WITH THE CODE)",
SMP_TRACE_ERROR("Association Model = %d (SOMETHING IS WRONG WITH THE CODE)\n",
p_cb->selected_association_model);
p = (tSMP_INT_DATA *)&failure;
int_evt = SMP_AUTH_CMPL_EVT;
}
SMP_TRACE_EVENT ("sec_level=%d ", p_cb->sec_level );
SMP_TRACE_EVENT ("sec_level=%d \n", p_cb->sec_level );
if (int_evt)
smp_sm_event(p_cb, int_evt, p);
}
@ -1377,7 +1378,7 @@ void smp_process_io_response(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
uint8_t reason = SMP_PAIR_AUTH_FAIL;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (p_cb->flags & SMP_PAIR_FLAGS_WE_STARTED_DD)
{
/* pairing started by local (slave) Security Request */
@ -1394,7 +1395,7 @@ void smp_process_io_response(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
(p_cb->selected_association_model == SMP_MODEL_SEC_CONN_JUSTWORKS)))
{
SMP_TRACE_ERROR ("Slave requires secure connection only mode \
but it can't be provided -> Slave fails pairing");
but it can't be provided -> Slave fails pairing\n");
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
return;
}
@ -1423,7 +1424,7 @@ void smp_br_process_slave_keys_response(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_br_send_pair_response(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
p_cb->local_i_key &= p_cb->peer_i_key;
p_cb->local_r_key &= p_cb->peer_r_key;
@ -1454,7 +1455,7 @@ void smp_pairing_cmpl(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_pair_terminate(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
p_cb->status = SMP_CONN_TOUT;
smp_proc_pairing_cmpl(p_cb);
}
@ -1468,7 +1469,7 @@ void smp_idle_terminate(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
if (p_cb->flags & SMP_PAIR_FLAGS_WE_STARTED_DD)
{
SMP_TRACE_DEBUG("Pairing terminated at IDLE state.");
SMP_TRACE_DEBUG("Pairing terminated at IDLE state.\n");
p_cb->status = SMP_FAIL;
smp_proc_pairing_cmpl(p_cb);
}
@ -1495,7 +1496,7 @@ void smp_fast_conn_param(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_both_have_public_keys(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s",__func__);
SMP_TRACE_DEBUG("%s\n",__func__);
/* invokes DHKey computation */
smp_compute_dhkey(p_cb);
@ -1515,17 +1516,17 @@ void smp_both_have_public_keys(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_start_secure_connection_phase1(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (p_cb->selected_association_model == SMP_MODEL_SEC_CONN_JUSTWORKS)
{
p_cb->sec_level = SMP_SEC_UNAUTHENTICATE;
SMP_TRACE_EVENT ("p_cb->sec_level =%d (SMP_SEC_UNAUTHENTICATE) ", p_cb->sec_level );
SMP_TRACE_EVENT ("p_cb->sec_level =%d (SMP_SEC_UNAUTHENTICATE)\n ", p_cb->sec_level );
}
else
{
p_cb->sec_level = SMP_SEC_AUTHENTICATED;
SMP_TRACE_EVENT ("p_cb->sec_level =%d (SMP_SEC_AUTHENTICATED) ", p_cb->sec_level );
SMP_TRACE_EVENT ("p_cb->sec_level =%d (SMP_SEC_AUTHENTICATED)\n ", p_cb->sec_level );
}
switch(p_cb->selected_association_model)
@ -1542,7 +1543,7 @@ void smp_start_secure_connection_phase1(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
break;
case SMP_MODEL_SEC_CONN_PASSKEY_DISP:
/* passkey has to be provided to user */
SMP_TRACE_DEBUG("Need to generate SC Passkey");
SMP_TRACE_DEBUG("Need to generate SC Passkey\n");
smp_generate_passkey(p_cb, NULL);
break;
case SMP_MODEL_SEC_CONN_OOB:
@ -1550,7 +1551,7 @@ void smp_start_secure_connection_phase1(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
smp_process_secure_connection_oob_data(p_cb, NULL);
break;
default:
SMP_TRACE_ERROR ("Association Model = %d is not used in LE SC",
SMP_TRACE_ERROR ("Association Model = %d is not used in LE SC\n",
p_cb->selected_association_model);
break;
}
@ -1564,7 +1565,7 @@ void smp_start_secure_connection_phase1(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_process_local_nonce(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
switch(p_cb->selected_association_model)
{
@ -1584,7 +1585,7 @@ void smp_process_local_nonce(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
/* slave commitment is already received, send local nonce, wait for remote nonce*/
SMP_TRACE_DEBUG("master in assoc mode = %d \
already rcvd slave commitment - race condition",
already rcvd slave commitment - race condition\n",
p_cb->selected_association_model);
p_cb->flags &= ~SMP_PAIR_FLAG_HAVE_PEER_COMM;
smp_send_rand(p_cb, NULL);
@ -1619,7 +1620,7 @@ void smp_process_local_nonce(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
smp_set_state(SMP_STATE_WAIT_NONCE);
break;
default:
SMP_TRACE_ERROR ("Association Model = %d is not used in LE SC",
SMP_TRACE_ERROR ("Association Model = %d is not used in LE SC\n",
p_cb->selected_association_model);
break;
}
@ -1636,7 +1637,7 @@ void smp_process_peer_nonce(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UINT8 reason;
SMP_TRACE_DEBUG("%s start ", __func__);
SMP_TRACE_DEBUG("%s start \n", __func__);
switch(p_cb->selected_association_model)
{
@ -1702,12 +1703,12 @@ void smp_process_peer_nonce(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
smp_sm_event(p_cb, SMP_SC_PHASE1_CMPLT_EVT, NULL);
break;
default:
SMP_TRACE_ERROR ("Association Model = %d is not used in LE SC",
SMP_TRACE_ERROR ("Association Model = %d is not used in LE SC\n",
p_cb->selected_association_model);
break;
}
SMP_TRACE_DEBUG("%s end ",__FUNCTION__);
SMP_TRACE_DEBUG("%s end\n ",__FUNCTION__);
}
/*******************************************************************************
@ -1719,17 +1720,17 @@ void smp_match_dhkey_checks(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UINT8 reason = SMP_DHKEY_CHK_FAIL;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (memcmp(p_data->key.p_data, p_cb->remote_dhkey_check, BT_OCTET16_LEN))
{
SMP_TRACE_WARNING ("dhkey chcks do no match");
SMP_TRACE_WARNING ("dhkey chcks do no match\n");
p_cb->failure = reason;
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
return;
}
SMP_TRACE_EVENT ("dhkey chcks match");
SMP_TRACE_EVENT ("dhkey chcks match\n");
/* compare the max encryption key size, and save the smaller one for the link */
if (p_cb->peer_enc_size < p_cb->loc_enc_size)
@ -1757,7 +1758,7 @@ void smp_match_dhkey_checks(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_move_to_secure_connections_phase2(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s",__func__);
SMP_TRACE_DEBUG("%s\n",__func__);
smp_sm_event(p_cb, SMP_SC_PHASE1_CMPLT_EVT, NULL);
}
@ -1770,7 +1771,7 @@ void smp_move_to_secure_connections_phase2(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_phase_2_dhkey_checks_are_present(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s",__func__);
SMP_TRACE_DEBUG("%s\n",__func__);
if (p_cb->flags & SMP_PAIR_FLAG_HAVE_PEER_DHK_CHK)
smp_sm_event(p_cb, SMP_SC_2_DHCK_CHKS_PRES_EVT, NULL);
@ -1786,7 +1787,7 @@ void smp_phase_2_dhkey_checks_are_present(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_wait_for_both_public_keys(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s",__func__);
SMP_TRACE_DEBUG("%s\n",__func__);
if ((p_cb->flags & SMP_PAIR_FLAG_HAVE_PEER_PUBL_KEY) &&
(p_cb->flags & SMP_PAIR_FLAG_HAVE_LOCAL_PUBL_KEY))
@ -1808,7 +1809,7 @@ void smp_start_passkey_verification(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UINT8 *p = NULL;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
p = p_cb->local_random;
UINT32_TO_STREAM(p, p_data->passkey);
@ -1825,7 +1826,7 @@ void smp_start_passkey_verification(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_process_secure_connection_oob_data(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
tSMP_SC_OOB_DATA *p_sc_oob_data = &p_cb->sc_oob_data;
if (p_sc_oob_data->loc_oob_data.present)
@ -1835,13 +1836,13 @@ void smp_process_secure_connection_oob_data(tSMP_CB *p_cb, tSMP_INT_DATA *p_data
}
else
{
SMP_TRACE_EVENT ("local OOB randomizer is absent");
SMP_TRACE_EVENT ("local OOB randomizer is absent\n");
memset(p_cb->local_random, 0, sizeof (p_cb->local_random));
}
if (!p_sc_oob_data->peer_oob_data.present)
{
SMP_TRACE_EVENT ("peer OOB data is absent");
SMP_TRACE_EVENT ("peer OOB data is absent\n");
memset(p_cb->peer_random, 0, sizeof (p_cb->peer_random));
}
else
@ -1863,7 +1864,7 @@ void smp_process_secure_connection_oob_data(tSMP_CB *p_cb, tSMP_INT_DATA *p_data
if (p_cb->peer_oob_flag != SMP_OOB_PRESENT)
{
/* the peer doesn't have local randomiser */
SMP_TRACE_EVENT ("peer didn't receive local OOB data, set local randomizer to 0");
SMP_TRACE_EVENT ("peer didn't receive local OOB data, set local randomizer to 0\n");
memset(p_cb->local_random, 0, sizeof (p_cb->local_random));
}
}
@ -1881,7 +1882,7 @@ void smp_process_secure_connection_oob_data(tSMP_CB *p_cb, tSMP_INT_DATA *p_data
*******************************************************************************/
void smp_set_local_oob_keys(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
memcpy(p_cb->sc_oob_data.loc_oob_data.private_key_used, p_cb->private_key,
BT_OCTET32_LEN);
@ -1896,7 +1897,7 @@ void smp_set_local_oob_keys(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_set_local_oob_random_commitment(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
memcpy(p_cb->sc_oob_data.loc_oob_data.randomizer, p_cb->rand,
BT_OCTET16_LEN);
@ -1907,7 +1908,7 @@ void smp_set_local_oob_random_commitment(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
#if SMP_DEBUG == TRUE
UINT8 *p_print = NULL;
SMP_TRACE_DEBUG("local SC OOB data set:");
SMP_TRACE_DEBUG("local SC OOB data set:\n");
p_print = (UINT8*) &p_cb->sc_oob_data.loc_oob_data.addr_sent_to;
smp_debug_print_nbyte_little_endian (p_print, (const UINT8 *)"addr_sent_to",
sizeof(tBLE_BD_ADDR));
@ -1952,7 +1953,7 @@ void smp_link_encrypted(BD_ADDR bda, UINT8 encr_enable)
{
tSMP_CB *p_cb = &smp_cb;
SMP_TRACE_DEBUG("%s encr_enable=%d", __func__, encr_enable);
SMP_TRACE_DEBUG("%s encr_enable=%d\n", __func__, encr_enable);
if (memcmp(&smp_cb.pairing_bda[0], bda, BD_ADDR_LEN) == 0)
{
@ -1980,7 +1981,7 @@ void smp_link_encrypted(BD_ADDR bda, UINT8 encr_enable)
*******************************************************************************/
BOOLEAN smp_proc_ltk_request(BD_ADDR bda)
{
SMP_TRACE_DEBUG("%s state = %d", __func__, smp_cb.state);
SMP_TRACE_DEBUG("%s state = %d\n", __func__, smp_cb.state);
BOOLEAN match = FALSE;
if (!memcmp(bda, smp_cb.pairing_bda, BD_ADDR_LEN))
@ -2021,7 +2022,7 @@ void smp_process_secure_connection_long_term_key(void)
{
tSMP_CB *p_cb = &smp_cb;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
smp_save_secure_connections_long_term_key(p_cb);
smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, FALSE);
@ -2041,7 +2042,7 @@ void smp_process_secure_connection_long_term_key(void)
*******************************************************************************/
void smp_set_derive_link_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG ("%s", __func__);
SMP_TRACE_DEBUG ("%s\n", __func__);
p_cb->derive_lk = TRUE;
smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_LK, FALSE);
smp_key_distribution(p_cb, NULL);
@ -2060,10 +2061,10 @@ void smp_derive_link_key_from_long_term_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data
{
tSMP_STATUS status = SMP_PAIR_FAIL_UNKNOWN;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (!smp_calculate_link_key_from_long_term_key(p_cb))
{
SMP_TRACE_ERROR("%s failed", __FUNCTION__);
SMP_TRACE_ERROR("%s failed\n", __FUNCTION__);
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status);
return;
}
@ -2084,15 +2085,15 @@ void smp_br_process_link_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
tSMP_STATUS status = SMP_PAIR_FAIL_UNKNOWN;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (!smp_calculate_long_term_key_from_link_key(p_cb))
{
SMP_TRACE_ERROR ("%s failed",__FUNCTION__);
SMP_TRACE_ERROR ("%s failed\n",__FUNCTION__);
smp_sm_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &status);
return;
}
SMP_TRACE_DEBUG("%s: LTK derivation from LK successfully completed", __FUNCTION__);
SMP_TRACE_DEBUG("%s: LTK derivation from LK successfully completed\n", __FUNCTION__);
smp_save_secure_connections_long_term_key(p_cb);
smp_update_key_mask (p_cb, SMP_SEC_KEY_TYPE_ENC, FALSE);
smp_br_select_next_key(p_cb, NULL);
@ -2105,7 +2106,7 @@ void smp_br_process_link_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_key_distribution_by_transport(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (p_cb->smp_over_br)
{
smp_br_select_next_key(p_cb, NULL);
@ -2123,7 +2124,7 @@ void smp_key_distribution_by_transport(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_br_pairing_complete(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (p_cb->total_tx_unacked == 0)
{

View File

@ -132,7 +132,7 @@ tSMP_STATUS SMP_Pair (BD_ADDR bd_addr)
tSMP_CB *p_cb = &smp_cb;
UINT8 status = SMP_PAIR_INTERNAL_ERR;
SMP_TRACE_EVENT ("%s state=%d br_state=%d flag=0x%x ",
SMP_TRACE_EVENT ("%s state=%d br_state=%d flag=0x%x \n",
__FUNCTION__, p_cb->state, p_cb->br_state, p_cb->flags);
if (p_cb->state != SMP_STATE_IDLE || p_cb->flags & SMP_PAIR_FLAGS_WE_STARTED_DD ||
p_cb->smp_over_br)
@ -148,7 +148,7 @@ tSMP_STATUS SMP_Pair (BD_ADDR bd_addr)
if (!L2CA_ConnectFixedChnl (L2CAP_SMP_CID, bd_addr))
{
SMP_TRACE_ERROR("%s: L2C connect fixed channel failed.", __FUNCTION__);
SMP_TRACE_ERROR("%s: L2C connect fixed channel failed.\n", __FUNCTION__);
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status);
return status;
}

View File

@ -82,7 +82,7 @@ void smp_debug_print_nbyte_little_endian(UINT8 *p, const UINT8 *key_name, UINT8
int row_count;
UINT8 p_buf[512];
SMP_TRACE_WARNING("%s(LSB ~ MSB):", key_name);
SMP_TRACE_WARNING("%s(LSB ~ MSB):\n", key_name);
memset(p_buf, 0, sizeof(p_buf));
row_count = len % col_count ? len / col_count + 1: len / col_count;
@ -145,16 +145,16 @@ BOOLEAN smp_encrypt_data (UINT8 *key, UINT8 key_len,
UINT8 *p_rev_key = NULL; /* input key in big endilan format */
UINT8 *p_rev_output = NULL; /* encrypted output in big endilan format */
SMP_TRACE_DEBUG ("%s", __func__);
SMP_TRACE_DEBUG ("%s\n", __func__);
if ( (p_out == NULL ) || (key_len != SMP_ENCRYT_KEY_SIZE) )
{
SMP_TRACE_ERROR ("%s failed", __func__);
SMP_TRACE_ERROR ("%s failed\n", __func__);
return FALSE;
}
if ((p_start = (UINT8 *)GKI_getbuf((SMP_ENCRYT_DATA_SIZE*4))) == NULL)
{
SMP_TRACE_ERROR ("%s failed unable to allocate buffer", __func__);
SMP_TRACE_ERROR ("%s failed unable to allocate buffer\n", __func__);
return FALSE;
}
@ -277,7 +277,7 @@ void smp_generate_stk(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
tSMP_ENC output;
tSMP_STATUS status = SMP_PAIR_FAIL_UNKNOWN;
SMP_TRACE_DEBUG ("%s", __func__);
SMP_TRACE_DEBUG ("%s\n", __func__);
if (p_cb->le_secure_connections_mode_is_used)
{
@ -312,7 +312,7 @@ void smp_generate_srand_mrand_confirm(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UNUSED(p_data);
SMP_TRACE_DEBUG ("%s", __func__);
SMP_TRACE_DEBUG ("%s\n", __func__);
p_cb->rand_enc_proc_state = SMP_GEN_SRAND_MRAND;
/* generate MRand or SRand */
if (!btsnd_hcic_ble_rand((void *)smp_rand_back))
@ -333,7 +333,7 @@ void smp_generate_rand_cont(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UNUSED(p_data);
SMP_TRACE_DEBUG ("%s", __func__);
SMP_TRACE_DEBUG ("%s\n", __func__);
p_cb->rand_enc_proc_state = SMP_GEN_SRAND_MRAND_CONT;
/* generate 64 MSB of MRand or SRand */
if (!btsnd_hcic_ble_rand((void *)smp_rand_back))
@ -360,7 +360,7 @@ void smp_generate_ltk(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
UNUSED(p_data);
BOOLEAN div_status;
SMP_TRACE_DEBUG ("%s", __FUNCTION__);
SMP_TRACE_DEBUG ("%s\n", __FUNCTION__);
if (smp_get_br_state() == SMP_BR_STATE_BOND_PENDING)
{
smp_br_process_link_key(p_cb, NULL);
@ -380,7 +380,7 @@ void smp_generate_ltk(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
}
else
{
SMP_TRACE_DEBUG ("Generate DIV for LTK");
SMP_TRACE_DEBUG ("Generate DIV for LTK\n");
p_cb->rand_enc_proc_state = SMP_GEN_DIV_LTK;
/* generate MRand or SRand */
if (!btsnd_hcic_ble_rand((void *)smp_rand_back))
@ -409,7 +409,7 @@ void smp_compute_csrk(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
tSMP_ENC output;
tSMP_STATUS status = SMP_PAIR_FAIL_UNKNOWN;
SMP_TRACE_DEBUG ("smp_compute_csrk div=%x", p_cb->div);
SMP_TRACE_DEBUG ("smp_compute_csrk div=%x\n", p_cb->div);
BTM_GetDeviceEncRoot(er);
/* CSRK = d1(ER, DIV, 1) */
UINT16_TO_STREAM(p, p_cb->div);
@ -417,7 +417,7 @@ void smp_compute_csrk(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
if (!SMP_Encrypt(er, BT_OCTET16_LEN, buffer, 4, &output))
{
SMP_TRACE_ERROR("smp_generate_csrk failed");
SMP_TRACE_ERROR("smp_generate_csrk failed\n");
if (p_cb->smp_over_br)
{
smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &status);
@ -475,7 +475,7 @@ void smp_concatenate_local( tSMP_CB *p_cb, UINT8 **p_data, UINT8 op_code)
{
UINT8 *p = *p_data;
SMP_TRACE_DEBUG ("%s", __func__);
SMP_TRACE_DEBUG ("%s\n", __func__);
UINT8_TO_STREAM(p, op_code);
UINT8_TO_STREAM(p, p_cb->local_io_capability);
UINT8_TO_STREAM(p, p_cb->loc_oob_flag);
@ -495,7 +495,7 @@ void smp_concatenate_peer( tSMP_CB *p_cb, UINT8 **p_data, UINT8 op_code)
{
UINT8 *p = *p_data;
SMP_TRACE_DEBUG ("smp_concatenate_peer ");
SMP_TRACE_DEBUG ("smp_concatenate_peer \n");
UINT8_TO_STREAM(p, op_code);
UINT8_TO_STREAM(p, p_cb->peer_io_caps);
UINT8_TO_STREAM(p, p_cb->peer_oob_flag);
@ -523,11 +523,11 @@ void smp_gen_p1_4_confirm( tSMP_CB *p_cb, BT_OCTET16 p1)
tBLE_ADDR_TYPE addr_type = 0;
BD_ADDR remote_bda;
SMP_TRACE_DEBUG ("smp_gen_p1_4_confirm");
SMP_TRACE_DEBUG ("smp_gen_p1_4_confirm\n");
if (!BTM_ReadRemoteConnectionAddr(p_cb->pairing_bda, remote_bda, &addr_type))
{
SMP_TRACE_ERROR("can not generate confirm for unknown device");
SMP_TRACE_ERROR("can not generate confirm for unknown device\n");
return;
}
@ -556,7 +556,7 @@ void smp_gen_p1_4_confirm( tSMP_CB *p_cb, BT_OCTET16 p1)
smp_concatenate_local(p_cb, &p, SMP_OPCODE_PAIRING_RSP);
}
#if SMP_DEBUG == TRUE
SMP_TRACE_DEBUG("p1 = pres || preq || rat' || iat'");
SMP_TRACE_DEBUG("p1 = pres || preq || rat' || iat'\n");
smp_debug_print_nbyte_little_endian ((UINT8 *)p1, (const UINT8 *)"P1", 16);
#endif
}
@ -576,14 +576,14 @@ void smp_gen_p2_4_confirm( tSMP_CB *p_cb, BT_OCTET16 p2)
UINT8 *p = (UINT8 *)p2;
BD_ADDR remote_bda;
tBLE_ADDR_TYPE addr_type = 0;
SMP_TRACE_DEBUG ("smp_gen_p2_4_confirm\n");
if (!BTM_ReadRemoteConnectionAddr(p_cb->pairing_bda, remote_bda, &addr_type))
{
SMP_TRACE_ERROR("can not generate confirm p2 for unknown device");
SMP_TRACE_ERROR("can not generate confirm p2 for unknown device\n");
return;
}
SMP_TRACE_DEBUG ("smp_gen_p2_4_confirm");
SMP_TRACE_DEBUG ("smp_gen_p2_4_confirm\n");
memset(p, 0, sizeof(BT_OCTET16));
@ -624,7 +624,7 @@ void smp_calculate_comfirm (tSMP_CB *p_cb, BT_OCTET16 rand, BD_ADDR bda)
tSMP_ENC output;
tSMP_STATUS status = SMP_PAIR_FAIL_UNKNOWN;
SMP_TRACE_DEBUG ("smp_calculate_comfirm ");
SMP_TRACE_DEBUG ("smp_calculate_comfirm \n");
/* generate p1 = pres || preq || rat' || iat' */
smp_gen_p1_4_confirm(p_cb, p1);
@ -661,9 +661,9 @@ static void smp_calculate_comfirm_cont(tSMP_CB *p_cb, tSMP_ENC *p)
tSMP_ENC output;
tSMP_STATUS status = SMP_PAIR_FAIL_UNKNOWN;
SMP_TRACE_DEBUG ("smp_calculate_comfirm_cont ");
SMP_TRACE_DEBUG ("smp_calculate_comfirm_cont \n");
#if SMP_DEBUG == TRUE
SMP_TRACE_DEBUG("Confirm step 1 p1' = e(k, r XOR p1) Generated");
SMP_TRACE_DEBUG("Confirm step 1 p1' = e(k, r XOR p1) Generated\n");
smp_debug_print_nbyte_little_endian (p->param_buf, (const UINT8 *)"C1", 16);
#endif
@ -676,11 +676,12 @@ static void smp_calculate_comfirm_cont(tSMP_CB *p_cb, tSMP_ENC *p)
/* calculate: Confirm = E(k, p1' XOR p2) */
if (!SMP_Encrypt(p_cb->tk, BT_OCTET16_LEN, p2, BT_OCTET16_LEN, &output))
{
SMP_TRACE_ERROR("smp_calculate_comfirm_cont failed");
SMP_TRACE_ERROR("smp_calculate_comfirm_cont failed\n");
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status);
}
else
{
SMP_TRACE_DEBUG("p_cb->rand_enc_proc_state=%d\n",p_cb->rand_enc_proc_state);
switch (p_cb->rand_enc_proc_state)
{
case SMP_GEN_CONFIRM:
@ -708,7 +709,7 @@ static void smp_generate_confirm(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UNUSED(p_data);
SMP_TRACE_DEBUG ("%s", __func__);
SMP_TRACE_DEBUG ("%s\n", __func__);
p_cb->rand_enc_proc_state = SMP_GEN_CONFIRM;
smp_debug_print_nbyte_little_endian ((UINT8 *)p_cb->rand, (const UINT8 *)"local rand", 16);
smp_calculate_comfirm(p_cb, p_cb->rand, p_cb->pairing_bda);
@ -729,7 +730,7 @@ void smp_generate_compare (tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
UNUSED(p_data);
SMP_TRACE_DEBUG ("smp_generate_compare ");
SMP_TRACE_DEBUG ("smp_generate_compare \n");
p_cb->rand_enc_proc_state = SMP_GEN_COMPARE;
smp_debug_print_nbyte_little_endian ((UINT8 *)p_cb->rrand, (const UINT8 *)"peer rand", 16);
smp_calculate_comfirm(p_cb, p_cb->rrand, p_cb->local_bda);
@ -749,7 +750,7 @@ static void smp_process_confirm(tSMP_CB *p_cb, tSMP_ENC *p)
{
tSMP_KEY key;
SMP_TRACE_DEBUG ("%s", __FUNCTION__);
SMP_TRACE_DEBUG ("%s\n", __FUNCTION__);
memcpy(p_cb->confirm, p->param_buf, BT_OCTET16_LEN);
#if (SMP_DEBUG == TRUE)
@ -759,7 +760,9 @@ static void smp_process_confirm(tSMP_CB *p_cb, tSMP_ENC *p)
key.key_type = SMP_KEY_TYPE_CFM;
key.p_data = p->param_buf;
smp_sm_event(p_cb, SMP_KEY_READY_EVT, &key);
}
/*******************************************************************************
@ -776,14 +779,14 @@ static void smp_process_compare(tSMP_CB *p_cb, tSMP_ENC *p)
{
tSMP_KEY key;
SMP_TRACE_DEBUG ("smp_process_compare ");
SMP_TRACE_DEBUG ("smp_process_compare \n");
#if (SMP_DEBUG == TRUE)
SMP_TRACE_DEBUG("Compare Generated");
SMP_TRACE_DEBUG("Compare Generated\n");
smp_debug_print_nbyte_little_endian (p->param_buf, (const UINT8 *)"Compare", 16);
#endif
key.key_type = SMP_KEY_TYPE_CMP;
key.p_data = p->param_buf;
//smp_set_state(SMP_STATE_CONFIRM);
smp_sm_event(p_cb, SMP_KEY_READY_EVT, &key);
}
@ -830,14 +833,14 @@ static void smp_generate_ltk_cont(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
tSMP_ENC output;
tSMP_STATUS status = SMP_PAIR_FAIL_UNKNOWN;
SMP_TRACE_DEBUG ("%s", __func__);
SMP_TRACE_DEBUG ("%s\n", __func__);
BTM_GetDeviceEncRoot(er);
/* LTK = d1(ER, DIV, 0)= e(ER, DIV)*/
if (!SMP_Encrypt(er, BT_OCTET16_LEN, (UINT8 *)&p_cb->div,
sizeof(UINT16), &output))
{
SMP_TRACE_ERROR("%s failed", __func__);
SMP_TRACE_ERROR("%s failed\n", __func__);
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status);
}
else
@ -867,7 +870,7 @@ static void smp_generate_y(tSMP_CB *p_cb, tSMP_INT_DATA *p)
tSMP_STATUS status = SMP_PAIR_FAIL_UNKNOWN;
SMP_TRACE_DEBUG ("smp_generate_y ");
SMP_TRACE_DEBUG ("smp_generate_y \n");
BTM_GetDeviceDHK(dhk);
if (!SMP_Encrypt(dhk, BT_OCTET16_LEN, p_cb->enc_rand,
@ -898,7 +901,7 @@ static void smp_generate_rand_vector (tSMP_CB *p_cb, tSMP_INT_DATA *p)
/* generate EDIV and rand now */
/* generate random vector */
SMP_TRACE_DEBUG ("smp_generate_rand_vector ");
SMP_TRACE_DEBUG ("smp_generate_rand_vector\n");
p_cb->rand_enc_proc_state = SMP_GEN_RAND_V;
if (!btsnd_hcic_ble_rand((void *)smp_rand_back))
smp_rand_back(NULL);
@ -946,7 +949,7 @@ BOOLEAN smp_calculate_legacy_short_term_key(tSMP_CB *p_cb, tSMP_ENC *output)
BT_OCTET16 ptext;
UINT8 *p = ptext;
SMP_TRACE_DEBUG ("%s", __func__);
SMP_TRACE_DEBUG ("%s\n", __func__);
memset(p, 0, BT_OCTET16_LEN);
if (p_cb->role == HCI_ROLE_MASTER)
{
@ -964,7 +967,7 @@ BOOLEAN smp_calculate_legacy_short_term_key(tSMP_CB *p_cb, tSMP_ENC *output)
encrypted = SMP_Encrypt( p_cb->tk, BT_OCTET16_LEN, ptext, BT_OCTET16_LEN, output);
if (!encrypted)
{
SMP_TRACE_ERROR("%s failed", __func__);
SMP_TRACE_ERROR("%s failed\n", __func__);
}
return encrypted;
}
@ -1007,19 +1010,19 @@ void smp_create_private_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
*******************************************************************************/
void smp_use_oob_private_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
{
SMP_TRACE_DEBUG ("%s req_oob_type: %d, role: %d",
SMP_TRACE_DEBUG ("%s req_oob_type: %d, role: %d\n",
__func__, p_cb->req_oob_type, p_cb->role);
switch (p_cb->req_oob_type)
{
case SMP_OOB_BOTH:
case SMP_OOB_LOCAL:
SMP_TRACE_DEBUG("%s restore secret key", __func__)
SMP_TRACE_DEBUG("%s restore secret key\n", __func__);
memcpy(p_cb->private_key, p_cb->sc_oob_data.loc_oob_data.private_key_used, BT_OCTET32_LEN);
smp_process_private_key(p_cb);
break;
default:
SMP_TRACE_DEBUG("%s create secret key anew", __func__);
SMP_TRACE_DEBUG("%s create secret key anew\n", __func__);
smp_set_state(SMP_STATE_PAIR_REQ_RSP);
smp_decide_association_model(p_cb, NULL);
break;
@ -1038,7 +1041,7 @@ void smp_use_oob_private_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
void smp_continue_private_key_creation (tSMP_CB *p_cb, tBTM_RAND_ENC *p)
{
UINT8 state = p_cb->rand_enc_proc_state & ~0x80;
SMP_TRACE_DEBUG ("%s state=0x%x", __func__, state);
SMP_TRACE_DEBUG ("%s state=0x%x\n", __func__, state);
switch (state)
{
@ -1125,7 +1128,7 @@ void smp_compute_dhkey (tSMP_CB *p_cb)
Point peer_publ_key, new_publ_key;
BT_OCTET32 private_key;
SMP_TRACE_DEBUG ("%s", __FUNCTION__);
SMP_TRACE_DEBUG ("%s\n", __FUNCTION__);
memcpy(private_key, p_cb->private_key, BT_OCTET32_LEN);
memcpy(peer_publ_key.x, p_cb->peer_publ_key.x, BT_OCTET32_LEN);
@ -1161,7 +1164,7 @@ void smp_calculate_local_commitment(tSMP_CB *p_cb)
{
UINT8 random_input;
SMP_TRACE_DEBUG("%s", __FUNCTION__);
SMP_TRACE_DEBUG("%s\n", __FUNCTION__);
switch (p_cb->selected_association_model)
{
@ -1169,7 +1172,7 @@ void smp_calculate_local_commitment(tSMP_CB *p_cb)
case SMP_MODEL_SEC_CONN_NUM_COMP:
if (p_cb->role == HCI_ROLE_MASTER)
SMP_TRACE_WARNING ("local commitment calc on master is not expected \
for Just Works/Numeric Comparison models");
for Just Works/Numeric Comparison models\n");
smp_calculate_f4(p_cb->loc_publ_key.x, p_cb->peer_publ_key.x, p_cb->rand, 0,
p_cb->commitment);
break;
@ -1180,12 +1183,12 @@ void smp_calculate_local_commitment(tSMP_CB *p_cb)
random_input, p_cb->commitment);
break;
case SMP_MODEL_SEC_CONN_OOB:
SMP_TRACE_WARNING ("local commitment calc is expected for OOB model BEFORE pairing");
SMP_TRACE_WARNING ("local commitment calc is expected for OOB model BEFORE pairing\n");
smp_calculate_f4(p_cb->loc_publ_key.x, p_cb->loc_publ_key.x, p_cb->local_random, 0,
p_cb->commitment);
break;
default:
SMP_TRACE_ERROR("Association Model = %d is not used in LE SC",
SMP_TRACE_ERROR("Association Model = %d is not used in LE SC\n",
p_cb->selected_association_model);
return;
}
@ -1215,7 +1218,7 @@ void smp_calculate_peer_commitment(tSMP_CB *p_cb, BT_OCTET16 output_buf)
case SMP_MODEL_SEC_CONN_NUM_COMP:
if (p_cb->role == HCI_ROLE_SLAVE)
SMP_TRACE_WARNING ("peer commitment calc on slave is not expected \
for Just Works/Numeric Comparison models");
for Just Works/Numeric Comparison models\n");
smp_calculate_f4(p_cb->peer_publ_key.x, p_cb->loc_publ_key.x, p_cb->rrand, 0,
output_buf);
break;
@ -1230,12 +1233,12 @@ void smp_calculate_peer_commitment(tSMP_CB *p_cb, BT_OCTET16 output_buf)
output_buf);
break;
default:
SMP_TRACE_ERROR("Association Model = %d is not used in LE SC",
SMP_TRACE_ERROR("Association Model = %d is not used in LE SC\n",
p_cb->selected_association_model);
return;
}
SMP_TRACE_EVENT ("peer commitment calculation is completed");
SMP_TRACE_EVENT ("peer commitment calculation is completed\n");
}
/*******************************************************************************
@ -1386,7 +1389,7 @@ UINT32 smp_calculate_g2(UINT8 *u, UINT8 *v, UINT8 *x, UINT8 *y)
UINT8 *p_prnt = NULL;
#endif
SMP_TRACE_DEBUG ("%s", __FUNCTION__);
SMP_TRACE_DEBUG ("%s\n", __FUNCTION__);
p = msg;
ARRAY_TO_STREAM(p, y, BT_OCTET16_LEN);

View File

@ -93,14 +93,14 @@ static void smp_connect_callback (UINT16 channel, BD_ADDR bd_addr, BOOLEAN conne
tSMP_INT_DATA int_data;
BD_ADDR dummy_bda = {0};
SMP_TRACE_EVENT ("SMDBG l2c %s", __FUNCTION__);
SMP_TRACE_EVENT ("SMDBG l2c %s\n", __FUNCTION__);
if (transport == BT_TRANSPORT_BR_EDR || memcmp(bd_addr, dummy_bda, BD_ADDR_LEN) == 0)
return;
if (memcmp(bd_addr, p_cb->pairing_bda, BD_ADDR_LEN) == 0)
{
SMP_TRACE_EVENT ("%s() for pairing BDA: %08x%04x Event: %s",
SMP_TRACE_EVENT ("%s() for pairing BDA: %08x%04x Event: %s\n",
__FUNCTION__,
(bd_addr[0]<<24)+(bd_addr[1]<<16)+(bd_addr[2]<<8) + bd_addr[3],
(bd_addr[4]<<8)+bd_addr[5],
@ -146,14 +146,14 @@ static void smp_data_received(UINT16 channel, BD_ADDR bd_addr, BT_HDR *p_buf)
tSMP_CB *p_cb = &smp_cb;
UINT8 *p = (UINT8 *)(p_buf + 1) + p_buf->offset;
UINT8 cmd ;
SMP_TRACE_EVENT ("SMDBG l2c %s", __FUNCTION__);
SMP_TRACE_EVENT ("\nSMDBG l2c %s\n", __FUNCTION__);
STREAM_TO_UINT8(cmd, p);
/* sanity check */
if ((SMP_OPCODE_MAX < cmd) || (SMP_OPCODE_MIN > cmd))
{
SMP_TRACE_WARNING( "Ignore received command with RESERVED code 0x%02x", cmd);
SMP_TRACE_WARNING( "Ignore received command with RESERVED code 0x%02x\n", cmd);
GKI_freebuf (p_buf);
return;
}
@ -184,7 +184,7 @@ static void smp_data_received(UINT16 channel, BD_ADDR bd_addr, BT_HDR *p_buf)
if (cmd == SMP_OPCODE_CONFIRM)
{
SMP_TRACE_DEBUG ("in %s cmd = 0x%02x, peer_auth_req = 0x%02x,"
"loc_auth_req = 0x%02x",
"loc_auth_req = 0x%02x\n",
__FUNCTION__, cmd, p_cb->peer_auth_req, p_cb->loc_auth_req);
if ((p_cb->peer_auth_req & SMP_SC_SUPPORT_BIT) &&

View File

@ -442,7 +442,7 @@ static const UINT8 smp_slave_entry_map[][SMP_STATE_MAX] =
{
/* state name: Idle WaitApp SecReq Pair Wait Confirm Rand PublKey SCPhs1 Wait Wait SCPhs2 Wait DHKChk Enc Bond CrLocSc
Rsp Pend ReqRsp Cfm Exch Strt Cmtm Nonce Strt DHKChk Pend Pend OobData */
/* PAIR_REQ */{ 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* PAIR_REQ */{ 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* PAIR_RSP */{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* CONFIRM */{ 0, 4, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
/* RAND */{ 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 },
@ -525,7 +525,6 @@ static const UINT8 smp_slave_pair_request_response_table[][SMP_SM_NUM_COLS] =
/* Event Action Next State */
/* CONFIRM */ {SMP_PROC_CONFIRM, SMP_SM_NO_ACTION, SMP_STATE_CONFIRM},
/* TK_REQ */ {SMP_SEND_APP_CBACK, SMP_SM_NO_ACTION, SMP_STATE_WAIT_APP_RSP},
/* TK/Confirm ready */
/* KEY_READY */{SMP_PROC_SL_KEY, SMP_SM_NO_ACTION, SMP_STATE_PAIR_REQ_RSP}
/* PUBL_KEY_EXCH_REQ */,{ SMP_CREATE_PRIVATE_KEY, SMP_SM_NO_ACTION, SMP_STATE_PUBLIC_KEY_EXCH},
@ -772,15 +771,15 @@ void smp_sm_event(tSMP_CB *p_cb, tSMP_EVENT event, void *p_data)
UINT8 action, entry, i;
tSMP_ENTRY_TBL entry_table = smp_entry_table[p_cb->role];
SMP_TRACE_EVENT("main smp_sm_event");
SMP_TRACE_EVENT("main smp_sm_event\n");
if (curr_state >= SMP_STATE_MAX)
{
SMP_TRACE_DEBUG( "Invalid state: %d", curr_state) ;
SMP_TRACE_DEBUG( "Invalid state: %d\n", curr_state) ;
return;
}
SMP_TRACE_DEBUG( "SMP Role: %s State: [%s (%d)], Event: [%s (%d)]",\
(p_cb->role == 0x01) ?"Slave" : "Master", smp_get_state_name( p_cb->state),
(p_cb->role == 0x01) ?"Slave" : "Master\n", smp_get_state_name( p_cb->state),
p_cb->state, smp_get_event_name(event), event) ;
/* look up the state table for the current state */
@ -799,7 +798,7 @@ void smp_sm_event(tSMP_CB *p_cb, tSMP_EVENT event, void *p_data)
}
else
{
SMP_TRACE_DEBUG( "Ignore event [%s (%d)] in state [%s (%d)]",
SMP_TRACE_DEBUG( "Ignore event [%s (%d)] in state [%s (%d)]\n",
smp_get_event_name(event), event, smp_get_state_name(curr_state),
curr_state);
return;
@ -825,7 +824,7 @@ void smp_sm_event(tSMP_CB *p_cb, tSMP_EVENT event, void *p_data)
break;
}
}
SMP_TRACE_DEBUG( "result state = %s", smp_get_state_name( p_cb->state ) ) ;
SMP_TRACE_DEBUG( "result state = %s\n", smp_get_state_name( p_cb->state ) ) ;
}
/*******************************************************************************

View File

@ -314,7 +314,7 @@ BOOLEAN smp_send_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
BT_HDR *p_buf;
BOOLEAN sent = FALSE;
UINT8 failure = SMP_PAIR_INTERNAL_ERR;
SMP_TRACE_EVENT("smp_send_cmd on l2cap cmd_code=0x%x", cmd_code);
SMP_TRACE_EVENT("smp_send_cmd on l2cap cmd_code=0x%x\n", cmd_code);
if ( cmd_code <= (SMP_OPCODE_MAX + 1 /* for SMP_OPCODE_PAIR_COMMITM */) &&
smp_cmd_build_act[cmd_code] != NULL)
{
@ -418,7 +418,7 @@ static BT_HDR * smp_build_confirm_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
UINT8 *p;
UNUSED(cmd_code);
SMP_TRACE_EVENT("smp_build_confirm_cmd");
SMP_TRACE_EVENT("smp_build_confirm_cmd\n");
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + SMP_CONFIRM_CMD_SIZE + L2CAP_MIN_OFFSET)) != NULL)
{
p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
@ -445,7 +445,7 @@ static BT_HDR * smp_build_rand_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
UINT8 *p;
UNUSED(cmd_code);
SMP_TRACE_EVENT("%s", __func__);
SMP_TRACE_EVENT("%s\n", __func__);
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + SMP_RAND_CMD_SIZE + L2CAP_MIN_OFFSET))
!= NULL)
{
@ -473,7 +473,7 @@ static BT_HDR * smp_build_encrypt_info_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
UINT8 *p;
UNUSED(cmd_code);
SMP_TRACE_EVENT("smp_build_encrypt_info_cmd");
SMP_TRACE_EVENT("smp_build_encrypt_info_cmd\n");
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + SMP_ENC_INFO_SIZE + L2CAP_MIN_OFFSET)) != NULL)
{
p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
@ -501,7 +501,7 @@ static BT_HDR * smp_build_master_id_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
UINT8 *p;
UNUSED(cmd_code);
SMP_TRACE_EVENT("%s", __func__);
SMP_TRACE_EVENT("%s\n", __func__);
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + SMP_MASTER_ID_SIZE + L2CAP_MIN_OFFSET)) != NULL)
{
@ -533,7 +533,7 @@ static BT_HDR * smp_build_identity_info_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
UNUSED(cmd_code);
UNUSED(p_cb);
SMP_TRACE_EVENT("smp_build_identity_info_cmd");
SMP_TRACE_EVENT("smp_build_identity_info_cmd\n");
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + SMP_ID_INFO_SIZE + L2CAP_MIN_OFFSET)) != NULL)
{
p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
@ -564,7 +564,7 @@ static BT_HDR * smp_build_id_addr_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
UNUSED(cmd_code);
UNUSED(p_cb);
SMP_TRACE_EVENT("smp_build_id_addr_cmd");
SMP_TRACE_EVENT("smp_build_id_addr_cmd\n");
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + SMP_ID_ADDR_SIZE + L2CAP_MIN_OFFSET)) != NULL)
{
p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
@ -593,7 +593,7 @@ static BT_HDR * smp_build_signing_info_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
UINT8 *p;
UNUSED(cmd_code);
SMP_TRACE_EVENT("smp_build_signing_info_cmd");
SMP_TRACE_EVENT("smp_build_signing_info_cmd\n");
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + SMP_SIGN_INFO_SIZE + L2CAP_MIN_OFFSET)) != NULL)
{
p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
@ -621,7 +621,7 @@ static BT_HDR * smp_build_pairing_fail(UINT8 cmd_code, tSMP_CB *p_cb)
UINT8 *p;
UNUSED(cmd_code);
SMP_TRACE_EVENT("%s", __func__);
SMP_TRACE_EVENT("%s\n", __func__);
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + SMP_PAIR_FAIL_SIZE + L2CAP_MIN_OFFSET)) != NULL)
{
p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
@ -649,7 +649,7 @@ static BT_HDR *smp_build_security_request(UINT8 cmd_code, tSMP_CB *p_cb)
UINT8 *p;
UNUSED(cmd_code);
SMP_TRACE_EVENT("%s", __func__);
SMP_TRACE_EVENT("%s\n", __func__);
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + 2 + L2CAP_MIN_OFFSET)) != NULL)
{
p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
@ -682,7 +682,7 @@ static BT_HDR *smp_build_pair_public_key_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
UINT8 *p_publ_key = publ_key;
UNUSED(cmd_code);
SMP_TRACE_EVENT("%s", __FUNCTION__);
SMP_TRACE_EVENT("%s\n", __FUNCTION__);
memcpy(p_publ_key, p_cb->loc_publ_key.x, BT_OCTET32_LEN);
memcpy(p_publ_key + BT_OCTET32_LEN, p_cb->loc_publ_key.y, BT_OCTET32_LEN);
@ -715,7 +715,7 @@ static BT_HDR *smp_build_pairing_commitment_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
UINT8 *p;
UNUSED(cmd_code);
SMP_TRACE_EVENT("%s", __func__);
SMP_TRACE_EVENT("%s\n", __func__);
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + SMP_PAIR_COMMITM_SIZE + L2CAP_MIN_OFFSET))
!= NULL)
{
@ -744,7 +744,7 @@ static BT_HDR *smp_build_pair_dhkey_check_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
UINT8 *p;
UNUSED(cmd_code);
SMP_TRACE_EVENT("%s", __FUNCTION__);
SMP_TRACE_EVENT("%s\n", __FUNCTION__);
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) +
SMP_PAIR_DHKEY_CHECK_SIZE + L2CAP_MIN_OFFSET)) != NULL)
{
@ -773,7 +773,7 @@ static BT_HDR * smp_build_pairing_keypress_notification_cmd(UINT8 cmd_code, tSMP
UINT8 *p;
UNUSED(cmd_code);
SMP_TRACE_EVENT("%s", __FUNCTION__);
SMP_TRACE_EVENT("%s\n", __FUNCTION__);
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR)\
+ SMP_PAIR_KEYPR_NOTIF_SIZE + L2CAP_MIN_OFFSET)) != NULL)
{
@ -804,7 +804,7 @@ void smp_convert_string_to_tk(BT_OCTET16 tk, UINT32 passkey)
{
UINT8 *p = tk;
tSMP_KEY key;
SMP_TRACE_EVENT("smp_convert_string_to_tk");
SMP_TRACE_EVENT("smp_convert_string_to_tk\n");
UINT32_TO_STREAM(p, passkey);
key.key_type = SMP_KEY_TYPE_TK;
@ -826,7 +826,7 @@ void smp_convert_string_to_tk(BT_OCTET16 tk, UINT32 passkey)
*******************************************************************************/
void smp_mask_enc_key(UINT8 loc_enc_size, UINT8 * p_data)
{
SMP_TRACE_EVENT("smp_mask_enc_key");
SMP_TRACE_EVENT("smp_mask_enc_key\n");
if (loc_enc_size < BT_OCTET16_LEN)
{
for (; loc_enc_size < BT_OCTET16_LEN; loc_enc_size ++)
@ -849,7 +849,7 @@ void smp_xor_128(BT_OCTET16 a, BT_OCTET16 b)
{
UINT8 i, *aa = a, *bb = b;
SMP_TRACE_EVENT("smp_xor_128");
SMP_TRACE_EVENT("smp_xor_128\n");
for (i = 0; i < BT_OCTET16_LEN; i++)
{
aa[i] = aa[i] ^ bb[i];
@ -870,7 +870,7 @@ void smp_cb_cleanup(tSMP_CB *p_cb)
tSMP_CALLBACK *p_callback = p_cb->p_callback;
UINT8 trace_level = p_cb->trace_level;
SMP_TRACE_EVENT("smp_cb_cleanup");
SMP_TRACE_EVENT("smp_cb_cleanup\n");
memset(p_cb, 0, sizeof(tSMP_CB));
p_cb->p_callback = p_callback;
@ -888,7 +888,7 @@ void smp_cb_cleanup(tSMP_CB *p_cb)
*******************************************************************************/
void smp_remove_fixed_channel(tSMP_CB *p_cb)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (p_cb->smp_over_br)
L2CA_RemoveFixedChnl (L2CAP_SMP_BR_CID, p_cb->pairing_bda);
@ -909,7 +909,7 @@ void smp_remove_fixed_channel(tSMP_CB *p_cb)
*******************************************************************************/
void smp_reset_control_value(tSMP_CB *p_cb)
{
SMP_TRACE_EVENT("smp_reset_control_value");
SMP_TRACE_EVENT("smp_reset_control_value\n");
btu_stop_timer (&p_cb->rsp_timer_ent);
p_cb->flags = 0;
/* set the link idle timer to drop the link when pairing is done
@ -939,7 +939,7 @@ void smp_proc_pairing_cmpl(tSMP_CB *p_cb)
tSMP_CALLBACK *p_callback = p_cb->p_callback;
BD_ADDR pairing_bda;
SMP_TRACE_DEBUG ("smp_proc_pairing_cmpl ");
SMP_TRACE_DEBUG ("smp_proc_pairing_cmpl \n");
evt_data.cmplt.reason = p_cb->status;
evt_data.cmplt.smp_over_br = p_cb->smp_over_br;
@ -953,7 +953,7 @@ void smp_proc_pairing_cmpl(tSMP_CB *p_cb)
evt_data.cmplt.is_pair_cancel = TRUE;
SMP_TRACE_DEBUG ("send SMP_COMPLT_EVT reason=0x%0x sec_level=0x%0x",
SMP_TRACE_DEBUG ("send SMP_COMPLT_EVT reason=0x%0x sec_level=0x%0x\n",
evt_data.cmplt.reason,
evt_data.cmplt.sec_level );
@ -981,12 +981,12 @@ BOOLEAN smp_command_has_invalid_parameters(tSMP_CB *p_cb)
{
UINT8 cmd_code = p_cb->rcvd_cmd_code;
SMP_TRACE_DEBUG("%s for cmd code 0x%02x", __func__, cmd_code);
SMP_TRACE_DEBUG("%s for cmd code 0x%02x\n", __func__, cmd_code);
if ((cmd_code > (SMP_OPCODE_MAX + 1 /* for SMP_OPCODE_PAIR_COMMITM */)) ||
(cmd_code < SMP_OPCODE_MIN))
{
SMP_TRACE_WARNING("Somehow received command with the RESERVED code 0x%02x", cmd_code);
SMP_TRACE_WARNING("Somehow received command with the RESERVED code 0x%02x\n", cmd_code);
return TRUE;
}
@ -1014,12 +1014,12 @@ BOOLEAN smp_command_has_valid_fixed_length(tSMP_CB *p_cb)
{
UINT8 cmd_code = p_cb->rcvd_cmd_code;
SMP_TRACE_DEBUG("%s for cmd code 0x%02x", __func__, cmd_code);
SMP_TRACE_DEBUG("%s for cmd code 0x%02x\n", __func__, cmd_code);
if (p_cb->rcvd_cmd_len != smp_cmd_size_per_spec[cmd_code])
{
SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with invalid length\
0x%02x (per spec the length is 0x%02x).",
0x%02x (per spec the length is 0x%02x).\n",
cmd_code, p_cb->rcvd_cmd_len, smp_cmd_size_per_spec[cmd_code]);
return FALSE;
}
@ -1048,12 +1048,12 @@ BOOLEAN smp_pairing_request_response_parameters_are_valid(tSMP_CB *p_cb)
UINT8 bond_flag = p_cb->peer_auth_req & 0x03; //0x03 is gen bond with appropriate mask
UINT8 enc_size = p_cb->peer_enc_size;
SMP_TRACE_DEBUG("%s for cmd code 0x%02x", __func__, p_cb->rcvd_cmd_code);
SMP_TRACE_DEBUG("%s for cmd code 0x%02x\n", __func__, p_cb->rcvd_cmd_code);
if (io_caps >= BTM_IO_CAP_MAX)
{
SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with IO Capabilty \
value (0x%02x) out of range).",
value (0x%02x) out of range).\n",
p_cb->rcvd_cmd_code, io_caps);
return FALSE;
}
@ -1061,7 +1061,7 @@ BOOLEAN smp_pairing_request_response_parameters_are_valid(tSMP_CB *p_cb)
if (!((oob_flag == SMP_OOB_NONE) || (oob_flag == SMP_OOB_PRESENT)))
{
SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with OOB data flag value \
(0x%02x) out of range).",
(0x%02x) out of range).\n",
p_cb->rcvd_cmd_code, oob_flag);
return FALSE;
}
@ -1069,7 +1069,7 @@ BOOLEAN smp_pairing_request_response_parameters_are_valid(tSMP_CB *p_cb)
if (!((bond_flag == SMP_AUTH_NO_BOND) || (bond_flag == SMP_AUTH_BOND)))
{
SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with Bonding_Flags value (0x%02x)\
out of range).",
out of range).\n",
p_cb->rcvd_cmd_code, bond_flag);
return FALSE;
}
@ -1077,7 +1077,7 @@ BOOLEAN smp_pairing_request_response_parameters_are_valid(tSMP_CB *p_cb)
if ((enc_size < SMP_ENCR_KEY_SIZE_MIN) || (enc_size > SMP_ENCR_KEY_SIZE_MAX))
{
SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with Maximum Encryption \
Key value (0x%02x) out of range).",
Key value (0x%02x) out of range).\n",
p_cb->rcvd_cmd_code, enc_size);
return FALSE;
}
@ -1098,12 +1098,12 @@ BOOLEAN smp_pairing_keypress_notification_is_valid(tSMP_CB *p_cb)
{
tBTM_SP_KEY_TYPE keypress_notification = p_cb->peer_keypress_notification;
SMP_TRACE_DEBUG("%s for cmd code 0x%02x", __func__, p_cb->rcvd_cmd_code);
SMP_TRACE_DEBUG("%s for cmd code 0x%02x\n", __func__, p_cb->rcvd_cmd_code);
if (keypress_notification >= BTM_SP_KEY_OUT_OF_RANGE)
{
SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with Pairing Keypress \
Notification value (0x%02x) out of range).",
Notification value (0x%02x) out of range).\n",
p_cb->rcvd_cmd_code, keypress_notification);
return FALSE;
}
@ -1150,7 +1150,7 @@ void smp_reject_unexpected_pairing_command(BD_ADDR bd_addr)
BT_HDR *p_buf;
UINT8 *p;
SMP_TRACE_DEBUG ("%s", __FUNCTION__);
SMP_TRACE_DEBUG ("%s\n", __FUNCTION__);
if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) +\
SMP_PAIR_FAIL_SIZE + L2CAP_MIN_OFFSET)) != NULL)
@ -1188,14 +1188,14 @@ tSMP_ASSO_MODEL smp_select_association_model(tSMP_CB *p_cb)
tSMP_ASSO_MODEL model = SMP_MODEL_OUT_OF_RANGE;
p_cb->le_secure_connections_mode_is_used = FALSE;
SMP_TRACE_EVENT("%s", __FUNCTION__);
SMP_TRACE_DEBUG("%s p_cb->peer_io_caps = %d p_cb->local_io_capability = %d",
SMP_TRACE_EVENT("%s\n", __FUNCTION__);
SMP_TRACE_DEBUG("%s p_cb->peer_io_caps = %d p_cb->local_io_capability = %d\n",
__FUNCTION__, p_cb->peer_io_caps, p_cb->local_io_capability);
SMP_TRACE_DEBUG("%s p_cb->peer_oob_flag = %d p_cb->loc_oob_flag = %d",
SMP_TRACE_DEBUG("%s p_cb->peer_oob_flag = %d p_cb->loc_oob_flag = %d\n",
__FUNCTION__, p_cb->peer_oob_flag, p_cb->loc_oob_flag);
SMP_TRACE_DEBUG("%s p_cb->peer_auth_req = 0x%02x p_cb->loc_auth_req = 0x%02x",
SMP_TRACE_DEBUG("%s p_cb->peer_auth_req = 0x%02x p_cb->loc_auth_req = 0x%02x\n",
__FUNCTION__, p_cb->peer_auth_req, p_cb->loc_auth_req);
SMP_TRACE_DEBUG("%s p_cb->secure_connections_only_mode_required = %s",
SMP_TRACE_DEBUG("%s p_cb->secure_connections_only_mode_required = %s\n",
__FUNCTION__, p_cb->secure_connections_only_mode_required ?
"TRUE" : "FALSE");
@ -1204,7 +1204,7 @@ tSMP_ASSO_MODEL smp_select_association_model(tSMP_CB *p_cb)
p_cb->le_secure_connections_mode_is_used = TRUE;
}
SMP_TRACE_DEBUG("use_sc_process = %d", p_cb->le_secure_connections_mode_is_used);
SMP_TRACE_DEBUG("use_sc_process = %d\n", p_cb->le_secure_connections_mode_is_used);
if (p_cb->le_secure_connections_mode_is_used)
{
@ -1228,7 +1228,7 @@ tSMP_ASSO_MODEL smp_select_legacy_association_model(tSMP_CB *p_cb)
{
tSMP_ASSO_MODEL model = SMP_MODEL_OUT_OF_RANGE;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
/* if OOB data is present on both devices, then use OOB association model */
if (p_cb->peer_oob_flag == SMP_OOB_PRESENT && p_cb->loc_oob_flag == SMP_OOB_PRESENT)
return SMP_MODEL_OOB;
@ -1266,7 +1266,7 @@ tSMP_ASSO_MODEL smp_select_association_model_secure_connections(tSMP_CB *p_cb)
{
tSMP_ASSO_MODEL model = SMP_MODEL_OUT_OF_RANGE;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
/* if OOB data is present on at least one device, then use OOB association model */
if (p_cb->peer_oob_flag == SMP_OOB_PRESENT || p_cb->loc_oob_flag == SMP_OOB_PRESENT)
return SMP_MODEL_SEC_CONN_OOB;
@ -1303,7 +1303,7 @@ void smp_reverse_array(UINT8 *arr, UINT8 len)
{
UINT8 i =0, tmp;
SMP_TRACE_DEBUG("smp_reverse_array");
SMP_TRACE_DEBUG("smp_reverse_array\n");
for (i = 0; i < len/2; i ++)
{
@ -1330,9 +1330,9 @@ UINT8 smp_calculate_random_input(UINT8 *random, UINT8 round)
UINT8 j = round%8;
UINT8 ri;
SMP_TRACE_DEBUG("random: 0x%02x, round: %d, i: %d, j: %d", random[i], round, i, j);
SMP_TRACE_DEBUG("random: 0x%02x, round: %d, i: %d, j: %d\n", random[i], round, i, j);
ri = ((random[i] >> j) & 1) | 0x80;
SMP_TRACE_DEBUG("%s ri=0x%02x", __func__, ri);
SMP_TRACE_DEBUG("%s ri=0x%02x\n", __func__, ri);
return ri;
}
@ -1347,7 +1347,7 @@ UINT8 smp_calculate_random_input(UINT8 *random, UINT8 round)
*******************************************************************************/
void smp_collect_local_io_capabilities(UINT8 *iocap, tSMP_CB *p_cb)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
iocap[0] = p_cb->local_io_capability;
iocap[1] = p_cb->loc_oob_flag;
@ -1365,7 +1365,7 @@ void smp_collect_local_io_capabilities(UINT8 *iocap, tSMP_CB *p_cb)
*******************************************************************************/
void smp_collect_peer_io_capabilities(UINT8 *iocap, tSMP_CB *p_cb)
{
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
iocap[0] = p_cb->peer_io_caps;
iocap[1] = p_cb->peer_oob_flag;
@ -1388,7 +1388,7 @@ void smp_collect_local_ble_address(UINT8 *le_addr, tSMP_CB *p_cb)
BD_ADDR bda;
UINT8 *p = le_addr;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
BTM_ReadConnectionAddr( p_cb->pairing_bda, bda, &addr_type);
BDADDR_TO_STREAM(p, bda);
@ -1411,11 +1411,11 @@ void smp_collect_peer_ble_address(UINT8 *le_addr, tSMP_CB *p_cb)
BD_ADDR bda;
UINT8 *p = le_addr;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (!BTM_ReadRemoteConnectionAddr(p_cb->pairing_bda, bda, &addr_type))
{
SMP_TRACE_ERROR("can not collect peer le addr information for unknown device");
SMP_TRACE_ERROR("can not collect peer le addr information for unknown device\n");
return;
}
@ -1438,7 +1438,7 @@ BOOLEAN smp_check_commitment(tSMP_CB *p_cb)
{
BT_OCTET16 expected;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
smp_calculate_peer_commitment(p_cb, expected);
print128(expected, (const UINT8 *)"calculated peer commitment");
@ -1446,11 +1446,11 @@ BOOLEAN smp_check_commitment(tSMP_CB *p_cb)
if (memcmp(p_cb->remote_commitment, expected, BT_OCTET16_LEN))
{
SMP_TRACE_WARNING("Commitment check fails");
SMP_TRACE_WARNING("Commitment check fails\n");
return FALSE;
}
SMP_TRACE_DEBUG("Commitment check succeeds");
SMP_TRACE_DEBUG("Commitment check succeeds\n");
return TRUE;
}
@ -1469,14 +1469,14 @@ void smp_save_secure_connections_long_term_key(tSMP_CB *p_cb)
tBTM_LE_LENC_KEYS lle_key;
tBTM_LE_PENC_KEYS ple_key;
SMP_TRACE_DEBUG("%s-Save LTK as local LTK key", __func__);
SMP_TRACE_DEBUG("%s-Save LTK as local LTK key\n", __func__);
memcpy(lle_key.ltk, p_cb->ltk, BT_OCTET16_LEN);
lle_key.div = 0;
lle_key.key_size = p_cb->loc_enc_size;
lle_key.sec_level = p_cb->sec_level;
btm_sec_save_le_key(p_cb->pairing_bda, BTM_LE_KEY_LENC, (tBTM_LE_KEY_VALUE *)&lle_key, TRUE);
SMP_TRACE_DEBUG("%s-Save LTK as peer LTK key", __func__);
SMP_TRACE_DEBUG("%s-Save LTK as peer LTK key\n", __func__);
ple_key.ediv = 0;
memset(ple_key.rand, 0, BT_OCTET8_LEN);
memcpy(ple_key.ltk, p_cb->ltk, BT_OCTET16_LEN);
@ -1504,7 +1504,7 @@ BOOLEAN smp_calculate_f5_mackey_and_long_term_key(tSMP_CB *p_cb)
UINT8 *p_na;
UINT8 *p_nb;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (p_cb->role == HCI_ROLE_MASTER)
{
@ -1523,11 +1523,11 @@ BOOLEAN smp_calculate_f5_mackey_and_long_term_key(tSMP_CB *p_cb)
if(!smp_calculate_f5(p_cb->dhkey, p_na, p_nb, a, b, p_cb->mac_key, p_cb->ltk))
{
SMP_TRACE_ERROR("%s failed", __func__);
SMP_TRACE_ERROR("%s failed\n", __func__);
return FALSE;
}
SMP_TRACE_EVENT ("%s is completed", __func__);
SMP_TRACE_EVENT ("%s is completed\n", __func__);
return TRUE;
}
@ -1545,7 +1545,7 @@ BOOLEAN smp_request_oob_data(tSMP_CB *p_cb)
{
tSMP_OOB_DATA_TYPE req_oob_type = SMP_OOB_INVALID_TYPE;
SMP_TRACE_DEBUG("%s", __func__);
SMP_TRACE_DEBUG("%s\n", __func__);
if (p_cb->peer_oob_flag == SMP_OOB_PRESENT && p_cb->loc_oob_flag == SMP_OOB_PRESENT)
{
@ -1562,7 +1562,7 @@ BOOLEAN smp_request_oob_data(tSMP_CB *p_cb)
req_oob_type = SMP_OOB_PEER;
}
SMP_TRACE_DEBUG("req_oob_type = %d", req_oob_type);
SMP_TRACE_DEBUG("req_oob_type = %d\n", req_oob_type);
if (req_oob_type == SMP_OOB_INVALID_TYPE)
return FALSE;