Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/patches/c71703d74a452a4f # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/aienux#388 (code only) closed derived `c71703d74a452a4f` #388 Imported from GitHub aien-dev/aienux#388 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `edd175183f30a31f4c7683e194dd6479dc8c7a6e` · Head `369722ca7f3e83ee58cf663bbfb10a99b9e037b7` ### Apply it ``` git checkout -b patch-c71703d74a452a4f edd175183f30a31f4c7683e194dd6479dc8c7a6e curl -fsSL https://interplane.io/drakestapleton/aienux/patches/c71703d74a452a4f.patch | git am ``` Raw patch (mbox) · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/aienux 388 369722ca7f3e83ee58cf663bbfb10a99b9e037b7 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aienux","number":388,"url":"https://github.com/aien-dev/aienux/pull/388","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:19Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index 37bb9013..e8f16107 100644 --- a/.crumb +++ b/.crumb @@ -27,33 +27,33 @@ "purpose": "Directory crates. Purpose not yet described by a human." }, { - "digest": "5fbbd547beb41060da78fc2045d188aa5148d64c48be02e667327947d81f6598", - "last_commit": "29a30a6", + "digest": "0d4a06c460e8b7becbe13d23cd86340ccdb9593233163ffa48232c2e01ba629d", + "last_commit": "9298343", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, { - "digest": "0d98faef5fa42de4cff8de8e8339e550c62f98cb610e81800f835d3b26a65f01", - "last_commit": "29a30a6", + "digest": "6e6359b3955e6c85b5e82111cd3081fa05aa372c71cc6967283a4abae670d274", + "last_commit": "9298343", "name": "native", "purpose": "Directory native. Purpose not yet described by a human." }, { - "digest": "45d955c9b529e601b184a680d586daffbe5efe31f98d9524bf58ace7ef3e1e22", - "last_commit": "29a30a6", + "digest": "d9f03dd4e35c62e4e5f93a7003a6595dbafad559a00ff9583ddd87f5803548e0", + "last_commit": "9298343", "name": "scripts", "purpose": "Directory scripts. Purpose not yet described by a human." } ], - "children_root": "sha256:59dff4882689e2833fac819fc49efdbf9099e6d762d374fef660e72875293675", - "compiled_at": "2026-10-14T21:43:37Z", + "children_root": "sha256:d0685804f74f687350491674e115672115a7937dcfccb5413cb13ca9269b5023", + "compiled_at": "2026-10-15T03:02:04Z", "compiler": "crumb-compile/1", - "digest": "sha256:8807d6073b03be165567b08420db1f1e23341ae597e9f85c55a798b66d0a527c", + "digest": "sha256:59f0bd67ad42a8ebb0cd2ebcee617bd27ced0a6d1c21598d7685e7bf490ff1cd", "evidence_files": 183, "evidence_root": "sha256:9ac286aca0d673f856463c2a1541854df773bfe792792e6b82b7cb7a47cd17cc", - "files": 3450, - "generated_at_commit": "45d244fd724e84f32461758c513072e0c16532a0", - "source_tree": "sha256:6a03eefd34e0b886f7e0aef371cc6233b896c1d86ddd20ec23a69edd7ab1afb9" + "files": 3452, + "generated_at_commit": "9298343feba939b6beacd049dc84c45d7ed1c28c", + "source_tree": "sha256:2e3e4e78f27f8b2f3b43467131fa3e40900adcc8852804cc56d9a7b0bd46f026" }, "owner_lane": "", "provenance": { diff --git a/docs/.crumb b/docs/.crumb index 02284771..27721fde 100644 --- a/docs/.crumb +++ b/docs/.crumb @@ -30,14 +30,14 @@ } ], "children_root": "sha256:491e93c09b6185b662afda8b29d24bb3ee81bc2aed9009757fdf4674d197be31", - "compiled_at": "2026-10-14T19:55:50Z", + "compiled_at": "2026-10-15T03:02:04Z", "compiler": "crumb-compile/1", - "digest": "sha256:5fbbd547beb41060da78fc2045d188aa5148d64c48be02e667327947d81f6598", + "digest": "sha256:0d4a06c460e8b7becbe13d23cd86340ccdb9593233163ffa48232c2e01ba629d", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 216, - "generated_at_commit": "29a30a6c135f5840b90a64031ed8f532c84ed80a", - "source_tree": "sha256:3b2f17a654c91e183e39872eb76a20bd42f9e0678cae522f1644c825cb31605a" + "generated_at_commit": "9298343feba939b6beacd049dc84c45d7ed1c28c", + "source_tree": "sha256:d43e759a59d0f64ce3902099e91110d07e0d31aeecbe72e9a6e307547e7a6fdd" }, "owner_lane": "", "provenance": { diff --git a/docs/OWNER_KEY_CEREMONY.md b/docs/OWNER_KEY_CEREMONY.md index 92e5fd8c..cb545a99 100644 --- a/docs/OWNER_KEY_CEREMONY.md +++ b/docs/OWNER_KEY_CEREMONY.md @@ -444,3 +444,38 @@ Signed: ______________________ Date: ____________ Keep the signed checklist with the passphrase sheet's location noted on it, not the passphrase itself. A photo of the checklist (no passphrase in view) may be committed next to the public folder as the owner's signed record. + +## 7. Realization receipts: the owner root may sign them (aienos#387) + +Recorded 2026-10-14 for aienos#387. The owner key that exists is the one made on 2026-10-14 by the YubiKey +ceremony (`docs/native/PI5-8-OWNER-CEREMONY.md`, aienos#380), not by the MacBook procedure above: YubiKey serial +39017074, PIV slot 9c, `owner_root_ed25519 +578ada3cb0c2d154623ac089191023c8ad4bc5e63b8ccd1a38db2d679b8c9e76`. + +**Entry: this owner root may sign Omega realization receipts** (omega `spec/one-layer-receipts.md`, receipt v1, +signer class OWNER). This is the entry `native/kernel/artifact/osc_receipt_anchor.h` and +`native/kernel/core/osc_admit.c` wait for: from aienos#387 the kernel's receipt policy, in the release and the +qualification build, has this key as its one OWNER receipt anchor. + +- **Basis.** The owner signed the first realization receipt with this key himself (PIN and touch, 2026-10-15 + 00:02:50 UTC; omega#455, `tests/checker2/fixtures/owner-receipt/a01.owner.rcpt`). Omega's spec makes the owner + root the only owner anchor honoured in production mode (section 6, step 2). +- **What such a signature says.** One checker2 identity accepted one exact program (the OSC IR), one executable is + bound to it by hash, for one target and one epoch window. It grants no capability and admits no unit: a unit + still needs its own container signature, and a release build has no OWNER unit anchor until TRUST-1, so a release + build still launches nothing. +- **The exact bytes signed** (65): `"OMEGA-REALIZATION-RECEIPT-SIG-V1\0"` followed by + SHA-256(`"OMEGA-REALIZATION-RECEIPT-V1\0"` and receipt bytes 0 to 351). The same key also signs owner + statements (they begin `AIENOS-OWNER-STATEMENT-V1`) and slot manifests (signed over their first 448 bytes, + which begin `AIENSLT1`). The three messages differ in length and in their first bytes, and Ed25519 signs the exact bytes, so a signature made + for one can never pass as another. +- **Signing.** `yubico-piv-tool -a verify-pin --sign -s 9c -A ED25519` over the 65-byte message, the same call as + `scripts/pi5-8/owner_ceremony.sh`. The tool asks for the PIN itself; nothing stores it. +- **Withdrawing.** Revocation in the kernel is compile-time (`rcpt_revoked_ids`, `rcpt_revoked_keys` in + `core/osc_admit.c`): withdrawing one receipt, or this permission, means building a new image with the receipt id + or the key fingerprint revoked, or with the anchor removed. There is no live revocation feed yet + (`docs/osc-receipts.md`, UNVERIFIED). +- **Checks.** `native/kernel/tests/test_osc_receipt.c` (`owner_receipt`): the committed owner receipt is VALID under + the release policy; every single-bit flip, another unit, another target, the epoch window edges, an unlisted + checker, a revoked receipt id and a revoked owner key are refused; TEST receipts stay refused. QEMU gate + `scripts/qemu_ck_osc_receipt_test.sh`: the owner receipt runs a01 in release mode (qualification image). diff --git a/docs/native/PI5-8-OWNER-CEREMONY.md b/docs/native/PI5-8-OWNER-CEREMONY.md index 82ef5f3d..0a0dfec8 100644 --- a/docs/native/PI5-8-OWNER-CEREMONY.md +++ b/docs/native/PI5-8-OWNER-CEREMONY.md @@ -27,6 +27,9 @@ private half never leaves the device. It does two jobs: 2. Its public half is the owner public key built into images: `make -C native/kernel full CK_HARDWARE_STAGING=1 CK_OWNER_PUBKEYS= CK_MACHINE_ID=` (see `native/kernel/README.md`, "Owner provisioning"). +Added after the ceremony (aienos#387): it also signs Omega realization receipts, and the kernel's receipt policy +trusts it for them. The entry and its limits are in `docs/OWNER_KEY_CEREMONY.md` section 7. + It is NOT the public-release signing key. That key is generated only at the first public release and is not touched here. ## Tools (installed on the Spark, verified) diff --git a/docs/osc-receipts.md b/docs/osc-receipts.md index 14e17900..f7c0881f 100644 --- a/docs/osc-receipts.md +++ b/docs/osc-receipts.md @@ -51,11 +51,13 @@ section 6; the first failure decides. Executable = the unit's code hash. Firmware: none (all zero). Dependencies: the empty list. Producer: none (all zero). - Checker identity: one pinned identity, checker2 at omega 265ce82a (`artifact/osc_receipt_anchor.h`). - Epoch floor 10, current epoch 20 (compile-time constants: there is no epoch authority yet). -- Qualification build (`CK_SEED0B_TEST_ANCHOR=1`): checker2's TEST key is the only receipt anchor +- Owner receipt anchor (both builds, aienos#387): the owner root `578ada3c…` (`artifact/osc_receipt_anchor.h`), the + one OWNER anchor. `docs/OWNER_KEY_CEREMONY.md` section 7 records that it may sign realization receipts. +- Qualification build (`CK_SEED0B_TEST_ANCHOR=1`): in addition, checker2's TEST key is the TEST receipt anchor (`artifact/osc_receipt_test_anchor.h`, separate from the unit TEST key) and one fixture receipt id is revoked. -- Release build: release mode, no receipt anchor at all, so every receipt is refused. The owner root - `578ada3c…` is listed in `osc_receipt_anchor.h` but is not trusted for receipts: it is in no anchor set - until `docs/OWNER_KEY_CEREMONY.md` says it may sign receipts. +- Release build: release mode and no TEST receipt anchor, so every TEST receipt is refused and an owner-signed + receipt can be valid. A release build still launches nothing: unit admission has no OWNER unit anchor until + TRUST-1, so no unit is admitted. ## Ambiguities in the spec, written down (no guess taken) @@ -76,8 +78,8 @@ section 6; the first failure decides. ## UNVERIFIED (not done, not claimed) - **Physical Spark: NOT_RUN.** Only QEMU. No hardware, no GPU, no reboot. -- **OWNER receipts:** none exist; the owner root is not trusted for receipts; a positive OWNER acceptance is - untested (refusals only). +- **OWNER receipts:** one exists (`tests/fixtures/osc_receipt_owner/a01.owner.rcpt`, signed on the owner YubiKey, + omega#455). It is accepted on the host and in QEMU only; no OWNER-signed unit exists, so no release image has run it. - **Translation validation:** the executable is bound to the program by hash only (evidence class 1 says so). Nothing shows the code implements the IR. - **LRAT proofs** are not replayed in the kernel; class 2 is refused instead. @@ -98,9 +100,14 @@ section 6; the first failure decides. every case of `tests/fixtures/osc_receipt/expected.txt` (checker2's own verdict recorded beside the kernel's), trust inputs against the fixtures, each structure reason and the order of the checks, epoch window edges, all 3328 single-bit flips of a valid receipt refused, in-memory receipts re-signed with the published TEST - seed (reproducing checker2's signature byte for byte), the Store receipt table. + seed (reproducing checker2's signature byte for byte), the owner-signed receipt (VALID under the release + policy; every single-bit flip and the binding, epoch, checker and revocation controls refused; aienos#387), the + Store receipt table. - Mutants: `make osc-receipt-mutants` removes each of the 25 guards in `osc_receipt.c` one at a time; the test must fail for every one. -- QEMU: `scripts/qemu_ck_osc_receipt_test.sh`, 17 launches of one unit: the valid receipt runs it (first and - last launch); every other launch is refused with its own named reason and maps nothing. -- Fixtures: `tests/fixtures/osc_receipt/make-receipts.sh` (provenance in `PROVENANCE.txt`). +- QEMU: `scripts/qemu_ck_osc_receipt_test.sh`, 18 launches of one unit: the valid receipt runs it (first and + last launch), the owner receipt runs it in release mode (the qualification policy with release set, as for + the TEST-receipt release launch; the true release policy is covered by the host release build); every other + launch is refused with its own named reason and maps nothing. +- Fixtures: `tests/fixtures/osc_receipt/make-receipts.sh` (provenance in `PROVENANCE.txt`); the owner receipt is + copied from omega (`tests/fixtures/osc_receipt_owner/PROVENANCE.txt`). diff --git a/native/.crumb b/native/.crumb index eacc1a7a..58237179 100644 --- a/native/.crumb +++ b/native/.crumb @@ -79,8 +79,8 @@ "purpose": "Directory native/disk. Purpose not yet described by a human." }, { - "digest": "7a268645098ae3e09b56d39274d2ac6f720eceb00164b1ad9e642aeec116f07e", - "last_commit": "29a30a6", + "digest": "5daad5c0596cea788d78e40989ef1b41460f668ea967986b7d5d3706a83b27e9", + "last_commit": "9298343", "name": "kernel", "purpose": "Directory native/kernel. Purpose not yet described by a human." }, @@ -104,20 +104,20 @@ }, { "digest": "f75197d76b7daaeee8223cf25353251824cd4497400a439724a3a424e014a229", - "last_commit": "7db773a", + "last_commit": "e5e8f08", "name": "store", "purpose": "Directory native/store. Purpose not yet described by a human." } ], - "children_root": "sha256:1c4a5de9ee4c194ac445c6bada2ef26f53a7857bcce00f6c5878a61ea6b25fcf", - "compiled_at": "2026-10-14T21:43:37Z", + "children_root": "sha256:635d6c7d585b627ea69bdc6d531c847cc95ff8d3e5eb66f3c664a21680eeea3c", + "compiled_at": "2026-10-15T03:02:04Z", "compiler": "crumb-compile/1", - "digest": "sha256:0d98faef5fa42de4cff8de8e8339e550c62f98cb610e81800f835d3b26a65f01", + "digest": "sha256:6e6359b3955e6c85b5e82111cd3081fa05aa372c71cc6967283a4abae670d274", "evidence_files": 4, "evidence_root": "sha256:e410b845507e00568e15b51a5797af32a97e0e4b8ab4e8487bb7c98e7e0cf335", - "files": 587, - "generated_at_commit": "45d244fd724e84f32461758c513072e0c16532a0", - "source_tree": "sha256:c72ef0f69a2cf87489567a24666305d481363a9eb24ca61a4d05abf25279c246" + "files": 589, + "generated_at_commit": "9298343feba939b6beacd049dc84c45d7ed1c28c", + "source_tree": "sha256:a6c8586bdf106c04e5348691d53b7c7f9e16ed07fce8fe5bab190bcf75fdc7aa" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/.crumb b/native/kernel/.crumb index 6c21820c..51669123 100644 --- a/native/kernel/.crumb +++ b/native/kernel/.crumb @@ -51,14 +51,14 @@ "purpose": "Directory native/kernel/arch. Purpose not yet described by a human." }, { - "digest": "243ae0c0be907222d5ae7105f655ee87020e18f47023ee53ca71d914e0ff4676", - "last_commit": "29a30a6", + "digest": "cd3be26829bc7f947521b1e5df144df2504ef25a3763ec0356861b7d17d5d901", + "last_commit": "9f98e9e", "name": "artifact", "purpose": "Directory native/kernel/artifact. Purpose not yet described by a human." }, { - "digest": "b9bbf4b8af5e31c209a7e31e2ceaab640969dd762058218763857c73aef02d38", - "last_commit": "29a30a6", + "digest": "c9035b8f32a9539fe8d1f93ed968b3b56dd3ba4c2630b32b6c286b1dbd19d908", + "last_commit": "9f98e9e", "name": "core", "purpose": "Directory native/kernel/core. Purpose not yet described by a human." }, @@ -87,8 +87,8 @@ "purpose": "Directory native/kernel/svc. Purpose not yet described by a human." }, { - "digest": "b9bfdf2069bf98725e1dc3b8088c19f4cb7a5ff6acbb2a7a2bb7beb23b787dee", - "last_commit": "29a30a6", + "digest": "39082c496ae95192fcfc9d8c4b3dc99fbff16df0f868e7ffd0a9af98e30a7fca", + "last_commit": "9f98e9e", "name": "tests", "purpose": "Directory native/kernel/tests. Purpose not yet described by a human." }, @@ -99,15 +99,15 @@ "purpose": "Hosted (Linux-built) checkers for the native kernel, run by `make -C native/kernel test`; nothin" } ], - "children_root": "sha256:fb0d678391e882db3960b067263af48e2f6027f23dc92a684e7d9c4b98a30ed8", - "compiled_at": "2026-10-14T19:58:14Z", + "children_root": "sha256:27fd9a9eadf996dc3ae1e9d14f6d11c52d14073aa8ec336e6461bdcc26c2a14b", + "compiled_at": "2026-10-15T03:02:04Z", "compiler": "crumb-compile/1", - "digest": "sha256:7a268645098ae3e09b56d39274d2ac6f720eceb00164b1ad9e642aeec116f07e", + "digest": "sha256:5daad5c0596cea788d78e40989ef1b41460f668ea967986b7d5d3706a83b27e9", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 406, - "generated_at_commit": "7963940dc7ffb44a00bb162d46d1c861090b2fa7", - "source_tree": "sha256:bd0e4d383cb083e7f623c376d2d4652e96ea8e4430d4c34869e99b6770d3f6c3" + "files": 408, + "generated_at_commit": "9298343feba939b6beacd049dc84c45d7ed1c28c", + "source_tree": "sha256:0fc2b8678abe57e560856b0b61a07fd29d4c17e2305e0399f49d1eebf86f3f97" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/GATES.md b/native/kernel/GATES.md index b551a442..b7e37370 100644 --- a/native/kernel/GATES.md +++ b/native/kernel/GATES.md @@ -797,13 +797,18 @@ policy, ambiguities and the UNVERIFIED list: `docs/osc-receipts.md`. - Host tests: `tests/test_osc_receipt.c`, part of `make test` and `make sanitize`, built for the qualification and the release policy. Mutants: `make osc-receipt-mutants`, 25 of 25 guards killed. - QEMU gate: one boot of the qualification image built with `CK_SEED0B_TEST_ANCHOR=1 CK_OSC_LAUNCH_TEST=1 - CK_OSC_RECEIPT_TEST=1` (TEST ONLY). The Store holds a01_valid_min.unit and 13 receipts minted by omega - checker2 with its TEST key. 17 launches of a01 add(a, b), one `osc_rcpt_launch:` line each: the valid receipt - RETURNS 3 and, after every refusal, 42; no receipt 64 MISSING; altered 75 BAD_SIGNATURE; replayed 77 + CK_OSC_RECEIPT_TEST=1` (TEST ONLY). The Store holds a01_valid_min.unit, 13 receipts minted by omega + checker2 with its TEST key and one receipt signed with the owner key (`a01.owner.rcpt`, aienos#387). 18 launches + of a01 add(a, b), one `osc_rcpt_launch:` line each: the valid receipt RETURNS 3 and, after every refusal, 42; the + owner receipt in release mode (variant 1: the qualification policy with release set) RETURNS 35; no receipt 64 MISSING; altered 75 BAD_SIGNATURE; replayed 77 STALE_EPOCH; revoked id 76 REVOKED (`revoked=receipt_id`); revoked TEST key 76 REVOKED (`revoked=signer_key`); expired 78; not yet valid 79; wrong target 80; l01's receipt 83 EXECUTABLE_MISMATCH; other program 82 PROGRAM_MISMATCH; 417 bytes 65 SIZE; release policy 73 TEST_SIGNER_IN_PRODUCTION; firmware 81; dependency 88; other checker 86 UNTRUSTED_CHECKER. Every refusal maps nothing (`ticks=0 pages_mapped=0`). +- Owner receipt (aienos#387): the owner root is the one OWNER receipt anchor of both policies + (`docs/OWNER_KEY_CEREMONY.md` section 7). The host test checks the owner receipt VALID under the release policy, all + 3328 single-bit flips and the wrong-unit, wrong-target, epoch, checker and revocation controls refused, and TEST + receipts still refused. - The OSC_LAUNCH, OSH_CORE and OSH_OP children now put each unit's receipt in the Store; their launches pass through the same check. - Evidence class 2 is refused 96 LRAT_PROOFS_REQUIRED (host test only; no class 2 fixture is in the QEMU Store). diff --git a/native/kernel/Makefile b/native/kernel/Makefile index b89d5ffe..81a9df2a 100644 --- a/native/kernel/Makefile +++ b/native/kernel/Makefile @@ -1573,16 +1573,16 @@ $(OUT)/host-san/test_osc_admit: $(KDIR)/tests/test_osc_admit.c $(KDIR)/core/osc_ OSC_RCPT_MUTANTS := 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 OSC_RCPT_TEST_DEF := -DOSC_RCPT_HOST_TEST -I$(KDIR)/include -DOSC_FIXTURE_DIR='"$(abspath $(KDIR)/tests/fixtures)"' OSC_RCPT_TEST_SRCS := $(KDIR)/tests/test_osc_receipt.c $(KDIR)/core/osc_admit.c $(ART_HOST_SRCS) -$(OUT)/host/test_osc_receipt: $(KDIR)/tests/test_osc_receipt.c $(KDIR)/core/osc_admit.c $(ART_HOST_DEPS) $(KDIR)/tests/ck_test.h $(wildcard $(KDIR)/tests/fixtures/osc_receipt/*) +$(OUT)/host/test_osc_receipt: $(KDIR)/tests/test_osc_receipt.c $(KDIR)/core/osc_admit.c $(ART_HOST_DEPS) $(KDIR)/tests/ck_test.h $(wildcard $(KDIR)/tests/fixtures/osc_receipt/*) $(wildcard $(KDIR)/tests/fixtures/osc_receipt_owner/*) @mkdir -p $(dir $@) $(HOSTCC) $(HCFLAGS) $(ART_HOST_INC) $(OSC_RCPT_TEST_DEF) -DCK_SEED0B_TEST_ANCHOR=1 -o $@ $(OSC_RCPT_TEST_SRCS) -$(OUT)/host-san/test_osc_receipt: $(KDIR)/tests/test_osc_receipt.c $(KDIR)/core/osc_admit.c $(ART_HOST_DEPS) $(KDIR)/tests/ck_test.h $(wildcard $(KDIR)/tests/fixtures/osc_receipt/*) +$(OUT)/host-san/test_osc_receipt: $(KDIR)/tests/test_osc_receipt.c $(KDIR)/core/osc_admit.c $(ART_HOST_DEPS) $(KDIR)/tests/ck_test.h $(wildcard $(KDIR)/tests/fixtures/osc_receipt/*) $(wildcard $(KDIR)/tests/fixtures/osc_receipt_owner/*) @mkdir -p $(dir $@) $(HOSTCC) $(HCFLAGS) $(SANFLAGS) $(ART_HOST_INC) $(OSC_RCPT_TEST_DEF) -DCK_SEED0B_TEST_ANCHOR=1 -o $@ $(OSC_RCPT_TEST_SRCS) # the same test against the release policy of core/osc_admit.c (no CK_SEED0B_TEST_ANCHOR): every TEST receipt refused -$(OUT)/host/test_osc_receipt_release: $(KDIR)/tests/test_osc_receipt.c $(KDIR)/core/osc_admit.c $(ART_HOST_DEPS) $(KDIR)/tests/ck_test.h $(wildcard $(KDIR)/tests/fixtures/osc_receipt/*) +$(OUT)/host/test_osc_receipt_release: $(KDIR)/tests/test_osc_receipt.c $(KDIR)/core/osc_admit.c $(ART_HOST_DEPS) $(KDIR)/tests/ck_test.h $(wildcard $(KDIR)/tests/fixtures/osc_receipt/*) $(wildcard $(KDIR)/tests/fixtures/osc_receipt_owner/*) @mkdir -p $(dir $@) $(HOSTCC) $(HCFLAGS) $(ART_HOST_INC) $(OSC_RCPT_TEST_DEF) -o $@ $(OSC_RCPT_TEST_SRCS) diff --git a/native/kernel/artifact/.crumb b/native/kernel/artifact/.crumb index 9d28bf8a..43b52963 100644 --- a/native/kernel/artifact/.crumb +++ b/native/kernel/artifact/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-14T19:55:50Z", + "compiled_at": "2026-10-15T02:48:19Z", "compiler": "crumb-compile/1", - "digest": "sha256:243ae0c0be907222d5ae7105f655ee87020e18f47023ee53ca71d914e0ff4676", + "digest": "sha256:cd3be26829bc7f947521b1e5df144df2504ef25a3763ec0356861b7d17d5d901", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 13, - "generated_at_commit": "29a30a6c135f5840b90a64031ed8f532c84ed80a", - "source_tree": "sha256:2b5860c776f68affc13b988df8ad75963335bb0df6322c20ca0c469927ee55a0" + "generated_at_commit": "edd175183f30a31f4c7683e194dd6479dc8c7a6e", + "source_tree": "sha256:6cd37233b62c978bf5adeb03aeafb474e456a830a8992130b0fba7492840faa8" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/artifact/osc_receipt_anchor.h b/native/kernel/artifact/osc_receipt_anchor.h index 3ab0c0a0..40de9b85 100644 --- a/native/kernel/artifact/osc_receipt_anchor.h +++ b/native/kernel/artifact/osc_receipt_anchor.h @@ -1,11 +1,11 @@ /* osc_receipt_anchor.h -- receipt trust inputs that are not TEST material (aienos#383). * * osc_rcpt_owner_root_pk: Drake's owner root public key from the aienos#380 ceremony - * (docs/OWNER_KEY_CEREMONY.md; the private key lives on a YubiKey, PIV slot 9c). It is LISTED here so that a - * release-mode verifier can honour no other owner anchor (omega spec/one-layer-receipts.md section 6 step 2), - * but it is NOT TRUSTED for receipts: no kernel policy puts it in rcpt_owner_anchors until - * docs/OWNER_KEY_CEREMONY.md records that it may sign realization receipts. Nothing in this repository signs - * with it. tests/test_osc_receipt.c checks that the release and qualification policies do not trust it. + * (docs/native/PI5-8-OWNER-CEREMONY.md; the private key lives on a YubiKey, PIV slot 9c). A release-mode verifier + * honours no other owner anchor (omega spec/one-layer-receipts.md section 6 step 2). It is the one OWNER receipt + * anchor of both kernel policies (core/osc_admit.c ck_osc_policy, aienos#387): docs/OWNER_KEY_CEREMONY.md + * section 7 records that it may sign realization receipts. Nothing in this repository signs with it. + * tests/test_osc_receipt.c checks the bytes against the ceremony record and an owner-signed receipt against it. * * osc_rcpt_checker_ids: the accepted checker2 identities (spec section 5). One entry: checker2 of omega * 265ce82a (omega#448), `checker2 version` checker_id. A changed checker2 has a new identity and its receipts are diff --git a/native/kernel/artifact/osc_unit.h b/native/kernel/artifact/osc_unit.h index 447a60ac..f99fbc29 100644 --- a/native/kernel/artifact/osc_unit.h +++ b/native/kernel/artifact/osc_unit.h @@ -99,7 +99,7 @@ struct osc_policy { * osc_unit_admit. Local authority, never taken from a receipt. `release` above also refuses TEST receipts. */ const uint8_t (*rcpt_test_anchors)[32]; /* raw Ed25519 public keys, receipt class TEST */ unsigned n_rcpt_test; - const uint8_t (*rcpt_owner_anchors)[32]; /* receipt class OWNER; empty until the owner key ceremony says so */ + const uint8_t (*rcpt_owner_anchors)[32]; /* receipt class OWNER (the kernel: the owner root, aienos#387) */ unsigned n_rcpt_owner; const uint8_t (*rcpt_checkers)[32]; /* accepted checker2 identities; none: every receipt is refused */ unsigned n_rcpt_checkers; diff --git a/native/kernel/core/.crumb b/native/kernel/core/.crumb index 3750c915..11410454 100644 --- a/native/kernel/core/.crumb +++ b/native/kernel/core/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-14T19:55:50Z", + "compiled_at": "2026-10-15T02:48:19Z", "compiler": "crumb-compile/1", - "digest": "sha256:b9bbf4b8af5e31c209a7e31e2ceaab640969dd762058218763857c73aef02d38", + "digest": "sha256:c9035b8f32a9539fe8d1f93ed968b3b56dd3ba4c2630b32b6c286b1dbd19d908", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 69, - "generated_at_commit": "29a30a6c135f5840b90a64031ed8f532c84ed80a", - "source_tree": "sha256:2be7b723b4c00aa3332bdbae1d60e2a1608804f39eaf72d1511281dc9597d8c1" + "generated_at_commit": "edd175183f30a31f4c7683e194dd6479dc8c7a6e", + "source_tree": "sha256:928d92ef1abd9076c57a25fb07becf22b43f0a46a7edd1998383f3dd6296e083" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/core/osc_admit.c b/native/kernel/core/osc_admit.c index cc777872..ed912892 100644 --- a/native/kernel/core/osc_admit.c +++ b/native/kernel/core/osc_admit.c @@ -52,12 +52,14 @@ static void hex(char *out, const uint8_t *b, size_t n) /* Realization receipt policy (artifact/osc_receipt.h, aienos#383), local to this build: * - both builds: the accepted checker2 identities of osc_receipt_anchor.h, target aienos-ck-aarch64-el0, no * firmware, no dependencies, no producer (all zero: the unit names no producer), epoch floor and current epoch - * fixed below (the kernel has no epoch authority yet, so they are compile-time constants), no OWNER receipt - * anchor (the owner root is listed, not trusted, until docs/OWNER_KEY_CEREMONY.md says so). - * - release build: release mode, so every TEST receipt is TEST_SIGNER_IN_PRODUCTION; no receipt anchor at all, - * so no receipt is valid and nothing can be launched. - * - qualification build (CK_SEED0B_TEST_ANCHOR=1): checker2's TEST key as the only receipt anchor and the - * fixture n_revoked_id.rcpt on the revoked-id list (osc_receipt_test_anchor.h). TEST ONLY. */ + * fixed below (the kernel has no epoch authority yet, so they are compile-time constants), and the owner root + * osc_rcpt_owner_root_pk as the one OWNER receipt anchor (aienos#387: docs/OWNER_KEY_CEREMONY.md section 7 + * records that the owner root may sign realization receipts). + * - release build: release mode, so every TEST receipt is TEST_SIGNER_IN_PRODUCTION; no TEST receipt anchor. An + * owner-signed receipt is valid, but a release build still launches nothing: unit admission has no OWNER unit + * anchor (OWNER anchors are not provisioned until TRUST-1), so no unit is admitted to launch. + * - qualification build (CK_SEED0B_TEST_ANCHOR=1): in addition, checker2's TEST key as the TEST receipt anchor and + * the fixture n_revoked_id.rcpt on the revoked-id list (osc_receipt_test_anchor.h). TEST ONLY. */ #define CK_OSC_RCPT_EPOCH_FLOOR 10u #define CK_OSC_RCPT_EPOCH_NOW 20u static uint8_t rcpt_target[32]; @@ -80,6 +82,9 @@ void ck_osc_policy(struct osc_policy *p) p->rcpt_epoch_floor = CK_OSC_RCPT_EPOCH_FLOOR; p->rcpt_epoch_now = CK_OSC_RCPT_EPOCH_NOW; p->rcpt_target = rcpt_target; + static const uint8_t (*const roa)[32] = &osc_rcpt_owner_root_pk; + p->rcpt_owner_anchors = roa; + p->n_rcpt_owner = 1; #ifdef CK_SEED0B_TEST_ANCHOR static const uint8_t (*const ta)[32] = &osc_unit_test1_pk; static const uint8_t (*const rta)[32] = &osc_rcpt_test_pk; @@ -309,9 +314,11 @@ static void lt_run(const struct lt_step *s) #ifdef CK_OSC_RECEIPT_TEST /* aienos#383 receipt self-test: every launch of a01_valid_min.unit add(a, b), each with one receipt from the Store - * (tests/fixtures/osc_receipt, minted by omega checker2 with its TEST key) or none. Only the valid receipt may run - * the unit; every refusal names its reason and maps nothing. Variant 1 and 2 change the policy for that one launch - * (release mode; the TEST key fingerprint revoked), to show the release rule and key revocation in one boot. */ + * (tests/fixtures/osc_receipt, minted by omega checker2 with its TEST key; a01.owner.rcpt, an OWNER receipt for the + * same unit signed with the owner key, tests/fixtures/osc_receipt_owner, aienos#387) or none. Only a valid + * receipt may run the unit; every refusal names its reason and maps nothing. Variant 1 and 2 change the policy for + * that one launch (release mode; the TEST key fingerprint revoked), to show the release rule, the owner receipt + * under it and key revocation in one boot. */ static void rt_all(void) { static const struct lt_step steps[] = { @@ -331,6 +338,7 @@ static void rt_all(void) { "a01_valid_min.unit", "add", 2, { 14, 15 }, 0, 0, 0, "n_firmware.rcpt", 0 }, { "a01_valid_min.unit", "add", 2, { 15, 16 }, 0, 0, 0, "n_deps.rcpt", 0 }, { "a01_valid_min.unit", "add", 2, { 16, 17 }, 0, 0, 0, "n_checker.rcpt", 0 }, + { "a01_valid_min.unit", "add", 2, { 17, 18 }, 0, 0, 0, "a01.owner.rcpt", 1 }, { "a01_valid_min.unit", "add", 2, { 20, 22 }, 0, 0, 0, "a01.rcpt", 0 }, }; ck_printf("osc_rcpt_selftest: launches=%u unit=a01_valid_min.unit; QEMU (aarch64 virt), TEST signer, not physical\n", @@ -433,11 +441,12 @@ unsigned ck_osc_candidate(const char *name, const uint8_t *b, size_t len) ck_printf("osc_policy: mode=release test_anchors=0 owner_anchors=0 (none provisioned) " "domains=1 gen_width=32; QEMU, not physical\n"); #endif - ck_printf("osc_receipt_policy: mode=%s receipt_test_anchors=%u receipt_owner_anchors=0 (owner root listed, not " - "trusted) checkers=%u target=%s epoch_floor=%u epoch_now=%u revoked_ids=%u revoked_keys=0 " + ck_printf("osc_receipt_policy: mode=%s receipt_test_anchors=%u receipt_owner_anchors=%u (the owner root) " + "checkers=%u target=%s epoch_floor=%u epoch_now=%u revoked_ids=%u revoked_keys=0 " "firmware=none dependencies=none producer=none; launch requires a valid receipt; QEMU, not " "physical\n", - p.release ? "release" : "qualification", p.n_rcpt_test, p.n_rcpt_checkers, OSC_RCPT_TARGET_NAME, + p.release ? "release" : "qualification", p.n_rcpt_test, p.n_rcpt_owner, p.n_rcpt_checkers, + OSC_RCPT_TARGET_NAME, (unsigned)CK_OSC_RCPT_EPOCH_FLOOR, (unsigned)CK_OSC_RCPT_EPOCH_NOW, p.n_rcpt_revoked_ids); } unsigned rc = osc_unit_admit(b, len, &p, &acc); diff --git a/native/kernel/tests/.crumb b/native/kernel/tests/.crumb index 15430e4c..e64419d9 100644 --- a/native/kernel/tests/.crumb +++ b/native/kernel/tests/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-14T19:58:14Z", + "compiled_at": "2026-10-15T02:48:46Z", "compiler": "crumb-compile/1", - "digest": "sha256:b9bfdf2069bf98725e1dc3b8088c19f4cb7a5ff6acbb2a7a2bb7beb23b787dee", + "digest": "sha256:39082c496ae95192fcfc9d8c4b3dc99fbff16df0f868e7ffd0a9af98e30a7fca", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "files": 186, - "generated_at_commit": "7963940dc7ffb44a00bb162d46d1c861090b2fa7", - "source_tree": "sha256:f9549126c3c2edbfd4022e26e37411e38e6aedb93b439d547fa283e4f9ae30af" + "files": 188, + "generated_at_commit": "9f98e9e847607cf775032174abba046fc9db9db7", + "source_tree": "sha256:5dc28030334f2dbd10d06cfa60858f6861dfe6cf5244be157b05de5aa7dd44aa" }, "owner_lane": "", "provenance": { diff --git a/native/kernel/tests/fixtures/osc_receipt_owner/PROVENANCE.txt b/native/kernel/tests/fixtures/osc_receipt_owner/PROVENANCE.txt new file mode 100644 index 00000000..49a50fe6 --- /dev/null +++ b/native/kernel/tests/fixtures/osc_receipt_owner/PROVENANCE.txt @@ -0,0 +1,23 @@ +Owner-signed Omega realization receipt (receipt v1, 416 bytes; omega spec/one-layer-receipts.md) for aienos#387. +PUBLIC data only. Not minted by make-receipts.sh (that script uses checker2's TEST key; this one needs the owner +YubiKey), so it is kept apart from ../osc_receipt and pinned by hash in tests/test_osc_receipt.c. + +File: a01.owner.rcpt +sha256: 1348e78b0f88a5054f2b78b0a8d7c998ba70d166c711a2341528824685776034 (= the receipt id) +Copied from: aien-dev/omega tests/checker2/fixtures/owner-receipt/a01.owner.rcpt at 710d438c (omega#455, merged), + byte for byte (`git show 710d438c:tests/checker2/fixtures/owner-receipt/a01.owner.rcpt`). Omega's + PROVENANCE.txt and a01.owner.check.txt in that folder record how it was made and checked. +Signer: class OWNER. Signed once on the owner YubiKey (serial 39017074, PIV slot 9c) on 2026-10-15T00:02:50Z by + ~/bin/owner-sign-receipt-test.sh. Owner root 578ada3cb0c2d154623ac089191023c8ad4bc5e63b8ccd1a38db2d679b8c9e76 + (aienos#380 ceremony, docs/native/PI5-8-OWNER-CEREMONY.md; artifact/osc_receipt_anchor.h). The + fingerprint at offset 320 is SHA-256 of that key: 5e004d574c1ea0cba4c441665e3b0273de4e75d278d86eaa687ab921a12941c6. +Binds: unit osc_unit/vectors/a01_valid_min.unit (sha256 5711ca0a71062f7df709bde41ed80c8e724f4826b886ecc9b0ceb55f80682da4): + IR sha256 084803c232dc44effcc44704c9ed0600dec1231451e0b76693633e98a48d1a1d, code sha256 + 6163612fd91c0ce8eb8126d4b38534867428704d346795a5e369055eef10fcdb; target aienos-ck-aarch64-el0; + policy epoch 20, expiry epoch 100; checker2 identity d7aae601...cf3ba (omega 265ce82a). +Re-checked: 2026-10-14 for aienos#387, independently of both verifiers: the 65-byte message + "OMEGA-REALIZATION-RECEIPT-SIG-V1\0" || SHA-256("OMEGA-REALIZATION-RECEIPT-V1\0" || bytes [0,352)) built + with printf/head/sha256sum equals omega's committed a01.owner-draft.tbs, and + `openssl pkeyutl -verify -rawin` with ~/aienos-owner-ceremony/20261014T114310Z/slot-9c-public.pem + over that message and bytes [352,416) prints "Signature Verified Successfully". +Changing it: any byte changed breaks the signature; a new receipt needs a new YubiKey signature (PIN and touch). diff --git a/native/kernel/tests/fixtures/osc_receipt_owner/a01.owner.rcpt b/native/kernel/tests/fixtures/osc_receipt_owner/a01.owner.rcpt new file mode 100644 index 00000000..8d06a38a Binary files /dev/null and b/native/kernel/tests/fixtures/osc_receipt_owner/a01.owner.rcpt differ diff --git a/native/kernel/tests/test_osc_receipt.c b/native/kernel/tests/test_osc_receipt.c index 0a0bb258..f3731e9c 100644 --- a/native/kernel/tests/test_osc_receipt.c +++ b/native/kernel/tests/test_osc_receipt.c @@ -2,13 +2,15 @@ * the kernel's own policy (core/osc_admit.c ck_osc_policy, linked in). * * Built twice: with CK_SEED0B_TEST_ANCHOR=1 (the qualification policy: checker2's TEST key anchored) and without - * it (the release policy: no receipt anchor, release mode). Checks: + * it (the release policy: release mode, the owner root as the only receipt anchor). Checks: * - every line of tests/fixtures/osc_receipt/expected.txt: the receipt, minted by omega checker2, verified * against the admitted unit gives the stated kernel verdict (checker2's own verdict for the same policy is * recorded beside it by make-receipts.sh); in the release build every one is refused; * - the trust inputs: the TEST key header against the fixtures, the pinned checker identity, the target hash, - * the revoked fixture id, the owner root listed but never trusted; + * the revoked fixture id, the owner root as the one OWNER receipt anchor (aienos#387), never a TEST anchor; * - each structure reason, the order of the checks, anchor rules, epoch window edges, every single-bit flip; + * - the owner-signed receipt (fixtures/osc_receipt_owner, aienos#387): VALID under the release policy, every + * single-bit flip and each binding, epoch and revocation control refused, TEST receipts still refused; * - the Store receipt table of osc_admit.c (kept by name, oversize, full). * The mutation run (Makefile osc-receipt-mutants) requires this test to FAIL with any one MUT guard removed. */ #include @@ -173,10 +175,13 @@ static void trust_inputs(void) CHECK(rl == OSC_RCPT_BYTES && memcmp(h, osc_rcpt_qual_revoked_id, 32) == 0); struct osc_policy p; ck_osc_policy(&p); - CHECK(p.n_rcpt_owner == 0 && p.rcpt_owner_anchors == NULL); /* owner root listed, not trusted */ + /* aienos#387: the owner root is the one OWNER receipt anchor in both builds, and it is not a TEST anchor */ + CHECK(p.n_rcpt_owner == 1 && p.rcpt_owner_anchors != NULL && + memcmp(p.rcpt_owner_anchors[0], osc_rcpt_owner_root_pk, 32) == 0); CHECK(p.n_rcpt_checkers == 1 && p.rcpt_target != NULL && p.rcpt_producer == NULL && p.rcpt_firmware == NULL); CHECK(p.rcpt_epoch_floor == 10 && p.rcpt_epoch_now == 20 && p.n_rcpt_revoked_keys == 0); for (unsigned i = 0; i < p.n_rcpt_test; i++) CHECK(memcmp(p.rcpt_test_anchors[i], osc_rcpt_owner_root_pk, 32) != 0); + for (unsigned i = 0; i < p.n_rcpt_owner; i++) CHECK(memcmp(p.rcpt_owner_anchors[i], osc_rcpt_test_pk, 32) != 0); #ifdef CK_SEED0B_TEST_ANCHOR CHECK(!p.release && p.n_rcpt_test == 1 && memcmp(p.rcpt_test_anchors[0], osc_rcpt_test_pk, 32) == 0); CHECK(p.n_rcpt_revoked_ids == 1); @@ -253,7 +258,7 @@ static void structure_and_order(void) MUTATE(r[303] ^= 1, OSC_RCPT_BAD_SIGNATURE); /* last byte of the input digest, signed */ MUTATE(r[351] ^= 1, OSC_RCPT_UNTRUSTED_SIGNER); /* last fingerprint byte */ MUTATE(r[320] ^= 1, OSC_RCPT_UNTRUSTED_SIGNER); /* fingerprint names no anchor */ - MUTATE(put16(r + 10, 2), OSC_RCPT_UNTRUSTED_SIGNER); /* OWNER class: no owner anchor in the kernel policy */ + MUTATE(put16(r + 10, 2), OSC_RCPT_UNTRUSTED_SIGNER); /* OWNER class: the TEST fingerprint names no owner anchor */ p.release = 1; MUTATE((void)0, OSC_RCPT_TEST_SIGNER_IN_PRODUCTION); MUTATE(put64(r + 312, 9), OSC_RCPT_EPOCH_ORDER); /* structure before class policy */ @@ -435,6 +440,116 @@ static void resigned(void) CHECK(v(r, 416, &a, &p) == OSC_RCPT_NOT_YET_VALID); } +/* aienos#387: the owner-signed receipt. fixtures/osc_receipt_owner/a01.owner.rcpt is omega + * tests/checker2/fixtures/owner-receipt/a01.owner.rcpt (omega#455, 710d438c) byte for byte, signed on the owner + * YubiKey (provenance in that folder). It is the one receipt here no TEST key made, so it is pinned by hash. */ +static const char owner_rcpt_sha256[] = "1348e78b0f88a5054f2b78b0a8d7c998ba70d166c711a2341528824685776034"; + +/* the release policy: what ck_osc_policy gives in a release build, also when this binary is the qualification + * build (there the TEST anchor and the fixture revocation are dropped and release mode is set) */ +static struct osc_policy rel(void) +{ + struct osc_policy p; + ck_osc_policy(&p); + p.release = 1; + p.rcpt_test_anchors = NULL; + p.n_rcpt_test = 0; + p.rcpt_revoked_ids = NULL; + p.n_rcpt_revoked_ids = 0; + return p; +} + +static void owner_receipt(void) +{ + uint8_t o[1024], t[1024], r[416], h[32], ofp[1][32], oid[1][32], other[32]; + char hs[65]; + size_t n = slurp("osc_receipt_owner/a01.owner.rcpt", o, sizeof o); + CHECK(n == OSC_RCPT_BYTES); + sha256_hash(o, n, h); + hex(h, 32, hs); + CHECK(!strcmp(hs, owner_rcpt_sha256)); /* the committed bytes, nothing else */ + memcpy(oid[0], h, 32); + sha256_hash(osc_rcpt_owner_root_pk, 32, ofp[0]); + CHECK(o[10] == OSC_SIGNER_OWNER && o[11] == 0 && memcmp(o + 320, ofp[0], 32) == 0); /* OWNER, owner root */ + CHECK(rcpt("a01.rcpt", t) == OSC_RCPT_BYTES); + struct osc_accept a, l, x; + CHECK(admit("a01", &a) && admit("l01", &l) && admit("osh_lex", &x)); + struct osc_receipt_info info; + + /* VALID under the kernel's own policy, in release mode, and under the release policy */ + struct osc_policy p; + ck_osc_policy(&p); + CHECK(v(o, 416, &a, &p) == 0); + p.release = 1; + memset(&info, 0, sizeof info); + CHECK(osc_receipt_verify(o, 416, &a, &p, &info) == 0); + p = rel(); + memset(&info, 0, sizeof info); + unsigned got = osc_receipt_verify(o, 416, &a, &p, &info); + if (got) printf(" owner receipt under the release policy: got %u %s\n", got, osc_code_name(got)); + CHECK(got == 0 && info.have_id && memcmp(info.id, oid[0], 32) == 0); + /* the TEST checker2 key stays out of the release policy: a TEST receipt is refused, and a TEST receipt relabelled + * OWNER names no owner anchor */ + CHECK(v(t, 416, &a, &p) == OSC_RCPT_TEST_SIGNER_IN_PRODUCTION); + memcpy(r, t, 416); + put16(r + 10, OSC_SIGNER_OWNER); + CHECK(v(r, 416, &a, &p) == OSC_RCPT_UNTRUSTED_SIGNER); + /* negative control: the release policy as shipped before aienos#387 (no owner anchor) refuses it */ + p.rcpt_owner_anchors = NULL; + p.n_rcpt_owner = 0; + CHECK(v(o, 416, &a, &p) == OSC_RCPT_UNTRUSTED_SIGNER); + /* the owner root anchored in both classes is refused */ + p = rel(); + static const uint8_t (*const ok)[32] = &osc_rcpt_owner_root_pk; + p.rcpt_test_anchors = ok; + p.n_rcpt_test = 1; + CHECK(v(o, 416, &a, &p) == OSC_RCPT_UNTRUSTED_SIGNER); + /* bound to a01 on this target and epoch window: wrong unit, wrong target, epoch edges, unlisted checker */ + p = rel(); + CHECK(v(o, 416, &l, &p) == OSC_RCPT_EXECUTABLE_MISMATCH); /* l01: a01's program, other code */ + CHECK(v(o, 416, &x, &p) == OSC_RCPT_PROGRAM_MISMATCH); /* osh_lex: another program */ + osc_receipt_target_hash("aienos-ck-x86_64-el0", 20, other); + p.rcpt_target = other; + CHECK(v(o, 416, &a, &p) == OSC_RCPT_WRONG_TARGET); + p = rel(); + p.rcpt_epoch_now = 100; /* expiry 100, inclusive */ + CHECK(v(o, 416, &a, &p) == 0); + p.rcpt_epoch_now = 101; + CHECK(v(o, 416, &a, &p) == OSC_RCPT_EXPIRED); + p.rcpt_epoch_now = 19; /* issued at epoch 20 */ + CHECK(v(o, 416, &a, &p) == OSC_RCPT_NOT_YET_VALID); + p = rel(); + p.rcpt_epoch_floor = 21; + CHECK(v(o, 416, &a, &p) == OSC_RCPT_STALE_EPOCH); + p = rel(); + p.n_rcpt_checkers = 0; + CHECK(v(o, 416, &a, &p) == OSC_RCPT_UNTRUSTED_CHECKER); + /* revocation: the receipt id, then the owner key fingerprint */ + p = rel(); + p.rcpt_revoked_ids = (const uint8_t (*)[32])oid; + p.n_rcpt_revoked_ids = 1; + CHECK(osc_receipt_verify(o, 416, &a, &p, &info) == OSC_RCPT_REVOKED && info.revoked == OSC_RCPT_REVOKED_ID); + p = rel(); + p.rcpt_revoked_keys = (const uint8_t (*)[32])ofp; + p.n_rcpt_revoked_keys = 1; + CHECK(osc_receipt_verify(o, 416, &a, &p, &info) == OSC_RCPT_REVOKED && info.revoked == OSC_RCPT_REVOKED_KEY); + /* every single-bit flip of the owner receipt is refused under the release policy */ + p = rel(); + int flips = 0, accepted = 0; + for (unsigned i = 0; i < 416; i++) + for (unsigned bit = 0; bit < 8; bit++) { + memcpy(r, o, 416); + r[i] ^= (uint8_t)(1u << bit); + if (v(r, 416, &a, &p) == 0) accepted++; + flips++; + } + CHECK(flips == 3328 && accepted == 0); + got = v(o, 416, &a, &p); + CHECK(got == 0); /* the input was not written */ + printf(" owner receipt a01.owner.rcpt under the release policy: %s; single-bit flips refused %d of %d\n", + got ? osc_code_name(got) : "VALID", flips - accepted, flips); +} + static void names(void) { CHECK(!strcmp(osc_code_name(OSC_RCPT_MISSING), "RECEIPT_MISSING")); @@ -500,6 +615,7 @@ int main(void) policy_edges(); names(); resigned(); + owner_receipt(); store_table(); return ck_t_verdict("test_osc_receipt"); } diff --git a/scripts/.crumb b/scripts/.crumb index 0fbb0b00..16109e60 100644 --- a/scripts/.crumb +++ b/scripts/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-14T19:55:50Z", + "compiled_at": "2026-10-15T03:02:04Z", "compiler": "crumb-compile/1", - "digest": "sha256:45d955c9b529e601b184a680d586daffbe5efe31f98d9524bf58ace7ef3e1e22", + "digest": "sha256:d9f03dd4e35c62e4e5f93a7003a6595dbafad559a00ff9583ddd87f5803548e0", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 116, - "generated_at_commit": "29a30a6c135f5840b90a64031ed8f532c84ed80a", - "source_tree": "sha256:e062288c9cefc0fc5b093760d22b205b1d9c96d77a985b6690f16ad54bdd0ba4" + "generated_at_commit": "9298343feba939b6beacd049dc84c45d7ed1c28c", + "source_tree": "sha256:fd8c1c963c584c6ffd691f1b77dac14b48f5784d530d04ac3dae0c0d1326307a" }, "owner_lane": "", "provenance": { diff --git a/scripts/qemu_ck_osc_receipt_test.sh b/scripts/qemu_ck_osc_receipt_test.sh index 0c12edb4..19f50954 100755 --- a/scripts/qemu_ck_osc_receipt_test.sh +++ b/scripts/qemu_ck_osc_receipt_test.sh @@ -4,14 +4,16 @@ # (AAVMF). # # Label: QEMU (aarch64 virt), TEST signer, not physical. Nothing here ran on a Spark or any real machine. The -# receipts are minted by omega checker2 with its TEST key (tests/fixtures/osc_receipt/PROVENANCE.txt); the units -# are signed with the container spec's THROWAWAY TEST key. +# receipts are minted by omega checker2 with its TEST key (tests/fixtures/osc_receipt/PROVENANCE.txt), except +# a01.owner.rcpt, signed with the owner key on the owner YubiKey (tests/fixtures/osc_receipt_owner/PROVENANCE.txt, +# aienos#387); the units are signed with the container spec's THROWAWAY TEST key. # -# One unit (a01_valid_min.unit) and thirteen receipts are written into the sealed C Store of a GPT boot disk +# One unit (a01_valid_min.unit) and fourteen receipts are written into the sealed C Store of a GPT boot disk # image. One boot of the qualification image built with CK_SEED0B_TEST_ANCHOR=1 CK_OSC_LAUNCH_TEST=1 -# CK_OSC_RECEIPT_TEST=1 launches a01 add(a, b) seventeen times, each time with one receipt or none, and prints one +# CK_OSC_RECEIPT_TEST=1 launches a01 add(a, b) eighteen times, each time with one receipt or none, and prints one # "osc_rcpt_launch:" line each. This gate checks: -# with the valid receipt the unit RETURNS the exact value (first and last launch); +# with the valid receipt the unit RETURNS the exact value (first and last launch), and with the owner receipt in +# release mode (aienos#387); # no receipt, an altered, stale, revoked, expired, not-yet-valid, wrong-target, wrong-firmware, wrong-program, # wrong-executable, wrong-length, wrong-dependencies or untrusted-checker receipt, the TEST key revoked, and a # TEST receipt under the release policy are each REFUSED with its own named reason, and nothing is mapped; @@ -57,9 +59,11 @@ simg="${out_prod}/host/ck_store_image" fix="native/kernel/tests/fixtures/osc_unit" rfix="native/kernel/tests/fixtures/osc_receipt" +ofix="native/kernel/tests/fixtures/osc_receipt_owner" rcpts=(a01 l01 n_altered n_stale n_revoked_id n_expired n_future n_target n_program n_length n_firmware n_deps n_checker) files=("${fix}/vectors/a01_valid_min.unit") for r in "${rcpts[@]}"; do files+=("${rfix}/${r}.rcpt"); done +files+=("${ofix}/a01.owner.rcpt") disk="${work}/nvme.img" "${out_prod}/host/ck_gpt_image" create "${disk}" 512 64 aienos-middle >/dev/null || fail "GPT boot disk image created" if "${simg}" build "${disk}" 512 "${files[@]}" >"${work}/build.txt" 2>&1; then pass "boot disk built: $(head -1 "${work}/build.txt")" @@ -104,26 +108,27 @@ boot "${out_rcpt}/full/BOOTAA64.EFI" "${serial}" "${work}/disk-run.img" release_flag check "${serial}" "left firmware and entered the kernel" "kernel: alive" -check "${serial}" "kernel read all fourteen candidates (one unit, thirteen receipts) from the boot disk Store" "^artifact_candidates: 14$" +check "${serial}" "kernel read all fifteen candidates (one unit, fourteen receipts) from the boot disk Store" "^artifact_candidates: 15$" if has "${serial}" "^report-truncated:"; then fail "kernel report lines were truncated"; else pass "no kernel report line was truncated"; fi check "${serial}" "final report reached the console" "report_kind: final" if has "${serial}" "report_kind: (panic|fault)"; then fail "panic or fault reported"; else pass "no kernel panic or fault report"; fi check "${serial}" "a01 admitted (the container check is unchanged)" "^osc_unit: a01_valid_min\\.unit ACCEPT " -check "${serial}" "receipt policy line: qualification, TEST receipt anchor, owner root listed but not trusted, launch requires a receipt" \ - "^osc_receipt_policy: mode=qualification receipt_test_anchors=1 receipt_owner_anchors=0 \\(owner root listed, not trusted\\) checkers=1 target=aienos-ck-aarch64-el0 epoch_floor=10 epoch_now=20 revoked_ids=1 revoked_keys=0 firmware=none dependencies=none producer=none; launch requires a valid receipt; QEMU, not physical$" -for r in "${rcpts[@]}"; do - b=$(stat -c %s "${rfix}/${r}.rcpt"); id=- - [[ "${b}" == 416 ]] && id=$(sha256sum "${rfix}/${r}.rcpt" | cut -c1-64) - check "${serial}" "${r}.rcpt stored from the Store (bytes=${b})" "^osc_receipt: ${r}\\.rcpt STORED bytes=${b} id=${id} " +check "${serial}" "receipt policy line: qualification, TEST receipt anchor, the owner root as owner receipt anchor, launch requires a receipt" \ + "^osc_receipt_policy: mode=qualification receipt_test_anchors=1 receipt_owner_anchors=1 \\(the owner root\\) checkers=1 target=aienos-ck-aarch64-el0 epoch_floor=10 epoch_now=20 revoked_ids=1 revoked_keys=0 firmware=none dependencies=none producer=none; launch requires a valid receipt; QEMU, not physical$" +for rf in "${files[@]:1}"; do + r=$(basename "${rf}" .rcpt); b=$(stat -c %s "${rf}"); id=- + [[ "${b}" == 416 ]] && id=$(sha256sum "${rf}" | cut -c1-64) + check "${serial}" "${r}.rcpt stored from the Store (bytes=${b})" "^osc_receipt: ${r//./\\.}\\.rcpt STORED bytes=${b} id=${id} " done -check "${serial}" "receipt totals: 13 seen, 13 stored" "^osc_receipts: seen=13 stored=13 dropped=0 " -check "${serial}" "self-test announces 17 launches" "^osc_rcpt_selftest: launches=17 unit=a01_valid_min\\.unit; " +check "${serial}" "receipt totals: 14 seen, 14 stored" "^osc_receipts: seen=14 stored=14 dropped=0 " +check "${serial}" "self-test announces 18 launches" "^osc_rcpt_selftest: launches=18 unit=a01_valid_min\\.unit; " label='QEMU \(aarch64 virt\), TEST signer, not physical' a=a01_valid_min.unit # rline TEXT ARGS RECEIPT POLICY RESULT REVOKED [run]: one launch line. A refusal ran nothing: no tick, no page. rline() { local file="${rfix}/$3" id='-' t + [[ -e "${ofix}/$3" ]] && file="${ofix}/$3" [[ "$3" != none && $(stat -c %s "${file}") == 416 ]] && id=$(sha256sum "${file}" | cut -c1-16) t="ticks=0 pages_mapped=0 page_tables_zeroed=1 slot_free=1" [[ "${7:-}" == run ]] && t="ticks=[0-9]+ pages_mapped=[1-9][0-9]* page_tables_zeroed=1 slot_free=1" @@ -146,11 +151,12 @@ rline "TEST receipt under the release policy: RECEIPT_TEST_SIGNER_IN_PRODUCTION rline "receipt naming firmware: RECEIPT_WRONG_FIRMWARE (81)" '14,15' n_firmware.rcpt qualification "$(ref 81 WRONG_FIRMWARE)" - rline "receipt with a dependency: RECEIPT_DEPENDENCIES_MISMATCH (88)" '15,16' n_deps.rcpt qualification "$(ref 88 DEPENDENCIES_MISMATCH)" - rline "receipt from an unlisted checker: RECEIPT_UNTRUSTED_CHECKER (86)" '16,17' n_checker.rcpt qualification "$(ref 86 UNTRUSTED_CHECKER)" - +rline "owner receipt (signed on the owner YubiKey) in release mode: the unit runs, add(17,18) RETURNED 35" '17,18' a01.owner.rcpt release 'RETURNED value=35' - run rline "after every refusal, the valid receipt still runs the unit: add(20,22) RETURNED 42" '20,22' a01.rcpt qualification 'RETURNED value=42' - run -check "${serial}" "summary: 2 returned, 15 refused" "^osc_rcpt_launches: returned=2 trapped=0 refused=15 unknown=0; ${label}\$" +check "${serial}" "summary: 3 returned, 15 refused" "^osc_rcpt_launches: returned=3 trapped=0 refused=15 unknown=0; ${label}\$" nl=$(grep -c '^osc_rcpt_launch: ' "${serial}" || true) names=$(grep -oE '^osc_rcpt_launch: .* name=RECEIPT_[A-Z_]+' "${serial}" | sed -E 's/.*name=//' | sort | uniq -d | tr '\n' ' ') -[[ "${nl}" == 17 ]] && pass "exactly 17 receipt launch lines" || fail "receipt launch lines (${nl} of 17)" +[[ "${nl}" == 18 ]] && pass "exactly 18 receipt launch lines" || fail "receipt launch lines (${nl} of 18)" # REVOKED appears twice on purpose (receipt id, signer key), told apart by the revoked= column [[ "${names}" == "RECEIPT_REVOKED " ]] && pass "every other refusal names a reason of its own" || fail "refusal reasons repeated: ${names}" if grep -E '^osc_launch: ' "${serial}" | grep -q .; then fail "a C3-3a launch line appeared in the receipt self-test"; else pass "only the receipt self-test ran"; fi ```