Skip to content

TLS13-C8: FETCHS.BIN — the first guest HTTPS consumer - #1286

Merged
drawmeanelephant merged 1 commit into
mainfrom
agent/autocoder/tls13-c8
Sep 15, 2026
Merged

drawmeanelephant merged 1 commit into
mainfrom
agent/autocoder/tls13-c8

Conversation

@drawmeanelephant

Copy link
Copy Markdown
Owner

Closes the consumer gap tracked under #1268.

What this is

user/src/fetchs.zig: a guest program that connects to the host gateway on 443 over the kernel TCP seam, completes a 1-RTT TLS 1.3 handshake against a vendored root set, sends one HTTP/1.0 GET, and streams the response body to the console.

Three seams had to meet, each now in its own file:

Layer File
Kernel TCP (one-slot, 192 B, no reassembly) → the client's byte-stream transport lib/tls/stream.zig (C7, #1280)
The root set as a static blob (ADR 0029 D5) lib/tls/vendored_roots.zig + vectors/emit_vendored_roots.py
Entropy (rng, slot 64) and the validity clock (ui.sys_time, slot 66)

The clock matters: a certificate check with no clock cannot tell "not yet valid" from "valid", and the guest does expose one.

Evidence

zig build        → FETCHS.BIN: entry_offset=0x484 image_size=239176
                   text=81920 data=157208 (bss tail 4104) from 3 PT_LOAD segments
zig build image  → artifacts/disk.img, contents verified
zig build test   → 196/196 steps succeeded; 3572/3572 tests passed

One real trap on the way: the guest entry convention is pub export fn _start() callconv(.c) noreturn, and the linker script's ENTRY(_start) silently turned my pub fn main into an empty 472-byte stub rather than erroring. Worth knowing for the next app.

Honest limit

Compile- and image-verified, not runtime-verified. Its behaviour against a live responder needs a VZ boot this session cannot perform. The class-B gate that would prove it (live-tls13-handshake: guest TLS.BIN/FETCHS.BIN against the runner's TLS responder) is specified in user/src/lib/tls/INTEGRATION.md, and cannot be committed before the runner has that responder — every vgate spec needs a guest boot, and a spec that cannot run fails the fleet.

The consumer the criterion actually asked for. `user/src/fetchs.zig` connects to
the host gateway on 443 over the kernel's TCP seam, completes a 1-RTT TLS 1.3
handshake against a vendored root set, sends one HTTP/1.0 GET, and streams the
response body to the console.

Three seams that had to meet, each now in its own file:
  * lib/tls/stream.zig      the one-slot 192-byte no-reassembly TCP buffer
                            bridged to the client's byte-stream transport (C7);
  * lib/tls/vendored_roots.zig  the root set as a static blob (ADR 0029 D5),
                            generated by vectors/emit_vendored_roots.py from
                            the fixture set, so the guest holds roots in the
                            image rather than fetching them per connection;
  * rng (slot 64) for entropy and ui.sys_time() (slot 66) for the validity
                            clock — a certificate check without a clock cannot
                            tell "not yet valid" from "valid", and the guest
                            does have one.

DSK3 segmented, because the trust store and the adapter accumulator are static
.bss that the flat ESP layout cannot express. Built with the repo's real
convention: `pub export fn _start() callconv(.c) noreturn` (the first attempt
used `pub fn main`, which the `ENTRY(_start)` linker script silently turned
into an empty 472-byte stub).

Evidence:
  zig build        -> FETCHS.BIN, entry_offset=0x484, image 239176 B,
                      text 81920, data 157208, 3 PT_LOAD segments
  zig build image  -> artifacts/disk.img, contents verified
  zig build test   -> 196/196 steps, 3572/3572 tests

HONEST LIMIT: this is compile- and image-verified. Its runtime behaviour
against a live responder needs a VZ boot, which this session cannot perform;
the class-B gate that would prove it is specified in INTEGRATION.md and cannot
be committed until the runner has a TLS responder (every vgate spec needs a
guest boot, and a spec that cannot run fails the fleet).
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