[S] Change in pysim[master]: prevent SimCardCommands.select_adf_by_aid bypassing lchan

2023-10-24 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/pysim/+/34849?usp=email )

 (

3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: prevent SimCardCommands.select_adf_by_aid bypassing lchan
..

prevent SimCardCommands.select_adf_by_aid bypassing lchan

Now that pySim-shell is aware of logical channels and issues almost
all of its APDUs on the currently selected channel, we must also make
sure that ADF selection by AID (implemented by the CardBase class)
issues the SELECT on the respective logical channel.

Before this patch, SELECT ADF by AID would always be issued on the
primary logical channel (0), irrespective of the currently active
RuntimeLchan.

Change-Id: Idf05c297e6a2e24ca539408b8912e348c0782bb4
Related: OS#6230
---
M pySim/cards.py
M pySim/runtime.py
2 files changed, 26 insertions(+), 5 deletions(-)

Approvals:
  Jenkins Builder: Verified
  dexter: Looks good to me, approved




diff --git a/pySim/cards.py b/pySim/cards.py
index 84f53e1..4573616 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -146,8 +146,10 @@
 return True
 return False

-def select_adf_by_aid(self, adf: str = "usim") -> Tuple[Optional[Hexstr], 
Optional[SwHexstr]]:
+def select_adf_by_aid(self, adf: str = "usim", scc: 
Optional[SimCardCommands] = None) -> Tuple[Optional[Hexstr], 
Optional[SwHexstr]]:
 """Select ADF.U/ISIM in the Card using its full AID"""
+# caller may pass a custom scc; we fall back to default
+scc = scc or self._scc
 if is_hex(adf):
 aid = adf
 else:
@@ -155,10 +157,10 @@
 if aid:
 aid_full = self._complete_aid(aid)
 if aid_full:
-return self._scc.select_adf(aid_full)
+return scc.select_adf(aid_full)
 else:
 # If we cannot get the full AID, try with short AID
-return self._scc.select_adf(aid)
+return scc.select_adf(aid)
 return (None, None)

 def card_detect(scc: SimCardCommands) -> Optional[CardBase]:
diff --git a/pySim/runtime.py b/pySim/runtime.py
index 27c2ef1..a54a1b6 100644
--- a/pySim/runtime.py
+++ b/pySim/runtime.py
@@ -299,7 +299,7 @@
 for p in inter_path:
 try:
 if isinstance(p, CardADF):
-(data, sw) = self.rs.card.select_adf_by_aid(p.aid)
+(data, sw) = self.rs.card.select_adf_by_aid(p.aid, 
scc=self.scc)
 self.selected_adf = p
 else:
 (data, sw) = self.scc.select_file(p.fid)
@@ -343,7 +343,7 @@
 f = sels[name]
 try:
 if isinstance(f, CardADF):
-(data, sw) = self.rs.card.select_adf_by_aid(f.aid)
+(data, sw) = self.rs.card.select_adf_by_aid(f.aid, 
scc=self.scc)
 else:
 (data, sw) = self.scc.select_file(f.fid)
 self.selected_file = f

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/34849?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Idf05c297e6a2e24ca539408b8912e348c0782bb4
Gerrit-Change-Number: 34849
Gerrit-PatchSet: 4
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


[S] Change in pysim[master]: prevent SimCardCommands.select_adf_by_aid bypassing lchan

2023-10-24 Thread laforge
Attention is currently required from: fixeria, laforge.

Hello Jenkins Builder, dexter, fixeria,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/pysim/+/34849?usp=email

to look at the new patch set (#4).

The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder

The change is no longer submittable: Verified is unsatisfied now.


Change subject: prevent SimCardCommands.select_adf_by_aid bypassing lchan
..

prevent SimCardCommands.select_adf_by_aid bypassing lchan

Now that pySim-shell is aware of logical channels and issues almost
all of its APDUs on the currently selected channel, we must also make
sure that ADF selection by AID (implemented by the CardBase class)
issues the SELECT on the respective logical channel.

Before this patch, SELECT ADF by AID would always be issued on the
primary logical channel (0), irrespective of the currently active
RuntimeLchan.

Change-Id: Idf05c297e6a2e24ca539408b8912e348c0782bb4
Related: OS#6230
---
M pySim/cards.py
M pySim/runtime.py
2 files changed, 26 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/49/34849/4
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/34849?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Idf05c297e6a2e24ca539408b8912e348c0782bb4
Gerrit-Change-Number: 34849
Gerrit-PatchSet: 4
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: fixeria 
Gerrit-Attention: laforge 
Gerrit-Attention: fixeria 
Gerrit-MessageType: newpatchset


[S] Change in pysim[master]: prevent SimCardCommands.select_adf_by_aid bypassing lchan

2023-10-24 Thread dexter
Attention is currently required from: fixeria, laforge.

dexter has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/34849?usp=email )

Change subject: prevent SimCardCommands.select_adf_by_aid bypassing lchan
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/pysim/+/34849?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Idf05c297e6a2e24ca539408b8912e348c0782bb4
Gerrit-Change-Number: 34849
Gerrit-PatchSet: 3
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: fixeria 
Gerrit-Attention: laforge 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Tue, 24 Oct 2023 09:32:25 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[S] Change in pysim[master]: prevent SimCardCommands.select_adf_by_aid bypassing lchan

2023-10-23 Thread laforge
Attention is currently required from: fixeria.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/34849?usp=email )

