Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/43568?usp=email )
Change subject: sysmocom_sjs1: CardModel for the sysmoUSIM-SJS1
......................................................................
sysmocom_sjs1: CardModel for the sysmoUSIM-SJS1
SJS1 model lifted off the the legacy
SysmoUSIMSJS1.program(), ADM is ADM1 with CHV 0x0a,
already used by the generic UiccCardBase default.
Change-Id: I32b011c68de5f990e709718b313b6f28a31ca78b
---
M pySim/app.py
A pySim/sysmocom_sjs1.py
M tests/unittests/test_files.py
3 files changed, 63 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/68/43568/1
diff --git a/pySim/app.py b/pySim/app.py
index 4e88788..cb7aa25 100644
--- a/pySim/app.py
+++ b/pySim/app.py
@@ -34,6 +34,7 @@
# CardModel is created, which will add the ATR-based matching and
# calling of SysmocomSJA2.add_files. See CardModel.apply_matching_models
import pySim.sysmocom_sja2
+import pySim.sysmocom_sjs1
# we need to import these modules so that the various sub-classes of
# CardProfile are created, which will be used in init_card() to iterate
diff --git a/pySim/sysmocom_sjs1.py b/pySim/sysmocom_sjs1.py
new file mode 100644
index 0000000..8f8c044
--- /dev/null
+++ b/pySim/sysmocom_sjs1.py
@@ -0,0 +1,61 @@
+# coding=utf-8
+"""Utilities / Functions related to sysmocom sysmoUSIM-SJS1 cards
+
+(C) 2026 by sysmocom - s.f.m.c. GmbH
+All Rights Reserved
+
+Author: Eric Wild <ewild(a)sysmocom.de>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+from construct import Struct, Bytes, Flag
+from osmocom.utils import *
+from osmocom.construct import *
+
+from pySim.filesystem import *
+from pySim.runtime import RuntimeState
+
+
+class EF_Ki(TransparentEF):
+ _test_de_encode = [
+ ('000102030405060708090a0b0c0d0e0f',
+ {'key': h2b('000102030405060708090a0b0c0d0e0f')}),
+ ]
+
+ def __init__(self, fid='00ff', name='EF.Ki'):
+ super().__init__(fid, name=name, desc='K/Ki authentication key', size=(16, 16))
+ self._construct = Struct('key'/Bytes(16))
+
+
+class EF_OPc(TransparentEF):
+ _test_de_encode = [
+ ('016ca53d7a0a804561646816d7b0c702fb',
+ {'use_opc_instead_of_op': True, 'op_opc': h2b('6ca53d7a0a804561646816d7b0c702fb')}),
+ ]
+
+ def __init__(self, fid='00f7', name='EF.OPc'):
+ super().__init__(fid, name=name, desc='OP/OPc for milenage', size=(17, 17))
+ self._construct = Struct('use_opc_instead_of_op'/Flag, 'op_opc'/Bytes(16))
+
+
+class SysmoUSIMSJS1(CardModel):
+ _atrs = ["3b9f96801fc78031a073be21136743200718000001a5"]
+
+ @classmethod
+ def add_files(cls, rs: RuntimeState):
+ """Add sysmoUSIM-SJS1 specific files to given RuntimeState."""
+ # the key material lives in DF.GSM shared with ADF.USIM
+ if '7f20' in rs.mf.children:
+ rs.mf.children['7f20'].add_files([EF_Ki(), EF_OPc()])
diff --git a/tests/unittests/test_files.py b/tests/unittests/test_files.py
index e7c50dc..e8a7bc0 100755
--- a/tests/unittests/test_files.py
+++ b/tests/unittests/test_files.py
@@ -27,6 +27,7 @@
import pySim.ts_31_103
import pySim.ts_51_011
import pySim.sysmocom_sja2
+import pySim.sysmocom_sjs1
import pySim.gsm_r
import pySim.cdma_ruim
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/43568?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I32b011c68de5f990e709718b313b6f28a31ca78b
Gerrit-Change-Number: 43568
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
dexter has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43536?usp=email )
Change subject: eIM_Tests: move response check into f_es9p_receive
......................................................................
eIM_Tests: move response check into f_es9p_receive
When passing messages via the ES9+ interface, we check the expected
response in f_es9p_transceive. However, we could also check it earlier
in f_es9p_receive. This allows gives use more freedom since we can now
use f_es9p_receive independently.
Change-Id: Iff20efba2e1ca749c258f375c7fea3fdfd3d74f6
Related: SYS#8203
---
M eim/eIM_Tests.ttcn
1 file changed, 7 insertions(+), 8 deletions(-)
Approvals:
osmith: Looks good to me, approved
pespin: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/eim/eIM_Tests.ttcn b/eim/eIM_Tests.ttcn
index 14370b6..ca490db 100644
--- a/eim/eIM_Tests.ttcn
+++ b/eim/eIM_Tests.ttcn
@@ -176,9 +176,9 @@
}
}
-
-private function f_es9p_receive() runs on eIM_ConnHdlr return RemoteProfileProvisioningRequest {
/* Receive one ES9+ HTTP request */
+private function f_es9p_receive(template RemoteProfileProvisioningRequest expected_es9p_req := omit)
+runs on eIM_ConnHdlr return RemoteProfileProvisioningRequest {
var HTTPMessage es9p_req;
timer T := 10.0;
var RemoteProfileProvisioningRequest request;
@@ -193,6 +193,10 @@
}
}
+ if (not istemplatekind(expected_es9p_req, "omit") and not match(request, expected_es9p_req)) {
+ setverdict(fail, "unexpected request from eIM on ES9+");
+ }
+
return request;
}
@@ -208,13 +212,8 @@
template RemoteProfileProvisioningRequest expected_es9p_req := omit)
runs on eIM_ConnHdlr return RemoteProfileProvisioningRequest {
var RemoteProfileProvisioningRequest es9p_req;
- es9p_req := f_es9p_receive();
+ es9p_req := f_es9p_receive(expected_es9p_req);
f_es9p_send(es9p_res);
- if (not istemplatekind(expected_es9p_req, "omit")) {
- if (not match(valueof(es9p_req), expected_es9p_req)) {
- setverdict(fail, "unexpected request from eIM on ES9p");
- }
- }
return es9p_req;
}
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/43536?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: Iff20efba2e1ca749c258f375c7fea3fdfd3d74f6
Gerrit-Change-Number: 43536
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>