OLD | NEW |
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 * | 4 * |
5 * TPM command utility. Runs simple TPM commands. Mostly useful when physical | 5 * TPM command utility. Runs simple TPM commands. Mostly useful when physical |
6 * presence has not been locked. | 6 * presence has not been locked. |
7 */ | 7 */ |
8 | 8 |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 */ | 250 */ |
251 command_record command_table[] = { | 251 command_record command_table[] = { |
252 { "getflags", "getf", "read and print the value of selected flags", | 252 { "getflags", "getf", "read and print the value of selected flags", |
253 HandlerGetFlags }, | 253 HandlerGetFlags }, |
254 { "startup", "sta", "issue a Startup command", TlclStartup }, | 254 { "startup", "sta", "issue a Startup command", TlclStartup }, |
255 { "selftestfull", "test", "issue a SelfTestFull command", TlclSelfTestFull }, | 255 { "selftestfull", "test", "issue a SelfTestFull command", TlclSelfTestFull }, |
256 { "continueselftest", "ctest", "issue a ContinueSelfTest command", | 256 { "continueselftest", "ctest", "issue a ContinueSelfTest command", |
257 TlclContinueSelfTest }, | 257 TlclContinueSelfTest }, |
258 { "assertphysicalpresence", "ppon", "assert Physical Presence", | 258 { "assertphysicalpresence", "ppon", "assert Physical Presence", |
259 TlclAssertPhysicalPresence }, | 259 TlclAssertPhysicalPresence }, |
| 260 { "physicalpresencecmdenable", "ppcmd", "turn on software PP", |
| 261 TlclPhysicalPresenceCMDEnable }, |
260 { "enable", "ena", "enable the TPM (needs PP)", TlclSetEnable }, | 262 { "enable", "ena", "enable the TPM (needs PP)", TlclSetEnable }, |
261 { "disable", "dis", "disable the TPM (needs PP)", TlclClearEnable }, | 263 { "disable", "dis", "disable the TPM (needs PP)", TlclClearEnable }, |
262 { "activate", "act", "activate the TPM (needs PP, maybe reboot)", | 264 { "activate", "act", "activate the TPM (needs PP, maybe reboot)", |
263 HandlerActivate }, | 265 HandlerActivate }, |
264 { "deactivate", "deact", "deactivate the TPM (needs PP, maybe reboot)", | 266 { "deactivate", "deact", "deactivate the TPM (needs PP, maybe reboot)", |
265 HandlerDeactivate }, | 267 HandlerDeactivate }, |
266 { "clear", "clr", "clear the TPM owner (needs PP)", TlclForceClear }, | 268 { "clear", "clr", "clear the TPM owner (needs PP)", TlclForceClear }, |
267 { "setnvlocked", "setnv", "set the nvLocked flag permanently (IRREVERSIBLE!)", | 269 { "setnvlocked", "setnv", "set the nvLocked flag permanently (IRREVERSIBLE!)", |
268 TlclSetNvLocked }, | 270 TlclSetNvLocked }, |
269 { "lockphysicalpresence", "pplock", "lock PP to current value until reboot", | 271 { "lockphysicalpresence", "pplock", "lock PP to current value until reboot", |
(...skipping 21 matching lines...) Expand all Loading... |
291 fprintf(stderr, "usage: %s <TPM command> [args]\n or: %s help\n", | 293 fprintf(stderr, "usage: %s <TPM command> [args]\n or: %s help\n", |
292 argv[0], argv[0]); | 294 argv[0], argv[0]); |
293 exit(1); | 295 exit(1); |
294 } else { | 296 } else { |
295 command_record* c; | 297 command_record* c; |
296 const char* cmd = argv[1]; | 298 const char* cmd = argv[1]; |
297 nargs = argc; | 299 nargs = argc; |
298 args = argv; | 300 args = argv; |
299 | 301 |
300 if (strcmp(cmd, "help") == 0) { | 302 if (strcmp(cmd, "help") == 0) { |
301 printf("%23s %7s %s\n\n", "command", "abbr.", "description"); | 303 printf("%26s %7s %s\n\n", "command", "abbr.", "description"); |
302 for (c = command_table; c < command_table + n_commands; c++) { | 304 for (c = command_table; c < command_table + n_commands; c++) { |
303 printf("%23s %7s %s\n", c->name, c->abbr, c->description); | 305 printf("%26s %7s %s\n", c->name, c->abbr, c->description); |
304 } | 306 } |
305 return 0; | 307 return 0; |
306 } | 308 } |
307 | 309 |
308 TlclLibInit(); | 310 TlclLibInit(); |
309 | 311 |
310 for (c = command_table; c < command_table + n_commands; c++) { | 312 for (c = command_table; c < command_table + n_commands; c++) { |
311 if (strcmp(cmd, c->name) == 0 || strcmp(cmd, c->abbr) == 0) { | 313 if (strcmp(cmd, c->name) == 0 || strcmp(cmd, c->abbr) == 0) { |
312 return ErrorCheck(c->handler(), cmd); | 314 return ErrorCheck(c->handler(), cmd); |
313 } | 315 } |
314 } | 316 } |
315 | 317 |
316 /* No command matched. */ | 318 /* No command matched. */ |
317 fprintf(stderr, "%s: unknown command: %s\n", argv[0], cmd); | 319 fprintf(stderr, "%s: unknown command: %s\n", argv[0], cmd); |
318 return 1; | 320 return 1; |
319 } | 321 } |
320 } | 322 } |
OLD | NEW |