16#include <botan/internal/xmss_signature_operation.h>
18#include <botan/internal/xmss_tools.h>
23 m_priv_key(private_key),
24 m_hash(private_key.xmss_parameters()),
27 m_is_initialized(false) {}
39 xmss_priv_key.wots_private_key_for(adrs, m_hash).
sign(msg, xmss_priv_key.
public_seed(), adrs, m_hash);
46 XMSS_Signature sig(m_leaf_idx, m_randomness, generate_tree_signature(msg_hash, xmss_priv_key, adrs));
52 return sizeof(uint64_t) +
53 params.
element_size() + params.len() * params.element_size() + params.tree_height() * params.element_size();
61 for(
size_t j = 0; j < params.tree_height(); j++) {
62 size_t k = (m_leaf_idx / (
static_cast<size_t>(1) << j)) ^ 0x01;
63 auth_path[j] = priv_key.tree_hash(k * (
static_cast<size_t>(1) << j), j, adrs);
77 m_is_initialized =
false;
81void XMSS_Signature_Operation::initialize() {
83 if(m_is_initialized) {
90 m_leaf_idx =
static_cast<uint32_t
>(m_priv_key.reserve_unused_leaf_index());
94 m_hash.
prf(m_randomness, m_priv_key.prf_value(), index_bytes);
98 m_is_initialized =
true;
static OID from_string(std::string_view str)
void set_ots_address(uint32_t value)
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 h_msg_init(std::span< const uint8_t > randomness, std::span< const uint8_t > root, std::span< const uint8_t > index_bytes)
size_t element_size() const
const secure_vector< uint8_t > & root() const
const secure_vector< uint8_t > & public_seed() const
const XMSS_Parameters & xmss_parameters() const
XMSS_Signature_Operation(const XMSS_PrivateKey &private_key)
AlgorithmIdentifier algorithm_identifier() const override
size_t signature_length() const override
std::vector< uint8_t > sign(RandomNumberGenerator &) override
void update(std::span< const uint8_t > input) override
wots_keysig_t sign(const secure_vector< uint8_t > &msg, std::span< const uint8_t > public_seed, XMSS_Address &adrs, XMSS_Hash &hash)
std::vector< secure_vector< uint8_t > > wots_keysig_t
std::vector< T, secure_allocator< T > > secure_vector
wots_keysig_t authentication_path
wots_keysig_t ots_signature