laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42790?usp=email )
Change subject: CCID: Successful case 2 and 3 APDU tests ......................................................................
CCID: Successful case 2 and 3 APDU tests
A SELECT APDU has data and must respond without any data, just the status words.
A READ BINARY APDU has no data, but it must respond with data, followed by the status words.
Change-Id: I9110250020c11bc7382b6308a182c09bb79e5e5e --- M ccid/CCID_Tests.ttcn 1 file changed, 33 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn index 346cacd..f5dae50 100644 --- a/ccid/CCID_Tests.ttcn +++ b/ccid/CCID_Tests.ttcn @@ -40,6 +40,8 @@ const octetstring c_UICC_SELECT_MF := '00a40004023f00'O; const octetstring c_SIM_SELECT_MF := 'a0a40004023f00'O; const octetstring c_UICC_MANAGE_CHANNEL := '0070800100'O; +const octetstring c_SIM_SELECT_EF_ICCID := '00A4000C022FE2'O; +const octetstring c_SIM_READ_BINARY := '00B000000A'O; const octetstring c_UICC_GET_RESPONSE_BASE := 'a0c00000'O;
/* Table 7 of ISO7816-3 */ @@ -408,6 +410,36 @@ f_start_and_wait(); }
+/* read binary (Case 3 + 2) */ +private function f_TC_successful_case_2_3() runs on Slot_CT +{ + var octetstring res; + + f_ccid_power_on(); + res := f_ccid_xfr(c_SIM_SELECT_EF_ICCID, '??'O); + if (res != '9000'O) { + setverdict(fail, "Unexpected SW1/SW2"); + mtc.stop; + } + res := f_ccid_xfr(c_SIM_READ_BINARY, ?); + if (substr(res, 10,2) != '9000'O) { + setverdict(fail, "Unexpected SW1/SW2"); + mtc.stop; + } +} +testcase TC_successful_case_2_3() runs on Test_CT +{ + var integer i; + + f_init(); + + for (i := 0; i < mp_use_slot_count; i := i+1) { + f_start_handler(refers(f_TC_successful_case_2_3), i); + } + + f_start_and_wait(); +} + /* GET RESPONSE (Case 4) */ private function f_TC_successful_case_4() runs on Slot_CT { @@ -565,6 +597,7 @@ execute( TC_set_params_nochange() ); execute( TC_successful_case_4() ); execute( TC_successful_case_1() ); + execute( TC_successful_case_2_3() );
/* error handling */ execute( TC_inval_slot() );