Botan 3.6.1
Crypto and TLS for C&
|
#include <tpm2_object.h>
Public Member Functions | |
void | _disengage () noexcept |
Reset the object's internal state without flushing its TPM handles. | |
PublicInfo & | _public_info (const SessionBundle &sessions, std::optional< TPMI_ALG_PUBLIC > expected_type={}) const |
void | _reset () noexcept |
Flush the object's TPM handles and reset its internal state. | |
ObjectAttributes | attributes (const SessionBundle &sessions) const |
const std::shared_ptr< Context > & | context () const |
bool | has_persistent_handle () const |
bool | has_transient_handle () const |
Object (const Object &)=delete | |
Object (Object &&other) noexcept | |
Object (std::shared_ptr< Context > ctx) | |
Object (std::shared_ptr< Context > ctx, ESYS_TR handle) | |
Object & | operator= (const Object &)=delete |
Object & | operator= (Object &&other) noexcept |
TPM2_HANDLE | persistent_handle () const |
ESYS_TR | transient_handle () const noexcept |
virtual | ~Object () |
Friends | |
class | ObjectSetter |
Wraps and manages the lifetime of TPM2 object handles both for transient and persistent objects. When this object is destroyed, the handles are released accordingly.
Note that some TSS2 library functions may internally release handles passed to them. In such cases, the Object instance can be disengaged, ensuring that the handles are not released twice. This is an internal functionality and should not be used directly.
Definition at line 85 of file tpm2_object.h.
|
explicit |
Definition at line 48 of file tpm2_object.cpp.
References BOTAN_ASSERT_NONNULL.
Create an object wrapper from a user-provided transient handle.
Use this to wrap an externally created transient object handle into a Botan::TPM2::Object instance. This is useful when the object is created by the application and not by the Botan::TPM2 library.
Note that this will take ownership of the ESYS_TR handle and will release it when the object is destroyed.
ctx | the TPM context to use |
handle | the transient handle to wrap |
Definition at line 52 of file tpm2_object.cpp.
|
virtual |
Definition at line 63 of file tpm2_object.cpp.
|
delete |
|
noexcept |
Definition at line 56 of file tpm2_object.cpp.
|
noexcept |
Reset the object's internal state without flushing its TPM handles.
Definition at line 107 of file tpm2_object.cpp.
Referenced by _reset(), and Botan::TPM2::HashFunction::final_with_ticket().
PublicInfo & Botan::TPM2::Object::_public_info | ( | const SessionBundle & | sessions, |
std::optional< TPMI_ALG_PUBLIC > | expected_type = {} ) const |
Definition at line 134 of file tpm2_object.cpp.
References BOTAN_ASSERT_NONNULL, BOTAN_STATE_CHECK, Botan::TPM2::check_rc(), and Botan::out_ptr().
Referenced by attributes(), Botan::TPM2::PrivateKey::create(), Botan::TPM2::PublicKey::create(), Botan::TPM2::PrivateKey::raw_public_key_bits(), and Botan::TPM2::PublicKey::raw_public_key_bits().
|
noexcept |
Flush the object's TPM handles and reset its internal state.
Definition at line 101 of file tpm2_object.cpp.
References _disengage().
Referenced by Botan::TPM2::HashFunction::clear().
ObjectAttributes Botan::TPM2::Object::attributes | ( | const SessionBundle & | sessions | ) | const |
Definition at line 129 of file tpm2_object.cpp.
References _public_info(), Botan::TPM2::PublicInfo::pub, and Botan::TPM2::ObjectAttributes::read().
Referenced by Botan::TPM2::PrivateKey::is_parent().
|
inline |
Definition at line 110 of file tpm2_object.h.
Referenced by Botan::TPM2::Session::attributes(), Botan::TPM2::HashFunction::final_with_ticket(), Botan::TPM2::HashFunction::new_object(), Botan::TPM2::Session::set_attributes(), and Botan::TPM2::Session::tpm_nonce().
bool Botan::TPM2::Object::has_persistent_handle | ( | ) | const |
Definition at line 112 of file tpm2_object.cpp.
Referenced by Botan::TPM2::PrivateKey::create(), Botan::TPM2::PublicKey::create(), persistent_handle(), and Botan::TPM2::PrivateKey::raw_private_key_bits().
bool Botan::TPM2::Object::has_transient_handle | ( | ) | const |
Definition at line 116 of file tpm2_object.cpp.
Referenced by Botan::TPM2::PrivateKey::create_transient_from_template(), and Botan::TPM2::HashFunction::final_with_ticket().
Definition at line 69 of file tpm2_object.cpp.
TPM2_HANDLE Botan::TPM2::Object::persistent_handle | ( | ) | const |
Definition at line 120 of file tpm2_object.cpp.
References BOTAN_STATE_CHECK, and has_persistent_handle().
|
noexcept |
Definition at line 125 of file tpm2_object.cpp.
Referenced by Botan::TPM2::Session::attributes(), Botan::TPM2::Session::authenticated_session(), Botan::TPM2::EC_PrivateKey::create_unrestricted_transient(), Botan::TPM2::RSA_PrivateKey::create_unrestricted_transient(), Botan::TPM2::HashFunction::final_with_ticket(), Botan::TPM2::PrivateKey::load_transient(), Botan::TPM2::Session::set_attributes(), and Botan::TPM2::Session::tpm_nonce().
|
friend |
Definition at line 125 of file tpm2_object.h.