mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-04 13:52:35 +00:00
build-docker: fix fingerprint calculation for model T production builds (#1261)
This commit is contained in:
parent
c63c727df0
commit
975f9b335e
@ -4,6 +4,7 @@ import sys
|
|||||||
import click
|
import click
|
||||||
|
|
||||||
from trezorlib import firmware
|
from trezorlib import firmware
|
||||||
|
from trezorlib._internal import firmware_headers
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@ -15,12 +16,18 @@ def firmware_fingerprint(filename, output):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
version, fw = firmware.parse(data)
|
version, fw = firmware.parse(data)
|
||||||
|
|
||||||
|
# Unsigned production builds for Trezor T do not have valid code hashes.
|
||||||
|
# Use the internal module which recomputes them first.
|
||||||
|
if version == firmware.FirmwareFormat.TREZOR_T:
|
||||||
|
fingerprint = firmware_headers.FirmwareImage(fw).digest()
|
||||||
|
else:
|
||||||
|
fingerprint = firmware.digest(version, fw)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
click.echo(e, err=True)
|
click.echo(e, err=True)
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
fingerprint = firmware.digest(version, fw).hex()
|
click.echo(fingerprint.hex(), file=output)
|
||||||
click.echo(fingerprint, file=output)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user