16 #include <botan/xmss_wots_parameters.h>
24 if(param_set ==
"WOTSP_SHA2-256_W16")
26 if(param_set ==
"WOTSP_SHA2-512_W16")
28 if(param_set ==
"WOTSP_SHAKE128_W16")
30 if(param_set ==
"WOTSP_SHAKE256_W16")
32 throw Invalid_Argument(
"Unknown XMSS-WOTS algorithm param '" + param_set +
"'");
48 m_name =
"WOTSP_SHA2-256_W16";
49 m_hash_name =
"SHA-256";
56 m_name =
"WOTSP_SHA2-512_W16";
57 m_hash_name =
"SHA-512";
64 m_name =
"WOTSP_SHAKE128_W16";
65 m_hash_name =
"SHAKE-128(256)";
72 m_name =
"WOTSP_SHAKE256_W16";
73 m_hash_name =
"SHAKE-256(512)";
78 "Algorithm id does not match any XMSS WOTS algorithm id.");
82 m_w == 16 ? m_lg_w = 4 : m_lg_w = 2;
83 m_len_1 =
static_cast<size_t>(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 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));
static ots_algorithm_t xmss_wots_id_from_string(const std::string ¶m_set)
size_t element_size() const
#define BOTAN_ASSERT(expr, assertion_made)
secure_vector< uint8_t > base_w(const secure_vector< uint8_t > &msg, size_t out_size) const
std::vector< T, secure_allocator< T >> secure_vector
size_t wots_parameter() const
void append_checksum(secure_vector< uint8_t > &data)
XMSS_WOTS_Parameters(const std::string &algo_name)