Lines Matching refs:p_rec
879 tBTM_SEC_DEV_REC *p_rec;
891 if ((p_rec = btm_find_dev (bd_addr)) != NULL && p_keys)
896 memcpy(p_rec->ble.keys.ltk, p_keys->penc_key.ltk, BT_OCTET16_LEN);
897 memcpy(p_rec->ble.keys.rand, p_keys->penc_key.rand, BT_OCTET8_LEN);
898 p_rec->ble.keys.sec_level = p_keys->penc_key.sec_level;
899 p_rec->ble.keys.ediv = p_keys->penc_key.ediv;
900 p_rec->ble.keys.key_size = p_keys->penc_key.key_size;
901 p_rec->ble.key_type |= BTM_LE_KEY_PENC;
902 p_rec->sec_flags |= BTM_SEC_LE_LINK_KEY_KNOWN;
904 p_rec->sec_flags |= BTM_SEC_LE_LINK_KEY_AUTHED;
906 p_rec->sec_flags &= ~BTM_SEC_LE_LINK_KEY_AUTHED;
908 p_rec->ble.key_type,
909 p_rec->sec_flags,
910 p_rec->ble.keys.sec_level);
916 p_rec
919 //memcpy( p_rec->ble.keys.irk, p_keys->pid_key, BT_OCTET16_LEN); todo will crash the system
920 memcpy(p_rec->ble.static_addr, p_keys->pid_key.static_addr, BD_ADDR_LEN);
921 p_rec->ble.static_addr_type = p_keys->pid_key.addr_type;
922 p_rec->ble.key_type |= BTM_LE_KEY_PID;
923 BTM_TRACE_DEBUG("BTM_LE_KEY_PID key_type=0x%x save peer IRK", p_rec->ble.key_type);
927 memcpy(p_rec->ble.keys.csrk, p_keys->pcsrk_key.csrk, BT_OCTET16_LEN);
928 p_rec->ble.keys.srk_sec_level = p_keys->pcsrk_key.sec_level;
929 p_rec->ble.keys.counter = p_keys->pcsrk_key.counter;
930 p_rec->ble.key_type |= BTM_LE_KEY_PCSRK;
931 p_rec->sec_flags |= BTM_SEC_LE_LINK_KEY_KNOWN;
933 p_rec->sec_flags |= BTM_SEC_LE_LINK_KEY_AUTHED;
935 p_rec->sec_flags &= ~BTM_SEC_LE_LINK_KEY_AUTHED;
938 p_rec->ble.key_type,
939 p_rec->sec_flags,
940 p_rec->ble.keys.srk_sec_level,
941 p_rec->ble.keys.counter );
945 p_rec->ble.keys.div = p_keys->lenc_key.div; /* update DIV */
946 p_rec->ble.keys.sec_level = p_keys->lenc_key.sec_level;
947 p_rec->ble.keys.key_size = p_keys->lenc_key.key_size;
948 p_rec->ble.key_type |= BTM_LE_KEY_LENC;
951 p_rec->ble.key_type,
952 p_rec->ble.keys.div,
953 p_rec->ble.keys.key_size,
954 p_rec->ble.keys.sec_level );
958 p_rec->ble.keys.div = p_keys->lcsrk_key.div; /* update DIV */
959 p_rec->ble.keys.local_csrk_sec_level = p_keys->lcsrk_key.sec_level;
960 p_rec->ble.keys.local_counter = p_keys->lcsrk_key.counter;
961 p_rec->ble.key_type |= BTM_LE_KEY_LCSRK;
963 p_rec->ble.key_type,
964 p_rec->ble.keys.div,
965 p_rec->ble.keys.local_csrk_sec_level,
966 p_rec->ble.keys.local_counter );
993 if (p_rec)
995 BTM_TRACE_DEBUG ("sec_flags=0x%x", p_rec->sec_flags);
1010 tBTM_SEC_DEV_REC *p_rec;
1014 if ((p_rec = btm_find_dev (bd_addr)) != NULL )
1016 p_rec->enc_key_size = enc_key_size;
1031 tBTM_SEC_DEV_REC *p_rec;
1033 if ((p_rec = btm_find_dev (bd_addr)) != NULL )
1035 return p_rec->enc_key_size;
1144 tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bd_addr);
1146 if (p_rec == NULL)
1152 BTM_TRACE_DEBUG ("btm_ble_set_encryption sec_act=0x%x role_master=%d", sec_act, p_rec->role_master);
1156 p_rec->security_required |= BTM_SEC_IN_MITM;
1164 if(p_rec->sec_state == BTM_SEC_STATE_ENCRYPTING) {
1172 p_rec->sec_state = BTM_SEC_STATE_ENCRYPTING;
1186 p_rec->sec_state = BTM_SEC_STATE_AUTHENTICATING;
1241 tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bda);
1247 if (!p_rec )
1253 if (p_rec->sec_state == BTM_SEC_STATE_ENCRYPTING)
1259 p_cb->enc_handle = p_rec->ble_hci_handle;
1263 if (btsnd_hcic_ble_start_enc(p_rec->ble_hci_handle, dummy_rand, 0, stk))
1266 else if (p_rec->ble.key_type & BTM_LE_KEY_PENC)
1268 if (btsnd_hcic_ble_start_enc(p_rec->ble_hci_handle, p_rec->ble.keys.rand,
1269 p_rec->ble.keys.ediv, p_rec->ble.keys.ltk))
1278 if (p_rec->sec_state == BTM_SEC_STATE_IDLE)
1279 p_rec->sec_state = BTM_SEC_STATE_ENCRYPTING;
1396 tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bda);
1400 if (p_rec == NULL)
1407 p_cb->enc_handle = p_rec->ble_hci_handle;
1408 p_cb->key_size = p_rec->ble.keys.key_size;
1410 BTM_TRACE_ERROR("key size = %d", p_rec->ble.keys.key_size);
1509 static void btm_ble_resolve_random_addr_on_conn_cmpl(void * p_rec, void *p_data)
1512 tBTM_SEC_DEV_REC *match_rec = (tBTM_SEC_DEV_REC *) p_rec;
1849 tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bd_addr);
1861 if (p_rec == NULL)
1886 UINT32_TO_STREAM(pp, p_rec->ble.keys.local_counter);
1889 UINT32_TO_STREAM(pp, p_rec->ble.keys.local_counter);
1918 UINT32_TO_STREAM(p_mac, p_rec->ble.keys.local_counter);
1921 UINT32_TO_STREAM(p_mac, p_rec->ble.keys.local_counter);
1971 tBTM_SEC_DEV_REC *p_rec = btm_find_dev (bd_addr);
1974 if (p_rec == NULL || (p_rec && !(p_rec->ble.key_type & BTM_LE_KEY_PCSRK)))
1978 else if (counter < p_rec->ble.keys.counter)
1988 BTM_TRACE_DEBUG ("BTM_BleVerifySignature rcv_cnt=%d >= expected_cnt=%d", counter, p_rec->ble.keys.counter);
1990 if (AES_CMAC(p_rec->ble.keys.csrk, p_orig, len, BTM_CMAC_TLEN_SIZE, p_mac))