unsafe fn find_default_context_cipher(&self) -> std::io::Result<Cipher> {
        let ciphers = [Cipher::aes_256_cfb(), Cipher::aes_128_cfb()];
        let mut ctx = tss_esapi::Context::new(
            Tcti::from_str(self.tcti.as_ref().ok_or_else(|| {
                std::io::Error::new(ErrorKind::InvalidData, "Invalid TCTI configuration string")
            })?)
            .map_err(|_| {
                std::io::Error::new(ErrorKind::InvalidData, "Invalid TCTI configuration string")
            })?,
        )
        .map_err(|e| {
            format_error!("Error when creating TSS Context", e);
            std::io::Error::new(ErrorKind::InvalidData, "failed initializing TSS context")
        })?;
        for cipher in ciphers.iter() {
            if ctx
                .test_parms(tss_esapi::utils::PublicParmsUnion::SymDetail(*cipher))
                .is_ok()
            {
                return Ok(*cipher);
            }
        }
        Err(std::io::Error::new(
            ErrorKind::Other,
            "desired ciphers not supported by TPM",
        ))
    }
/// Identify the best cipher for our needs supported by the TPM.
///
/// The algorithms sought are the following, in the given order:
/// * AES-256 in CFB mode
/// * AES-128 in CFB mode
///
/// The method is unsafe because it relies on creating a TSS Context which could cause
/// undefined behaviour if multiple such contexts are opened concurrently.
Identify the best cipher for our needs supported by the TPM.
The algorithms sought are the following, in the given order:
AES-256 in CFB mode
AES-128 in CFB mode

The method is unsafe because it relies on creating a TSS Context which could cause
undefined behaviour if multiple such contexts are opened concurrently.
Identify the best cipher for our needs supported by the TPM . The algorithms sought are the following in the given order : AES - 256 in CFB mode AES - 128 in CFB mode The method is unsafe because it relies on creating a TSS Context which could cause undefined behaviour if multiple such contexts are opened concurrently .
unsafe fn find_default_context_cipher(&self) -> std::io::Result<Cipher> {
        let ciphers = [Cipher::aes_256_cfb(), Cipher::aes_128_cfb()];
        let mut ctx = tss_esapi::Context::new(
            Tcti::from_str(self.tcti.as_ref().ok_or_else(|| {
                std::io::Error::new(ErrorKind::InvalidData, "Invalid TCTI configuration string")
            })?)
            .map_err(|_| {
                std::io::Error::new(ErrorKind::InvalidData, "Invalid TCTI configuration string")
            })?,
        )
        .map_err(|e| {
            format_error!("Error when creating TSS Context", e);
            std::io::Error::new(ErrorKind::InvalidData, "failed initializing TSS context")
        })?;
        for cipher in ciphers.iter() {
            if ctx
                .test_parms(tss_esapi::utils::PublicParmsUnion::SymDetail(*cipher))
                .is_ok()
            {
                return Ok(*cipher);
            }
        }
        Err(std::io::Error::new(
            ErrorKind::Other,
            "desired ciphers not supported by TPM",
        ))
    }
unsafe fn find_default_context_cipher ( & self ) -> std :: io :: Result < Cipher > { let ciphers = [ Cipher :: aes_256_cfb ( ) , Cipher :: aes_128_cfb ( ) ] ; let mut ctx = tss_esapi :: Context :: new ( Tcti :: from_str ( self . tcti . as_ref ( ) . ok_or_else ( | | { std :: io :: Error :: new ( ErrorKind :: InvalidData , " " ) } ) ? ) . map_err ( | _ | { std :: io :: Error :: new ( ErrorKind :: InvalidData , " " ) } ) ? , ) . map_err ( | e | { format_error ! ( " " e ) ; std :: io :: Error :: new ( ErrorKind :: InvalidData , " " ) } ) ? ; for cipher in ciphers . iter ( ) { if ctx . test_parms ( tss_esapi :: utils :: PublicParmsUnion :: SymDetail ( * cipher ) ) . is_ok ( ) { return Ok ( * cipher ) ; } } Err ( std :: io :: Error :: new ( ErrorKind :: Other , " " , ) ) }
Identify the best cipher for our needs supported by the TPM.
Identify the best cipher for our needs supported by the TPM .
&self
&self