mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-16 04:29:08 +00:00
core/tools: cleanly shut down keyctl-proxy after signing
This commit is contained in:
parent
e9c68d7397
commit
ccacada37c
@ -90,6 +90,9 @@ def process_remote_signers(fw, addrs: List[str]) -> Tuple[int, List[bytes]]:
|
|||||||
sigs.append(sig)
|
sigs.append(sig)
|
||||||
click.echo("OK")
|
click.echo("OK")
|
||||||
|
|
||||||
|
for _, proxy in proxies:
|
||||||
|
proxy.finish()
|
||||||
|
|
||||||
# compute global signature
|
# compute global signature
|
||||||
return sigmask, cosi.combine_sig(global_R, sigs)
|
return sigmask, cosi.combine_sig(global_R, sigs)
|
||||||
|
|
||||||
|
@ -57,7 +57,10 @@ def make_commit(name, index, digest):
|
|||||||
|
|
||||||
@Pyro4.expose
|
@Pyro4.expose
|
||||||
class KeyctlProxy:
|
class KeyctlProxy:
|
||||||
def __init__(self, image_type, digest: bytes, commit: Tuple[bytes, bytes]) -> None:
|
def __init__(
|
||||||
|
self, daemon, image_type, digest: bytes, commit: Tuple[bytes, bytes]
|
||||||
|
) -> None:
|
||||||
|
self.daemon = daemon
|
||||||
self.name = image_type.NAME
|
self.name = image_type.NAME
|
||||||
self.address_n = parse_path(PATH.format(image_type.BIP32_INDEX))
|
self.address_n = parse_path(PATH.format(image_type.BIP32_INDEX))
|
||||||
self.digest = digest
|
self.digest = digest
|
||||||
@ -88,6 +91,11 @@ class KeyctlProxy:
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
click.echo("Trying again ...")
|
click.echo("Trying again ...")
|
||||||
|
|
||||||
|
@Pyro4.oneway
|
||||||
|
def finish(self):
|
||||||
|
click.echo("Done! \\(^o^)/")
|
||||||
|
self.daemon.shutdown()
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@click.option(
|
@click.option(
|
||||||
@ -125,7 +133,7 @@ def cli(ipaddr, fw_file, fw_or_type, digest):
|
|||||||
break
|
break
|
||||||
|
|
||||||
daemon = Pyro4.Daemon(host=ipaddr, port=PORT)
|
daemon = Pyro4.Daemon(host=ipaddr, port=PORT)
|
||||||
proxy = KeyctlProxy(fw_or_type, digest, (pubkey, R))
|
proxy = KeyctlProxy(daemon, fw_or_type, digest, (pubkey, R))
|
||||||
uri = daemon.register(proxy, "keyctl")
|
uri = daemon.register(proxy, "keyctl")
|
||||||
click.echo(f"keyctl-proxy running at URI: {uri}")
|
click.echo(f"keyctl-proxy running at URI: {uri}")
|
||||||
click.echo("Press Ctrl+C to abort.")
|
click.echo("Press Ctrl+C to abort.")
|
||||||
|
Loading…
Reference in New Issue
Block a user