Botan 3.9.0
Crypto and TLS for C&
Botan::TPM2::detail::SessionHandle Class Referencefinal

#include <tpm2_session.h>

Public Member Functions

 operator ESYS_TR () &&noexcept
SessionHandleoperator= (const SessionHandle &)=delete
SessionHandleoperator= (SessionHandle &&)=delete
 SessionHandle ()=default
 SessionHandle (const SessionHandle &)=delete
 SessionHandle (SessionHandle &&)=delete
 ~SessionHandle ()

Friends

class Botan::TPM2::Session

Detailed Description

This wraps a Session object and ensures that the session's attributes are restored to their original state after they have been modified by a (failing) TSS2 library function.

This is a workaround for the fact that TSS2 library calls may modify the session's attributes and not reset them when the call fails.

Definition at line 62 of file tpm2_session.h.

Constructor & Destructor Documentation

◆ SessionHandle() [1/3]

Botan::TPM2::detail::SessionHandle::SessionHandle ( )
default

◆ SessionHandle() [2/3]

Botan::TPM2::detail::SessionHandle::SessionHandle ( const SessionHandle & )
delete

References SessionHandle().

◆ SessionHandle() [3/3]

Botan::TPM2::detail::SessionHandle::SessionHandle ( SessionHandle && )
delete

References SessionHandle().

◆ ~SessionHandle()

Botan::TPM2::detail::SessionHandle::~SessionHandle ( )

Definition at line 130 of file tpm2_session.cpp.

130 {
131 try {
132 if(m_session) {
133 m_session->get().set_attributes(m_original_attributes);
134 }
135 } catch(...) {}
136}

Member Function Documentation

◆ operator ESYS_TR()

Botan::TPM2::detail::SessionHandle::operator ESYS_TR ( ) &&
nodiscardnoexcept

Definition at line 138 of file tpm2_session.cpp.

138 {
139 if(m_session) {
140 return m_session->get().transient_handle();
141 } else {
142 return ESYS_TR_NONE;
143 }
144}

◆ operator=() [1/2]

SessionHandle & Botan::TPM2::detail::SessionHandle::operator= ( const SessionHandle & )
delete

References SessionHandle().

◆ operator=() [2/2]

SessionHandle & Botan::TPM2::detail::SessionHandle::operator= ( SessionHandle && )
delete

References SessionHandle().

◆ Botan::TPM2::Session

friend class Botan::TPM2::Session
friend

Definition at line 77 of file tpm2_session.h.

References Botan::TPM2::Session, and SessionHandle().

Referenced by Botan::TPM2::Session.


The documentation for this class was generated from the following files: