lists.osmocom.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

gerrit-log

Thread Start a new thread
Download
Threads by month
  • ----- 2026 -----
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2025 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
gerrit-log@lists.osmocom.org

June 2026

  • 1 participants
  • 870 discussions
[S] Change in osmo-ttcn3-hacks[master]: CCID: Check response of reader with empty SIM carrier
by jolly 01 Jun '26

01 Jun '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42805?usp=email ) Change subject: CCID: Check response of reader with empty SIM carrier ...................................................................... CCID: Check response of reader with empty SIM carrier The reader has a SIM carrier inserted, but there is no response from the SIM while expecting the ATR. The reader will get a timeout and is expected to respond with a suitable error code. The test uses the slot with the SIMtrace inserted. The SIMtrace will not respond with an ATR. This way there is no (extra) empty slot required for this test. Change-Id: Ifebdcce8f9dd9a51de5a5cb6cf223041d5c38622 --- M ccid/CCID_Tests.ttcn 1 file changed, 41 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/05/42805/1 diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn index 5e7c49b..6d4d6c9 100644 --- a/ccid/CCID_Tests.ttcn +++ b/ccid/CCID_Tests.ttcn @@ -1129,11 +1129,49 @@ f_start_and_wait(); } +/* The SIM slot is empty, but closed. There is no ATR received. */ +private function f_TC_empty_slot() runs on CardemSlot_CT +{ + var octetstring req := c_SIM_SELECT_EF_ICCID; + var octetstring res := '9000'O; + var CCID_PDU ccid_pdu; + var CCID_PDU par; + + /* Do not start SIM emulation, so there is no ATR. */ + f_cardem_transmit(ts_SIMTRACE_CEMU_SET_ATR(''O)); + f_sleep(0.2); + + f_ccid_power_on(CCID_PWRSEL_3V0, tr_CCID_HeaderIN_FAIL(CCID_ERR_ICC_MUTE, CCID_ICC_STATUS_PRES_INACT)); + + /* Send a request towards reader. */ + CCID.send(ts_CCID_XfrBlock(g_slot_nr, req, 0)); + /* Receive the response from reader. */ + ccid_pdu := f_ccid_receive(tr_CCID_DataBlock(g_slot_nr, ?, ?, ?)); + if (ccid_pdu.hdr_in.bError != CCID_ERR_CMD_NOT_SUPPORTED) { + setverdict(fail, "Unexpected Response or error code"); + mtc.stop; + } + /* Send GetParameters on empty slot. */ + par := f_ccid_get_par(); + log(par); + // FIXME: check result code + + /* Stop simtrace emulation, to prevent race condition. */ + vc_Cardem.stop; + vc_Cardem.done; +} +testcase TC_empty_slot() runs on Test_CT +{ + f_init(); + + f_start_handler(refers(f_TC_empty_slot), mp_simtrace_slot, true); + + f_start_and_wait(); +} + /* TODO */ /* IccPowerOn with wrong voltage (> 0x04) */ -/* XfrBlock on empty slot */ -/* GetParameters on empty slot */ /* SetParameters for bProtocolNum > 0x01 */ /* SetParameters: invalid parameters */ /* set unsupported frequency */ @@ -1181,6 +1219,7 @@ execute( TC_unexpected_procedure_byte() ); execute( TC_procedure_byte_timeout() ); execute( TC_status_word_timeout() ); + execute( TC_empty_slot() ); } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42805?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: Ifebdcce8f9dd9a51de5a5cb6cf223041d5c38622 Gerrit-Change-Number: 42805 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: CCID: Check if reader handles Abort correctly
by jolly 01 Jun '26

