pub struct PcrBank { /* private fields */ }
Expand description

Struct for holding PcrSlots and their corresponding values.

Implementations§

source§

impl PcrBank

source

pub fn create(pcr_slots: Vec<PcrSlot>, digests: Vec<Digest>) -> Result<PcrBank>

Function that creates PcrBank from a vector of pcr slots and a vector of pcr digests.

Details

The order of pcr slots are assumed to match the order of the Digests.

Errors
  • If number of pcr slots does not match the number of pcr digests InconsistentParams error is returned.

  • If the vector of pcr slots contains duplicates then InconsistentParams error is returned.

source

pub fn get_digest(&self, pcr_slot: PcrSlot) -> Option<&Digest>

Retrieves reference to a Digest associated with the provided PcrSlot.

Details

Returns a reference to a Digest associated with the provided PcrSlot if one exists else returns None.

source

pub fn has_digest(&self, pcr_slot: PcrSlot) -> bool

Returns true if the PcrBank contains a digest for the provided PcrSlot.

source

pub fn len(&self) -> usize

Number of digests in the PcrBank

source

pub fn is_empty(&self) -> bool

Returns true if the PcrBank is empty

source

pub fn remove_digest(&mut self, pcr_slot: PcrSlot) -> Option<Digest>

Removees the Digest associated with the PcrSlot and returns it.

Details

Removes the Digest associated with the provided PcrSlot out of the bank and returns it if it exists else returns None.

source

pub fn insert_digest(&mut self, pcr_slot: PcrSlot, digest: Digest) -> Result<()>

Inserts Digest value associated with a PcrSlot into the bank.

Errors

Returns an error if a Digest is already associated with the provided PcrSlot.

source

pub fn try_extend(&mut self, other: PcrBank) -> Result<()>

Attempts to extend the PcrBank with other.

Errors

Returns an error if the a value in other already exists.

Trait Implementations§

source§

impl Clone for PcrBank

source§

fn clone(&self) -> PcrBank

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 PcrBank

source§

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

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

impl<'a> IntoIterator for &'a PcrBank

§

type Item = (&'a PcrSlot, &'a Digest)

The type of the elements being iterated over.
§

type IntoIter = Iter<'a, PcrSlot, Digest>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl PartialEq<PcrBank> for PcrBank

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for PcrBank

source§

impl StructuralEq for PcrBank

source§

impl StructuralPartialEq for PcrBank

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> Free for T

source§

default unsafe fn free(ptr_ref: NonNull<T>)

Drops the content pointed by this pointer and frees it. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.