Skip to content

Commit

Permalink
[ambz2] Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
prokoma committed Dec 16, 2024
1 parent 273986b commit ccb4f94
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions ltchiptool/soc/ambz2/util/models/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

FLASH_CALIBRATION = b"\x99\x99\x96\x96\x3F\xCC\x66\xFC\xC0\x33\xCC\x03\xE5\xDC\x31\x62"

IMAGE_SIGNATURE_OFFSET = 0
IMAGE_PUBLIC_KEY_OFFSET = 32


Expand Down
6 changes: 3 additions & 3 deletions ltchiptool/soc/ambz2/util/ota.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Copyright (c) Martin Prokopič 2024-12-02

from .models.images import IMAGE_PUBLIC_KEY_OFFSET
from .models.images import IMAGE_PUBLIC_KEY_OFFSET, IMAGE_SIGNATURE_OFFSET


def patch_firmware_for_ota(data: bytes) -> bytes:
copy = bytearray(data)
copy[0] ^= 0xff # negate first signature byte
copy[IMAGE_PUBLIC_KEY_OFFSET] ^= 0xff # negate first pubkey byte
copy[IMAGE_SIGNATURE_OFFSET] ^= 0xFF # negate first signature byte
copy[IMAGE_PUBLIC_KEY_OFFSET] ^= 0xFF # negate first pubkey byte
return bytes(copy)

0 comments on commit ccb4f94

Please sign in to comment.