Struct tss_esapi::structures::pcr_selection::PcrSelection
source · pub struct PcrSelection { /* private fields */ }
Expand description
This module contains the PcrSelection struct. The TSS counterpart of this struct is the TPMS_PCR_SELECTION.
Implementations§
source§impl PcrSelection
impl PcrSelection
sourcepub fn create(
hashing_algorithm: HashingAlgorithm,
size_of_select: PcrSelectSize,
selected_pcr_slots: &[PcrSlot]
) -> Result<Self>
pub fn create( hashing_algorithm: HashingAlgorithm, size_of_select: PcrSelectSize, selected_pcr_slots: &[PcrSlot] ) -> Result<Self>
Creates new PcrSelection
§Errors
Returns InconsistentParams error if a pcr slot
has been provided that ends up in an octet outside the
range specified by the size_of_select
parameter.
sourcepub const fn hashing_algorithm(&self) -> HashingAlgorithm
pub const fn hashing_algorithm(&self) -> HashingAlgorithm
Returns the hashing algorithm for the selection
sourcepub const fn size_of_select(&self) -> PcrSelectSize
pub const fn size_of_select(&self) -> PcrSelectSize
Returns ‘Size of Select’
NB! This is not the same as how many PcrSlot there are in the selection but rather how many octets that are needed to hold the bit field that indicate what slots that are selected.
sourcepub fn is_selected(&self, pcr_slot: PcrSlot) -> bool
pub fn is_selected(&self, pcr_slot: PcrSlot) -> bool
Returns true if the specified PcrSlot is selected in the PcrSelection.
sourcepub fn deselect_exact(&mut self, pcr_slot: PcrSlot) -> Result<()>
pub fn deselect_exact(&mut self, pcr_slot: PcrSlot) -> Result<()>
sourcepub fn deselect(&mut self, pcr_slot: PcrSlot)
pub fn deselect(&mut self, pcr_slot: PcrSlot)
Removes the specified PcrSlots from the selected pcrs.
sourcepub fn merge_exact(&mut self, other: &Self) -> Result<()>
pub fn merge_exact(&mut self, other: &Self) -> Result<()>
Merges another PcrSelection into self
if the
elements in the collection does not already exist
in self
.
§Constraints
- Cannot be called with
other
that has a hashing_algorithm that is different from the one inself
. - Cannot be called with
other
that has a size_of_select that is different from the one inself
. - Cannot be called with
other
that contains pcr slots present inself
.
§Errors
Returns InvalidParam if there is a hashing algorithm mismatch
Returns InvalidParam if there is size of select mismatch.
Returns InvalidParam if other
contains items that are present in self
sourcepub fn subtract_exact(&mut self, other: &Self) -> Result<()>
pub fn subtract_exact(&mut self, other: &Self) -> Result<()>
Removes the selected pcr slots in other
from self
if none
of the pcr slots are present in self
.
§Constraints
- Cannot be called with
other
that has a hashing_algorithm that is different from the one inself
. - Cannot be called with
other
that has a size_of_select that is different from the one inself
. - Cannot be called with
other
that contains pcr slots not present inself
.
Trait Implementations§
source§impl Clone for PcrSelection
impl Clone for PcrSelection
source§fn clone(&self) -> PcrSelection
fn clone(&self) -> PcrSelection
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PcrSelection
impl Debug for PcrSelection
source§impl From<PcrSelection> for TPMS_PCR_SELECTION
impl From<PcrSelection> for TPMS_PCR_SELECTION
source§fn from(pcr_selection: PcrSelection) -> Self
fn from(pcr_selection: PcrSelection) -> Self
source§impl PartialEq for PcrSelection
impl PartialEq for PcrSelection
source§fn eq(&self, other: &PcrSelection) -> bool
fn eq(&self, other: &PcrSelection) -> bool
self
and other
values to be equal, and is used
by ==
.