From ce3618f509c8297dc592b882a69085adbcac44fb Mon Sep 17 00:00:00 2001 From: JC-000 <3798556+JC-000@users.noreply.github.com> Date: Wed, 7 Oct 2026 18:25:37 -0500 Subject: [PATCH 1/2] measure_margins: add the shipped TRUST_STORE profiles; fix stale comb CRYPTO_HOT comment The two UCI products ship with TRUST_STORE=1 TRUST_RELEASE=1 (tools/package/_common.sh), and measure_margins measured neither, so the margins it printed for uci-onchip / uci-comb were not the shipped images'. Add uci-onchip-store and uci-comb-store, flag for flag as PACKAGE_VARIANTS builds them; their PRG hashes match the package (da4d607e..., e6750100...). The comb demo (uci-comb-demo-store) was already a profile. The comb cfgs (-onchip.cfg and its cold twin, kept in step for tools/test_cold_bank.py) said CRYPTO_HOT has no room for LIB_X25519_CODE on comb. That holds for the HTTPS_BODY_TO_REU demo only; the shipped comb-store image has CRYPTO_HOT to spare. Say so, and point at the tool instead of a figure. PRG-neutral on every profile. Co-Authored-By: Claude Opus 5.5 (1M context) --- cfg/c64-https-uci-onchip-cold.cfg | 8 +++++++- cfg/c64-https-uci-onchip.cfg | 8 +++++++- tools/measure_margins.py | 11 ++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/cfg/c64-https-uci-onchip-cold.cfg b/cfg/c64-https-uci-onchip-cold.cfg index f162ce2..3ab58b9 100644 --- a/cfg/c64-https-uci-onchip-cold.cfg +++ b/cfg/c64-https-uci-onchip-cold.cfg @@ -461,7 +461,13 @@ SEGMENTS { # --- Resident crypto + TLS code / rodata. --- CRYPTO_CODE: load = CRYPTO_HOT, type = ro; CRYPTO_RODATA: load = CRYPTO_OVERLAY, type = ro; # onchip-comb variant: relieve CRYPTO_HOT - LIB_X25519_CODE: load = CRYPTO_OVERLAY, type = ro; # CRYPTO_HOT has no room for it on comb # sibling ladder (x25519.s, x25519_init.s) + # Sibling ladder (x25519.s, x25519_init.s). It is here for the comb + # DEMO build (HTTPS_BODY_TO_REU=1), whose CRYPTO_HOT cannot hold it. + # The shipped product (TRUST_STORE=1, no viewer) has CRYPTO_HOT room to + # spare, so "no room" is a demo constraint, not a product one: compare + # the uci-comb-store and uci-comb-demo-store rows of + # tools/measure_margins.py before moving it, never a figure here. + LIB_X25519_CODE: load = CRYPTO_OVERLAY, type = ro; X25519_GLUE_CODE: load = CRYPTO_OVERLAY, type = ro; # src/crypto/x25519_tables.s, same home RESIDENT_RODATA: load = CRYPTO_HOT, type = ro, optional = yes; CRYPTO_INIT_CODE: load = CRYPTO_HOT, type = ro, optional = yes; diff --git a/cfg/c64-https-uci-onchip.cfg b/cfg/c64-https-uci-onchip.cfg index 3580f5d..cf9399a 100644 --- a/cfg/c64-https-uci-onchip.cfg +++ b/cfg/c64-https-uci-onchip.cfg @@ -425,7 +425,13 @@ SEGMENTS { # --- Resident crypto + TLS code / rodata. --- CRYPTO_CODE: load = CRYPTO_HOT, type = ro; CRYPTO_RODATA: load = CRYPTO_OVERLAY, type = ro; # onchip-comb variant: relieve CRYPTO_HOT - LIB_X25519_CODE: load = CRYPTO_OVERLAY, type = ro; # CRYPTO_HOT has no room for it on comb # sibling ladder (x25519.s, x25519_init.s) + # Sibling ladder (x25519.s, x25519_init.s). It is here for the comb + # DEMO build (HTTPS_BODY_TO_REU=1), whose CRYPTO_HOT cannot hold it. + # The shipped product (TRUST_STORE=1, no viewer) has CRYPTO_HOT room to + # spare, so "no room" is a demo constraint, not a product one: compare + # the uci-comb-store and uci-comb-demo-store rows of + # tools/measure_margins.py before moving it, never a figure here. + LIB_X25519_CODE: load = CRYPTO_OVERLAY, type = ro; X25519_GLUE_CODE: load = CRYPTO_OVERLAY, type = ro; # src/crypto/x25519_tables.s, same home RESIDENT_RODATA: load = CRYPTO_HOT, type = ro, optional = yes; CRYPTO_INIT_CODE: load = CRYPTO_HOT, type = ro, optional = yes; diff --git a/tools/measure_margins.py b/tools/measure_margins.py index 71f7581..e3c2c2c 100644 --- a/tools/measure_margins.py +++ b/tools/measure_margins.py @@ -55,7 +55,8 @@ WIKI = ("HTTPS_HOST=en.wikipedia.org", "HTTPS_PATH=/w/index.php?title=Commodore_64&action=raw") -# The five link profiles, plus the wikipedia target on both ip65 profiles: +# The five link profiles, the two shipped store products, the comb demo, +# plus the wikipedia target on both ip65 profiles: # ip65's NET_CODE tail is a joint budget with HTTPS_TARGET_RODATA, so the # default target's figure does not say whether a longer target links. PROFILES = { @@ -66,6 +67,14 @@ "uci-comb": ("BACKEND=uci", "USE_NISTCURVES_ONCHIP_COMB=1"), "ip65-wiki": ("BACKEND=ip65",) + WIKI, "ip65-onchip-wiki": ("BACKEND=ip65", "USE_NISTCURVES_ONCHIP=1") + WIKI, + # The two shipped UCI products, flag for flag as PACKAGE_VARIANTS in + # tools/package/_common.sh builds them (TRUST_STORE=1 TRUST_RELEASE=1). + # The plain uci-onchip / uci-comb rows above are NOT what ships: the + # store moves CRYPTO_OVERLAY and CRYPTO_HOT by hundreds of bytes. + "uci-onchip-store": ("BACKEND=uci", "USE_NISTCURVES_ONCHIP=1", + "TRUST_STORE=1", "TRUST_RELEASE=1"), + "uci-comb-store": ("BACKEND=uci", "USE_NISTCURVES_ONCHIP_COMB=1", + "TRUST_STORE=1", "TRUST_RELEASE=1"), # The comb Wikipedia demo with the trust store (#155 phase 2): the # build the cold bank exists for. HTTPS_BODY_TO_REU re-arms the viewer. "uci-comb-demo-store": ("BACKEND=uci", "USE_NISTCURVES_ONCHIP_COMB=1", From f95a4bb0ad5c1460b1a54ef0826ce1ee4a9b45c7 Mon Sep 17 00:00:00 2001 From: JC-000 <3798556+JC-000@users.noreply.github.com> Date: Thu, 8 Oct 2026 13:32:52 -0500 Subject: [PATCH 2/2] cfg: narrow the ladder comment in the COLD_BANK=0 comb cfg Review nit: the comment mirrored into cfg/c64-https-uci-onchip.cfg cited the shipped TRUST_STORE product, which that cfg can never link (the Makefile refuses COLD_BANK=0 with TRUST_STORE=1). It now says what the cfg links and that its CRYPTO_HOT question is its own build's. The cold cfg keeps the product-specific text; test_cold_bank.py's CFG_EDITS records the difference (case_cfg_is_the_comb_cfg_plus_the_bank: ok). Comment only: COLD_BANK=0 comb PRG unchanged (9dac6d43...). Co-Authored-By: Claude Opus 5.5 (1M context) --- cfg/c64-https-uci-onchip.cfg | 11 +++++------ tools/test_cold_bank.py | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/cfg/c64-https-uci-onchip.cfg b/cfg/c64-https-uci-onchip.cfg index cf9399a..bdaddfa 100644 --- a/cfg/c64-https-uci-onchip.cfg +++ b/cfg/c64-https-uci-onchip.cfg @@ -425,12 +425,11 @@ SEGMENTS { # --- Resident crypto + TLS code / rodata. --- CRYPTO_CODE: load = CRYPTO_HOT, type = ro; CRYPTO_RODATA: load = CRYPTO_OVERLAY, type = ro; # onchip-comb variant: relieve CRYPTO_HOT - # Sibling ladder (x25519.s, x25519_init.s). It is here for the comb - # DEMO build (HTTPS_BODY_TO_REU=1), whose CRYPTO_HOT cannot hold it. - # The shipped product (TRUST_STORE=1, no viewer) has CRYPTO_HOT room to - # spare, so "no room" is a demo constraint, not a product one: compare - # the uci-comb-store and uci-comb-demo-store rows of - # tools/measure_margins.py before moving it, never a figure here. + # Sibling ladder (x25519.s, x25519_init.s). This cfg links only + # COLD_BANK=0 comb images, which cannot hold TRUST_STORE (the Makefile + # refuses it), so neither shipped product is built here; whether + # CRYPTO_HOT could take the ladder is a question for this cfg's own + # build, measured, not for the cold cfg's figures. LIB_X25519_CODE: load = CRYPTO_OVERLAY, type = ro; X25519_GLUE_CODE: load = CRYPTO_OVERLAY, type = ro; # src/crypto/x25519_tables.s, same home RESIDENT_RODATA: load = CRYPTO_HOT, type = ro, optional = yes; diff --git a/tools/test_cold_bank.py b/tools/test_cold_bank.py index 34d1208..6d2e9c7 100644 --- a/tools/test_cold_bank.py +++ b/tools/test_cold_bank.py @@ -93,6 +93,22 @@ def check(ok, msg): # The cold cfg's whole delta from the comb cfg. If the comb cfg changes, the # change is owed to the cold one too, and this fails until it is made. CFG_EDITS = [ + # The ladder's placement comment: the cold cfg speaks for the shipped + # TRUST_STORE products, which the comb cfg (COLD_BANK=0) cannot link. + ( + ' # Sibling ladder (x25519.s, x25519_init.s). This cfg links only\n' + ' # COLD_BANK=0 comb images, which cannot hold TRUST_STORE (the Makefile\n' + ' # refuses it), so neither shipped product is built here; whether\n' + " # CRYPTO_HOT could take the ladder is a question for this cfg's own\n" + " # build, measured, not for the cold cfg's figures.\n" + ' LIB_X25519_CODE: load = CRYPTO_OVERLAY, type = ro;\n', + ' # Sibling ladder (x25519.s, x25519_init.s). It is here for the comb\n' + ' # DEMO build (HTTPS_BODY_TO_REU=1), whose CRYPTO_HOT cannot hold it.\n' + ' # The shipped product (TRUST_STORE=1, no viewer) has CRYPTO_HOT room to\n' + ' # spare, so "no room" is a demo constraint, not a product one: compare\n' + ' # the uci-comb-store and uci-comb-demo-store rows of\n' + ' # tools/measure_margins.py before moving it, never a figure here.\n' + ' LIB_X25519_CODE: load = CRYPTO_OVERLAY, type = ro;\n'), (" OVERLAY_FILE_PAD: start = $C000, size = $2000, file = %O, define = yes, fill = yes, fillval = $00;\n", " # Cold bank: the PRG's copy of the cold groups (src/net/uci/cold_bank.s),\n" " # back to back; boot stashes it into the REU. The head of what was\n"