Change subject: prevent SimCardCommands.select_adf_by_aid bypassing lchan
..


Patch Set 2:

(1 comment)

File pySim/cards.py:

https://gerrit.osmocom.org/c/pysim/+/34849/comment/86a1eaea_77077d00
PS1, Line 149: SimCardCommands
> `Optional[SimCardCommands]` as it can be `None`
Done



--
To view, visit https://gerrit.osmocom.org/c/pysim/+/34849?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Idf05c297e6a2e24ca539408b8912e348c0782bb4
Gerrit-Change-Number: 34849
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Attention: fixeria 
Gerrit-Comment-Date: Mon, 23 Oct 2023 11:47:49 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: fixeria 
Gerrit-MessageType: comment


[S] Change in pysim[master]: prevent SimCardCommands.select_adf_by_aid bypassing lchan

2023-10-23 Thread laforge
Attention is currently required from: fixeria, laforge.

Hello Jenkins Builder, fixeria,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/pysim/+/34849?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Code-Review+1 by fixeria, Verified+1 by Jenkins Builder


Change subject: prevent SimCardCommands.select_adf_by_aid bypassing lchan
..

prevent SimCardCommands.select_adf_by_aid bypassing lchan

Now that pySim-shell is aware of logical channels and issues almost
all of its APDUs on the currently selected channel, we must also make
sure that ADF selection by AID (implemented by the CardBase class)
issues the SELECT on the respective logical channel.

Before this patch, SELECT ADF by AID would always be issued on the
primary logical channel (0), irrespective of the currently active
RuntimeLchan.

Change-Id: Idf05c297e6a2e24ca539408b8912e348c0782bb4
Related: OS#6230
---
M pySim/cards.py
M pySim/runtime.py
2 files changed, 26 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/49/34849/2
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/34849?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Idf05c297e6a2e24ca539408b8912e348c0782bb4
Gerrit-Change-Number: 34849
Gerrit-PatchSet: 2
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Attention: laforge 
Gerrit-Attention: fixeria 
Gerrit-MessageType: newpatchset


[S] Change in pysim[master]: prevent SimCardCommands.select_adf_by_aid bypassing lchan

2023-10-23 Thread fixeria
Attention is currently required from: laforge.

