aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / kernel / svc / security.h
| 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* security.h -- the security boot stage: the native capability authority |
| 18 | * (AEGIS, native/capability) and ARGUS (native/argus) with its ARGUS-1 |
| 19 | * containment bridge and gate, brought up the way the e2e bridge test does, |
| 20 | * then two in-kernel self-checks: |
| 21 | * caps: the Rust ipc demo semantics on the C authority (grant, attenuated |
| 22 | * delegation, amplification refused, forged reference denied, |
| 23 | * revoke of the ancestor denies the delegated copy); |
| 24 | * argus: the ARGUS-1 first narrow-revoke invariant (I1 one narrow revoke, |
| 25 | * I5 no authority expansion). |
| 26 | * Not a qualification: it runs on whatever CPU the kernel runs on. */ |
| 27 | #ifndef AIENOS_CK_SECURITY_H |
| 28 | #define AIENOS_CK_SECURITY_H |
| 29 | #include <stdint.h> |
| 30 | #include "aienos_capability.h" |
| 31 | |
| 32 | typedef struct { |
| 33 | /* caps */ |
| 34 | int caps_granted, caps_attenuated, caps_amplify_denied, caps_forged_denied, caps_revoked_denied; |
| 35 | int caps_ok; |
| 36 | /* argus */ |
| 37 | uint32_t findings_before; /* findings drained after the caps check */ |
| 38 | uint32_t trigger_findings; /* findings from the trigger event (want 1) */ |
| 39 | int decision, execution; /* AIENOS_CONTAIN_* of the receipts */ |
| 40 | uint32_t revokes_during; /* observer REVOKE announcements during submit (want 1) */ |
| 41 | uint32_t mints_during; /* observer MINT announcements during the ARGUS run (want 0) */ |
| 42 | uint32_t executor_mints; /* MINTs with subject AIENOS_CONTAIN_SUBJ after create (want 0) */ |
| 43 | int target_denied_code; /* validate rc on the revoked target */ |
| 44 | int unrelated_same_subject; /* validate rc, want 0 */ |
| 45 | int unrelated_other_subject; /* validate rc, want 0 */ |
| 46 | int executor_unchanged; /* rights == REVOKE only, same generation, LIVE */ |
| 47 | int health_ok, bridge_ok; |
| 48 | int argus_ok; |
| 49 | const char *fail; /* first failed step, NULL when both ok */ |
| 50 | } ck_sec_report; |
| 51 | |
| 52 | /* Bring up authority + ARGUS and run both checks. 0 when both pass. The |
| 53 | * authority and ARGUS stay up (kernel lifetime); ck_security_shutdown frees |
| 54 | * them (host tests). */ |
| 55 | int ck_security_run(ck_sec_report *r); |
| 56 | void ck_security_shutdown(void); |
| 57 | #endif |