[][src]Struct tss_esapi::utils::PcrSelections

pub struct PcrSelections { /* fields omitted */ }

A struct representing pcr selections

The minimum number of octets allowed in a TPMS_PCR_SELECT.sizeOfSelect is not determined by the number of PCR implemented but by the number of PCR required by the platform-specific specification with which the TPM is compliant or by the implementer if not adhering to a platform-specific specification.

Implementations

impl PcrSelections[src]

pub fn len(&self) -> usize[src]

Function for retrieiving the number of banks in the selection

pub fn is_empty(&self) -> bool[src]

Returns true if the selection is empty.

pub fn subtract(&mut self, other: &Self) -> Result<()>[src]

Removes items in other from `self.

Arguments

  • other - A PcrSelections containing items that will be removed from self.

Constraints

  • Cannot be called with other that contains items that are not present in self.

  • Cannot be called with other that has a size_of_select that is different from the one in self.

Errors

  • Calling the method with other that contains items not present in self will result in an InvalidParam error.

  • Calling the method with other that contains a size_of_select that is different then the one in self will result in a InvalidParam error.

Examples

use tss_esapi::utils::{PcrSelectionsBuilder, PcrSlot, algorithm_specifiers::HashingAlgorithm};
// pcr selections
let mut pcr_selections = PcrSelectionsBuilder::new()
    .with_size_of_select(Default::default())
    .with_selection(HashingAlgorithm::Sha256, &[PcrSlot::Slot0, PcrSlot::Slot8])
    .build();

// Another pcr selections
let other = PcrSelectionsBuilder::new()
    .with_size_of_select(Default::default())
    .with_selection(
        HashingAlgorithm::Sha256, &[PcrSlot::Slot0],
    )
    .build();
pcr_selections.subtract(&other).unwrap();
assert_eq!(pcr_selections.len(), 1);

Trait Implementations

impl Clone for PcrSelections[src]

impl Debug for PcrSelections[src]

impl Default for PcrSelections[src]

impl Eq for PcrSelections[src]

impl From<PcrSelections> for TPML_PCR_SELECTION[src]

impl PartialEq<PcrSelections> for PcrSelections[src]

impl StructuralEq for PcrSelections[src]

impl StructuralPartialEq for PcrSelections[src]

impl TryFrom<TPML_PCR_SELECTION> for PcrSelections[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Free for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.