10#include <botan/internal/xmss_hash.h>
12#include <botan/exceptn.h>
13#include <botan/xmss_parameters.h>
14#include <botan/internal/fmt.h>
19 m_hash(hash.m_hash->new_object()),
20 m_msg_hash(hash.m_msg_hash->new_object()),
21 m_zero_padding(hash.m_zero_padding) {}
24 m_hash(
HashFunction::create(params.hash_function_name())),
25 m_msg_hash(
HashFunction::create(params.hash_function_name())),
26 m_zero_padding(params.hash_id_size() - 1 ) {
27 if(!m_hash || !m_msg_hash) {
31 BOTAN_ASSERT(m_hash->output_length() > 0,
"Hash output length of zero is invalid.");
35 std::span<const uint8_t>
root,
36 std::span<const uint8_t> index_bytes) {
38 m_msg_hash->update(m_zero_padding);
39 m_msg_hash->update(0x02);
40 m_msg_hash->update(randomness.data(), randomness.size());
41 m_msg_hash->update(
root.data(),
root.size());
42 m_msg_hash->update(index_bytes.data(), index_bytes.size());
46 m_msg_hash->update(data.data(), data.size());
50 return m_msg_hash->final();
#define BOTAN_ASSERT(expr, assertion_made)
secure_vector< uint8_t > h_msg_final()
void h_msg_update(std::span< const uint8_t > data)
XMSS_Hash(const XMSS_Parameters ¶ms)
void h_msg_init(std::span< const uint8_t > randomness, std::span< const uint8_t > root, std::span< const uint8_t > index_bytes)
const std::string & hash_function_name() const
Gf448Elem root(const Gf448Elem &elem)
Compute the root of elem in the field.
std::string fmt(std::string_view format, const T &... args)
std::vector< T, secure_allocator< T > > secure_vector