9#ifndef BOTAN_SP_HASH_H_
10#define BOTAN_SP_HASH_H_
12#include <botan/hash.h>
13#include <botan/sp_parameters.h>
14#include <botan/internal/sp_address.h>
15#include <botan/internal/sp_types.h>
37 std::tuple<SphincsHashedMessage, XmssTreeIndexInLayer, TreeNodeIndex>
H_msg(
56 template <
typename... BufferTs>
57 void T(std::span<uint8_t> out,
const Sphincs_Address& address,
const BufferTs&... in) {
58 auto& hash =
tweak_hash(address, (in.size() + ...));
59 (hash.update(in), ...);
63 template <
typename OutT = std::vector<u
int8_t>,
typename... BufferTs>
71 T(out, address, sk_seed);
75 T(out, address, sk_seed);
const SphincsPublicSeed & m_pub_seed
virtual HashFunction & tweak_hash(const Sphincs_Address &address, size_t input_length)=0
const Sphincs_Parameters & m_sphincs_params
Sphincs_Hash_Functions(const Sphincs_Parameters &sphincs_params, const SphincsPublicSeed &pub_seed)
OutT T(const Sphincs_Address &address, const BufferTs &... in)
void T(std::span< uint8_t > out, const Sphincs_Address &address, const BufferTs &... in)
virtual void PRF_msg(StrongSpan< SphincsMessageRandomness > out, StrongSpan< const SphincsSecretPRF > sk_prf, StrongSpan< const SphincsOptionalRandomness > opt_rand, const SphincsMessageInternal &msg)=0
std::tuple< SphincsHashedMessage, XmssTreeIndexInLayer, TreeNodeIndex > H_msg(StrongSpan< const SphincsMessageRandomness > r, const SphincsTreeNode &root, const SphincsMessageInternal &message)
virtual ~Sphincs_Hash_Functions()=default
static std::unique_ptr< Sphincs_Hash_Functions > create(const Sphincs_Parameters &sphincs_params, const SphincsPublicSeed &pub_seed)
virtual std::vector< uint8_t > H_msg_digest(StrongSpan< const SphincsMessageRandomness > r, const SphincsTreeNode &root, const SphincsMessageInternal &message)=0
void PRF(StrongSpan< WotsNode > out, const SphincsSecretSeed &sk_seed, const Sphincs_Address &address)
void PRF(StrongSpan< ForsLeafSecret > out, const SphincsSecretSeed &sk_seed, const Sphincs_Address &address)
virtual std::string msg_hash_function_name() const =0
Gf448Elem root(const Gf448Elem &elem)
Compute the root of elem in the field.
Strong< std::vector< uint8_t >, struct SphincsTreeNode_ > SphincsTreeNode
Either an XMSS or FORS tree node or leaf.
Strong< std::vector< uint8_t >, struct SphincsPublicSeed_ > SphincsPublicSeed
Strong< secure_vector< uint8_t >, struct SphincsSecretSeed_ > SphincsSecretSeed
M' representation of FIPS 205 (the input to slh_sign_internal and slh_verify_internal)