Added new commands and reactivated full rebuild after fixing for ARM ebuild.
Review URL: http://codereview.chromium.org/3116025
Change-Id: Ideb82562f6b1c3ce5cd9e0b79de250d0a7bd976e
diff --git a/utility/Makefile b/utility/Makefile
index 5a78c90..745cc9c 100644
--- a/utility/Makefile
+++ b/utility/Makefile
@@ -11,6 +11,7 @@
CFLAGS += $(INCLUDES)
CFLAGS += -MMD -MF $@.d
LIBS = $(HOSTLIB) $(FWLIB)
+HOSTCC = cc
BUILD_ROOT = ${BUILD}/utility
@@ -53,7 +54,7 @@
$(CC) $(CFLAGS) $(INCLUDES) $< -o $@ $(LIBS) -lcrypto
${BUILD_ROOT}/tlcl_generator: tlcl_generator.c
- $(CC) $(CFLAGS) $(INCLUDES) -fpack-struct $< -o $@
+ $(HOSTCC) $(CFLAGS) $(INCLUDES) -fpack-struct $< -o $@
${BUILD_ROOT}/vbutil_firmware: vbutil_firmware.c $(LIBS)
$(CC) $(CFLAGS) $(INCLUDES) $< -o $@ $(LIBS) -lcrypto
diff --git a/utility/tlcl_generator.c b/utility/tlcl_generator.c
index 927014d..0b8258b 100644
--- a/utility/tlcl_generator.c
+++ b/utility/tlcl_generator.c
@@ -17,7 +17,7 @@
#include <stdlib.h>
#include <tss/tcs.h>
-#include "tlcl.h"
+#include "sysincludes.h"
#include "tlcl_internal.h"
#include "tpmextras.h"
@@ -278,6 +278,25 @@
return cmd;
}
+Command* BuildGetSTClearFlagsCommand(void) {
+ int size = (kTpmRequestHeaderLength +
+ sizeof(TPM_CAPABILITY_AREA) + /* capArea */
+ sizeof(uint32_t) + /* subCapSize */
+ sizeof(uint32_t)); /* subCap */
+
+ Command* cmd = newCommand(TPM_ORD_GetCapability, size);
+ cmd->name = "tpm_getstclearflags_cmd";
+ AddInitializedField(cmd, kTpmRequestHeaderLength,
+ sizeof(TPM_CAPABILITY_AREA), TPM_CAP_FLAG);
+ AddInitializedField(cmd, kTpmRequestHeaderLength +
+ sizeof(TPM_CAPABILITY_AREA),
+ sizeof(uint32_t), sizeof(uint32_t));
+ AddInitializedField(cmd, kTpmRequestHeaderLength +
+ sizeof(TPM_CAPABILITY_AREA) + sizeof(uint32_t),
+ sizeof(uint32_t), TPM_CAP_FLAG_VOLATILE);
+ return cmd;
+}
+
Command* BuildGetPermissionsCommand(void) {
int size = (kTpmRequestHeaderLength +
sizeof(TPM_CAPABILITY_AREA) + /* capArea */
@@ -407,6 +426,7 @@
BuildPhysicalEnableCommand,
BuildPhysicalSetDeactivatedCommand,
BuildGetFlagsCommand,
+ BuildGetSTClearFlagsCommand,
BuildGetPermissionsCommand,
BuildExtendCommand,
};
diff --git a/utility/tpmc.c b/utility/tpmc.c
index b74bf1c..0213b4b 100644
--- a/utility/tpmc.c
+++ b/utility/tpmc.c
@@ -200,6 +200,52 @@
return result;
}
+static uint32_t HandlerGetPermanentFlags(void) {
+ TPM_PERMANENT_FLAGS pflags;
+ uint32_t result = TlclGetPermanentFlags(&pflags);
+ if (result == 0) {
+#define P(name) printf("%s %d\n", #name, pflags.name)
+ P(disable);
+ P(ownership);
+ P(deactivated);
+ P(readPubek);
+ P(disableOwnerClear);
+ P(allowMaintenance);
+ P(physicalPresenceLifetimeLock);
+ P(physicalPresenceHWEnable);
+ P(physicalPresenceCMDEnable);
+ P(CEKPUsed);
+ P(TPMpost);
+ P(TPMpostLock);
+ P(FIPS);
+ P(Operator);
+ P(enableRevokeEK);
+ P(nvLocked);
+ P(readSRKPub);
+ P(tpmEstablished);
+ P(maintenanceDone);
+ P(disableFullDALogicInfo);
+#undef P
+ }
+ return result;
+}
+
+static uint32_t HandlerGetSTClearFlags(void) {
+ TPM_STCLEAR_FLAGS vflags;
+ uint32_t result = TlclGetSTClearFlags(&vflags);
+ if (result == 0) {
+#define P(name) printf("%s %d\n", #name, vflags.name)
+ P(deactivated);
+ P(disableForceClear);
+ P(physicalPresence);
+ P(physicalPresenceLock);
+ P(bGlobalLock);
+#undef P
+ }
+ return result;
+}
+
+
/* Table of TPM commands.
*/
command_record command_table[] = {
@@ -232,6 +278,10 @@
HandlerRead },
{ "getpermissions", "getp", "print space permissions (getp <index>)",
HandlerGetPermissions },
+ { "getpermanentflags", "getpf", "print all permanent flags",
+ HandlerGetPermanentFlags },
+ { "getstclearflags", "getvf", "print all volatile (ST_CLEAR) flags",
+ HandlerGetSTClearFlags },
};
static int n_commands = sizeof(command_table) / sizeof(command_table[0]);