cmd: mvebu/bubt: Do not modify image in A8K check_image_header()

Change checksum verification code so it does require to modify image.

Signed-off-by: Pali Rohár <pali@kernel.org>
This commit is contained in:
Pali Rohár
2023-01-29 18:38:11 +01:00
committed by Stefan Roese
parent 40e3204c62
commit 7d9c083844

View File

@@ -739,18 +739,14 @@ static int check_image_header(void)
return -ENOEXEC;
}
/* The checksum value is discarded from checksum calculation */
hdr->prolog_checksum = 0;
checksum = do_checksum32((u32 *)hdr, header_len);
checksum -= hdr->prolog_checksum;
if (checksum != checksum_ref) {
printf("Error: Bad Image checksum. 0x%x != 0x%x\n",
checksum, checksum_ref);
return -ENOEXEC;
}
/* Restore the checksum before writing */
hdr->prolog_checksum = checksum_ref;
printf("Image checksum...OK!\n");
return 0;