laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37937?usp=email )
Change subject: commands: avoid double lchan patching, get rid of cla_byte getter+setter methods
......................................................................
commands: avoid double lchan patching, get rid of cla_byte getter+setter methods
The SimCardCommands has a cla_byte @property method, which automatically
returns the lchan patched CLA byte. We use cla_byte property to build
the UICC command APDUs inside SimCardCommands and then we hand the APDU
over to the send_apdu* methods. The cla_byte @property method as well
as the send_apdu* methods perform the lchan patching. This means the CLA
byte gets patched twice, which is technically not an issue, but can be
confusing when trying to understand the code.
To fix this, let's remove the @property methods and turn cla_byte into
a normal property again. This is also more accurate since the cla_byte
property originally was introduced to switch between UICC and classic
SIM APDU commands, which have almost identcal APDUs.
Related: OS#6531
Change-Id: I420f8a5f7ff8d9e5ef94d6519fb3716d6c7caf64
---
M pySim/commands.py
1 file changed, 1 insertion(+), 12 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim/commands.py b/pySim/commands.py
index 656f71a..f13e18b 100644
--- a/pySim/commands.py
+++ b/pySim/commands.py
@@ -66,7 +66,6 @@
byte by the respective instance. """
def __init__(self, transport: LinkBase, lchan_nr: int = 0):
self._tp = transport
- self._cla_byte = None
self.sel_ctrl = "0000"
self.lchan_nr = lchan_nr
# invokes the setter below
@@ -76,16 +75,11 @@
def fork_lchan(self, lchan_nr: int) -> 'SimCardCommands':
"""Fork a per-lchan specific SimCardCommands instance off the current instance."""
ret = SimCardCommands(transport = self._tp, lchan_nr = lchan_nr)
- ret.cla_byte = self._cla_byte
+ ret.cla_byte = self.cla_byte
ret.sel_ctrl = self.sel_ctrl
return ret
@property
- def cla_byte(self) -> Hexstr:
- """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:
"""Maximum length of the command apdu data section. Depends on secure channel protocol used."""
if self.scp:
@@ -93,11 +87,6 @@
else:
return 255
- @cla_byte.setter
- def cla_byte(self, new_val: Hexstr):
- """Set the (raw, without lchan) default CLA value for this card."""
- self._cla_byte = new_val
-
def send_apdu(self, pdu: Hexstr, apply_lchan:bool = True) -> ResTuple:
"""Sends an APDU and auto fetch response data
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37937?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: I420f8a5f7ff8d9e5ef94d6519fb3716d6c7caf64
Gerrit-Change-Number: 37937
Gerrit-PatchSet: 4
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>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38010?usp=email )
Change subject: pySim.esim.saip: Another naming irregularity.
......................................................................
pySim.esim.saip: Another naming irregularity.
The choice member is called df-5gprose but the header is called
'df-5g-prose-header' (note the '-' between '5g' and 'prose'). WTF.
Change-Id: I86004ac2e18a187c26c5e470344908512d21fb9e
---
M pySim/esim/saip/__init__.py
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index bf39025..7b4d04e 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -386,6 +386,7 @@
'pukCodes': 'puk-Header',
'pinCodes': 'pin-Header',
'securityDomain': 'sd-Header',
+ 'df-5gprose': 'df-5g-prose-header',
}
def __init__(self, decoded = None, mandated: bool = True,
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38010?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: I86004ac2e18a187c26c5e470344908512d21fb9e
Gerrit-Change-Number: 38010
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/38016?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: esim.saip.templates: Fix expand_default_value_pattern for length==0
......................................................................
esim.saip.templates: Fix expand_default_value_pattern for length==0
The original code treated length==0 like length==None (unspecified),
which is wrong.
Change-Id: I39fa1e2b1b9d6d1c671ea37bdbec1d6f97e8a5e7
---
M pySim/esim/saip/templates.py
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/pySim/esim/saip/templates.py b/pySim/esim/saip/templates.py
index 04b2cd4..f69ec7a 100644
--- a/pySim/esim/saip/templates.py
+++ b/pySim/esim/saip/templates.py
@@ -117,9 +117,9 @@
def expand_default_value_pattern(self, length: Optional[int] = None) -> Optional[bytes]:
"""Expand the default value pattern to the specified length."""
- if not length:
+ if length is None:
length = self._default_value_len()
- if not length:
+ if length is None:
raise ValueError("%s does not have a default length" % self)
if not self.default_val:
return None
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/38016?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: I39fa1e2b1b9d6d1c671ea37bdbec1d6f97e8a5e7
Gerrit-Change-Number: 38016
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/37966?usp=email )
Change subject: contrib/jenkins.sh: Install dependencies before calling pylint
......................................................................
contrib/jenkins.sh: Install dependencies before calling pylint
This is the only way we can make sure pylint has all required
information about imports from packages we depend upon.
Change-Id: I29582aa3d7f9ace9ce832d5b907420aaf14881fb
---
M contrib/jenkins.sh
1 file changed, 6 insertions(+), 0 deletions(-)
Approvals:
fixeria: Looks good to me, but someone else must approve
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index b3d83dd..5356fcb 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -51,6 +51,12 @@
"pylint")
# Print pylint version
pip3 freeze | grep pylint
+
+ virtualenv -p python3 venv --system-site-packages
+ . venv/bin/activate
+
+ pip install .
+
# Run pylint to find potential errors
# Ignore E1102: not-callable
# pySim/filesystem.py: E1102: method is not callable (not-callable)
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37966?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: I29582aa3d7f9ace9ce832d5b907420aaf14881fb
Gerrit-Change-Number: 37966
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>