| 763 | } |
| 764 | |
| 765 | static void validate_subpart_dir(struct subpart_dir *s, const char *name, |
| 766 | bool checksum_check) |
| 767 | { |
| 768 | if ((s->h.marker != SUBPART_DIR_MARKER) || |
| 769 | (s->h.header_version != SUBPART_DIR_HEADER_VERSION_SUPPORTED) || |
| 770 | (s->h.entry_version != SUBPART_DIR_ENTRY_VERSION_SUPPORTED) || |
| 771 | (s->h.header_length != SUBPART_DIR_HEADER_SIZE)) { |
| 772 | ERROR("Invalid subpart_dir for %s.\n", name); |
| 773 | exit(-1); |
| 774 | } |
| 775 | |
| 776 | if (checksum_check == false) |
| 777 | return; |
| 778 | |
| 779 | uint8_t checksum = calc_checksum(s); |
| 780 | |
| 781 | if (checksum != s->h.checksum) |
| 782 | ERROR("Invalid checksum for %s (Expected=0x%x, Actual=0x%x).\n", |
| 783 | name, checksum, s->h.checksum); |
| 784 | } |
| 785 | |
| 786 | static void validate_subpart_dir_without_checksum(struct subpart_dir *s, |
| 787 | const char *name) |
no test coverage detected