Botan 3.6.1
Crypto and TLS for C&
|
Namespaces | |
namespace | detail |
Classes | |
class | AttributeWrapper |
class | Context |
struct | CryptoCallbackState |
class | EC_PrivateKey |
class | EC_PublicKey |
class | Error |
struct | esys_liberator |
class | HashFunction |
class | Object |
struct | ObjectAttributes |
struct | ObjectHandles |
class | ObjectSetter |
class | PrivateKey |
struct | PropMap |
struct | PublicInfo |
class | PublicKey |
class | RandomNumberGenerator |
class | RSA_PrivateKey |
class | RSA_PublicKey |
class | Session |
struct | SessionAttributes |
class | SessionBundle |
class | Signature_Operation |
class | Signature_Operation_Base |
struct | SignatureAlgorithmSelection |
class | Verification_Operation |
Concepts | |
concept | tpm2_buffer |
Typedefs | |
using | TPMA_SESSION = uint8_t |
template<typename T > | |
using | unique_esys_ptr = std::unique_ptr<T, esys_liberator> |
A unique pointer type for ESYS handles that automatically frees the handle. | |
Functions | |
constexpr auto | as_span (tpm2_buffer auto &data) |
Construct a std::span as a view into a TPM2 buffer. | |
constexpr auto | as_span (tpm2_buffer auto &data, size_t length) |
std::optional< TPM2_ALG_ID > | asymmetric_algorithm_botan_to_tss2 (std::string_view algo_name) noexcept |
std::optional< std::pair< TPMI_ALG_SYM, TPM2_KEY_BITS > > | block_cipher_botan_to_tss2 (std::string_view cipher_name) noexcept |
std::optional< std::string > | block_cipher_tss2_to_botan (TPMI_ALG_SYM cipher_id, TPM2_KEY_BITS key_bits) noexcept |
constexpr void | check_rc (std::string_view location, TSS2_RC rc) |
template<TSS2_RC... expected_errors> requires (sizeof...(expected_errors) > 0) | |
constexpr TSS2_RC | check_rc_expecting (std::string_view location, TSS2_RC rc) |
std::optional< TPMT_SYM_DEF > | cipher_botan_to_tss2 (std::string_view algo_name) |
std::optional< TPMI_ALG_SYM_MODE > | cipher_mode_botan_to_tss2 (std::string_view mode_name) noexcept |
std::optional< std::string > | cipher_mode_tss2_to_botan (TPMI_ALG_SYM_MODE mode_id) |
std::optional< std::string > | cipher_tss2_to_botan (TPMT_SYM_DEF cipher_def) noexcept |
template<concepts::resizable_byte_buffer OutT> | |
constexpr OutT | copy_into (const tpm2_buffer auto &data) |
template<tpm2_buffer T> | |
constexpr T | copy_into (std::span< const uint8_t > data) |
template<tpm2_buffer T> | |
constexpr void | copy_into (T &dest, std::span< const uint8_t > data) |
std::optional< size_t > | curve_id_order_byte_size (TPMI_ECC_CURVE curve_id) |
std::optional< std::string > | curve_id_tss2_to_botan (TPMI_ECC_CURVE mode_id) |
void | enable_crypto_callbacks (const std::shared_ptr< Context > &ctx) |
std::string | get_botan_hash_name (TPM2_ALG_ID hash_id) |
TSS2_RC | get_raw_rc (TSS2_RC rc) |
std::optional< TPM2_ECC_CURVE > | get_tpm2_curve_id (const OID &curve_oid) |
TPMI_ALG_HASH | get_tpm2_hash_type (std::string_view hash_name) |
TPMT_SYM_DEF | get_tpm2_sym_cipher_spec (std::string_view algo_name) |
std::optional< TPMI_ALG_HASH > | hash_algo_botan_to_tss2 (std::string_view hash_name) noexcept |
std::optional< std::string > | hash_algo_tss2_to_botan (TPMI_ALG_HASH hash_id) noexcept |
template<tpm2_buffer T> | |
constexpr T | init_empty () |
Create an empty TPM2 buffer of the given type. | |
constexpr auto | out_persistent_handle (Object &object) |
constexpr auto | out_transient_handle (Object &object) |
template<typename MaskT , typename FieldPointerT > | |
PropMap (MaskT, FieldPointerT) -> PropMap< MaskT, FieldPointerT > | |
Deduction guide to simplify the creation of PropMap instances. | |
std::optional< TPMI_ALG_ASYM_SCHEME > | rsa_encryption_padding_botan_to_tss2 (std::string_view name) noexcept |
std::optional< TPMT_RSA_DECRYPT > | rsa_encryption_scheme_botan_to_tss2 (std::string_view padding) |
std::optional< TPMI_ALG_SIG_SCHEME > | rsa_signature_padding_botan_to_tss2 (std::string_view padding_name) noexcept |
std::optional< TPMT_SIG_SCHEME > | rsa_signature_scheme_botan_to_tss2 (std::string_view name) |
using Botan::TPM2::TPMA_SESSION = uint8_t |
Definition at line 20 of file tpm2_session.h.
using Botan::TPM2::unique_esys_ptr = std::unique_ptr<T, esys_liberator> |
A unique pointer type for ESYS handles that automatically frees the handle.
Definition at line 154 of file tpm2_util.h.
|
constexpr |
Construct a std::span as a view into a TPM2 buffer.
Definition at line 102 of file tpm2_util.h.
Referenced by as_span(), copy_into(), copy_into(), Botan::TPM2::PrivateKey::create_transient_from_template(), Botan::TPM2::Verification_Operation::is_valid_signature(), and Botan::TPM2::Signature_Operation::sign().
|
constexpr |
Set the size of data
to length
and construct a std::span as a view into data
Definition at line 108 of file tpm2_util.h.
References as_span(), and BOTAN_ASSERT_NOMSG.
|
inlinenodiscardnoexcept |
Definition at line 26 of file tpm2_algo_mappings.h.
Referenced by Botan::TPM2::Context::supports_algorithm().
|
inlinenodiscardnoexcept |
Definition at line 159 of file tpm2_algo_mappings.h.
Referenced by cipher_botan_to_tss2(), and Botan::TPM2::Context::supports_algorithm().
|
inlinenodiscardnoexcept |
Definition at line 120 of file tpm2_algo_mappings.h.
Referenced by cipher_tss2_to_botan().
|
constexpr |
Check the return code and throw an exception if some error occured.
TPM2::Error | if an error occured. |
Definition at line 54 of file tpm2_util.h.
Referenced by Botan::TPM2::Object::_public_info(), Botan::TPM2::Session::attributes(), Botan::TPM2::Session::authenticated_session(), check_rc_expecting(), Botan::TPM2::PrivateKey::create_transient_from_template(), enable_crypto_callbacks(), Botan::TPM2::Context::evict(), Botan::TPM2::HashFunction::final_with_ticket(), Botan::TPM2::PrivateKey::load_transient(), Botan::TPM2::PublicKey::load_transient(), Botan::TPM2::Context::persist(), Botan::TPM2::Session::set_attributes(), Botan::TPM2::Signature_Operation::sign(), Botan::TPM2::Session::tpm_nonce(), and Botan::TPM2::Session::unauthenticated_session().
|
nodiscardconstexpr |
Check the return code and throw an exception if an unexpected error occured.
Errors that are listed in the expected_errors
parameter are considered expected and will not cause an exception to be thrown. Instead the error code is decoded and returned to the caller for further processing.
TPM2::Error | if an unexpected error occured. |
Definition at line 72 of file tpm2_util.h.
References check_rc(), and get_raw_rc().
Referenced by Botan::TPM2::Verification_Operation::is_valid_signature().
|
inlinenodiscard |
Definition at line 296 of file tpm2_algo_mappings.h.
References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_count(), block_cipher_botan_to_tss2(), and cipher_mode_botan_to_tss2().
Referenced by get_tpm2_sym_cipher_spec(), and Botan::TPM2::Context::supports_algorithm().
|
inlinenodiscardnoexcept |
Definition at line 262 of file tpm2_algo_mappings.h.
Referenced by cipher_botan_to_tss2(), and Botan::TPM2::Context::supports_algorithm().
|
inlinenodiscard |
Definition at line 182 of file tpm2_algo_mappings.h.
Referenced by cipher_tss2_to_botan().
|
inlinenodiscardnoexcept |
cipher_id
, key_bits
and mode_name
are known, otherwise std::nullopt Definition at line 282 of file tpm2_algo_mappings.h.
References block_cipher_tss2_to_botan(), cipher_mode_tss2_to_botan(), and Botan::fmt().
|
constexpr |
Copy the content of the TPM2 buffer data
into a new resizable byte buffer of the user's choosing.
Definition at line 133 of file tpm2_util.h.
References as_span(), and Botan::copy_mem().
|
constexpr |
Create a TPM2 buffer from the provided data
, assuming that the provided data
is not larger than the capacity of the buffer type.
Definition at line 124 of file tpm2_util.h.
References copy_into(), and T.
|
constexpr |
Copy the data
into the TPM2 buffer dest
, assuming that the provided data
is not larger than the capacity of the buffer.
Definition at line 117 of file tpm2_util.h.
References as_span(), and Botan::copy_mem().
Referenced by copy_into(), Botan::TPM2::EC_PrivateKey::create_unrestricted_transient(), Botan::TPM2::RSA_PrivateKey::create_unrestricted_transient(), Botan::TPM2::PrivateKey::load_transient(), Botan::TPM2::Context::persist(), and Botan::TPM2::Session::tpm_nonce().
|
inlinenodiscard |
Definition at line 221 of file tpm2_algo_mappings.h.
|
inlinenodiscard |
Definition at line 199 of file tpm2_algo_mappings.h.
void Botan::TPM2::enable_crypto_callbacks | ( | const std::shared_ptr< Context > & | ctx | ) |
Enable the Botan crypto callbacks for the given ESYS context.
The callbacks may maintain two types of state:
The runtime crypto backend is available since TSS2 4.0.0 and later. Explicit support for SM4 was added in TSS2 4.1.0.
Note that the callback implementations should be defensive in regard to the input parameters. All pointers should be checked for nullptr before being dereferenced. Some output parameters (e.g. out-buffer lengths) may be regarded as optional, and should be checked for nullptr before being written to.
Error code conventions:
Enable Botan's crypto callbacks in the TPM2-TSS for the given context
.
Not_Implemented | if the TPM2-TSS does not support crypto callbacks. |
Definition at line 867 of file tpm2_crypto_backend.cpp.
References BOTAN_ASSERT_NONNULL, BOTAN_UNUSED, check_rc(), and init.
Referenced by Botan::TPM2::Context::use_botan_crypto_backend().
|
inlinenodiscard |
hash_id
value is known, otherwise throws Invalid_State Definition at line 112 of file tpm2_algo_mappings.h.
References hash_algo_tss2_to_botan().
Referenced by Botan::TPM2::HashFunction::name().
Definition at line 18 of file tpm2_error.cpp.
References Botan::fmt().
Referenced by check_rc_expecting().
|
inlinenodiscard |
Definition at line 240 of file tpm2_algo_mappings.h.
References Botan::OID::to_formatted_string().
Referenced by Botan::TPM2::EC_PrivateKey::create_unrestricted_transient().
|
inlinenodiscard |
hash_name
is known, otherwise throws Lookup_Error Definition at line 73 of file tpm2_algo_mappings.h.
References hash_algo_botan_to_tss2().
Referenced by Botan::TPM2::Session::authenticated_session(), and Botan::TPM2::Session::unauthenticated_session().
|
inlinenodiscard |
Definition at line 316 of file tpm2_algo_mappings.h.
References cipher_botan_to_tss2().
Referenced by Botan::TPM2::Session::authenticated_session(), and Botan::TPM2::Session::unauthenticated_session().
|
inlinenodiscardnoexcept |
hash_name
is known, otherwise std::nullopt Definition at line 47 of file tpm2_algo_mappings.h.
Referenced by get_tpm2_hash_type(), rsa_encryption_scheme_botan_to_tss2(), rsa_signature_scheme_botan_to_tss2(), and Botan::TPM2::Context::supports_algorithm().
|
inlinenodiscardnoexcept |
hash_id
value is known, otherwise std::nullopt Definition at line 85 of file tpm2_algo_mappings.h.
Referenced by get_botan_hash_name().
|
constexpr |
Create an empty TPM2 buffer of the given type.
Definition at line 142 of file tpm2_util.h.
References T.
Referenced by Botan::TPM2::EC_PrivateKey::create_unrestricted_transient(), Botan::TPM2::RSA_PrivateKey::create_unrestricted_transient(), Botan::TPM2::HashFunction::final_with_ticket(), and Botan::TPM2::Signature_Operation::sign().
|
constexpr |
Helper to set the persistent handle of an object from a TSS2 library function's out parameter.
Definition at line 215 of file tpm2_util.h.
Referenced by Botan::TPM2::Context::persist().
|
constexpr |
Helper to set the transient handle of an object from a TSS2 library function's out parameter.
Definition at line 209 of file tpm2_util.h.
Referenced by Botan::TPM2::Session::authenticated_session(), Botan::TPM2::PrivateKey::create_transient_from_template(), Botan::TPM2::PrivateKey::load_transient(), Botan::TPM2::PublicKey::load_transient(), Botan::TPM2::Context::persist(), and Botan::TPM2::Session::unauthenticated_session().
Botan::TPM2::PropMap | ( | MaskT | , |
FieldPointerT | ) -> PropMap< MaskT, FieldPointerT > |
Deduction guide to simplify the creation of PropMap instances.
|
inlinenodiscardnoexcept |
Definition at line 360 of file tpm2_algo_mappings.h.
References name.
Referenced by rsa_encryption_scheme_botan_to_tss2(), and Botan::TPM2::Context::supports_algorithm().
|
inlinenodiscard |
Definition at line 373 of file tpm2_algo_mappings.h.
References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_count(), hash_algo_botan_to_tss2(), and rsa_encryption_padding_botan_to_tss2().
Referenced by Botan::TPM2::Context::supports_algorithm().
|
inlinenodiscardnoexcept |
Definition at line 324 of file tpm2_algo_mappings.h.
Referenced by rsa_signature_scheme_botan_to_tss2(), and Botan::TPM2::Context::supports_algorithm().
|
inlinenodiscard |
Definition at line 337 of file tpm2_algo_mappings.h.
References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_count(), hash_algo_botan_to_tss2(), name, and rsa_signature_padding_botan_to_tss2().
Referenced by Botan::TPM2::Context::supports_algorithm().