1use bitfield_struct::bitfield;
7use zerocopy::FromBytes;
8use zerocopy::Immutable;
9use zerocopy::IntoBytes;
10use zerocopy::KnownLayout;
11
12pub const VBS_REPORT_SIZE: usize = 0x230;
14
15#[repr(C)]
16#[derive(IntoBytes, Immutable, KnownLayout, FromBytes)]
17pub struct VbsReportPackageHeader {
18 pub package_size: u32,
20 pub version: u32,
22 pub signature_scheme: u32,
24 pub signature_size: u32,
26 pub _reserved: u32,
28}
29
30#[repr(C)]
32#[derive(IntoBytes, Immutable, KnownLayout, FromBytes)]
33pub struct VbsVmIdentity {
34 pub owner_id: [u8; 32],
36 pub measurement: [u8; 32],
38 pub signer: [u8; 32],
40 pub host_data: [u8; 32],
42 pub enabled_vtl: VtlBitMap,
44 pub policy: SecurityAttributes,
46 pub guest_vtl: u32,
48 pub guest_svn: u32,
50 pub guest_product_id: u32,
52 pub guest_module_id: u32,
54 pub _reserved: [u8; 64],
56}
57
58#[repr(C)]
60#[derive(IntoBytes, Immutable, KnownLayout, FromBytes)]
61pub struct VbsReport {
62 pub header: VbsReportPackageHeader,
64 pub version: u32,
66 pub report_data: [u8; 64],
68 pub identity: VbsVmIdentity,
70 pub signature: [u8; 256],
72}
73
74static_assertions::const_assert_eq!(VBS_REPORT_SIZE, size_of::<VbsReport>());
75
76#[bitfield(u32)]
78#[derive(IntoBytes, Immutable, KnownLayout, FromBytes, PartialEq, Eq)]
79pub struct VtlBitMap {
80 pub vtl0: bool,
82 pub vtl1: bool,
84 pub vtl2: bool,
86 #[bits(29)]
87 pub _reserved: u32,
88}
89
90#[bitfield(u32)]
92#[derive(IntoBytes, Immutable, KnownLayout, FromBytes, PartialEq, Eq)]
93pub struct SecurityAttributes {
94 pub debug_allowed: bool,
96 #[bits(31)]
97 pub _reserved: u32,
98}