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


Change subject: CCID: Successful case 4 APDU test
......................................................................

CCID: Successful case 4 APDU test

A GET RESPONSE APDU must respond with the exact number of bytes that
have been indicated by SW2 of the previous SELECT MF APDU.

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



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

diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index 3ff9c36..6a8efc9 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -39,6 +39,7 @@

 const octetstring c_UICC_SELECT_MF := '00a40004023f00'O;
 const octetstring c_SIM_SELECT_MF := 'a0a40004023f00'O;
+const octetstring c_UICC_GET_RESPONSE_BASE := 'a0c00000'O;

 /* Table 7 of ISO7816-3 */
 type enumerated ISO7816_Fi {
@@ -381,6 +382,38 @@
        f_start_and_wait();
 }

+/* GET RESPONSE (Case 4) */
+private function f_TC_successful_case_4() runs on Slot_CT
+{
+       var octetstring res;
+       var integer len;
+
+       f_ccid_power_on();
+       res := f_ccid_xfr(c_UICC_SELECT_MF, '??'O);
+       if (res[0] != '61'O) {
+               setverdict(fail, "Unexpected SW1");
+               mtc.stop;
+       }
+       len := oct2int(res[1]);
+       res := f_ccid_xfr(c_UICC_GET_RESPONSE_BASE & int2oct(len, 1), ?)
+       if (lengthof(res) != len + 2) {
+               setverdict(fail, "Expected ", len + 2, " octets, but got ", 
res);
+               mtc.stop;
+       }
+}
+testcase TC_successful_case_4() 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_4), i);
+       }
+
+       f_start_and_wait();
+}
+


 /* TODO */
@@ -504,6 +537,7 @@
                execute( TC_reset_params() );
        }
        execute( TC_set_params_nochange() );
+       execute( TC_successful_case_4() );

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

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

Reply via email to