Skip to content

Add REPORTDATA binding to AttestationProvider#95

Open
tuddman wants to merge 1 commit into
IntelLabs:mainfrom
tuddman:add-reportdata-binding
Open

Add REPORTDATA binding to AttestationProvider#95
tuddman wants to merge 1 commit into
IntelLabs:mainfrom
tuddman:add-reportdata-binding

Conversation

@tuddman

@tuddman tuddman commented May 13, 2026

Copy link
Copy Markdown

Adds get_attestation_report_with_data to the AttestationProvider trait so callers can bind a challenge (typically a nonce or a hash of a verifier-supplied transcript) into the TEE's REPORTDATA field. The default trait implementation returns Error::NotSupported, keeping the change purely additive for any existing downstream implementers.

LinuxTdxProvider overrides the new method: it accepts up to TDX_REPORT_DATA_LEN (64) bytes, zero-pads shorter inputs on the right, rejects oversized input with Error::NotSupported, and then forwards the buffer through the existing linux::get_tdreport_v15_kvm device path. The private get_tdreport helper is refactored to delegate to a new get_tdreport_with_data so all device interaction flows through a single point.

The tdx-attest quote CLI gains a -r/--report-data <hex> flag (optional 0x prefix) that routes to the new method when supplied.

Tests cover the new behavior:

  • trait default returns NotSupported
  • oversize (>64 byte) input is rejected
  • short input (32-byte nonce) is accepted and zero-padded
  • full-length (64-byte) input is accepted
  • empty input behaves like the existing no-arg path

On non-TDX hosts the device-touching cases skip via the existing handle_expected_tdx_error helper.

Adds `get_attestation_report_with_data` to the `AttestationProvider`
trait so callers can bind a challenge (typically a nonce or a hash of a
verifier-supplied transcript) into the TEE's REPORTDATA field. The
default trait implementation returns `Error::NotSupported`, keeping the
change purely additive for any existing downstream implementers.

`LinuxTdxProvider` overrides the new method: it accepts up to
`TDX_REPORT_DATA_LEN` (64) bytes, zero-pads shorter inputs on the right,
rejects oversized input with `Error::NotSupported`, and then forwards
the buffer through the existing `linux::get_tdreport_v15_kvm` device
path. The private `get_tdreport` helper is refactored to delegate to a
new `get_tdreport_with_data` so all device interaction flows through a
single point.

The `tdx-attest quote` CLI gains a `-r/--report-data <hex>` flag
(optional `0x` prefix) that routes to the new method when supplied.

Tests cover the new behavior:
  - trait default returns NotSupported
  - oversize (>64 byte) input is rejected
  - short input (32-byte nonce) is accepted and zero-padded
  - full-length (64-byte) input is accepted
  - empty input behaves like the existing no-arg path

On non-TDX hosts the device-touching cases skip via the existing
`handle_expected_tdx_error` helper.

Signed-off-by: tuddman@users.noreply.github.com <tuddman@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant