Jacob Garber | fa8f567 | 2020-05-18 13:18:19 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: BSD-3-Clause */ |
| 2 | |
| 3 | /* |
Philipp Deppenwiese | c07f8fb | 2018-02-27 19:40:52 +0100 | [diff] [blame] | 4 | * Some TPM constants and type definitions for standalone compilation for use |
| 5 | * in the firmware |
| 6 | */ |
| 7 | #ifndef TCG1_TSS_STRUCTURES_H_ |
| 8 | #define TCG1_TSS_STRUCTURES_H_ |
Daisuke Nojiri | efb5cde | 2014-07-02 08:37:23 -0700 | [diff] [blame] | 9 | |
Philipp Deppenwiese | c07f8fb | 2018-02-27 19:40:52 +0100 | [diff] [blame] | 10 | #include <stdint.h> |
| 11 | #include "../common/tss_common.h" |
Daisuke Nojiri | efb5cde | 2014-07-02 08:37:23 -0700 | [diff] [blame] | 12 | |
Philipp Deppenwiese | c07f8fb | 2018-02-27 19:40:52 +0100 | [diff] [blame] | 13 | #define TPM_MAX_COMMAND_SIZE 4096 |
| 14 | #define TPM_LARGE_ENOUGH_COMMAND_SIZE 256 /* saves space in the firmware */ |
| 15 | #define TPM_PUBEK_SIZE 256 |
Daisuke Nojiri | efb5cde | 2014-07-02 08:37:23 -0700 | [diff] [blame] | 16 | |
Philipp Deppenwiese | c07f8fb | 2018-02-27 19:40:52 +0100 | [diff] [blame] | 17 | #define TPM_NV_INDEX0 ((uint32_t)0x00000000) |
| 18 | #define TPM_NV_INDEX_LOCK ((uint32_t)0xffffffff) |
| 19 | #define TPM_NV_PER_GLOBALLOCK (((uint32_t)1)<<15) |
| 20 | #define TPM_NV_PER_PPWRITE (((uint32_t)1)<<0) |
| 21 | #define TPM_NV_PER_READ_STCLEAR (((uint32_t)1)<<31) |
| 22 | #define TPM_NV_PER_WRITE_STCLEAR (((uint32_t)1)<<14) |
Daisuke Nojiri | efb5cde | 2014-07-02 08:37:23 -0700 | [diff] [blame] | 23 | |
Elyes Haouas | b538d71 | 2022-11-18 15:03:07 +0100 | [diff] [blame^] | 24 | #define TPM_TAG_RQU_COMMAND ((uint16_t)0xc1) |
| 25 | #define TPM_TAG_RQU_AUTH1_COMMAND ((uint16_t)0xc2) |
| 26 | #define TPM_TAG_RQU_AUTH2_COMMAND ((uint16_t)0xc3) |
Daisuke Nojiri | efb5cde | 2014-07-02 08:37:23 -0700 | [diff] [blame] | 27 | |
Elyes Haouas | b538d71 | 2022-11-18 15:03:07 +0100 | [diff] [blame^] | 28 | #define TPM_TAG_RSP_COMMAND ((uint16_t)0xc4) |
| 29 | #define TPM_TAG_RSP_AUTH1_COMMAND ((uint16_t)0xc5) |
| 30 | #define TPM_TAG_RSP_AUTH2_COMMAND ((uint16_t)0xc6) |
Daisuke Nojiri | efb5cde | 2014-07-02 08:37:23 -0700 | [diff] [blame] | 31 | |
Philipp Deppenwiese | c07f8fb | 2018-02-27 19:40:52 +0100 | [diff] [blame] | 32 | typedef uint8_t TSS_BOOL; |
| 33 | typedef uint16_t TPM_STRUCTURE_TAG; |
Daisuke Nojiri | efb5cde | 2014-07-02 08:37:23 -0700 | [diff] [blame] | 34 | |
Philipp Deppenwiese | c07f8fb | 2018-02-27 19:40:52 +0100 | [diff] [blame] | 35 | typedef struct tdTPM_PERMANENT_FLAGS { |
| 36 | TPM_STRUCTURE_TAG tag; |
| 37 | TSS_BOOL disable; |
| 38 | TSS_BOOL ownership; |
| 39 | TSS_BOOL deactivated; |
| 40 | TSS_BOOL readPubek; |
| 41 | TSS_BOOL disableOwnerClear; |
| 42 | TSS_BOOL allowMaintenance; |
| 43 | TSS_BOOL physicalPresenceLifetimeLock; |
| 44 | TSS_BOOL physicalPresenceHWEnable; |
| 45 | TSS_BOOL physicalPresenceCMDEnable; |
| 46 | TSS_BOOL CEKPUsed; |
| 47 | TSS_BOOL TPMpost; |
| 48 | TSS_BOOL TPMpostLock; |
| 49 | TSS_BOOL FIPS; |
| 50 | TSS_BOOL Operator; |
| 51 | TSS_BOOL enableRevokeEK; |
| 52 | TSS_BOOL nvLocked; |
| 53 | TSS_BOOL readSRKPub; |
| 54 | TSS_BOOL tpmEstablished; |
| 55 | TSS_BOOL maintenanceDone; |
| 56 | TSS_BOOL disableFullDALogicInfo; |
| 57 | } TPM_PERMANENT_FLAGS; |
Daisuke Nojiri | efb5cde | 2014-07-02 08:37:23 -0700 | [diff] [blame] | 58 | |
Philipp Deppenwiese | c07f8fb | 2018-02-27 19:40:52 +0100 | [diff] [blame] | 59 | typedef struct tdTPM_STCLEAR_FLAGS { |
| 60 | TPM_STRUCTURE_TAG tag; |
| 61 | TSS_BOOL deactivated; |
| 62 | TSS_BOOL disableForceClear; |
| 63 | TSS_BOOL physicalPresence; |
| 64 | TSS_BOOL physicalPresenceLock; |
| 65 | TSS_BOOL bGlobalLock; |
| 66 | } TPM_STCLEAR_FLAGS; |
Daisuke Nojiri | efb5cde | 2014-07-02 08:37:23 -0700 | [diff] [blame] | 67 | |
Philipp Deppenwiese | c07f8fb | 2018-02-27 19:40:52 +0100 | [diff] [blame] | 68 | #endif /* TCG1_TSS_STRUCTURES_H_ */ |