01 Jun '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42806?usp=email ) Change subject: CCID: Check if reader handles Abort correctly ...................................................................... CCID: Check if reader handles Abort correctly This test fails with osmo-ccid-firmware, because it is not yet implemented. Change-Id: Iebe97e73497b8468ebf08faf2c4db700fc76997f --- M ccid/CCID_Tests.ttcn 1 file changed, 53 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/06/42806/1 diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn index 6d4d6c9..a9d640e 100644 --- a/ccid/CCID_Tests.ttcn +++ b/ccid/CCID_Tests.ttcn @@ -803,6 +803,58 @@ f_start_and_wait(); } +/* The SIM transfer is aborted. */ +private function f_TC_abort() runs on CardemSlot_CT +{ + var octetstring req := c_SIM_READ_BINARY; + var CCID_PDU ccid_pdu; + + /* We need to emulate a SIM that does not respond, so we can be sure + * that the reader is still waiting while we abort. + */ + 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 NULL procedure byte by SIM. */ + f_cardem_transmit(ts_SIMTRACE_CEMU_TX_DATA(ts_CardEmu_DataFlags(pb_and_tx := true, final := true), + req[1])); + /* Send abort toward reader. */ + CCID.send(ts_CCID_Abort(g_slot_nr, 0)); + /* Eat the possible 'DataBlock' that will be received after timeout. */ + timer T := 1.0; + T.start; + alt { + [] CCID.receive(tr_CCID_DataBlock(g_slot_nr, ?, ?, ?)) { + log("Eating 'DataBlock'."); + repeat; + } + [] T.timeout { } + } + /* Receive the response from reader. */ + ccid_pdu := f_ccid_receive(tr_CCID_SlotStatus(g_slot_nr, ?, ?, ?)); + if (ccid_pdu.hdr_in.bStatus.bmCommandStatus != CCID_CMD_STATUS_OK) { + setverdict(fail, "Unexpected Response"); + mtc.stop; + } + + /* Stop simtrace emulation, to prevent race condition. */ + vc_Cardem.stop; + vc_Cardem.done; +} +testcase TC_abort() runs on Test_CT +{ + f_init(); + + f_start_handler(refers(f_TC_abort), mp_simtrace_slot, true); + + f_start_and_wait(); +} + /* TODO */ @@ -1205,6 +1257,7 @@ execute( TC_256_bytes_response() ); execute( TC_null_procedure_byte() ); execute( TC_255_bytes_request() ); + execute( TC_abort() ); /* error handling */ execute( TC_inval_slot() ); -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42806?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: Iebe97e73497b8468ebf08faf2c4db700fc76997f Gerrit-Change-Number: 42806 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: CCID: Fix “unsupported Secure” test case
by jolly 01 Jun '26

01 Jun '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42787?usp=email ) Change subject: CCID: Fix “unsupported Secure” test case ...................................................................... CCID: Fix “unsupported Secure” test case Expect SlotStatus or DataBlock. The specification states that DataBlock response is used to indicate, if Secure command is not suppported. Existing implementation, such as Omnikey Cardman 3121 or osmo-ccid-firmware respond with SlotStatus instead. Change-Id: I21517c3e28e0d0e42e8a177b7c668bff15c35aa0 --- M ccid/CCID_Tests.ttcn 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/87/42787/1 diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn index 566cb3e..3ff9c36 100644 --- a/ccid/CCID_Tests.ttcn +++ b/ccid/CCID_Tests.ttcn @@ -461,6 +461,9 @@ [] CCID.receive(tr_CCID_DataBlock(hdr_in := tr_CCID_HeaderIN_FAIL(CCID_ERR_CMD_NOT_SUPPORTED))) { setverdict(pass); } + [] CCID.receive(tr_CCID_SlotStatus(hdr_in := tr_CCID_HeaderIN_FAIL(CCID_ERR_CMD_NOT_SUPPORTED))) { + setverdict(pass); + } [] as_ccid_any(); } } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42787?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: I21517c3e28e0d0e42e8a177b7c668bff15c35aa0 Gerrit-Change-Number: 42787 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: CCID: Successful case 4 APDU test
by jolly 01 Jun '26

01 Jun '26
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 <andreas(a)eversberg.eu>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: CCID: Successful case 1 APDU test
by jolly 01 Jun '26

01 Jun '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42789?usp=email ) Change subject: CCID: Successful case 1 APDU test ...................................................................... CCID: Successful case 1 APDU test A MANAGE CHANNEL APDU has no data and must respond without any data, just the status words. Change-Id: I7d5ee9bbd8bb2505a762e3fd80238db658940c16 --- M ccid/CCID_Tests.ttcn 1 file changed, 27 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/89/42789/1 diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn index 6a8efc9..346cacd 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_MANAGE_CHANNEL := '0070800100'O; const octetstring c_UICC_GET_RESPONSE_BASE := 'a0c00000'O; /* Table 7 of ISO7816-3 */ @@ -382,6 +383,31 @@ f_start_and_wait(); } +/* manage channel (Case 1) */ +private function f_TC_successful_case_1() runs on Slot_CT +{ + var octetstring res; + + f_ccid_power_on(); + res := f_ccid_xfr(c_UICC_MANAGE_CHANNEL, '??'O); + if (res != '6200'O) { + setverdict(fail, "Unexpected SW1/SW2"); + mtc.stop; + } +} +testcase TC_successful_case_1() 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_1), i); + } + + f_start_and_wait(); +} + /* GET RESPONSE (Case 4) */ private function f_TC_successful_case_4() runs on Slot_CT { @@ -538,6 +564,7 @@ } execute( TC_set_params_nochange() ); execute( TC_successful_case_4() ); + execute( TC_successful_case_1() ); /* error handling */ execute( TC_inval_slot() ); -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42789?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: I7d5ee9bbd8bb2505a762e3fd80238db658940c16 Gerrit-Change-Number: 42789 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: CCID: Successful case 2 and 3 APDU tests
by jolly 01 Jun '26

