jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42799?usp=email )
Change subject: CCID: Check if reader times out while expecting status words ......................................................................
CCID: Check if reader times out while expecting status words
A case 1 APDU is sent toward the reader. The reader expects two status words. If none of these are sent by the SIM the reader must timeout and send an error message back to the host.
Change-Id: I054b56a9e2f10e5b984ad0398efb4be5696ce16c --- M ccid/CCID_Tests.ttcn 1 file changed, 35 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/99/42799/1
diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn index d88b103..f695bf4 100644 --- a/ccid/CCID_Tests.ttcn +++ b/ccid/CCID_Tests.ttcn @@ -922,6 +922,40 @@ f_start_and_wait(); }
+/* The SIM does not send the expected status words. */ +private function f_TC_status_word_timeout() runs on CardemSlot_CT +{ + var octetstring req := c_UICC_MANAGE_CHANNEL; + 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)); + /* 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_status_word_timeout() runs on Test_CT +{ + f_init(); + + f_start_handler(refers(f_TC_status_word_timeout), mp_simtrace_slot, true); + + f_start_and_wait(); +} +
/* TODO */ /* IccPowerOn with wrong voltage (> 0x04) */ @@ -969,6 +1003,7 @@ execute( TC_wrong_procedure_byte() ); execute( TC_unexpected_procedure_byte() ); execute( TC_procedure_byte_timeout() ); + execute( TC_status_word_timeout() ); }