1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

fix(core): rename fw_or_type to image_type in keyctl-proxy to avoid confusion

This commit is contained in:
Pavol Rusnak 2021-07-14 17:27:31 +02:00 committed by matejcik
parent cd9c4e478d
commit ff21ea3d5c

View File

@ -122,10 +122,10 @@ class KeyctlProxy:
@click.option(
"-l", "--listen", "ipaddr", default="0.0.0.0", help="Bind to particular ip address"
)
@click.option("-t", "--header-type", "fw_or_type", type=click.Choice(indexmap.keys()))
@click.option("-t", "--image-type", type=click.Choice(indexmap.keys()))
@click.option("-d", "--digest")
@click.argument("fw_file", type=click.File("rb"), required=False)
def cli(ipaddr, fw_file, fw_or_type, digest):
def cli(ipaddr, fw_file, image_type, digest):
"""Participate in signing of firmware.
Specify either fw_file to auto-detect type and digest, or use -t and -d to specify
@ -135,16 +135,16 @@ def cli(ipaddr, fw_file, fw_or_type, digest):
public_keys = None
if fw_file:
if fw_or_type or digest:
if image_type or digest:
raise click.ClickException("Do not specify fw_file together with -t/-d")
fw_or_type = parse_image(fw_file.read())
digest = fw_or_type.digest()
public_keys = fw_or_type.public_keys
image_type = parse_image(fw_file.read())
digest = image_type.digest()
public_keys = image_type.public_keys
click.echo(fw_or_type.format())
click.echo(image_type.format())
if not fw_file and (not fw_or_type or not digest):
if not fw_file and (not image_type or not digest):
raise click.ClickException("Please specify either fw_file or -t and -d")
try:
@ -153,10 +153,10 @@ def cli(ipaddr, fw_file, fw_or_type, digest):
except Exception as e:
raise click.ClickException("Please connect a Trezor and retry.") from e
pubkey, R = make_commit(fw_or_type, digest, public_keys)
pubkey, R = make_commit(image_type, digest, public_keys)
daemon = Pyro4.Daemon(host=ipaddr, port=PORT)
proxy = KeyctlProxy(daemon, fw_or_type, digest, (pubkey, R))
proxy = KeyctlProxy(daemon, image_type, digest, (pubkey, R))
uri = daemon.register(proxy, "keyctl")
click.echo("keyctl-proxy running at URI: {}".format(uri))
click.echo("Press Ctrl+C to abort.")