15#include <botan/xmss_wots.h>
16#include <botan/internal/xmss_tools.h>
17#include <botan/exceptn.h>
25 if(param_set ==
"WOTSP-SHA2_256")
27 if(param_set ==
"WOTSP-SHA2_512")
29 if(param_set ==
"WOTSP-SHAKE_256")
31 if(param_set ==
"WOTSP-SHAKE_512")
33 throw Invalid_Argument(
"Unknown XMSS-WOTS algorithm param '" + param_set +
"'");
49 m_name =
"WOTSP-SHA2_256";
50 m_hash_name =
"SHA-256";
57 m_name =
"WOTSP-SHA2_512";
58 m_hash_name =
"SHA-512";
65 m_name =
"WOTSP-SHAKE_256";
66 m_hash_name =
"SHAKE-128(256)";
73 m_name =
"WOTSP-SHAKE_512";
74 m_hash_name =
"SHAKE-256(512)";
78 throw Not_Implemented(
"Algorithm id does not match any known XMSS WOTS algorithm id.");
82 m_lg_w = (m_w == 16) ? 4 : 2;
83 m_len_1 =
static_cast<size_t>(std::ceil((8 *
element_size()) / m_lg_w));
84 m_len_2 =
static_cast<size_t>(
86 BOTAN_ASSERT(m_len == m_len_1 + m_len_2,
"Invalid XMSS WOTS parameter "
98 for(
size_t i = 0; i < out_size; i++)
107 result.push_back(
static_cast<uint8_t
>((total >> bits) & (m_w - 1)));
115 value <<= (8 - ((m_len_2 * m_lg_w) % 8));
116 size_t len_2_bytes =
static_cast<size_t>(
117 std::ceil(
static_cast<float>(m_len_2 * m_lg_w) / 8.f));
120 return base_w(result, m_len_2);
128 for(
size_t i = 0; i < data.size(); i++)
134 std::move(csum_bytes.begin(), csum_bytes.end(), std::back_inserter(data));
#define BOTAN_ASSERT(expr, assertion_made)
size_t wots_parameter() const
size_t element_size() const
XMSS_WOTS_Parameters(const std::string &algo_name)
ots_algorithm_t oid() const
void append_checksum(secure_vector< uint8_t > &data)
secure_vector< uint8_t > base_w(const secure_vector< uint8_t > &msg, size_t out_size) const
static ots_algorithm_t xmss_wots_id_from_string(const std::string ¶m_set)
std::vector< T, secure_allocator< T > > secure_vector