omnet
aien-dev/omnet
Brought by drakestapleton
omnet / om / quantity / README.md
| 1 | # Checked quantities (SC1-Q) |
| 2 | |
| 3 | Apache-2.0 source imported byte-for-byte from Omega's `om/quantity/` proposal |
| 4 | [#771](https://github.com/aien-dev/omega-mv/pull/771), not a second implementation. |
| 5 | The `q` function prefix names this unit. Compiler pin is unchanged. |
| 6 | |
| 7 | `qty {val,cap}` distinguishes bounded quantities from modular scalar words; |
| 8 | `qobj {ident,ver,extent}` and `qslic {ident,ver,off,count}` bind a view to an |
| 9 | owner-assigned nonreused object/version, not an fd number. Raw fields remain |
| 10 | trusted construction boundaries, not sealed capabilities or physical units. |
| 11 | |
| 12 | All calls return int:0 success,1 malformed input,2 domain mismatch/negative signed |
| 13 | ingress/widening through narrow,3 overflow/underflow,4 object mismatch. Refusal |
| 14 | leaves output unchanged. Output/input structs must be distinct (seed alias rule). |
| 15 | |
| 16 | - `qword`, `qsigned`: validate original ingress before conversion/effects. |
| 17 | - `qadd`, `qsub`, `qmul`: validate both inputs/equal caps before guarded arithmetic. |
| 18 | - `qnarrow`: target cap cannot exceed source cap; value must fit. |
| 19 | - `qnext`: refuse cap exhaustion; no wrapping policy epoch. |
| 20 | - `qtyslice`: validate expected/current identity, version, extent, then offset and |
| 21 | count by subtraction before address formation. |
| 22 | |
| 23 | A constructor applied after a wrapped sum cannot recover the original operands. |
| 24 | Revalidate serialized slices from original offset/count against the trusted current |
| 25 | object immediately before effects. Same caps do not distinguish application units. |
| 26 | |
| 27 | Actual consumer: `dsframe` and `dsio` validate decoded lengths and cursor arithmetic |
| 28 | before socket effects; `dsgrow` checks positive signed syscall results before |
| 29 | conversion and checked addition. `dsbound` rechecks final response length, but it |
| 30 | cannot prove that all upstream response-writer arithmetic was checked. The remaining |
| 31 | producer/effect inventory is in `qualification/security3-consumer/quantities.json`. |
| 32 | |
| 33 | ## Qualification |
| 34 | |
| 35 | The imported runtime fixtures cover widths1..8, u64 wrapping products, negative |
| 36 | input, narrowing, object/version mismatches, unchanged refusal outputs and epoch |
| 37 | exhaustion. Four mixed nominal fixtures must compile-refuse7; crypto wrapping |
| 38 | must execute0. The exact-source add/mul guard mutants must compile and normally |
| 39 | fail their named assertions. `oracle-export.om` emits262140 actual records for |
| 40 | external exact-arithmetic comparison; raw corpus evidence lives in Omega #771. |
| 41 | These are finite/native tests, not a language-wide or translation theorem. |
| 42 | |
| 43 | `sh om/quantity/test/run.sh` is registered by the existing `tools/test.sh` glob. |
| 44 | It only bootstraps the pinned compiler and executes the existing security3 `.om` |
| 45 | coordinator. All selection, source composition, mutation, exit/output checks and |
| 46 | verdicts are in `qualification/security3/run.om --consumer-units`, not shell. |
| 47 | That mode also exercises actual transport/no-op and secret-comparison fixtures; |
| 48 | see `qualification/security3/README.md` for exact commands and retained results. |
| 49 | |
| 50 | ## Third-party material and notices |
| 51 | |
| 52 | No third-party algorithm or vector text is copied into this unit. Omega source is |
| 53 | Apache-2.0, the same license as omnet. Imported deterministic fixtures are synthetic. |
| 54 | The independent arbitrary-precision arithmetic oracle is a development tool, not |
| 55 | shipped production/test-runner logic. |