Home | History | Annotate | Download | only in include
      1 /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
      2  * Use of this source code is governed by a BSD-style license that can be
      3  * found in the LICENSE file.
      4  *
      5  * Some TPM constants and type definitions for standalone compilation for use
      6  * in the firmware
      7  */
      8 #ifndef VBOOT_REFERENCE_TSS_CONSTANTS_H_
      9 #define VBOOT_REFERENCE_TSS_CONSTANTS_H_
     10 #include <stdint.h>
     11 
     12 #define TPM_MAX_COMMAND_SIZE 4096
     13 #define TPM_LARGE_ENOUGH_COMMAND_SIZE 256  /* saves space in the firmware */
     14 #define TPM_PUBEK_SIZE 256
     15 #define TPM_PCR_DIGEST 20
     16 
     17 #define TPM_E_NON_FATAL 0x800
     18 
     19 #define TPM_SUCCESS ((uint32_t)0x00000000)
     20 
     21 #define TPM_E_AREA_LOCKED           ((uint32_t)0x0000003c)
     22 #define TPM_E_BADINDEX              ((uint32_t)0x00000002)
     23 #define TPM_E_BAD_PRESENCE          ((uint32_t)0x0000002d)
     24 #define TPM_E_IOERROR               ((uint32_t)0x0000001f)
     25 #define TPM_E_INVALID_POSTINIT      ((uint32_t)0x00000026)
     26 #define TPM_E_MAXNVWRITES           ((uint32_t)0x00000048)
     27 #define TPM_E_OWNER_SET             ((uint32_t)0x00000014)
     28 
     29 #define TPM_E_NEEDS_SELFTEST ((uint32_t)(TPM_E_NON_FATAL + 1))
     30 #define TPM_E_DOING_SELFTEST ((uint32_t)(TPM_E_NON_FATAL + 2))
     31 
     32 #define TPM_E_ALREADY_INITIALIZED    ((uint32_t)0x00005000)  /* vboot local */
     33 #define TPM_E_INTERNAL_INCONSISTENCY ((uint32_t)0x00005001)  /* vboot local */
     34 #define TPM_E_MUST_REBOOT            ((uint32_t)0x00005002)  /* vboot local */
     35 #define TPM_E_CORRUPTED_STATE        ((uint32_t)0x00005003)  /* vboot local */
     36 #define TPM_E_COMMUNICATION_ERROR    ((uint32_t)0x00005004)  /* vboot local */
     37 #define TPM_E_RESPONSE_TOO_LARGE     ((uint32_t)0x00005005)  /* vboot local */
     38 #define TPM_E_NO_DEVICE              ((uint32_t)0x00005006)  /* vboot local */
     39 #define TPM_E_INPUT_TOO_SMALL        ((uint32_t)0x00005007)  /* vboot local */
     40 #define TPM_E_WRITE_FAILURE          ((uint32_t)0x00005008)  /* vboot local */
     41 #define TPM_E_READ_EMPTY             ((uint32_t)0x00005009)  /* vboot local */
     42 #define TPM_E_READ_FAILURE           ((uint32_t)0x0000500a)  /* vboot local */
     43 
     44 #define TPM_NV_INDEX0 ((uint32_t)0x00000000)
     45 #define TPM_NV_INDEX_LOCK ((uint32_t)0xffffffff)
     46 #define TPM_NV_PER_GLOBALLOCK (((uint32_t)1)<<15)
     47 #define TPM_NV_PER_PPWRITE (((uint32_t)1)<<0)
     48 #define TPM_NV_PER_READ_STCLEAR (((uint32_t)1)<<31)
     49 #define TPM_NV_PER_WRITE_STCLEAR (((uint32_t)1)<<14)
     50 
     51 #define TPM_TAG_RQU_COMMAND       ((uint16_t) 0xc1)
     52 #define TPM_TAG_RQU_AUTH1_COMMAND ((uint16_t) 0xc2)
     53 #define TPM_TAG_RQU_AUTH2_COMMAND ((uint16_t) 0xc3)
     54 
     55 #define TPM_TAG_RSP_COMMAND       ((uint16_t) 0xc4)
     56 #define TPM_TAG_RSP_AUTH1_COMMAND ((uint16_t) 0xc5)
     57 #define TPM_TAG_RSP_AUTH2_COMMAND ((uint16_t) 0xc6)
     58 
     59 typedef uint8_t TSS_BOOL;
     60 typedef uint16_t TPM_STRUCTURE_TAG;
     61 
     62 typedef struct tdTPM_PERMANENT_FLAGS
     63 {
     64 	TPM_STRUCTURE_TAG tag;
     65 	TSS_BOOL disable;
     66 	TSS_BOOL ownership;
     67 	TSS_BOOL deactivated;
     68 	TSS_BOOL readPubek;
     69 	TSS_BOOL disableOwnerClear;
     70 	TSS_BOOL allowMaintenance;
     71 	TSS_BOOL physicalPresenceLifetimeLock;
     72 	TSS_BOOL physicalPresenceHWEnable;
     73 	TSS_BOOL physicalPresenceCMDEnable;
     74 	TSS_BOOL CEKPUsed;
     75 	TSS_BOOL TPMpost;
     76 	TSS_BOOL TPMpostLock;
     77 	TSS_BOOL FIPS;
     78 	TSS_BOOL Operator;
     79 	TSS_BOOL enableRevokeEK;
     80 	TSS_BOOL nvLocked;
     81 	TSS_BOOL readSRKPub;
     82 	TSS_BOOL tpmEstablished;
     83 	TSS_BOOL maintenanceDone;
     84 	TSS_BOOL disableFullDALogicInfo;
     85 } TPM_PERMANENT_FLAGS;
     86 
     87 typedef struct tdTPM_STCLEAR_FLAGS{
     88 	TPM_STRUCTURE_TAG tag;
     89 	TSS_BOOL deactivated;
     90 	TSS_BOOL disableForceClear;
     91 	TSS_BOOL physicalPresence;
     92 	TSS_BOOL physicalPresenceLock;
     93 	TSS_BOOL bGlobalLock;
     94 } TPM_STCLEAR_FLAGS;
     95 
     96 #endif  /* VBOOT_REFERENCE_TSS_CONSTANTS_H_ */
     97