Botan 3.9.0
Crypto and TLS for C&
|
#include <tpm2_hash.h>
Public Member Functions | |
void | clear () override |
HashFunction * | clone () const |
std::unique_ptr< Botan::HashFunction > | copy_state () const override |
template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>> | |
T | final () |
void | final (std::span< uint8_t > out) |
template<concepts::resizable_byte_buffer T> | |
void | final (T &out) |
void | final (uint8_t out[]) |
std::vector< uint8_t > | final_stdvec () |
std::pair< unique_esys_ptr< TPM2B_DIGEST >, unique_esys_ptr< TPMT_TK_HASHCHECK > > | final_with_ticket () |
virtual size_t | hash_block_size () const |
HashFunction (std::shared_ptr< Context > ctx, std::string_view algorithm, TPMI_RH_HIERARCHY hierarchy=ESYS_TR_RH_NULL, SessionBundle sessions={}) | |
std::string | name () const override |
std::unique_ptr< Botan::HashFunction > | new_object () const override |
size_t | output_length () const override |
template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>> | |
T | process (const uint8_t in[], size_t length) |
template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>> | |
T | process (std::span< const uint8_t > in) |
template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>> | |
T | process (std::string_view in) |
virtual std::string | provider () const |
TPMI_ALG_HASH | type () const |
void | update (const uint8_t in[], size_t length) |
void | update (std::span< const uint8_t > in) |
void | update (std::string_view str) |
void | update (uint8_t in) |
void | update_be (uint16_t val) |
void | update_be (uint32_t val) |
void | update_be (uint64_t val) |
void | update_le (uint16_t val) |
void | update_le (uint32_t val) |
void | update_le (uint64_t val) |
Static Public Member Functions | |
static std::unique_ptr< HashFunction > | create (std::string_view algo_spec, std::string_view provider="") |
static std::unique_ptr< HashFunction > | create_or_throw (std::string_view algo_spec, std::string_view provider="") |
static std::vector< std::string > | providers (std::string_view algo_spec) |
Exposes the hashing capability of a TPM 2.0 device as a Botan::HashFunction. Typically this is used to obtain a TPMT_TK_HASHCHECK ticket after the hash operation has been completed. Otherwise, the HashFunction behaves like any other Botan::HashFunction.
Definition at line 29 of file tpm2_hash.h.
Botan::TPM2::HashFunction::HashFunction | ( | std::shared_ptr< Context > | ctx, |
std::string_view | algorithm, | ||
TPMI_RH_HIERARCHY | hierarchy = ESYS_TR_RH_NULL, | ||
SessionBundle | sessions = {} ) |
Definition at line 19 of file tpm2_hash.cpp.
References Botan::TPM2::get_tpm2_hash_type().
|
overridevirtual |
Reset the state.
Implements Botan::HashFunction.
Definition at line 55 of file tpm2_hash.cpp.
|
inlineinherited |
Definition at line 85 of file hash.h.
References new_object().
|
overridevirtual |
Not_Implemented | as copying state is not supported within the TPM |
Implements Botan::HashFunction.
Definition at line 59 of file tpm2_hash.cpp.
|
staticinherited |
Create an instance based on a name, or return null if the algo/provider combination cannot be found. If provider is empty then best available is chosen.
Definition at line 107 of file hash.cpp.
References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_as_integer(), Botan::SCAN_Name::arg_count(), create(), Botan::make_commoncrypto_hash(), and provider().
Referenced by botan_hash_init(), Botan::BlockCipher::create(), Botan::EME::create(), create(), Botan::KDF::create(), Botan::MessageAuthenticationCode::create(), Botan::PasswordHashFamily::create(), Botan::PBKDF::create(), Botan::SignaturePaddingScheme::create(), create_or_throw(), Botan::Certificate_Store_In_Memory::find_cert_by_pubkey_sha1(), and Botan::Certificate_Store_In_Memory::find_cert_by_raw_subject_dn_sha256().
|
staticinherited |
Create an instance based on a name If provider is empty then best available is chosen.
algo_spec | algorithm name |
provider | provider implementation to use Throws Lookup_Error if not found. |
Definition at line 298 of file hash.cpp.
References create(), and provider().
Referenced by botan_pubkey_fingerprint(), botan_pubkey_sm2_compute_za(), Botan::OCSP::CertID::CertID(), Botan::create_hex_fingerprint(), Botan::Sodium::crypto_hash_sha256(), Botan::Sodium::crypto_hash_sha512(), Botan::Bcrypt_PBKDF::derive_key(), Botan::ed25519_gen_keypair(), Botan::ed25519_sign(), Botan::ed25519_verify(), Botan::expand_message_xmd(), Botan::TLS::Handshake_Hash::final(), Botan::generate_dsa_primes(), Botan::LMOTS_Params::hash(), Botan::LMS_Params::hash(), Botan::Classic_McEliece_Parameters::hash_func(), Botan::OCSP::CertID::is_id_for(), Botan::TLS::make_hello_random(), Botan::Roughtime::nonce_from_blind(), Botan::PKCS1v15_Raw_SignaturePaddingScheme::PKCS1v15_Raw_SignaturePaddingScheme(), Botan::TLS::Transcript_Hash_State::set_algorithm(), Botan::RTSS_Share::split(), Botan::srp6_client_agree(), Botan::srp6_generate_verifier(), Botan::SRP6_Server_Session::step1(), Botan::SRP6_Server_Session::step2(), Botan::Cert_Extension::Subject_Key_ID::Subject_Key_ID(), and Botan::PK_Ops::Verification_with_Hash::Verification_with_Hash().
|
inlineinherited |
Complete the computation and retrieve the final result as a container of your choice.
Definition at line 77 of file buf_comp.h.
References output_length().
|
inherited |
Definition at line 54 of file buf_comp.cpp.
References BOTAN_ARG_CHECK, and output_length().
|
inlineinherited |
Definition at line 88 of file buf_comp.h.
References output_length().
|
inlineinherited |
Complete the computation and retrieve the final result.
out | The byte array to be filled with the result. Must be of length output_length() |
Definition at line 69 of file buf_comp.h.
References output_length().
Referenced by final_stdvec(), Botan::PseudorandomKeyGeneration::gen(), Botan::TPM2::Verification_Operation::is_valid_signature(), Botan::mgf1_mask(), Botan::KMAC::operator=(), Botan::pbkdf2(), Botan::Sphincs_Hash_Functions_Sha2::PRF_msg(), process(), process(), process(), Botan::TPM2::Signature_Operation::sign(), and Botan::sm2_compute_za().
|
inlineinherited |
std::pair< unique_esys_ptr< TPM2B_DIGEST >, unique_esys_ptr< TPMT_TK_HASHCHECK > > Botan::TPM2::HashFunction::final_with_ticket | ( | ) |
Finalize the hash operation and return the digest and the ticket as TSS2 structures.
Definition at line 102 of file tpm2_hash.cpp.
References BOTAN_ASSERT_NONNULL, BOTAN_STATE_CHECK, Botan::TPM2::check_rc(), Botan::TPM2::init_empty(), and Botan::out_ptr().
|
inlinevirtualinherited |
Reimplemented in Botan::BLAKE2b, Botan::BLAKE2s, Botan::Comb4P, Botan::GOST_34_11, Botan::Keccak_1600, Botan::MD4, Botan::MD5, Botan::RIPEMD_160, Botan::SHA_1, Botan::SHA_224, Botan::SHA_256, Botan::SHA_384, Botan::SHA_3, Botan::SHA_512, Botan::SHA_512_256, Botan::SHAKE_128, Botan::SHAKE_256, Botan::Skein_512, Botan::SM3, Botan::Streebog, and Botan::Whirlpool.
Definition at line 64 of file hash.h.
|
overridevirtual |
Implements Botan::HashFunction.
Definition at line 32 of file tpm2_hash.cpp.
References Botan::TPM2::get_botan_hash_name().
Referenced by new_object().
|
overridevirtual |
Implements Botan::HashFunction.
Definition at line 63 of file tpm2_hash.cpp.
References name().
|
overridevirtual |
Implements Botan::Buffered_Computation.
Definition at line 36 of file tpm2_hash.cpp.
|
inlineinherited |
Update and finalize computation. Does the same as calling update() and final() consecutively.
in | the input to process as a byte array |
length | the length of the byte array |
Definition at line 101 of file buf_comp.h.
References final(), and update().
Referenced by Botan::Kyber_Symmetric_Primitives::H(), Botan::Kyber_Symmetric_Primitives::H(), and Botan::Kyber_Symmetric_Primitives::H().
|
inlineinherited |
Update and finalize computation. Does the same as calling update() and final() consecutively.
in | the input to process as a contiguous container |
Definition at line 125 of file buf_comp.h.
|
inlineinherited |
Update and finalize computation. Does the same as calling update() and final() consecutively.
in | the input to process as a string |
Definition at line 113 of file buf_comp.h.
|
inlinevirtualinherited |
Reimplemented in Botan::Keccak_1600, Botan::SHA_1, Botan::SHA_224, Botan::SHA_256, Botan::SHA_384, Botan::SHA_3, Botan::SHA_512, Botan::SHA_512_256, Botan::SHAKE_128, and Botan::SHAKE_256.
Definition at line 49 of file hash.h.
Referenced by create(), and create_or_throw().
|
staticinherited |
algo_spec | algorithm name |
Definition at line 305 of file hash.cpp.
References Botan::probe_providers_of().
|
inline |
Definition at line 45 of file tpm2_hash.h.
|
inlineinherited |
Add new input to process.
in | the input to process as a byte array |
length | of param in in bytes |
Definition at line 34 of file buf_comp.h.
Referenced by Botan::PseudorandomKeyGeneration::gen(), Botan::LMOTS_Public_Key::LMOTS_Public_Key(), Botan::mgf1_mask(), Botan::pbkdf2(), Botan::Sphincs_Hash_Functions_Sha2::PRF_msg(), process(), process(), process(), Botan::TLS::TLS_NULL_HMAC_AEAD_Mode::set_associated_data_n(), and Botan::sm2_compute_za().
|
inlineinherited |
Add new input to process.
in | the input to process as a contiguous data range |
Definition at line 40 of file buf_comp.h.
|
inherited |
Add new input to process.
str | the input to process as a std::string_view. Will be interpreted as a byte array based on the strings encoding. |
Definition at line 14 of file buf_comp.cpp.
References Botan::as_span_of_bytes().
|
inlineinherited |
Process a single byte.
in | the byte to process |
Definition at line 61 of file buf_comp.h.
|
inherited |
Definition at line 18 of file buf_comp.cpp.
References Botan::store_be().
Referenced by Botan::mgf1_mask(), and Botan::pbkdf2().
|
inherited |
Definition at line 24 of file buf_comp.cpp.
References Botan::store_be().
|
inherited |
Definition at line 30 of file buf_comp.cpp.
References Botan::store_be().
|
inherited |
Definition at line 36 of file buf_comp.cpp.
References Botan::store_le().
|
inherited |
Definition at line 42 of file buf_comp.cpp.
References Botan::store_le().
|
inherited |
Definition at line 48 of file buf_comp.cpp.
References Botan::store_le().