Skip to content

SNP: add RustCrypto verification and signed workload claims for WASM - #243

Merged
jialez0 merged 1 commit into
openanolis:mainfrom
mateo-moon:codex/snp-rustcrypto-wasm
Nov 10, 2026
Merged

jialez0 merged 1 commit into
openanolis:mainfrom
mateo-moon:codex/snp-rustcrypto-wasm

Conversation

@mateo-moon

@mateo-moon mateo-moon commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Browser verifiers cannot use the SNP backend’s native OpenSSL dependency. Add an optional snp-rustcrypto backend that shares the existing AMD certificate/report verification, generation/TCB, VMPL, REPORT_DATA, HOST_DATA and SVSM checks. Keep the native OpenSSL backend and its ARM-compatible signature conversion.

Accept both the legacy SNP evidence schema and current CoCo AA sev 7 JSON while preserving the signed report bytes. Export AMD-signed HOST_DATA, REPORT_DATA and chip ID for EAR appraisal and transport-key/nonce binding. Browser evidence must include its AMD-signed VCEK/VLEK; browsers do not fall back to a filesystem or KDS lookup. Check certificate signature parameters and the P-384 report algorithm explicitly.

Exercise RustCrypto in native test/lint jobs and the existing WASM builds. Keep the lockfile compatible with the declared Rust 1.88 toolchain and the AS test HTTP client compatible with its pinned SDK. Run the SNP checks before sudo-based tests create root-owned Cargo files.

Validation:

  • Fork validation PR #1 runs the same PR-triggered workflows against this branch. All 18 jobs pass at 2de41693c4b40fbf8e86e20cba7a78817836b4bd.
  • KBS/AS/RVPS builds, tests and lint; MySQL/encrypted-database/shared-storage tests; both Gateway API engines; all seven container builds; and all four x86_64/aarch64 native RPM build/smoke-test jobs pass.
  • WASM verifier/AS builds with TDX Rust and SNP RustCrypto, workflow lint, and Rust formatting pass.
  • All 22 shared SNP tests pass with each backend on Rust 1.88 locally, including ARM OpenSSL and RustCrypto, signed-binding rejection and legacy/current Milan/Turin evidence.

Upstream Actions approval remains separate from the fork validation results.

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@mateo-moon
mateo-moon marked this pull request as ready for review October 27, 2026 21:13
@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@jialez0

jialez0 commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

@mateo-moon Now that #246 is merged, please rebase this PR onto the latest main, remove the duplicate reqwest upgrade and reqwest-sdk alias (switching the test back to reqwest::Client), refresh Cargo.lock, and rerun CI.

@imlk0

imlk0 commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

@mateo-moon Thanks for your contribution. I've split the reqwest_sdk hack out into a separate PR: #246. This should help with your work; you'll probably want to rebase onto it ;)

Also, I notice the SNP verifier now has two implementations (the legacy OpenSSL one and the modern RustCrypto one). For maintainability, would it make sense to unify them into a single codebase? As far as I know, ring's API is fairly close to openssl-sys, so perhaps we could use conditional compilation, or just migrate everything to ring or rust-crypto. @jiale would like your take on this.

I've also noticed your PR on TNG; I'll get to that as soon as this one lands.

@mateo-moon
mateo-moon force-pushed the codex/snp-rustcrypto-wasm branch from 2de4169 to c873f70 Compare November 2, 2026 10:13
@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@mateo-moon

Copy link
Copy Markdown
Contributor Author

Thanks @imlk0 and @jialez0! Rebased onto main including #246, removed the duplicate reqwest upgrade and reqwest-sdk alias, switched the test back to reqwest::Client, and refreshed Cargo.lock.

Locally, all 22 SNP tests pass with each backend on Rust 1.88, along with the three artifact SDK regression tests, formatting, RustCrypto lint, and the verifier/AS WASM compile checks. Upstream CI is currently awaiting approval.

On unifying the SNP verifier, I agree with the maintainability concern. Evidence parsing, certificate-chain selection, chip/TCB checks, REPORT_DATA/HOST_DATA binding, SVSM handling, and claim extraction already share one path. Conditional compilation selects the certificate and signature backend.

There is still validation worth consolidating: RustCrypto explicitly restricts certificate signature parameters and the report algorithm, while the OpenSSL path delegates more to its library. My preference is shared validation with small compile-time backend adapters, backed by the same malformed-input tests.

Moving SNP entirely to RustCrypto could simplify this further, but I’d treat changing the native default as a separate step. ring provides the required signature primitives, though we would still need the X.509 parsing and validation around them, so API similarity alone wouldn’t remove that work.

@jialez0

jialez0 commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

@mateo-moon The updated code looks good to merge, and all CI checks are passing. Please rebase the branch onto the latest main and resolve the conflicts so we can use Rebase and merge; GitHub currently reports canBeRebased=false. A local replay encounters conflicts in deps/verifier/Cargo.toml and deps/verifier/src/snp/mod.rs. Please rerun CI after the rebase.

Share SNP evidence, workload-binding and claim handling across the native OpenSSL and optional RustCrypto backends. Accept current CoCo evidence without changing the signed report bytes, and exercise both backends and WASM builds in CI.
@mateo-moon
mateo-moon force-pushed the codex/snp-rustcrypto-wasm branch from c873f70 to 95ee31d Compare November 4, 2026 10:49
@ostest-bot

Copy link
Copy Markdown

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

@ostest-bot

Copy link
Copy Markdown

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

@mateo-moon

Copy link
Copy Markdown
Contributor Author

Thanks @jialez0! Cleaned up the history into one commit on latest main, now at 95ee31d. GitHub reports rebaseable=true.

The source tree is unchanged from the previous head that passed all 18 checks. Fresh CI runs were triggered, but they’re awaiting maintainer approval. Could you approve those when you have a moment?

@jialez0 jialez0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Thanks @mateo-moon

@jialez0
jialez0 merged commit 5d896be into openanolis:main Nov 10, 2026
18 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.

4 participants