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


Change subject: fix(ts_51_011): apply correct access conditions length
......................................................................

fix(ts_51_011): apply correct access conditions length

When the access conditions are extracted from resp_bin, the wrong length
is used and only 2 bytes instead of 3 are extracted.

3GPP TS 51.011, section 9.2.1, table below "Response parameters/data
in case of an EF", clearly states that the length should be 3 bytes
(position 9-11)

Related: OS#7018
Change-Id: I410fb58c395beafba8de6d5ab4e71452f424cdf2
---
M pySim/ts_51_011.py
M tests/unittests/test_decode_select_resp.py
2 files changed, 3 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/72/42772/1

diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py
index 4cad049..24cf5c5 100644
--- a/pySim/ts_51_011.py
+++ b/pySim/ts_51_011.py
@@ -1305,7 +1305,7 @@
                 record_len = resp_bin[14]
                 ret['file_descriptor']['record_len'] = record_len
                 ret['file_descriptor']['num_of_rec'] = ret['file_size'] // 
record_len
-            ret['access_conditions'] = b2h(resp_bin[8:10])
+            ret['access_conditions'] = b2h(resp_bin[8:11])
             if resp_bin[11] & 0x01 == 0:
                 ret['life_cycle_status_int'] = 'operational_activated'
             elif resp_bin[11] & 0x04:
diff --git a/tests/unittests/test_decode_select_resp.py 
b/tests/unittests/test_decode_select_resp.py
index bfb76cb..f8356f1 100644
--- a/tests/unittests/test_decode_select_resp.py
+++ b/tests/unittests/test_decode_select_resp.py
@@ -47,10 +47,10 @@
              "decoded" : {'file_descriptor': {'file_descriptor_byte': 
{'file_type': 'df'}}, 'proprietary_info': {'available_memory': 0}, 'file_id': 
'7f10', 'file_characteristics': '81', 'num_direct_child_df': 0, 
'num_direct_child_ef': 13, 'num_chv_unblock_adm_codes': 4}},
             # EF.MSISDN
             {"resp_hex" : "000000346f40040011ffff0102011a",
-             "decoded" : {'file_descriptor': {'file_descriptor_byte': 
{'file_type': 'working_ef', 'structure': 'linear_fixed'}, 'record_len': 26, 
'num_of_rec': 2}, 'proprietary_info': {}, 'file_id': '6f40', 'file_size': 52, 
'access_conditions': '11ff', 'life_cycle_status_int': 'terminated'}},
+             "decoded" : {'file_descriptor': {'file_descriptor_byte': 
{'file_type': 'working_ef', 'structure': 'linear_fixed'}, 'record_len': 26, 
'num_of_rec': 2}, 'proprietary_info': {}, 'file_id': '6f40', 'file_size': 52, 
'access_conditions': '11ffff', 'life_cycle_status_int': 'terminated'}},
             # EF.ICCID
             {"resp_hex" : "0000000a2fe204000cffff01020000",
-             "decoded" : {'file_descriptor': {'file_descriptor_byte': 
{'file_type': 'working_ef', 'structure': 'transparent'}}, 'proprietary_info': 
{}, 'file_id': '2fe2', 'file_size': 10, 'access_conditions': '0cff', 
'life_cycle_status_int': 'terminated'}},
+             "decoded" : {'file_descriptor': {'file_descriptor_byte': 
{'file_type': 'working_ef', 'structure': 'transparent'}}, 'proprietary_info': 
{}, 'file_id': '2fe2', 'file_size': 10, 'access_conditions': '0cffff', 
'life_cycle_status_int': 'terminated'}},
         ]
         self.decode_select_response(CardProfileSIM, testcases)


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

Reply via email to