vboot_reference: remove dependency on trousers

This is done to break a circular DEPENDency as we want to
send UMA stats from tcsd.  Without this, metrics depends on
vboot_reference which depends on trousers which depends on
metrics.  Technically the vboot_reference dependency on trousers
is header-file only, but we can't cope with that.

BUG=chromium:481552
TEST=compiled with emerge-<something> vboot_reference
BRANCH=none

Change-Id: Iea5c0c39bb70977c9d375e63ea607687debe9f9f
Reviewed-on: https://chromium-review.googlesource.com/267744
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Luigi Semenzato <semenzato@chromium.org>
This commit is contained in:
Luigi Semenzato
2015-04-28 11:12:18 -07:00
committed by ChromeOS Commit Bot
parent d7da706484
commit b472d9cfe3
3 changed files with 135 additions and 32 deletions

View File

@@ -16,37 +16,40 @@
#define TPM_E_NON_FATAL 0x800
#define TPM_SUCCESS ((uint32_t)0x00000000)
#define TPM_SUCCESS ((uint32_t) 0x00000000)
#define TPM_E_AREA_LOCKED ((uint32_t)0x0000003c)
#define TPM_E_BADINDEX ((uint32_t)0x00000002)
#define TPM_E_BAD_PRESENCE ((uint32_t)0x0000002d)
#define TPM_E_IOERROR ((uint32_t)0x0000001f)
#define TPM_E_INVALID_POSTINIT ((uint32_t)0x00000026)
#define TPM_E_MAXNVWRITES ((uint32_t)0x00000048)
#define TPM_E_OWNER_SET ((uint32_t)0x00000014)
#define TPM_E_AREA_LOCKED ((uint32_t) 0x0000003c)
#define TPM_E_BADINDEX ((uint32_t) 0x00000002)
#define TPM_E_BAD_PRESENCE ((uint32_t) 0x0000002d)
#define TPM_E_IOERROR ((uint32_t) 0x0000001f)
#define TPM_E_INVALID_POSTINIT ((uint32_t) 0x00000026)
#define TPM_E_MAXNVWRITES ((uint32_t) 0x00000048)
#define TPM_E_OWNER_SET ((uint32_t) 0x00000014)
#define TPM_E_NEEDS_SELFTEST ((uint32_t)(TPM_E_NON_FATAL + 1))
#define TPM_E_DOING_SELFTEST ((uint32_t)(TPM_E_NON_FATAL + 2))
#define TPM_E_NEEDS_SELFTEST ((uint32_t) (TPM_E_NON_FATAL + 1))
#define TPM_E_DOING_SELFTEST ((uint32_t) (TPM_E_NON_FATAL + 2))
#define TPM_E_ALREADY_INITIALIZED ((uint32_t)0x00005000) /* vboot local */
#define TPM_E_INTERNAL_INCONSISTENCY ((uint32_t)0x00005001) /* vboot local */
#define TPM_E_MUST_REBOOT ((uint32_t)0x00005002) /* vboot local */
#define TPM_E_CORRUPTED_STATE ((uint32_t)0x00005003) /* vboot local */
#define TPM_E_COMMUNICATION_ERROR ((uint32_t)0x00005004) /* vboot local */
#define TPM_E_RESPONSE_TOO_LARGE ((uint32_t)0x00005005) /* vboot local */
#define TPM_E_NO_DEVICE ((uint32_t)0x00005006) /* vboot local */
#define TPM_E_INPUT_TOO_SMALL ((uint32_t)0x00005007) /* vboot local */
#define TPM_E_WRITE_FAILURE ((uint32_t)0x00005008) /* vboot local */
#define TPM_E_READ_EMPTY ((uint32_t)0x00005009) /* vboot local */
#define TPM_E_READ_FAILURE ((uint32_t)0x0000500a) /* vboot local */
#define TPM_E_ALREADY_INITIALIZED ((uint32_t) 0x00005000) /* vboot local */
#define TPM_E_INTERNAL_INCONSISTENCY ((uint32_t) 0x00005001) /* vboot local */
#define TPM_E_MUST_REBOOT ((uint32_t) 0x00005002) /* vboot local */
#define TPM_E_CORRUPTED_STATE ((uint32_t) 0x00005003) /* vboot local */
#define TPM_E_COMMUNICATION_ERROR ((uint32_t) 0x00005004) /* vboot local */
#define TPM_E_RESPONSE_TOO_LARGE ((uint32_t) 0x00005005) /* vboot local */
#define TPM_E_NO_DEVICE ((uint32_t) 0x00005006) /* vboot local */
#define TPM_E_INPUT_TOO_SMALL ((uint32_t) 0x00005007) /* vboot local */
#define TPM_E_WRITE_FAILURE ((uint32_t) 0x00005008) /* vboot local */
#define TPM_E_READ_EMPTY ((uint32_t) 0x00005009) /* vboot local */
#define TPM_E_READ_FAILURE ((uint32_t) 0x0000500a) /* vboot local */
#define TPM_NV_INDEX0 ((uint32_t)0x00000000)
#define TPM_NV_INDEX_LOCK ((uint32_t)0xffffffff)
#define TPM_NV_PER_GLOBALLOCK (((uint32_t)1)<<15)
#define TPM_NV_PER_PPWRITE (((uint32_t)1)<<0)
#define TPM_NV_PER_READ_STCLEAR (((uint32_t)1)<<31)
#define TPM_NV_PER_WRITE_STCLEAR (((uint32_t)1)<<14)
#define TPM_NV_INDEX0 ((uint32_t) 0x00000000)
#define TPM_NV_INDEX_LOCK ((uint32_t) 0xffffffff)
#define TPM_NV_PER_GLOBALLOCK (((uint32_t) 1) << 15)
#define TPM_NV_PER_PPWRITE (((uint32_t) 1) << 0)
#define TPM_NV_PER_READ_STCLEAR (((uint32_t)1) << 31)
#define TPM_NV_PER_WRITE_STCLEAR (((uint32_t)1) << 14)
#define TPM_TAG_NV_ATTRIBUTES ((uint16_t) 0x0017)
#define TPM_TAG_NV_DATA_PUBLIC ((uint16_t) 0x0018)
#define TPM_TAG_RQU_COMMAND ((uint16_t) 0xc1)
#define TPM_TAG_RQU_AUTH1_COMMAND ((uint16_t) 0xc2)
@@ -57,7 +60,72 @@
#define TPM_TAG_RSP_AUTH2_COMMAND ((uint16_t) 0xc6)
typedef uint8_t TSS_BOOL;
typedef uint8_t TPM_BOOL;
typedef uint16_t TPM_TAG;
typedef uint16_t TPM_STRUCTURE_TAG;
typedef uint32_t TPM_NV_INDEX;
typedef uint32_t TPM_NV_PER_ATTRIBUTES;
typedef uint8_t TPM_LOCALITY_SELECTION;
typedef uint32_t TPM_COMMAND_CODE;
typedef uint16_t TPM_PHYSICAL_PRESENCE;
typedef uint16_t TPM_STARTUP_TYPE;
typedef uint32_t TPM_CAPABILITY_AREA;
#define TPM_CAP_FLAG ((uint32_t) 0x00000004)
#define TPM_CAP_FLAG_PERMANENT ((uint32_t) 0x00000108)
#define TPM_CAP_FLAG_VOLATILE ((uint32_t) 0x00000109)
#define TPM_CAP_PROPERTY ((uint32_t) 0x00000005)
#define TPM_CAP_PROP_OWNER ((uint32_t) 0x00000111)
#define TPM_CAP_NV_INDEX ((uint32_t) 0x00000011)
#define TPM_ST_CLEAR ((uint16_t) 0x0001)
#define TPM_ST_STATE ((uint16_t) 0x0002)
#define TPM_ST_DEACTIVATED ((uint16_t) 0x0003)
#define TPM_LOC_FOUR (((uint32_t)1)<<4)
#define TPM_LOC_THREE (((uint32_t)1)<<3)
#define TPM_LOC_TWO (((uint32_t)1)<<2)
#define TPM_LOC_ONE (((uint32_t)1)<<1)
#define TPM_LOC_ZERO (((uint32_t)1)<<0)
#define TPM_PHYSICAL_PRESENCE_LOCK ((uint16_t) 0x0004)
#define TPM_PHYSICAL_PRESENCE_PRESENT ((uint16_t) 0x0008)
#define TPM_PHYSICAL_PRESENCE_NOTPRESENT ((uint16_t) 0x0010)
#define TPM_PHYSICAL_PRESENCE_CMD_ENABLE ((uint16_t) 0x0020)
#define TPM_PHYSICAL_PRESENCE_HW_ENABLE ((uint16_t) 0x0040)
#define TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK ((uint16_t) 0x0080)
#define TPM_PHYSICAL_PRESENCE_CMD_DISABLE ((uint16_t) 0x0100)
#define TPM_PHYSICAL_PRESENCE_HW_DISABLE ((uint16_t) 0x0200)
#define TPM_SHA1_160_HASH_LEN 0x14
#define TPM_SHA1BASED_NONCE_LEN TPM_SHA1_160_HASH_LEN
typedef struct tdTPM_DIGEST
{
uint8_t digest[TPM_SHA1_160_HASH_LEN];
} TPM_DIGEST;
typedef TPM_DIGEST TPM_COMPOSITE_HASH;
typedef struct tdTPM_PCR_SELECTION
{
uint16_t sizeOfSelect;
uint8_t *pcrSelect;
} TPM_PCR_SELECTION;
typedef struct tdTPM_NV_ATTRIBUTES
{
TPM_STRUCTURE_TAG tag;
TPM_NV_PER_ATTRIBUTES attributes;
} TPM_NV_ATTRIBUTES;
typedef struct tdTPM_PCR_INFO_SHORT
{
TPM_PCR_SELECTION pcrSelection;
TPM_LOCALITY_SELECTION localityAtRelease;
TPM_COMPOSITE_HASH digestAtRelease;
} TPM_PCR_INFO_SHORT;
typedef struct tdTPM_PERMANENT_FLAGS
{
@@ -93,4 +161,43 @@ typedef struct tdTPM_STCLEAR_FLAGS{
TSS_BOOL bGlobalLock;
} TPM_STCLEAR_FLAGS;
typedef struct tdTPM_NV_DATA_PUBLIC
{
TPM_STRUCTURE_TAG tag;
TPM_NV_INDEX nvIndex;
TPM_PCR_INFO_SHORT pcrInfoRead;
TPM_PCR_INFO_SHORT pcrInfoWrite;
TPM_NV_ATTRIBUTES permission;
TPM_BOOL bReadSTClear;
TPM_BOOL bWriteSTClear;
TPM_BOOL bWriteDefine;
uint32_t dataSize;
} TPM_NV_DATA_PUBLIC;
typedef struct tdTPM_NONCE
{
uint8_t nonce[TPM_SHA1BASED_NONCE_LEN];
} TPM_NONCE;
/* Ordinals */
#define TPM_ORD_ContinueSelfTest ((uint32_t) 0x00000053)
#define TPM_ORD_Extend ((uint32_t) 0x00000014)
#define TPM_ORD_ForceClear ((uint32_t) 0x0000005D)
#define TPM_ORD_GetCapability ((uint32_t) 0x00000065)
#define TPM_ORD_GetRandom ((uint32_t) 0x00000046)
#define TPM_ORD_NV_DefineSpace ((uint32_t) 0x000000CC)
#define TPM_ORD_NV_ReadValue ((uint32_t) 0x000000CF)
#define TPM_ORD_NV_WriteValue ((uint32_t) 0x000000CD)
#define TPM_ORD_PcrRead ((uint32_t) 0x00000015)
#define TPM_ORD_PhysicalEnable ((uint32_t) 0x0000006F)
#define TPM_ORD_PhysicalDisable ((uint32_t) 0x00000070)
#define TSC_ORD_PhysicalPresence ((uint32_t) 0x4000000A)
#define TPM_ORD_PhysicalSetDeactivated ((uint32_t) 0x00000072)
#define TPM_ORD_ReadPubek ((uint32_t) 0x0000007C)
#define TPM_ORD_SaveState ((uint32_t) 0x00000098)
#define TPM_ORD_SelfTestFull ((uint32_t) 0x00000050)
#define TPM_ORD_Startup ((uint32_t) 0x00000099)
#endif /* VBOOT_REFERENCE_TSS_CONSTANTS_H_ */

View File

@@ -10,10 +10,6 @@
#include <stdlib.h>
#include <string.h>
#include <tss/tcs.h>
/* Don't use the vboot constants, since they conflict with the TCS lib */
#define VBOOT_REFERENCE_TSS_CONSTANTS_H_
#include "host_common.h"
#include "test_common.h"
#include "tlcl.h"

View File

@@ -15,11 +15,11 @@
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <tss/tcs.h>
#include "sysincludes.h"
#include "tlcl_internal.h"
#include "tpmextras.h"
#include "tss_constants.h"
/* See struct Command below. This structure represent a field in a TPM
* command. [name] is the field name. [visible] is 1 if the field is