src/include: Open brace on same line as enum or struct
[coreboot.git] / src / include / tpm_lite / tss_constants.h
blob937e553969e30c8483ae3df50bfbf4ce2f266011
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.
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>
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
17 #define TPM_E_NON_FATAL 0x800
19 #define TPM_SUCCESS ((uint32_t)0x00000000)
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)
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))
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 #define TPM_E_NV_DEFINED ((uint32_t)0x0000500b) /* vboot local */
45 #define TPM_NV_INDEX0 ((uint32_t)0x00000000)
46 #define TPM_NV_INDEX_LOCK ((uint32_t)0xffffffff)
47 #define TPM_NV_PER_GLOBALLOCK (((uint32_t)1)<<15)
48 #define TPM_NV_PER_PPWRITE (((uint32_t)1)<<0)
49 #define TPM_NV_PER_READ_STCLEAR (((uint32_t)1)<<31)
50 #define TPM_NV_PER_WRITE_STCLEAR (((uint32_t)1)<<14)
52 #define TPM_TAG_RQU_COMMAND ((uint16_t) 0xc1)
53 #define TPM_TAG_RQU_AUTH1_COMMAND ((uint16_t) 0xc2)
54 #define TPM_TAG_RQU_AUTH2_COMMAND ((uint16_t) 0xc3)
56 #define TPM_TAG_RSP_COMMAND ((uint16_t) 0xc4)
57 #define TPM_TAG_RSP_AUTH1_COMMAND ((uint16_t) 0xc5)
58 #define TPM_TAG_RSP_AUTH2_COMMAND ((uint16_t) 0xc6)
60 /* Some TPM2 return codes used in this library. */
61 #define TPM2_RC_SUCCESS 0
62 #define TPM2_RC_NV_DEFINED 0x14c
64 typedef uint8_t TSS_BOOL;
65 typedef uint16_t TPM_STRUCTURE_TAG;
67 typedef struct tdTPM_PERMANENT_FLAGS {
68 TPM_STRUCTURE_TAG tag;
69 TSS_BOOL disable;
70 TSS_BOOL ownership;
71 TSS_BOOL deactivated;
72 TSS_BOOL readPubek;
73 TSS_BOOL disableOwnerClear;
74 TSS_BOOL allowMaintenance;
75 TSS_BOOL physicalPresenceLifetimeLock;
76 TSS_BOOL physicalPresenceHWEnable;
77 TSS_BOOL physicalPresenceCMDEnable;
78 TSS_BOOL CEKPUsed;
79 TSS_BOOL TPMpost;
80 TSS_BOOL TPMpostLock;
81 TSS_BOOL FIPS;
82 TSS_BOOL Operator;
83 TSS_BOOL enableRevokeEK;
84 TSS_BOOL nvLocked;
85 TSS_BOOL readSRKPub;
86 TSS_BOOL tpmEstablished;
87 TSS_BOOL maintenanceDone;
88 TSS_BOOL disableFullDALogicInfo;
89 } TPM_PERMANENT_FLAGS;
91 typedef struct tdTPM_STCLEAR_FLAGS {
92 TPM_STRUCTURE_TAG tag;
93 TSS_BOOL deactivated;
94 TSS_BOOL disableForceClear;
95 TSS_BOOL physicalPresence;
96 TSS_BOOL physicalPresenceLock;
97 TSS_BOOL bGlobalLock;
98 } TPM_STCLEAR_FLAGS;
100 #endif /* VBOOT_REFERENCE_TSS_CONSTANTS_H_ */