Skip to content

Commit

Permalink
Fix FPT checksum calculation for ME11
Browse files Browse the repository at this point in the history
  • Loading branch information
corna committed May 4, 2017
1 parent ba885fa commit 5184453
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion me_cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,12 @@ def relocate_partition(f, me_start, me_end, partition_header_offset,
if me11:
mef.seek(me_start + 0x10)
header = bytearray(mef.read(0x20))
header[0x0b] = 0x00
else:
mef.seek(me_start)
header = bytearray(mef.read(0x30))
checksum = (0x100 - (sum(header) - header[0x1b]) & 0xff) & 0xff
header[0x1b] = 0x00
checksum = (0x100 - sum(header) & 0xff) & 0xff

print("Correcting checksum (0x{:02x})...".format(checksum))
# The checksum is just the two's complement of the sum of the first
Expand Down

0 comments on commit 5184453

Please sign in to comment.