1 //
2 // Copyright (C) 2015 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef TRUNKS_TPM_CONSTANTS_H_
18 #define TRUNKS_TPM_CONSTANTS_H_
19 
20 #include "trunks/tpm_generated.h"
21 
22 namespace trunks {
23 
24 // TPM Object Attributes.
25 constexpr TPMA_OBJECT kFixedTPM = 1U << 1;
26 constexpr TPMA_OBJECT kFixedParent = 1U << 4;
27 constexpr TPMA_OBJECT kSensitiveDataOrigin = 1U << 5;
28 constexpr TPMA_OBJECT kUserWithAuth = 1U << 6;
29 constexpr TPMA_OBJECT kAdminWithPolicy = 1U << 7;
30 constexpr TPMA_OBJECT kNoDA = 1U << 10;
31 constexpr TPMA_OBJECT kRestricted = 1U << 16;
32 constexpr TPMA_OBJECT kDecrypt = 1U << 17;
33 constexpr TPMA_OBJECT kSign = 1U << 18;
34 
35 // TPM NV Index Attributes, defined in TPM Spec Part 2 section 13.2.
36 constexpr TPMA_NV TPMA_NV_PPWRITE = 1U << 0;
37 constexpr TPMA_NV TPMA_NV_OWNERWRITE = 1U << 1;
38 constexpr TPMA_NV TPMA_NV_AUTHWRITE = 1U << 2;
39 constexpr TPMA_NV TPMA_NV_POLICYWRITE = 1U << 3;
40 constexpr TPMA_NV TPMA_NV_COUNTER = 1U << 4;
41 constexpr TPMA_NV TPMA_NV_BITS = 1U << 5;
42 constexpr TPMA_NV TPMA_NV_EXTEND = 1U << 6;
43 constexpr TPMA_NV TPMA_NV_POLICY_DELETE = 1U << 10;
44 constexpr TPMA_NV TPMA_NV_WRITELOCKED = 1U << 11;
45 constexpr TPMA_NV TPMA_NV_WRITEALL = 1U << 12;
46 constexpr TPMA_NV TPMA_NV_WRITEDEFINE = 1U << 13;
47 constexpr TPMA_NV TPMA_NV_WRITE_STCLEAR = 1U << 14;
48 constexpr TPMA_NV TPMA_NV_GLOBALLOCK = 1U << 15;
49 constexpr TPMA_NV TPMA_NV_PPREAD = 1U << 16;
50 constexpr TPMA_NV TPMA_NV_OWNERREAD = 1U << 17;
51 constexpr TPMA_NV TPMA_NV_AUTHREAD = 1U << 18;
52 constexpr TPMA_NV TPMA_NV_POLICYREAD = 1U << 19;
53 constexpr TPMA_NV TPMA_NV_NO_DA = 1U << 25;
54 constexpr TPMA_NV TPMA_NV_ORDERLY = 1U << 26;
55 constexpr TPMA_NV TPMA_NV_CLEAR_STCLEAR = 1U << 27;
56 constexpr TPMA_NV TPMA_NV_READLOCKED = 1U << 28;
57 constexpr TPMA_NV TPMA_NV_WRITTEN = 1U << 29;
58 constexpr TPMA_NV TPMA_NV_PLATFORMCREATE = 1U << 30;
59 constexpr TPMA_NV TPMA_NV_READ_STCLEAR = 1U << 31;
60 
61 }  // namespace trunks
62 
63 #endif  // TRUNKS_TPM_CONSTANTS_H_
64