From eb8c91601e524907c0bd8b1fbce5ce0e3e2d7e3f Mon Sep 17 00:00:00 2001 From: JC-000 <3798556+JC-000@users.noreply.github.com> Date: Sat, 17 Oct 2026 21:54:02 -0500 Subject: [PATCH 1/7] Release v0.6.0: PQ_HYBRID=1 in uci-onchip and uci-comb (matrix, manifest text, README) Co-Authored-By: Claude Sonnet 5.5 --- README.md | 14 +++++++------- tools/package/_common.sh | 4 ++-- tools/package/build_prgs.sh | 4 ++-- tools/package/write_manifest.sh | 6 ++++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 66b5fc8..a32016e 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ An HTTPS client for the Commodore 64 in 6502 assembly. Implements TLS 1.3 over T ## I just want to run it Grab a release — latest is -[**v0.5.1**](https://github.com/JC-000/c64-https/releases/tag/v0.5.1). +[**v0.6.0**](https://github.com/JC-000/c64-https/releases/tag/v0.6.0). It replaces every earlier release; see its release notes for what changed. Every build is prebuilt, as a `.prg` and as a bootable `.d64`. No assembler, no cc65, no Python packages, no build step. `MANIFEST.txt` in @@ -28,8 +28,8 @@ the release walks you through the choice: | image | for | note | |---|---|---| | `c64-https-ip65-onchip` | bone-stock C64 + RR-Net cartridge | maximum compatibility: no REU, no turbo, nothing optional. If you are not sure what you have, this is the one that runs. ~36 min per handshake at 1 MHz. | -| `c64-https-uci-onchip` | Ultimate 64 / C64 Ultimate at turbo, REU off | boots straight to the menu | -| `c64-https-uci-comb` | Ultimate 64 / C64 Ultimate at turbo, REU **on** | fastest — 1.73x quicker verify (16.4 s vs 28.4 s, U64E at 48 MHz). Builds a 16 KB table into REU bank 2 at each boot first: ~34 s at 64 MHz, ~45 s at 48 MHz. | +| `c64-https-uci-onchip` | Ultimate 64 / C64 Ultimate at turbo, REU off | boots straight to the menu; offers the hybrid X25519MLKEM768 (post-quantum) key exchange | +| `c64-https-uci-comb` | Ultimate 64 / C64 Ultimate at turbo, REU **on** | fastest — 1.73x quicker verify (16.4 s vs 28.4 s, U64E at 48 MHz). Builds a 16 KB table into REU bank 2 at each boot first: ~34 s at 64 MHz, ~45 s at 48 MHz. Also offers X25519MLKEM768 (+1.7 s, n=1). | | `c64-https-uci-m3-demo` | Ultimate 64 with the M3 (ESP32 TLS) firmware | a secondary variant: TLS runs on the Ultimate's ESP32, not the 6510; needs M3 firmware. Its own README is in the release. | Every image carries **one** default host, baked in at build time (`make @@ -213,9 +213,9 @@ otherwise, and nothing here said it before: key change is not saved, so the old key still applies. To keep the store elsewhere, build with the product's own arguments from `tools/package/_common.sh` plus `TRUST_STORE_DIR=`, e.g. `make BACKEND=uci - USE_NISTCURVES_ONCHIP=1 TRUST_STORE=1 TRUST_STORE_DIR=/SD` for + USE_NISTCURVES_ONCHIP=1 TRUST_STORE=1 PQ_HYBRID=1 TRUST_STORE_DIR=/SD` for `uci-onchip`, or `make BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 - TRUST_STORE=1 TRUST_STORE_DIR=/SD` for `uci-comb`. The directory must + TRUST_STORE=1 PQ_HYBRID=1 TRUST_STORE_DIR=/SD` for `uci-comb`. The directory must already exist (the client never creates one) and be an absolute path of `A-Za-z0-9_.-` components, at most 41 characters. @@ -305,8 +305,8 @@ section of `build/c64-https.map` for the **three shipped products** | product | make args | cfg | |---|---|---| | `ip65-onchip` | `BACKEND=ip65 USE_NISTCURVES_ONCHIP=1` | `cfg/c64-https-ip65.cfg` | -| `uci-onchip` | `BACKEND=uci USE_NISTCURVES_ONCHIP=1` | `cfg/c64-https-uci.cfg` | -| `uci-comb` | `BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1` | `cfg/c64-https-uci-onchip-cold.cfg` (`COLD_BANK=0`: `cfg/c64-https-uci-onchip.cfg`) | +| `uci-onchip` | `BACKEND=uci USE_NISTCURVES_ONCHIP=1 PQ_HYBRID=1` | `cfg/c64-https-uci.cfg` | +| `uci-comb` | `BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 PQ_HYBRID=1` | `cfg/c64-https-uci-onchip-cold.cfg` (`COLD_BANK=0`: `cfg/c64-https-uci-onchip.cfg`) | Note the third row: the `-onchip*.cfg` swap is driven by `USE_NISTCURVES_ONCHIP_COMB`, **not** by `USE_NISTCURVES_ONCHIP` — plain diff --git a/tools/package/_common.sh b/tools/package/_common.sh index 52de71f..7039310 100644 --- a/tools/package/_common.sh +++ b/tools/package/_common.sh @@ -23,8 +23,8 @@ # and every downstream script picks it up with no further edits. PACKAGE_VARIANTS=( "ip65-onchip|c64-https-ip65-onchip.prg|BACKEND=ip65 USE_NISTCURVES_ONCHIP=1|ip65-noreu|ip65|MAXIMUM COMPATIBILITY. Bone-stock C64 + RR-Net / cs8900a cartridge. No REU, no turbo, nothing optional at all — the only image a completely unmodified machine can run end to end. Slowest: ~36 min per handshake at 1 MHz." - "uci-onchip|c64-https-uci-onchip.prg|BACKEND=uci USE_NISTCURVES_ONCHIP=1 TRUST_STORE=1|uci-noreu|uci|TURBO, NO REU. Ultimate 64 / C64 Ultimate at 32/48/64 MHz with the REU disabled or absent. Boots straight to the menu. Remembers each server's key on first use (TRUST.A / TRUST.B on /USB1) and refuses a changed one unless you accept it." - "uci-comb|c64-https-uci-comb.prg|BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 TRUST_STORE=1|uci-comb|uci|TURBO + REU — FASTEST. Ultimate 64 / C64 Ultimate at 32/48/64 MHz with the REU enabled. ~1.7x faster verify than the no-REU turbo image (measured: 16.4 s vs 28.4 s on a U64E at 48 MHz). Costs a one-time table build at every boot: ~34 s at 64 MHz, ~45 s at 48 MHz. Needs REU bank 2. Remembers each server's key on first use (TRUST.A / TRUST.B on /USB1) and refuses a changed one unless you accept it." + "uci-onchip|c64-https-uci-onchip.prg|BACKEND=uci USE_NISTCURVES_ONCHIP=1 TRUST_STORE=1 PQ_HYBRID=1|uci-noreu|uci|TURBO, NO REU. Ultimate 64 / C64 Ultimate at 32/48/64 MHz with the REU disabled or absent. Boots straight to the menu. Offers the hybrid X25519MLKEM768 key exchange (post-quantum, with X25519 as the fallback the server may choose): ~+1.7 s of handshake measured on the comb image (n=1, U64E at 48 MHz). Remembers each server's key on first use (TRUST.A / TRUST.B on /USB1) and refuses a changed one unless you accept it." + "uci-comb|c64-https-uci-comb.prg|BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 TRUST_STORE=1 PQ_HYBRID=1|uci-comb|uci|TURBO + REU — FASTEST. Ultimate 64 / C64 Ultimate at 32/48/64 MHz with the REU enabled. ~1.7x faster verify than the no-REU turbo image (measured: 16.4 s vs 28.4 s on a U64E at 48 MHz). Costs a one-time table build at every boot: ~34 s at 64 MHz, ~45 s at 48 MHz. Needs REU bank 2. Offers the hybrid X25519MLKEM768 key exchange (post-quantum, with X25519 as the fallback the server may choose): measured +1.7 s of handshake on the comb image, n=1, U64E at 48 MHz. Remembers each server's key on first use (TRUST.A / TRUST.B on /USB1) and refuses a changed one unless you accept it." ) # Field accessors — `variant_field <1-based index>`. diff --git a/tools/package/build_prgs.sh b/tools/package/build_prgs.sh index 4a111be..38dd624 100755 --- a/tools/package/build_prgs.sh +++ b/tools/package/build_prgs.sh @@ -5,8 +5,8 @@ # Three variants, one per shipped product (PACKAGE_VARIANTS in _common.sh): # # c64-https-ip65-onchip.prg make BACKEND=ip65 USE_NISTCURVES_ONCHIP=1 -# c64-https-uci-onchip.prg make BACKEND=uci USE_NISTCURVES_ONCHIP=1 TRUST_STORE=1 -# c64-https-uci-comb.prg make BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 TRUST_STORE=1 +# c64-https-uci-onchip.prg make BACKEND=uci USE_NISTCURVES_ONCHIP=1 TRUST_STORE=1 PQ_HYBRID=1 +# c64-https-uci-comb.prg make BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 TRUST_STORE=1 PQ_HYBRID=1 # # each with TRUST_RELEASE=1 appended (variant_make_args in _common.sh). # diff --git a/tools/package/write_manifest.sh b/tools/package/write_manifest.sh index 0645dd2..2089a81 100755 --- a/tools/package/write_manifest.sh +++ b/tools/package/write_manifest.sh @@ -87,14 +87,16 @@ echo " what you have, this is the one that will run." echo " ~36 min per handshake at 1 MHz." echo echo " uci-onchip Ultimate 64 / C64 Ultimate at turbo, REU off." -echo " Boots straight to the menu." +echo " Boots straight to the menu. Offers the hybrid" +echo " X25519MLKEM768 (post-quantum) key exchange." echo echo " uci-comb Ultimate 64 / C64 Ultimate at turbo, REU ON." echo " The fastest image: ~1.7x quicker verify than" echo " uci-onchip. It builds a 16 KB table into REU" echo " bank 2 at every boot before the menu appears —" echo " ~34 s at 64 MHz, ~45 s at 48 MHz. That is the" -echo " program working, not a hang." +echo " program working, not a hang. Also offers the" +echo " hybrid X25519MLKEM768 key exchange (+1.7 s, n=1)." echo echo " Why the split: below about 5 MHz the extra table work costs more" echo " than it saves, and below ~18 MHz the plain REU multiply path wins" From 1847ecad44017c339746eaa7c495423267dd25fa Mon Sep 17 00:00:00 2001 From: JC-000 <3798556+JC-000@users.noreply.github.com> Date: Sat, 17 Oct 2026 22:41:34 -0500 Subject: [PATCH 2/7] Release v0.6.0: banner rig prints tls_kex_group / REQUIRE_KEX, release notes draft Co-Authored-By: Claude Sonnet 5.5 --- docs/release-notes-v0.6.0.md | 93 +++++++++++++++++++++++++++++++++++ tools/uci/rig_https_banner.py | 17 +++++++ 2 files changed, 110 insertions(+) create mode 100644 docs/release-notes-v0.6.0.md diff --git a/docs/release-notes-v0.6.0.md b/docs/release-notes-v0.6.0.md new file mode 100644 index 0000000..1938601 --- /dev/null +++ b/docs/release-notes-v0.6.0.md @@ -0,0 +1,93 @@ +# c64-https v0.6.0 + +**For demonstration and educational purposes only. It is not cryptographically secure.** + +Built from the commit tagged `v0.6.0`. Submodule pins (`tools/check_upstream_pins.py`): +- `libs/mlkem` v0.6.0 (new); +- `libs/nistcurves` v0.15.0 (unchanged); +- `libs/x25519` v0.16.0 (unchanged); +- ip65 `25a9c5a` (untagged, unchanged). + +The headline: **both UCI images now offer the post-quantum hybrid key exchange X25519MLKEM768**, and have completed a fetch of the Wikipedia Commodore 64 article over it on hardware. `ip65-onchip` stays classic. + +--- + +## Assets + +| image | for | PRG sha256 | +|---|---|---| +| `c64-https-ip65-onchip` | stock C64 + RR-Net, no REU, no turbo | `e69bfce7b552e765df02cb253b4ff12cecaca3e978669376b7af5ffad9343dce` | +| `c64-https-uci-onchip` | U64E / C64 Ultimate, turbo, no REU | `3b4dd718cbdc296f2083c90ce4d89a25e1fbd032e849c66f25227ef4d0ac4d5a` | +| `c64-https-uci-comb` | U64E / C64 Ultimate, turbo + REU (fastest) | `41202de9fa6b9da769fce87a3223e7d1c74630f873b4b64a940afacddb7cbeb6` | +| `c64-https-uci-m3-demo` | U64E with the TLS-socket (ESP32) firmware | `916d41628a17b9436bbf58a71f7350c721a06e459cf5c33e5baeb1ad61af9a24` (carried forward from v0.5.1, unchanged) | + +Each image also ships as a bootable `.d64` (hashes: the release's `SHA256SUMS`, written when the assets are attached). The 1541 filenames are unchanged (`ip65-noreu`, `uci-noreu`, `uci-comb`). + +The `.prg`/`.d64` names, 1541 filenames and sizes are the same as v0.5.1 (47,105 B, 47,105 B, 51,201 B). + +--- + +## Post-quantum hybrid key exchange + +- `make` argument `PQ_HYBRID=1` is now part of the `uci-onchip` and `uci-comb` products (`tools/package/_common.sh`). The ClientHello offers `X25519MLKEM768` (0x11EC) first and `X25519` (0x001D) as well; the server picks. Against a server that picks 11EC the handshake secret is extracted from `mlkem_ss || x25519_ss` (draft-ietf-tls-ecdhe-mlkem: ML-KEM first); against one that picks X25519 nothing differs from v0.5.1. +- ML-KEM-768 comes from `libs/mlkem` (c64-mlkem v0.6.0). Its code is loaded at `$A000` and copied to `$E000` at boot; the polynomial area is `$D000-$DFFF` and is scrubbed after KeyGen and after Decaps, as are the shared secrets after the key schedule. `PQ_HYBRID` is refused on ip65, uci-m3 and the uci REU profile. +- Cost, measured on a U64E at 48 MHz, comb image, n=1: trigger to client Finished 43.7 s hybrid vs 42.0 s X25519-only, about +1.7 s (local OpenSSL listener). Against Wikipedia the release PRGs took 191-192 s (onchip) and 220-222 s (comb) for the 760 KB page, and the X25519-only control comb image 218 s. +- **What it does and does not buy.** The hybrid secret needs an attacker to break both X25519 and ML-KEM-768. This client's entropy is still weak (the DRBG is seeded from SID voice 3 and CIA1 timer A), so the ML-KEM seed and the X25519 key are not strong secrets; this is a demonstration of the protocol path, not a security claim. +- Servers: OpenSSL 3.6.5 `s_server` and en.wikipedia.org negotiate 11EC with our hello (tables below); browserleaks.com did in the P5 live run. github.com and lwn.net do not offer 11EC; a `uci-comb` fetch of github.com/robots.txt falls back to X25519 and completes (below). + +## Other changes since v0.5.1 + +- ClientHello is built in sections with 16-bit lengths and a HelloRetryRequest is refused (#312); the hybrid ServerHello is read as a stream across records (#314); the key schedule is hybrid (#315). +- The linker output no longer depends on the build locale (#311): the PRG hashes reproduce under any `LANG`. +- A linker-config edit relinks the PRG (#306); pytest is green on a uci or an ip65 build (#308); the rig trampolines set the trust-store mode (#307). +- README and M3 demo provenance fixes (#303, #310). + +## M3 demo + +Carried forward from v0.5.1 unchanged (PRG, `.d64`, README, checksum file). The M3 build does not link the 6510 TLS or crypto code, and building `BACKEND=uci-m3 HTTPS_HOST=en.wikipedia.org HTTPS_PATH=/wiki/Commodore_64` at this release reproduces the v0.5.1 PRG byte for byte (`916d4162...`), so the hardware validation recorded for it still describes these bytes. It was not re-run for this release and `tools/package/build_m3_demo.sh` was not used: it would rewrite the README around this commit and re-quote firmware provenance that nobody re-verified. + +--- + +## Validated + +Built on macOS 27.0.1, GNU Make 3.81, ca65/ld65 V2.18, `LANG=en_US.UTF-8`. `make package-verify` passed **14/14** with no SKIP (PRG reproducibility from a second clean build, load ranges off the I/O page, `.d64` read-back byte-compare and VICE boot to the banner for all three images, listener selftest). + +**Hardware, exact release PRGs** (U64E 10.43.23.81, fw 3.15 branch build, 48 MHz, `rig_https_banner.py`: menu path, `G`, typed host `en.wikipedia.org`, path `/wiki/Commodore_64`; completeness by the response's own framing; `REQUIRE_KEX=EC` makes any other group a failure). Every run is listed: + +| # | image (PRG sha256 prefix) | tls_kex_group | HTTP | body | elapsed | +|---|---|---|---|---|---| +| 1 | `uci-comb` (41202de9) | $EC | 200 | 760,609 B == Content-Length, PASS | 220 s | +| 2 | `uci-comb` (41202de9) | $EC | 200 | 760,609 B == Content-Length, PASS | 222 s | +| 3 | `uci-comb` (41202de9) | $EC | 200 | 760,609 B == Content-Length, PASS | 222 s | +| 4 | `uci-onchip` (3b4dd718) | $EC | 200 | 760,609 B == Content-Length, PASS | 191 s | +| 5 | `uci-onchip` (3b4dd718) | $EC | 200 | 760,609 B == Content-Length, PASS | 192 s | +| control | v0.5.1-equivalent classic `uci-comb` (`BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 TRUST_STORE=1 TRUST_RELEASE=1`, fee4d5b1) | n/a | 200 | 760,609 B == Content-Length, PASS | 218 s | +| fallback | `uci-comb` (41202de9), github.com /robots.txt | $1D | 200 | 14,489 B == Content-Length, PASS | 101 s | + +All 7 runs completed (5 hybrid Wikipedia, 1 classic control, 1 github fallback); no truncation was seen (#211 is intermittent, so 7 clean runs bound it, they do not remove it). The Wikipedia article is now 760,609 B (759,171 B at v0.5.1). Elapsed is the whole rig run including boot (comb adds its ~45 s table build). + +**Local OpenSSL 3.6.5 listener** (`tools/uci/rig_https_local.py`, `EXTERNAL_LISTENER=1`; it needs a name the listener's certificate carries, so the images were built with the release arguments plus `HTTPS_SNI=www.foo.invalid`: `uci-onchip` `46398f0b…`, `uci-comb` `fdb7386e…`): + +| image | server `-groups` | tls_kex_group | result | oracle (C64 app traffic secrets vs the server's keylog) | +|---|---|---|---|---| +| uci-onchip | X25519MLKEM768 | $EC | full HTTPS PASS | MATCH | +| uci-onchip | X25519 | $1D | full HTTPS PASS | n/a (not hybrid) | +| uci-comb | X25519MLKEM768 | $EC | full HTTPS PASS | MATCH | +| uci-comb | X25519 | $1D | full HTTPS PASS | n/a (not hybrid) | + +`boot_check.py` passed on the release `uci-onchip` and `uci-comb` PRGs. + +**Memory** (`tools/measure_margins.py --build`, the exact release arguments, free bytes): `uci-onchip` LOADER 157, NET_CODE 105, CRYPTO_OVERLAY 372, CRYPTO_HOT 196; `uci-comb` LOADER 342, NET_CODE 134, **CRYPTO_OVERLAY 55**, CRYPTO_HOT 379, COLD_IMAGE 1,697, COLD_RUN_TRUST 75. + +**Suites**, on this tree: `BACKEND=uci python3 tools/run_all_tests.py` 455/455 (the `net` and `ip65_exports` suites are accounted skips: they test the ip65 adapter); bare `python3 -m pytest -q` 510 passed; the PQ suites listed in PR #315 and the mutant set (72 mutants, per the review of #315) all pass. + +**`ip65-onchip`** is byte-identical to master's knob-off build (`e69bfce7…`) and was checked by the package-verify VICE boot only; no network fetch was run for this release. It is not hybrid. + +## What this release does NOT do + +- **No certificate chain validation on the three 6510 images** (unchanged). The UCI images pin by trust-on-first-use in `/USB1`; `ip65-onchip` accepts any certificate whose signature verifies. +- **Server name validation is UCI-only.** +- **Entropy is weak** (see above). +- **The Wikipedia REU viewer demo does not link with `PQ_HYBRID=1`.** `make BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 PQ_HYBRID=1 HTTPS_HOST=en.wikipedia.org HTTPS_PATH=/wiki/Commodore_64 HTTPS_BODY_TO_REU=1` overflows CRYPTO_HOT by 507 B. Build it without `PQ_HYBRID`. +- **A server that sends its whole hybrid ServerHello as one record cannot be read** (the record buffer is 548 B); the client refuses it at once. Servers that honour max_fragment_length (OpenSSL, Wikipedia, browserleaks) split it. +- **The C64 Ultimate was not validated for this release.** diff --git a/tools/uci/rig_https_banner.py b/tools/uci/rig_https_banner.py index 54209d6..ecf4b02 100755 --- a/tools/uci/rig_https_banner.py +++ b/tools/uci/rig_https_banner.py @@ -501,6 +501,18 @@ def read_shadow_ok(): also=lambda: close_confirmed(stopped_early, read_shadow_ok, read_tcp_state, closed_before)) dump(lines, "final screen") + # PQ_HYBRID builds: which group the server chose. Read after the close + # wait, on the live transport (tls_kex_group sits just past the 'Q' + # scrub span; nothing rewrites it until the next connect). Printed always + # when the label exists; REQUIRE_KEX=EC (hex) makes a different + # group a failure of an otherwise passing run. + kex = None + try: + kex = bytes(client.read_mem(label_addr("tls_kex_group"), 1))[0] + print(f" tls_kex_group=${kex:02X}") + except KeyError: + pass + if not ok: print("WARNING: never saw CONNECTION CLOSED — leaving the machine " "as-is rather than resetting it (a reset with a live socket " @@ -533,6 +545,11 @@ def read_shadow_ok(): for line in report[:-1]: print(line) print(report[-1], file=sys.stderr if code else sys.stdout) + want = os.environ.get("REQUIRE_KEX", "") + if want and code == 0 and kex != int(want, 16): + print(f"FAIL: REQUIRE_KEX=${int(want, 16):02X} but tls_kex_group is " + f"{'absent' if kex is None else '$%02X' % kex}", file=sys.stderr) + return 1 return code finally: # #234: before disable_uci — the C64 needs the command interface to From 6d6786e7c2cd8d253bcde8a7bcb979a2fd7d66aa Mon Sep 17 00:00:00 2001 From: JC-000 <3798556+JC-000@users.noreply.github.com> Date: Sat, 17 Oct 2026 23:49:31 -0500 Subject: [PATCH 3/7] WIP release review fixes Co-Authored-By: Claude Sonnet 5.5 --- README.md | 47 +++++++++++++++++++++---- tools/http_body_checks.py | 43 +++++++++++++++++++++-- tools/mutate_http_body_checks.py | 20 +++++++++++ tools/package/write_release_sums.sh | 53 +++++++++++++++++++++++++++++ tools/test_http_body_checks_unit.py | 40 +++++++++++++++++++++- tools/uci/rig_https_banner.py | 25 +++++++++----- 6 files changed, 209 insertions(+), 19 deletions(-) create mode 100644 tools/package/write_release_sums.sh diff --git a/README.md b/README.md index a32016e..464eb91 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ the release walks you through the choice: | image | for | note | |---|---|---| | `c64-https-ip65-onchip` | bone-stock C64 + RR-Net cartridge | maximum compatibility: no REU, no turbo, nothing optional. If you are not sure what you have, this is the one that runs. ~36 min per handshake at 1 MHz. | -| `c64-https-uci-onchip` | Ultimate 64 / C64 Ultimate at turbo, REU off | boots straight to the menu; offers the hybrid X25519MLKEM768 (post-quantum) key exchange | -| `c64-https-uci-comb` | Ultimate 64 / C64 Ultimate at turbo, REU **on** | fastest — 1.73x quicker verify (16.4 s vs 28.4 s, U64E at 48 MHz). Builds a 16 KB table into REU bank 2 at each boot first: ~34 s at 64 MHz, ~45 s at 48 MHz. Also offers X25519MLKEM768 (+1.7 s, n=1). | +| `c64-https-uci-onchip` | Ultimate 64 / C64 Ultimate at turbo, REU off | boots straight to the menu; offers the hybrid X25519MLKEM768 (post-quantum) key exchange (about +2.5 s, n=3 to client Finished) | +| `c64-https-uci-comb` | Ultimate 64 / C64 Ultimate at turbo, REU **on** | fastest — 1.73x quicker verify (16.4 s vs 28.4 s, U64E at 48 MHz). Builds a 16 KB table into REU bank 2 at each boot first: ~34 s at 64 MHz, ~45 s at 48 MHz. Also offers X25519MLKEM768 (about +2.5 s, n=3 to client Finished vs the same image without it). | | `c64-https-uci-m3-demo` | Ultimate 64 with the M3 (ESP32 TLS) firmware | a secondary variant: TLS runs on the Ultimate's ESP32, not the 6510; needs M3 firmware. Its own README is in the release. | Every image carries **one** default host, baked in at build time (`make @@ -120,7 +120,7 @@ a venv mismatch reproduces #90 exactly after an install that appeared to succeed │ ┌──────┴───────┐ ┌──────┴─────────┐ │ │ │ AEAD │ │ Key Schedule │ │ (crypto modules) │ │ ChaCha20- │ │ HKDF-SHA256 │ │ hkdf.s - │ │ Poly1305 │ │ ECDHE X25519 │ │ + │ │ Poly1305 │ │ X25519+ML-KEM768│ │ │ └──────────────┘ └────────────────┘ │ ├─────────────────────────────────────────┤ │ Network backend boundary │ net_init / net_poll / net_tcp_* @@ -166,7 +166,7 @@ anywhere in `src/crypto/`. - **AEAD:** ChaCha20-Poly1305 — in-tree `src/crypto/{chacha20,poly1305,aead}.s`, originally from [c64-wireguard](https://github.com/JC-000/c64-wireguard) - **Hash:** SHA-256 — in-tree `src/crypto/sha256.s`, originally from [c64-aes256-ecdsa](https://github.com/JC-000/c64-aes256-ecdsa) -- **Key exchange:** ECDHE with X25519 only — `supported_groups` and `key_share` carry the single group 0x001D (`src/tls_handshake.s`, grep `group = x25519`); the vendored `libs/x25519` sibling, built on-chip (no REU) on every profile +- **Key exchange:** `uci-onchip` and `uci-comb` (built `PQ_HYBRID=1`) offer X25519MLKEM768 (0x11EC: ML-KEM-768 encapsulation key || X25519 share) first and X25519 (0x001D) second, in `supported_groups` and `key_share`; the server picks. A 0x11EC answer feeds `mlkem_ss || x25519_ss` into the handshake secret (draft-ietf-tls-ecdhe-mlkem, ML-KEM first); a 0x001D answer uses X25519 alone. `ip65-onchip`, and any build without `PQ_HYBRID=1`, offers only 0x001D (`src/tls_handshake.s`, grep `group = x25519`). X25519 is the vendored `libs/x25519` sibling, built on-chip (no REU) on every profile; ML-KEM-768 is the vendored `libs/mlkem` (c64-mlkem), UCI only - **Certificate signatures:** ECDSA P-256 (`ecdsa_secp256r1_sha256`, 0x0403) from the [c64-nist-curves](https://github.com/JC-000/c64-nist-curves) submodule at `libs/nistcurves`, via the thin dispatcher `src/crypto/ecdsa_verify.s`. P-384 (0x0503) is **retired**: not advertised, and refused — see Known Issues. - **Key derivation:** HKDF-SHA256, built from HMAC-SHA256 (`src/hkdf.s`) - **PRNG:** HMAC-DRBG seeded from SID voice 3 noise + CIA timer entropy (`src/entropy.s`, `src/crypto/hmac_drbg.s`) @@ -249,6 +249,19 @@ more ECDSA verifies at ~16-30 s each, and a root store means kilobytes of resident keys — not an oversight. Treat the transport as confidential against passive observers, not authenticated against active ones. +**What the post-quantum hybrid protects, and what it does not.** `PQ_HYBRID=1` +changes the key exchange only. A passive recorder who later has a quantum +computer cannot recover a session's keys from the recorded handshake unless it +can also break X25519 or ML-KEM-768 ("harvest now, decrypt later"). It changes +nothing about authentication, which stays classical: the server's +CertificateVerify is ECDSA P-256 and the UCI images' only pin is +trust-on-first-use of that leaf key, so forged or stolen P-256 keys, or an +attacker on the path at first use, are not stopped by it. And it is only as +strong as its secrets: this client's DRBG is seeded from SID voice 3 and CIA +timer noise (weak, as stated above), and both the ML-KEM seed and the X25519 +private key come from it. Read it as a demonstration of the protocol path, not +as a claim of quantum safety. + Confidentiality against passive observers is the property this client keeps after conceding authentication, so it is worth saying what upholds it. **As of v0.4.3** the X25519 shared secret is rejected when it comes out all zero, as @@ -378,6 +391,25 @@ $C000-$CFFF (no region) the 4 KB TCP ring, by equate; not in $D000-$DFFF I/O never in the PRG (#288) ``` +With `PQ_HYBRID=1` (both shipped UCI images) the same layout also carries: + +``` +$A000-$BFFF (file bytes) the staged ML-KEM image (7,490 B); boot copies + it to $E000 before zeroing the BSS +$B100-$BBFF ML-KEM rest BSS shares the window with the X25519 tables; + scrubbed after KeyGen and after Decaps +$C000-$C95F TCP ring, first the ML-KEM dk scratch (2,400 B), zeroed right + 2,400 B after KeyGen; the ring itself is unused then +$D000-$DFFF RAM under I/O ML-KEM polynomial area (not in the PRG, the + CPU banks I/O out to reach it); scrubbed +$E000-$FDFF MLKEM_CODE_RAM the ML-KEM code, copied there at boot +NET_BSS_TAIL tls_pq_seed (64 B) + tls_mlkem_ss (32 B), below + $4200; the ek and the ct each share cert_buf +``` + +Exact extents: `tools/measure_margins.py` (the `*-pq` profiles) and +`src/crypto/mlkem_link.s`. + `CRYPTO_OVERLAY` is not empty in any shipped UCI image — it holds the resident tenants listed above. Free space per region is **measured, not tabulated here**, because it differs per profile and every hand-kept table @@ -555,9 +587,9 @@ Progress: - [x] VIC-II blanking during the CPU-bound crypto — `src/vic.s`, scoped to the two X25519 scalar multiplies and the ECDSA verify so the on-screen handshake progress markers stay visible between phases. Worth **6.3-6.8%**, measured both in VICE at 1 MHz and on a U64E at 8/16/48 MHz; see the VIC-II blanking section of `CLAUDE.md` - [x] HKDF-SHA256 — Extract, Expand, Expand-Label, Derive-Secret (RFC 5869 + TLS 1.3) - [x] TLS 1.3 record layer — encrypt/decrypt with ChaCha20-Poly1305, nonce construction, sequence numbers -- [x] TLS 1.3 handshake — ClientHello builder (x25519 key_share, SNI), ServerHello parser, streaming transcript hash +- [x] TLS 1.3 handshake — ClientHello builder (x25519 key_share, SNI; with `PQ_HYBRID=1` also the ML-KEM-768 key share), ServerHello parser (a streaming reader under `PQ_HYBRID=1`), streaming transcript hash - [x] TLS 1.3 key schedule — early/handshake/master secrets, traffic key derivation, Finished MAC (RFC 8446 §7.1) -- [x] ECDHE x25519 key exchange — generate keypair, compute shared secret +- [x] ECDHE x25519 key exchange — generate keypair, compute shared secret; with `PQ_HYBRID=1` (UCI) also ML-KEM-768 KeyGen/Decaps and the hybrid key schedule (`libs/mlkem`) - [x] TLS 1.3 key schedule integration testing — all 9 HKDF steps verified against RFC 8448 + Finished MAC - [x] Entropy/DRBG initialization — SID voice 3 noise + CIA timer seeding at boot, DRBG fills for TLS random values - [x] X.509 certificate parsing — DER parser extracts TBS, public key, signature (r,s), curve ID (the live TLS path accepts P-256 only) @@ -913,6 +945,7 @@ Environment variables honored by `rig_https_local.py`: Vendored as submodules and linked into the PRG: - [c64-nist-curves](https://github.com/JC-000/c64-nist-curves) — `libs/nistcurves`, the ECDSA P-256 verify used for CertificateVerify +- [c64-mlkem](https://github.com/JC-000/c64-mlkem) — `libs/mlkem`, ML-KEM-768 for the X25519MLKEM768 hybrid; linked only under `PQ_HYBRID=1` (both shipped UCI images) - [c64-x25519](https://github.com/JC-000/c64-x25519) — `libs/x25519`, the X25519 in every build since #245 (on-chip profile, via `tools/integration/build_x25519.sh`; lookup tables generated at runtime by `src/crypto/x25519_tables.s`). - [ip65](https://github.com/cc65/ip65) — the TCP/IP stack behind the ip65 backend @@ -921,7 +954,7 @@ Not vendored — origin of code that now lives in-tree, or tooling: - [c64-wireguard](https://github.com/JC-000/c64-wireguard) — ChaCha20, Poly1305, ChaCha20-Poly1305 AEAD - [c64-aes256-ecdsa](https://github.com/JC-000/c64-aes256-ecdsa) — AES-256, SHA-256, ECDSA P-256, HMAC-DRBG - [c64-test-harness](https://github.com/JC-000/c64-test-harness) — VICE test automation framework -- [c64-lib-contract](https://github.com/JC-000/c64-lib-contract) — the segment-naming / manifest contract the two crypto submodules follow +- [c64-lib-contract](https://github.com/JC-000/c64-lib-contract) — the segment-naming / manifest contract the crypto submodules follow ## License diff --git a/tools/http_body_checks.py b/tools/http_body_checks.py index 269dc84..5ba5338 100644 --- a/tools/http_body_checks.py +++ b/tools/http_body_checks.py @@ -650,8 +650,40 @@ def stall_config_error(stall_abort: float, stall_grace: float): EXIT_INCONCLUSIVE = 78 +def parse_require_kex(text: str): + """REQUIRE_KEX: '' -> None (not required); else one hex byte (e.g. 'EC' + or '0xEC'). Anything else raises ValueError -- the rig calls this before + the device is touched, so a typo costs nothing.""" + text = (text or "").strip() + if not text: + return None + try: + val = int(text, 16) + except ValueError: + raise ValueError(f"REQUIRE_KEX={text!r} is not a hex byte") from None + if not 0 <= val <= 0xFF: + raise ValueError(f"REQUIRE_KEX={text!r} is outside 00-FF") + return val + + +def check_kex_group(kex, required: int) -> Verdict: + """The server chose the key-exchange group the run is meant to prove. + + *kex* is tls_kex_group as read from the C64 (None = the label is absent + or the read failed). A required group that cannot be read is a failure, + never a skip: a PASS that never looked at the group proves nothing about + PQ_HYBRID.""" + if kex is None: + return Verdict(False, f"tls_kex_group could not be read " + f"(required ${required:02X})", {"kex": None}) + if kex != required: + return Verdict(False, f"tls_kex_group is ${kex:02X}, required " + f"${required:02X}", {"kex": kex}) + return Verdict(True, f"tls_kex_group is ${kex:02X}", {"kex": kex}) + + def decide_exit(banner_ok: bool, shadow: Verdict, settled: Verdict, - status, body): + status, body, kex=None, require_kex=None): """Turn the verdicts into (exit code, report lines). THIS LIVES HERE, NOT IN THE RIG, AND THAT PLACEMENT IS THE POINT. @@ -683,6 +715,10 @@ def decide_exit(banner_ok: bool, shadow: Verdict, settled: Verdict, never turn anything into a PASS, so it cannot hide a truncation. """ checks = [shadow, status, body] + kex_v = None + if require_kex is not None: + kex_v = check_kex_group(kex, require_kex) + checks = checks + [kex_v] lines = [ "=== VERDICT ===", f" banner names the build target : {'PASS' if banner_ok else 'FAIL'}", @@ -690,7 +726,10 @@ def decide_exit(banner_ok: bool, shadow: Verdict, settled: Verdict, for label, v in (("shadow RAM readable ($A000)", shadow), ("fetch settled (not still growing)", settled), ("HTTP status", status), - ("body complete (own framing)", body)): + ("body complete (own framing)", body), + ("key exchange group (REQUIRE_KEX)", kex_v)): + if label.startswith("key exchange") and kex_v is None: + continue # not required: no line, no verdict lines.append(f" {label:<33}: " + ("FAIL (never evaluated)" if v is None else f"{v.status.upper()} — {v.reason}")) diff --git a/tools/mutate_http_body_checks.py b/tools/mutate_http_body_checks.py index 66dd001..fdf3835 100644 --- a/tools/mutate_http_body_checks.py +++ b/tools/mutate_http_body_checks.py @@ -118,6 +118,26 @@ MODULE, " if settled.inconclusive:", " if settled.inconclusive and False:"), + ("K1: the kex verdict is never added to decide_exit's checks", + MODULE, + " checks = checks + [kex_v]", + " pass"), + ("K2: check_kex_group passes a wrong group", + MODULE, + " if kex != required:", + " if False and kex != required:"), + ("K3: check_kex_group passes an unread group", + MODULE, + " if kex is None:\n return Verdict(False, f\"tls_kex_group could not be read \"", + " if False and kex is None:\n return Verdict(False, f\"tls_kex_group could not be read \""), + ("K4: REQUIRE_KEX 0 is treated as unset", + MODULE, + " if require_kex is not None:", + " if require_kex:"), + ("K5: the rig does not pass the group to decide_exit", + RIG, + " kex=kex, require_kex=REQUIRE_KEX)", + " kex=None, require_kex=REQUIRE_KEX)"), ("the rig decides its own exit code again instead of delegating", RIG, " code, report = decide_exit(banner_ok=banner_ok, shadow=shadow,\n" diff --git a/tools/package/write_release_sums.sh b/tools/package/write_release_sums.sh new file mode 100644 index 0000000..f751389 --- /dev/null +++ b/tools/package/write_release_sums.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +# ============================================================================= +# tools/package/write_release_sums.sh — the release's top-level SHA256SUMS. +# +# Writes /SHA256SUMS in `shasum -a 256 -c` form over every asset a +# release attaches, so the file is generated, never typed: +# +# from dist/ (make package): +# c64-https-ip65-onchip.{prg,d64} c64-https-uci-onchip.{prg,d64} +# c64-https-uci-comb.{prg,d64} MANIFEST.txt build-info.txt +# c64-https-listener.py +# from the M3 demo directory (carried forward or `make package-m3-demo`): +# c64-https-uci-m3-demo.{prg,d64} c64-https-uci-m3-demo-README.txt +# c64-https-uci-m3-demo-SHA256SUMS +# +# The M3 demo's own README is attached under the name +# c64-https-uci-m3-demo-README.txt and its checksum file under +# c64-https-uci-m3-demo-SHA256SUMS; inside the demo package they are +# README.txt and SHA256SUMS, so pass either spelling. +# +# tools/package/write_release_sums.sh +# +# is the directory the release's files are gathered in (dist/ +# plus the M3 files copied or linked next to them). Refuses a missing file: +# a release that silently omits an asset from its checksum list is the +# failure this exists to prevent. Nothing but SHA256SUMS is written. +# ============================================================================= +set -euo pipefail + +DIR="${1:?usage: write_release_sums.sh }" +cd "$DIR" + +ASSETS=( + c64-https-ip65-onchip.prg c64-https-ip65-onchip.d64 + c64-https-uci-onchip.prg c64-https-uci-onchip.d64 + c64-https-uci-comb.prg c64-https-uci-comb.d64 + c64-https-uci-m3-demo.prg c64-https-uci-m3-demo.d64 + c64-https-uci-m3-demo-README.txt + c64-https-uci-m3-demo-SHA256SUMS + c64-https-listener.py + MANIFEST.txt + build-info.txt +) + +missing=0 +for f in "${ASSETS[@]}"; do + [ -f "$f" ] || { echo "write_release_sums: missing $f in $DIR" >&2; missing=1; } +done +[ "$missing" = 0 ] || exit 1 + +shasum -a 256 "${ASSETS[@]}" > SHA256SUMS +shasum -a 256 -c SHA256SUMS >/dev/null +echo "wrote $DIR/SHA256SUMS (${#ASSETS[@]} assets, verified)" diff --git a/tools/test_http_body_checks_unit.py b/tools/test_http_body_checks_unit.py index f5a5b38..4926f70 100644 --- a/tools/test_http_body_checks_unit.py +++ b/tools/test_http_body_checks_unit.py @@ -34,6 +34,7 @@ "check_body_complete": "test_body_complete_red_green", "check_http_status": "test_http_status_red_green", "check_fetch_settled": "test_fetch_settled_red_green", + "check_kex_group": "test_kex_group_red_green", } #: `decide_exit` is not a `check_*` and so is outside RED_CASES, but it is @@ -959,6 +960,42 @@ def code(**kw) -> int: assert rc == hbc.EXIT_FAIL and any("broken" in ln for ln in lines) +def test_kex_group_red_green() -> None: + """REQUIRE_KEX is part of the exit decision (P5 release review): a run + that passes everything else but ends on the wrong group, or on a group + nobody could read, must not exit 0, and the report must say FAIL.""" + ok = hbc.Verdict(True, "fine") + settled_ok = hbc.check_fetch_settled(False, 1.0, 300.0) + base = dict(banner_ok=True, shadow=ok, settled=settled_ok, status=ok, body=ok) + + # not required: whatever was read (or not) changes nothing + assert hbc.decide_exit(**base)[0] == hbc.EXIT_PASS + assert hbc.decide_exit(**base, kex=0x1D)[0] == hbc.EXIT_PASS + # required and matching + assert hbc.decide_exit(**base, kex=0xEC, require_kex=0xEC)[0] == hbc.EXIT_PASS + # required, wrong group (the github $1D fallback case), neighbours, unread + for got in (0x1D, 0xEB, 0xED, 0x00, None): + rc, lines = hbc.decide_exit(**base, kex=got, require_kex=0xEC) + assert rc == hbc.EXIT_FAIL, got + assert lines[-1].startswith("FAIL"), (got, lines[-1]) + assert any("REQUIRE_KEX" in ln and "FAIL" in ln for ln in lines), lines + # required group $00 is a real requirement, not "unset" + assert hbc.decide_exit(**base, kex=0xEC, require_kex=0x00)[0] == hbc.EXIT_FAIL + # a wrong group does not outrank the still-growing gate (78 stays 78) + growing = hbc.check_fetch_settled(True, 300.0, 300.0) + assert hbc.decide_exit(**dict(base, settled=growing), kex=0x1D, + require_kex=0xEC)[0] == hbc.EXIT_INCONCLUSIVE + # parsing: validated up front + assert hbc.parse_require_kex("") is None + assert hbc.parse_require_kex("EC") == 0xEC and hbc.parse_require_kex("0xec") == 0xEC + for bad in ("zz", "1ff", "-1", "E C"): + try: + hbc.parse_require_kex(bad) + except ValueError: + continue + raise AssertionError(f"REQUIRE_KEX={bad!r} was accepted") + + def test_the_banner_rig_delegates_its_exit_code() -> None: """The rig must hold no exit-code logic of its own. @@ -1031,7 +1068,8 @@ def test_the_banner_rig_delegates_its_exit_code() -> None: "verdict by keyword, or a transposition is invisible here and " "on the bench") given = {kw.arg for kw in call.value.keywords} - missing = {"banner_ok", "shadow", "settled", "status", "body"} - given + missing = {"banner_ok", "shadow", "settled", "status", "body", + "kex", "require_kex"} - given assert not missing, f"decide_exit is not given {sorted(missing)}" diff --git a/tools/uci/rig_https_banner.py b/tools/uci/rig_https_banner.py index ecf4b02..3d72bc5 100755 --- a/tools/uci/rig_https_banner.py +++ b/tools/uci/rig_https_banner.py @@ -93,7 +93,7 @@ STALL_GRACE, OPTIONAL_SYMBOLS, SYMBOLS, StallTracker, check_body_complete, check_fetch_settled, check_http_status, close_confirmed, decide_exit, decode_body_state, - early_stop_step, poll_until, stall_config_error, + early_stop_step, parse_require_kex, poll_until, stall_config_error, ) from ip65_hw_checks import check_shadow_ram_readable # noqa: E402 from _rig_lifecycle import guard_socket_teardown # noqa: E402 @@ -109,6 +109,10 @@ #: check all use -- an HTTP 200 with a complete body is the proof of all four. TYPED_HOST = os.environ.get("TYPED_HOST", "") TYPED_PATH = os.environ.get("TYPED_PATH", "") +#: REQUIRE_KEX=EC: the run must end with tls_kex_group == $EC (decide_exit +#: enforces it). Parsed and validated in main() before the device is touched. +_REQUIRE_KEX_RAW = os.environ.get("REQUIRE_KEX", "") +REQUIRE_KEX = None EXPECT_HOST = (TYPED_HOST or os.environ.get("HTTPS_HOST", "en.wikipedia.org")).upper() @@ -200,6 +204,12 @@ def main() -> int: # sub-floor STALL_ABORT makes should_stop_early raise inside the poll # loop, skipping the 'Q' below with a live socket; a STALL_GRACE at or # above it would make an early stop and the deadline disagree. + global REQUIRE_KEX + try: + REQUIRE_KEX = parse_require_kex(_REQUIRE_KEX_RAW) + except ValueError as exc: + print(f"[fatal] {exc}", file=sys.stderr) + return 2 bad_stall = stall_config_error(STALL_ABORT_S, STALL_GRACE_S) if bad_stall: print(f"[fatal] {bad_stall}", file=sys.stderr) @@ -510,8 +520,9 @@ def read_shadow_ok(): try: kex = bytes(client.read_mem(label_addr("tls_kex_group"), 1))[0] print(f" tls_kex_group=${kex:02X}") - except KeyError: - pass + except Exception as exc: # KeyError (no label) or a failed read: + # never fatal here; REQUIRE_KEX turns it into a FAIL verdict + print(f" tls_kex_group: not read ({exc!r})") if not ok: print("WARNING: never saw CONNECTION CLOSED — leaving the machine " @@ -540,16 +551,12 @@ def read_shadow_ok(): # so the gate silently dies and the cry-wolf failure returns. A # plausible signature-refactor slip; keywords remove it. code, report = decide_exit(banner_ok=banner_ok, shadow=shadow, - settled=settled, status=status, body=body) + settled=settled, status=status, body=body, + kex=kex, require_kex=REQUIRE_KEX) print() for line in report[:-1]: print(line) print(report[-1], file=sys.stderr if code else sys.stdout) - want = os.environ.get("REQUIRE_KEX", "") - if want and code == 0 and kex != int(want, 16): - print(f"FAIL: REQUIRE_KEX=${int(want, 16):02X} but tls_kex_group is " - f"{'absent' if kex is None else '$%02X' % kex}", file=sys.stderr) - return 1 return code finally: # #234: before disable_uci — the C64 needs the command interface to From 0bcbe1213bc9193fcd048ee5095f718126fea1d7 Mon Sep 17 00:00:00 2001 From: JC-000 <3798556+JC-000@users.noreply.github.com> Date: Sat, 17 Oct 2026 23:51:29 -0500 Subject: [PATCH 4/7] Release review round 1: README PQ sections, measured cost, notes, REQUIRE_KEX in decide_exit, SHA256SUMS script Co-Authored-By: Claude Sonnet 5.5 --- CLAUDE.md | 46 ++++++----------- docs/engineering-notes.md | 13 ++++- docs/release-notes-v0.6.0.md | 91 ++++++++++++++++++++++----------- tools/package/_common.sh | 4 +- tools/package/write_manifest.sh | 10 ++-- 5 files changed, 98 insertions(+), 66 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index b6f8a65..2e720be 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -540,34 +540,17 @@ engineering-notes. ## End-to-end HTTPS status -**Real servers work** (2026-08-21/22, U64E @ 48 MHz, comb): github.com, -browserleaks.com, lwn.net all HTTP 200 (~32-39 s to Finished), and -en.wikipedia.org's C64 article streamed into REU `$10:0000` via -`HTTPS_BODY_TO_REU=1` and shown by `src/viewer.s` — **handshake and GET -verified, body completeness NOT** (#211). This entry used to claim -125,235 B byte-verified; that does not reproduce on either tree. `http_get` -returns `carry=0`/`http_status=200` on bodies tens of KB short of their -`Content-Length`, intermittently and not as a function of size — measured -offline against a local listener with no chunking, and live at -117,192 / 89,526 / 73,720 B against a same-day 125,703 B anchor. It can also -hang outright. **Do not treat any large-body fetch as complete until #211 -closes**; it went unnoticed because the only rig on that path could not go -red on a short body (#210, now fixed: `rig_https_banner.py` derives the -expected size from the response's own framing and gates its exit code on -it). That rig also **sets the CPU clock instead of inheriting it** — a -completeness verdict is clock-sensitive where the banner verdict was not, -and a device left at 1 MHz makes a slow fetch look like a truncated one. -**#211 reproduces on the shipped path.** Two runs of ONE artifact — PRG -`44e6c0dd605db65682131d6621fc9ad7b8b03cb0d22b0b241691abd3c35ed32a`, -`BACKEND=uci USE_NISTCURVES_ONCHIP=1 HTTPS_HOST=en.wikipedia.org -HTTPS_PATH=/wiki/Commodore_64`, U64E @ 48 MHz, `FETCH_TIMEOUT=900`, same -host, same day: one **PASS** (754,413 B consumed == Content-Length, HTTP -200) and one **FAIL** (frozen at 299,123 B, 455,290 B short). One of each: -treat neither as the norm, and do not quote the PASS on its own. The stall is -**abrupt** — the counter freezes and stays frozen for hundreds of seconds, -which is what #219's fast-expiry path predicts — not a trickle. 754,413 B -is the *rendered page* at that path and is not the 125,703 B raw-article -figure quoted above; they are different resources. The handshake results above are unaffected. The +**Real servers work** (U64E @ 48 MHz): github.com, browserleaks.com, lwn.net +HTTP 200, and en.wikipedia.org's C64 article (760,609 B at v0.6.0) completes +with consumed == Content-Length on both UCI products, comb and onchip, through +`rig_https_banner.py` — the only completeness oracle (it derives the expected +size from the response's own framing, #210, and **sets the CPU clock instead +of inheriting it**: a device left at 1 MHz makes a slow fetch look +truncated). Silent truncation (#211: `http_get` returning `carry=0`/HTTP 200 +on a short body, or hanging) is **closed** (2026-09-24, PR #238); the +2026-08/09 truncated sizes and the shipped-path PASS/FAIL pair in the issue +predate that fix. A completeness claim still comes only from that rig's +verdict, never from `carry` or `http_status`. The local-listener handshake works on both backends (UCI at 48 MHz and 1 MHz; ip65 in VICE at honest 1 MHz, ~36 min). @@ -898,8 +881,11 @@ TABLES_BSS. between each, matrix in `tools/package/_common.sh`: c64-https-ip65-onchip.prg stock C64 + RR-Net, no REU, no turbo - c64-https-uci-onchip.prg turbo, no REU (TRUST_STORE=1) - c64-https-uci-comb.prg turbo + REU, fastest (needs bank 2 + boot precompute; TRUST_STORE=1) + c64-https-uci-onchip.prg turbo, no REU (TRUST_STORE=1 PQ_HYBRID=1) + c64-https-uci-comb.prg turbo + REU, fastest (needs bank 2 + boot precompute; TRUST_STORE=1 PQ_HYBRID=1) + +Since v0.6.0 both UCI products are `PQ_HYBRID=1`; no classic UCI image ships +any more (build one by omitting `PQ_HYBRID=1`). `ip65-onchip` stays classic. REU-profile images were retired (curation: still fastest below ~18 MHz, one line in `PACKAGE_VARIANTS` to restore). **That line is a diff --git a/docs/engineering-notes.md b/docs/engineering-notes.md index db6e324..3e8952c 100644 --- a/docs/engineering-notes.md +++ b/docs/engineering-notes.md @@ -4311,8 +4311,17 @@ all runs full HTTPS PASS, tls_kex_group $EC unless noted): - comb (REU 16 MB, `C64_INIT_WAIT=90`), `make BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 PQ_HYBRID=1 HTTPS_SNI=www.foo.invalid`, sha256 `265c4c583c2b5a2430daf3a7ee2a3e546d99a8b7c1c4173476e8455097cfa042`: 165 s / - 164 s ($1D) / 166 s. With `PHASE_TIMING=1` (1 s poll, n=1 each) trigger to - client Finished 43.7 s hybrid vs 42.0 s X25519-only: about +1.7 s. + 164 s ($1D) / 166 s. (A `PHASE_TIMING=1` pair of 43.7 s hybrid vs 42.0 s + X25519-only on this one image was NOT the cost of PQ: both runs pay KeyGen, + since only the server's choice differed. Superseded by the next entry.) + - cost of PQ_HYBRID (v0.6.0 release review): classic image (same arguments, no + `PQ_HYBRID`) vs hybrid image, release arguments plus `HTTPS_SNI`, local + OpenSSL listener (hybrid group for the PQ image), SYS trigger to client + Finished, `PHASE_POLL=0.5`, n=3 each: onchip 52.4/52.1/52.6 s vs + 55.2/54.8/54.6 s (+2.5 s), comb 41.0/41.3/40.6 s vs 43.9/43.1/43.4 s + (+2.5 s). The classic runs ended in a rig traceback after the fetch + (`rig_https_local.py`'s `PQ_DUMP` reads PQ-only labels); the CFIN marker and + the sentinel were already reached. - live (`tools/uci/rig_https_live.py`), comb image WITHOUT `HTTPS_SNI`, `make BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 PQ_HYBRID=1`, sha256 `b8677dd79968fb57e475baaa0995c8979d670b159ae753b207a947d5e8be8d61`: diff --git a/docs/release-notes-v0.6.0.md b/docs/release-notes-v0.6.0.md index 1938601..866c2f9 100644 --- a/docs/release-notes-v0.6.0.md +++ b/docs/release-notes-v0.6.0.md @@ -8,7 +8,9 @@ Built from the commit tagged `v0.6.0`. Submodule pins (`tools/check_upstream_pin - `libs/x25519` v0.16.0 (unchanged); - ip65 `25a9c5a` (untagged, unchanged). -The headline: **both UCI images now offer the post-quantum hybrid key exchange X25519MLKEM768**, and have completed a fetch of the Wikipedia Commodore 64 article over it on hardware. `ip65-onchip` stays classic. +This release covers the merged PRs since v0.5.1: #306-#308, #310, #311 (build and rig fixes), #312-#315 (the post-quantum hybrid key exchange, below) and this release's packaging change. The main change: **both UCI images now offer the hybrid key exchange X25519MLKEM768.** They have completed fetches of the Wikipedia Commodore 64 article over it on hardware. `ip65-onchip` stays classic and is **not** byte-identical to v0.5.1 (see below). + +**No classic UCI image ships any more.** `uci-onchip` and `uci-comb` are the same products as before with `PQ_HYBRID=1` added to their make arguments. To build the v0.5.1-style X25519-only UCI image, omit it: `make BACKEND=uci USE_NISTCURVES_ONCHIP=1 TRUST_STORE=1` (or `USE_NISTCURVES_ONCHIP_COMB=1`). --- @@ -19,56 +21,81 @@ The headline: **both UCI images now offer the post-quantum hybrid key exchange X | `c64-https-ip65-onchip` | stock C64 + RR-Net, no REU, no turbo | `e69bfce7b552e765df02cb253b4ff12cecaca3e978669376b7af5ffad9343dce` | | `c64-https-uci-onchip` | U64E / C64 Ultimate, turbo, no REU | `3b4dd718cbdc296f2083c90ce4d89a25e1fbd032e849c66f25227ef4d0ac4d5a` | | `c64-https-uci-comb` | U64E / C64 Ultimate, turbo + REU (fastest) | `41202de9fa6b9da769fce87a3223e7d1c74630f873b4b64a940afacddb7cbeb6` | -| `c64-https-uci-m3-demo` | U64E with the TLS-socket (ESP32) firmware | `916d41628a17b9436bbf58a71f7350c721a06e459cf5c33e5baeb1ad61af9a24` (carried forward from v0.5.1, unchanged) | +| `c64-https-uci-m3-demo` | U64E with the TLS-socket (ESP32) firmware, see below | `916d41628a17b9436bbf58a71f7350c721a06e459cf5c33e5baeb1ad61af9a24` (carried forward from v0.5.1, unchanged) | + +| disk | sha256 | +|---|---| +| `c64-https-ip65-onchip.d64` | `30c5ba3974eed49a248e0041c1bf1e3e2e9584d772c710b086f50dc18a840e38` | +| `c64-https-uci-onchip.d64` | `70356cd1a7334c009ac37641d6cc7f4954550fa9d530e0ab913dda7a2b5d2302` | +| `c64-https-uci-comb.d64` | `293883c77a30364674425a17b3121a1adab08d21d4e2f7f8c72362e494916faa` | +| `c64-https-uci-m3-demo.d64` | `ae2cc5b7d40190ddfc911cb40e7a7d62e406c134f304b3fe9e2f04ea540ff498` (carried forward) | + +Each image ships as a `.prg` and as a bootable `.d64`. The full asset set is: +- the three `.prg` and three `.d64` above; +- `MANIFEST.txt`, `build-info.txt`, `c64-https-listener.py`; +- the M3 demo's `c64-https-uci-m3-demo.prg`, `c64-https-uci-m3-demo.d64`, `c64-https-uci-m3-demo-README.txt` and `c64-https-uci-m3-demo-SHA256SUMS` (v0.5.1's files, unchanged); +- a top-level `SHA256SUMS` covering every other asset, generated by `tools/package/write_release_sums.sh ` (it refuses a missing file and verifies its own output). -Each image also ships as a bootable `.d64` (hashes: the release's `SHA256SUMS`, written when the assets are attached). The 1541 filenames are unchanged (`ip65-noreu`, `uci-noreu`, `uci-comb`). +The M3 demo's own checksum file names its README `README.txt`, the name inside the demo package; rename the asset to that before running `shasum -c` on it. -The `.prg`/`.d64` names, 1541 filenames and sizes are the same as v0.5.1 (47,105 B, 47,105 B, 51,201 B). +The 1541 filenames (`ip65-noreu`, `uci-noreu`, `uci-comb`) and the PRG sizes (47,105 B, 47,105 B, 51,201 B) are the same as v0.5.1. --- ## Post-quantum hybrid key exchange -- `make` argument `PQ_HYBRID=1` is now part of the `uci-onchip` and `uci-comb` products (`tools/package/_common.sh`). The ClientHello offers `X25519MLKEM768` (0x11EC) first and `X25519` (0x001D) as well; the server picks. Against a server that picks 11EC the handshake secret is extracted from `mlkem_ss || x25519_ss` (draft-ietf-tls-ecdhe-mlkem: ML-KEM first); against one that picks X25519 nothing differs from v0.5.1. -- ML-KEM-768 comes from `libs/mlkem` (c64-mlkem v0.6.0). Its code is loaded at `$A000` and copied to `$E000` at boot; the polynomial area is `$D000-$DFFF` and is scrubbed after KeyGen and after Decaps, as are the shared secrets after the key schedule. `PQ_HYBRID` is refused on ip65, uci-m3 and the uci REU profile. -- Cost, measured on a U64E at 48 MHz, comb image, n=1: trigger to client Finished 43.7 s hybrid vs 42.0 s X25519-only, about +1.7 s (local OpenSSL listener). Against Wikipedia the release PRGs took 191-192 s (onchip) and 220-222 s (comb) for the 760 KB page, and the X25519-only control comb image 218 s. -- **What it does and does not buy.** The hybrid secret needs an attacker to break both X25519 and ML-KEM-768. This client's entropy is still weak (the DRBG is seeded from SID voice 3 and CIA1 timer A), so the ML-KEM seed and the X25519 key are not strong secrets; this is a demonstration of the protocol path, not a security claim. -- Servers: OpenSSL 3.6.5 `s_server` and en.wikipedia.org negotiate 11EC with our hello (tables below); browserleaks.com did in the P5 live run. github.com and lwn.net do not offer 11EC; a `uci-comb` fetch of github.com/robots.txt falls back to X25519 and completes (below). +- The ClientHello offers `X25519MLKEM768` (0x11EC: ML-KEM-768 encapsulation key || X25519 share) first and `X25519` (0x001D) second; the server picks. A 0x11EC answer feeds `mlkem_ss || x25519_ss` into the handshake secret (draft-ietf-tls-ecdhe-mlkem, ML-KEM first). A 0x001D answer completes with X25519 alone, as before. +- **A server that picks X25519 does not get the v0.5.1 client.** KeyGen still runs on every connection; the ClientHello is about 1.2 KB larger and is sent in several sections; and the ServerHello is read by a stricter streaming reader (an empty session-id echo, exactly the two extensions we asked for, a malformed or oversize record header while waiting for the ServerHello is now fatal). +- ML-KEM-768 comes from `libs/mlkem` (c64-mlkem v0.6.0). Its code is staged in the PRG at `$A000` and copied to `$E000` at boot; the polynomial area is `$D000-$DFFF` (RAM under I/O) and the decapsulation-key scratch is the first 2,400 B of the TCP ring. Intermediates are scrubbed after KeyGen and after Decaps, and both shared secrets are zeroed once the handshake secret exists. `PQ_HYBRID` is refused on ip65, uci-m3 and the uci REU profile. +- **Cost** (U64E at 48 MHz, local OpenSSL 3.6.5 listener, release arguments plus `HTTPS_SNI`, time from the SYS trigger to client Finished, 0.5 s poll, n=3 each; the classic image is the same arguments without `PQ_HYBRID`): + + | image | classic (PQ_HYBRID off) | hybrid | difference | + |---|---|---|---| + | uci-onchip | 52.4, 52.1, 52.6 s (mean 52.4) | 55.2, 54.8, 54.6 s (mean 54.9) | **+2.5 s** (+4.8%) | + | uci-comb | 41.0, 41.3, 40.6 s (mean 41.0) | 43.9, 43.1, 43.4 s (mean 43.5) | **+2.5 s** (+6.1%) | + + Whole Wikipedia fetch with the release PRGs, rig wall-clock: 191-192 s onchip, 220-222 s comb; the classic comb control took 218 s (n=1). +- **What it protects, and what it does not.** The hybrid changes the key exchange only: a passive recorder who later has a quantum computer cannot recover a session's keys from the recorded handshake unless it can also break X25519 or ML-KEM-768 (harvest now, decrypt later). **Authentication is unchanged and classical:** the server proves itself with ECDSA P-256, and the UCI images' only pin is trust-on-first-use of that leaf key. And the protection is only as good as its secrets: this client's DRBG is seeded from SID voice 3 and CIA timer noise, which is weak, and the ML-KEM seed and X25519 private key both come from it. Read this as a demonstration of the protocol path, not as quantum safety. +- Servers: OpenSSL 3.6.5 `s_server` and en.wikipedia.org negotiate 11EC with our hello (tables below); browserleaks.com did in an earlier live run. github.com and lwn.net do not offer 11EC (`openssl s_client -groups X25519MLKEM768` gets `handshake_failure`); a `uci-comb` fetch of github.com/robots.txt falls back to X25519 and completes. ## Other changes since v0.5.1 -- ClientHello is built in sections with 16-bit lengths and a HelloRetryRequest is refused (#312); the hybrid ServerHello is read as a stream across records (#314); the key schedule is hybrid (#315). -- The linker output no longer depends on the build locale (#311): the PRG hashes reproduce under any `LANG`. -- A linker-config edit relinks the PRG (#306); pytest is green on a uci or an ip65 build (#308); the rig trampolines set the trust-store mode (#307). -- README and M3 demo provenance fixes (#303, #310). +- PQ stages, in order: the sectioned ClientHello with 16-bit lengths and HelloRetryRequest refusal (#312); `libs/mlkem` pinned and placed behind `PQ_HYBRID=1`, link-only (#313); the streaming hybrid ServerHello, KeyGen in `tls_connect`, Decaps (#314); the hybrid key schedule (#315). +- The linker output no longer depends on the build locale (#311), a linker-config edit relinks the PRG (#306), a bare pytest is green on a uci or an ip65 build (#308), and the rig trampolines set the trust-store mode (#307). Docs: #303, #310. +- `tools/uci/rig_https_banner.py` prints `tls_kex_group`; `REQUIRE_KEX=EC` makes any other group part of the exit decision (`decide_exit`). + +## `ip65-onchip` is not the v0.5.1 binary + +`c64-https-ip65-onchip.prg` is `e69bfce7…`; v0.5.1's was `810f1158…`. Rebuilt at each step: `1c377d34…` after #311 (link order only), then `e69bfce7…` from #312 on, unchanged by #313-#315. **#312 changed ip65 code**: it added the HelloRetryRequest check to the ip65 ServerHello parser and changed the shared ClientHello builder. **No handshake has been run on these ip65 bytes**: the VICE network rig needs a sudo rig-up that was not done for this release, so the image has only been booted to the banner (package-verify). Treat it as not network-validated at v0.6.0, whatever "unchanged by PQ" may suggest. It does not offer the hybrid. ## M3 demo -Carried forward from v0.5.1 unchanged (PRG, `.d64`, README, checksum file). The M3 build does not link the 6510 TLS or crypto code, and building `BACKEND=uci-m3 HTTPS_HOST=en.wikipedia.org HTTPS_PATH=/wiki/Commodore_64` at this release reproduces the v0.5.1 PRG byte for byte (`916d4162...`), so the hardware validation recorded for it still describes these bytes. It was not re-run for this release and `tools/package/build_m3_demo.sh` was not used: it would rewrite the README around this commit and re-quote firmware provenance that nobody re-verified. +Carried forward from v0.5.1 unchanged (PRG, `.d64`, README, checksum file). The M3 build does not link the 6510 TLS or crypto code, and building `BACKEND=uci-m3 HTTPS_HOST=en.wikipedia.org HTTPS_PATH=/wiki/Commodore_64` at this release reproduces the v0.5.1 PRG byte for byte (`916d4162…`), so the hardware validation recorded for it still describes these bytes. It was not re-run for this release, and `tools/package/build_m3_demo.sh` was not used: it would rewrite the README around this commit and re-quote firmware provenance that nobody re-verified. --- ## Validated -Built on macOS 27.0.1, GNU Make 3.81, ca65/ld65 V2.18, `LANG=en_US.UTF-8`. `make package-verify` passed **14/14** with no SKIP (PRG reproducibility from a second clean build, load ranges off the I/O page, `.d64` read-back byte-compare and VICE boot to the banner for all three images, listener selftest). +Built on macOS 27.0.1, GNU Make 3.81, ca65/ld65 V2.18, `LANG=en_US.UTF-8`; the PRG hashes are locale-independent since #311. `make package-verify` passed **14/14** with no SKIP (PRG reproducibility from a second clean build, load ranges off the I/O page, `.d64` read-back byte-compare and VICE boot to the banner for all three images, listener selftest). -**Hardware, exact release PRGs** (U64E 10.43.23.81, fw 3.15 branch build, 48 MHz, `rig_https_banner.py`: menu path, `G`, typed host `en.wikipedia.org`, path `/wiki/Commodore_64`; completeness by the response's own framing; `REQUIRE_KEX=EC` makes any other group a failure). Every run is listed: +**Hardware, exact release PRGs** (U64E, fw 3.15 branch build, 48 MHz, `rig_https_banner.py`: menu path, `G`, typed host `en.wikipedia.org`, path `/wiki/Commodore_64`; completeness by the response's own framing; `REQUIRE_KEX=EC` makes any other group a failure). The device's real `/USB1/TRUST.A|B` were used as users run it; no key-change prompt appeared. Every run: | # | image (PRG sha256 prefix) | tls_kex_group | HTTP | body | elapsed | |---|---|---|---|---|---| | 1 | `uci-comb` (41202de9) | $EC | 200 | 760,609 B == Content-Length, PASS | 220 s | | 2 | `uci-comb` (41202de9) | $EC | 200 | 760,609 B == Content-Length, PASS | 222 s | | 3 | `uci-comb` (41202de9) | $EC | 200 | 760,609 B == Content-Length, PASS | 222 s | -| 4 | `uci-onchip` (3b4dd718) | $EC | 200 | 760,609 B == Content-Length, PASS | 191 s | -| 5 | `uci-onchip` (3b4dd718) | $EC | 200 | 760,609 B == Content-Length, PASS | 192 s | -| control | v0.5.1-equivalent classic `uci-comb` (`BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 TRUST_STORE=1 TRUST_RELEASE=1`, fee4d5b1) | n/a | 200 | 760,609 B == Content-Length, PASS | 218 s | +| 4 | `uci-onchip` (3b4dd718), device REU enabled (16 MB) | $EC | 200 | 760,609 B == Content-Length, PASS | 191 s | +| 5 | `uci-onchip` (3b4dd718), device REU enabled (16 MB) | $EC | 200 | 760,609 B == Content-Length, PASS | 192 s | +| 6 | `uci-onchip` (3b4dd718), device REU **Disabled** | $EC | 200 | 760,609 B == Content-Length, PASS | 190 s | +| control | `BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 TRUST_STORE=1 TRUST_RELEASE=1` on this tree, `PQ_HYBRID` off (fee4d5b1) | n/a | 200 | 760,609 B == Content-Length, PASS | 218 s | | fallback | `uci-comb` (41202de9), github.com /robots.txt | $1D | 200 | 14,489 B == Content-Length, PASS | 101 s | -All 7 runs completed (5 hybrid Wikipedia, 1 classic control, 1 github fallback); no truncation was seen (#211 is intermittent, so 7 clean runs bound it, they do not remove it). The Wikipedia article is now 760,609 B (759,171 B at v0.5.1). Elapsed is the whole rig run including boot (comb adds its ~45 s table build). +All 8 runs completed; no truncation was seen. The silent-truncation defect #211 was closed on 2026-09-24 (PR #238); these runs are evidence for that fix on the PQ images, not a statement that it is intermittent today. The article is 760,609 B now (759,171 B at v0.5.1). Elapsed is the whole rig run including boot (comb adds its ~45 s table build). -**Local OpenSSL 3.6.5 listener** (`tools/uci/rig_https_local.py`, `EXTERNAL_LISTENER=1`; it needs a name the listener's certificate carries, so the images were built with the release arguments plus `HTTPS_SNI=www.foo.invalid`: `uci-onchip` `46398f0b…`, `uci-comb` `fdb7386e…`): +**Local OpenSSL 3.6.5 listener** (`tools/uci/rig_https_local.py`, `EXTERNAL_LISTENER=1`; it dials the listener's IP, so a release PRG cannot pass the name check, and the images were built with the release arguments plus `HTTPS_SNI=www.foo.invalid`: `uci-onchip` `46398f0b…`, `uci-comb` `fdb7386e…`): -| image | server `-groups` | tls_kex_group | result | oracle (C64 app traffic secrets vs the server's keylog) | +| image | server `-groups` | tls_kex_group | result | oracle (C64 application traffic secrets vs the server's keylog) | |---|---|---|---|---| | uci-onchip | X25519MLKEM768 | $EC | full HTTPS PASS | MATCH | | uci-onchip | X25519 | $1D | full HTTPS PASS | n/a (not hybrid) | @@ -77,17 +104,23 @@ All 7 runs completed (5 hybrid Wikipedia, 1 classic control, 1 github fallback); `boot_check.py` passed on the release `uci-onchip` and `uci-comb` PRGs. -**Memory** (`tools/measure_margins.py --build`, the exact release arguments, free bytes): `uci-onchip` LOADER 157, NET_CODE 105, CRYPTO_OVERLAY 372, CRYPTO_HOT 196; `uci-comb` LOADER 342, NET_CODE 134, **CRYPTO_OVERLAY 55**, CRYPTO_HOT 379, COLD_IMAGE 1,697, COLD_RUN_TRUST 75. +**Trust store on the PQ images** (the store stages in the TCP ring, which now also hosts the ML-KEM dk scratch). The rigs refuse any directory but `//c64https-test`, so they ran on the release arguments plus `TRUST_STORE_DIR=/USB1/c64https-test HTTPS_PORT=24520` (`uci-onchip` `a0d26e3d…`, `uci-comb` `e8adb55d…`); the real `/USB1/TRUST.A|B` (80 B / 144 B) were unchanged afterwards: +- `rig_trust_store.py` (disk I/O: empty, save, load, torn write, corruption, 32 records, missing directory): exit 0 on both, 24 and 25 checks, 0 failures; phase 13 runs only at 1 MHz and was not run. +- `rig_trust_policy.py`, local mode, through the menu against a Python TLS 1.3 listener (it can only choose X25519, so these fetches took 0x001D): exit 0 on both, **30 passed, 0 failed each**: first use records the key (`KEY RECORDED`), a matching key is `KNOWN KEY` with the store untouched, a changed key shows `KEY CHANGED` and the full hash and sends no client Finished, accept-on-retry records `ACCEPTED/K2`, and `Y` at the prompt runs one `UNPINNED` fetch that records nothing. Live mode (`RIG_MODE=live`) needs the REU viewer demo, which does not link with PQ (below), so it was not run. -**Suites**, on this tree: `BACKEND=uci python3 tools/run_all_tests.py` 455/455 (the `net` and `ip65_exports` suites are accounted skips: they test the ip65 adapter); bare `python3 -m pytest -q` 510 passed; the PQ suites listed in PR #315 and the mutant set (72 mutants, per the review of #315) all pass. +**Memory** (`tools/measure_margins.py --build`, the exact release arguments, free bytes): `uci-onchip` LOADER 157, NET_CODE 105, CRYPTO_OVERLAY 372, CRYPTO_HOT 196; `uci-comb` LOADER 342, NET_CODE 134, **CRYPTO_OVERLAY 55**, CRYPTO_HOT 379, COLD_IMAGE 1,697, COLD_RUN_TRUST 75. -**`ip65-onchip`** is byte-identical to master's knob-off build (`e69bfce7…`) and was checked by the package-verify VICE boot only; no network fetch was run for this release. It is not hybrid. +**Suites**, on this tree: `BACKEND=uci python3 tools/run_all_tests.py` 455/455 (the `net` and `ip65_exports` suites are accounted skips: they test the ip65 adapter). That aggregate runs the non-PQ REU profile; **no VICE suite runs the release images**, which are covered by `make package-verify`'s VICE boot, the hardware runs above, and the PQ suites (`test_pq_*`, `test_mlkem_*`, 72 mutants, per the review of #315). Bare `python3 -m pytest -q` 510 passed. ## What this release does NOT do -- **No certificate chain validation on the three 6510 images** (unchanged). The UCI images pin by trust-on-first-use in `/USB1`; `ip65-onchip` accepts any certificate whose signature verifies. +- **No certificate chain validation on the three 6510 images** (unchanged). The released UCI images pin by trust-on-first-use (`TRUST.A` / `TRUST.B` on `/USB1`); a build-time pin or a signed bundle needs a custom build. If the store cannot be used, they offer to continue unpinned. The ip65 image accepts any certificate whose signature verifies. On the M3 demo, the ESP32 verifies certificates against its own Mozilla CA store. - **Server name validation is UCI-only.** - **Entropy is weak** (see above). -- **The Wikipedia REU viewer demo does not link with `PQ_HYBRID=1`.** `make BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 PQ_HYBRID=1 HTTPS_HOST=en.wikipedia.org HTTPS_PATH=/wiki/Commodore_64 HTTPS_BODY_TO_REU=1` overflows CRYPTO_HOT by 507 B. Build it without `PQ_HYBRID`. -- **A server that sends its whole hybrid ServerHello as one record cannot be read** (the record buffer is 548 B); the client refuses it at once. Servers that honour max_fragment_length (OpenSSL, Wikipedia, browserleaks) split it. -- **The C64 Ultimate was not validated for this release.** +- **The Wikipedia REU viewer demo does not link with `PQ_HYBRID=1`.** `make BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 PQ_HYBRID=1 HTTPS_HOST=en.wikipedia.org HTTPS_PATH=/wiki/Commodore_64 HTTPS_BODY_TO_REU=1` overflows CRYPTO_HOT by 507 B. Build the demo without `PQ_HYBRID`. +- **A hybrid ServerHello sent as one record cannot be read** (the record buffer is 548 B); the client refuses it at once, leaving `tls_sh_err=$0E` (not shown on screen). Servers that honour max_fragment_length (OpenSSL, Wikipedia, browserleaks) split it. Front ends that ignore it, such as Cloudflare's and BoringSSL-based ones, are out of scope (Cloudflare also enforces a ~15 s deadline). +- **`ip65-onchip` is not network-validated at this release** (see above). +- **The C64 Ultimate was not validated for this release.** The last C64U run (v0.5.1, `uci-onchip` against Wikipedia at 64 MHz) did not reach a connection: + - Its trust store could not be used, so the image printed `TRUST FAIL 02` and asked `CONTINUE UNPINNED? Y/N`. The UCI images keep their trust store (`TRUST.A` / `TRUST.B`) on `/USB1`, and that C64 Ultimate has no `/USB1` volume. That fits, but the cause was not investigated. + - The path the rig typed arrived as `/wiki/.ommodore_64`. + - No socket was opened ("NOT DIALLED"). diff --git a/tools/package/_common.sh b/tools/package/_common.sh index 7039310..0583ab6 100644 --- a/tools/package/_common.sh +++ b/tools/package/_common.sh @@ -23,8 +23,8 @@ # and every downstream script picks it up with no further edits. PACKAGE_VARIANTS=( "ip65-onchip|c64-https-ip65-onchip.prg|BACKEND=ip65 USE_NISTCURVES_ONCHIP=1|ip65-noreu|ip65|MAXIMUM COMPATIBILITY. Bone-stock C64 + RR-Net / cs8900a cartridge. No REU, no turbo, nothing optional at all — the only image a completely unmodified machine can run end to end. Slowest: ~36 min per handshake at 1 MHz." - "uci-onchip|c64-https-uci-onchip.prg|BACKEND=uci USE_NISTCURVES_ONCHIP=1 TRUST_STORE=1 PQ_HYBRID=1|uci-noreu|uci|TURBO, NO REU. Ultimate 64 / C64 Ultimate at 32/48/64 MHz with the REU disabled or absent. Boots straight to the menu. Offers the hybrid X25519MLKEM768 key exchange (post-quantum, with X25519 as the fallback the server may choose): ~+1.7 s of handshake measured on the comb image (n=1, U64E at 48 MHz). Remembers each server's key on first use (TRUST.A / TRUST.B on /USB1) and refuses a changed one unless you accept it." - "uci-comb|c64-https-uci-comb.prg|BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 TRUST_STORE=1 PQ_HYBRID=1|uci-comb|uci|TURBO + REU — FASTEST. Ultimate 64 / C64 Ultimate at 32/48/64 MHz with the REU enabled. ~1.7x faster verify than the no-REU turbo image (measured: 16.4 s vs 28.4 s on a U64E at 48 MHz). Costs a one-time table build at every boot: ~34 s at 64 MHz, ~45 s at 48 MHz. Needs REU bank 2. Offers the hybrid X25519MLKEM768 key exchange (post-quantum, with X25519 as the fallback the server may choose): measured +1.7 s of handshake on the comb image, n=1, U64E at 48 MHz. Remembers each server's key on first use (TRUST.A / TRUST.B on /USB1) and refuses a changed one unless you accept it." + "uci-onchip|c64-https-uci-onchip.prg|BACKEND=uci USE_NISTCURVES_ONCHIP=1 TRUST_STORE=1 PQ_HYBRID=1|uci-noreu|uci|TURBO, NO REU. Ultimate 64 / C64 Ultimate at 32/48/64 MHz with the REU disabled or absent. Boots straight to the menu. Offers the hybrid X25519MLKEM768 key exchange (post-quantum, with X25519 as the fallback the server may choose): about +2.5 s to client Finished vs the same image without it (U64E at 48 MHz, n=3). Remembers each server's key on first use (TRUST.A / TRUST.B on /USB1) and refuses a changed one unless you accept it." + "uci-comb|c64-https-uci-comb.prg|BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 TRUST_STORE=1 PQ_HYBRID=1|uci-comb|uci|TURBO + REU — FASTEST. Ultimate 64 / C64 Ultimate at 32/48/64 MHz with the REU enabled. ~1.7x faster verify than the no-REU turbo image (measured: 16.4 s vs 28.4 s on a U64E at 48 MHz). Costs a one-time table build at every boot: ~34 s at 64 MHz, ~45 s at 48 MHz. Needs REU bank 2. Offers the hybrid X25519MLKEM768 key exchange (post-quantum, with X25519 as the fallback the server may choose): about +2.5 s to client Finished vs the same image without it (U64E at 48 MHz, n=3). Remembers each server's key on first use (TRUST.A / TRUST.B on /USB1) and refuses a changed one unless you accept it." ) # Field accessors — `variant_field <1-based index>`. diff --git a/tools/package/write_manifest.sh b/tools/package/write_manifest.sh index 2089a81..615ce0c 100755 --- a/tools/package/write_manifest.sh +++ b/tools/package/write_manifest.sh @@ -88,7 +88,9 @@ echo " ~36 min per handshake at 1 MHz." echo echo " uci-onchip Ultimate 64 / C64 Ultimate at turbo, REU off." echo " Boots straight to the menu. Offers the hybrid" -echo " X25519MLKEM768 (post-quantum) key exchange." +echo " X25519MLKEM768 key exchange (key exchange only;" +echo " authentication is unchanged; demonstration only," +echo " not cryptographically secure)." echo echo " uci-comb Ultimate 64 / C64 Ultimate at turbo, REU ON." echo " The fastest image: ~1.7x quicker verify than" @@ -96,7 +98,7 @@ echo " uci-onchip. It builds a 16 KB table into REU" echo " bank 2 at every boot before the menu appears —" echo " ~34 s at 64 MHz, ~45 s at 48 MHz. That is the" echo " program working, not a hang. Also offers the" -echo " hybrid X25519MLKEM768 key exchange (+1.7 s, n=1)." +echo " hybrid X25519MLKEM768 key exchange (+2.5 s, n=3)." echo echo " Why the split: below about 5 MHz the extra table work costs more" echo " than it saves, and below ~18 MHz the plain REU multiply path wins" @@ -167,7 +169,9 @@ echo echo " There are deliberately no combined images. Shipping one variant per disk" echo " means the label is the whole contents, so no image can quietly leave a" echo " product out: what you downloaded is what boots. A disk holding all three" -echo " could not fit in any case - 248 + 248 + 186 = 682 blocks against 664." +echo " would not be the label-is-the-contents disk this is (the three PRGs are" +echo " 186 + 186 + 202 = 574 blocks against a .d64's 664, so they would fit;" +echo " the split is deliberate, not forced)." echo if [ -f "$D64_LIST" ]; then while IFS= read -r ln; do From 71abd1c4fbccd9b7467b2f5da2f56af21f859f0a Mon Sep 17 00:00:00 2001 From: JC-000 <3798556+JC-000@users.noreply.github.com> Date: Sat, 17 Oct 2026 23:52:53 -0500 Subject: [PATCH 5/7] Release review: REQUIRE_KEX tests/mutants (95/95), banner boot note, PQ_DUMP tolerates classic images Co-Authored-By: Claude Sonnet 5.5 --- tools/mutate_http_body_checks.py | 7 ++++--- tools/test_http_body_checks_unit.py | 7 +++++++ tools/uci/rig_https_banner.py | 7 ++++++- tools/uci/rig_https_local.py | 2 ++ 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/tools/mutate_http_body_checks.py b/tools/mutate_http_body_checks.py index fdf3835..68ada55 100644 --- a/tools/mutate_http_body_checks.py +++ b/tools/mutate_http_body_checks.py @@ -141,7 +141,8 @@ ("the rig decides its own exit code again instead of delegating", RIG, " code, report = decide_exit(banner_ok=banner_ok, shadow=shadow,\n" - " settled=settled, status=status, body=body)", + " settled=settled, status=status, body=body,\n" + " kex=kex, require_kex=REQUIRE_KEX)", " code, report = (0, ['PASS'])"), # --- Round-2 review wrote these six against decide_exit WITHOUT # --- looking at this list, and all six were caught. Folded in so @@ -175,8 +176,8 @@ ("the rig passes decide_exit's verdicts positionally, so a " "settled/status transposition is invisible to every guard", RIG, - " code, report = decide_exit(banner_ok=banner_ok, shadow=shadow,\n settled=settled, status=status, body=body)", - " code, report = decide_exit(banner_ok, shadow, status, settled, body)"), + " code, report = decide_exit(banner_ok=banner_ok, shadow=shadow,\n settled=settled, status=status, body=body,\n kex=kex, require_kex=REQUIRE_KEX)", + " code, report = decide_exit(banner_ok, shadow, status, settled, body, kex, REQUIRE_KEX)"), # --- the 6502 side. The reviewer reversed these two arms in # --- src/http.s and every host-side test stayed green, 8/8. ("the 6502 verdict tests http_chunked before http_cl_valid " diff --git a/tools/test_http_body_checks_unit.py b/tools/test_http_body_checks_unit.py index 4926f70..eb494ac 100644 --- a/tools/test_http_body_checks_unit.py +++ b/tools/test_http_body_checks_unit.py @@ -1071,6 +1071,13 @@ def test_the_banner_rig_delegates_its_exit_code() -> None: missing = {"banner_ok", "shadow", "settled", "status", "body", "kex", "require_kex"} - given assert not missing, f"decide_exit is not given {sorted(missing)}" + # ...and the two REQUIRE_KEX inputs are exactly the group the rig + # read and the parsed requirement: passing kex=None (or a literal) + # would turn the check into a constant. + kws = {kw.arg: ast.unparse(kw.value) for kw in call.value.keywords} + assert kws["kex"] == "kex" and kws["require_kex"] == "REQUIRE_KEX", kws + assert "label_addr('tls_kex_group')" in ast.unparse(tree), ( + "the rig no longer reads tls_kex_group") # =========================================================================== diff --git a/tools/uci/rig_https_banner.py b/tools/uci/rig_https_banner.py index 3d72bc5..9cb3034 100755 --- a/tools/uci/rig_https_banner.py +++ b/tools/uci/rig_https_banner.py @@ -319,7 +319,12 @@ def main() -> int: print(f"[fatal] {exc}", file=sys.stderr) return 4 - print(f"Waiting up to {INIT_WAIT:.0f}s for the menu (comb boot precompute)...") + try: + label_addr("ec_precompute_256") + boot_note = " (comb boot precompute)" + except KeyError: + boot_note = "" + print(f"Waiting up to {INIT_WAIT:.0f}s for the menu{boot_note}...") ok, lines = wait_for(client, "Q=QUIT", INIT_WAIT + 30, "boot") if not ok: dump(lines, "screen at boot timeout") diff --git a/tools/uci/rig_https_local.py b/tools/uci/rig_https_local.py index 73c566e..22a71ab 100644 --- a/tools/uci/rig_https_local.py +++ b/tools/uci/rig_https_local.py @@ -284,6 +284,8 @@ def _pq_dump(client, transport, labels, outdir: str) -> None: time.sleep(3.0) def rd(name, n): + if name not in labels: # a classic image has no PQ labels: dump what exists + return "" return bytes(client.read_mem(labels[name], n)).hex() state = { From 446173b6a22913f59afa3b3891819393f0487b04 Mon Sep 17 00:00:00 2001 From: JC-000 <3798556+JC-000@users.noreply.github.com> Date: Sun, 18 Oct 2026 00:06:16 -0500 Subject: [PATCH 6/7] Release round 2 nits: docs/tooling only (diagram, MANIFEST disclaimer, sums script checks M3 files and is executable, kex message, notes) Co-Authored-By: Claude Sonnet 5.5 --- CLAUDE.md | 5 +++-- README.md | 6 +++++- docs/release-notes-v0.6.0.md | 8 ++++---- tools/package/write_manifest.sh | 4 ++++ tools/package/write_release_sums.sh | 17 +++++++++++++---- tools/pq_keylog_check.py | 4 +++- tools/test_pq_keylog_check.py | 6 ++++++ tools/uci/rig_https_banner.py | 4 ++-- 8 files changed, 40 insertions(+), 14 deletions(-) mode change 100644 => 100755 tools/package/write_release_sums.sh diff --git a/CLAUDE.md b/CLAUDE.md index 2e720be..ca5bd3f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -571,8 +571,9 @@ never exercised: - Cloudflare is out of scope: ignores MFL and enforces a ~15 s deadline. PQ_HYBRID (P5): X25519MLKEM768 handshakes complete on the U64E against a local -OpenSSL 3.6.5 `s_server`, onchip and comb images. Live servers, comb image only: -browserleaks.com (HTTP 200) and en.wikipedia.org (HTTP 301 at `/`); github.com and +OpenSSL 3.6.5 `s_server`, onchip and comb images. Live: en.wikipedia.org's C64 +article on both release images (see End-to-end status), browserleaks.com (HTTP 200) +and en.wikipedia.org `/` (HTTP 301) on comb; github.com and lwn.net do not offer 11EC (handshake_failure to a hybrid-only hello). Image hashes, make lines and timings: the P5 section of engineering-notes. diff --git a/README.md b/README.md index 464eb91..7406bd7 100644 --- a/README.md +++ b/README.md @@ -120,7 +120,7 @@ a venv mismatch reproduces #90 exactly after an install that appeared to succeed │ ┌──────┴───────┐ ┌──────┴─────────┐ │ │ │ AEAD │ │ Key Schedule │ │ (crypto modules) │ │ ChaCha20- │ │ HKDF-SHA256 │ │ hkdf.s - │ │ Poly1305 │ │ X25519+ML-KEM768│ │ + │ │ Poly1305 │ │ ECDHE X25519 │ │ │ └──────────────┘ └────────────────┘ │ ├─────────────────────────────────────────┤ │ Network backend boundary │ net_init / net_poll / net_tcp_* @@ -135,6 +135,10 @@ a venv mismatch reproduces #90 exactly after an install that appeared to succeed make BACKEND=ip65 make BACKEND=uci ``` +On the UCI images built `PQ_HYBRID=1` (both shipped ones) the key exchange +is X25519 plus ML-KEM-768 (X25519MLKEM768); the box above shows the classic +ECDHE only. + The TLS, HTTP, and crypto layers are backend-agnostic: switching backend is a link-line change (different cfg + different `src/net//*.o`), not a call-site change. diff --git a/docs/release-notes-v0.6.0.md b/docs/release-notes-v0.6.0.md index 866c2f9..d6b5e0e 100644 --- a/docs/release-notes-v0.6.0.md +++ b/docs/release-notes-v0.6.0.md @@ -8,7 +8,7 @@ Built from the commit tagged `v0.6.0`. Submodule pins (`tools/check_upstream_pin - `libs/x25519` v0.16.0 (unchanged); - ip65 `25a9c5a` (untagged, unchanged). -This release covers the merged PRs since v0.5.1: #306-#308, #310, #311 (build and rig fixes), #312-#315 (the post-quantum hybrid key exchange, below) and this release's packaging change. The main change: **both UCI images now offer the hybrid key exchange X25519MLKEM768.** They have completed fetches of the Wikipedia Commodore 64 article over it on hardware. `ip65-onchip` stays classic and is **not** byte-identical to v0.5.1 (see below). +This release covers the merged PRs since v0.5.1: #303, #306-#308, #310, #311 (build, rig and docs fixes), #312-#315 (the post-quantum hybrid key exchange, below) and this release's packaging change. The main change: **both UCI images now offer the hybrid key exchange X25519MLKEM768.** They have completed fetches of the Wikipedia Commodore 64 article over it on hardware. `ip65-onchip` stays classic and is **not** byte-identical to v0.5.1 (see below). **No classic UCI image ships any more.** `uci-onchip` and `uci-comb` are the same products as before with `PQ_HYBRID=1` added to their make arguments. To build the v0.5.1-style X25519-only UCI image, omit it: `make BACKEND=uci USE_NISTCURVES_ONCHIP=1 TRUST_STORE=1` (or `USE_NISTCURVES_ONCHIP_COMB=1`). @@ -47,7 +47,7 @@ The 1541 filenames (`ip65-noreu`, `uci-noreu`, `uci-comb`) and the PRG sizes (47 - The ClientHello offers `X25519MLKEM768` (0x11EC: ML-KEM-768 encapsulation key || X25519 share) first and `X25519` (0x001D) second; the server picks. A 0x11EC answer feeds `mlkem_ss || x25519_ss` into the handshake secret (draft-ietf-tls-ecdhe-mlkem, ML-KEM first). A 0x001D answer completes with X25519 alone, as before. - **A server that picks X25519 does not get the v0.5.1 client.** KeyGen still runs on every connection; the ClientHello is about 1.2 KB larger and is sent in several sections; and the ServerHello is read by a stricter streaming reader (an empty session-id echo, exactly the two extensions we asked for, a malformed or oversize record header while waiting for the ServerHello is now fatal). - ML-KEM-768 comes from `libs/mlkem` (c64-mlkem v0.6.0). Its code is staged in the PRG at `$A000` and copied to `$E000` at boot; the polynomial area is `$D000-$DFFF` (RAM under I/O) and the decapsulation-key scratch is the first 2,400 B of the TCP ring. Intermediates are scrubbed after KeyGen and after Decaps, and both shared secrets are zeroed once the handshake secret exists. `PQ_HYBRID` is refused on ip65, uci-m3 and the uci REU profile. -- **Cost** (U64E at 48 MHz, local OpenSSL 3.6.5 listener, release arguments plus `HTTPS_SNI`, time from the SYS trigger to client Finished, 0.5 s poll, n=3 each; the classic image is the same arguments without `PQ_HYBRID`): +- **Cost** (U64E at 48 MHz, local OpenSSL 3.6.5 listener started with `-groups X25519` for the classic image and `-groups X25519MLKEM768` for the PQ image (the group differs per column and cannot be avoided: the classic client offers no hybrid group), release arguments plus `HTTPS_SNI`, time from the SYS trigger to client Finished, 0.5 s poll, n=3 each; the classic image is the same arguments without `PQ_HYBRID`): | image | classic (PQ_HYBRID off) | hybrid | difference | |---|---|---|---| @@ -61,7 +61,7 @@ The 1541 filenames (`ip65-noreu`, `uci-noreu`, `uci-comb`) and the PRG sizes (47 ## Other changes since v0.5.1 - PQ stages, in order: the sectioned ClientHello with 16-bit lengths and HelloRetryRequest refusal (#312); `libs/mlkem` pinned and placed behind `PQ_HYBRID=1`, link-only (#313); the streaming hybrid ServerHello, KeyGen in `tls_connect`, Decaps (#314); the hybrid key schedule (#315). -- The linker output no longer depends on the build locale (#311), a linker-config edit relinks the PRG (#306), a bare pytest is green on a uci or an ip65 build (#308), and the rig trampolines set the trust-store mode (#307). Docs: #303, #310. +- The linker output no longer depends on the build locale (#311), a linker-config edit relinks the PRG (#306), a bare pytest is green on a uci or an ip65 build (#308), and the rig trampolines set the trust-store mode (#307). Docs: #303 (where the UCI images keep the trust store), #310 (M3 demo provenance). - `tools/uci/rig_https_banner.py` prints `tls_kex_group`; `REQUIRE_KEX=EC` makes any other group part of the exit decision (`decide_exit`). ## `ip65-onchip` is not the v0.5.1 binary @@ -106,7 +106,7 @@ All 8 runs completed; no truncation was seen. The silent-truncation defect #211 **Trust store on the PQ images** (the store stages in the TCP ring, which now also hosts the ML-KEM dk scratch). The rigs refuse any directory but `//c64https-test`, so they ran on the release arguments plus `TRUST_STORE_DIR=/USB1/c64https-test HTTPS_PORT=24520` (`uci-onchip` `a0d26e3d…`, `uci-comb` `e8adb55d…`); the real `/USB1/TRUST.A|B` (80 B / 144 B) were unchanged afterwards: - `rig_trust_store.py` (disk I/O: empty, save, load, torn write, corruption, 32 records, missing directory): exit 0 on both, 24 and 25 checks, 0 failures; phase 13 runs only at 1 MHz and was not run. -- `rig_trust_policy.py`, local mode, through the menu against a Python TLS 1.3 listener (it can only choose X25519, so these fetches took 0x001D): exit 0 on both, **30 passed, 0 failed each**: first use records the key (`KEY RECORDED`), a matching key is `KNOWN KEY` with the store untouched, a changed key shows `KEY CHANGED` and the full hash and sends no client Finished, accept-on-retry records `ACCEPTED/K2`, and `Y` at the prompt runs one `UNPINNED` fetch that records nothing. Live mode (`RIG_MODE=live`) needs the REU viewer demo, which does not link with PQ (below), so it was not run. +- `rig_trust_policy.py`, local mode, through the menu against a Python TLS 1.3 listener (it can only choose X25519, so these fetches took 0x001D): exit 0 on both, **30 passed, 0 failed each**: first use records the key (`KEY RECORDED`), a matching key is `KNOWN KEY` with the store untouched, a changed key shows `KEY CHANGED` and the full hash and sends no client Finished, accept-on-retry records `ACCEPTED/K2`, and `Y` at the prompt runs one `UNPINNED` fetch that records nothing. Live mode (`RIG_MODE=live`) needs the REU viewer demo, which does not link with PQ (below), so it was not run. **Disclosure:** the first-use and changed-key trust paths were therefore exercised on the PQ images with X25519 fetches only (KeyGen and the dk scratch in the ring still ran on every connect); with an 11EC server only the known-key path has been run, in the Wikipedia runs above. **Memory** (`tools/measure_margins.py --build`, the exact release arguments, free bytes): `uci-onchip` LOADER 157, NET_CODE 105, CRYPTO_OVERLAY 372, CRYPTO_HOT 196; `uci-comb` LOADER 342, NET_CODE 134, **CRYPTO_OVERLAY 55**, CRYPTO_HOT 379, COLD_IMAGE 1,697, COLD_RUN_TRUST 75. diff --git a/tools/package/write_manifest.sh b/tools/package/write_manifest.sh index 615ce0c..8c9fba9 100755 --- a/tools/package/write_manifest.sh +++ b/tools/package/write_manifest.sh @@ -31,6 +31,10 @@ echo echo "TLS 1.3 / HTTPS client for the Commodore 64. Everything here is prebuilt:" echo "you need no assembler, no cc65, no Python packages and no build step." echo +echo "DEMONSTRATION AND EDUCATIONAL USE ONLY. This client is not cryptographically" +echo "secure (weak entropy, no certificate chain validation), including the" +echo "post-quantum hybrid key exchange the UCI images offer." +echo echo "generated : $(info generated)" echo "git HEAD : $(info git_head)" if [ "$(info git_dirty)" = "yes" ]; then diff --git a/tools/package/write_release_sums.sh b/tools/package/write_release_sums.sh old mode 100644 new mode 100755 index f751389..0ee2fd0 --- a/tools/package/write_release_sums.sh +++ b/tools/package/write_release_sums.sh @@ -13,10 +13,11 @@ # c64-https-uci-m3-demo.{prg,d64} c64-https-uci-m3-demo-README.txt # c64-https-uci-m3-demo-SHA256SUMS # -# The M3 demo's own README is attached under the name -# c64-https-uci-m3-demo-README.txt and its checksum file under -# c64-https-uci-m3-demo-SHA256SUMS; inside the demo package they are -# README.txt and SHA256SUMS, so pass either spelling. +# The M3 demo's own README and checksum file are attached under the names +# c64-https-uci-m3-demo-README.txt and c64-https-uci-m3-demo-SHA256SUMS; +# inside the demo package they are README.txt and SHA256SUMS. This script +# expects the attached names (copy/rename them into first) and +# also checks the M3 PRG, .d64 and README against the M3 checksum file. # # tools/package/write_release_sums.sh # @@ -48,6 +49,14 @@ for f in "${ASSETS[@]}"; do done [ "$missing" = 0 ] || exit 1 +# The M3 demo's own checksum file must agree with the files beside it. It names +# its README README.txt, so check through a temporary copy under that name. +tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT +cp c64-https-uci-m3-demo.prg c64-https-uci-m3-demo.d64 "$tmp/" +cp c64-https-uci-m3-demo-README.txt "$tmp/README.txt" +( cd "$tmp" && shasum -a 256 -c "$OLDPWD/c64-https-uci-m3-demo-SHA256SUMS" >/dev/null ) \ + || { echo "write_release_sums: the M3 files do not match their own checksum file" >&2; exit 1; } + shasum -a 256 "${ASSETS[@]}" > SHA256SUMS shasum -a 256 -c SHA256SUMS >/dev/null echo "wrote $DIR/SHA256SUMS (${#ASSETS[@]} assets, verified)" diff --git a/tools/pq_keylog_check.py b/tools/pq_keylog_check.py index 83868fc..60a3f0a 100644 --- a/tools/pq_keylog_check.py +++ b/tools/pq_keylog_check.py @@ -112,7 +112,9 @@ def check_state(state, keylog_text): IDLE again after tls_close.""" h = lambda k: bytes.fromhex(state[k]) # noqa: E731 if h("tls_kex_group") != b"\xec": - return "inconclusive", f"tls_kex_group=${state['tls_kex_group']}: the server did not choose 11EC, no hybrid run to check" + kg = state.get("tls_kex_group") or "" + return "inconclusive", (f"tls_kex_group={'$' + kg if kg else 'n/a (no PQ labels: a classic image)'}: " + "the server did not choose 11EC, no hybrid run to check") if h("tls_sh_err") != b"\x00": return "inconclusive", f"tls_sh_err=${state['tls_sh_err']}: the ServerHello was refused" if h("tls_reached_connected") != b"\x07": diff --git a/tools/test_pq_keylog_check.py b/tools/test_pq_keylog_check.py index 0056a09..debbbc8 100644 --- a/tools/test_pq_keylog_check.py +++ b/tools/test_pq_keylog_check.py @@ -102,6 +102,12 @@ def test_state_mode_red_on_either_secret(): _log3())[0] is False +def test_a_classic_image_state_names_itself_not_a_dollar_sign(): + classic = {k: "" for k in _state()} + r, msg = K.check_state(classic, _log3()) + assert r == "inconclusive" and "n/a" in msg and "$:" not in msg, msg + + def test_state_mode_residue_is_a_failure_not_a_pass(): for k, n in (("tls_pq_seed", 64), ("tls_mlkem_ss", 32), ("tls_shared_secret", 32)): r, msg = K.check_state(_state(**{k: "11" * n}), _log3()) diff --git a/tools/uci/rig_https_banner.py b/tools/uci/rig_https_banner.py index 9cb3034..8aff685 100755 --- a/tools/uci/rig_https_banner.py +++ b/tools/uci/rig_https_banner.py @@ -519,8 +519,8 @@ def read_shadow_ok(): # PQ_HYBRID builds: which group the server chose. Read after the close # wait, on the live transport (tls_kex_group sits just past the 'Q' # scrub span; nothing rewrites it until the next connect). Printed always - # when the label exists; REQUIRE_KEX=EC (hex) makes a different - # group a failure of an otherwise passing run. + # when the label exists. REQUIRE_KEX=EC (hex) is a verdict inside + # decide_exit (check_kex_group), not logic here: this block only reads. kex = None try: kex = bytes(client.read_mem(label_addr("tls_kex_group"), 1))[0] From 82082290c6568d3c3fb34994527717157b7623e6 Mon Sep 17 00:00:00 2001 From: JC-000 <3798556+JC-000@users.noreply.github.com> Date: Sun, 18 Oct 2026 08:10:42 -0500 Subject: [PATCH 7/7] Release notes: ip65-onchip VICE e2e PASS at honest 1 MHz (docs only) Co-Authored-By: Claude Sonnet 5.5 --- docs/release-notes-v0.6.0.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/release-notes-v0.6.0.md b/docs/release-notes-v0.6.0.md index d6b5e0e..72040f2 100644 --- a/docs/release-notes-v0.6.0.md +++ b/docs/release-notes-v0.6.0.md @@ -66,7 +66,9 @@ The 1541 filenames (`ip65-noreu`, `uci-noreu`, `uci-comb`) and the PRG sizes (47 ## `ip65-onchip` is not the v0.5.1 binary -`c64-https-ip65-onchip.prg` is `e69bfce7…`; v0.5.1's was `810f1158…`. Rebuilt at each step: `1c377d34…` after #311 (link order only), then `e69bfce7…` from #312 on, unchanged by #313-#315. **#312 changed ip65 code**: it added the HelloRetryRequest check to the ip65 ServerHello parser and changed the shared ClientHello builder. **No handshake has been run on these ip65 bytes**: the VICE network rig needs a sudo rig-up that was not done for this release, so the image has only been booted to the banner (package-verify). Treat it as not network-validated at v0.6.0, whatever "unchanged by PQ" may suggest. It does not offer the hybrid. +`c64-https-ip65-onchip.prg` is `e69bfce7…`; v0.5.1's was `810f1158…`. Rebuilt at each step: `1c377d34…` after #311 (link order only), then `e69bfce7…` from #312 on, unchanged by #313-#315. **#312 changed ip65 code**: it added the HelloRetryRequest check to the ip65 ServerHello parser and changed the shared ClientHello builder. It does not offer the hybrid. + +**Validated in emulation, not on silicon.** The hardware-free ip65 end-to-end (`tests/rig_vice_https_macos.py`, `E2E_PROFILE=onchip`, `E2E_NO_WARP=1`) PASSED on these bytes: ethernet-capable VICE 3.10 `x64sc` (the patched pcap build at `~/opt/vice-eth/bin/x64sc`) on a feth/pcap link with the rig's dnsmasq, a host TLS 1.3 listener on port 24530, honest 1 MHz, 2,328 s wall (DHCP OK at +35 s; after `G`: TCP connected +3 s, CH +475 s, SH +931 s, ServerHello processed (PROC) +950 s, last flight record received +2,266 s, server Finished +2,269 s, request sent +2,287 s, connection closed +2,293 s), `http_status=200`, body `TLS13 OK FROM C64 TEST` (22 B, as expected). The image under test was built with the exact release arguments plus the rig's port: `make BACKEND=ip65 USE_NISTCURVES_ONCHIP=1 TRUST_RELEASE=1 HTTPS_PORT=24530`, sha256 `9b1ef4b1582242ef0820a33499c60f1f6a69db803f45de6431451fe34a4c7463`. It differs from the release PRG `e69bfce7…` in exactly 4 bytes, the two HTTPS_PORT words (443 = `$01BB` vs 24530 = `$5FD2`, each stored twice); nothing else. What this does NOT cover: real RR-Net/cs8900a silicon (the physical rig was not run), server name validation (the ip65 image has none and accepts any certificate whose signature verifies), and anything faster than 1 MHz. ## M3 demo @@ -119,7 +121,7 @@ All 8 runs completed; no truncation was seen. The silent-truncation defect #211 - **Entropy is weak** (see above). - **The Wikipedia REU viewer demo does not link with `PQ_HYBRID=1`.** `make BACKEND=uci USE_NISTCURVES_ONCHIP_COMB=1 PQ_HYBRID=1 HTTPS_HOST=en.wikipedia.org HTTPS_PATH=/wiki/Commodore_64 HTTPS_BODY_TO_REU=1` overflows CRYPTO_HOT by 507 B. Build the demo without `PQ_HYBRID`. - **A hybrid ServerHello sent as one record cannot be read** (the record buffer is 548 B); the client refuses it at once, leaving `tls_sh_err=$0E` (not shown on screen). Servers that honour max_fragment_length (OpenSSL, Wikipedia, browserleaks) split it. Front ends that ignore it, such as Cloudflare's and BoringSSL-based ones, are out of scope (Cloudflare also enforces a ~15 s deadline). -- **`ip65-onchip` is not network-validated at this release** (see above). +- **`ip65-onchip` was validated in VICE only** (one e2e PASS at honest 1 MHz, see above); not on real RR-Net silicon at this release, and it has no server name validation. - **The C64 Ultimate was not validated for this release.** The last C64U run (v0.5.1, `uci-onchip` against Wikipedia at 64 MHz) did not reach a connection: - Its trust store could not be used, so the image printed `TRUST FAIL 02` and asked `CONTINUE UNPINNED? Y/N`. The UCI images keep their trust store (`TRUST.A` / `TRUST.B`) on `/USB1`, and that C64 Ultimate has no `/USB1` volume. That fits, but the cause was not investigated. - The path the rig typed arrived as `/wiki/.ommodore_64`.