laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/43988?usp=email )


Change subject: esim.saip: apply proprietaryEFInfo when the Fcp has no 
fileDescriptor
......................................................................

esim.saip: apply proprietaryEFInfo when the Fcp has no fileDescriptor

File.from_fileDescriptor() applied proprietaryEFInfo (the special file
information, the fill or repeat pattern, a BER-TLV maximum file size)
only inside the branch that decodes the Fcp's own fileDescriptor. A
file whose structure comes from its template, with an Fcp that changes
only the pattern, kept fill_pattern None, and its body was the template
default where the eUICC holds the pattern.

Apply proprietaryEFInfo to any working EF whose type is known, from the
Fcp's descriptor or from the template, in the same order as before.

The folder osmocom-pysim-saip-proprietary-efinfo-without-descriptor of
hampushellsberg-dev/PySIM-upstream-patches on GitHub has the analysis
and a repro.

Change-Id: I8b874a3c5f328a6f4c5b5f13e7bd7b641740b2df
---
M pySim/esim/saip/__init__.py
1 file changed, 19 insertions(+), 15 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/88/43988/1

diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index dc5f7ce..6887bef 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -377,21 +377,6 @@
                     self.file_type = 'TR'
                 elif fdb_dec['structure'] == 'ber_tlv':
                     self.file_type = 'BT'
-                    if 'maximumFileSize' in pefi:
-                        self._file_size = 
self._decode_file_size(pefi['maximumFileSize'])
-                specialFileInformation = pefi.get('specialFileInformation', 
None)
-                if specialFileInformation:
-                    # TS 102 222 Table 5
-                    if specialFileInformation[0] & 0x80:
-                        self.high_update = True
-                    if specialFileInformation[0] & 0x40:
-                        self.read_and_update_when_deact = True
-                if 'repeatPattern' in pefi:
-                    self.fill_pattern = pefi['repeatPattern']
-                    self.fill_pattern_repeat = True
-                if 'fillPattern' in pefi:
-                    self.fill_pattern = pefi['fillPattern']
-                    self.fill_pattern_repeat = False
             elif fdb_dec['file_type'] == 'df':
                 # only set it, if an earlier call to from_template() didn't 
already set it, as
                 # the template can differentiate between MF, DF and ADF 
(unlike FDB)
@@ -403,6 +388,25 @@
                 #raise ValueError("%s: from_fileDescriptor without nested 
'fileDescriptor'" % self)
                 pass

+        # proprietaryEFInfo applies to a working EF whether or not the Fcp 
repeats the
+        # fileDescriptor its template already defines (TCA SAIP v3.4.1 section 
8.3.3)
+        if self.file_type in ['TR', 'LF', 'CY', 'BT']:
+            if self.file_type == 'BT' and 'maximumFileSize' in pefi:
+                self._file_size = 
self._decode_file_size(pefi['maximumFileSize'])
+            specialFileInformation = pefi.get('specialFileInformation', None)
+            if specialFileInformation:
+                # TS 102 222 Table 5
+                if specialFileInformation[0] & 0x80:
+                    self.high_update = True
+                if specialFileInformation[0] & 0x40:
+                    self.read_and_update_when_deact = True
+            if 'repeatPattern' in pefi:
+                self.fill_pattern = pefi['repeatPattern']
+                self.fill_pattern_repeat = True
+            if 'fillPattern' in pefi:
+                self.fill_pattern = pefi['fillPattern']
+                self.fill_pattern_repeat = False
+
         logger.debug("\t%s" % repr(self))

     def from_tuples(self, l:List[Tuple]):

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/43988?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: I8b874a3c5f328a6f4c5b5f13e7bd7b641740b2df
Gerrit-Change-Number: 43988
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>
Gerrit-CC: hampushellsberg <[email protected]>

Reply via email to