1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 21:22:10 +00:00

fix(core/headertool): always rehash when inserting signature (fixes #2616)

[no changelog]
This commit is contained in:
matejcik 2022-12-15 14:18:26 +01:00 committed by matejcik
parent 253f2587dc
commit 8921a124c3

View File

@ -163,9 +163,6 @@ def cli(
if replace_vendor_header: if replace_vendor_header:
do_replace_vendorheader(fw, replace_vendor_header) do_replace_vendorheader(fw, replace_vendor_header)
if rehash:
do_rehash(fw)
if sign_dev_keys: if sign_dev_keys:
if not isinstance(fw, firmware_headers.CosiSignedImage): if not isinstance(fw, firmware_headers.CosiSignedImage):
raise click.ClickException("Can't use development keys on this image type.") raise click.ClickException("Can't use development keys on this image type.")
@ -193,6 +190,9 @@ def cli(
raise click.ClickException("Can't sign this image type.") raise click.ClickException("Can't sign this image type.")
fw.insert_signature(signature, sigmask) fw.insert_signature(signature, sigmask)
if signature or rehash:
do_rehash(fw)
click.echo(f"Detected image type: {fw.NAME}") click.echo(f"Detected image type: {fw.NAME}")
click.echo(fw.format(verbose)) click.echo(fw.format(verbose))