mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-04 04:27:34 +00:00
fix hash check computation and op offset
This commit is contained in:
parent
df12dcdd1e
commit
44d3c19733
1 changed files with 5 additions and 0 deletions
|
|
@ -186,6 +186,7 @@ def main():
|
|||
i += 4
|
||||
header_total_size = int.from_bytes(pt_data[i:i+4], 'little')
|
||||
logging.info("Header total length in bytes: {}".format(header_total_size))
|
||||
i += 4
|
||||
i += 36 # reserved
|
||||
op = int.from_bytes(pt_data[i:i+4], 'little')
|
||||
logging.info("Stored Backup Opcode: {}".format(op))
|
||||
|
|
@ -194,6 +195,10 @@ def main():
|
|||
if backup_version == 0x10001:
|
||||
logging.info("Doing hash verification of pt+ct metadata")
|
||||
hasher = SHA512.new(truncate="256")
|
||||
check_region = bytearray(check_region)
|
||||
# patch the backup opcode back to the one used to compute the checksum, because the version
|
||||
# written to disk had the opcode manipulated to "2" which instructs the system to do a restore
|
||||
check_region[140:144] = [0, 0, 0, 0]
|
||||
hasher.update(check_region)
|
||||
computed_checksum = hasher.digest()
|
||||
if computed_checksum != checksum:
|
||||
|
|
|
|||
Loading…
Reference in a new issue