Attention is currently required from: laforge.
Hello Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/37931?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
Change subject: scp: fix key length in dek_encrypt and dek_decrypt
......................................................................
scp: fix key length in dek_encrypt and dek_decrypt
When creating the DES cipher object with DES.new, we use the property
card_keys.dek. This property may hold a 16 byte key, but DES uses
an 8 byte key (56 bit + 8 bit integrity). Pycryptodome does not
automatically ignore excess key bytes. Instead it throws an
exception. This means we need to make sure to supply only the first
8 bytes of card_keys.dek
See also: https://pycryptodome.readthedocs.io/en/latest/src/cipher/des.html
Related: OS#6531
Change-Id: I92e0dc6a6196b532bd8b53fca7b9e78070d6903f
---
M pySim/global_platform/scp.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/31/37931/2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37931?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I92e0dc6a6196b532bd8b53fca7b9e78070d6903f
Gerrit-Change-Number: 37931
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Attention is currently required from: laforge.
dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/37932?usp=email )
Change subject: pySim-shell: rework startup procedure and introduce non interactive mode
......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS1:
> I would prefer something like --nointeractive or --noprompt over --headless, but I guess those are s […]
I think --noprompt is also fine
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37932?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: I07ecb27b37e2573629981a0d032cc95cd156be7e
Gerrit-Change-Number: 37932
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Wed, 28 Aug 2024 12:48:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Attention is currently required from: fixeria, laforge.
dexter has posted comments on this change by dexter. ( https://gerrit.osmocom.org/c/pysim/+/37840?usp=email )
Change subject: ara_m: use class byte of current lchan
......................................................................
Patch Set 9:
(1 comment)
Patchset:
PS6:
> I have now reviewed the code locations where we call send_apdu* methods. […]
Done
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37840?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: Ie3e48678f178a488bfaea6cc2b9a3e18145a8d10
Gerrit-Change-Number: 37840
Gerrit-PatchSet: 9
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 28 Aug 2024 12:09:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Comment-In-Reply-To: dexter <pmaier(a)sysmocom.de>
dexter has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37919?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: global_platform: use scp_key_identity ICCID for ADF.ISD
......................................................................
global_platform: use scp_key_identity ICCID for ADF.ISD
Related: OS#6531
Change-Id: I73a6f7088321a2b703074aa5228910709050cab2
---
M pySim/global_platform/__init__.py
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim/global_platform/__init__.py b/pySim/global_platform/__init__.py
index ecdc6b3..308a32a 100644
--- a/pySim/global_platform/__init__.py
+++ b/pySim/global_platform/__init__.py
@@ -894,6 +894,7 @@
# application using '00a4040000' and then parse the response FCI to get the ISD AID
def __init__(self, aid='a000000003000000'):
super().__init__(aid=aid, name='ADF.ISD', desc='Issuer Security Domain')
+ self.adf.scp_key_identity = 'ICCID'
#class CardProfileGlobalPlatform(CardProfile):
# ORDER = 23
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37919?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: I73a6f7088321a2b703074aa5228910709050cab2
Gerrit-Change-Number: 37919
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
dexter has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37918?usp=email )
(
2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: global_platform: fix help description for establish_scp03
......................................................................
global_platform: fix help description for establish_scp03
The argument parser object for establish_scp03 (est_scp03_parser) is
copied from est_scp02_parser. This object still has the .description
property set, which is the description for establish_scp02. To get
the description string that is defined in do_establish_scp03, we must
remove the old description string first.
Related: OS#6531
Change-Id: Ibb26bddf88b2e644a7f0c6b2a06bde228aa8afc7
---
M pySim/global_platform/__init__.py
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim/global_platform/__init__.py b/pySim/global_platform/__init__.py
index 075a189..ecdc6b3 100644
--- a/pySim/global_platform/__init__.py
+++ b/pySim/global_platform/__init__.py
@@ -830,6 +830,7 @@
self._establish_scp(scp02, host_challenge, opts.security_level)
est_scp03_parser = deepcopy(est_scp02_parser)
+ est_scp03_parser.description = None
est_scp03_parser.add_argument('--s16-mode', action='store_true', help='S16 mode (S8 is default)')
@cmd2.with_argparser(est_scp03_parser)
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37918?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: Ibb26bddf88b2e644a7f0c6b2a06bde228aa8afc7
Gerrit-Change-Number: 37918
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/37936?usp=email )
Change subject: commands: get rid of cla4lchan
......................................................................
commands: get rid of cla4lchan
The send_apdu* methods now support lchan patching, so there is no longer
a need for computing the class byte manually (which is prone get forgotten)
before calling a send_apdu*. It is now enough to supply an APDU that has
a class byte with the default channel selected. This also means we do not
need cla4lchan anymore, so let's restruture the code and get rid of it
completely.
Related: OS#6531
Change-Id: Ia795f3c16a8875484fce3b44e61497d5aa52b447
---
M pySim/commands.py
M pySim/euicc.py
2 files changed, 11 insertions(+), 24 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/36/37936/1
diff --git a/pySim/commands.py b/pySim/commands.py
index 3a7fe47..9e231f1 100644
--- a/pySim/commands.py
+++ b/pySim/commands.py
@@ -81,8 +81,8 @@
@property
def cla_byte(self) -> Hexstr:
- """Return the (cached) patched default CLA byte for this card."""
- return self._cla4lchan
+ """Return the lchan patched default CLA value for this card."""
+ return cla_with_lchan(self._cla_byte, self.lchan_nr)
@property
def max_cmd_len(self) -> int:
@@ -96,19 +96,6 @@
def cla_byte(self, new_val: Hexstr):
"""Set the (raw, without lchan) default CLA value for this card."""
self._cla_byte = new_val
- # compute cached result
- self._cla4lchan = cla_with_lchan(self._cla_byte, self.lchan_nr)
-
- def cla4lchan(self, cla: Hexstr) -> Hexstr:
- """Compute the lchan-patched value of the given CLA value. If no CLA
- value is provided as argument, the lchan-patched version of the SimCardCommands._cla_byte
- value is used. Most commands will use the latter, while some wish to override it and
- can pass it as argument here."""
- if not cla:
- # return cached result to avoid re-computing this over and over again
- return self._cla4lchan
- else:
- return cla_with_lchan(cla, self.lchan_nr)
def send_apdu(self, pdu: Hexstr, apply_lchan:bool = True) -> ResTuple:
"""Sends an APDU and auto fetch response data
@@ -122,7 +109,7 @@
sw : string (in hex) of status word (ex. "9000")
"""
if apply_lchan:
- pdu = self.cla4lchan(pdu[0:2]) + pdu[2:]
+ pdu = cla_with_lchan(pdu[0:2], self.lchan_nr) + pdu[2:]
if self.scp:
return self.scp.send_apdu_wrapper(self._tp.send_apdu, pdu)
else:
@@ -142,7 +129,7 @@
sw : string (in hex) of status word (ex. "9000")
"""
if apply_lchan:
- pdu = self.cla4lchan(pdu[0:2]) + pdu[2:]
+ pdu = cla_with_lchan(pdu[0:2], self.lchan_nr) + pdu[2:]
if self.scp:
return self.scp.send_apdu_wrapper(self._tp.send_apdu_checksw, pdu, sw)
else:
@@ -517,9 +504,9 @@
# TS 102 221 Section 11.3.1 low-level helper
def _retrieve_data(self, tag: int, first: bool = True) -> ResTuple:
if first:
- pdu = self.cla4lchan('80') + 'cb008001%02x' % (tag)
+ pdu = '80cb008001%02x' % (tag)
else:
- pdu = self.cla4lchan('80') + 'cb000000'
+ pdu = '80cb000000'
return self.send_apdu_checksw(pdu)
def retrieve_data(self, ef: Path, tag: int) -> ResTuple:
@@ -549,7 +536,7 @@
p1 = 0x00
if isinstance(data, (bytes, bytearray)):
data = b2h(data)
- pdu = self.cla4lchan('80') + 'db00%02x%02x%s' % (p1, len(data)//2, data)
+ pdu = '80db00%02x%02x%s' % (p1, len(data)//2, data)
return self.send_apdu_checksw(pdu)
def set_data(self, ef, tag: int, value: str, verify: bool = False, conserve: bool = False) -> ResTuple:
@@ -592,7 +579,7 @@
if len(rand) != 32:
raise ValueError('Invalid rand')
self.select_path(['3f00', '7f20'])
- return self.send_apdu_checksw(self.cla4lchan('a0') + '88000010' + rand, sw='9000')
+ return self.send_apdu_checksw('a088000010' + rand, sw='9000')
def authenticate(self, rand: Hexstr, autn: Hexstr, context: str = '3g') -> ResTuple:
"""Execute AUTHENTICATE (USIM/ISIM).
@@ -625,7 +612,7 @@
def status(self) -> ResTuple:
"""Execute a STATUS command as per TS 102 221 Section 11.1.2."""
- return self.send_apdu_checksw(self.cla4lchan('80') + 'F2000000')
+ return self.send_apdu_checksw('80F2000000')
def deactivate_file(self) -> ResTuple:
"""Execute DECATIVATE FILE command as per TS 102 221 Section 11.1.14."""
@@ -645,7 +632,7 @@
def resize_file(self, payload: Hexstr) -> ResTuple:
"""Execute RESIZE FILE command as per TS 102 222 Section 6.10"""
- return self.send_apdu_checksw(self.cla4lchan('80') + 'd40000%02x%s' % (len(payload)//2, payload))
+ return self.send_apdu_checksw('80d40000%02x%s' % (len(payload)//2, payload))
def delete_file(self, fid: Hexstr) -> ResTuple:
"""Execute DELETE FILE command as per TS 102 222 Section 6.4"""
diff --git a/pySim/euicc.py b/pySim/euicc.py
index d0cb682..8bd1ae4 100644
--- a/pySim/euicc.py
+++ b/pySim/euicc.py
@@ -322,7 +322,7 @@
def store_data(scc: SimCardCommands, tx_do: Hexstr, exp_sw: SwMatchstr ="9000") -> Tuple[Hexstr, SwHexstr]:
"""Perform STORE DATA according to Table 47+48 in Section 5.7.2 of SGP.22.
Only single-block store supported for now."""
- capdu = '%sE29100%02x%s' % (scc.cla4lchan('80'), len(tx_do)//2, tx_do)
+ capdu = '80E29100%02x%s' % (len(tx_do)//2, tx_do)
return scc.send_apdu_checksw(capdu, exp_sw)
@staticmethod
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37936?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: Ia795f3c16a8875484fce3b44e61497d5aa52b447
Gerrit-Change-Number: 37936
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Attention is currently required from: dexter.
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/37919?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
The change is no longer submittable: Verified is unsatisfied now.
Change subject: global_platform: use scp_key_identity ICCID for ADF.ISD
......................................................................
global_platform: use scp_key_identity ICCID for ADF.ISD
Related: OS#6531
Change-Id: I73a6f7088321a2b703074aa5228910709050cab2
---
M pySim/global_platform/__init__.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/19/37919/3
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37919?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I73a6f7088321a2b703074aa5228910709050cab2
Gerrit-Change-Number: 37919
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Attention is currently required from: dexter.
Hello Jenkins Builder, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/37918?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder
The change is no longer submittable: Verified is unsatisfied now.
Change subject: global_platform: fix help description for establish_scp03
......................................................................
global_platform: fix help description for establish_scp03
The argument parser object for establish_scp03 (est_scp03_parser) is
copied from est_scp02_parser. This object still has the .description
property set, which is the description for establish_scp02. To get
the description string that is defined in do_establish_scp03, we must
remove the old description string first.
Related: OS#6531
Change-Id: Ibb26bddf88b2e644a7f0c6b2a06bde228aa8afc7
---
M pySim/global_platform/__init__.py
1 file changed, 1 insertion(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/18/37918/3
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37918?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ibb26bddf88b2e644a7f0c6b2a06bde228aa8afc7
Gerrit-Change-Number: 37918
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Attention is currently required from: fixeria, laforge.
Hello Jenkins Builder, fixeria, laforge,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/pysim/+/37840?usp=email
to look at the new patch set (#9).
The following approvals got outdated and were removed:
Code-Review-1 by laforge, Verified+1 by Jenkins Builder
Change subject: ara_m: use class byte of current lchan
......................................................................
ara_m: use class byte of current lchan
The ara_m commands use APDUs with a fix class byte (0x80). This means
that all ARA-M related features only work in the basic logical channel.
To fix this, let's compute the class byte for the current logical channel
dynamically inside the send_apdu methods of SimCardCommands. This will
fix the problem globally.
Related: OS#6531
Change-Id: Ie3e48678f178a488bfaea6cc2b9a3e18145a8d10
---
M pySim-shell.py
M pySim/ara_m.py
M pySim/commands.py
3 files changed, 33 insertions(+), 26 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/40/37840/9
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37840?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie3e48678f178a488bfaea6cc2b9a3e18145a8d10
Gerrit-Change-Number: 37840
Gerrit-PatchSet: 9
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>