fixeria has posted comments on this change. ( 
https://gerrit.osmocom.org/c/pysim/+/34849?usp=email )

Change subject: prevent SimCardCommands.select_adf_by_aid bypassing lchan
..


Patch Set 1: Code-Review+1

(1 comment)

File pySim/cards.py:

https://gerrit.osmocom.org/c/pysim/+/34849/comment/bdd219c9_533d75ab
PS1, Line 149: SimCardCommands
`Optional[SimCardCommands]` as it can be `None`



--
To view, visit https://gerrit.osmocom.org/c/pysim/+/34849?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Idf05c297e6a2e24ca539408b8912e348c0782bb4
Gerrit-Change-Number: 34849
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Attention: laforge 
Gerrit-Comment-Date: Mon, 23 Oct 2023 06:57:06 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[S] Change in pysim[master]: prevent SimCardCommands.select_adf_by_aid bypassing lchan

2023-10-22 Thread laforge
laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/34849?usp=email )


Change subject: prevent SimCardCommands.select_adf_by_aid bypassing lchan
..

prevent SimCardCommands.select_adf_by_aid bypassing lchan

Now that pySim-shell is aware of logical channels and issues almost
all of its APDUs on the currently selected channel, we must also make
sure that ADF selection by AID (implemented by the CardBase class)
issues the SELECT on the respective logical channel.

Before this patch, SELECT ADF by AID would always be issued on the
primary logical channel (0), irrespective of the currently active
RuntimeLchan.

Change-Id: Idf05c297e6a2e24ca539408b8912e348c0782bb4
Related: OS#6230
---
M pySim/cards.py
M pySim/runtime.py
2 files changed, 26 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/49/34849/1

diff --git a/pySim/cards.py b/pySim/cards.py
index 84f53e1..a241d1c 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -146,8 +146,10 @@
 return True
 return False

-def select_adf_by_aid(self, adf: str = "usim") -> Tuple[Optional[Hexstr], 
Optional[SwHexstr]]:
+def select_adf_by_aid(self, adf: str = "usim", scc: SimCardCommands = 
None) -> Tuple[Optional[Hexstr], Optional[SwHexstr]]:
 """Select ADF.U/ISIM in the Card using its full AID"""
+# caller may pass a custom scc; we fall back to default
+scc = scc or self._scc
 if is_hex(adf):
 aid = adf
 else:
@@ -155,10 +157,10 @@
 if aid:
 aid_full = self._complete_aid(aid)
 if aid_full:
-return self._scc.select_adf(aid_full)
+return scc.select_adf(aid_full)
 else:
 # If we cannot get the full AID, try with short AID
-return self._scc.select_adf(aid)
+return scc.select_adf(aid)
 return (None, None)

 def card_detect(scc: SimCardCommands) -> Optional[CardBase]:
diff --git a/pySim/runtime.py b/pySim/runtime.py
index 27c2ef1..a54a1b6 100644
--- a/pySim/runtime.py
+++ b/pySim/runtime.py
@@ -299,7 +299,7 @@
 for p in inter_path:
 try:
 if isinstance(p, CardADF):
-(data, sw) = self.rs.card.select_adf_by_aid(p.aid)
+(data, sw) = self.rs.card.select_adf_by_aid(p.aid, 
scc=self.scc)
 self.selected_adf = p
 else:
 (data, sw) = self.scc.select_file(p.fid)
@@ -343,7 +343,7 @@
 f = sels[name]
 try:
 if isinstance(f, CardADF):
-(data, sw) = self.rs.card.select_adf_by_aid(f.aid)
+(data, sw) = self.rs.card.select_adf_by_aid(f.aid, 
scc=self.scc)
 else:
 (data, sw) = self.scc.select_file(f.fid)
 self.selected_file = f

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/34849?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Idf05c297e6a2e24ca539408b8912e348c0782bb4
Gerrit-Change-Number: 34849
Gerrit-PatchSet: 1
Gerrit-Owner: laforge 
Gerrit-MessageType: newchange