8#ifndef BOTAN_XMSS_ADDRESS_H_
9#define BOTAN_XMSS_ADDRESS_H_
11#include <botan/secmem.h>
12#include <botan/types.h>
91 m_data[15] =
static_cast<uint8_t
>(type);
92 std::fill(
m_data.begin() + 16,
m_data.end(),
static_cast<uint8_t
>(0));
111 "Invalid Key_Mask for current XMSS_Address::Type.");
112 m_data[31] =
static_cast<uint8_t
>(value);
124 "get_ots_address() requires XMSS_Address::Type::"
125 "OTS_Hash_Address.");
138 "set_ots_address() requires XMSS_Address::Type::"
139 "OTS_Hash_Address.");
152 "set_ltree_address() requires XMSS_Address::Type::"
166 "set_ltree_address() requires XMSS_Address::Type::"
179 "get_chain_address() requires XMSS_Address::Type::"
180 "OTS_Hash_Address.");
190 "set_chain_address() requires XMSS_Address::Type::"
191 "OTS_Hash_Address.");
204 "get_tree_height() requires XMSS_Address::Type::"
205 "LTree_Address or XMSS_Address::Type::Hash_Tree_Address.");
218 "set_tree_height() requires XMSS_Address::Type::"
219 "LTree_Address or XMSS_Address::Type::Hash_Tree_Address.");
232 "get_hash_address() requires XMSS_Address::Type::"
233 "OTS_Hash_Address.");
246 "set_hash_address() requires XMSS_Address::Type::"
247 "OTS_Hash_Address.");
260 "get_tree_index() requires XMSS_Address::Type::"
261 "LTree_Address or XMSS_Address::Type::Hash_Tree_Address.");
274 "set_tree_index() requires XMSS_Address::Type::"
275 "LTree_Address or XMSS_Address::Type::Hash_Tree_Address.");
293 BOTAN_ASSERT(
m_data.size() == m_address_size,
"XMSS_Address must be of 256 bits size.");
300 static const size_t m_address_size = 32;
302 inline uint32_t get_hi32(
size_t offset)
const {
303 return ((0x000000FF &
m_data[8 * offset + 3]) | (0x000000FF &
m_data[8 * offset + 2]) << 8 |
304 (0x000000FF &
m_data[8 * offset + 1]) << 16 | (0x000000FF &
m_data[8 * offset]) << 24);
307 inline void set_hi32(
size_t offset, uint32_t value) {
308 m_data[offset * 8] = ((value >> 24) & 0xFF);
309 m_data[offset * 8 + 1] = ((value >> 16) & 0xFF);
310 m_data[offset * 8 + 2] = ((value >> 8) & 0xFF);
311 m_data[offset * 8 + 3] = ((value) & 0xFF);
314 inline uint32_t get_lo32(
size_t offset)
const {
315 return ((0x000000FF &
m_data[8 * offset + 7]) | (0x000000FF &
m_data[8 * offset + 6]) << 8 |
316 (0x000000FF &
m_data[8 * offset + 5]) << 16 | (0x000000FF &
m_data[8 * offset + 4]) << 24);
319 inline void set_lo32(
size_t offset, uint32_t value) {
320 m_data[offset * 8 + 4] = ((value >> 24) & 0xFF);
321 m_data[offset * 8 + 5] = ((value >> 16) & 0xFF);
322 m_data[offset * 8 + 6] = ((value >> 8) & 0xFF);
323 m_data[offset * 8 + 7] = ((value) & 0xFF);
#define BOTAN_ASSERT(expr, assertion_made)
void set_hash_address(uint32_t value)
void set_key_mask_mode(Key_Mask value)
secure_vector< uint8_t > m_data
void set_ots_address(uint32_t value)
uint32_t get_tree_index() const
uint32_t get_ots_address() const
uint32_t get_ltree_address() const
void set_chain_address(uint32_t value)
uint32_t get_tree_height() const
void set_tree_height(uint32_t value)
void set_tree_index(uint32_t value)
uint64_t get_tree_addr() const
uint8_t get_layer_addr() const
uint32_t get_chain_address() const
const secure_vector< uint8_t > & bytes() const
secure_vector< uint8_t > & bytes()
void set_ltree_address(uint32_t value)
XMSS_Address(secure_vector< uint8_t > data)
uint32_t get_hash_address() const
Key_Mask get_key_mask_mode() const
int(* final)(unsigned char *, CTX *)
std::vector< T, secure_allocator< T > > secure_vector