01 Jun '26
jolly has uploaded this change for review. ( 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(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/90/42790/1 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() ); -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42790?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: I9110250020c11bc7382b6308a182c09bb79e5e5e Gerrit-Change-Number: 42790 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: CCID: Truncated APDU test
by jolly 01 Jun '26

01 Jun '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42791?usp=email ) Change subject: CCID: Truncated APDU test ...................................................................... CCID: Truncated APDU test A SELECT APDU must have a header + two bytes of data (what to select). The test truncates this APDU in all variants, ranging from 6 bytes down to 0 bytes. The reader may respond with an error caused by invald request or with and error caused by timeout of the SIM. Change-Id: I3df2ad9871bccdd03f618a6a457671adb1624590 --- M ccid/CCID_Tests.ttcn 1 file changed, 41 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/91/42791/1 diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn index f5dae50..107d00d 100644 --- a/ccid/CCID_Tests.ttcn +++ b/ccid/CCID_Tests.ttcn @@ -43,6 +43,7 @@ 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; +const octetstring c_UICC_TRUNCATED := '00a40004'O; /* Table 7 of ISO7816-3 */ type enumerated ISO7816_Fi { @@ -564,9 +565,47 @@ f_start_and_wait(); } +/* truncated transfer */ +private function f_TC_truncated() runs on Slot_CT +{ + var integer i; + var octetstring req; + var CCID_PDU pdu; + const record of octetstring c_status := { '6700'O, '6700'O, '6700'O, '6d00'O, '6881'O }; + + f_ccid_power_on(); + for (i := 4; i >= 0; i := i-1) { + log("Testing trunkted transfer block with ", i, " octet(s)."); + req := substr(c_UICC_TRUNCATED, 0, i); + pdu := f_ccid_xfr_pdu(req, ?); + if (pdu.hdr_in.bStatus.bmCommandStatus == CCID_CMD_STATUS_FAILED) { + log("Command failed as expected."); + continue; + } + if (pdu.u.DataBlock.abData == c_status[4 - i]) { + log("Got expected status result. (status ", c_status[4 - i], ")"); + continue; + } + setverdict(fail, "Unexpected SW1/SW2. (expected ", c_status[4 - i], ", got ", + pdu.u.DataBlock.abData, ")"); + mtc.stop; + } +} +testcase TC_truncated() 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_truncated), i); + } + + f_start_and_wait(); +} + /* TODO */ -/* truncated message */ /* IccPowerOn with wrong voltage (> 0x04) */ /* XfrBlock on empty slot */ /* GetParameters on empty slot */ @@ -606,6 +645,7 @@ } execute( TC_unsupp_mechanical() ); execute( TC_unsupp_secure() ); + execute( TC_truncated() ); } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42791?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: I3df2ad9871bccdd03f618a6a457671adb1624590 Gerrit-Change-Number: 42791 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[XS] Change in osmo-ttcn3-hacks[master]: SIMTRACE: Add missing pres_pol to CardEmu_BD_Config message
by jolly 01 Jun '26

01 Jun '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42792?usp=email ) Change subject: SIMTRACE: Add missing pres_pol to CardEmu_BD_Config message ...................................................................... SIMTRACE: Add missing pres_pol to CardEmu_BD_Config message Change-Id: I443e8151b0aa9bff150222ab6b507ed1f7946768 --- M library/SIMTRACE_Templates.ttcn M library/SIMTRACE_Types.ttcn 2 files changed, 6 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/92/42792/1 diff --git a/library/SIMTRACE_Templates.ttcn b/library/SIMTRACE_Templates.ttcn index 05f738f..d9e6c9a 100644 --- a/library/SIMTRACE_Templates.ttcn +++ b/library/SIMTRACE_Templates.ttcn @@ -217,12 +217,14 @@ template (value) SIMTRACE_PDU ts_SIMTRACE_CEMU_CONFIG(template (value) CardEmu_FeatureFlags flags) := ts_SIMTRACE(SIMTRACE_MSGT_BD_CEMU_CONFIG, { cardem_bd_config := { features := flags, - slot_mux_nr := 0} }); + slot_mux_nr := 0, + pres_pol := 0} }); template (present) SIMTRACE_PDU tr_SIMTRACE_CEMU_CONFIG(template (present) CardEmu_FeatureFlags flags) := tr_SIMTRACE(SIMTRACE_MSGT_BD_CEMU_CONFIG, { cardem_bd_config := { features := flags, - slot_mux_nr := * } }); + slot_mux_nr := *, + pres_pol := * } }); /*********************************************************************** diff --git a/library/SIMTRACE_Types.ttcn b/library/SIMTRACE_Types.ttcn index d28df2f..55f5541 100644 --- a/library/SIMTRACE_Types.ttcn +++ b/library/SIMTRACE_Types.ttcn @@ -274,7 +274,8 @@ type record CardEmu_BD_Config { CardEmu_FeatureFlags features, - uint8_t slot_mux_nr optional + uint8_t slot_mux_nr optional, + uint8_t pres_pol optional }; /*********************************************************************** -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42792?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: I443e8151b0aa9bff150222ab6b507ed1f7946768 Gerrit-Change-Number: 42792 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[S] Change in osmo-ttcn3-hacks[master]: CCID: Add test to verify a working Simtrace setup
by jolly 01 Jun '26

01 Jun '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42794?usp=email ) Change subject: CCID: Add test to verify a working Simtrace setup ...................................................................... CCID: Add test to verify a working Simtrace setup This test checks if a valid request is forwarded to SIMtrace and a valid response is returned back to the reader. Change-Id: I19264bc257024e9028996e417ff23bbbaebf5f92 --- M ccid/CCID_Tests.ttcn 1 file changed, 40 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/94/42794/1 diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn index 0715fba..158aa6e 100644 --- a/ccid/CCID_Tests.ttcn +++ b/ccid/CCID_Tests.ttcn @@ -591,6 +591,44 @@ f_start_and_wait(); } +/* A general test to verify a working simtrace. */ +private function f_TC_simtrace_test() runs on CardemSlot_CT +{ + var octetstring req := c_UICC_MANAGE_CHANNEL; + var octetstring res := '6200'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), + res)); + /* Receive the response from reader. */ + ccid_pdu := f_ccid_receive(tr_CCID_DataBlock(g_slot_nr, ?, ?, ?)); + if (ccid_pdu.u.DataBlock.abData != res) { + setverdict(fail, "Unexpected SW1/SW2"); + mtc.stop; + } + + /* Stop simtrace emulation, to prevent race condition. */ + vc_Cardem.stop; + vc_Cardem.done; +} +testcase TC_simtrace_test() runs on Test_CT +{ + f_init(); + + f_start_handler(refers(f_TC_simtrace_test), mp_simtrace_slot, true); + + f_start_and_wait(); +} + /* TODO */ @@ -755,6 +793,7 @@ execute( TC_successful_case_4() ); execute( TC_successful_case_1() ); execute( TC_successful_case_2_3() ); + execute( TC_simtrace_test() ); /* error handling */ execute( TC_inval_slot() ); @@ -764,6 +803,7 @@ execute( TC_unsupp_mechanical() ); execute( TC_unsupp_secure() ); execute( TC_truncated() ); + } -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42794?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: I19264bc257024e9028996e417ff23bbbaebf5f92 Gerrit-Change-Number: 42794 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
[M] Change in osmo-ttcn3-hacks[master]: CCID: Integrate SIMTRACE emulation into test cases
by jolly 01 Jun '26

01 Jun '26
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42793?usp=email ) Change subject: CCID: Integrate SIMTRACE emulation into test cases ...................................................................... CCID: Integrate SIMTRACE emulation into test cases This integration allows to add tests that use SIMtrace hardware instead of a physical SIM. These tests can be used to test handling of invalid behaviors, such as invalid responses or timeouts. The number of slots (mp_use_slot_count) are reduced to 7, so that the 8th slot can be used with a SIMtrace for subsequent tests. Change-Id: Ia27dd5198edb188bc73196ac3fbd6d56ba75812e --- M ccid/CCID_Tests.ttcn M ccid/gen_links.sh 2 files changed, 132 insertions(+), 13 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/93/42793/1 diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn index 107d00d..0715fba 100644 --- a/ccid/CCID_Tests.ttcn +++ b/ccid/CCID_Tests.ttcn @@ -3,6 +3,7 @@ /* TTCN-3 tests for USB CCID (Chip Card Interface Device) * * (C) 2018-2019 by Harald Welte <laforge(a)gnumonks.org> + * (C) 2026 by Andreas Eversberg <aeversberg(a)sysmocom.de> */ import from General_Types all; @@ -16,18 +17,33 @@ import from CCID_Templates all; import from CCID_Emulation all; +import from SIMTRACE_Types all; +import from SIMTRACE_Templates all; +import from SIMTRACE_Emulation all; + modulepar { USB_Device_Match mp_usb_dev_match := { vid_pid := { vid := '1d50'H, pid := '6141'H } }; - integer mp_use_slot_count := 8; + USB_Device_Match mp_cardem_usb_dev_match := { vid_pid := { vid := '1d50'H, pid := '60e3'H } }; + integer mp_use_slot_count := 7; + integer mp_simtrace_slot := 7; boolean mp_test_power_off := true; boolean mp_test_set_params := false; boolean mp_quirk_resetpar_returns_slotsts := false; } + /* global test component; manages CCID device */ type component Test_CT { var CCID_Emulation_CT vc_CCID; port USB_PT USB; - var Slot_CT vc_SLOT[NR_SLOTS]; + var CardemSlot_CT vc_SLOT[NR_SLOTS]; + var ST_Emulation_CT vc_cardem_ref[NR_SLOTS]; + private var boolean Cardem_In_Use := false; +}; + +type component CardemSlot_CT extends Slot_CT { + var ST_Emulation_CT vc_Cardem := null; + port ST_USER_PT ST; + port ST_USER_PT ST_IRQ; }; /* maximum number of slots we are supporting in the test suite */ @@ -93,28 +109,46 @@ } }; -type function void_fn() runs on Slot_CT; +type function void_fn() runs on CardemSlot_CT; -/* first function inside Slot_CT; wait for CCID_EVENT_UP + call testcase-specific function */ -private function f_handler_init(void_fn fn, integer slot_nr) runs on Slot_CT { +/* first function inside CardemSlot_CT; wait for CCID_EVENT_UP + call testcase-specific function */ +private function f_handler_init(void_fn fn, integer slot_nr, ST_Emulation_CT v_cardem_ref) runs on CardemSlot_CT { g_slot_nr := slot_nr; - CCID.receive(CCID_Emulation_Event:{up_down:=CCID_EVENT_UP}); + vc_Cardem := v_cardem_ref; g_Tguard.start; activate(as_Tguard()); + CCID.receive(CCID_Emulation_Event:{up_down:=CCID_EVENT_UP}); fn.apply(); } /* start a single slot handler */ -private function f_start_handler(void_fn fn, integer slot_nr) runs on Test_CT +private function f_start_handler(void_fn fn, integer slot_nr, boolean use_cardem := false) runs on Test_CT { - var Slot_CT vc; + var ST_Emulation_CT vc_Cardem := null; - vc_SLOT[slot_nr] := Slot_CT.create("Slot" & int2str(slot_nr)); + vc_SLOT[slot_nr] := CardemSlot_CT.create("Slot" & int2str(slot_nr)); connect(vc_SLOT[slot_nr]:CCID, vc_CCID:SLOT[slot_nr]); - vc_SLOT[slot_nr].start(f_handler_init(fn, slot_nr)); + + if (use_cardem) { + if (Cardem_In_Use) { + setverdict(fail, "Only one CCID slot handler can use Cardem."); + mtc.stop; + } + vc_Cardem := ST_Emulation_CT.create("Cardem"); + map(vc_Cardem:USB, system:USB); + connect(vc_Cardem:INOUT, vc_SLOT[slot_nr]:ST); + connect(vc_Cardem:IRQ, vc_SLOT[slot_nr]:ST_IRQ); + Cardem_In_Use := true; + } + + vc_cardem_ref[slot_nr] := vc_Cardem; + + vc_SLOT[slot_nr].start(f_handler_init(fn, slot_nr, vc_Cardem)); + } +/* start a single Cardem slot handler */ private function f_wait_handlers_complete() runs on Test_CT { var integer i; @@ -127,9 +161,19 @@ } private function f_start_and_wait() runs on Test_CT { - /* start CCID_Emulation last, it will trigger all the per-slot components */ - var CCID_Emulation_Params cep := { usb_dev_match := mp_usb_dev_match }; - vc_CCID.start(CCID_Emulation.main(cep)); + var integer i; + + /* start CCID_Emulation and Cardem_Emulation last, it will trigger all the per-slot components */ + var CCID_Emulation_Params ccidp := { usb_dev_match := mp_usb_dev_match }; + var USB_IF_Params cardemp := { usb_dev_match := mp_cardem_usb_dev_match, usb_if_nr := 0 }; + vc_CCID.start(CCID_Emulation.main(ccidp)); + for (i := 0; i < NR_SLOTS; i := i+1) { + if (vc_SLOT[i] != null) { + if (vc_cardem_ref[i] != null) { + vc_cardem_ref[i].start(SIMTRACE_Emulation.main(cardemp)); + } + } + } f_wait_handlers_complete(); } @@ -142,7 +186,81 @@ } } +altstep as_cardem_any() runs on CardemSlot_CT { + var SIMTRACE_PDU pdu; + [] ST.receive(SIMTRACE_PDU:?) -> value pdu { + setverdict(fail, "Received unexpected CCID ", pdu); + self.stop; + } + [] ST.receive { + setverdict(fail, "Received unexpected non-CCID"); + self.stop; + } +} +/* transceive a Cardem command (expect 'rx' on IN) */ +function f_cardem_receive(template (present) SIMTRACE_PDU exp_rx) +runs on CardemSlot_CT return SIMTRACE_PDU { + var SIMTRACE_PDU pdu; + + alt { + [] ST.receive(exp_rx) -> value pdu { + return pdu; + } + [] as_cardem_any(); + } + return pdu; +} + +function f_cardem_transmit(template (value) SIMTRACE_PDU tx) +runs on CardemSlot_CT { + ST.send(tx); +} + +altstep as_cardem_manager() runs on CardemSlot_CT { + var SIMTRACE_PDU pdu; + + [] ST.receive(tr_SIMTRACE_CEMU_CONFIG(tr_FeatureFlags(true))) { + log("Got Config."); + repeat; + } + [] ST_IRQ.receive(tr_SIMTRACE_MODEM_STATUS()) { + log("Got Status."); + repeat; + } + [] ST.receive(tr_SIMTRACE_CEMU_PTS(?, ?)) { + log("Got PTS info."); + repeat; + } +} + +function f_cardem_manager() runs on CardemSlot_CT { + if (vc_Cardem == null) { + setverdict(fail, "Please enable Cardem support first."); + mtc.stop; + } + + activate(as_cardem_manager()); + + f_cardem_transmit(ts_SIMTRACE_CEMU_CONFIG(ts_FeatureFlags(true))); + f_cardem_transmit(ts_SIMTRACE_MODEM_SIM_SELECT(SIM_SELECT_REMOTE)); + f_cardem_transmit(ts_SIMTRACE_CEMU_SET_ATR('3b00'O)); + f_cardem_transmit(ts_SIMTRACE_CEMU_CARDINSERT(1)); + f_cardem_transmit(ts_SIMTRACE_MODEM_RESET(MODEM_RESET_PULSE, 300)); + f_cardem_transmit(ts_SIMTRACE_CEMU_SET_ATR('3b9f96801f878031e073fe211b674a4c753034054ba9'O)); + f_sleep(0.2); +} + +private function f_ccid_receive(template (present) CCID_PDU pdu_exp) runs on Slot_CT return CCID_PDU { + var CCID_PDU pdu_rx; + alt { + [] CCID.receive(pdu_exp) -> value pdu_rx { + } + [] as_ccid_any(); + } + + return pdu_rx; +} /*********************************************************************** * Test behavior regarding valid situations diff --git a/ccid/gen_links.sh b/ccid/gen_links.sh index dac7ffe..2f6f0ac 100755 --- a/ccid/gen_links.sh +++ b/ccid/gen_links.sh @@ -16,6 +16,7 @@ DIR=../library FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_Types.ttcn " FILES+="Native_Functions.ttcn Native_FunctionDefs.cc " +FILES+="SIMTRACE_Types.ttcn SIMTRACE_Templates.ttcn SIMTRACE_Emulation.ttcn " gen_links $DIR $FILES gen_links_finish -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42793?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: Ia27dd5198edb188bc73196ac3fbd6d56ba75812e Gerrit-Change-Number: 42793 Gerrit-PatchSet: 1 Gerrit-Owner: jolly <andreas(a)eversberg.eu>
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 83
  • 84
  • 85
  • 86
  • 87
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.