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:
@@ -19,7 +19,7 @@ CC ?= cc
|
||||
CFLAGS := -std=c99 -Wall -Wextra -Werror -O2 -g -I$(HERE) -I$(ROOT)/kernel/include \
|
||||
-I$(ROOT)/kernel/include/starkernel -I$(ROOT)/v3/include
|
||||
|
||||
TESTS := test_heartbeat test_gpt test_usb_config test_sk_v4_stop test_sk_v4_slots test_sk_v4_mint test_sk_v4_identity test_heartbeat_export test_ssm_jacquard test_physics_l2 test_stadium_node test_stadium_ops test_stadium_words
|
||||
TESTS := test_capsule_sig test_capsule_sig_signed test_heartbeat test_gpt test_usb_config test_sk_v4_stop test_sk_v4_slots test_sk_v4_mint test_sk_v4_identity test_heartbeat_export test_ssm_jacquard test_physics_l2 test_stadium_node test_stadium_ops test_stadium_words
|
||||
# the one adaptive heartbeat paces itself (plan 2026-11-17-one-adaptive-heartbeat): heartbeat.c, its Q48.16, and the
|
||||
# v4 inference arithmetic its slope provider runs
|
||||
SRC_test_heartbeat := $(ROOT)/kernel/src/heartbeat.c $(ROOT)/kernel/src/math/q48_16.c $(ROOT)/v4/system/inference.c
|
||||
@@ -40,6 +40,10 @@ EXTRA_test_sk_v4_mint := -D__STARKERNEL__ -I$(ROOT)/v4/include
|
||||
SRC_test_sk_v4_slots := $(ROOT)/kernel/src/v4/sk_v4_slots.c
|
||||
SRC_test_sk_v4_stop := $(ROOT)/kernel/src/v4/sk_v4_stop.c
|
||||
SRC_test_gpt := $(ROOT)/kernel/src/gpt.c
|
||||
# #139: the signature results the kernel refuses, on a developer build and a signed one
|
||||
SRC_test_capsule_sig := $(ROOT)/kernel/src/capsule/capsule_sig.c $(addprefix $(ROOT)/kernel/src/crypto/,x509_ed25519.c ed25519.c fe25519.c scalar25519.c sha512.c)
|
||||
SRC_test_capsule_sig_signed := $(SRC_test_capsule_sig)
|
||||
EXTRA_test_capsule_sig_signed := -DCAPSULE_SIGNED_BUILD=1
|
||||
SRC_test_usb_config := $(ROOT)/kernel/src/usb/usb_config.c
|
||||
|
||||
define TEST_RULE
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/* SPDX-License-Identifier: LicenseRef-Starship-1.0
|
||||
* Copyright (c) 2023-2026 Robert A. James
|
||||
*/
|
||||
/* test_capsule_sig.c -- which capsule signature results the kernel refuses (#139;
|
||||
* docs/v4.0.0/plans/2026-11-20-capsule-trust.md, ruled 2026-11-20): capsule_sig_refused(), the one
|
||||
* decision every caller asks. INVALID is refused on every build. A signed build (built with the
|
||||
* signing key, CAPSULE_SIGNED_BUILD 1) also refuses MISSING and NO_ROOT_KEY; a build without the key
|
||||
* warns of them and boots. Built twice: as here, unsigned, and as test_capsule_sig_signed.c.
|
||||
*/
|
||||
#include "harness.h"
|
||||
#include "starkernel/capsule_sig.h"
|
||||
|
||||
#ifndef CAPSULE_SIGNED_BUILD
|
||||
#define CAPSULE_SIGNED_BUILD 0
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("capsule_sig_refused, a %s build\n", CAPSULE_SIGNED_BUILD ? "signed" : "developer (unsigned)");
|
||||
CHECK(!capsule_sig_refused(CAPSULE_SIG_OK), "a good signature is never refused");
|
||||
CHECK(capsule_sig_refused(CAPSULE_SIG_INVALID), "a signature that does not verify is always refused");
|
||||
CHECK(capsule_sig_refused(CAPSULE_SIG_MISSING) == CAPSULE_SIGNED_BUILD,
|
||||
"an unsigned capsule: refused on a signed build, warned of on a developer build");
|
||||
CHECK(capsule_sig_refused(CAPSULE_SIG_NO_ROOT_KEY) == CAPSULE_SIGNED_BUILD,
|
||||
"no signing certificate to check by: refused on a signed build, warned of on a developer build");
|
||||
return DONE();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: LicenseRef-Starship-1.0
|
||||
* Copyright (c) 2023-2026 Robert A. James
|
||||
*/
|
||||
/* test_capsule_sig_signed.c -- test_capsule_sig.c on a signed build (CAPSULE_SIGNED_BUILD 1, from the
|
||||
* Makefile's EXTRA, as the kernel's build sets it with the signing key). */
|
||||
#include "test_capsule_sig.c"
|
||||
Reference in New Issue
Block a user