Botan 3.7.1
Crypto and TLS for C&
|
#include <botan/ffi.h>
#include <botan/internal/ffi_pkey.h>
#include <botan/internal/ffi_rng.h>
#include <botan/internal/ffi_util.h>
Go to the source code of this file.
Functions | |
int | botan_tpm2_crypto_backend_state_destroy (botan_tpm2_crypto_backend_state_t cbs) |
int | botan_tpm2_ctx_destroy (botan_tpm2_ctx_t ctx) |
int | botan_tpm2_ctx_enable_crypto_backend (botan_tpm2_ctx_t ctx, botan_rng_t rng) |
int | botan_tpm2_ctx_from_esys (botan_tpm2_ctx_t *ctx_out, ESYS_CONTEXT *esys_ctx) |
int | botan_tpm2_ctx_init (botan_tpm2_ctx_t *ctx_out, const char *tcti_nameconf) |
int | botan_tpm2_ctx_init_ex (botan_tpm2_ctx_t *ctx_out, const char *tcti_name, const char *tcti_conf) |
int | botan_tpm2_enable_crypto_backend (botan_tpm2_crypto_backend_state_t *cbs_out, ESYS_CONTEXT *esys_ctx, botan_rng_t rng) |
int | botan_tpm2_rng_init (botan_rng_t *rng_out, botan_tpm2_ctx_t ctx, botan_tpm2_session_t s1, botan_tpm2_session_t s2, botan_tpm2_session_t s3) |
int | botan_tpm2_session_destroy (botan_tpm2_session_t session) |
int | botan_tpm2_supports_crypto_backend () |
int | botan_tpm2_unauthenticated_session_init (botan_tpm2_session_t *session_out, botan_tpm2_ctx_t ctx) |
int botan_tpm2_crypto_backend_state_destroy | ( | botan_tpm2_crypto_backend_state_t | cbs | ) |
Frees all resouces of a TPM2 Crypto Callback State Note that this does not attempt to de-register the crypto backend, it just frees the resource pointed to by cbs
. Use the ESAPI function Esys_SetCryptoCallbacks(ctx, nullptr)
to deregister manually.
cbs | TPM2 Crypto Callback State |
Definition at line 207 of file ffi_tpm2.cpp.
References BOTAN_FFI_CHECKED_DELETE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and BOTAN_UNUSED.
int botan_tpm2_ctx_destroy | ( | botan_tpm2_ctx_t | ctx | ) |
Frees all resouces of a TPM2 context
ctx | TPM2 context |
Definition at line 175 of file ffi_tpm2.cpp.
References BOTAN_FFI_CHECKED_DELETE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and BOTAN_UNUSED.
int botan_tpm2_ctx_enable_crypto_backend | ( | botan_tpm2_ctx_t | ctx, |
botan_rng_t | rng ) |
Enable Botan's TSS2 crypto backend that replaces the cryptographic functions required for the communication with the TPM with implementations provided by Botan instead of using TSS' defaults OpenSSL or mbedTLS. Note that the provided rng
should not be dependent on the TPM and the caller must ensure that it remains usable for the lifetime of the ctx
.
ctx | TPM2 context |
rng | random number generator to be used by the crypto backend |
Definition at line 152 of file ffi_tpm2.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan_FFI::safe_get().
int botan_tpm2_ctx_from_esys | ( | botan_tpm2_ctx_t * | ctx_out, |
struct ESYS_CONTEXT * | esys_ctx ) |
Wrap an existing ESYS_CONTEXT for use in Botan. Note that destroying the created botan_tpm2_ctx_t won't finalize esys_ctx
ctx_out | output TPM2 context |
esys_ctx | ESYS_CONTEXT to wrap |
Definition at line 134 of file ffi_tpm2.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, Botan::TPM2::Context::create(), and Botan_FFI::ffi_guard_thunk().
int botan_tpm2_ctx_init | ( | botan_tpm2_ctx_t * | ctx_out, |
const char * | tcti_nameconf ) |
Initialize a TPM2 context
ctx_out | output TPM2 context |
tcti_nameconf | TCTI config (may be nullptr) |
Definition at line 74 of file ffi_tpm2.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, Botan::TPM2::Context::create(), and Botan_FFI::ffi_guard_thunk().
int botan_tpm2_ctx_init_ex | ( | botan_tpm2_ctx_t * | ctx_out, |
const char * | tcti_name, | ||
const char * | tcti_conf ) |
Initialize a TPM2 context
ctx_out | output TPM2 context |
tcti_name | TCTI name (may be nullptr) |
tcti_conf | TCTI config (may be nullptr) |
Definition at line 100 of file ffi_tpm2.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, Botan::TPM2::Context::create(), and Botan_FFI::ffi_guard_thunk().
int botan_tpm2_enable_crypto_backend | ( | botan_tpm2_crypto_backend_state_t * | cbs_out, |
struct ESYS_CONTEXT * | esys_ctx, | ||
botan_rng_t | rng ) |
Use this if you just need Botan's crypto backend but do not want to wrap any other ESYS functionality using Botan's TPM2 wrapper. A Crypto Backend State is created that the user needs to keep alive for as long as the crypto backend is used and needs to be destroyed after. Note that the provided rng
should not be dependent on the TPM and the caller must ensure that it remains usable for the lifetime of the esys_ctx
.
cbs_out | To be created Crypto Backend State |
esys_ctx | TPM2 context |
rng | random number generator to be used by the crypto backend |
Definition at line 184 of file ffi_tpm2.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_UNUSED, Botan_FFI::ffi_guard_thunk(), Botan_FFI::safe_get(), and Botan::TPM2::use_botan_crypto_backend().
int botan_tpm2_rng_init | ( | botan_rng_t * | rng_out, |
botan_tpm2_ctx_t | ctx, | ||
botan_tpm2_session_t | s1, | ||
botan_tpm2_session_t | s2, | ||
botan_tpm2_session_t | s3 ) |
Initialize a random number generator object via TPM2
rng_out | rng object to create |
ctx | TPM2 context |
s1 | the first session to use (optional, may be nullptr) |
s2 | the second session to use (optional, may be nullptr) |
s3 | the third session to use (optional, may be nullptr) |
Definition at line 216 of file ffi_tpm2.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, and BOTAN_UNUSED.
int botan_tpm2_session_destroy | ( | botan_tpm2_session_t | session | ) |
Create an unauthenticated session for use with TPM2
session | the session object to destroy |
Definition at line 255 of file ffi_tpm2.cpp.
References BOTAN_FFI_CHECKED_DELETE, BOTAN_FFI_ERROR_NOT_IMPLEMENTED, and BOTAN_UNUSED.
int botan_tpm2_supports_crypto_backend | ( | ) |
Checks if Botan's TSS2 crypto backend can be used in this build
Definition at line 66 of file ffi_tpm2.cpp.
References Botan::TPM2::Context::supports_botan_crypto_backend().
int botan_tpm2_unauthenticated_session_init | ( | botan_tpm2_session_t * | session_out, |
botan_tpm2_ctx_t | ctx ) |
Create an unauthenticated session for use with TPM2
session_out | the session object to create |
ctx | TPM2 context |
Definition at line 237 of file ffi_tpm2.cpp.
References BOTAN_FFI_ERROR_NOT_IMPLEMENTED, BOTAN_FFI_ERROR_NULL_POINTER, BOTAN_FFI_SUCCESS, BOTAN_FFI_VISIT, BOTAN_UNUSED, and Botan::TPM2::Session::unauthenticated_session().