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