Attention is currently required from: fixeria, laforge.
dexter has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/pysim/+/42674?usp=email )
Change subject: personalization: fix EF_SMSP length, alpha_id padding
......................................................................
Patch Set 5: Verified+1
(3 comments)
Patchset:
PS5:
I have tested this patch with a small test program and TS48V1-B-UNIQUE.der. When I parse the results with saip_tool.py the encoded result looks fine. I get the expected amount of padding at the beginning. With that I see no major problems with this patch. We could just polish the last bits (no need to set alpha ID, rec length 38 instead of 42) and then merge it.
PS5:
> One still has to ensure to pass the file length (total_len=f_smsp.rec_len) to encode_record_hex. […]
Done
File pySim/esim/saip/personalization.py:
https://gerrit.osmocom.org/c/pysim/+/42674/comment/f46d9e41_846e730c?usp=em… :
PS5, Line 638: f_smsp.rec_len = 42
> (missing detail: the current version also does NOT set `f_smsp. […]
The size of 38 is the default that TCA suggests. If it works with 38, then this probably means that efFileSize is not set in the template.
In any case, using a size of 38 sounds reasonable. This would leave 10 chars for the alpha id. I think that 10 chars "ought to be enough for anybody". If this is the only problem we could just set f_smsp.rec_len to 38.
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/42674?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ief6e02517f3e96158a2509d763b88aec4bd5a296
Gerrit-Change-Number: 42674
Gerrit-PatchSet: 5
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 01 Jun 2026 10:38:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42798?usp=email )
Change subject: CCID: Check if reader times out while expecting procedure byte
......................................................................
CCID: Check if reader times out while expecting procedure byte
A case 3 APDU is sent toward the reader. The reader expects a procedure
byte or a status word. If none of these are sent by the SIM the reader
must timeout and send an error message back to the host.
Change-Id: Iacd6aacaf8220e69b9b7038e354d54c788d1eb05
---
M ccid/CCID_Tests.ttcn
1 file changed, 49 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/98/42798/1
diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index 1ac1351..d88b103 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -874,6 +874,54 @@
f_start_and_wait();
}
+/* The SIM does not send the expected procedure byte. */
+private function f_TC_procedure_byte_timeout() runs on CardemSlot_CT
+{
+ var octetstring req := c_SIM_READ_BINARY;
+ 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 procedure byte from SIM. */
+ f_cardem_transmit(ts_SIMTRACE_CEMU_TX_DATA(ts_CardEmu_DataFlags(pb_and_tx := true, final := true),
+ '60'O));
+ /* Eat the possible 'Time Extension status' */
+ timer T := 0.2;
+ T.start;
+ alt {
+ [] CCID.receive(tr_CCID_DataBlock(g_slot_nr, ?, tr_CCID_HeaderIN(?, CCID_CMD_STATUS_TIME_EXT, ?), ?)) {
+ log("Eating 'Time Extension status'.");
+ repeat;
+ }
+ [] as_ccid_any();
+ [] T.timeout { }
+ }
+ /* 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_procedure_byte_timeout() runs on Test_CT
+{
+ f_init();
+
+ f_start_handler(refers(f_TC_procedure_byte_timeout), mp_simtrace_slot, true);
+
+ f_start_and_wait();
+}
+
/* TODO */
/* IccPowerOn with wrong voltage (> 0x04) */
@@ -920,6 +968,7 @@
execute( TC_truncated_response() );
execute( TC_wrong_procedure_byte() );
execute( TC_unexpected_procedure_byte() );
+ execute( TC_procedure_byte_timeout() );
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42798?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: Iacd6aacaf8220e69b9b7038e354d54c788d1eb05
Gerrit-Change-Number: 42798
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
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() );
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42799?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: I054b56a9e2f10e5b984ad0398efb4be5696ce16c
Gerrit-Change-Number: 42799
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>