Add REPORTDATA binding to AttestationProvider#95
Open
tuddman wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
get_attestation_report_with_datato theAttestationProvidertrait 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 returnsError::NotSupported, keeping the change purely additive for any existing downstream implementers.LinuxTdxProvideroverrides the new method: it accepts up toTDX_REPORT_DATA_LEN(64) bytes, zero-pads shorter inputs on the right, rejects oversized input withError::NotSupported, and then forwards the buffer through the existinglinux::get_tdreport_v15_kvmdevice path. The privateget_tdreporthelper is refactored to delegate to a newget_tdreport_with_dataso all device interaction flows through a single point.The
tdx-attest quoteCLI gains a-r/--report-data <hex>flag (optional0xprefix) that routes to the new method when supplied.Tests cover the new behavior:
On non-TDX hosts the device-touching cases skip via the existing
handle_expected_tdx_errorhelper.