eSE restricted mode check failure storage bin file dependancy is removed
diff --git a/halimpl/pn54x/hal/phNxpNciHal.c b/halimpl/pn54x/hal/phNxpNciHal.c
index 01445b4..81ee5cf 100644
--- a/halimpl/pn54x/hal/phNxpNciHal.c
+++ b/halimpl/pn54x/hal/phNxpNciHal.c
@@ -3659,17 +3659,40 @@
int ret = 0;
NFCSTATUS status = NFCSTATUS_FAILED;
const char config_eseinfo_path[] = "/data/vendor/nfc/nfaStorage.bin1";
+ uint8_t *reset_ese_session_identity_set;
+ uint8_t ese_session_dyn_uicc_nv[] = {
+ 0x20, 0x02, 0x17, 0x02,0xA0, 0xEA, 0x08, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,0xA0, 0x1E, 0x08, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+ uint8_t ese_session_dyn_uicc[] = {
+ 0x20, 0x02, 0x22, 0x03, 0xA0, 0xEA, 0x08, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0, 0x1E, 0x08, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0, 0xEB, 0x08, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+ uint8_t ese_session_nv[] = {
+ 0x20, 0x02, 0x0C, 0x01, 0xA0, 0xEA, 0x08, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+ uint8_t ese_session[] = {
+ 0x20, 0x02, 0x17, 0x02, 0xA0, 0xEA, 0x08, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0, 0xEB, 0x08,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+ if(nfcFL.nfccFL._NFC_NXP_STAT_DUAL_UICC_WO_EXT_SWITCH || nfcFL.nfccFL._NFCC_DYNAMIC_DUAL_UICC) {
+ if(nfcFL.eseFL._EXCLUDE_NV_MEM_DEPENDENCY) {
+ reset_ese_session_identity_set = ese_session_dyn_uicc_nv;
+ }
+ else {
+ reset_ese_session_identity_set = ese_session_dyn_uicc;
+ }
+ }
+ else {
+ if(nfcFL.eseFL._EXCLUDE_NV_MEM_DEPENDENCY) {
+ reset_ese_session_identity_set = ese_session_nv;
+ }
+ else {
+ reset_ese_session_identity_set = ese_session;
+ }
+ }
- static uint8_t reset_session_identity_set[] = {
- 0x20, 0x02, 0x22, 0x03, 0xA0, 0xEA, 0x08, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0, 0x1E, 0x08, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0, 0xEB, 0x08, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
-
- static uint8_t reset_session_identity_set_stat[] = {
- 0x20, 0x02, 0x17, 0x02, 0xA0, 0xEA, 0x08, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xA0, 0xEB, 0x08,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
#ifdef PN547C2_FACTORY_RESET_DEBUG
static uint8_t reset_session_identity[] = {0x20, 0x03, 0x05, 0x02,
@@ -3693,15 +3716,11 @@
#endif
if((nfcFL.nfccFL._NFC_NXP_STAT_DUAL_UICC_WO_EXT_SWITCH) &&
(nfcFL.nfccFL._NFCC_DYNAMIC_DUAL_UICC)) {
- status = phNxpNciHal_send_ext_cmd(sizeof(reset_session_identity_set),
- reset_session_identity_set);
- }
- else {
- status = phNxpNciHal_send_ext_cmd(sizeof(reset_session_identity_set_stat),
- reset_session_identity_set_stat);
+ status = phNxpNciHal_send_ext_cmd(sizeof(reset_ese_session_identity_set),
+ reset_ese_session_identity_set);
}
if (status != NFCSTATUS_SUCCESS) {
- NXPLOG_NCIHAL_E("NXP reset_session_identity_set command failed");
+ NXPLOG_NCIHAL_E("NXP reset_ese_session_identity_set command failed");
}
#ifdef PN547C2_FACTORY_RESET_DEBUG
/* NXP ACT Proprietary Ext */
diff --git a/src/nfa/hci/nfa_hci_act.c b/src/nfa/hci/nfa_hci_act.c
old mode 100644
new mode 100755
index 39d5562..9026b4a
--- a/src/nfa/hci/nfa_hci_act.c
+++ b/src/nfa/hci/nfa_hci_act.c
@@ -104,6 +104,8 @@
static void nfa_hci_read_num_nfcee_config_cb(uint8_t event, uint16_t param_len,
uint8_t* p_param);
static tNFA_STATUS nfa_hci_poll_session_id(uint8_t host_type);
+static void nfa_hci_get_pipe_state_cb(uint8_t event, uint16_t param_len, uint8_t* p_param);
+static void nfa_hci_update_pipe_status(uint8_t gateId, uint8_t pipeId);
#endif
/*******************************************************************************
@@ -3185,6 +3187,8 @@
// display atr and read first parameter on APDU Gate
NFA_TRACE_DEBUG0(
"nfa_hci_handle_Nfcee_dynpipe_rsp - ATR received read APDU Size!!!");
+ NFA_TRACE_DEBUG0 (
+ "nfa_hci_handle_Nfcee_dynpipe_rsp - ETSI12 init complete");
evt_data.admin_rsp_rcvd.status = NFA_STATUS_OK;
nfa_hci_cb.hci_state = NFA_HCI_STATE_IDLE;
nfa_hciu_send_to_all_apps(NFA_HCI_CONFIG_DONE_EVT, &evt_data);
@@ -3243,4 +3247,152 @@
}
return status;
}
+
+/*******************************************************************************
+**
+** Function nfa_hci_getApduAndConnectivity_PipeStatus
+**
+** Description API to retrieve APDU & Connectivity pipe created status from
+** FirmWare
+**
+** Returns If NCI command is SUCCESS/FAILED
+**
+*******************************************************************************/
+tNFA_STATUS nfa_hci_getApduAndConnectivity_PipeStatus()
+{
+ tNFA_STATUS status = NFA_STATUS_OK;
+ uint8_t p_data[NFA_MAX_HCI_CMD_LEN];
+ uint8_t *p = p_data, *parm_len , *num_param;
+ memset(p_data, 0, sizeof(p_data));
+ NCI_MSG_BLD_HDR0 (p, NCI_MT_CMD, NCI_GID_CORE);
+ NCI_MSG_BLD_HDR1 (p, NCI_MSG_CORE_GET_CONFIG);
+ parm_len = p++;
+ num_param = p++;
+ UINT8_TO_STREAM (p, NXP_NFC_SET_CONFIG_PARAM_EXT);
+ UINT8_TO_STREAM (p, NXP_NFC_ESE_APDU_PIPE_STATUS);
+ (*num_param)++;
+ UINT8_TO_STREAM (p, NXP_NFC_SET_CONFIG_PARAM_EXT);
+ UINT8_TO_STREAM (p, NXP_NFC_ESE_CONN_PIPE_STATUS);
+ (*num_param)++;
+
+ *parm_len = (p - num_param);
+ if(*num_param != 0x00)
+ {
+ status = nfa_hciu_send_raw_cmd(p-p_data, p_data, nfa_hci_get_pipe_state_cb);
+ }
+ NFA_TRACE_DEBUG1 ("nfa_hci_getApduConnectivity_PipeStatus %x",*num_param);
+
+ return status;
+}
+
+/*******************************************************************************
+**
+** Function nfa_hci_get_pipe_state_cb
+**
+** Description Callback API to retrieve APDU & Connectivity pipe created
+** status from FirmWare
+**
+** Returns None
+**
+*******************************************************************************/
+static void nfa_hci_get_pipe_state_cb(uint8_t event, uint16_t param_len, uint8_t* p_param)
+{
+ uint8_t num_param_id = 0x00, xx;
+ uint8_t NFA_PARAM_ID_INDEX = 0x04;
+ uint8_t param_id1 = 0x00;
+ uint8_t param_id2 = 0x00;
+ uint8_t status = 0x00;
+
+ nfa_sys_stop_timer (&nfa_hci_cb.timer);
+ p_param += NFA_PARAM_ID_INDEX;
+ STREAM_TO_UINT8(num_param_id , p_param);
+ while(num_param_id > 0x00)
+ {
+ STREAM_TO_UINT8(param_id1 , p_param);
+ STREAM_TO_UINT8(param_id2 , p_param);
+ p_param++;
+ STREAM_TO_UINT8(status , p_param);
+ if(param_id1 == NXP_NFC_SET_CONFIG_PARAM_EXT
+ && param_id2 == NXP_NFC_ESE_APDU_PIPE_STATUS)
+ {
+ /*Update eSE APDU pipe status*/
+ if(status == 1)
+ {
+ /*UINT8 local_gate, UINT8 pipe_id, UINT8 dest_host, UINT8 dest_gate*/
+ if(!nfa_hci_api_IspipePresent(NFA_HCI_HOST_ID_ESE, NFA_HCI_ETSI12_APDU_GATE))
+ {
+ nfa_hci_update_pipe_status(NFA_HCI_ETSI12_APDU_GATE, NFA_HCI_APDU_PIPE);
+ if(nfa_hciu_find_gate_by_gid (NFA_HCI_ETSI12_APDU_GATE) == NULL)
+ {
+ tNFA_HCI_DYN_GATE *pg;
+ int xx;
+ for (xx = 0, pg = nfa_hci_cb.cfg.dyn_gates; xx < NFA_HCI_MAX_GATE_CB; xx++, pg++)
+ {
+ if (pg->gate_id == 0)
+ {
+ /* Found a free gate control block */
+ pg->gate_id = NFA_HCI_ETSI12_APDU_GATE;
+ pg->gate_owner = NFA_HANDLE_GROUP_HCI;
+ pg->pipe_inx_mask = 0;
+
+ NFA_TRACE_DEBUG2 ("nfa_hci_alloc_apdu_gate id:%d app_handle: 0x%04x",
+ NFA_HCI_ETSI12_APDU_GATE, NFA_HANDLE_GROUP_HCI);
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ nfa_hciu_release_pipe (NFA_HCI_APDU_PIPE);
+ }
+ }
+ else if(param_id1 == NXP_NFC_SET_CONFIG_PARAM_EXT
+ && param_id2 == NXP_NFC_ESE_CONN_PIPE_STATUS)
+ {
+ /*Update eSE Connectivity pipe status*/
+ if(status == 1)
+ {
+ if(!nfa_hci_api_IspipePresent(NFA_HCI_HOST_ID_ESE, NFA_HCI_CONNECTIVITY_GATE))
+ {
+ nfa_hci_update_pipe_status(NFA_HCI_CONNECTIVITY_GATE, NFA_HCI_CONN_ESE_PIPE);
+ }
+ }
+ else
+ {
+ nfa_hciu_release_pipe (NFA_HCI_CONN_ESE_PIPE);
+ }
+ }
+ num_param_id--;
+ }
+}
+
+/*******************************************************************************
+**
+** Function nfa_hci_update_pipe_status
+**
+** Description API to update APDU & Connectivity pipe hci_cfg status
+**
+** Returns None
+**
+*******************************************************************************/
+static void nfa_hci_update_pipe_status(uint8_t gateId, uint8_t pipeId)
+{
+ uint8_t count = 0;
+ nfa_hciu_add_pipe_to_static_gate(gateId, pipeId, NFA_HCI_HOST_ID_ESE, gateId);
+
+ /*Set the pipe status HCI_OPENED*/
+ for (count = 0;count < NFA_HCI_MAX_PIPE_CB;count++)
+ {
+ if(((nfa_hci_cb.cfg.dyn_pipes[count].dest_host) == NFA_HCI_HOST_ID_ESE) &&
+ ((nfa_hci_cb.cfg.dyn_pipes[count].dest_gate) == gateId)
+ &&((nfa_hci_cb.cfg.dyn_pipes[count].local_gate) == gateId))
+ {
+ NFA_TRACE_DEBUG1 ("Set the pipe state to open -- %d !!!",nfa_hci_cb.cfg.dyn_pipes[count].pipe_id);
+ nfa_hci_cb.cfg.dyn_pipes[count].pipe_state = NFA_HCI_PIPE_OPENED;
+ break;
+ }
+ }
+}
#endif
diff --git a/src/nfa/hci/nfa_hci_main.c b/src/nfa/hci/nfa_hci_main.c
index 2b2e712..1e32ed7 100644
--- a/src/nfa/hci/nfa_hci_main.c
+++ b/src/nfa/hci/nfa_hci_main.c
@@ -745,6 +745,11 @@
nfa_hci_handle_nfcee_config_evt(NFA_HCI_NFCEE_CONFIG_COMPLETE);
#endif
nfa_hci_cb.hci_state = NFA_HCI_STATE_DISABLED;
+#if (NXP_EXTNS == true)
+ if(nfcFL.eseFL._EXCLUDE_NV_MEM_DEPENDENCY == false) {
+ nfa_hci_getApduAndConnectivity_PipeStatus();
+ }
+#endif
}
}
diff --git a/src/nfa/int/nfa_hci_int.h b/src/nfa/int/nfa_hci_int.h
index d5113f1..3a3cbc6 100644
--- a/src/nfa/int/nfa_hci_int.h
+++ b/src/nfa/int/nfa_hci_int.h
@@ -628,6 +628,7 @@
extern void nfa_hciu_set_nfceeid_poll_mask(uint8_t event, uint8_t host_id);
extern bool nfa_hciu_check_any_host_reset_pending();
extern tNFA_STATUS nfa_hci_api_config_nfcee(uint8_t hostId);
+extern tNFA_STATUS nfa_hci_getApduAndConnectivity_PipeStatus();
void nfa_hci_handle_clear_all_pipes_evt(uint8_t source_host);
#endif
diff --git a/src/nfc/include/nfc_api.h b/src/nfc/include/nfc_api.h
index 2697785..4a8b5f6 100644
--- a/src/nfc/include/nfc_api.h
+++ b/src/nfc/include/nfc_api.h
@@ -175,6 +175,8 @@
#define NXP_NFC_PROP_MAX_CMD_BUF_SIZE ((unsigned char)0x40)
#define NXP_NFC_SET_MSB(x) (x |= 0x80)
#define NXP_NFC_RESET_MSB(x) (x &= 0x7F)
+#define NXP_NFC_ESE_CONN_PIPE_STATUS ((unsigned char)0x22)
+#define NXP_NFC_ESE_APDU_PIPE_STATUS ((unsigned char)0x23)
/**********************************************
* NFC Config Parameter IDs defined by NXP NFC
**********************************************/