diff options
author | Andrey Pronin <apronin@google.com> | 2016-07-22 18:45:07 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-26 17:31:56 -0700 |
commit | 0960682caa1fd27539b0c2100e4f8766ebe66640 (patch) | |
tree | b1cf5c1004163ffe3bd6277ba3e9d88f3d1d236b /utility | |
parent | ca7251286655fe8865d0089bfc23b42ffececbf3 (diff) | |
download | vboot-0960682caa1fd27539b0c2100e4f8766ebe66640.tar.gz |
Implement GetCapabilities and reading flags for tpm2
For TPM2.0:
1) Implement TPM2_GetCapabilities command that allows reading
TPM properties, including PERMANENT and STARTUP_CLEAR flags.
2) Implement 'getpf' and 'getvf' commands in tpmc.
BRANCH=none
BUG=chrome-os-partner:55210
BUG=chrome-os-partner:55250
TEST=boot on kevin, verify 'tpmc getpf' and 'tpmc getvf'
Change-Id: I8490b2c92ebf7c266e27b7cb5898126a1b99b1a8
Reviewed-on: https://chromium-review.googlesource.com/362770
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'utility')
-rw-r--r-- | utility/tpmc.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/utility/tpmc.c b/utility/tpmc.c index 8d2ed241..f621661e 100644 --- a/utility/tpmc.c +++ b/utility/tpmc.c @@ -322,23 +322,19 @@ static uint32_t HandlerGetRandom(void) { return result; } -/* TODO(apronin): stubs for permanent and ST_CLEAR flags for TPM2 */ -#ifdef TPM2_MODE -static uint32_t HandlerGetPermanentFlags(void) { - fprintf(stderr, "getpermanentflags not implemented for TPM2\n"); - return OTHER_ERROR; -} - -static uint32_t HandlerGetSTClearFlags(void) { - fprintf(stderr, "getstclearflags not implemented for TPM2\n"); - return OTHER_ERROR; -} -#else 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) +#ifdef TPM2_MODE + P(ownerAuthSet); + P(endorsementAuthSet); + P(lockoutAuthSet); + P(disableClear); + P(inLockout); + P(tpmGeneratedEPS); +#else P(disable); P(ownership); P(deactivated); @@ -359,6 +355,7 @@ static uint32_t HandlerGetPermanentFlags(void) { P(tpmEstablished); P(maintenanceDone); P(disableFullDALogicInfo); +#endif #undef P } return result; @@ -369,16 +366,23 @@ static uint32_t HandlerGetSTClearFlags(void) { uint32_t result = TlclGetSTClearFlags(&vflags); if (result == 0) { #define P(name) printf("%s %d\n", #name, vflags.name) +#ifdef TPM2_MODE + P(phEnable); + P(shEnable); + P(ehEnable); + P(phEnableNV); + P(orderly); +#else P(deactivated); P(disableForceClear); P(physicalPresence); P(physicalPresenceLock); P(bGlobalLock); +#endif #undef P } return result; } -#endif /* TPM2_MODE */ static uint32_t HandlerSendRaw(void) { uint8_t request[4096]; |