Botan 3.7.1
Crypto and TLS for C&
|
#include <sp_hash.h>
Public Member Functions | |
std::tuple< SphincsHashedMessage, XmssTreeIndexInLayer, TreeNodeIndex > | H_msg (StrongSpan< const SphincsMessageRandomness > r, const SphincsTreeNode &root, const SphincsMessageInternal &message) |
virtual std::string | msg_hash_function_name () const =0 |
void | PRF (StrongSpan< ForsLeafSecret > out, const SphincsSecretSeed &sk_seed, const Sphincs_Address &address) |
void | PRF (StrongSpan< WotsNode > out, const SphincsSecretSeed &sk_seed, const Sphincs_Address &address) |
virtual void | PRF_msg (StrongSpan< SphincsMessageRandomness > out, StrongSpan< const SphincsSecretPRF > sk_prf, StrongSpan< const SphincsOptionalRandomness > opt_rand, const SphincsMessageInternal &msg)=0 |
template<typename OutT = std::vector<uint8_t>, typename... BufferTs> | |
OutT | T (const Sphincs_Address &address, BufferTs &&... in) |
template<typename... BufferTs> | |
void | T (std::span< uint8_t > out, const Sphincs_Address &address, BufferTs &&... in) |
virtual | ~Sphincs_Hash_Functions ()=default |
Static Public Member Functions | |
static std::unique_ptr< Sphincs_Hash_Functions > | create (const Sphincs_Parameters &sphincs_params, const SphincsPublicSeed &pub_seed) |
Protected Member Functions | |
virtual std::vector< uint8_t > | H_msg_digest (StrongSpan< const SphincsMessageRandomness > r, const SphincsTreeNode &root, const SphincsMessageInternal &message)=0 |
Sphincs_Hash_Functions (const Sphincs_Parameters &sphincs_params, const SphincsPublicSeed &pub_seed) | |
virtual HashFunction & | tweak_hash (const Sphincs_Address &address, size_t input_length)=0 |
Protected Attributes | |
const SphincsPublicSeed & | m_pub_seed |
const Sphincs_Parameters & | m_sphincs_params |
A collection of pseudorandom hash functions required for SLH-DSA computations. See FIPS 205, Section 11.2.1 and 11.2.2.
|
virtualdefault |
|
protected |
Definition at line 30 of file sp_hash.cpp.
|
static |
Creates a Sphincs_Hash_Functions object instantiating the hash functions used for the specified sphincs_params
. The pub_seed
is used to seed the hash functions (possibly padded). This is pre-computed and the respective state is copied on the further calls on H(seed) with tweak_hash, i.e., T and PRF.
Definition at line 34 of file sp_hash.cpp.
References BOTAN_ASSERT_UNREACHABLE, Botan::Haraka, Botan::Sphincs_Parameters::hash_type(), Botan::Sha256, and Botan::Shake256.
Referenced by Botan::SphincsPlus_PrivateKey::SphincsPlus_PrivateKey().
std::tuple< SphincsHashedMessage, XmssTreeIndexInLayer, TreeNodeIndex > Botan::Sphincs_Hash_Functions::H_msg | ( | StrongSpan< const SphincsMessageRandomness > | r, |
const SphincsTreeNode & | root, | ||
const SphincsMessageInternal & | message ) |
Definition at line 78 of file sp_hash.cpp.
References BOTAN_ASSERT_NOMSG, Botan::BufferSlicer::copy(), Botan::BufferSlicer::empty(), H_msg_digest(), m_sphincs_params, Botan::root(), and Botan::BufferSlicer::take().
|
protectedpure virtual |
Referenced by H_msg().
|
pure virtual |
Implemented in Botan::Sphincs_Hash_Functions_Sha2, and Botan::Sphincs_Hash_Functions_Shake.
|
inline |
Definition at line 70 of file sp_hash.h.
References T.
Referenced by Botan::fors_sign_and_pkgen(), and Botan::wots_sign_and_pkgen().
|
inline |
|
pure virtual |
Using SK.PRF, the optional randomness, and a message, computes the message random R, and the tree and leaf indices.
out | output location for the message hash |
sk_prf | SK.PRF |
opt_rand | optional randomness |
msg | message |
Implemented in Botan::Sphincs_Hash_Functions_Sha2, and Botan::Sphincs_Hash_Functions_Shake.
|
inline |
|
inline |
Definition at line 57 of file sp_hash.h.
Referenced by Botan::compute_root(), Botan::fors_public_key_from_signature(), Botan::fors_sign_and_pkgen(), Botan::ht_verify(), Botan::treehash(), and Botan::wots_sign_and_pkgen().
|
protectedpure virtual |
Prepare the underlying hash function for hashing any given input depending on the expected input length.
address | the SLH-DSA address of the hash to be tweaked |
input_length | the input buffer length that will be processed with the tweaked hash (typically N or 2*N) |
|
protected |
Definition at line 103 of file sp_hash.h.
Referenced by Botan::Sphincs_Hash_Functions_Shake::Sphincs_Hash_Functions_Shake().
|
protected |