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
+18
View File
@@ -8,6 +8,14 @@
* signature/behavior stays untouched; this is a new, additive check
* called alongside it, not folded into it.
*
* Which results are refused is capsule_sig_refused()'s, the one decision every caller asks (#139,
* docs/v4.0.0/plans/2026-11-20-capsule-trust.md, ruled 2026-11-20): INVALID on every build; MISSING
* and NO_ROOT_KEY as well on a signed build (CAPSULE_SIGNED_BUILD 1, set by kernel/Makefile and
* v4/Makefile exactly when they sign the capsules). A developer build, without the key, warns of them
* and boots. The anchor is the signing certificate in the image (FABRIC-3 XLVI): it is not checked
* against the root CA (ruled 2026-11-20). Corrected 2026-11-20: until then, as below, only INVALID
* was refused on any build.
*
* Enforced ONLY on CAPSULE_SIG_INVALID (2026-08-26, after landing
* WARN-only and proving correct on all three architectures against both
* a valid and a deliberately-corrupted capsule -- see FABRIC-2.md's
@@ -31,6 +39,12 @@
* mkcapsule refuses to sign with a key that is not this certificate's. */
#define CAPSULE_SIGNING_CERT_NAME "pki:starshipos-intermediate.der"
/* 1 when the kernel is built with the signing key (kernel/Makefile, v4/Makefile): its capsules are
* signed, so an unsigned one, or no certificate to check by, is refused (#139). */
#ifndef CAPSULE_SIGNED_BUILD
#define CAPSULE_SIGNED_BUILD 0
#endif
typedef enum {
CAPSULE_SIG_OK = 0, /* has_sig=1, and it verifies */
CAPSULE_SIG_MISSING, /* has_sig=0 -- not signed at all */
@@ -58,4 +72,8 @@ CapsuleSigResult capsule_verify_signature(
* capsule_validate_result_str()'s existing shape. */
const char *capsule_sig_result_str(CapsuleSigResult result);
/* 1 if a capsule with this result is refused (#139): INVALID always; MISSING and NO_ROOT_KEY on a
* signed build (CAPSULE_SIGNED_BUILD). Every caller asks this rather than testing a result itself. */
int capsule_sig_refused(CapsuleSigResult result);
#endif /* STARKERNEL_CAPSULE_SIG_H */