summaryrefslogtreecommitdiff
path: root/include/smbios.h
diff options
context:
space:
mode:
authorMasahisa Kojima <masahisa.kojima@linaro.org>2021-10-26 11:27:24 +0300
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2021-10-26 18:58:14 +0300
commit3d49ee8510d38e7fd087c7250a3f4392a38bf0dd (patch)
treee0f5d9398fb5072d38c354438ac6ce30ffeaff05 /include/smbios.h
parenta45dac1785564e1cbb876c44f3b56b05c974584e (diff)
downloadu-boot-3d49ee8510d38e7fd087c7250a3f4392a38bf0dd.tar.xz
efi_loader: add SMBIOS table measurement
TCG PC Client Platform Firmware Profile Specification requires to measure the SMBIOS table that contains static configuration information (e.g. Platform Manufacturer Enterprise Number assigned by IANA, platform model number, Vendor and Device IDs for each SMBIOS table). The device- and environment-dependent information such as serial number is cleared to zero or space character for the measurement. Existing smbios_string() function returns pointer to the string with const qualifier, but exisintg use case is updating version string and const qualifier must be removed. This commit removes const qualifier from smbios_string() return value and reuses to clear the strings for the measurement. This commit also fixes the following compiler warning: lib/smbios-parser.c:59:39: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] const struct smbios_header *header = (struct smbios_header *)entry->struct_table_address; Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Diffstat (limited to 'include/smbios.h')
-rw-r--r--include/smbios.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/smbios.h b/include/smbios.h
index aa6b6f3849..acfcbfe2ca 100644
--- a/include/smbios.h
+++ b/include/smbios.h
@@ -260,9 +260,9 @@ const struct smbios_header *smbios_header(const struct smbios_entry *entry, int
*
* @header: pointer to struct smbios_header
* @index: string index
- * @return: NULL or a valid const char pointer
+ * @return: NULL or a valid char pointer
*/
-const char *smbios_string(const struct smbios_header *header, int index);
+char *smbios_string(const struct smbios_header *header, int index);
/**
* smbios_update_version() - Update the version string
@@ -292,4 +292,17 @@ int smbios_update_version(const char *version);
*/
int smbios_update_version_full(void *smbios_tab, const char *version);
+/**
+ * smbios_prepare_measurement() - Update smbios table for the measurement
+ *
+ * TCG specification requires to measure static configuration information.
+ * This function clear the device dependent parameters such as
+ * serial number for the measurement.
+ *
+ * @entry: pointer to a struct smbios_entry
+ * @header: pointer to a struct smbios_header
+ */
+void smbios_prepare_measurement(const struct smbios_entry *entry,
+ struct smbios_header *header);
+
#endif /* _SMBIOS_H_ */