jolly has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42798?usp=email )

Change subject: CCID: Check if reader times out while expecting procedure byte
......................................................................

CCID: Check if reader times out while expecting procedure byte

A case 2 APDU (according to ISO 7816) is sent toward the reader. The
reader expects a procedure byte or a status word. If none of these are
sent by the SIM the reader must timeout and send an error message back
to the host.

Change-Id: Iacd6aacaf8220e69b9b7038e354d54c788d1eb05
---
M ccid/CCID_Tests.ttcn
1 file changed, 49 insertions(+), 0 deletions(-)

Approvals:
  jolly: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index 5d80c16..643f78f 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -1121,6 +1121,54 @@
        f_start_and_wait();
 }

+/* The SIM does not send the expected procedure byte. */
+private function f_TC_procedure_byte_timeout() runs on CardemSlot_CT
+{
+       var octetstring req := c_SIM_READ_BINARY;
+       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 procedure byte from SIM. */
+       
f_cardem_transmit(ts_SIMTRACE_CEMU_TX_DATA(ts_CardEmu_DataFlags(pb_and_tx := 
true, final := true),
+                                                  '60'O));
+       /* Eat the possible 'Time Extension status' */
+       timer T := 0.2;
+       T.start;
+       alt {
+       [] CCID.receive(tr_CCID_DataBlock(g_slot_nr, ?, tr_CCID_HeaderIN(?, 
CCID_CMD_STATUS_TIME_EXT, ?), ?)) {
+               log("Eating 'Time Extension status'.");
+               repeat;
+               }
+       [] as_ccid_any();
+       [] T.timeout { }
+       }
+       /* 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_procedure_byte_timeout() runs on Test_CT
+{
+       f_init();
+
+       f_start_handler(refers(f_TC_procedure_byte_timeout), mp_simtrace_slot, 
true);
+
+       f_start_and_wait();
+}
+

 /* TODO */
 /* IccPowerOn with wrong voltage (> 0x04) */
@@ -1171,6 +1219,7 @@
        execute( TC_status_word_timeout() );
        execute( TC_status_word_incomplete() );
        execute( TC_wrong_procedure_byte() );
+       execute( TC_procedure_byte_timeout() );
 }



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42798?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Iacd6aacaf8220e69b9b7038e354d54c788d1eb05
Gerrit-Change-Number: 42798
Gerrit-PatchSet: 10
Gerrit-Owner: jolly <[email protected]>
Gerrit-Reviewer: Hoernchen <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: jolly <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>

Reply via email to