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 * The exit code is 0 for success, the TPM error code for TPM errors, and 255 | 8 * The exit code is 0 for success, the TPM error code for TPM errors, and 255 |
9 * for other errors. | 9 * for other errors. |
10 */ | 10 */ |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 HandlerWrite }, | 283 HandlerWrite }, |
284 { "read", "read", "read from a space (read <index> <size>)", | 284 { "read", "read", "read from a space (read <index> <size>)", |
285 HandlerRead }, | 285 HandlerRead }, |
286 { "getpermissions", "getp", "print space permissions (getp <index>)", | 286 { "getpermissions", "getp", "print space permissions (getp <index>)", |
287 HandlerGetPermissions }, | 287 HandlerGetPermissions }, |
288 { "getpermanentflags", "getpf", "print all permanent flags", | 288 { "getpermanentflags", "getpf", "print all permanent flags", |
289 HandlerGetPermanentFlags }, | 289 HandlerGetPermanentFlags }, |
290 { "getstclearflags", "getvf", "print all volatile (ST_CLEAR) flags", | 290 { "getstclearflags", "getvf", "print all volatile (ST_CLEAR) flags", |
291 HandlerGetSTClearFlags }, | 291 HandlerGetSTClearFlags }, |
292 { "resume", "res", "execute TPM_Startup(ST_STATE)", TlclResume }, | 292 { "resume", "res", "execute TPM_Startup(ST_STATE)", TlclResume }, |
| 293 { "savestate", "save", "execute TPM_SaveState", TlclSaveState }, |
293 }; | 294 }; |
294 | 295 |
295 static int n_commands = sizeof(command_table) / sizeof(command_table[0]); | 296 static int n_commands = sizeof(command_table) / sizeof(command_table[0]); |
296 | 297 |
297 int main(int argc, char* argv[]) { | 298 int main(int argc, char* argv[]) { |
298 if (argc < 2) { | 299 if (argc < 2) { |
299 fprintf(stderr, "usage: %s <TPM command> [args]\n or: %s help\n", | 300 fprintf(stderr, "usage: %s <TPM command> [args]\n or: %s help\n", |
300 argv[0], argv[0]); | 301 argv[0], argv[0]); |
301 return OTHER_ERROR; | 302 return OTHER_ERROR; |
302 } else { | 303 } else { |
(...skipping 16 matching lines...) Expand all Loading... |
319 if (strcmp(cmd, c->name) == 0 || strcmp(cmd, c->abbr) == 0) { | 320 if (strcmp(cmd, c->name) == 0 || strcmp(cmd, c->abbr) == 0) { |
320 return ErrorCheck(c->handler(), cmd); | 321 return ErrorCheck(c->handler(), cmd); |
321 } | 322 } |
322 } | 323 } |
323 | 324 |
324 /* No command matched. */ | 325 /* No command matched. */ |
325 fprintf(stderr, "%s: unknown command: %s\n", argv[0], cmd); | 326 fprintf(stderr, "%s: unknown command: %s\n", argv[0], cmd); |
326 return OTHER_ERROR; | 327 return OTHER_ERROR; |
327 } | 328 } |
328 } | 329 } |
OLD | NEW |