Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions igvm_defs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,14 @@ pub enum IgvmVariableHeaderType {
/// specified by a structure of type [`IGVM_VHS_PARAMETER`].
#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
IGVM_VHT_ENVIRONMENT_INFO_PARAMETER = 0x313,
/// A Corim measurement structure described by [`IGVM_VHS_CORIM_MEASUREMENT`].
/// FIXME: should this be an init header to be early in the file?
#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
IGVM_VHT_CORIM_MEASUREMENT = 0x314,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call it IGVM_VHT_CORIM_DOCUMENT that aligns better with spec?

/// A Corim signature structure described by [`IGVM_VHS_CORIM_SIGNATURE`].
/// FIXME: should this be an init header to be early in the file?
#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
IGVM_VHT_CORIM_SIGNATURE = 0x315,
}

/// The range of header types for platform structures.
Expand Down Expand Up @@ -1237,3 +1245,57 @@ pub enum VbsSigningAlgorithm {
/// ECDSA P384.
ECDSA_P384 = 0x1,
}

/// A structure defining a CoRIM CBOR payload for a given platform. TODO: rename

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A structure defining a CoRIM CBOR payload for a given platform. TODO: rename
/// A structure defining a CoRIM document for a given platform.

/// to remove measurement?
///
/// The payload described by this header is a CBOR CoRIM payload. There may only

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to be have a similar level of detail here as below, pointing to section 4.1 of the spec, and explicitly calling it out as a tagged unsigned CoRIM map.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// The payload described by this header is a CBOR CoRIM payload. There may only
/// The payload described by this header is a CoRIM document described in RFC https://datatracker.ietf.org/doc/draft-ietf-rats-corim/. There may only

/// be one for a given platform. There may be an associated COSE_Sign1 structure
/// wrapping this payload, see [`IGVM_VHS_CORIM_SIGNATURE`].

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For detached mode

Suggested change
/// wrapping this payload, see [`IGVM_VHS_CORIM_SIGNATURE`].
/// for this payload, see [`IGVM_VHS_CORIM_SIGNATURE`].

///
/// The CoRIM payload must adhere to the following specifications for each

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// The CoRIM payload must adhere to the following specifications for each
/// The CoRIM document must adhere to the following specifications for each

/// platform:
///
/// | Platform | Specification |
/// |----------|---------------|
/// | Intel TDX | TBD |
/// | VBS | TBD |
/// | AMD SEV-SNP | TBD |
/// | ARM CCA | TBD |
#[repr(C)]
#[derive(Copy, Clone, Debug, IntoBytes, Immutable, KnownLayout, FromBytes)]
struct IGVM_VHS_CORIM_MEASUREMENT {
/// Compatibility mask.
pub compatibility_mask: u32,
/// File offset for the CoRIM CBOR payload.
pub file_offset: u32,
/// Size in bytes of the CoRIM CBOR payload.
pub size_bytes: u32,
/// Reserved.
pub reserved: u32,
}

/// This is a signed COSE_Sign1 structure wrapping a CoRIM CBOR payload for a

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// This is a signed COSE_Sign1 structure wrapping a CoRIM CBOR payload for a
/// A COSE_Sign1 structure that signs the CoRIM document for a given platform.
/// The associated document is defined in [`IGVM_VHS_CORIM_DOCUMENT`].
/// This structure always corresponds to a document and uses a detached payload,
/// so the document itself is not embedded here.

/// given platform. The payload measured by this CBOR is described the
/// corresponding [`IGVM_VHS_CORIM_MEASUREMENT`] structure. There cannot be this
/// structure without that one.
///
/// Note that a user may choose to create a single CBOR containing this
/// COSE_Sign1 with the payload filled in by the other corim measurement
/// structure.
///
/// The payload described by this header is a COSE_Sign1 structure described in
/// section 4.2 in RFC https://datatracker.ietf.org/doc/draft-ietf-rats-corim/,
/// which is a COSE_Sign1 structure with a CBOR corim payload.
#[repr(C)]
#[derive(Copy, Clone, Debug, IntoBytes, Immutable, KnownLayout, FromBytes)]
struct IGVM_VHS_CORIM_SIGNATURE {
/// Compatibility mask.
pub compatibility_mask: u32,
/// File offset for the COSE_Sign1 measurement payload.
pub file_offset: u32,
/// Size in bytes of the COSE_Sign1 measurement payload.
pub size_bytes: u32,
/// Reserved.
pub reserved: u32,
}