|
Botan 3.14.1
Crypto and TLS for C&
|
#include <hash_engine_mdx.h>
Public Types | |
| using | compress_fn = void (*)(uint8_t* states, const uint8_t* const* blocks, size_t nblocks) |
| using | extract_fn = void (*)(const uint8_t* states, uint8_t* digests) |
Public Member Functions | |
| void | batch_hash (std::span< std::span< uint8_t > > outputs, std::span< std::span< const uint8_t > > inputs) |
| void | batch_hash (std::span< std::span< uint8_t > > outputs, std::span< std::span< const uint8_t > > inputs1, std::span< std::span< const uint8_t > > inputs2) override |
| MDx_MB_Engine (std::string_view name, size_t output_length, std::span< const uint8_t > common_prefix, std::string_view provider, size_t lanes, size_t block_bytes, size_t ctr_bytes, std::span< const W > midstate, compress_fn compress, extract_fn extract) | |
| std::string | name () const override |
| size_t | output_length () const override |
| size_t | parallelism () const override |
| std::string | provider () const override |
| size_t | uncached_prefix_bytes () const override |
Static Public Member Functions | |
| static std::unique_ptr< Hash_Engine > | create_or_null (std::string_view hash_fn, std::span< const uint8_t > common_prefix={}, std::string_view provider="") |
| static std::unique_ptr< Hash_Engine > | create_or_throw (std::string_view hash_fn, std::span< const uint8_t > common_prefix={}, std::string_view provider="") |
| static std::vector< std::string > | possible_providers (std::string_view hash_fn) |
Protected Member Functions | |
| void | check_batch_args (std::span< std::span< uint8_t > > outputs, std::span< std::span< const uint8_t > > inputs1, std::span< std::span< const uint8_t > > inputs2) const |
| std::span< const uint8_t > | common_prefix () const |
Generic multi-buffer engine for big-endian Merkle-Damgard hashes
The states buffer passed to the compression function holds the 8 chaining variables for each lane, as little-endian words in variable-major order (all lanes of A, then all lanes of B, ...). blocks[l] points to the first of nblocks contiguous blocks for lane l.
The extract function transposes the states into digests, which holds the full (untruncated) big-endian digest of each lane in lane order.
Definition at line 33 of file hash_engine_mdx.h.
| using Botan::MDx_MB_Engine< W >::compress_fn = void (*)(uint8_t* states, const uint8_t* const* blocks, size_t nblocks) |
Definition at line 35 of file hash_engine_mdx.h.
| using Botan::MDx_MB_Engine< W >::extract_fn = void (*)(const uint8_t* states, uint8_t* digests) |
Definition at line 36 of file hash_engine_mdx.h.
|
inline |
Definition at line 38 of file hash_engine_mdx.h.
References BOTAN_ASSERT_NOMSG, Botan::Hash_Engine::common_prefix(), Botan::Hash_Engine::Hash_Engine(), name(), output_length(), provider(), and Botan::store_le().
|
inlineinherited |
Hash many inputs
Computes H(common_prefix || inputs[i]) into outputs[i]. Each input must be exactly identical length.
outputs[i] may alias inputs[i], but must not otherwise overlap any other input or output.
Definition at line 57 of file hash_engine.h.
References batch_hash().
Referenced by batch_hash(), and Botan::lmots_compute_pubkeys().
|
inlineoverridevirtual |
Hash many inputs, each formed from two parts
Computes H(common_prefix || inputs1[i] || inputs2[i]) into outputs[i]. All inputs1 must be exactly identical length, as must all inputs2. Alternately inputs2 may be an empty list.
outputs[i] may alias inputs1[i] and/or inputs2[i], but must not otherwise overlap any other input or output.
Implements Botan::Hash_Engine.
Definition at line 81 of file hash_engine_mdx.h.
References BOTAN_ARG_CHECK, BOTAN_ASSERT_NOMSG, Botan::Hash_Engine::check_batch_args(), Botan::checked_add(), Botan::clear_mem(), Botan::Hash_Engine::common_prefix(), Botan::copy_mem(), and Botan::store_be().
|
protectedinherited |
Verify the batch_hash argument contract, throwing Invalid_Argument if violated
Definition at line 248 of file hash_engine.cpp.
References BOTAN_ARG_CHECK, and output_length().
Referenced by Botan::MDx_MB_Engine< W >::batch_hash().
|
inlineprotectedinherited |
Definition at line 127 of file hash_engine.h.
Referenced by batch_hash(), Botan::MDx_MB_Engine< W >::batch_hash(), create_or_null(), create_or_throw(), Hash_Engine(), Botan::MDx_MB_Engine< W >::MDx_MB_Engine(), uncached_prefix_bytes(), and Botan::MDx_MB_Engine< W >::uncached_prefix_bytes().
|
staticinherited |
Create a new Hash_Engine
| hash_fn | the hash function to compute |
| common_prefix | implicitly prepended to each message hashed; implementations may precompute the resulting hash state |
| provider | if set, use this specific implementation |
Definition at line 268 of file hash_engine.cpp.
References common_prefix(), Botan::Thread_Pool::global_instance(), and provider().
Referenced by create_or_throw().
|
staticinherited |
Create a new Hash_Engine
| hash_fn | the hash function to compute |
| common_prefix | implicitly prepended to each message hashed; implementations may precompute the resulting hash state |
| provider | if set, use this specific implementation |
The default provider splits sufficiently large batches over the global Thread_Pool, whose threads are started on the first such batch, or over the executor installed with Work_Executor::set_global.
Throws Lookup_Error if the hash function or requested provider is not available
Definition at line 291 of file hash_engine.cpp.
References common_prefix(), create_or_null(), and provider().
Referenced by batch_hash(), Botan::create_shake_row_generator(), Botan::XMSS_Hash::f_batch(), Botan::XMSS_Hash::h_batch(), Botan::lmots_compute_pubkey_from_sig(), Botan::Kyber_Symmetric_Primitives::shake_XOF_batch(), Botan::LMOTS_Private_Key::sign(), and Botan::Sphincs_Hash_Functions_Sha2::Sphincs_Hash_Functions_Sha2().
|
inlineoverridevirtual |
Implements Botan::Hash_Engine.
Definition at line 71 of file hash_engine_mdx.h.
Referenced by MDx_MB_Engine().
|
inlineoverridevirtual |
Implements Botan::Hash_Engine.
Definition at line 75 of file hash_engine_mdx.h.
Referenced by MDx_MB_Engine().
|
inlineoverridevirtual |
Implements Botan::Hash_Engine.
Definition at line 77 of file hash_engine_mdx.h.
|
staticinherited |
Return a list of possible providers for this hash function
Definition at line 301 of file hash_engine.cpp.
References BOTAN_UNUSED.
|
inlineoverridevirtual |
Implements Botan::Hash_Engine.
Definition at line 73 of file hash_engine_mdx.h.
Referenced by MDx_MB_Engine().
|
inlineoverridevirtual |
Reimplemented from Botan::Hash_Engine.
Definition at line 79 of file hash_engine_mdx.h.
References Botan::Hash_Engine::common_prefix().