1use crate::{
8 data::{
9 Tpm2bAuth, Tpm2bCreationData, Tpm2bData, Tpm2bDigest, Tpm2bEncryptedSecret, Tpm2bIdObject,
10 Tpm2bName, Tpm2bPrivate, Tpm2bPublic, Tpm2bSensitive, Tpm2bSensitiveCreate,
11 Tpm2bSensitiveData, TpmCc, TpmRh, TpmlPcrSelection, TpmtTkCreation,
12 },
13 tpm_struct, TpmTransient,
14};
15use core::fmt::Debug;
16
17pub type Tpm2bTemplate = Tpm2bPublic;
18
19tpm_struct! {
20 #[derive(Debug, Default, PartialEq, Eq, Clone)]
21 kind: Command,
22 name: TpmCreateCommand,
23 cc: TpmCc::Create,
24 no_sessions: false,
25 with_sessions: true,
26 handles: {
27 pub parent_handle: crate::data::TpmiDhObject,
28 },
29 parameters: {
30 pub in_sensitive: Tpm2bSensitiveCreate,
31 pub in_public: Tpm2bPublic,
32 pub outside_info: Tpm2bData,
33 pub creation_pcr: TpmlPcrSelection,
34 }
35}
36
37tpm_struct! {
38 #[derive(Debug, PartialEq, Eq, Clone)]
39 kind: Response,
40 name: TpmCreateResponse,
41 cc: TpmCc::Create,
42 no_sessions: false,
43 with_sessions: true,
44 handles: {},
45 parameters: {
46 pub out_private: Tpm2bPrivate,
47 pub out_public: Tpm2bPublic,
48 pub creation_data: Tpm2bCreationData,
49 pub creation_hash: Tpm2bDigest,
50 pub creation_ticket: TpmtTkCreation,
51 }
52}
53
54tpm_struct! {
55 #[derive(Debug, PartialEq, Eq, Clone)]
56 kind: Command,
57 name: TpmCreateLoadedCommand,
58 cc: TpmCc::CreateLoaded,
59 no_sessions: false,
60 with_sessions: true,
61 handles: {
62 pub parent_handle: crate::data::TpmiDhParent,
63 },
64 parameters: {
65 pub in_sensitive: Tpm2bSensitiveCreate,
66 pub in_public: Tpm2bTemplate,
67 }
68}
69
70tpm_struct! {
71 #[derive(Debug, PartialEq, Eq, Clone)]
72 kind: Response,
73 name: TpmCreateLoadedResponse,
74 cc: TpmCc::CreateLoaded,
75 no_sessions: false,
76 with_sessions: true,
77 handles: {
78 pub object_handle: TpmTransient,
79 },
80 parameters: {
81 pub out_private: Tpm2bPrivate,
82 pub out_public: Tpm2bPublic,
83 pub name: Tpm2bName,
84 }
85}
86
87tpm_struct! {
88 #[derive(Debug, Default, PartialEq, Eq, Clone)]
89 kind: Command,
90 name: TpmLoadCommand,
91 cc: TpmCc::Load,
92 no_sessions: false,
93 with_sessions: true,
94 handles: {
95 pub parent_handle: crate::data::TpmiDhObject,
96 },
97 parameters: {
98 pub in_private: Tpm2bPrivate,
99 pub in_public: Tpm2bPublic,
100 }
101}
102
103tpm_struct! {
104 #[derive(Debug, PartialEq, Eq, Clone)]
105 kind: Response,
106 name: TpmLoadResponse,
107 cc: TpmCc::Load,
108 no_sessions: false,
109 with_sessions: true,
110 handles: {
111 pub object_handle: TpmTransient,
112 },
113 parameters: {
114 pub name: Tpm2bName,
115 }
116}
117
118tpm_struct! {
119 #[derive(Debug, PartialEq, Eq, Clone)]
120 kind: Command,
121 name: TpmLoadExternalCommand,
122 cc: TpmCc::LoadExternal,
123 no_sessions: true,
124 with_sessions: true,
125 handles: {},
126 parameters: {
127 pub in_private: Tpm2bSensitive,
128 pub in_public: Tpm2bPublic,
129 pub hierarchy: TpmRh,
130 }
131}
132
133tpm_struct! {
134 #[derive(Debug, PartialEq, Eq, Clone)]
135 kind: Response,
136 name: TpmLoadExternalResponse,
137 cc: TpmCc::LoadExternal,
138 no_sessions: true,
139 with_sessions: true,
140 handles: {
141 pub object_handle: TpmTransient,
142 },
143 parameters: {
144 pub name: Tpm2bName,
145 }
146}
147
148tpm_struct! {
149 #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
150 kind: Command,
151 name: TpmReadPublicCommand,
152 cc: TpmCc::ReadPublic,
153 no_sessions: true,
154 with_sessions: true,
155 handles: {
156 pub object_handle: crate::data::TpmiDhObject,
157 },
158 parameters: {}
159}
160
161tpm_struct! {
162 #[derive(Debug, Default, PartialEq, Eq, Clone)]
163 kind: Response,
164 name: TpmReadPublicResponse,
165 cc: TpmCc::ReadPublic,
166 no_sessions: true,
167 with_sessions: false,
168 handles: {},
169 parameters: {
170 pub out_public: Tpm2bPublic,
171 pub name: Tpm2bName,
172 pub qualified_name: Tpm2bName,
173 }
174}
175
176tpm_struct! {
177 #[derive(Debug, PartialEq, Eq, Clone)]
178 kind: Command,
179 name: TpmActivateCredentialCommand,
180 cc: TpmCc::ActivateCredential,
181 no_sessions: false,
182 with_sessions: true,
183 handles: {
184 pub activate_handle: crate::data::TpmiDhObject,
185 pub key_handle: crate::data::TpmiDhObject,
186 },
187 parameters: {
188 pub credential_blob: Tpm2bIdObject,
189 pub secret: Tpm2bEncryptedSecret,
190 }
191}
192
193tpm_struct! {
194 #[derive(Debug, PartialEq, Eq, Clone)]
195 kind: Response,
196 name: TpmActivateCredentialResponse,
197 cc: TpmCc::ActivateCredential,
198 no_sessions: true,
199 with_sessions: true,
200 handles: {},
201 parameters: {
202 pub cert_info: Tpm2bDigest,
203 }
204}
205
206tpm_struct! {
207 #[derive(Debug, PartialEq, Eq, Clone)]
208 kind: Command,
209 name: TpmMakeCredentialCommand,
210 cc: TpmCc::MakeCredential,
211 no_sessions: true,
212 with_sessions: true,
213 handles: {
214 pub handle: crate::data::TpmiDhObject,
215 },
216 parameters: {
217 pub credential: Tpm2bDigest,
218 pub object_name: Tpm2bName,
219 }
220}
221
222tpm_struct! {
223 #[derive(Debug, PartialEq, Eq, Clone)]
224 kind: Response,
225 name: TpmMakeCredentialResponse,
226 cc: TpmCc::MakeCredential,
227 no_sessions: true,
228 with_sessions: true,
229 handles: {},
230 parameters: {
231 pub credential_blob: Tpm2bIdObject,
232 pub secret: Tpm2bEncryptedSecret,
233 }
234}
235
236tpm_struct! {
237 #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
238 kind: Command,
239 name: TpmUnsealCommand,
240 cc: TpmCc::Unseal,
241 no_sessions: false,
242 with_sessions: true,
243 handles: {
244 pub item_handle: crate::data::TpmiDhObject,
245 },
246 parameters: {}
247}
248
249tpm_struct! {
250 #[derive(Debug, Default, PartialEq, Eq, Clone)]
251 kind: Response,
252 name: TpmUnsealResponse,
253 cc: TpmCc::Unseal,
254 no_sessions: false,
255 with_sessions: true,
256 handles: {},
257 parameters: {
258 pub out_data: Tpm2bSensitiveData,
259 }
260}
261
262tpm_struct! {
263 #[derive(Debug, Default, PartialEq, Eq, Clone)]
264 kind: Command,
265 name: TpmObjectChangeAuthCommand,
266 cc: TpmCc::ObjectChangeAuth,
267 no_sessions: false,
268 with_sessions: true,
269 handles: {
270 pub object_handle: crate::data::TpmiDhObject,
271 pub parent_handle: crate::data::TpmiDhObject,
272 },
273 parameters: {
274 pub new_auth: Tpm2bAuth,
275 }
276}
277
278tpm_struct! {
279 #[derive(Debug, Default, PartialEq, Eq, Clone)]
280 kind: Response,
281 name: TpmObjectChangeAuthResponse,
282 cc: TpmCc::ObjectChangeAuth,
283 no_sessions: false,
284 with_sessions: true,
285 handles: {},
286 parameters: {
287 pub out_private: Tpm2bPrivate,
288 }
289}