dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/39057?usp=email )
Change subject: ara_m fix export of AID-REF-DO (empty) ......................................................................
ara_m fix export of AID-REF-DO (empty)
GPD_SPE_013 Table 6-3 defines two types of AID-REF-DO objects (both are fully independed TLV IEs with the same name). The version with tag '4F' identifies an SE application. It may contain an AID prefix or even be of length 0 in case the rule should apply to all SE applications. Then there is the version with tag 'C0', which must always have length 0 and serves a flag to apply the rule to the implicitly selected SE application. Technically both are completely different things, so we must also treat them separately in the pySim-shell code.
Related: OS#6681 Change-Id: I771d5e860b12215280e3d0a8c314ce843fe0d6a2 --- M pySim/ara_m.py 1 file changed, 11 insertions(+), 7 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/57/39057/1
diff --git a/pySim/ara_m.py b/pySim/ara_m.py index 63838b2..611e8f7 100644 --- a/pySim/ara_m.py +++ b/pySim/ara_m.py @@ -320,9 +320,9 @@ '--device-app-id', required=True, help='Identifies the specific device application that the rule appplies to. Hash of Certificate of Application Provider, or UUID. (20/32 hex bytes)') aid_grp = store_ref_ar_do_parse.add_mutually_exclusive_group() aid_grp.add_argument( - '--aid', help='Identifies the specific SE application for which rules are to be stored. Can be a partial AID, containing for example only the RID. (5-16 hex bytes)') + '--aid', help='Identifies the specific SE application for which rules are to be stored. Can be a partial AID, containing for example only the RID. (5-16 or 0 hex bytes)') aid_grp.add_argument('--aid-empty', action='store_true', - help='No specific SE application, applies to all applications') + help='No specific SE application, applies to implicitly selected application (all channels)') store_ref_ar_do_parse.add_argument( '--pkg-ref', help='Full Android Java package name (up to 127 chars ASCII)') # AR-DO @@ -423,10 +423,13 @@ # matching key. if dictlist is None: return None - obj = None for d in dictlist: - obj = d.get(key, obj) - return obj + if key in d: + obj = d.get(key) + if obj is None: + return "" + return obj + return None
@staticmethod def __export_ref_ar_do_list(ref_ar_do_list): @@ -437,6 +440,7 @@ if ref_do_list and ar_do_list: # Get ref_do parameters aid_ref_do = CardApplicationARAM.__export_get_from_dictlist('aid_ref_do', ref_do_list) + aid_ref_empty_do = CardApplicationARAM.__export_get_from_dictlist('aid_ref_empty_do', ref_do_list) dev_app_id_ref_do = CardApplicationARAM.__export_get_from_dictlist('dev_app_id_ref_do', ref_do_list) pkg_ref_do = CardApplicationARAM.__export_get_from_dictlist('pkg_ref_do', ref_do_list)
@@ -447,9 +451,9 @@
# Write command-line export_str += "aram_store_ref_ar_do" - if aid_ref_do: + if aid_ref_do is not None: export_str += (" --aid "%s"" % aid_ref_do) - else: + if aid_ref_empty_do is not None: export_str += " --aid-empty" if dev_app_id_ref_do: export_str += (" --device-app-id "%s"" % dev_app_id_ref_do)