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

This reverts commit a51592e180, 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
This commit is contained in:
Harald Welte
2018-01-23 16:20:34 +01:00
parent 19fffa1db7
commit d9d2b941eb

View File

@@ -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)
else:
pin_adm = None