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/omega-mv/patches/7fb4107f0492a8c0 # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/omega-mv#455 (code only) closed derived `7fb4107f0492a8c0` #455 Imported from GitHub aien-dev/omega-mv#455 (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 `62833658f5c291f0d229b45d2c18500145cbab66` · Head `b5033484eb3d540c1fdd35406474b28b56ea47c8` ### Fetch it A git bundle of the pull request's head, 11073 bytes. ``` curl -fsSL https://interplane.io/drakestapleton/omega-mv/patches/7fb4107f0492a8c0.bundle -o 7fb4107f0492a8c0.bundle git fetch 7fb4107f0492a8c0.bundle refs/pull/455/head ``` Raw bundle · 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/omega-mv 455 b5033484eb3d540c1fdd35406474b28b56ea47c8 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"omega-mv","number":455,"url":"https://github.com/aien-dev/omega-mv/pull/455","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:55Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index 194d9315c..935bb0ef4 100644 --- a/.crumb +++ b/.crumb @@ -52,7 +52,7 @@ }, { "digest": "26ad30306af327e06a46a0b30e06fa9726c95a627772ebcf31eb54a824ec5366", - "last_commit": "18531691", + "last_commit": "dd67f6bd", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -63,8 +63,8 @@ "purpose": "Directory doctrine. Purpose not yet described by a human." }, { - "digest": "5f0f4cfb1ef5837569c712847c5f7c8c9c93fe1083a42b582cf2a9cbe27f4d3f", - "last_commit": "18531691", + "digest": "b98001ac8c91759a2eb2125dadf492b7cb2dc1072279baad13a5d7c50470df12", + "last_commit": "abb4d224", "name": "mk", "purpose": "Directory mk. Purpose not yet described by a human." }, @@ -76,44 +76,44 @@ }, { "digest": "eccc4aec1037ae222d6370836953732b031b8ed70de28967b7af7ca62c2abe0b", - "last_commit": "c02b278c", + "last_commit": "5901baa5", "name": "research", "purpose": "Directory research. Purpose not yet described by a human." }, { - "digest": "3d892a08078369eebc9a5e2a7ee2b6a24c278f2dbd91db5e7026decb8d8399f8", - "last_commit": "9e168fc8", + "digest": "119a9f1adb744797c10e946c8e9725ec260587fb303668d71a627527d31a8e84", + "last_commit": "accd294d", "name": "spec", "purpose": "Directory spec. Purpose not yet described by a human." }, { "digest": "d69b7371545db3c5920b5e035b3d1d8b8205664f393fedd7b9fc1bb582f23821", - "last_commit": "d0889a94", + "last_commit": "265ce82a", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { - "digest": "792cfc471ce3778cf2a4f7c90d0cddeae9cbe5494b013045e4f81cc5f4a7daa4", - "last_commit": "d0889a94", + "digest": "8401c311b8d73c13a75937463ca173dba2af1a3e79fda3e126be4e1918f56436", + "last_commit": "accd294d", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, { "digest": "84e7502fdc66e65c9c94ffaa834cc53aec818ee3215716ba98926cf1c70bcca8", - "last_commit": "d0889a94", + "last_commit": "dd67f6bd", "name": "tools", "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:e5feee9f2e633a6186591944f7fb182e76437d5369b36c7dc4602536ab2fa1f5", - "compiled_at": "2026-10-14T21:46:29Z", + "children_root": "sha256:44431b7effe75de4017e5a7fe6e7810607b465f61b217cf1df997d7cf1f9788f", + "compiled_at": "2026-10-15T00:25:19Z", "compiler": "crumb-compile/1", - "digest": "sha256:82c7b5e82537fc6491d0257898fa82d9391c8cdd096f2b2b18d3bedf5b9769de", + "digest": "sha256:d33abb528566e2b7158ab4ef752b8d810ec7e5073bb6d196e584cb17cc9f2bec", "evidence_files": 7963, "evidence_root": "sha256:d198e446f05fd456453e386f3d6cfa4f28afb8ea8adbe0ed352bd9815d3cf3dd", - "files": 10722, - "generated_at_commit": "2a6d6d7b9091bd2184b15dcde893035dbcca40d3", - "source_tree": "sha256:6bad7bb3adfbed940e36cff7b6502bb83a2a5d02563733e2e096fad3512ed7be" + "files": 10731, + "generated_at_commit": "6dd6b739360d4ac2f5f997a96b6f8b110951a0a1", + "source_tree": "sha256:af844ade36bd73d7f365f4b0980b1c9f063baaf0aa0c4728c2417be693b92459" }, "owner_lane": "", "provenance": { diff --git a/mk/.crumb b/mk/.crumb index 7b1643d29..b0f15c987 100644 --- a/mk/.crumb +++ b/mk/.crumb @@ -7,14 +7,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-10-14T18:36:27Z", + "compiled_at": "2026-10-15T00:04:44Z", "compiler": "crumb-compile/1", - "digest": "sha256:5f0f4cfb1ef5837569c712847c5f7c8c9c93fe1083a42b582cf2a9cbe27f4d3f", + "digest": "sha256:b98001ac8c91759a2eb2125dadf492b7cb2dc1072279baad13a5d7c50470df12", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 70, - "generated_at_commit": "4fa52370f177d268e4248955dc7adec53519e215", - "source_tree": "sha256:1eb1827be8d0df76b1b76db2a0a6ea03b519f4fe9817f2c4e796feb213dd4761" + "generated_at_commit": "accd294d335a05aceda8428bef1f808bb4a24dd4", + "source_tree": "sha256:c7b5c521643f1d61e749a4a478093741aaf8b8fe7cc79739c8a383d34336dd24" }, "owner_lane": "", "provenance": { diff --git a/mk/checker2.mk b/mk/checker2.mk index e9464a6d2..470f9d013 100644 --- a/mk/checker2.mk +++ b/mk/checker2.mk @@ -10,7 +10,7 @@ # make test-checker2-mutants negative controls only: each GUARD line removed must fail a test ifndef CHECKER2_MK CHECKER2_MK := 1 -.PHONY: checker2 test-checker2 test-checker2-lrat test-checker2-unit test-checker2-mutants test-checker2-differential test-checker2-blast-native +.PHONY: checker2 test-checker2 test-checker2-owner-receipt test-checker2-lrat test-checker2-unit test-checker2-mutants test-checker2-differential test-checker2-blast-native C2_DIR = $(OUT_DIR)/checker2 C2_CFLAGS = -std=gnu11 -Wall -Wextra -Werror -D_GNU_SOURCE -O2 -Isrc -Isrc/checker2 C2_ASAN = -O1 -g -fsanitize=address,undefined -fno-sanitize-recover=all @@ -97,12 +97,16 @@ $(C2_DIR)/test_c2_blast_native: tests/checker2/test_c2_blast_native.c $(C2_CORE) test-checker2-blast-native: $(OUT_DIR)/compiler/oscc $(C2_DIR)/test_c2_blast_native sh tests/checker2/blast_native.sh $(OUT_DIR)/compiler/oscc $(C2_DIR)/test_c2_blast_native $(C2_DIR)/blast_native -test-checker2-unit: $(C2_DIR)/test_c2_receipt $(C2_DIR)/test_c2_receipt_asan $(C2_DIR)/test_c2_ir $(C2_DIR)/test_c2_ir_asan test-checker2-differential test-checker2-lrat test-checker2-blast-native +test-checker2-unit: $(C2_DIR)/test_c2_receipt $(C2_DIR)/test_c2_receipt_asan $(C2_DIR)/test_c2_ir $(C2_DIR)/test_c2_ir_asan test-checker2-differential test-checker2-lrat test-checker2-blast-native test-checker2-owner-receipt ./$(C2_DIR)/test_c2_receipt tests/checker2/fixtures ./$(C2_DIR)/test_c2_receipt_asan tests/checker2/fixtures ./$(C2_DIR)/test_c2_ir $(C2_IRDIR) ./$(C2_DIR)/test_c2_ir_asan $(C2_IRDIR) +# positive production case: the receipt signed on Drake's YubiKey (spec section 11; fails PENDING until signed) +test-checker2-owner-receipt: $(C2_DIR)/checker2 + sh tests/checker2/owner_receipt.sh $(C2_DIR)/checker2 tests/checker2/fixtures/owner-receipt $(C2_DIR)/owner-receipt + test-checker2-mutants: test-checker2-differential test-checker2-lrat sh tests/checker2/mutants.sh "$(CC)" "$(C2_DIR)/mutants" "$(C2_IRDIR)" "$(C2_DIR)/lrat" diff --git a/spec/.crumb b/spec/.crumb index fc2d95592..7830023bf 100644 --- a/spec/.crumb +++ b/spec/.crumb @@ -20,14 +20,14 @@ } ], "children_root": "sha256:6834a3241647d3a098283d4eafedbdb1428dfa4d834f9ed5f22025b6d2303093", - "compiled_at": "2026-10-14T18:36:27Z", + "compiled_at": "2026-10-15T00:04:44Z", "compiler": "crumb-compile/1", - "digest": "sha256:3d892a08078369eebc9a5e2a7ee2b6a24c278f2dbd91db5e7026decb8d8399f8", + "digest": "sha256:119a9f1adb744797c10e946c8e9725ec260587fb303668d71a627527d31a8e84", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 58, - "generated_at_commit": "4fa52370f177d268e4248955dc7adec53519e215", - "source_tree": "sha256:a1fb731468c43b20acfa4e5a2cde5e3adde0d6ab71b10aba4eaeadffcd2dfec0" + "generated_at_commit": "accd294d335a05aceda8428bef1f808bb4a24dd4", + "source_tree": "sha256:2666c370cfc7550bb01dd15cef1c4c6f9e60f70044f6899f18f24ba85e585768" }, "owner_lane": "", "provenance": { diff --git a/spec/one-layer-receipts.md b/spec/one-layer-receipts.md index a4e36eb5f..1434a33b1 100644 --- a/spec/one-layer-receipts.md +++ b/spec/one-layer-receipts.md @@ -197,10 +197,14 @@ class 1 receipt). Proofs are deterministic: the solver writes byte-identical pro - Translation validation of the executable against the program (plan section 3) is not done; evidence classes 1 and 2 say so in their definitions. -- Production acceptance of an OWNER receipt is tested only in its refusals; a positive production - case needs one receipt signed on Drake's YubiKey (owner presence, decision D3). UNVERIFIED - until then. -- The admission side (aienos#383) is separate work and must verify exactly these bytes. +- Production acceptance of an OWNER receipt: VERIFIED for one positive case. Receipt a01 was signed + on Drake's YubiKey (serial 39017074, PIV slot 9c, owner root 578ada3c...9e76) on 2026-10-15T00:02:50Z; + `checker2 receipt verify --production` accepts it, openssl verifies the Ed25519 signature against the + ceremony public key, and six tampered controls are refused (`make test-checker2-owner-receipt`, + fixtures in tests/checker2/fixtures/owner-receipt). The aienos kernel verifier accepts it under an owner + policy; the shipped aienos release policy does not yet carry an owner receipt anchor, so it reports + UNTRUSTED_SIGNER there. Adding that anchor is aienos work and is UNVERIFIED. +- The admission side (aienos#383, merged in aienos#384) verifies exactly these bytes. - Dependency receipts are not resolved in v1: the `dependencies` digest binds their ids, and a verifier can require the expected ids (`DEPENDENCIES_MISMATCH`), but no verifier fetches the dependency receipts or checks their validity, class or freshness. UNVERIFIED for any chain. @@ -245,6 +249,11 @@ class 1 receipt). Proofs are deterministic: the solver writes byte-identical pro bits, else edge values and 3000 samples) checker2's CNF must agree with the compiled code on the trap and, through an `ensures result != c` probe, on the exact result value; 8 negative controls (the CNF of one operation against the code of another) must disagree; +- `owner_receipt.sh`: the positive production case of section 11. The committed OWNER draft and its + 65-byte message (`tests/checker2/fixtures/owner-receipt`, PROVENANCE.txt) are rebuilt and must be + byte-identical; the receipt signed once on Drake's YubiKey must verify `--production`, and a changed + signature byte, a changed program hash, a wrong target, an expired epoch, a revoked owner key and a + wrong executable must each be refused. It fails `OWNER-RECEIPT PENDING` until that signature is committed; - `mutants.sh`: each line tagged `GUARD:` in the receipt code, decoder, acceptance rules, LRAT checker and bit-blaster is removed in turn; a test must fail every time (104 of 104); the script also refuses a tag count that differs from the mutant count. diff --git a/tests/.crumb b/tests/.crumb index 06b0a6a5c..7832f925f 100644 --- a/tests/.crumb +++ b/tests/.crumb @@ -134,7 +134,7 @@ }, { "digest": "f041b7daf38c51e8db72834bb764cef7741637981223039d89731a30aa91e224", - "last_commit": "18531691", + "last_commit": "1edf41a5", "name": "compiler", "purpose": "Directory tests/compiler. Purpose not yet described by a human." }, @@ -212,7 +212,7 @@ }, { "digest": "024a746eff9cd1871d1e507c2f56ed6a1f7125cb457915904f9b1455140f8942", - "last_commit": "e59633e5", + "last_commit": "5901baa5", "name": "physics0", "purpose": "PD-0 gates: world self-test, oracle calibration, learner L0/L1/NULL, mutations, OSC differential" }, @@ -260,7 +260,7 @@ }, { "digest": "e505518cad5dd5bb87591ad6e105c0394161cebe5ac399ff0cde45d0dec59ee9", - "last_commit": "", + "last_commit": "dd67f6bd", "name": "reservoir", "purpose": "Reservoir tests (omega#440): Gate 1 simulator and readout checks against an independent binary64" }, @@ -296,14 +296,14 @@ } ], "children_root": "sha256:007780788467b076e31455e97b09ed7fb861af2e96184fd750995606dac0dc60", - "compiled_at": "2026-10-14T21:46:29Z", + "compiled_at": "2026-10-15T00:25:19Z", "compiler": "crumb-compile/1", - "digest": "sha256:792cfc471ce3778cf2a4f7c90d0cddeae9cbe5494b013045e4f81cc5f4a7daa4", + "digest": "sha256:8401c311b8d73c13a75937463ca173dba2af1a3e79fda3e126be4e1918f56436", "evidence_files": 16, "evidence_root": "sha256:96d08097822ad95f4e562c19e0ba5df5a035774c48632f1832912c40a27bd27a", - "files": 1173, - "generated_at_commit": "2a6d6d7b9091bd2184b15dcde893035dbcca40d3", - "source_tree": "sha256:373f62cb1aa94f1490d7fc8a071c38e0d1beb9856e661ff85ef628019f7a24e1" + "files": 1182, + "generated_at_commit": "6dd6b739360d4ac2f5f997a96b6f8b110951a0a1", + "source_tree": "sha256:d63ab817e1db8f8495a6745545d980db3e21e84764d6715978083babea6905cb" }, "owner_lane": "", "provenance": { diff --git a/tests/checker2/fixtures/owner-receipt/PROVENANCE.txt b/tests/checker2/fixtures/owner-receipt/PROVENANCE.txt new file mode 100644 index 000000000..ca2ad424a --- /dev/null +++ b/tests/checker2/fixtures/owner-receipt/PROVENANCE.txt @@ -0,0 +1,22 @@ +Owner-signed realization receipt (receipt v1, spec/one-layer-receipts.md): the positive production case of +section 11. PUBLIC data only. + +Program: a01.ir and a01.code are section 1 (OSC IR, 109 bytes) and section 2 (code, 164 bytes) of aienos + native/kernel/tests/fixtures/osc_unit/vectors/a01_valid_min.unit at aien-spark/aienos 69abd96c45d2 + (unit sha256 5711ca0a71062f7df709bde41ed80c8e724f4826b886ecc9b0ceb55f80682da4). Each section was extracted + the way aienos tests/fixtures/osc_receipt/make-receipts.sh does it and hashes to its section-table entry: + ir_sha256 084803c232dc44effcc44704c9ed0600dec1231451e0b76693633e98a48d1a1d + code_sha256 6163612fd91c0ce8eb8126d4b38534867428704d346795a5e369055eef10fcdb +Draft: a01.owner-draft.rcpt = checker2 (omega 265ce82a, checker_id d7aae601...cf3ba, the identity pinned in aienos + artifact/osc_receipt_anchor.h) `receipt issue a01.ir a01.code --target aienos-ck-aarch64-el0 --epoch 20 + --expiry 100 --owner-draft`: OWNER class, owner root fingerprint, all-zero signature. Target and epoch 20 + are the aienos kernel's (OSC_RCPT_TARGET_NAME; core/osc_admit.c epoch floor 10, current epoch 20). +Message: a01.owner-draft.tbs = `receipt tbs` of the draft: the 65 bytes the YubiKey signs (section 3). +Signature: a01.owner.sig (64 bytes) is made once on Drake's YubiKey, serial 39017074, PIV slot 9c, owner root + 578ada3cb0c2d154623ac089191023c8ad4bc5e63b8ccd1a38db2d679b8c9e76 (aienos#380 ceremony), by + ~/bin/owner-sign-receipt-test.sh on the Spark: yubico-piv-tool -a verify-pin --sign -s 9c -A ED25519. + a01.owner.rcpt is `receipt attach` of the draft and that signature. a01.owner.check.txt records the + script's verdicts (openssl, omega production verify, the aienos kernel verifier built for the host). + Until those files are committed tests/checker2/owner_receipt.sh fails with OWNER-RECEIPT PENDING. +Rebuild: the draft and message are deterministic; owner_receipt.sh rebuilds both and requires byte identity. A + changed checker2 identity changes them, and the receipt must then be signed again. diff --git a/tests/checker2/fixtures/owner-receipt/a01.code b/tests/checker2/fixtures/owner-receipt/a01.code new file mode 100644 index 000000000..83e455406 Binary files /dev/null and b/tests/checker2/fixtures/owner-receipt/a01.code differ diff --git a/tests/checker2/fixtures/owner-receipt/a01.ir b/tests/checker2/fixtures/owner-receipt/a01.ir new file mode 100644 index 000000000..805fd32c7 Binary files /dev/null and b/tests/checker2/fixtures/owner-receipt/a01.ir differ diff --git a/tests/checker2/fixtures/owner-receipt/a01.owner-draft.rcpt b/tests/checker2/fixtures/owner-receipt/a01.owner-draft.rcpt new file mode 100644 index 000000000..d987ff160 Binary files /dev/null and b/tests/checker2/fixtures/owner-receipt/a01.owner-draft.rcpt differ diff --git a/tests/checker2/fixtures/owner-receipt/a01.owner-draft.tbs b/tests/checker2/fixtures/owner-receipt/a01.owner-draft.tbs new file mode 100644 index 000000000..4250f6e06 Binary files /dev/null and b/tests/checker2/fixtures/owner-receipt/a01.owner-draft.tbs differ diff --git a/tests/checker2/fixtures/owner-receipt/a01.owner.check.txt b/tests/checker2/fixtures/owner-receipt/a01.owner.check.txt new file mode 100644 index 000000000..e06a35033 --- /dev/null +++ b/tests/checker2/fixtures/owner-receipt/a01.owner.check.txt @@ -0,0 +1,6 @@ +Owner-signed receipt check, 2026-10-15T00:02:50Z (~/bin/owner-sign-receipt-test.sh) +signer: YubiKey serial 39017074, PIV slot 9c, owner_root_ed25519 578ada3cb0c2d154623ac089191023c8ad4bc5e63b8ccd1a38db2d679b8c9e76 +receipt_id: 1348e78b0f88a5054f2b78b0a8d7c998ba70d166c711a2341528824685776034 +omega 9e5c33c06c56f3fb21cba2000f0434f1b4037efd: checker2 receipt verify --production: VALID; changed signature byte: BAD_SIGNATURE +openssl Ed25519 over the 65-byte message: verified +aienos kernel verifier origin/main edd175183: VALID under the owner policy; UNTRUSTED_SIGNER under today's shipped release policy (no owner anchor yet) diff --git a/tests/checker2/fixtures/owner-receipt/a01.owner.rcpt b/tests/checker2/fixtures/owner-receipt/a01.owner.rcpt new file mode 100644 index 000000000..8d06a38a7 Binary files /dev/null and b/tests/checker2/fixtures/owner-receipt/a01.owner.rcpt differ diff --git a/tests/checker2/fixtures/owner-receipt/a01.owner.sig b/tests/checker2/fixtures/owner-receipt/a01.owner.sig new file mode 100644 index 000000000..5458596bc --- /dev/null +++ b/tests/checker2/fixtures/owner-receipt/a01.owner.sig @@ -0,0 +1 @@ +¥&o33 +CoµòY0\p›?Q˜¦®\4sû³Ý²¤w½èu(ð`¶J÷¶.´‹Š¸š½Š˜$à \ No newline at end of file diff --git a/tests/checker2/owner_receipt.sh b/tests/checker2/owner_receipt.sh new file mode 100644 index 000000000..cb2123cf3 --- /dev/null +++ b/tests/checker2/owner_receipt.sh @@ -0,0 +1,69 @@ +#!/bin/sh +# Positive production case for OWNER receipts (spec/one-layer-receipts.md section 11, omega#446): +# one receipt signed on Drake's YubiKey (owner root, PIV slot 9c) must be accepted by +# `checker2 receipt verify --production`, and its tampered copies refused. +# +# Fixtures (tests/checker2/fixtures/owner-receipt, PROVENANCE.txt): +# a01.ir, a01.code program and executable bytes of aienos osc_unit/vectors/a01_valid_min.unit +# a01.owner-draft.rcpt `receipt issue --owner-draft` output: OWNER class, all-zero signature +# a01.owner-draft.tbs `receipt tbs` output: the 65 bytes the YubiKey signs +# a01.owner.sig the 64-byte Ed25519 signature made on the YubiKey (Drake) +# a01.owner.rcpt `receipt attach` output: the signed receipt +# Checks: the draft and the message are rebuilt by this checker2 and must be byte-identical (a changed +# checker identity changes them, and the signed receipt must then be made again); the signed receipt is +# the draft with exactly the committed signature in bytes [352, 416); production verify says VALID; +# controls: a changed signature byte, a changed program hash, a wrong target, an expired epoch, a +# revoked owner key and a wrong executable are each refused with their named reason. +# Until the signature is committed the test FAILS with OWNER-RECEIPT PENDING: the gap stays visible. +# Usage: owner_receipt.sh +set -u +C2=$1 F=$2 W=$3 +TARGET=aienos-ck-aarch64-el0 EPOCH=20 EXPIRY=100 FLOOR=10 +OWNER_FP=$(od -An -tx1 -j320 -N32 "$F/a01.owner-draft.rcpt" | tr -d ' \n') # key fingerprint written by issue +rm -rf "$W" && mkdir -p "$W" || exit 2 +fail=0 ctl=0 +bad() { echo "owner_receipt: FAIL $*"; fail=$((fail + 1)); } + +"$C2" receipt issue "$F/a01.ir" "$F/a01.code" --target $TARGET --epoch $EPOCH --expiry $EXPIRY \ + --owner-draft "$W/draft.rcpt" || bad "issue --owner-draft" +cmp -s "$W/draft.rcpt" "$F/a01.owner-draft.rcpt" || bad "owner draft is not byte-identical to the committed draft" +"$C2" receipt tbs "$F/a01.owner-draft.rcpt" "$W/tbs" || bad "tbs" +cmp -s "$W/tbs" "$F/a01.owner-draft.tbs" || bad "signed message is not byte-identical to the committed one" + +if [ ! -f "$F/a01.owner.rcpt" ] || [ ! -f "$F/a01.owner.sig" ]; then + echo "owner_receipt: OWNER-RECEIPT PENDING: no YubiKey-signed receipt committed yet (~/bin/owner-sign-receipt-test.sh)" + exit 1 +fi +[ "$(wc -c <"$F/a01.owner.rcpt")" = 416 ] || bad "signed receipt is not 416 bytes" +[ "$(wc -c <"$F/a01.owner.sig")" = 64 ] || bad "signature is not 64 bytes" +head -c 352 "$F/a01.owner.rcpt" >"$W/head.signed" +head -c 352 "$F/a01.owner-draft.rcpt" >"$W/head.draft" +cmp -s "$W/head.signed" "$W/head.draft" || bad "signed receipt differs from the draft in the signed bytes" +tail -c 64 "$F/a01.owner.rcpt" | cmp -s - "$F/a01.owner.sig" || bad "signed receipt does not carry the committed signature" +# attach again from the committed draft and signature: verifies against the compiled-in owner root +mkdir -p "$W/store" +"$C2" receipt attach "$F/a01.owner-draft.rcpt" "$F/a01.owner.sig" --out-dir "$W/store" >"$W/attach.out" || bad "attach refuses the committed signature" +cmp -s "$(sed -n 's/^receipt=//p' "$W/attach.out" | cut -d' ' -f1)" "$F/a01.owner.rcpt" || bad "attach does not rebuild the committed receipt" + +v() { "$C2" receipt verify "$1" "$F/a01.ir" "${2:-$F/a01.code}" --target "${3:-$TARGET}" --epoch "${4:-$EPOCH}" --floor $FLOOR $5; } +out=$(v "$F/a01.owner.rcpt" "" "" "" --production) +[ "$out" = receipt=VALID ] || bad "production verify: $out" +out=$(v "$F/a01.owner.rcpt" "" "" "" "") +[ "$out" = receipt=VALID ] || bad "default (production) verify: $out" + +# expect NAME WANT RECEIPT EXE TARGET EPOCH EXTRA (empty: the default) +expect() { + n=$1 want=$2; shift 2 + got=$(v "$@") + if [ "$got" = "receipt=$want" ]; then ctl=$((ctl + 1)); else bad "control $n: want $want, got $got"; fi +} +flip() { cat "$F/a01.owner.rcpt" >"$2"; printf '\377' | dd of="$2" bs=1 seek="$1" conv=notrunc status=none; } +flip 400 "$W/sig.flip"; expect signature-byte BAD_SIGNATURE "$W/sig.flip" "" "" "" --production +flip 48 "$W/prog.flip"; expect program-hash BAD_SIGNATURE "$W/prog.flip" "" "" "" --production +expect wrong-target WRONG_TARGET "$F/a01.owner.rcpt" "" aarch64-linux-host "" --production +expect expired EXPIRED "$F/a01.owner.rcpt" "" "" $((EXPIRY + 1)) --production +expect revoked-key REVOKED "$F/a01.owner.rcpt" "" "" "" "--production --revoked-key $OWNER_FP" +expect wrong-executable EXECUTABLE_MISMATCH "$F/a01.owner.rcpt" "$F/a01.ir" "" "" --production + +if [ "$fail" -ne 0 ]; then echo "owner_receipt: FAIL ($fail)"; exit 1; fi +echo "owner_receipt: PASS owner-signed receipt VALID in production, $ctl controls refused" ```