Botan 3.6.1
Crypto and TLS for C&
Botan::TPM2::ObjectSetter Class Reference

#include <tpm2_util.h>

Public Member Functions

 ObjectSetter (const ObjectSetter &)=delete
 
constexpr ObjectSetter (Object &object, bool persistent=false)
 
 ObjectSetter (ObjectSetter &&)=delete
 
constexpr operator uint32_t * () &&noexcept
 
ObjectSetteroperator= (const ObjectSetter &)=delete
 
ObjectSetteroperator= (ObjectSetter &&)=delete
 
constexpr ~ObjectSetter () noexcept
 

Detailed Description

Helper type setting a TPM2_HANDLE or ESYS_TR on a given instance of Object from a TSS2 library function's out parameter.

This is not used directly, but through the out_transient_handle() and out_persistent_handle() respectively.

Definition at line 174 of file tpm2_util.h.

Constructor & Destructor Documentation

◆ ObjectSetter() [1/3]

Botan::TPM2::ObjectSetter::ObjectSetter ( Object & object,
bool persistent = false )
inlineconstexpr

Definition at line 176 of file tpm2_util.h.

176 :
177 m_object(object), m_persistent(persistent), m_handle(persistent ? 0 : ESYS_TR_NONE) {}

◆ ~ObjectSetter()

Botan::TPM2::ObjectSetter::~ObjectSetter ( )
inlineconstexprnoexcept

Definition at line 179 of file tpm2_util.h.

179 {
180 if(!was_written()) {
181 return;
182 }
183
184 if(m_persistent) {
185 m_object.handles().persistent = m_handle;
186 } else {
187 m_object.handles().transient = m_handle;
188 }
189 }
std::optional< TPM2_HANDLE > persistent
Definition tpm2_util.h:163

References Botan::TPM2::ObjectHandles::persistent, and Botan::TPM2::ObjectHandles::transient.

◆ ObjectSetter() [2/3]

Botan::TPM2::ObjectSetter::ObjectSetter ( const ObjectSetter & )
delete

◆ ObjectSetter() [3/3]

Botan::TPM2::ObjectSetter::ObjectSetter ( ObjectSetter && )
delete

Member Function Documentation

◆ operator uint32_t *()

Botan::TPM2::ObjectSetter::operator uint32_t * ( ) &&
inlinenodiscardconstexprnoexcept

Definition at line 196 of file tpm2_util.h.

196{ return &m_handle; }

◆ operator=() [1/2]

ObjectSetter & Botan::TPM2::ObjectSetter::operator= ( const ObjectSetter & )
delete

◆ operator=() [2/2]

ObjectSetter & Botan::TPM2::ObjectSetter::operator= ( ObjectSetter && )
delete

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