Debian Codegraph @

tpm2/templates.go

raw
1 package tpm2
2
3 var (
4 // RSASRKTemplate contains the TCG reference RSA-2048 SRK template.
5 // https://trustedcomputinggroup.org/wp-content/uploads/TCG-TPM-v2.0-Provisioning-Guidance-Published-v1r1.pdf
6 RSASRKTemplate = TPMTPublic{
7 Type: TPMAlgRSA,
8 NameAlg: TPMAlgSHA256,
9 ObjectAttributes: TPMAObject{
10 FixedTPM: true,
11 STClear: false,
12 FixedParent: true,
13 SensitiveDataOrigin: true,
14 UserWithAuth: true,
15 AdminWithPolicy: false,
16 NoDA: true,
17 EncryptedDuplication: false,
18 Restricted: true,
19 Decrypt: true,
20 SignEncrypt: false,
21 },
22 Parameters: NewTPMUPublicParms(
23 TPMAlgRSA,
24 &TPMSRSAParms{
25 Symmetric: TPMTSymDefObject{
26 Algorithm: TPMAlgAES,
27 KeyBits: NewTPMUSymKeyBits(
28 TPMAlgAES,
29 TPMKeyBits(128),
30 ),
31 Mode: NewTPMUSymMode(
32 TPMAlgAES,
33 TPMAlgCFB,
34 ),
35 },
36 KeyBits: 2048,
37 },
38 ),
39 Unique: NewTPMUPublicID(
40 TPMAlgRSA,
41 &TPM2BPublicKeyRSA{
42 Buffer: make([]byte, 256),
43 },
44 ),
45 }
46 // RSAEKTemplate contains the TCG reference RSA-2048 EK template.
47 RSAEKTemplate = TPMTPublic{
48 Type: TPMAlgRSA,
49 NameAlg: TPMAlgSHA256,
50 ObjectAttributes: TPMAObject{
51 FixedTPM: true,
52 STClear: false,
53 FixedParent: true,
54 SensitiveDataOrigin: true,
55 UserWithAuth: false,
56 AdminWithPolicy: true,
57 NoDA: false,
58 EncryptedDuplication: false,
59 Restricted: true,
60 Decrypt: true,
61 SignEncrypt: false,
62 },
63 AuthPolicy: TPM2BDigest{
64 Buffer: []byte{
65 // TPM2_PolicySecret(RH_ENDORSEMENT)
66 0x83, 0x71, 0x97, 0x67, 0x44, 0x84, 0xB3, 0xF8,
67 0x1A, 0x90, 0xCC, 0x8D, 0x46, 0xA5, 0xD7, 0x24,
68 0xFD, 0x52, 0xD7, 0x6E, 0x06, 0x52, 0x0B, 0x64,
69 0xF2, 0xA1, 0xDA, 0x1B, 0x33, 0x14, 0x69, 0xAA,
70 },
71 },
72 Parameters: NewTPMUPublicParms(
73 TPMAlgRSA,
74 &TPMSRSAParms{
75 Symmetric: TPMTSymDefObject{
76 Algorithm: TPMAlgAES,
77 KeyBits: NewTPMUSymKeyBits(
78 TPMAlgAES,
79 TPMKeyBits(128),
80 ),
81 Mode: NewTPMUSymMode(
82 TPMAlgAES,
83 TPMAlgCFB,
84 ),
85 },
86 KeyBits: 2048,
87 },
88 ),
89 Unique: NewTPMUPublicID(
90 TPMAlgRSA,
91 &TPM2BPublicKeyRSA{
92 Buffer: make([]byte, 256),
93 },
94 ),
95 }
96
97 // ECCSRKTemplate contains the TCG reference ECC-P256 SRK template.
98 // https://trustedcomputinggroup.org/wp-content/uploads/TCG-TPM-v2.0-Provisioning-Guidance-Published-v1r1.pdf
99 ECCSRKTemplate = TPMTPublic{
100 Type: TPMAlgECC,
101 NameAlg: TPMAlgSHA256,
102 ObjectAttributes: TPMAObject{
103 FixedTPM: true,
104 STClear: false,
105 FixedParent: true,
106 SensitiveDataOrigin: true,
107 UserWithAuth: true,
108 AdminWithPolicy: false,
109 NoDA: true,
110 EncryptedDuplication: false,
111 Restricted: true,
112 Decrypt: true,
113 SignEncrypt: false,
114 },
115 Parameters: NewTPMUPublicParms(
116 TPMAlgECC,
117 &TPMSECCParms{
118 Symmetric: TPMTSymDefObject{
119 Algorithm: TPMAlgAES,
120 KeyBits: NewTPMUSymKeyBits(
121 TPMAlgAES,
122 TPMKeyBits(128),
123 ),
124 Mode: NewTPMUSymMode(
125 TPMAlgAES,
126 TPMAlgCFB,
127 ),
128 },
129 CurveID: TPMECCNistP256,
130 },
131 ),
132 Unique: NewTPMUPublicID(
133 TPMAlgECC,
134 &TPMSECCPoint{
135 X: TPM2BECCParameter{
136 Buffer: make([]byte, 32),
137 },
138 Y: TPM2BECCParameter{
139 Buffer: make([]byte, 32),
140 },
141 },
142 ),
143 }
144
145 // ECCEKTemplate contains the TCG reference ECC-P256 EK template.
146 ECCEKTemplate = TPMTPublic{
147 Type: TPMAlgECC,
148 NameAlg: TPMAlgSHA256,
149 ObjectAttributes: TPMAObject{
150 FixedTPM: true,
151 STClear: false,
152 FixedParent: true,
153 SensitiveDataOrigin: true,
154 UserWithAuth: false,
155 AdminWithPolicy: true,
156 NoDA: false,
157 EncryptedDuplication: false,
158 Restricted: true,
159 Decrypt: true,
160 SignEncrypt: false,
161 },
162 AuthPolicy: TPM2BDigest{
163 Buffer: []byte{
164 // TPM2_PolicySecret(RH_ENDORSEMENT)
165 0x83, 0x71, 0x97, 0x67, 0x44, 0x84, 0xB3, 0xF8,
166 0x1A, 0x90, 0xCC, 0x8D, 0x46, 0xA5, 0xD7, 0x24,
167 0xFD, 0x52, 0xD7, 0x6E, 0x06, 0x52, 0x0B, 0x64,
168 0xF2, 0xA1, 0xDA, 0x1B, 0x33, 0x14, 0x69, 0xAA,
169 },
170 },
171 Parameters: NewTPMUPublicParms(
172 TPMAlgECC,
173 &TPMSECCParms{
174 Symmetric: TPMTSymDefObject{
175 Algorithm: TPMAlgAES,
176 KeyBits: NewTPMUSymKeyBits(
177 TPMAlgAES,
178 TPMKeyBits(128),
179 ),
180 Mode: NewTPMUSymMode(
181 TPMAlgAES,
182 TPMAlgCFB,
183 ),
184 },
185 CurveID: TPMECCNistP256,
186 },
187 ),
188 Unique: NewTPMUPublicID(
189 TPMAlgECC,
190 &TPMSECCPoint{
191 X: TPM2BECCParameter{
192 Buffer: make([]byte, 32),
193 },
194 Y: TPM2BECCParameter{
195 Buffer: make([]byte, 32),
196 },
197 },
198 ),
199 }
200 )