pldm: Add verify CRC value of the BIOS table

Add a checksum methods to the BIOS table and verify the integrity
of the BIOS table.

Tested: add the UTest method and pass the test.

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I57849714b0450b65fd894f767b15ab47de8cde89
diff --git a/libpldm/bios_table.c b/libpldm/bios_table.c
index e4e7d96..58c331b 100644
--- a/libpldm/bios_table.c
+++ b/libpldm/bios_table.c
@@ -1117,3 +1117,19 @@
 	pldm_bios_table_iter_free(iter);
 	return rc;
 }
+
+bool pldm_bios_table_checksum(const uint8_t *table, size_t size)
+{
+	if (table == NULL)
+		return false;
+
+	// 12: BIOSStringHandle(uint16) + BIOSStringLength(uint16) +
+	//     Variable(4) + checksum(uint32)
+	if (size < 12)
+		return false;
+
+	uint32_t src_crc = le32toh(*(uint32_t *)(table + size - 4));
+	uint32_t dst_crc = crc32(table, size - 4);
+
+	return src_crc == dst_crc;
+}