Review at  https://gerrit.osmocom.org/5999

Revert "pySim-prog: ADM code can be longer 8 digits, it's implementation 
specific."

This reverts commit a51592e1807c1d13f88b32275aa4a8a77d7d3b40, which
broke the use of ADM pins on sysmoUSIM-SJS1 (and possibly others?)

The ADM pins have so far always been specified as ASCII decimal digits,
i.e. something like "-a 53204025" gets translated to hex "3533323034303235"

After the above patch this is broken and gets instead translated to
"53204025ffffffff" in hex which obviously breaks.  Let's revert back to
the old behavior to make it work again.

Change-Id: I3d68b7e09938a2fcb7a9a6a31048388cc3141f79
---
M pySim-prog.py
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/99/5999/1

diff --git a/pySim-prog.py b/pySim-prog.py
index c08f43b..f27daf0 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -361,9 +361,10 @@
                opc = ''.join(['%02x' % random.randrange(0,256) for i in 
range(16)])
 
        if opts.pin_adm is not None:
-               pin_adm = opts.pin_adm
-               if not re.match('^([0-9a-fA-F][0-9a-fA-F])+$', pin_adm):
-                       raise ValueError('ADM pin needs to be in hex format 
(even number of hex digits)')
+               if len(opts.pin_adm) > 8:
+                       raise ValueError("PIN-ADM needs to be <=8 digits")
+               pin_adm = ''.join(['%02x'%(ord(x)) for x in opts.pin_adm])
+               pin_adm = rpad(pin_adm, 16)
        else:
                pin_adm = None
 

-- 
To view, visit https://gerrit.osmocom.org/5999
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d68b7e09938a2fcb7a9a6a31048388cc3141f79
Gerrit-PatchSet: 1
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <lafo...@gnumonks.org>

Reply via email to