Skip to content

XNetworking: read CERT_CHAIN_CONTEXT at its real offsets - #47

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
gefydev:xnetworking-chain-offsets
Nov 22, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
gefydev:xnetworking-chain-offsets

Conversation

@gefydev

@gefydev gefydev commented Nov 22, 2026

Copy link
Copy Markdown
Member

extract_chain_certs read cChain / rgpChain at +16 / +24 and cElement / rgpElement at +20 / +24. Both structs start with cbSize and an 8-byte CERT_TRUST_STATUS, so in wincrypt.h the counts are at +12 and the arrays at +16. The walk found no chain, and XNetworkingVerifyServerCertificate failed every thumbprint pin with CERT_E_UNTRUSTEDROOT. This only affects titles that pass pins; without pins the chain's certificates are not compared.

The chain is now read through small repr(C) structs, like the other CryptoAPI structs in the file, so no new windows-sys feature is needed. #37 fixed the same thing and was closed by its author. This is a smaller version of that fix.

Validation

  • New test chain_certs_read_at_the_sdk_offsets builds a chain byte by byte at the documented offsets. It fails on main (no certificates come back) and passes with the fix.
  • cargo test -p xcl --lib: 330 passed, 0 failed, on Windows GNU under Wine. I did not run the e2e or GPU tests.

extract_chain_certs read cChain / rgpChain at +16 / +24 and cElement /
rgpElement at +20 / +24. In wincrypt.h both structs have cbSize and an
8-byte CERT_TRUST_STATUS first, so the counts sit at +12 and the arrays
at +16. At +24 of the chain context is cLowerQualityChainContext, so the
walk found no chain and XNetworkingVerifyServerCertificate failed every
thumbprint pin with CERT_E_UNTRUSTEDROOT.

The chain is now read through small repr(C) structs. The test builds a
chain byte by byte at the documented offsets; the old code returns no
certificates for it.
@ivall
ivall merged commit f5e6b7a into xcl-dev:main Nov 22, 2026
@ivall

ivall commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Thanks, merged! The offsets match wincrypt.h on x64: cChain / cElement @ +12 after cbSize and the 8-byte CERT_TRUST_STATUS, the arrays @ +16, pCertContext @ +8. I checked it with the MSVC toolchain on Windows: all tests pass, 337 lib tests with your new one, the e2e test title, and the GPU tests.

rootw0rm pushed a commit to rootw0rm/xcl that referenced this pull request Nov 27, 2026
…wports/scissors/topo) into ListDrawRecord

List slots xcl-dev#34 (SetGraphicsRootSignature), xcl-dev#50 (OMSetRenderTargets),
xcl-dev#47 (IASetIndexBuffer), plus PC-side xcl-dev#20/xcl-dev#21/xcl-dev#22 (topology, viewports,
scissors) store into ListDrawRecord. SetPipelineState (xcl-dev#25) now merges
instead of overwriting so PSO-first or state-first order both keep the
full record. Store-only: no draw, no validation, no execute; triangle/
bias FAILs stay failing.

Evidence: new draw_s2_list_state_recorded_pre_draw fails pre-change
(S2 symbols absent at HEAD: grep count 0) and passes post; full lib
806 passed, 0 failed, 1 ignored; both cargo checks clean; title null
4 FAILs identical to HEAD-baseline worktree run (triangle, present,
bias-xcl-dev#94, all D3D12.X GPU-only, + pre-existing files:delete also on
HEAD), delta 0; Vulkan 3 (triangle, bias-xcl-dev#94 + same files:delete);
retail HOLDS (exit 139 @ exe+0x2237320, SIGSEGV fault 0, 20 stubs,
xgr XAsync/XNetworking/XUser, 0 d3d12).
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