]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd: mvebu/bubt: Do not modify image in A8K check_image_header()
authorPali Rohár <pali@kernel.org>
Sun, 29 Jan 2023 17:38:11 +0000 (18:38 +0100)
committerStefan Roese <sr@denx.de>
Wed, 1 Mar 2023 05:39:17 +0000 (06:39 +0100)
Change checksum verification code so it does require to modify image.

Signed-off-by: Pali Rohár <pali@kernel.org>
cmd/mvebu/bubt.c

index 820d342ae1005972c2adb3888e31efd00c4de2b3..1b08ca9298c287420a849e16a5f5370e51f8db4a 100644 (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;