Skip to content

Commit 23fd8a2

Browse files
tpm: Fill in the remaining v2 TCG function pointers
1 parent 15951c5 commit 23fd8a2

File tree

1 file changed

+51
-7
lines changed

1 file changed

+51
-7
lines changed

uefi/src/proto/tcg/v2.rs

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//! [TPM]: https://en.wikipedia.org/wiki/Trusted_Platform_Module
1212
1313
use super::HashAlgorithm;
14+
use crate::data_types::PhysicalAddress;
1415
use crate::proto::unsafe_protocol;
1516
use crate::{Result, Status};
1617
use bitflags::bitflags;
@@ -117,6 +118,19 @@ impl BootServiceCapability {
117118
}
118119
}
119120

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+
120134
/// Protocol for interacting with TPM devices.
121135
///
122136
/// This protocol can be used for interacting with older TPM 1.1/1.2
@@ -131,13 +145,43 @@ pub struct Tcg {
131145
protocol_capability: *mut BootServiceCapability,
132146
) -> Status,
133147

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,
141185
}
142186

143187
impl Tcg {

0 commit comments

Comments
 (0)