From 5560a35af7f56774a55c65449c666532cadb0107 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Thu, 21 Feb 2019 16:18:49 +0100 Subject: [PATCH] tools: fix keyctl-proxy --- tools/keyctl-proxy | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/keyctl-proxy b/tools/keyctl-proxy index 2ec3c0430c..9633afeb1a 100755 --- a/tools/keyctl-proxy +++ b/tools/keyctl-proxy @@ -1,8 +1,11 @@ #!/usr/bin/env python3 import binascii import sys +import traceback + import Pyro4 import serpent +from trezorlib import cosi, tools PORT = 5001 indexmap = {"bootloader": 0, "vendorheader": 1, "firmware": 2} @@ -11,8 +14,9 @@ indexmap = {"bootloader": 0, "vendorheader": 1, "firmware": 2} def get_trezor(): from trezorlib.client import TrezorClient from trezorlib.transport import get_transport + from trezorlib.ui import ClickUI - return TrezorClient(get_transport()) + return TrezorClient(get_transport(), ui=ClickUI()) def get_path(index): @@ -32,9 +36,10 @@ class KeyctlProxy(object): "\n\n\nCommiting to hash %s with path %s:" % (binascii.hexlify(digest).decode(), path) ) - commit = t.cosi_commit(t.expand_path(path), digest) + commit = cosi.commit(t, tools.parse_path(path), digest) except Exception as e: print(e) + traceback.print_exc() print("Trying again ...") pk = commit.pubkey R = commit.commitment @@ -56,11 +61,12 @@ class KeyctlProxy(object): "\n\n\nSigning hash %s with path %s:" % (binascii.hexlify(digest).decode(), path) ) - signature = t.cosi_sign( - t.expand_path(path), digest, global_R, global_pk + signature = cosi.sign( + t, tools.parse_path(path), digest, global_R, global_pk ) except Exception as e: print(e) + traceback.print_exc() print("Trying again ...") sig = signature.signature print("Signature sent!")