capsule trust: a signed kernel refuses an unsigned capsule; the intermediate is the anchor (#139)

capsule_sig_refused(), the one decision at v4's boot and v3's three
births: INVALID always; MISSING and NO_ROOT_KEY on a signed build
(CAPSULE_SIGNED_BUILD, set exactly when the Makefiles sign). A
developer build warns and boots. test_capsule_sig, built both ways,
did not build without it; 4 checks each way now. nightly.sh
capsule-trust, a nightly step: signed, v4:centre.4th left unsigned
(test only), amd64 must refuse it -- CI's, as ruled, since only CI has
the key. No root check, as ruled; the step-4 trust model (blobs signed
by their authors, MANIFEST.md hashes, contributors' intermediates,
snakeoil) recorded as given. FABRIC-3 XLIX. Gates pass, POST 992/992.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RzZgrf7V7Zk2iczBXDRbm
This commit is contained in:
Claude
2026-11-20 22:37:25 +00:00
parent 5425d52cb1
commit 9db364f7c7
20 changed files with 1750 additions and 11 deletions
+2 -1
View File
@@ -190,6 +190,7 @@ RUN_riscv64 ?= qemu-riscv64
# as kernel/Makefile: CI sets SIGN_KEY; unset, the capsules are built unsigned
SIGN_KEY ?=
SIGN_KEY_ARGS = $(if $(wildcard $(SIGN_KEY)),--sign-key $(SIGN_KEY),)
CAPSULE_SIGNED_DEF = $(if $(wildcard $(SIGN_KEY)),-DCAPSULE_SIGNED_BUILD=1,) # #139, as kernel/Makefile
CRYPTO_SRCS := $(addprefix $(ROOT)/kernel/src/crypto/,ed25519.c fe25519.c scalar25519.c sha512.c)
MKCAPSULE_SRCS := $(ROOT)/tools/mkcapsule.c $(ROOT)/tools/pkcs8_ed25519.c $(CRYPTO_SRCS) \
$(ROOT)/kernel/src/crypto/x509_ed25519.c
@@ -204,7 +205,7 @@ SYSTEM_SRCS := $(HERE)/system/boot.c $(HERE)/system/post.c $(HERE)/system/post
$(ROOT)/kernel/src/hash/xxhash64.c $(ROOT)/kernel/src/crypto/x509_ed25519.c $(CRYPTO_SRCS)
# The kernel's sources are held to the kernel's warnings, not this model's.
SYSTEM_CFLAGS := $(CSTD) -Wall -Wextra $(OPT) -I$(HERE)/include -I$(ROOT)/kernel/include -I$(ROOT)/v3/include \
-DV4_CELL_BITS=64 $(HOST_DEFS)
-DV4_CELL_BITS=64 $(HOST_DEFS) $(CAPSULE_SIGNED_DEF)
$(BINDIR)/mkcapsule: $(MKCAPSULE_SRCS)
@mkdir -p $(BINDIR)
+1 -1
View File
@@ -345,7 +345,7 @@ static const uint8_t *open_capsule(const v4_boot *b, const char *name, const Cap
sr = capsule_verify_signature(descs, names, capsule_get_signatures(), arena, dir->desc_count, (int)(cap - descs));
if (sr != CAPSULE_SIG_OK) {
say(b, "V4: capsule "); say(b, name); say(b, " signature: "); say(b, capsule_sig_result_str(sr)); say(b, "\n");
if (sr == CAPSULE_SIG_INVALID) return 0;
if (capsule_sig_refused(sr)) return 0;
}
p = capsule_get_payload(cap, arena);