interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / net / receipt.sh

96 lines · 4978 bytes Raw Blame History
1#!/bin/sh
2# SPDX-License-Identifier: Apache-2.0
3# Copyright 2026 Drake Stapleton (AIEN / aien-dev)
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# receipt.sh: one content-addressed M6-A + M6-B host receipt for the current
18# commit. Refuses a dirty tree. Runs make test + sanitize + mutants from clean, records the
19# commit, toolchain, source hashes and verdict lines, and writes
20# receipts/m6a_net_host_<sha256 of the receipt body>.txt. Never overwrites.
21#
22# Optional: RUSTDIFF=/path/to/driver runs an external driver built from the
23# UNMODIFIED Rust reference (kept outside this repo: no Rust in AIENOS) on the
24# same corpus and records a live comparison; otherwise that line is NOT_RUN and
25# only the pinned digest is checked.
26set -eu
27cd "$(dirname "$0")"
28top=$(git rev-parse --show-toplevel)
29if [ -n "$(git -C "$top" status --porcelain --untracked-files=normal)" ]; then
30 echo "receipt: refusing to run on a dirty tree:" >&2
31 git -C "$top" status --short >&2
32 exit 2
33fi
34commit=$(git rev-parse HEAD)
35log=$(mktemp -d "${TMPDIR:-/tmp}/m6a-net-receipt.XXXXXX")
36make clean >/dev/null
37status=PASS
38make test > "$log/test.txt" 2>&1 || status=FAIL
39make sanitize > "$log/sanitize.txt" 2>&1 || status=FAIL
40secure=PASS
41make mutants > "$log/mutants.txt" 2>&1 || { status=FAIL; secure=FAIL; }
42grep -q "^AIENOS_NET_SECURE_TESTS: PASS" "$log/test.txt" || secure=FAIL
43grep -q "^AIENOS_NET_SECURE_TESTS: PASS" "$log/sanitize.txt" || secure=FAIL
44grep -q "^X25519_RFC7748: PASS" "$log/test.txt" || secure=FAIL
45live="NET_RUST_DIFFERENTIAL_LIVE: NOT_RUN (no RUSTDIFF driver given; pinned digest checked)"
46if [ -n "${RUSTDIFF:-}" ]; then
47 if "$RUSTDIFF" < out/diff_corpus.bin > "$log/rust.txt" && cmp -s "$log/rust.txt" out/diff_ref.txt; then
48 live="NET_RUST_DIFFERENTIAL_LIVE: PASS (driver sha256 $(sha256sum "$RUSTDIFF" | cut -d' ' -f1))"
49 else
50 live="NET_RUST_DIFFERENTIAL_LIVE: FAIL"; status=FAIL
51 fi
52fi
53if [ -n "$(git -C "$top" status --porcelain --untracked-files=normal)" ]; then
54 echo "receipt: the run changed tracked files" >&2; status=FAIL
55fi
56body="$log/body.txt"
57{
58 echo "AIENOS M6-A hosted C network stack + M6-B secure transport receipt"
59 echo "commit: $commit"
60 echo "host: $(uname -srm)"
61 echo "cc: $(${CC:-cc} --version 2>/dev/null | head -1)"
62 echo "scope: host tests only (no QEMU, no hardware, no native binding, TEST identity only)"
63 echo "scope M6-B: hosted protocol code only; no real keys, no timing measurement, no formal protocol analysis"
64 echo "sources:"
65 for f in aienos_net.c aienos_net.h aienos_virtio_pci.c aienos_virtio_pci.h aienos_ctl.c aienos_ctl.h \
66 aienos_virtio_net.c aienos_virtio_net.h \
67 x25519.c x25519.h aienos_sec.c aienos_sec.h ../argus/sha256.c \
68 ../crypto/aes.c ../crypto/polyval.c ../crypto/gcm_siv.c ../crypto/hmac.c ../crypto/ct.c \
69 ../sig/ed25519.c ../sig/sha512.c ../sig/ct.c \
70 tests/net_test.c tests/ctl_test.c tests/net_diff.c tests/x25519_test.c tests/sec_test.c tests/vnet_test.c \
71 tests/fixtures/qemu822_virtio_net_pci_transitional.cfg tests/fixtures/qemu822_virtio_net_pci_modern.cfg \
72 tests/fixtures/dump_qemu_virtio_net_cfg.sh \
73 Makefile receipt.sh; do
74 echo " $(sha256sum "$f" | cut -d' ' -f1) native/net/$f"
75 done
76 echo "rust reference (spec, unmodified):"
77 for f in "$top/crates/aienos-kernel/src/net.rs" "$top/crates/aienos-kernel/src/virtio_net.rs"; do
78 echo " $(sha256sum "$f" | cut -d' ' -f1) ${f#$top/}"
79 done
80 echo "differential corpus: $(sha256sum out/diff_corpus.bin | cut -d' ' -f1)"
81 echo "results:"
82 grep -hE '^(net_test|ctl_test|vnet_test|lib-checks|NET_|CTL_|VNET_|VIRTIO_|X25519_|AIENOS_NET_| [a-z+0-9-]+ +(done|link_down))' "$log/test.txt" "$log/sanitize.txt" "$log/mutants.txt" | sed 's/^/ /'
83 echo " $live"
84 echo "deferred (not claimed): native binding -> needs a C kernel (no-Rust rule; port order open);"
85 echo " production identity and keys -> needs M5 key hierarchy (TRUST-1); M6-B runs on TEST keys only;"
86 echo " physical NIC qualification -> needs Machine 1 wave after TRUST-1 Gate 7."
87 echo "M6A_NET_HOST: $status"
88 echo "AIENOS_NET_SECURE: $secure"
89} > "$body"
90digest=$(sha256sum "$body" | cut -d' ' -f1)
91mkdir -p receipts
92out="receipts/m6a_net_host_${digest}.txt"
93[ -e "$out" ] || cp "$body" "$out"
94cat "$out"
95echo "receipt: native/net/$out (raw logs in $log)"
96[ "$status" = PASS ]