jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42795?usp=email )
Change subject: CCID: Check if reader handles truncated SIM response
......................................................................
CCID: Check if reader handles truncated SIM response
The reader knows how many byte of data is expected in the SIM response.
The emulated SIM will truncate that response, so that some data and the
final status words are not sent by the SIM. The tests expects the
reader to time out and return an appropriate error core.
Change-Id: I6db6d7889a1355ee9aa2005e676fed5d20a3f2dc
---
M ccid/CCID_Tests.ttcn
1 file changed, 39 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/95/42795/1
diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index 158aa6e..e63044b 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -760,6 +760,44 @@
f_start_and_wait();
}
+/* The SIM responds with truncated response. */
+private function f_TC_truncated_response() runs on CardemSlot_CT
+{
+ var octetstring req := c_SIM_READ_BINARY;
+ var octetstring res := '0102030405060708090a9000'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),
+ req[1] & substr(res, 0, 5)));
+ /* 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_truncated_response() runs on Test_CT
+{
+ f_init();
+
+ f_start_handler(refers(f_TC_truncated_response), mp_simtrace_slot, true);
+
+ f_start_and_wait();
+}
+
/* TODO */
/* IccPowerOn with wrong voltage (> 0x04) */
@@ -803,7 +841,7 @@
execute( TC_unsupp_mechanical() );
execute( TC_unsupp_secure() );
execute( TC_truncated() );
-
+ execute( TC_truncated_response() );
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42795?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: I6db6d7889a1355ee9aa2005e676fed5d20a3f2dc
Gerrit-Change-Number: 42795
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/+/42796?usp=email )
Change subject: CCID: Send a wrong procedure byte towards the reader
......................................................................
CCID: Send a wrong procedure byte towards the reader
A case 3 request is send and a response with data is expected, but the
first byte replied by the sim is not a procedure byte, nor a valid
status byte.
This text expects the reader to return an error that states an incorrect
received procedure byte.
Change-Id: Iaa0bd8845b3408fba309874fe41c855d8e7efccc
---
M ccid/CCID_Tests.ttcn
1 file changed, 39 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/96/42796/1
diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index e63044b..1e2b99f 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -798,6 +798,44 @@
f_start_and_wait();
}
+/* The SIM sends a wrong procedure byte */
+private function f_TC_wrong_procedure_byte() runs on CardemSlot_CT
+{
+ var octetstring req := c_SIM_READ_BINARY;
+ var octetstring res := '0102030405060708090a9000'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),
+ '42'O & res));
+ /* Receive the response from reader. */
+ ccid_pdu := f_ccid_receive(tr_CCID_DataBlock(g_slot_nr, ?, ?, ?));
+ if (ccid_pdu.hdr_in.bError != CCID_ERR_PROCEDURE_BYTE_CONFLICT) {
+ setverdict(fail, "Unexpected Response or error code");
+ mtc.stop;
+ }
+
+ /* Stop simtrace emulation, to prevent race condition. */
+ vc_Cardem.stop;
+ vc_Cardem.done;
+}
+testcase TC_wrong_procedure_byte() runs on Test_CT
+{
+ f_init();
+
+ f_start_handler(refers(f_TC_wrong_procedure_byte), mp_simtrace_slot, true);
+
+ f_start_and_wait();
+}
+
/* TODO */
/* IccPowerOn with wrong voltage (> 0x04) */
@@ -842,6 +880,7 @@
execute( TC_unsupp_secure() );
execute( TC_truncated() );
execute( TC_truncated_response() );
+ execute( TC_wrong_procedure_byte() );
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42796?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: Iaa0bd8845b3408fba309874fe41c855d8e7efccc
Gerrit-Change-Number: 42796
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/+/42797?usp=email )
Change subject: CCID: Send procedure byte, when not expected
......................................................................
CCID: Send procedure byte, when not expected
A case 1 APDU does not request any data from SIM to return. The SIM will
only return a status byte with no procedure byte in advance.
The test sends a procedure byte in advance of the two status bytes
towards the reader. The reader expects SW1 instead of the status byte,
so that it returns it as SW1.
Change-Id: Icffd48d99f0eb48e0898efb027854eba8c22f4a4
---
M ccid/CCID_Tests.ttcn
1 file changed, 39 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/97/42797/1
diff --git a/ccid/CCID_Tests.ttcn b/ccid/CCID_Tests.ttcn
index 1e2b99f..1ac1351 100644
--- a/ccid/CCID_Tests.ttcn
+++ b/ccid/CCID_Tests.ttcn
@@ -836,6 +836,44 @@
f_start_and_wait();
}
+/* Send a procedure byte where only a status is expected. */
+private function f_TC_unexpected_procedure_byte() runs on CardemSlot_CT
+{
+ var octetstring req := c_UICC_MANAGE_CHANNEL;
+ var octetstring res := '62'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),
+ req[1] & res));
+ /* Receive the response from reader. */
+ ccid_pdu := f_ccid_receive(tr_CCID_DataBlock(g_slot_nr, ?, ?, ?));
+ if (ccid_pdu.u.DataBlock.abData != req[1] & res[0]) {
+ setverdict(fail, "Unexpected SW1/SW2");
+ mtc.stop;
+ }
+
+ /* Stop simtrace emulation, to prevent race condition. */
+ vc_Cardem.stop;
+ vc_Cardem.done;
+}
+testcase TC_unexpected_procedure_byte() runs on Test_CT
+{
+ f_init();
+
+ f_start_handler(refers(f_TC_unexpected_procedure_byte), mp_simtrace_slot, true);
+
+ f_start_and_wait();
+}
+
/* TODO */
/* IccPowerOn with wrong voltage (> 0x04) */
@@ -881,6 +919,7 @@
execute( TC_truncated() );
execute( TC_truncated_response() );
execute( TC_wrong_procedure_byte() );
+ execute( TC_unexpected_procedure_byte() );
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42797?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: Icffd48d99f0eb48e0898efb027854eba8c22f4a4
Gerrit-Change-Number: 42797
Gerrit-PatchSet: 1
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Attention is currently required from: fixeria, pespin.
jolly has posted comments on this change by jolly. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42775?usp=email )
Change subject: C5G: Release UE Context before sending Service request
......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS2:
> I think you need to call it after the NGAP.receive.
Done
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42775?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: If6fae56487aebd810c51cbab170d95d5dec7e138
Gerrit-Change-Number: 42775
Gerrit-PatchSet: 3
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Mon, 01 Jun 2026 08:21:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: jolly <andreas(a)eversberg.eu>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Comment-In-Reply-To: fixeria <vyanitskiy(a)sysmocom.de>
Attention is currently required from: fixeria, jolly.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42775?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
Change subject: C5G: Release UE Context before sending Service request
......................................................................
C5G: Release UE Context before sending Service request
A recent fix in Open5GS rejects RAN_UE_NGAP_ID in InitialUEMessage. This
causes all tests to fail that send a subsequent InitialUEMessage with
the same RAN_UE_NGAP_ID.
Release the UE Context before re-using the RAN_UE_NGAP_ID, because the
connection handler can only handle one context at a time.
Note that the AMF_UE_NGAP_ID is incremented by Open5GS for every
context.
This fixes:
TC_ue_service_request_cm_idle_inact_sess
TC_ue_service_request_cm_idle_ul_data
TC_ue_service_request_cm_idle_unknown_sess_active
Related: Open5GS Issues #4481
Change-Id: If6fae56487aebd810c51cbab170d95d5dec7e138
---
M 5gc/C5G_Tests.ttcn
1 file changed, 14 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/75/42775/3
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/42775?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: If6fae56487aebd810c51cbab170d95d5dec7e138
Gerrit-Change-Number: 42775
Gerrit-PatchSet: 3
Gerrit-Owner: jolly <andreas(a)eversberg.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: jolly <andreas(a)eversberg.eu>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
osmith has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/42625?usp=email )
Change subject: osmo-smdpp.py: use commonpath in transversal check
......................................................................
osmo-smdpp.py: use commonpath in transversal check
Use commonpath, as commonprefix allows accessing a sibiling directory
with the same prefix.
Change-Id: I7a42b40aa2bbcd5f0ec99f172503354c6eaa9828
---
M osmo-smdpp.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
Hoernchen: Looks good to me, but someone else must approve
osmith: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/osmo-smdpp.py b/osmo-smdpp.py
index d1d6fd7..2a8e478 100755
--- a/osmo-smdpp.py
+++ b/osmo-smdpp.py
@@ -640,7 +640,7 @@
# look up profile based on matchingID. We simply check if a given file exists for now..
path = os.path.join(self.upp_dir, matchingId) + '.der'
# prevent directory traversal attack
- if os.path.commonprefix((os.path.realpath(path),self.upp_dir)) != self.upp_dir:
+ if os.path.commonpath((os.path.realpath(path),self.upp_dir)) != self.upp_dir:
raise ApiError('8.2.6', '3.8', 'Refused')
if not os.path.isfile(path) or not os.access(path, os.R_OK):
raise ApiError('8.2.6', '3.8', 'Refused')
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/42625?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I7a42b40aa2bbcd5f0ec99f172503354c6eaa9828
Gerrit-Change-Number: 42625
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>