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

Change subject: CCID: Send a wrong procedure byte towards the reader
......................................................................

CCID: Send a wrong procedure byte towards the reader

A case 2 request (according to ISO 7816) is sent and a response with
data is expected, but the first byte replied by the SIM is not a
procedure byte, nor a valid status byte.

This text expects the reader to return an error that states an incorrect
received procedure byte.

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

Approvals:
  Jenkins Builder: Verified
  Hoernchen: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved




diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index 0988ae7..5d80c16 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -1083,6 +1083,44 @@
        f_start_and_wait();
 }

+/* The SIM sends a wrong procedure byte */
+private function f_TC_wrong_procedure_byte() 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),
+                                                  '42'O & res));
+       /* Receive the response from reader. */
+       ccid_pdu := f_ccid_receive(tr_CCID_DataBlock(g_slot_nr, ?, ?, ?));
+       if (ccid_pdu.hdr_in.bError != CCID_ERR_PROCEDURE_BYTE_CONFLICT) {
+               setverdict(fail, "Unexpected Response or error code");
+               mtc.stop;
+       }
+
+       /* Stop simtrace emulation, to prevent race condition. */
+       vc_Cardem.stop;
+       vc_Cardem.done;
+}
+testcase TC_wrong_procedure_byte() runs on Test_CT
+{
+       f_init();
+
+       f_start_handler(refers(f_TC_wrong_procedure_byte), mp_simtrace_slot, 
true);
+
+       f_start_and_wait();
+}
+

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



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42796?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: Iaa0bd8845b3408fba309874fe41c855d8e7efccc
Gerrit-Change-Number: 42796
Gerrit-PatchSet: 7
Gerrit-Owner: jolly <[email protected]>
Gerrit-Reviewer: Hoernchen <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <[email protected]>

Reply via email to