mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-23 07:58:09 +00:00
e2abd2a9ad
Removed oldest v1 style of firmware signature and presence checks. Added debug helpers for T1 signatures. Support for v2 and v3 signatures, but can only update FW to v3-style signed. Support for debugging T1 signatures. Scripts and README for debugging v2/v3 FW signing scheme. Firmware in GetFeatures counts only v3 signatures as signed. Add documentation and comments about signing schemes like a sane person
20 lines
481 B
Python
Executable File
20 lines
481 B
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import sys
|
|
|
|
TOTALSIZE = 32768
|
|
MAXSIZE = TOTALSIZE - 32
|
|
|
|
infile = sys.argv[1]
|
|
outfile = sys.argv[2]
|
|
fs = os.stat(infile).st_size
|
|
print(f"Current bootloader size before align is {fs} bytes")
|
|
if fs > MAXSIZE:
|
|
raise Exception(
|
|
f"bootloader has to be smaller than {MAXSIZE} bytes (current size is {fs})"
|
|
)
|
|
with open(outfile, "wb") as f:
|
|
with open(infile, "rb") as i:
|
|
f.write(i.read())
|
|
f.write(b"\x00" * (TOTALSIZE - fs))
|