pub struct KernelState { /* private fields */ }Expand description
Complete kernel state (TCB)
Corresponds to Lean: structure KernelState
Implementations§
Source§impl KernelState
impl KernelState
Sourcepub fn initial(key: Key, policy: PolicyState) -> Self
pub fn initial(key: Key, policy: PolicyState) -> Self
Create initial kernel state
Corresponds to Lean: def KernelState.initial (key : Key) (pol : PolicyState) : KernelState
Sourcepub fn tick(&self) -> Result<Self, KernelError>
pub fn tick(&self) -> Result<Self, KernelError>
Advance kernel time (immutable, checked)
Corresponds to Lean: def KernelState.tick (ks : KernelState) : KernelState
§Errors
Returns KernelError::CounterOverflow if the time counter would exceed u64::MAX.
Sourcepub fn rotate_key(&mut self, new_key: Key)
pub fn rotate_key(&mut self, new_key: Key)
Rotate HMAC key (kernel-only operation)
Corresponds to Lean: def KernelState.rotateKey
The current key becomes the previous key for grace period verification. The epoch is incremented.
SECURITY: This operation should only be callable by privileged kernel code.
Sourcepub fn with_rotated_key(&self, new_key: Key) -> Self
pub fn with_rotated_key(&self, new_key: Key) -> Self
Rotate HMAC key (immutable version)
Sourcepub fn verify_cap_seal(&self, cap: &Capability) -> bool
pub fn verify_cap_seal(&self, cap: &Capability) -> bool
Verify capability seal using key state (supports rotation)
Corresponds to Lean: def KernelState.verify_cap_seal
Sourcepub fn alloc_cap_id(&mut self) -> Result<CapId, KernelError>
pub fn alloc_cap_id(&mut self) -> Result<CapId, KernelError>
Allocate a fresh capability ID
Corresponds to Lean: def KernelState.alloc_cap_id
INVARIANT: The returned ID is guaranteed fresh (not in use).
§Errors
Returns KernelError::CapIdExhausted if the capability ID counter would overflow.
Sourcepub fn next_cap_id(&self) -> CapId
pub fn next_cap_id(&self) -> CapId
Get the next capability ID (without allocating)
Sourcepub fn tick_checked(&mut self) -> Result<(), KernelError>
pub fn tick_checked(&mut self) -> Result<(), KernelError>
Advance kernel time (mutating, checked)
§Errors
Returns KernelError::CounterOverflow if the time counter would exceed u64::MAX.
Sourcepub fn cap_not_revoked(&self, cap: &Capability) -> bool
pub fn cap_not_revoked(&self, cap: &Capability) -> bool
Check if capability is not revoked
Corresponds to Lean: def KernelState.cap_not_revoked
Sourcepub fn revocation(&self) -> &RevocationState
pub fn revocation(&self) -> &RevocationState
Get a reference to the revocation state
Sourcepub fn policy(&self) -> &PolicyState
pub fn policy(&self) -> &PolicyState
Get a reference to the policy state
Trait Implementations§
Source§impl Clone for KernelState
impl Clone for KernelState
Source§fn clone(&self) -> KernelState
fn clone(&self) -> KernelState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more