diff --git a/common/tpm_registers.c b/common/tpm_registers.c index 3236c7d8a5..da8b75c023 100644 --- a/common/tpm_registers.c +++ b/common/tpm_registers.c @@ -109,7 +109,13 @@ enum tpm_sts_bits { /* Used to count bytes read in version string */ static int tpm_fw_ver_index; -static uint8_t tpm_fw_ver[180]; +/* + * Used to store the full version string, which includes version of the two RO + * and two RW regions in the flash as well as the version string of the four + * cr50 image components. The number is somewhat arbitrary, calculated for the + * worst case scenario when all compontent trees are 'dirty'. + */ +static uint8_t tpm_fw_ver[260]; /* * We need to be able to report firmware version to the host, both RO and RW @@ -155,6 +161,12 @@ static void set_version_string(void) " RW_B:%s %s", (active_rw == SYSTEM_IMAGE_RW_B ? "*" : ""), system_get_version(SYSTEM_IMAGE_RW_B)); + offset = strlen(tpm_fw_ver); + if (offset == sizeof(tpm_fw_ver) - 1) + return; + + snprintf(tpm_fw_ver + offset, sizeof(tpm_fw_ver) - offset, + "\n%s", system_get_build_info()); } static void set_tpm_state(enum tpm_states state)