[Gnuk-users] Gnuk 1.2.3: keys for firmware upgrades

Ineiev ineiev at gnu.org
Mon May 1 07:42:06 UTC 2017


On Mon, May 01, 2017 at 01:23:13AM -0400, Ineiev wrote:
> 
> (Now I can see that there is also tool/get_raw_public_key.py,
> it does work for me.)

However, when I upload it, the script says data don't compare:

$ gnuk/tool/gnuk_put_binary_libusb.py -p -k 0 6864BCD8.bin
Admin password:
Device: 020
Configuration: 1
Interface: 0
Traceback (most recent call last):
  File "/home/dti/sda5/fst-01/fst-a01/gnuk/tool/gnuk_put_binary_libusb.py", line 111, in <module>
    main(fileid, is_update, data, passwd)
  File "/home/dti/sda5/fst-01/fst-a01/gnuk/tool/gnuk_put_binary_libusb.py", line 62, in main
    compare(data, data_in_device)
  File "/mnt/sda5/home/dti/fst-01/fst-a01/gnuk/tool/gnuk_token.py", line 580, in compare
    raise ValueError("verify failed")
ValueError: verify failed

When looking into gnuk_token.py, it turns out that data_original and
data_in_device have different types: the former is a string and
the latter is an array of integers, they don't match in Python 2.7.6.

--- a/tool/gnuk_token.py
+++ b/tool/gnuk_token.py
@@ -577,7 +577,11 @@ class regnual(object):
 def compare(data_original, data_in_device):
     if data_original == data_in_device:
         return True
-    raise ValueError("verify failed")
+    for i in range(len(data_original)):
+        if ord(data_original[i]) != data_in_device[i]:
+          print("data differ in position %i of %i" % (i, len(data_original)))
+           raise ValueError("verify failed")
+    return True

 def gnuk_devices():
     busses = usb.busses()

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/gnuk-users/attachments/20170501/065278e2/attachment.sig>


More information about the gnuk-users mailing list