Stub tlcl implementation for tpm2 case

Build a special version of TPM Lightweight Command Library in
libvboot_host for TPM2. Create the framework for implementation, stub
functions for now. libvboot_host is used by tpmc and other user-space
utilities that talk directly to tpm bypassing trunks/trousers.

BRANCH=none
BUG=chrome-os-partner:54981
BUG=chrome-os-partner:55210
TEST=Boot on kevin, verify that 'tpmc read' works.

Change-Id: I4cc41028041193041defc319687697eb9edb1f3e
Reviewed-on: https://chromium-review.googlesource.com/358623
Commit-Ready: Andrey Pronin <apronin@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
Tested-by: Andrey Pronin <apronin@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
This commit is contained in:
Andrey Pronin
2016-07-06 19:10:46 -07:00
committed by chrome-bot
parent d5820a79fc
commit 1becb0dabe
6 changed files with 218 additions and 19 deletions

View File

@@ -22,9 +22,13 @@
#define TPM2_NV_WriteLock ((TPM_CC)0x00000138)
#define TPM2_NV_Read ((TPM_CC)0x0000014E)
/* TCG Spec defined, verify for TPM2. */
/* TCG Spec defined, verify for TPM2.
* TODO(apronin): find TPM2 RC substitutes for TPM1.2 error codes.
*/
#define TPM_E_BADINDEX ((uint32_t) 0x00000002)
#define TPM_E_INVALID_POSTINIT ((uint32_t) 0x00000026)
#define TPM_E_BADTAG ((uint32_t) 0x0000001E)
#define TPM_E_IOERROR ((uint32_t) 0x0000001F)
#define TPM_E_MAXNVWRITES ((uint32_t) 0x00000048)
#define HR_SHIFT 24
@@ -121,4 +125,12 @@ struct tpm2_response {
typedef struct {} TPM_PERMANENT_FLAGS;
typedef struct {} TPM_STCLEAR_FLAGS;
/* TODO(apronin): For TPM2 certain properties must be received using
* TPM2_GetCapability instead of being hardcoded as they are now:
* TPM_MAX_COMMAND_SIZE -> use TPM_PT_MAX_COMMAND_SIZE for TPM2.
* TPM_PCR_DIGEST -> use TPM_PT_MAX_DIGEST for TPM2.
*/
#define TPM_MAX_COMMAND_SIZE 4096
#define TPM_PCR_DIGEST 32
#endif /* ! __VBOOT_REFERENCE_FIRMWARE_INCLUDE_TPM2_TSS_CONSTANTS_H */