Skip to content

Correcting SGX-ISA types and functions related to TDX support (Related to RTE-678)#914

Open
Taowyoo wants to merge 4 commits intomasterfrom
yx/better-name-of-report-mac-struct
Open

Correcting SGX-ISA types and functions related to TDX support (Related to RTE-678)#914
Taowyoo wants to merge 4 commits intomasterfrom
yx/better-name-of-report-mac-struct

Conversation

@Taowyoo
Copy link
Copy Markdown
Collaborator

@Taowyoo Taowyoo commented Mar 31, 2026

Since REPORTMACSTRUCT is used by both SGX and TDX.
The naming should not strict to TDX.

This PR:

  1. Renames the type to ReportMacStruct and move to the main crate level instead of under tdx module namespace.
  2. Keeps backward compatibility by adding a type alias using old name.
  3. verify function now is part of ReportMac instead of TdxReportV1, although maintaining compatibility that the verify function still exists in TdxReportV1
  4. Move the internal tdx_arch module to be part of entire arch module in the crate.
  5. Refactor the arch module to allow non-upstreamed new instruction sets to be used without breaking the entire module namespace in the main lib.rs file.
  6. Move all TdxError crates out as it is more relevant to tdx-ql crate. The error from SGX-ISA should be only the ErrorCode types. TdxError is not part of the ISA.
  7. Add proper enum to ReportType possible known constants, instead of a singular constants.

@Taowyoo Taowyoo force-pushed the yx/better-name-of-report-mac-struct branch from 825b9db to bdc9bdc Compare March 31, 2026 20:32
@Taowyoo Taowyoo self-assigned this Mar 31, 2026
@Taowyoo Taowyoo added the C-sgx-isa Crate: sgx-isa label Mar 31, 2026
- Rename the `TdxReportMac` struct to `ReportMac`
- Add `TdxReportMac` type alias for backward compatibility
@gilanghamidy
Copy link
Copy Markdown
Member

@Taowyoo I will help taking over the further revision, so you don't have to worry about it. :)

@gilanghamidy gilanghamidy assigned gilanghamidy and unassigned Taowyoo Apr 7, 2026
@gilanghamidy gilanghamidy force-pushed the yx/better-name-of-report-mac-struct branch 5 times, most recently from b3ba000 to 35a04aa Compare April 7, 2026 17:17
- `verify` function now is part of `ReportMac` instead of
  `TdxReportV1`, although maintaining compatibility that the `verify`
  function still exists in `TdxReportV1`
- Move the internal `tdx_arch` module to be part of entire `arch`
  module in the crate.
- Move `ReportMac` to the main crate level instead of under `tdx`
  module namespace
- Move all `TdxError` crates out as it is more relevant to `tdx-ql`
  crate. The error from SGX-ISA should be only the `ErrorCode` types.
  `TdxError` is not part of the ISA.
@gilanghamidy gilanghamidy force-pushed the yx/better-name-of-report-mac-struct branch from 35a04aa to eee73c8 Compare April 7, 2026 17:47
@gilanghamidy gilanghamidy requested a review from sardok April 8, 2026 08:18
@gilanghamidy gilanghamidy dismissed their stale review April 8, 2026 08:19

I am taking over this PR, so it will require another reviewer.

Copy link
Copy Markdown
Member

@jethrogb jethrogb left a comment

Choose a reason for hiding this comment

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

A lot of my comments are simply about consistency with how other types were already being defined in this crate. Please review all types that were recently added for consistency.

}

impl ReportMac {
pub const UNPADDED_SIZE: usize = 256;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Missing TRUNCATED_SIZE const

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need that? Because the MAC itself is verified by everifyreport2, and software basically has no means to verify that. So we don't need the implementation like in the sgx_isa::Report type where there is verify function that uses a closure that splits the MAC and the rest of the data.

@gilanghamidy gilanghamidy force-pushed the yx/better-name-of-report-mac-struct branch 2 times, most recently from 300d702 to da8a740 Compare April 8, 2026 11:00
@gilanghamidy gilanghamidy force-pushed the yx/better-name-of-report-mac-struct branch from da8a740 to 629ca86 Compare April 8, 2026 11:02
@gilanghamidy gilanghamidy changed the title Better name of rust type for REPORTMACSTRUCT Correcting SGX-ISA types and functions related to TDX support (Related to RTE-678) Apr 8, 2026
@gilanghamidy gilanghamidy requested a review from jethrogb April 10, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-sgx-isa Crate: sgx-isa

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants