laforge submitted this change.
CCID: Check if reader handles truncated SIM response
The reader knows how many byte of data is expected in the SIM response.
The emulated SIM will truncate that response, so that some data and the
final status words are not sent by the SIM. The tests expects the
reader to time out and return an appropriate error core.
Change-Id: I6db6d7889a1355ee9aa2005e676fed5d20a3f2dc
---
M ccid/CCID_Tests.ttcn
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index 158aa6e..e63044b 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -760,6 +760,44 @@
f_start_and_wait();
}
+/* The SIM responds with truncated response. */
+private function f_TC_truncated_response() runs on CardemSlot_CT
+{
+ var octetstring req := c_SIM_READ_BINARY;
+ var octetstring res := '0102030405060708090a9000'O;
+ var CCID_PDU ccid_pdu;
+
+ f_cardem_manager();
+
+ f_ccid_power_on(CCID_PWRSEL_3V0);
+
+ /* Send a request towards reader. */
+ CCID.send(ts_CCID_XfrBlock(g_slot_nr, req, 0));
+ /* Receive the request by SIM. */
+ f_cardem_receive(tr_SIMTRACE_CEMU_RX_DATA(?, req));
+ /* Transmit the response by SIM. */
+ f_cardem_transmit(ts_SIMTRACE_CEMU_TX_DATA(ts_CardEmu_DataFlags(pb_and_tx := true, final := true),
+ req[1] & substr(res, 0, 5)));
+ /* Receive the response from reader. */
+ ccid_pdu := f_ccid_receive(tr_CCID_DataBlock(g_slot_nr, ?, ?, ?));
+ if (ccid_pdu.hdr_in.bError != CCID_ERR_ICC_MUTE) {
+ setverdict(fail, "Unexpected Response or error code");
+ mtc.stop;
+ }
+
+ /* Stop simtrace emulation, to prevent race condition. */
+ vc_Cardem.stop;
+ vc_Cardem.done;
+}
+testcase TC_truncated_response() runs on Test_CT
+{
+ f_init();
+
+ f_start_handler(refers(f_TC_truncated_response), mp_simtrace_slot, true);
+
+ f_start_and_wait();
+}
+
/* TODO */
/* IccPowerOn with wrong voltage (> 0x04) */
@@ -803,7 +841,7 @@
execute( TC_unsupp_mechanical() );
execute( TC_unsupp_secure() );
execute( TC_truncated() );
-
+ execute( TC_truncated_response() );
}
To view, visit change 42795. To unsubscribe, or for help writing mail filters, visit settings.