Struct Cap

Source
pub struct Cap {
    pub target: ObjID,
    pub accessor: ObjID,
    pub protections: Protections,
    pub revocation: Revoc,
    /* private fields */
}
Expand description

A capability that represents authorization for a Security Context to access an object.

Capabilities are stored inside crate::sec_ctx::SecCtx, and are authenticated using cryptographic signatures. When accessing an object for the first time, the kernel searches through the attached Security Context for a usable capability. If none found it will look through inactive contexts for a valid capability and then procedes to verify its signature in order to grant access rights.

§Fields

  • target - The object ID this capability grants access to
  • accessor - The security context ID in which this capability resides
  • protections - The specific access rights this capability grants
  • flags - Specifies the cryptographic primitives used to form the signature
  • gates - Allows access into an object in a specified range
  • revocation - Specifies when the capability is invalid
  • signature - the signature of the capability

§Examples

// Example of creating and using a capability
todo

Fields§

§target: ObjID

Object ID this capability grants access to

§accessor: ObjID

Security context ID in which this capability resides

§protections: Protections

Specific access rights this capability grants

§revocation: Revoc

Specifies when this capability is invalid, i.e. expiration.

Implementations§

Source§

impl Cap

Source

pub fn new( target: ObjID, accessor: ObjID, prots: Protections, target_priv_key: &SigningKey, revocation: Revoc, gates: Gates, hashing_algo: HashingAlgo, ) -> Result<Self, SecurityError>

creating a new capability, revoc specified in expiration data in ns from unix epoch

Source

pub fn verify_sig( &self, verifying_key: &VerifyingKey, ) -> Result<(), SecurityError>

verifies signature inside capability

Source

pub fn check_gate( &self, ptr_offset: u64, align: u64, ) -> Result<(), SecurityError>

checks to see if the specified ptr_offset falls in the capability’s gate.

Trait Implementations§

Source§

impl Clone for Cap

Source§

fn clone(&self) -> Cap

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Cap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Cap

Source§

fn eq(&self, other: &Cap) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Cap

Source§

impl Eq for Cap

Source§

impl StructuralPartialEq for Cap

Auto Trait Implementations§

§

impl Freeze for Cap

§

impl ObjSafe for Cap

§

impl RefUnwindSafe for Cap

§

impl Send for Cap

§

impl StoreCopy for Cap

§

impl Sync for Cap

§

impl Unpin for Cap

§

impl UnwindSafe for Cap

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more