8#ifndef BOTAN_XMSS_HASH_H_
9#define BOTAN_XMSS_HASH_H_
11#include <botan/hash.h>
37 inline void calculate_hash(
const uint8_t hash_id,
39 std::span<const uint8_t> key,
40 std::span<const uint8_t> data) {
41 m_hash->update(m_zero_padding);
42 m_hash->update(hash_id);
43 m_hash->update(key.data(), key.size());
44 m_hash->update(data.data(), data.size());
45 m_hash->final(result);
58 calculate_hash(0x03, result, key, data);
73 std::span<const uint8_t> key,
74 std::span<const uint8_t> data) {
75 calculate_hash(0x04, result, key, data);
86 calculate_hash(0x00, result, key, data);
98 calculate_hash(0x01, result, key, data);
113 std::span<const uint8_t>
root,
114 std::span<const uint8_t> index_bytes,
115 std::span<const uint8_t> data) {
118 return m_msg_hash->final();
128 void h_msg_init(std::span<const uint8_t> randomness,
129 std::span<const uint8_t>
root,
130 std::span<const uint8_t> index_bytes);
150 std::unique_ptr<HashFunction> m_hash;
151 std::unique_ptr<HashFunction> m_msg_hash;
157 std::vector<uint8_t> m_zero_padding;
std::string hash_function() const
size_t output_length() const
XMSS_Hash & operator=(XMSS_Hash &&)=default
XMSS_Hash(XMSS_Hash &&hash)=default
secure_vector< uint8_t > h_msg_final()
void prf(secure_vector< uint8_t > &result, std::span< const uint8_t > key, std::span< const uint8_t > data)
void h_msg_update(std::span< const uint8_t > data)
void prf_keygen(secure_vector< uint8_t > &result, std::span< const uint8_t > key, std::span< const uint8_t > data)
secure_vector< uint8_t > h_msg(std::span< const uint8_t > randomness, std::span< const uint8_t > root, std::span< const uint8_t > index_bytes, std::span< const uint8_t > data)
XMSS_Hash(const XMSS_Parameters ¶ms)
void f(secure_vector< uint8_t > &result, std::span< const uint8_t > key, std::span< const uint8_t > data)
void h(secure_vector< uint8_t > &result, std::span< const uint8_t > key, std::span< const uint8_t > data)
XMSS_Hash & operator=(const XMSS_Hash &)=delete
void h_msg_init(std::span< const uint8_t > randomness, std::span< const uint8_t > root, std::span< const uint8_t > index_bytes)
int(* final)(unsigned char *, CTX *)
Gf448Elem root(const Gf448Elem &elem)
Compute the root of elem in the field.
std::vector< T, secure_allocator< T > > secure_vector