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 / spec / one-layer-receipts.md

267 lines · 18060 bytes Raw Blame History Source

One-layer receipts v1: signed Omega realization receipts (normative)

Stage 3 of the one-layer plan (omega#446). Code: src/checker2/ (receipts c2_receipt.{h,c}, IR decoder c2_ir.{h,c}, acceptance rules c2_check.c, LRAT checker c2_lrat.{h,c}, bit-blaster c2_blast.{h,c}, command line checker2_main.c). Tests: make test-checker2 (section 12). Pairs with aienos#383 (OSC unit admission), which must verify exactly these bytes.

1. What a receipt says, and what it does not

A receipt records that checker2 (the independent checker in src/checker2/) judged one exact set of bytes and accepted them, and that a key of a stated signer class vouches for that record. The signature establishes provenance only. It never establishes correctness, and a receipt grants no capability: aienos grants stay separate, revocable authority.

A receipt is minted only by checker2 receipt issue, which runs checker2 on the program bytes itself and refuses to sign when checker2 rejects. Nothing else in Omega writes receipts.

2. Byte layout (416 bytes, little-endian, no padding, no text, no timestamps)

offsetsizefield
08magic O M R C P T 1 \0
82format version, = 1
102signer class: 1 TEST, 2 OWNER (same numbers as aienos OSC_SIGNER_TEST/OSC_SIGNER_OWNER)
122signature algorithm, = 1 (pure Ed25519, RFC 8032 section 5.1)
142evidence class (section 4)
1632requirements: SHA-256 of the requirements object bytes (all zero: none supplied)
4832program: SHA-256 of the canonical program bytes (OSC IR; equals oscc ir_sha256)
8032executable: SHA-256 of the realized executable bytes (equals oscc code_sha256)
11232dependencies: SHA-256("OMEGA-RECEIPT-DEPS-V1\0" ‖ u32 count ‖ receipt ids, strictly ascending)
14432checker: identity of the checker2 build (section 5)
17632producer checker: SHA-256 of the oscc binary that produced the bytes
20832target: SHA-256("OMEGA-TARGET-V1\0" ‖ target name), e.g. aarch64-linux-host
24032firmware: SHA-256 of the firmware image; all zero = none (host)
27232input: SHA-256 of the input or dataset identity; all zero = none
3048policy epoch the receipt was issued under
3128expiry epoch: last epoch at which it is fresh; must be >= policy epoch
32032key fingerprint: SHA-256 of the signer's 32-byte Ed25519 public key
35264Ed25519 signature

"\0" is one zero byte, included in the hash. Receipt id = SHA-256 of all 416 bytes. Ed25519 signatures are deterministic, so the same inputs and key always give the same receipt and id.

3. Signature

Signed message (65 bytes) = "OMEGA-REALIZATION-RECEIPT-SIG-V1\0" ‖ SHA-256("OMEGA-REALIZATION-RECEIPT-V1\0" ‖ bytes [0, 352)).

The verifier takes the public key from its own anchor set for the receipt's class, matched by fingerprint, never from the receipt (same rule as aienos osc_unit_admit step 13).

Keys

4. Evidence class

valuenamemeaning
1IR_CHECKEDchecker2 decoded the canonical program bytes and accepted them. The executable is bound by hash only; it is not translation-validated against the program.
2IR_CHECKED_LRATas 1, plus a declared property proved by an LRAT certificate that checker2's own LRAT checker accepted

Any other value is refused.

5. Checker identity

checker = SHA-256(C2_CHECKER_VERSION including its terminating NUL ‖ the 64 lowercase hex characters of SHA-256 over the concatenation of the checker2 sources in the fixed order of C2_ID_SRCS in mk/checker2.mk). The sources include the IR decoder, the acceptance rules, the LRAT checker, the bit-blaster, the receipt code and the command line; the untrusted solver (src/checker2/untrusted/) is deliberately outside. checker2 version prints the version, sources_sha256 and checker_id. A changed checker gives a new identity. The verifier holds a list of accepted checker identities in its policy (C2ReceiptPolicy.checkers); the list is required and an empty list refuses every receipt. checker2 receipt verify accepts its own identity plus any given with --accept-checker.

6. Verification order and named reasons

The verifier stops at the first failure and returns its reason. Codes are stable.

  1. Structure: SIZE (1, not exactly 416 bytes), MAGIC (2), VERSION (3), SIGNATURE_ALGORITHM (4), SIGNER_CLASS (5), EVIDENCE_CLASS (6), EPOCH_ORDER (7). Code 8 is unassigned.
  2. Class policy: in production mode any class other than OWNER is TEST_SIGNER_IN_PRODUCTION (9). The key must be in the anchor set of the receipt's class, else UNTRUSTED_SIGNER (10); in production the only owner anchor honoured is the compiled-in owner root; a key anchored in both classes is refused (UNTRUSTED_SIGNER).
  3. Signature: BAD_SIGNATURE (11).
  4. Revocation: receipt id, then signer key fingerprint, in the verifier's revocation lists: REVOKED (12).
  5. Freshness (epochs, no clock): policy epoch below the verifier's floor is a replay of a superseded receipt, STALE_EPOCH (13); current epoch above expiry EXPIRED (14); current epoch below the policy epoch NOT_YET_VALID (15). The window is inclusive at both ends.
  6. Checker identity: the receipt's checker must be in the verifier's list of accepted checker identities (section 5), else UNTRUSTED_CHECKER (22). The list is part of the policy and is checked with or without expectations.
  7. Binding to what is being admitted: WRONG_TARGET (16), WRONG_FIRMWARE (17), PROGRAM_MISMATCH (18), EXECUTABLE_MISMATCH (19), WRONG_PRODUCER (23, producer checker identity), DEPENDENCIES_MISMATCH (24, dependency digest). The dependency digest binds the dependency receipt ids only: v1 does not fetch, resolve or verify the dependency receipts themselves (section 11).

ARGUMENT (20) and KEY_CLASS (21, signing refused) are tool and signing errors.

The revocation lists, the epoch floor and the current epoch come from the admitting side's policy (for aienos: its own authority), never from the receipt.

7. Storage: content-addressed, never rewritten

checker2 receipt issue --out-dir D writes D/<id hex>.rcpt with exclusive create. If the file already exists with identical bytes the write is a no-op; any other existing content is an error, never an overwrite.

8. Command line

checker2 check <unit.ir>
checker2 version
checker2 receipt issue <unit.ir> <exe> --target T --epoch E --expiry X
                       (--out-dir D | --owner-draft PATH)
                       [--firmware F] [--requirements R | --lrat FUNC=PROOF ...]
                       [--input I] [--producer P] [--dep ID ...]
checker2 receipt tbs <receipt> <out65>
checker2 receipt attach <receipt> <sig64> --out-dir D
checker2 receipt verify <receipt> <unit.ir> <exe> --target T --epoch E
                       [--allow-test-key | --production] [--floor N] [--firmware F]
                       [--revoked-id ID ...] [--revoked-key FP ...] [--lrat FUNC=PROOF ...]
                       [--producer P] [--dep ID ...] [--accept-checker ID ...]
checker2 prove-cnf <unit.ir> <func> <out.cnf>
checker2 prove-check <unit.ir> <func> <proof.lrat>

Exit 0 accept or done, 1 reject or refused, 2 usage or I/O error. issue refuses to sign bytes checker2 rejects. verify applies the production policy by default (fail closed): a TEST-class receipt is refused as TEST_SIGNER_IN_PRODUCTION unless --allow-test-key is given, which only qualification and test runs may do; --production states the default, and giving both is a usage error. --dep ids must be strictly ascending (their digest is order-sensitive). verify always compares the producer and dependency digests: no --producer means an all-zero producer and no --dep means an empty dependency list, exactly what issue writes without them.

Owner signing, without Omega ever holding the private key: issue --owner-draft PATH writes an OWNER-class receipt with the owner root fingerprint and an all-zero signature; tbs writes the 65-byte message of section 3; Drake signs it on the YubiKey (PIV slot 9c); attach verifies the signature against the compiled-in owner root and stores the signed receipt by id (section 7).

9. What checker2 accepts, and what it was written from

checker2 decodes the canonical OSC IR bytes itself and applies its own acceptance rules. It links no file of src/compiler/ and shares no parser, evaluator or instruction table with the producer (oscc). Its sources were written from these inputs only; no existing checker implementation (src/compiler/osc_check.* or any other) was read:

Every rejection names a stable rule (C2-*, listed in c2_check.c). Acceptance requires, per function: valid types and operands; well-formed control flow; every use defined on every path; ownership, arena, pool and handle discipline (a may-set analysis: use-after-release, double release and double close are rejected when they hold on every path; a heap owner or pool still live at a return, or overwritten while live, is rejected when that holds on some path (omega#465), with drop-flag branches followed by the flag's value so a conditional release is not a false leak; arena objects keep the every-path rule because ADESTROY reclaims them); mutable-borrow exclusivity (C2-BORROW-MUT-ALIAS, omega#465: a register is not used while a mutable borrow taken from it, directly or through a copy, is still live, on some path; a shared borrow used while a mutable borrow of the same object is live, and a mutable borrow whose owner was moved to another register, are outside this rule); every loop reducible and bounded by a guarded counter with a constant limit of at most 10^6.

10. Evidence class 2: LRAT proofs

Property no-trap-except-requires of a function F: for every argument value, a run of F that passes its requires clauses ends without any trap (overflow, division, shift, cast, loop bound, ensures, or an explicit trap). checker2 builds the CNF of "some argument reaches a trap" itself, from the IR bytes (c2_blast.h: scalar functions only; calls, memory, division and signed right shift are refused, never approximated). The solver (src/checker2/untrusted/c2sat.om, pure seeded OM-2) is untrusted and outside the checker identity. An UNSAT answer counts only when checker2's own LRAT checker (c2_lrat.h: RUP steps only, RAT hints refused, the empty clause required, clause ids at most input clauses plus proof lines so a huge id cannot size its tables) accepts the proof against the CNF checker2 rebuilt.

With --lrat FUNC=PROOF (functions strictly ascending), issue checks every proof and sets evidence class 2 with requirements = SHA-256 of the requirements object:

OMEGA-REQUIREMENTS-V1\n
no-trap-except-requires <FUNC> proof_sha256=<64 hex>\n      (one line per proof)

verify replays: a class 2 receipt is valid only when the same proofs are given, each checks against the IR bytes, and the rebuilt object hashes to requirements. Reasons: LRAT-PROOFS-REQUIRED, LRAT-REPLAY-FAILED, LRAT-REQUIREMENTS-MISMATCH, and LRAT-NOT-CLAIMED (proofs offered for a class 1 receipt). Proofs are deterministic: the solver writes byte-identical proofs on every run.

11. Not covered (open)

12. Tests

make test-checker2 (CI job checker2 in .github/workflows/host-suites.yml):