Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

releases/describe_signed_firmware: add helpful error msg #1180

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions releases/describe_signed_firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,19 @@ def main() -> int:
magic, rest = signed_firmware[:MAGIC_LEN], signed_firmware[MAGIC_LEN:]
sigdata, firmware = rest[:SIGDATA_LEN], rest[SIGDATA_LEN:]

print(
"The following information assumes the provided binary was signed correctly; "
"the signatures are not being verified."
)
if magic == MAGIC_MULTI:
print("This is a Multi-edition firmware.")
elif magic == MAGIC_BTCONLY:
print("This is a Bitcoin-only edition firmware.")
else:
print("Unrecognized firmware edition; magic =", magic.hex())
print(
f"Unrecognized firmware edition; magic = f{magic.hex()}. Maybe you have accidentally invoked this script on an unsigned binary. Make sure to use a signed firmware binary."
)
return 1
print(
"The following information assumes the provided binary was signed correctly; "
"the signatures are not being verified."
)

firmware_padded = firmware + b"\xFF" * (MAX_FIRMWARE_SIZE - len(firmware))

Expand Down
Loading