mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-17 21:22:10 +00:00
fix(core): don't use format strings in keyctl-proxy
This commit is contained in:
parent
3d69ca1b1b
commit
0a951b8a77
1
core/.changelog.d/1707.fixed
Normal file
1
core/.changelog.d/1707.fixed
Normal file
@ -0,0 +1 @@
|
||||
Don't use format strings in keyctl-proxy
|
@ -36,24 +36,24 @@ def make_commit(fw_or_type, digest, public_keys):
|
||||
|
||||
# device information - show only first time
|
||||
click.echo(
|
||||
f"\nUsing device {click.style(TREZOR.features.label, bold=True)} "
|
||||
f"at path {TREZOR.transport.get_path()}"
|
||||
"\nUsing device {} ".format(click.style(TREZOR.features.label, bold=True)) +
|
||||
"at path {}".format(TREZOR.transport.get_path())
|
||||
)
|
||||
|
||||
while True:
|
||||
# signing information - repeat every time
|
||||
click.echo(f"Commiting to {click.style(fw_or_type.NAME, bold=True)} hash:")
|
||||
click.echo("Commiting to {} hash:".format(click.style(fw_or_type.NAME, bold=True)))
|
||||
for partid in range(4):
|
||||
digest_part = digest[partid * 8 : (partid + 1) * 8]
|
||||
color = "red" if partid % 2 else "cyan"
|
||||
digest_str = click.style(digest_part.hex().upper(), fg=color)
|
||||
click.echo("\t" + digest_str)
|
||||
click.echo(f"Using path: {click.style(path, bold=True)}")
|
||||
click.echo("Using path: {}".format(click.style(path, bold=True)))
|
||||
|
||||
try:
|
||||
commit = cosi.commit(TREZOR, address_n, digest)
|
||||
if public_keys is not None and commit.pubkey not in public_keys:
|
||||
click.echo(f"\n\nPublic key {commit.pubkey.hex()} is unknown.")
|
||||
click.echo("\n\nPublic key {} is unknown.".format(commit.pubkey.hex()))
|
||||
if click.confirm("Retry with a different passphrase?", default=True):
|
||||
TREZOR.init_device()
|
||||
continue
|
||||
@ -80,8 +80,8 @@ class KeyctlProxy:
|
||||
|
||||
def _check_name_digest(self, name, digest):
|
||||
if name != self.name or digest != self.digest:
|
||||
click.echo(f"ERROR! Remote wants to sign {name} with digest {digest.hex()}")
|
||||
click.echo(f"Expected: {self.name} with digest {self.digest.hex()}")
|
||||
click.echo("ERROR! Remote wants to sign {} with digest {}".format(name, digest.hex()))
|
||||
click.echo("Expected: {} with digest {}".format(self.name, self.digest.hex()))
|
||||
raise ValueError("Unexpected index/digest")
|
||||
|
||||
def get_commit(self, name, digest):
|
||||
@ -158,7 +158,7 @@ def cli(ipaddr, fw_file, fw_or_type, digest):
|
||||
daemon = Pyro4.Daemon(host=ipaddr, port=PORT)
|
||||
proxy = KeyctlProxy(daemon, fw_or_type, digest, (pubkey, R))
|
||||
uri = daemon.register(proxy, "keyctl")
|
||||
click.echo(f"keyctl-proxy running at URI: {uri}")
|
||||
click.echo("keyctl-proxy running at URI: {}".format(uri))
|
||||
click.echo("Press Ctrl+C to abort.")
|
||||
daemon.requestLoop()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user