MCPcopy Create free account
hub / github.com/coreboot/coreboot / validate_subpart_dir

Function validate_subpart_dir

util/cbfstool/ifwitool.c:765–784  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

763}
764
765static 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
786static void validate_subpart_dir_without_checksum(struct subpart_dir *s,
787 const char *name)

Calls 2

exitFunction · 0.85
calc_checksumFunction · 0.70

Tested by

no test coverage detected