mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-15 19:08:07 +00:00
24 lines
617 B
Python
Executable File
24 lines
617 B
Python
Executable File
#!/usr/bin/env python3
|
|
import json
|
|
|
|
import click
|
|
|
|
from trezorlib import firmware
|
|
|
|
|
|
@click.command()
|
|
@click.argument("specfile", type=click.File("r"))
|
|
@click.argument("image", type=click.File("rb"))
|
|
@click.argument("outfile", type=click.File("wb"))
|
|
def build_vendorheader(specfile, image, outfile):
|
|
spec = json.load(specfile)
|
|
spec["pubkeys"] = [bytes.fromhex(k) for k in spec["pubkeys"]]
|
|
spec["image"] = firmware.Toif.parse(image.read())
|
|
spec["sigmask"] = 0
|
|
spec["signature"] = b"\x00" * 64
|
|
outfile.write(firmware.VendorHeader.build(spec))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
build_vendorheader()
|