jolly has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42802?usp=email )


Change subject: CCID: Check if reader restarts WWT upon NULL procedure byte
......................................................................

CCID: Check if reader restarts WWT upon NULL procedure byte

The reader will receive a NULL procedure byte every 0.2 for a long time.
The reader may only respond with a status that time extension was
requested. At the end the SIM proceeds with a valid response. This
response must be returned by the reader.

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



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/02/42802/1

diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index 9c10186..b9a23ef 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -705,6 +705,61 @@
        f_start_and_wait();
 }

+/* The SIM responds with many procedure bytes to prevent timeout. */
+private function f_TC_null_procedure_byte() runs on CardemSlot_CT
+{
+       var octetstring req := c_SIM_READ_BINARY;
+       var octetstring res := '0102030405060708090a9000'O;
+       var CCID_PDU ccid_pdu;
+       var integer i;
+
+       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));
+       for (i := 0; i < 40; i := i+1) {
+               /* Transmit NULL procedure byte by SIM. */
+               
f_cardem_transmit(ts_SIMTRACE_CEMU_TX_DATA(ts_CardEmu_DataFlags(pb_and_tx := 
true, final := false),
+                                                          '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 { }
+               }
+       }
+       /* Transmit the response by SIM. */
+       
f_cardem_transmit(ts_SIMTRACE_CEMU_TX_DATA(ts_CardEmu_DataFlags(pb_and_tx := 
true, final := true),
+                                                  req[1] & res));
+       /* Receive the response from reader. */
+       ccid_pdu := f_ccid_receive(tr_CCID_DataBlock(g_slot_nr, ?, ?, ?));
+       if (ccid_pdu.u.DataBlock.abData != res) {
+               setverdict(fail, "Unexpected SW1/SW2");
+               mtc.stop;
+       }
+
+       /* Stop simtrace emulation, to prevent race condition. */
+       vc_Cardem.stop;
+       vc_Cardem.done;
+}
+testcase TC_null_procedure_byte() runs on Test_CT
+{
+       f_init();
+
+       f_start_handler(refers(f_TC_null_procedure_byte), mp_simtrace_slot, 
true);
+
+       f_start_and_wait();
+}
+


 /* TODO */
@@ -1068,6 +1123,7 @@
        execute( TC_simtrace_test() );
        execute( TC_255_bytes_response() );
        execute( TC_256_bytes_response() );
+       execute( TC_null_procedure_byte() );

        /* error handling */
        execute( TC_inval_slot() );

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

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I4eb09e86f88df19d96e9ec55872654352ca2ebd5
Gerrit-Change-Number: 42802
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <[email protected]>

Reply via email to