Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9a73fb1

Browse files
committedJul 15, 2024
tcg: Impl Eq/PartialEq for PcrEventInputs
A manual implementation is required since this is a packed struct.
1 parent 9c2f94d commit 9a73fb1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed
 

‎uefi/src/proto/tcg/v2.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ struct EventHeader {
157157
/// `TCG_PCR_EVENT2` for reading events. To help clarify the usage, our
158158
/// API renames these types to `PcrEventInputs` and `PcrEvent`,
159159
/// respectively.
160-
#[derive(Pointee)]
160+
#[derive(Eq, Pointee)]
161161
#[repr(C, packed)]
162162
pub struct PcrEventInputs {
163163
size: u32,
@@ -228,6 +228,15 @@ impl Debug for PcrEventInputs {
228228
}
229229
}
230230

231+
// Manual `PartialEq` implementation since it can't be derived for a packed DST.
232+
impl PartialEq for PcrEventInputs {
233+
fn eq(&self, other: &PcrEventInputs) -> bool {
234+
self.size == other.size
235+
&& self.event_header == other.event_header
236+
&& self.event == other.event
237+
}
238+
}
239+
231240
#[repr(C, packed)]
232241
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
233242
struct AlgorithmDigestSize {

0 commit comments

Comments
 (0)
Please sign in to comment.