1use crate::{
8 data::{
9 Tpm2b, Tpm2bDigest, TpmAlgId, TpmCc, TpmRh, TpmiYesNo, TpmlDigest, TpmlDigestValues,
10 TpmlPcrSelection,
11 },
12 tpm_response, tpm_struct,
13};
14use core::{convert::TryFrom, fmt::Debug};
15
16tpm_struct!(
17 #[derive(Debug, PartialEq, Eq, Clone)]
18 TpmPcrEventCommand,
19 TpmCc::PcrEvent,
20 false,
21 true,
22 1,
23 {
24 pub event_data: Tpm2b,
25 }
26);
27
28tpm_struct!(
29 #[derive(Debug, Default, PartialEq, Eq, Clone)]
30 TpmPcrReadCommand,
31 TpmCc::PcrRead,
32 true,
33 false,
34 0,
35 {
36 pub pcr_selection_in: TpmlPcrSelection,
37 }
38);
39
40tpm_struct!(
41 #[derive(Debug, Default, PartialEq, Eq, Clone)]
42 TpmPcrReadResponse,
43 TpmCc::PcrRead,
44 true,
45 false,
46 0,
47 {
48 pub pcr_update_counter: u32,
49 pub pcr_selection_out: TpmlPcrSelection,
50 pub pcr_values: TpmlDigest,
51 }
52);
53
54tpm_response!(
55 #[derive(Debug, Default, PartialEq, Eq, Clone)]
56 TpmPcrEventResponse,
57 TpmCc::PcrEvent,
58 false,
59 true,
60 {
61 pub digests: TpmlDigestValues,
62 }
63);
64
65tpm_struct!(
66 #[derive(Debug, PartialEq, Eq, Clone)]
67 TpmPcrExtendCommand,
68 TpmCc::PcrExtend,
69 false,
70 true,
71 1,
72 {
73 pub digests: TpmlDigestValues,
74 }
75);
76
77tpm_response!(
78 #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
79 TpmPcrExtendResponse,
80 TpmCc::PcrExtend,
81 false,
82 true,
83 {}
84);
85
86tpm_struct!(
87 #[derive(Debug, PartialEq, Eq, Clone)]
88 TpmPcrAllocateCommand,
89 TpmCc::PcrAllocate,
90 false,
91 true,
92 1,
93 {
94 pub pcr_allocation: TpmlPcrSelection,
95 }
96);
97
98tpm_response!(
99 #[derive(Debug, PartialEq, Eq, Clone)]
100 TpmPcrAllocateResponse,
101 TpmCc::PcrAllocate,
102 false,
103 true,
104 {
105 pub allocation_success: TpmiYesNo,
106 pub max_pcr: u32,
107 pub size_needed: u32,
108 pub size_available: u32,
109 }
110);
111
112tpm_struct!(
113 #[derive(Debug, PartialEq, Eq, Clone)]
114 TpmPcrSetAuthPolicyCommand,
115 TpmCc::PcrSetAuthPolicy,
116 false,
117 true,
118 1,
119 {
120 pub auth_policy: Tpm2bDigest,
121 pub hash_alg: TpmAlgId,
122 pub pcr_num: TpmRh,
123 }
124);
125
126tpm_response!(
127 #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
128 TpmPcrSetAuthPolicyResponse,
129 TpmCc::PcrSetAuthPolicy,
130 false,
131 true,
132 {}
133);
134
135tpm_struct!(
136 #[derive(Debug, PartialEq, Eq, Clone)]
137 TpmPcrSetAuthValueCommand,
138 TpmCc::PcrSetAuthValue,
139 false,
140 true,
141 1,
142 {
143 pub auth: Tpm2bDigest,
144 }
145);
146
147tpm_response!(
148 #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
149 TpmPcrSetAuthValueResponse,
150 TpmCc::PcrSetAuthValue,
151 false,
152 true,
153 {}
154);
155
156tpm_struct!(
157 #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
158 TpmPcrResetCommand,
159 TpmCc::PcrReset,
160 false,
161 true,
162 1,
163 {}
164);
165
166tpm_response!(
167 #[derive(Debug, Default, PartialEq, Eq, Copy, Clone)]
168 TpmPcrResetResponse,
169 TpmCc::PcrReset,
170 false,
171 true,
172 {}
173);