summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utility/tpmc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/utility/tpmc.c b/utility/tpmc.c
index baddee65..1e4e3026 100644
--- a/utility/tpmc.c
+++ b/utility/tpmc.c
@@ -129,6 +129,11 @@ uint8_t ErrorCheck(uint32_t result, const char* cmd) {
/* Handler functions. These wouldn't exist if C had closures.
*/
+static uint32_t HandlerTpmVersion(void) {
+ puts(TPM_MODE_STRING);
+ return 0;
+}
+
/* TODO(apronin): stub for selected flags for TPM2 */
#ifdef TPM2_MODE
static uint32_t HandlerGetFlags(void) {
@@ -465,6 +470,8 @@ static uint32_t HandlerNotImplementedForTPM2(void) {
/* Table of TPM commands.
*/
command_record command_table[] = {
+ { "tpmversion", "tpmver", "print TPM version: 1.2 or 2.0",
+ HandlerTpmVersion },
{ "getflags", "getf", "read and print the value of selected flags",
HandlerGetFlags },
{ "startup", "sta", "issue a Startup command", TlclStartup },
@@ -559,6 +566,9 @@ int main(int argc, char* argv[]) {
}
return 0;
}
+ if (!strcmp(cmd, "tpmversion") || !strcmp(cmd, "tpmver")) {
+ return HandlerTpmVersion();
+ }
result = TlclLibInit();
if (result) {