Lines Matching refs:p_cb
46 static void smp_generate_confirm(tSMP_CB *p_cb, tSMP_INT_DATA *p_data);
47 static void smp_generate_ltk_cont(tSMP_CB *p_cb, tSMP_INT_DATA *p_data);
48 static void smp_generate_y(tSMP_CB *p_cb, tSMP_INT_DATA *p);
49 static void smp_generate_rand_vector (tSMP_CB *p_cb, tSMP_INT_DATA *p);
50 static void smp_process_stk(tSMP_CB *p_cb, tSMP_ENC *p);
51 static void smp_calculate_comfirm_cont(tSMP_CB *p_cb, tSMP_ENC *p);
52 static void smp_process_confirm(tSMP_CB *p_cb, tSMP_ENC *p);
53 static void smp_process_compare(tSMP_CB *p_cb, tSMP_ENC *p);
54 static void smp_process_ediv(tSMP_CB *p_cb, tSMP_ENC *p);
55 static BOOLEAN smp_calculate_legacy_short_term_key(tSMP_CB *p_cb, tSMP_ENC *output);
56 static void smp_continue_private_key_creation(tSMP_CB *p_cb, tBTM_RAND_ENC *p);
57 static void smp_process_private_key(tSMP_CB *p_cb);
58 static void smp_finish_nonce_generation(tSMP_CB *p_cb);
59 static void smp_process_new_nonce(tSMP_CB *p_cb);
185 void smp_generate_passkey(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_generate_passkey() argument
190 p_cb->rand_enc_proc_state = SMP_GEN_TK; in smp_generate_passkey()
206 void smp_proc_passkey(tSMP_CB *p_cb , tBTM_RAND_ENC *p) in smp_proc_passkey() argument
208 UINT8 *tt = p_cb->tk; in smp_proc_passkey()
222 memset(p_cb->tk, 0, BT_OCTET16_LEN); in smp_proc_passkey()
226 key.p_data = p_cb->tk; in smp_proc_passkey()
228 if (p_cb->p_callback) in smp_proc_passkey()
230 (*p_cb->p_callback)(SMP_PASSKEY_NOTIF_EVT, p_cb->pairing_bda, (tSMP_EVT_DATA *)&passkey); in smp_proc_passkey()
233 if (p_cb->selected_association_model == SMP_MODEL_SEC_CONN_PASSKEY_DISP) in smp_proc_passkey()
239 smp_sm_event(p_cb, SMP_KEY_READY_EVT, (tSMP_INT_DATA *)&key); in smp_proc_passkey()
254 void smp_generate_stk(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_generate_stk() argument
263 if (p_cb->le_secure_connections_mode_is_used) in smp_generate_stk()
269 memcpy(output.param_buf, p_cb->ltk, SMP_ENCRYT_DATA_SIZE); in smp_generate_stk()
271 else if (!smp_calculate_legacy_short_term_key(p_cb, &output)) in smp_generate_stk()
274 smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status); in smp_generate_stk()
278 smp_process_stk(p_cb, &output); in smp_generate_stk()
292 void smp_generate_srand_mrand_confirm(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_generate_srand_mrand_confirm() argument
297 p_cb->rand_enc_proc_state = SMP_GEN_SRAND_MRAND; in smp_generate_srand_mrand_confirm()
313 void smp_generate_rand_cont(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_generate_rand_cont() argument
318 p_cb->rand_enc_proc_state = SMP_GEN_SRAND_MRAND_CONT; in smp_generate_rand_cont()
339 void smp_generate_ltk(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_generate_ltk() argument
347 smp_br_process_link_key(p_cb, NULL); in smp_generate_ltk()
350 else if (p_cb->le_secure_connections_mode_is_used) in smp_generate_ltk()
356 div_status = btm_get_local_div(p_cb->pairing_bda, &p_cb->div); in smp_generate_ltk()
360 smp_generate_ltk_cont(p_cb, NULL); in smp_generate_ltk()
365 p_cb->rand_enc_proc_state = SMP_GEN_DIV_LTK; in smp_generate_ltk()
382 void smp_compute_csrk(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_compute_csrk() argument
393 SMP_TRACE_DEBUG ("smp_compute_csrk div=%x", p_cb->div); in smp_compute_csrk()
396 UINT16_TO_STREAM(p, p_cb->div); in smp_compute_csrk()
402 if (p_cb->smp_over_br) in smp_compute_csrk()
404 smp_br_state_machine_event(p_cb, SMP_BR_AUTH_CMPL_EVT, &status); in smp_compute_csrk()
408 smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status); in smp_compute_csrk()
413 memcpy((void *)p_cb->csrk, output.param_buf, BT_OCTET16_LEN); in smp_compute_csrk()
414 smp_send_csrk_info(p_cb, NULL); in smp_compute_csrk()
429 void smp_generate_csrk(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_generate_csrk() argument
437 div_status = btm_get_local_div(p_cb->pairing_bda, &p_cb->div); in smp_generate_csrk()
440 smp_compute_csrk(p_cb, NULL); in smp_generate_csrk()
445 p_cb->rand_enc_proc_state = SMP_GEN_DIV_CSRK; in smp_generate_csrk()
455 void smp_concatenate_local( tSMP_CB *p_cb, UINT8 **p_data, UINT8 op_code) in smp_concatenate_local() argument
461 UINT8_TO_STREAM(p, p_cb->local_io_capability); in smp_concatenate_local()
462 UINT8_TO_STREAM(p, p_cb->loc_oob_flag); in smp_concatenate_local()
463 UINT8_TO_STREAM(p, p_cb->loc_auth_req); in smp_concatenate_local()
464 UINT8_TO_STREAM(p, p_cb->loc_enc_size); in smp_concatenate_local()
465 UINT8_TO_STREAM(p, p_cb->local_i_key); in smp_concatenate_local()
466 UINT8_TO_STREAM(p, p_cb->local_r_key); in smp_concatenate_local()
475 void smp_concatenate_peer( tSMP_CB *p_cb, UINT8 **p_data, UINT8 op_code) in smp_concatenate_peer() argument
481 UINT8_TO_STREAM(p, p_cb->peer_io_caps); in smp_concatenate_peer()
482 UINT8_TO_STREAM(p, p_cb->peer_oob_flag); in smp_concatenate_peer()
483 UINT8_TO_STREAM(p, p_cb->peer_auth_req); in smp_concatenate_peer()
484 UINT8_TO_STREAM(p, p_cb->peer_enc_size); in smp_concatenate_peer()
485 UINT8_TO_STREAM(p, p_cb->peer_i_key); in smp_concatenate_peer()
486 UINT8_TO_STREAM(p, p_cb->peer_r_key); in smp_concatenate_peer()
501 void smp_gen_p1_4_confirm( tSMP_CB *p_cb, BT_OCTET16 p1) in smp_gen_p1_4_confirm() argument
509 if (!BTM_ReadRemoteConnectionAddr(p_cb->pairing_bda, remote_bda, &addr_type)) in smp_gen_p1_4_confirm()
515 BTM_ReadConnectionAddr( p_cb->pairing_bda, p_cb->local_bda, &p_cb->addr_type); in smp_gen_p1_4_confirm()
517 if (p_cb->role == HCI_ROLE_MASTER) in smp_gen_p1_4_confirm()
520 UINT8_TO_STREAM(p, p_cb->addr_type); in smp_gen_p1_4_confirm()
524 smp_concatenate_local(p_cb, &p, SMP_OPCODE_PAIRING_REQ); in smp_gen_p1_4_confirm()
526 smp_concatenate_peer(p_cb, &p, SMP_OPCODE_PAIRING_RSP); in smp_gen_p1_4_confirm()
533 UINT8_TO_STREAM(p, p_cb->addr_type); in smp_gen_p1_4_confirm()
535 smp_concatenate_peer(p_cb, &p, SMP_OPCODE_PAIRING_REQ); in smp_gen_p1_4_confirm()
537 smp_concatenate_local(p_cb, &p, SMP_OPCODE_PAIRING_RSP); in smp_gen_p1_4_confirm()
555 void smp_gen_p2_4_confirm( tSMP_CB *p_cb, BT_OCTET16 p2) in smp_gen_p2_4_confirm() argument
561 if (!BTM_ReadRemoteConnectionAddr(p_cb->pairing_bda, remote_bda, &addr_type)) in smp_gen_p2_4_confirm()
571 if (p_cb->role == HCI_ROLE_MASTER) in smp_gen_p2_4_confirm()
576 BDADDR_TO_STREAM(p, p_cb->local_bda); in smp_gen_p2_4_confirm()
581 BDADDR_TO_STREAM(p, p_cb->local_bda); in smp_gen_p2_4_confirm()
600 void smp_calculate_comfirm (tSMP_CB *p_cb, BT_OCTET16 rand, BD_ADDR bda) in smp_calculate_comfirm() argument
610 smp_gen_p1_4_confirm(p_cb, p1); in smp_calculate_comfirm()
618 if (!SMP_Encrypt(p_cb->tk, BT_OCTET16_LEN, p1, BT_OCTET16_LEN, &output)) in smp_calculate_comfirm()
621 smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status); in smp_calculate_comfirm()
625 smp_calculate_comfirm_cont(p_cb, &output); in smp_calculate_comfirm()
639 static void smp_calculate_comfirm_cont(tSMP_CB *p_cb, tSMP_ENC *p) in smp_calculate_comfirm_cont() argument
651 smp_gen_p2_4_confirm(p_cb, p2); in smp_calculate_comfirm_cont()
658 if (!SMP_Encrypt(p_cb->tk, BT_OCTET16_LEN, p2, BT_OCTET16_LEN, &output)) in smp_calculate_comfirm_cont()
661 smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status); in smp_calculate_comfirm_cont()
665 switch (p_cb->rand_enc_proc_state) in smp_calculate_comfirm_cont()
668 smp_process_confirm(p_cb, &output); in smp_calculate_comfirm_cont()
672 smp_process_compare(p_cb, &output); in smp_calculate_comfirm_cont()
688 static void smp_generate_confirm(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_generate_confirm() argument
693 p_cb->rand_enc_proc_state = SMP_GEN_CONFIRM; in smp_generate_confirm()
694 smp_debug_print_nbyte_little_endian ((UINT8 *)p_cb->rand, (const UINT8 *)"local rand", 16); in smp_generate_confirm()
695 smp_calculate_comfirm(p_cb, p_cb->rand, p_cb->pairing_bda); in smp_generate_confirm()
709 void smp_generate_compare (tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_generate_compare() argument
714 p_cb->rand_enc_proc_state = SMP_GEN_COMPARE; in smp_generate_compare()
715 smp_debug_print_nbyte_little_endian ((UINT8 *)p_cb->rrand, (const UINT8 *)"peer rand", 16); in smp_generate_compare()
716 smp_calculate_comfirm(p_cb, p_cb->rrand, p_cb->local_bda); in smp_generate_compare()
729 static void smp_process_confirm(tSMP_CB *p_cb, tSMP_ENC *p) in smp_process_confirm() argument
734 memcpy(p_cb->confirm, p->param_buf, BT_OCTET16_LEN); in smp_process_confirm()
738 smp_debug_print_nbyte_little_endian ((UINT8 *)p_cb->confirm, (const UINT8 *)"Confirm", 16); in smp_process_confirm()
743 smp_sm_event(p_cb, SMP_KEY_READY_EVT, &key); in smp_process_confirm()
756 static void smp_process_compare(tSMP_CB *p_cb, tSMP_ENC *p) in smp_process_compare() argument
768 smp_sm_event(p_cb, SMP_KEY_READY_EVT, &key); in smp_process_compare()
781 static void smp_process_stk(tSMP_CB *p_cb, tSMP_ENC *p) in smp_process_stk() argument
789 smp_mask_enc_key(p_cb->loc_enc_size, p->param_buf); in smp_process_stk()
794 smp_sm_event(p_cb, SMP_KEY_READY_EVT, &key); in smp_process_stk()
806 static void smp_generate_ltk_cont(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_generate_ltk_cont() argument
818 if (!SMP_Encrypt(er, BT_OCTET16_LEN, (UINT8 *)&p_cb->div, in smp_generate_ltk_cont()
822 smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status); in smp_generate_ltk_cont()
827 smp_mask_enc_key(p_cb->loc_enc_size, output.param_buf); in smp_generate_ltk_cont()
828 memcpy((void *)p_cb->ltk, output.param_buf, BT_OCTET16_LEN); in smp_generate_ltk_cont()
829 smp_generate_rand_vector(p_cb, NULL); in smp_generate_ltk_cont()
842 static void smp_generate_y(tSMP_CB *p_cb, tSMP_INT_DATA *p) in smp_generate_y() argument
854 if (!SMP_Encrypt(dhk, BT_OCTET16_LEN, p_cb->enc_rand, in smp_generate_y()
858 smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status); in smp_generate_y()
862 smp_process_ediv(p_cb, &output); in smp_generate_y()
876 static void smp_generate_rand_vector (tSMP_CB *p_cb, tSMP_INT_DATA *p) in smp_generate_rand_vector() argument
883 p_cb->rand_enc_proc_state = SMP_GEN_RAND_V; in smp_generate_rand_vector()
897 static void smp_process_ediv(tSMP_CB *p_cb, tSMP_ENC *p) in smp_process_ediv() argument
907 p_cb->ediv = p_cb->div ^ y; in smp_process_ediv()
913 smp_sm_event(p_cb, SMP_KEY_READY_EVT, &key); in smp_process_ediv()
925 BOOLEAN smp_calculate_legacy_short_term_key(tSMP_CB *p_cb, tSMP_ENC *output) in smp_calculate_legacy_short_term_key() argument
932 if (p_cb->role == HCI_ROLE_MASTER) in smp_calculate_legacy_short_term_key()
934 memcpy(p, p_cb->rand, BT_OCTET8_LEN); in smp_calculate_legacy_short_term_key()
935 memcpy(&p[BT_OCTET8_LEN], p_cb->rrand, BT_OCTET8_LEN); in smp_calculate_legacy_short_term_key()
939 memcpy(p, p_cb->rrand, BT_OCTET8_LEN); in smp_calculate_legacy_short_term_key()
940 memcpy(&p[BT_OCTET8_LEN], p_cb->rand, BT_OCTET8_LEN); in smp_calculate_legacy_short_term_key()
945 encrypted = SMP_Encrypt( p_cb->tk, BT_OCTET16_LEN, ptext, BT_OCTET16_LEN, output); in smp_calculate_legacy_short_term_key()
965 void smp_create_private_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_create_private_key() argument
968 p_cb->rand_enc_proc_state = SMP_GENERATE_PRIVATE_KEY_0_7; in smp_create_private_key()
989 void smp_use_oob_private_key(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_use_oob_private_key() argument
992 __func__, p_cb->req_oob_type, p_cb->role); in smp_use_oob_private_key()
994 switch (p_cb->req_oob_type) in smp_use_oob_private_key()
999 … memcpy(p_cb->private_key, p_cb->sc_oob_data.loc_oob_data.private_key_used, BT_OCTET32_LEN); in smp_use_oob_private_key()
1000 smp_process_private_key(p_cb); in smp_use_oob_private_key()
1005 smp_decide_association_model(p_cb, NULL); in smp_use_oob_private_key()
1019 void smp_continue_private_key_creation (tSMP_CB *p_cb, tBTM_RAND_ENC *p) in smp_continue_private_key_creation() argument
1021 UINT8 state = p_cb->rand_enc_proc_state & ~0x80; in smp_continue_private_key_creation()
1027 memcpy((void *)p_cb->private_key, p->param_buf, p->param_len); in smp_continue_private_key_creation()
1028 p_cb->rand_enc_proc_state = SMP_GENERATE_PRIVATE_KEY_8_15; in smp_continue_private_key_creation()
1034 memcpy((void *)&p_cb->private_key[8], p->param_buf, p->param_len); in smp_continue_private_key_creation()
1035 p_cb->rand_enc_proc_state = SMP_GENERATE_PRIVATE_KEY_16_23; in smp_continue_private_key_creation()
1041 memcpy((void *)&p_cb->private_key[16], p->param_buf, p->param_len); in smp_continue_private_key_creation()
1042 p_cb->rand_enc_proc_state = SMP_GENERATE_PRIVATE_KEY_24_31; in smp_continue_private_key_creation()
1048 memcpy((void *)&p_cb->private_key[24], p->param_buf, p->param_len); in smp_continue_private_key_creation()
1049 smp_process_private_key (p_cb); in smp_continue_private_key_creation()
1070 void smp_process_private_key(tSMP_CB *p_cb) in smp_process_private_key() argument
1077 memcpy(private_key, p_cb->private_key, BT_OCTET32_LEN); in smp_process_private_key()
1079 memcpy(p_cb->loc_publ_key.x, public_key.x, BT_OCTET32_LEN); in smp_process_private_key()
1080 memcpy(p_cb->loc_publ_key.y, public_key.y, BT_OCTET32_LEN); in smp_process_private_key()
1082 smp_debug_print_nbyte_little_endian (p_cb->private_key, (const UINT8 *)"private", in smp_process_private_key()
1084 smp_debug_print_nbyte_little_endian (p_cb->loc_publ_key.x, (const UINT8 *)"local public(x)", in smp_process_private_key()
1086 smp_debug_print_nbyte_little_endian (p_cb->loc_publ_key.y, (const UINT8 *)"local public(y)", in smp_process_private_key()
1088 p_cb->flags |= SMP_PAIR_FLAG_HAVE_LOCAL_PUBL_KEY; in smp_process_private_key()
1089 smp_sm_event(p_cb, SMP_LOC_PUBL_KEY_CRTD_EVT, NULL); in smp_process_private_key()
1104 void smp_compute_dhkey (tSMP_CB *p_cb) in smp_compute_dhkey() argument
1111 memcpy(private_key, p_cb->private_key, BT_OCTET32_LEN); in smp_compute_dhkey()
1112 memcpy(peer_publ_key.x, p_cb->peer_publ_key.x, BT_OCTET32_LEN); in smp_compute_dhkey()
1113 memcpy(peer_publ_key.y, p_cb->peer_publ_key.y, BT_OCTET32_LEN); in smp_compute_dhkey()
1117 memcpy(p_cb->dhkey, new_publ_key.x, BT_OCTET32_LEN); in smp_compute_dhkey()
1119 smp_debug_print_nbyte_little_endian (p_cb->dhkey, (const UINT8 *)"Old DHKey", in smp_compute_dhkey()
1122 smp_debug_print_nbyte_little_endian (p_cb->private_key, (const UINT8 *)"private", in smp_compute_dhkey()
1124 smp_debug_print_nbyte_little_endian (p_cb->peer_publ_key.x, (const UINT8 *)"rem public(x)", in smp_compute_dhkey()
1126 smp_debug_print_nbyte_little_endian (p_cb->peer_publ_key.y, (const UINT8 *)"rem public(y)", in smp_compute_dhkey()
1128 smp_debug_print_nbyte_little_endian (p_cb->dhkey, (const UINT8 *)"Reverted DHKey", in smp_compute_dhkey()
1141 void smp_calculate_local_commitment(tSMP_CB *p_cb) in smp_calculate_local_commitment() argument
1147 switch (p_cb->selected_association_model) in smp_calculate_local_commitment()
1151 if (p_cb->role == HCI_ROLE_MASTER) in smp_calculate_local_commitment()
1154 smp_calculate_f4(p_cb->loc_publ_key.x, p_cb->peer_publ_key.x, p_cb->rand, 0, in smp_calculate_local_commitment()
1155 p_cb->commitment); in smp_calculate_local_commitment()
1159 random_input = smp_calculate_random_input(p_cb->local_random, p_cb->round); in smp_calculate_local_commitment()
1160 smp_calculate_f4(p_cb->loc_publ_key.x, p_cb->peer_publ_key.x, p_cb->rand, in smp_calculate_local_commitment()
1161 random_input, p_cb->commitment); in smp_calculate_local_commitment()
1165 smp_calculate_f4(p_cb->loc_publ_key.x, p_cb->loc_publ_key.x, p_cb->local_random, 0, in smp_calculate_local_commitment()
1166 p_cb->commitment); in smp_calculate_local_commitment()
1170 p_cb->selected_association_model); in smp_calculate_local_commitment()
1187 void smp_calculate_peer_commitment(tSMP_CB *p_cb, BT_OCTET16 output_buf) in smp_calculate_peer_commitment() argument
1193 switch (p_cb->selected_association_model) in smp_calculate_peer_commitment()
1197 if (p_cb->role == HCI_ROLE_SLAVE) in smp_calculate_peer_commitment()
1200 smp_calculate_f4(p_cb->peer_publ_key.x, p_cb->loc_publ_key.x, p_cb->rrand, 0, in smp_calculate_peer_commitment()
1205 ri = smp_calculate_random_input(p_cb->peer_random, p_cb->round); in smp_calculate_peer_commitment()
1206 smp_calculate_f4(p_cb->peer_publ_key.x, p_cb->loc_publ_key.x, p_cb->rrand, ri, in smp_calculate_peer_commitment()
1210 smp_calculate_f4(p_cb->peer_publ_key.x, p_cb->peer_publ_key.x, p_cb->peer_random, 0, in smp_calculate_peer_commitment()
1215 p_cb->selected_association_model); in smp_calculate_peer_commitment()
1302 void smp_calculate_numeric_comparison_display_number(tSMP_CB *p_cb, in smp_calculate_numeric_comparison_display_number() argument
1307 if (p_cb->role == HCI_ROLE_MASTER) in smp_calculate_numeric_comparison_display_number()
1309 p_cb->number_to_display = in smp_calculate_numeric_comparison_display_number()
1310 smp_calculate_g2(p_cb->loc_publ_key.x, p_cb->peer_publ_key.x, p_cb->rand, in smp_calculate_numeric_comparison_display_number()
1311 p_cb->rrand); in smp_calculate_numeric_comparison_display_number()
1315 p_cb->number_to_display = in smp_calculate_numeric_comparison_display_number()
1316 smp_calculate_g2(p_cb->peer_publ_key.x, p_cb->loc_publ_key.x, p_cb->rrand, in smp_calculate_numeric_comparison_display_number()
1317 p_cb->rand); in smp_calculate_numeric_comparison_display_number()
1320 if (p_cb->number_to_display >= (BTM_MAX_PASSKEY_VAL + 1)) in smp_calculate_numeric_comparison_display_number()
1323 reason = p_cb->failure = SMP_PAIR_FAIL_UNKNOWN; in smp_calculate_numeric_comparison_display_number()
1324 smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason); in smp_calculate_numeric_comparison_display_number()
1328 SMP_TRACE_EVENT("Number to display in numeric comparison = %d", p_cb->number_to_display); in smp_calculate_numeric_comparison_display_number()
1329 p_cb->cb_evt = SMP_NC_REQ_EVT; in smp_calculate_numeric_comparison_display_number()
1330 smp_sm_event(p_cb, SMP_SC_DSPL_NC_EVT, &p_cb->number_to_display); in smp_calculate_numeric_comparison_display_number()
1743 void smp_calculate_local_dhkey_check(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_calculate_local_dhkey_check() argument
1749 smp_calculate_f5_mackey_and_long_term_key(p_cb); in smp_calculate_local_dhkey_check()
1751 smp_collect_local_io_capabilities(iocap, p_cb); in smp_calculate_local_dhkey_check()
1753 smp_collect_local_ble_address(a, p_cb); in smp_calculate_local_dhkey_check()
1754 smp_collect_peer_ble_address(b, p_cb); in smp_calculate_local_dhkey_check()
1755 smp_calculate_f6(p_cb->mac_key, p_cb->rand, p_cb->rrand, p_cb->peer_random, iocap, a, b, in smp_calculate_local_dhkey_check()
1756 p_cb->dhkey_check); in smp_calculate_local_dhkey_check()
1770 void smp_calculate_peer_dhkey_check(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) in smp_calculate_peer_dhkey_check() argument
1780 smp_collect_peer_io_capabilities(iocap, p_cb); in smp_calculate_peer_dhkey_check()
1782 smp_collect_local_ble_address(a, p_cb); in smp_calculate_peer_dhkey_check()
1783 smp_collect_peer_ble_address(b, p_cb); in smp_calculate_peer_dhkey_check()
1784 ret = smp_calculate_f6(p_cb->mac_key, p_cb->rrand, p_cb->rand, p_cb->local_random, iocap, in smp_calculate_peer_dhkey_check()
1796 smp_sm_event(p_cb, SMP_SC_KEY_READY_EVT, &key); in smp_calculate_peer_dhkey_check()
1801 smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &status); in smp_calculate_peer_dhkey_check()
1907 BOOLEAN smp_calculate_link_key_from_long_term_key(tSMP_CB *p_cb) in smp_calculate_link_key_from_long_term_key() argument
1915 if (p_cb->id_addr_rcvd && p_cb->id_addr_type == BLE_ADDR_PUBLIC) in smp_calculate_link_key_from_long_term_key()
1918 memcpy(bda_for_lk, p_cb->id_addr, BD_ADDR_LEN); in smp_calculate_link_key_from_long_term_key()
1920 else if ((BTM_ReadRemoteConnectionAddr(p_cb->pairing_bda, bda_for_lk, &conn_addr_type)) && in smp_calculate_link_key_from_long_term_key()
1931 if ((p_dev_rec = btm_find_dev (p_cb->pairing_bda)) == NULL) in smp_calculate_link_key_from_long_term_key()
1940 ret = smp_calculate_h6(p_cb->ltk, (UINT8 *)"1pmt" /* reversed "tmp1" */,intermediate_link_key); in smp_calculate_link_key_from_long_term_key()
1964 if (p_cb->sec_level == SMP_SEC_AUTHENTICATED) in smp_calculate_link_key_from_long_term_key()
1972 if (p_cb->sec_level == SMP_SEC_AUTHENTICATED) in smp_calculate_link_key_from_long_term_key()
2009 BOOLEAN smp_calculate_long_term_key_from_link_key(tSMP_CB *p_cb) in smp_calculate_long_term_key_from_link_key() argument
2017 if ((p_dev_rec = btm_find_dev (p_cb->pairing_bda)) == NULL) in smp_calculate_long_term_key_from_link_key()
2024 if ((br_link_key_type = BTM_SecGetDeviceLinkKeyType (p_cb->pairing_bda)) in smp_calculate_long_term_key_from_link_key()
2058 p_cb->ltk); in smp_calculate_long_term_key_from_link_key()
2066 p_cb->sec_level = (br_link_key_type == BTM_LKEY_TYPE_AUTH_COMB_P_256) in smp_calculate_long_term_key_from_link_key()
2155 void smp_start_nonce_generation(tSMP_CB *p_cb) in smp_start_nonce_generation() argument
2158 p_cb->rand_enc_proc_state = SMP_GEN_NONCE_0_7; in smp_start_nonce_generation()
2172 void smp_finish_nonce_generation(tSMP_CB *p_cb) in smp_finish_nonce_generation() argument
2175 p_cb->rand_enc_proc_state = SMP_GEN_NONCE_8_15; in smp_finish_nonce_generation()
2189 void smp_process_new_nonce(tSMP_CB *p_cb) in smp_process_new_nonce() argument
2191 SMP_TRACE_DEBUG ("%s round %d", __FUNCTION__, p_cb->round); in smp_process_new_nonce()
2192 smp_sm_event(p_cb, SMP_HAVE_LOC_NONCE_EVT, NULL); in smp_process_new_nonce()
2207 tSMP_CB *p_cb = &smp_cb; in smp_rand_back() local
2210 UINT8 state = p_cb->rand_enc_proc_state & ~0x80; in smp_rand_back()
2218 memcpy((void *)p_cb->rand, p->param_buf, p->param_len); in smp_rand_back()
2219 smp_generate_rand_cont(p_cb, NULL); in smp_rand_back()
2223 memcpy((void *)&p_cb->rand[8], p->param_buf, p->param_len); in smp_rand_back()
2224 smp_generate_confirm(p_cb, NULL); in smp_rand_back()
2228 STREAM_TO_UINT16(p_cb->div, pp); in smp_rand_back()
2229 smp_generate_ltk_cont(p_cb, NULL); in smp_rand_back()
2233 STREAM_TO_UINT16(p_cb->div, pp); in smp_rand_back()
2234 smp_compute_csrk(p_cb, NULL); in smp_rand_back()
2238 smp_proc_passkey(p_cb, p); in smp_rand_back()
2242 memcpy(p_cb->enc_rand, p->param_buf, BT_OCTET8_LEN); in smp_rand_back()
2243 smp_generate_y(p_cb, NULL); in smp_rand_back()
2250 smp_continue_private_key_creation(p_cb, p); in smp_rand_back()
2254 memcpy((void *)p_cb->rand, p->param_buf, p->param_len); in smp_rand_back()
2255 smp_finish_nonce_generation(p_cb); in smp_rand_back()
2259 memcpy((void *)&p_cb->rand[8], p->param_buf, p->param_len); in smp_rand_back()
2260 smp_process_new_nonce(p_cb); in smp_rand_back()
2267 SMP_TRACE_ERROR("%s key generation failed: (%d)", __FUNCTION__, p_cb->rand_enc_proc_state); in smp_rand_back()
2268 smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &failure); in smp_rand_back()