summaryrefslogtreecommitdiff
path: root/utility
diff options
context:
space:
mode:
authorMattias Nissler <mnissler@chromium.org>2017-07-07 10:26:43 +0200
committerchrome-bot <chrome-bot@chromium.org>2017-08-23 17:01:24 -0700
commitb2b3970923b7971acf78b11d5678ddc3a3a23521 (patch)
treeae86830209d4952c67a6e266991c529b35efea41 /utility
parent509339ce2b7499ccb90331ab6910b87d0f9889a5 (diff)
downloadvboot-b2b3970923b7971acf78b11d5678ddc3a3a23521.tar.gz
Add support for IFX FieldUpgradeInfoRequest2 command
Add tpm_lite library support for the IFX specific TPM_FieldUpgrade subcommand "FieldUpgradeInfoRequest2". Expose this via tpmc so it can be used from shell scripts. BRANCH=none BUG=chromium:728130 TEST=Builds and tpmc ifxfieldupgradeinfo prints plausible results. Change-Id: Ie58ebccef7fe90f7fca65d7cd9c78e1f16f9f29a Reviewed-on: https://chromium-review.googlesource.com/562772 Commit-Ready: Mattias Nissler <mnissler@chromium.org> Tested-by: Mattias Nissler <mnissler@chromium.org> Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Diffstat (limited to 'utility')
-rw-r--r--utility/tlcl_generator.c16
-rw-r--r--utility/tpmc.c28
2 files changed, 44 insertions, 0 deletions
diff --git a/utility/tlcl_generator.c b/utility/tlcl_generator.c
index 70ce5fd9..bb7ed819 100644
--- a/utility/tlcl_generator.c
+++ b/utility/tlcl_generator.c
@@ -404,6 +404,21 @@ Command* BuildGetVersionValCommand(void) {
return cmd;
}
+Command* BuildIFXFieldUpgradeInfoRequest2Command(void) {
+ int size = (kTpmRequestHeaderLength +
+ sizeof(TPM_IFX_FieldUpgradeInfoRequest2) +
+ sizeof(uint16_t));
+ Command* cmd = newCommand(TPM_ORD_FieldUpgrade, size);
+ cmd->name = "tpm_ifx_fieldupgradeinforequest2_cmd";
+ AddInitializedField(cmd, kTpmRequestHeaderLength,
+ sizeof(TPM_IFX_FieldUpgradeInfoRequest2),
+ TPM_IFX_FieldUpgradeInfoRequest2);
+ AddInitializedField(cmd, kTpmRequestHeaderLength +
+ sizeof(TPM_IFX_FieldUpgradeInfoRequest2),
+ sizeof(uint16_t), 0);
+ return cmd;
+}
+
/* Output the fields of a structure.
*/
void OutputFields(Field* fld) {
@@ -526,6 +541,7 @@ Command* (*builders[])(void) = {
BuildGetRandomCommand,
BuildExtendCommand,
BuildGetVersionValCommand,
+ BuildIFXFieldUpgradeInfoRequest2Command,
};
static void FreeFields(Field* fld) {
diff --git a/utility/tpmc.c b/utility/tpmc.c
index ae45ca1c..a36f7e94 100644
--- a/utility/tpmc.c
+++ b/utility/tpmc.c
@@ -468,6 +468,31 @@ static uint32_t HandlerGetVersion(void) {
return result;
}
+#ifndef TPM2_MODE
+static void PrintIFXFirmwarePackage(TPM_IFX_FIRMWAREPACKAGE* firmware_package,
+ const char* prefix) {
+ printf("%s_package_id %08x\n", prefix,
+ firmware_package->FwPackageIdentifier);
+ printf("%s_version %08x\n", prefix, firmware_package->Version);
+ printf("%s_stale_version %08x\n", prefix, firmware_package->StaleVersion);
+}
+
+static uint32_t HandlerIFXFieldUpgradeInfo(void) {
+ TPM_IFX_FIELDUPGRADEINFO info;
+ uint32_t result = TlclIFXFieldUpgradeInfo(&info);
+ if (result == 0) {
+ printf("max_data_size %u\n", info.wMaxDataSize);
+ PrintIFXFirmwarePackage(&info.sBootloaderFirmwarePackage, "bootloader");
+ PrintIFXFirmwarePackage(&info.sFirmwarePackages[0], "fw0");
+ PrintIFXFirmwarePackage(&info.sFirmwarePackages[1], "fw1");
+ printf("status %04x\n", info.wSecurityModuleStatus);
+ PrintIFXFirmwarePackage(&info.sProcessFirmwarePackage, "process_fw");
+ printf("field_upgrade_counter %u\n", info.wFieldUpgradeCounter);
+ }
+ return result;
+}
+#endif
+
#ifdef TPM2_MODE
static uint32_t HandlerDoNothingForTPM2(void) {
return 0;
@@ -548,6 +573,9 @@ command_record command_table[] = {
HandlerSendRaw },
{ "getversion", "getver", "get TPM vendor and firmware version",
HandlerGetVersion },
+ { "ifxfieldupgradeinfo", "ifxfui",
+ TPM20_NOT_IMPLEMENTED("read and print IFX field upgrade info",
+ HandlerIFXFieldUpgradeInfo) },
};
static int n_commands = sizeof(command_table) / sizeof(command_table[0]);