11
11
//! [TPM]: https://en.wikipedia.org/wiki/Trusted_Platform_Module
12
12
13
13
use super :: HashAlgorithm ;
14
+ use crate :: data_types:: PhysicalAddress ;
14
15
use crate :: proto:: unsafe_protocol;
15
16
use crate :: { Result , Status } ;
16
17
use bitflags:: bitflags;
@@ -117,6 +118,19 @@ impl BootServiceCapability {
117
118
}
118
119
}
119
120
121
+ bitflags ! {
122
+ /// Flags for the [`Tcg::hash_log_extend_event`] function.
123
+ #[ derive( Default ) ]
124
+ #[ repr( transparent) ]
125
+ pub struct HashLogExtendEventFlags : u64 {
126
+ /// Extend an event but don't log it.
127
+ const EFI_TCG2_EXTEND_ONLY = 0x0000_0000_0000_0001 ;
128
+
129
+ /// Use when measuring a PE/COFF image.
130
+ const PE_COFF_IMAGE = 0x0000_0000_0000_0010 ;
131
+ }
132
+ }
133
+
120
134
/// Protocol for interacting with TPM devices.
121
135
///
122
136
/// This protocol can be used for interacting with older TPM 1.1/1.2
@@ -131,13 +145,43 @@ pub struct Tcg {
131
145
protocol_capability : * mut BootServiceCapability ,
132
146
) -> Status ,
133
147
134
- // TODO: fill these in and provide a public interface.
135
- get_event_log : unsafe extern "efiapi" fn ( ) -> Status ,
136
- hash_log_extend_event : unsafe extern "efiapi" fn ( ) -> Status ,
137
- submit_command : unsafe extern "efiapi" fn ( ) -> Status ,
138
- get_active_pcr_banks : unsafe extern "efiapi" fn ( ) -> Status ,
139
- set_active_pcr_banks : unsafe extern "efiapi" fn ( ) -> Status ,
140
- get_result_of_set_active_pcr_banks : unsafe extern "efiapi" fn ( ) -> Status ,
148
+ get_event_log : unsafe extern "efiapi" fn (
149
+ this : * mut Tcg ,
150
+ event_log_format : EventLogFormat ,
151
+ event_log_location : * mut PhysicalAddress ,
152
+ event_log_last_entry : * mut PhysicalAddress ,
153
+ event_log_truncated : * mut u8 ,
154
+ ) -> Status ,
155
+
156
+ hash_log_extend_event : unsafe extern "efiapi" fn (
157
+ this : * mut Tcg ,
158
+ flags : HashLogExtendEventFlags ,
159
+ data_to_hash : PhysicalAddress ,
160
+ data_to_hash_len : u64 ,
161
+ // Use `()` here rather than `PcrEventInputs` so that it's a
162
+ // thin pointer.
163
+ event : * const ( ) ,
164
+ ) -> Status ,
165
+
166
+ submit_command : unsafe extern "efiapi" fn (
167
+ this : * mut Tcg ,
168
+ input_parameter_block_size : u32 ,
169
+ input_parameter_block : * const u8 ,
170
+ output_parameter_block_size : u32 ,
171
+ output_parameter_block : * mut u8 ,
172
+ ) -> Status ,
173
+
174
+ get_active_pcr_banks :
175
+ unsafe extern "efiapi" fn ( this : * mut Tcg , active_pcr_banks : * mut HashAlgorithm ) -> Status ,
176
+
177
+ set_active_pcr_banks :
178
+ unsafe extern "efiapi" fn ( this : * mut Tcg , active_pcr_banks : HashAlgorithm ) -> Status ,
179
+
180
+ get_result_of_set_active_pcr_banks : unsafe extern "efiapi" fn (
181
+ this : * mut Tcg ,
182
+ operation_present : * mut u32 ,
183
+ response : * mut u32 ,
184
+ ) -> Status ,
141
185
}
142
186
143
187
impl Tcg {
0 commit comments