Change in pysim[master]: cards: Make select_adf_by_aid() use prefix AID selection

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Oct 21 08:07:19 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/25873 )


Change subject: cards: Make select_adf_by_aid() use prefix AID selection
......................................................................

cards: Make select_adf_by_aid() use prefix AID selection

There is no need for us to expand a partial AID to the full AID before
selecting that ADF.  The UICC specifications permit AID selection by
prefix only.  So we can pass the prefix to the card, and the card will
do the prefix matching.

>From the API user point of view, this allows us to select applications
not listed in EF.DIR

Change-Id: I0747b4e46ca7e30bd96d76053765080367ac1317
---
M pySim/cards.py
1 file changed, 4 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/73/25873/1

diff --git a/pySim/cards.py b/pySim/cards.py
index 95352ff..305ca0c 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -282,22 +282,18 @@
 			self._aids = []
 		return self._aids
 
-	# Select ADF.U/ISIM in the Card using its full AID
+	# Select ADF.U/ISIM in the Card using its AID
 	def select_adf_by_aid(self, adf="usim"):
-		# Find full AID by partial AID:
 		if is_hex(adf):
-			for aid in self._aids:
-				if len(aid) >= len(adf) and adf == aid[0:len(adf)]:
-					return self._scc.select_adf(aid)
+			return self._scc.select_adf(adf)
 		# Find full AID by application name:
 		elif adf in ["usim", "isim"]:
 			# First (known) halves of the U/ISIM AID
 			aid_map = {}
 			aid_map["usim"] = "a0000000871002"
 			aid_map["isim"] = "a0000000871004"
-			for aid in self._aids:
-				if aid_map[adf] in aid:
-					return self._scc.select_adf(aid)
+			if aid_map[adf] in aid:
+				return self._scc.select_adf(aid_map[adf])
 		return (None, None)
 
 	# Erase the contents of a file

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/25873
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I0747b4e46ca7e30bd96d76053765080367ac1317
Gerrit-Change-Number: 25873
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211021/511d5e48/attachment.htm>


More information about the gerrit-log mailing list