]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: (gpt) use blkid_probe_verify_csum() for partition array checksum
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 8 Dec 2024 08:55:27 +0000 (09:55 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 10 Dec 2024 09:58:57 +0000 (10:58 +0100)
All checksums should be tests with this function to keep checksum
validation configurable.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
(cherry picked from commit fce366c4982273cd73df727338ed02d9f357b6c6)

libblkid/src/partitions/gpt.c

index 473bf5c0e21b7fcd7d3429c131317a917f2ac2fb..a8846be21f27eeead4a0e1b7ea66987c90bf03f1 100644 (file)
@@ -294,7 +294,7 @@ static struct gpt_header *get_gpt_header(
 
        /* Validate entries */
        crc = count_crc32((unsigned char *) *ents, esz, 0, 0);
-       if (crc != le32_to_cpu(h->partition_entry_array_crc32)) {
+       if (!blkid_probe_verify_csum(pr, crc, le32_to_cpu(h->partition_entry_array_crc32))) {
                DBG(LOWPROBE, ul_debug("GPT entries corrupted"));
                return NULL;
        }