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 toaccessor
- The security context ID in which this capability residesprotections
- The specific access rights this capability grantsflags
- Specifies the cryptographic primitives used to form the signaturegates
- Allows access into an object in a specified rangerevocation
- Specifies when the capability is invalidsignature
- 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
impl Cap
Sourcepub fn new(
target: ObjID,
accessor: ObjID,
prots: Protections,
target_priv_key: &SigningKey,
revocation: Revoc,
gates: Gates,
hashing_algo: HashingAlgo,
) -> Result<Self, SecurityError>
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
Sourcepub fn verify_sig(
&self,
verifying_key: &VerifyingKey,
) -> Result<(), SecurityError>
pub fn verify_sig( &self, verifying_key: &VerifyingKey, ) -> Result<(), SecurityError>
verifies signature inside capability
Sourcepub fn check_gate(
&self,
ptr_offset: u64,
align: u64,
) -> Result<(), SecurityError>
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§
impl Copy for Cap
impl Eq for Cap
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.