Skip to content

feat(attester): add pure-Go attester library (attester-go)#98

Merged
jialez0 merged 1 commit into
inclavare-containers:mainfrom
jialez0:feat/attester-go
Jul 16, 2026
Merged

feat(attester): add pure-Go attester library (attester-go)#98
jialez0 merged 1 commit into
inclavare-containers:mainfrom
jialez0:feat/attester-go

Conversation

@jialez0

@jialez0 jialez0 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

What

Adds attestation-agent/attester-go, a pure-Go re-implementation of the attester crate. It collects TEE attestation evidence from a confidential guest and produces evidence whose JSON is byte-compatible with the Rust attester, so it verifies against an unmodified Trustee attestation-service.

Why

To let Go programs collect TEE evidence with no cgo and no external shared library — in particular without libtdx_attest.so/DCAP. Every platform is driven through native kernel interfaces (ConfigFS TSM, ioctl on /dev/tdx_guest, /dev/sev-guest, /dev/csv-guest, vsock). The default build (CGO_ENABLED=0) is a fully static binary with zero platform .so dependencies, so one binary runs across heterogeneous TEE hosts and undetected platforms are simply skipped.

Platforms

  • sample — software measurement register + event log.
  • TDX — all quote paths of the Rust attester, natively:
    1. ConfigFS TSM (/sys/kernel/config/tsm/report), primary;
    2. GET_REPORT0 + QGS message over vsock (when /etc/tdx-attest.conf sets a port);
    3. TDX_CMD_GET_QUOTE TDVMCALL ioctl (what libtdx_attest does internally, reimplemented without the library).
      Plus GET_REPORT0 for BindInitData/GetRuntimeMeasurement and RTMR extend (sysfs + TDX_CMD_EXTEND_RTMR ioctl).
  • SNP/dev/sev-guest SNP_GET_EXT_REPORT (report + cert chain).
  • CSV/dev/csv-guest CSV_GET_REPORT with a self-contained SM3, PEK/serial extraction, optional HSK/CEK download from the Hygon KDS.
  • GPU evidence (optional, -tags gpu) — NVIDIA NVML via go-nvml, which dlopens libnvidia-ml at runtime (no hard dependency; the binary still starts without a driver).

Evidence compatibility

The evidence structs reproduce serde_json's exact output of the Rust types: fixed [u8; N] render as number arrays ([N]byte, never base64), Vec<u8> fields that must be number arrays use a custom marshaler, newtype wrappers render as bare numbers, SNP cert_type as bare string / {"OTHER":...}, and Option fields keep the exact null/omitted behaviour.

Testing

  • TDX: validated end-to-end on real Intel TDX hardware — the GET_QUOTE TDVMCALL ioctl path produces a valid quote, and both the input report_data and the RTMRs read via GET_REPORT0 are verified to be embedded in the produced quote.
  • sample: unit-tested.
  • SNP/CSV: struct sizes and JSON byte-format are locked by unit tests; the ioctl collection paths follow the sev 4.0.0 and csv-rs ABIs but have not yet been exercised on real SNP/CSV hardware.

Notes

  • New self-contained Go module under attestation-agent/attester-go; does not touch the existing Rust crates.
  • Default build depends only on golang.org/x/sys; go-nvml is pulled in only under -tags gpu.

@shankailun-aliyun

Copy link
Copy Markdown
Collaborator

@jialez0 ,您好,您的请求已接收,请耐心等待结果。

@shankailun-aliyun

Copy link
Copy Markdown
Collaborator

@jialez0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

Add attestation-agent/attester-go, a pure-Go re-implementation of the
`attester` crate that collects TEE evidence with no cgo and no external
shared library (in particular without libtdx_attest/DCAP). Evidence is
JSON byte-compatible with the Rust attester so it verifies against an
unmodified Trustee attestation-service.

Platforms: sample, TDX (ConfigFS TSM + GET_REPORT0/QGS over vsock +
GET_QUOTE TDVMCALL ioctl, all native), SNP (/dev/sev-guest ioctl), CSV
(/dev/csv-guest ioctl, self-contained SM3). Optional NVIDIA GPU evidence
behind the `gpu` build tag via go-nvml (dlopen, no hard dependency).

Code is organized into an `api` contract package, `internal` helpers
(ioctl/eventlog/tsm/sm3/util) and one package per platform under
`platform/`, wired by a thin top-level facade.

The default build is fully static (CGO_ENABLED=0). TDX has been validated
end-to-end on real Intel TDX hardware.

Signed-off-by: Jiale Zhang <zhangjiale@linux.alibaba.com>
@jialez0
jialez0 force-pushed the feat/attester-go branch from 69acb12 to 6c742b2 Compare July 15, 2026 11:32
@shankailun-aliyun

Copy link
Copy Markdown
Collaborator

@jialez0 ,您好,您的请求已接收,请耐心等待结果。

@shankailun-aliyun

Copy link
Copy Markdown
Collaborator

@jialez0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start

@jialez0
jialez0 merged commit 324018c into inclavare-containers:main Jul 16, 2026
10 checks passed
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.

2 participants