interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / om / sha256 / om2-evidence / AUDIT-L838.txt

94 lines · 7057 bytes Raw Blame History
1L838 audit of sha256_init/update/final/hash callers (contract spec/omegese-om2.md section 7)
2=========================================================================================
3Tree: omega-mv main acb3f15cdc691b1b046b48b0dad0f9255a12ba4b. Evidence class: SOURCE (static text
4analysis plus a hand review of every flagged site). Recorded 2026-10-25.
5
6Method. The recipes in audit/ are oracle tooling (python3 3.12.3) outside the delivered closure.
7They expect to run from a copy in /tmp/zl/sha-audit:
8 python3 audit.py <repo> inventory over git-tracked *.c *.h *.cc *.cpp *.inc; strips comments and
9 string bodies; splits arguments with balanced parentheses -> callsites.tsv
10 python3 audit2.py <repo> (A) hash with digest and data sharing a base, (B) final whose digest
11 names the ctx, (C) update whose data names the ctx, (D) per function and
12 per ctx expression: update/final after final without init, final inside
13 a loop whose body has no init, final in a function with no init;
14 (E) copy-initialised ctx, assignments, memcpy/memmove/memcmp/memset on
15 ctx objects, struct members of type sha256_ctx, .state/.count/.buffer
16 access; (F) by-value ctx parameters and returns -> audit2.out
17 python3 audit3.py <repo> one level of wrappers that forward (data, digest) parameters into
18 sha256_hash; their calls with a shared base -> audit3.out
19Scope limit: static. Aliasing through pointers that arrive as distinct parameters is not decidable
20from text; the wrapper pass covers one level. Lengths >= 2^32 cannot be found statically (every
21caller passes size_t).
22
231. Count (non-declaration call sites)
24 built tree (src tools tests research om): 894 sites in 165 files
25 init 163, update 353, final 167, hash 211
26 src 572 (init 102, update 250, final 105, hash 115) tools 56 (11, 13, 12, 20)
27 tests 217 (40, 69, 40, 68) research 29 (6, 15, 6, 2)
28 src/sha256.c internal 3 (sha256_hash's streamed path), om/sha256/parity harness 17
29 consumers (excluding src/sha256.c and the parity harness): 874; src/ + tools/: 628
30 also: C embedded in tools/test_numeric_qualify.sh:269-276 (init, update, final: 3 sites);
31 Makefile:2017,2057,2059,2061 are mutant replacement strings of existing source lines.
32 not built: evidence/ snapshots, 25 hash sites in 21 files.
33 No call through a function pointer, no NULL or literal-0 pointer argument.
34
352. Digest overlapping data (all sha256_hash; final's digest never names its ctx; no update reads
36 from its own ctx)
37 OVERLAP src/omega_program.c:777 sha256_hash(task, sizeof(SynthesisTask) - OMEGA_ID_BYTES,
38 task->task_id.bytes); task_id is the first field (src/omega_program.h:83), so the digest
39 [0,32) lies inside the hashed range [0, sizeof - 32).
40 OVERLAP tests/runtime/rx_sem_incremental.c:183 sha256_hash(d, 32, d), iterated.
41 Adjacent, not overlapping (half-open ranges): src/physics0/ladder/pd0_fmt.c:54,336;
42 src/runtime/rx_costmodel.c:487; src/runtime/rx_jspace.c:1663; src/tensor/omega_tensor_store.c:307,322;
43 tests/runtime/rx_c4_requal.c:788,789; tests/runtime/rx_costmodel_unit.c:434;
44 tests/runtime/rx_jspace_prod.c:828,885,886; tests/test_omega_tensor_store.c:534,551;
45 via wrapper checksum(): src/runtime/rx_generation.c:297,339,364,562.
46 Distinct fields of one struct (code pointer vs digest array, no overlap):
47 src/omega_blackwell_codegen.c:1286, src/omega_blackwell_gates.c:824,
48 src/omega_gpu_attention_api.c:739, src/omega_gpu_elementwise_api.c:869, tests/vc_fixture.h:55.
49 Contract: covered by section 6 `out` (copy after status 0, memmove). Receipt required: hash(d,32,d)
50 (erratum E3 (2)).
51
523. Context used after final without init: none.
53 No update or final follows a final on the same ctx without an init between them, and no final sits
54 in a loop whose body lacks the init. Six finals are in functions without a local init: the four in
55 src/reservoir/omega_reservoir.c (217, 613, 631, 653) init through h_domain() (line 191 calls
56 sha256_init first); src/fabric/fab_loopback.c:108 and src/fabric/fabric.c:498 finalize a copy
57 (item 4).
58
594. Whole-context copies (no compare)
60 COPY src/fabric/fab_loopback.c:107 sha256_ctx c = l->transcript; sha256_final(&c, out);
61 (FabLoop.transcript, fab_loopback.h:62; init at fab_loopback.c:77, updates at :56-57)
62 COPY src/fabric/fabric.c:496 ev = n->event_hash; sha256_final(&ev, evd);
63 (FabNode.event_hash, fabric.h:277; init at :192, update at :78)
64 COPY src/osh/host/osh_journal.c:81,104 sha256_ctx h = *hp; ...updates...; *hp = h;
65 All three copy a LIVE context (between init and final) and continue or finalize the copy; the
66 original keeps being used. They need: a byte copy of a live context is an equivalent context. This
67 was reported to the coordinator and became erratum E3 (1); receipt required: copy after k updates.
68 No memcmp/bcmp of a ctx. No memset of a ctx (every memset hit in audit2.out is another object
69 with a reused short name; reviewed). FabLoop and FabNode, which embed a ctx, are memset to zero
70 before their init and are never copied whole.
71
725. Dependence on the post-final state: none. No code reads a ctx after final; no access to
73 .state/.count/.buffer anywhere outside src/sha256.c; no by-value ctx parameter or return.
74
756. Build facts for the cutover (not section 7 semantics)
76 - src/sha256.c is the only translation unit that includes src/omega_om_units.inc, and
77 src/omega_blake3.c links against omega_omb3 defined there (omega_blake3.c:29). Deleting
78 sha256.c without a new home for the generated units breaks every BLAKE3 link.
79 - src/sha256.c is named in about 280 build lines: Makefile 61, mk/*.mk (37 files), and shell
80 recipes under tests/, tools/, seed/rung3, seed/rung4, research/atemporal, om/*/parity.
81 - Makefile:657 RX_CX_FS_ALLOWED lists sha256_* as the only allowed undefined symbols of the
82 freestanding rx_cortex object; erratum E3 (3) changes that rule to omega2_sha256_*.
83
84
857. Unit changes made after this audit that touch caller-visible behaviour (none change the API)
86 - S4 (2026-10-25): absorb exceeded the 16-register limit (error 12, line 268 @ 4c8aa0ff7). The
87 buffer copy is now fn tobuf (c, bi, d, o, k), used by absorb's tail and by sha256_update's short
88 path; absorb takes (c, d, bi) and reads n = len d. Same bytes copied in the same order.
89 - Rolled loops trap 4 after 1000000 passes: whole blocks go through blocks/run in runs of 2^25
90 bytes (part), so updates of >= 2^32 bytes stay supported (receipt: s4/README.txt, ./t big).
91 - The generated header names the buffer field `buf` (src/sha256.h: `buffer`); item 5: no caller
92 reads ctx fields, so no caller changes.
93
94Section 7 is consistent with the callers, given E3.