laforge submitted this change.

View Change


Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified
fix SimCardCommands.run_gsm(): always use CLA=0xa0

Depending on the card type (SIM or USIM/ISUM), self.cla_byte may
be either 0xa0 or 0x00. Sending RUN GSM ALGORITHM with CLA=0x00
fails with SW=6985 (Command not allowed), so let's make sure
that we always use CLA=0xa0 regardless of the card type.

Change-Id: Ia0abba136dbd4cdea8dbbc3c4d6abe12c2863680
---
M pySim/commands.py
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/pySim/commands.py b/pySim/commands.py
index d123e67..ba37876 100644
--- a/pySim/commands.py
+++ b/pySim/commands.py
@@ -407,7 +407,7 @@
if len(rand) != 32:
raise ValueError('Invalid rand')
self.select_path(['3f00', '7f20'])
- return self._tp.send_apdu(self.cla_byte + '88000010' + rand)
+ return self._tp.send_apdu('a0' + '88000010' + rand)

def authenticate(self, rand: str, autn: str, context='3g'):
"""Execute AUTHENTICATE (USIM/ISIM).

To view, visit change 31813. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ia0abba136dbd4cdea8dbbc3c4d6abe12c2863680
Gerrit-Change-Number: 31813
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge@osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-CC: fixeria <vyanitskiy@sysmocom.de>
Gerrit-MessageType: merged