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


Change subject: CCID: Check if reader handles special P3 value 0x00 correctly
......................................................................

CCID: Check if reader handles special P3 value 0x00 correctly

If data is requested from SIM with P3 set 0x00, it means that 256
bytes are requested. The reader will receive a procedure byte, which
must cause it to receive all 256 data bytes + two status words.

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



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

diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index ca638c8..9c10186 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -667,6 +667,44 @@
        f_start_and_wait();
 }

+/* The SIM responds with 256 bytes. */
+private function f_TC_256_bytes_response() runs on CardemSlot_CT
+{
+       var octetstring req := c_UICC_GET_RESPONSE_BASE & '00'O;
+       var octetstring res := 
'232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323429000'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] & 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_256_bytes_response() runs on Test_CT
+{
+       f_init();
+
+       f_start_handler(refers(f_TC_256_bytes_response), mp_simtrace_slot, 
true);
+
+       f_start_and_wait();
+}
+


 /* TODO */
@@ -1029,6 +1067,7 @@
        execute( TC_successful_case_2_3() );
        execute( TC_simtrace_test() );
        execute( TC_255_bytes_response() );
+       execute( TC_256_bytes_response() );

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

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42801?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: Icc3fd1937b9829fcf825c58d7b676aa2be2c48e7
Gerrit-Change-Number: 42801
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <[email protected]>

Reply via email to