44 static std::shared_ptr<Context> create(
const std::string& tcti_nameconf);
52 static std::shared_ptr<Context> create(std::optional<std::string> tcti = {},
53 std::optional<std::string> conf = {});
75 void use_botan_crypto_backend(
const std::shared_ptr<Botan::RandomNumberGenerator>& rng);
83 static bool supports_botan_crypto_backend() noexcept;
86 bool uses_botan_crypto_backend() const noexcept;
89 ESYS_CONTEXT* esys_context() noexcept;
91 operator ESYS_CONTEXT*() noexcept {
return esys_context(); }
94 std::string vendor()
const;
97 std::string manufacturer()
const;
105 bool supports_algorithm(std::string_view algo_name)
const;
108 size_t max_random_bytes_per_request()
const;
110 std::vector<ESYS_TR> transient_handles()
const;
114 std::optional<TPM2_HANDLE> find_free_persistent_handle()
const;
116 std::vector<TPM2_HANDLE> persistent_handles()
const;
121 std::span<const uint8_t> auth_value = {},
122 std::optional<TPM2_HANDLE> persistent_handle = std::nullopt);
125 void evict(std::unique_ptr<TPM2::PrivateKey> key,
const SessionBundle& sessions);
129 std::unique_ptr<TPM2::PrivateKey> storage_root_key(std::span<const uint8_t> auth_value,
130 const SessionBundle& sessions);
133 Context(
const char* tcti_nameconf);
134 Context(
const char* tcti_name,
const char* tcti_conf);
136#if defined(BOTAN_HAS_TPM2_CRYPTO_BACKEND)
137 friend void enable_crypto_callbacks(
const std::shared_ptr<Context>&);
138 CryptoCallbackState& crypto_callback_state();
143 std::unique_ptr<Impl> m_impl;
Context & operator=(const Context &)=delete
Context(const Context &)=delete
Context & operator=(Context &&ctx) noexcept=default
Context(Context &&ctx) noexcept=default
uint32_t ESYS_TR
Forward declaration of TSS2 type for convenience.
uint32_t TPM2_HANDLE
Forward declaration of TSS2 type for convenience.