diff options
authorHarald Welte <laforge@gnumonks.org>2018-01-23 16:20:34 +0100
committerHarald Welte <laforge@gnumonks.org>2018-01-23 16:25:55 +0100
commitd9d2b941eb2f8f1566767ed4957295fb391a999d (patch)
parent19fffa1db760cca15a2689695f3cc14be1933513 (diff)
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
1 files changed, 4 insertions, 3 deletions
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 @@ def gen_parameters(opts):
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)
pin_adm = None