jolly has uploaded this change for review. ( 
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 3 request is send 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(-)



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

diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index e63044b..1e2b99f 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -798,6 +798,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) */
@@ -842,6 +880,7 @@
        execute( TC_unsupp_secure() );
        execute( TC_truncated() );
        execute( TC_truncated_response() );
+       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: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Iaa0bd8845b3408fba309874fe41c855d8e7efccc
Gerrit-Change-Number: 42796
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <[email protected]>

Reply via email to