jolly has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42806?usp=email )
(
8 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: CCID: Check if reader handles Abort correctly
......................................................................
CCID: Check if reader handles Abort correctly
The tests aborts an ongoing case 2 APDU (according to ISO 7816). The
SIM responds with a NULL procedure byte so that the reader does not
time out.
The abort messages are sent on both, the control pipe and the bulk
pipe with the same sequence number.
This test fails with osmo-ccid-firmware, because the abort
message/handling is not yet implemented.
Change-Id: Iebe97e73497b8468ebf08faf2c4db700fc76997f
---
M ccid/CCID_Tests.ttcn
1 file changed, 72 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Hoernchen: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index 643f78f..00387d4 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -803,6 +803,77 @@
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;
+ var boolean v_slot_status_received := false;
+
+ /* 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),
+ '60'O));
+ /* Send abort toward reader. Note that CCID_Emulation.ttcn will detect
+ * the PC_to_RDR_Abort message type and sends another abort message to
+ * the control pipe in advance with the same sequence number. This is
+ * done there, because the sequence number is set at CCID_Emulation.ttcn
+ * upon transmission of the two messages. */
+ CCID.send(ts_CCID_Abort(g_slot_nr, 0));
+ /* Wait for slot status, but eat the possible 'DataBlock' that will be received after timeout. */
+ timer T := 3.0;
+ T.start;
+ alt {
+ [] CCID.receive(tr_CCID_DataBlock(g_slot_nr, ?, ?, ?)) -> value ccid_pdu {
+ log("Eating 'DataBlock'.");
+ if (ccid_pdu.hdr_in.bStatus.bmCommandStatus != CCID_CMD_STATUS_FAILED) {
+ setverdict(fail, "Unexpected Datablock status after abort command.");
+ mtc.stop;
+ }
+ if (ccid_pdu.hdr_in.bError != CCID_ERR_CMD_ABORTED) {
+ setverdict(fail, "Unexpected Datablock error code after abort command.");
+ mtc.stop;
+ }
+ repeat;
+ }
+ [] CCID.receive(tr_CCID_SlotStatus(g_slot_nr, ?, ?, ?)) -> value ccid_pdu {
+ v_slot_status_received := true;
+ if (ccid_pdu.hdr_in.bStatus.bmCommandStatus != CCID_CMD_STATUS_OK) {
+ setverdict(fail, "Unexpected Response to abort command.");
+ mtc.stop;
+ }
+ }
+ [] T.timeout { }
+ }
+
+ if (not v_slot_status_received) {
+ setverdict(fail, "No response to abort command.");
+ 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 +1276,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: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Iebe97e73497b8468ebf08faf2c4db700fc76997f
Gerrit-Change-Number: 42806
Gerrit-PatchSet: 10
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Attention is currently required from: laforge.
Jenkins Builder has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/simtrace2/+/43005?usp=email )
Change subject: firmware: Implement debug command via USB control vendor class
......................................................................
Patch Set 8:
(1 comment)
File firmware/apps/cardem/main.c:
Robot Comment from checkpatch (run ID ):
https://gerrit.osmocom.org/c/simtrace2/+/43005/comment/4d2ada6b_6d17e888?us… :
PS8, Line 44: void (*ctrl_vendor_req) (const USBGenericRequest *request);
Unnecessary space before function pointer arguments
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/43005?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I1f4d29335eb0d2feef376b8ecdfe57a0162914d6
Gerrit-Change-Number: 43005
Gerrit-PatchSet: 8
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Thu, 16 Jul 2026 13:29:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: laforge.
lynxis lazus has posted comments on this change by lynxis lazus. ( https://gerrit.osmocom.org/c/simtrace2/+/43005?usp=email )
Change subject: firmware: Implement debug command via USB control vendor class
......................................................................
Patch Set 7:
(1 comment)
File firmware/libcommon/source/mode_cardemu.c:
https://gerrit.osmocom.org/c/simtrace2/+/43005/comment/7f9c61b7_eb90fc77?us… :
PS6, Line 714: struct cardem_inst *ci = &cardem_inst[i];
> I would simply definde a struct with named members at the simtrace protocol level, and then use that […]
Done
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/43005?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I1f4d29335eb0d2feef376b8ecdfe57a0162914d6
Gerrit-Change-Number: 43005
Gerrit-PatchSet: 7
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Thu, 16 Jul 2026 13:29:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>