Botan 3.7.1
Crypto and TLS for C&
tpm2_crypto_backend.cpp
Go to the documentation of this file.
1/*
2* TPM 2 TSS crypto callbacks backend interface
3* (C) 2024 Jack Lloyd
4* (C) 2024 René Meusel, Amos Treiber - Rohde & Schwarz Cybersecurity GmbH, financed by LANCOM Systems GmbH
5*
6* Botan is released under the Simplified BSD License (see license.txt)
7*/
8
9#include <botan/tpm2_crypto_backend.h>
10
11#include <botan/internal/tpm2_crypto_backend_impl.h>
12#include <botan/internal/tpm2_util.h>
13
14namespace Botan::TPM2 {
15
16std::unique_ptr<CryptoCallbackState> use_botan_crypto_backend(
17 ESYS_CONTEXT* context, const std::shared_ptr<Botan::RandomNumberGenerator>& rng) {
18 auto crypto_callback_state = std::make_unique<CryptoCallbackState>(CryptoCallbackState{.rng = rng});
19 set_crypto_callbacks(context, crypto_callback_state.get());
20 return crypto_callback_state;
21}
22
24#if defined(BOTAN_TSS2_SUPPORTS_CRYPTO_CALLBACKS)
25 return true;
26#else
27 return false;
28#endif
29}
30
31} // namespace Botan::TPM2
#define BOTAN_PUBLIC_API(maj, min)
Definition api.h:19
bool supports_botan_crypto_backend() noexcept
std::unique_ptr< CryptoCallbackState > use_botan_crypto_backend(ESYS_CONTEXT *context, const std::shared_ptr< Botan::RandomNumberGenerator > &rng)
void set_crypto_callbacks(ESYS_CONTEXT *ctx, void *callback_state)