xmss-KAT-generator/hash_address.c

66 líneas
1.1 KiB
C
Original Vista normal Histórico

2016-09-22 15:31:41 +01:00
#include <stdint.h>
void set_layer_addr(uint32_t addr[8], uint32_t layer)
{
addr[0] = layer;
2016-09-22 15:31:41 +01:00
}
void set_tree_addr(uint32_t addr[8], uint64_t tree)
{
addr[1] = (uint32_t) (tree >> 32);
addr[2] = (uint32_t) tree;
2016-09-22 15:31:41 +01:00
}
void set_type(uint32_t addr[8], uint32_t type)
{
addr[3] = type;
2016-09-22 15:31:41 +01:00
}
void set_key_and_mask(uint32_t addr[8], uint32_t key_and_mask)
{
addr[7] = key_and_mask;
2016-09-22 15:31:41 +01:00
}
void copy_subtree_addr(uint32_t out[8], const uint32_t in[8])
{
out[0] = in[0];
out[1] = in[1];
out[2] = in[2];
}
/* These functions are used for OTS addresses. */
2016-09-22 15:31:41 +01:00
void set_ots_addr(uint32_t addr[8], uint32_t ots)
{
addr[4] = ots;
2016-09-22 15:31:41 +01:00
}
void set_chain_addr(uint32_t addr[8], uint32_t chain)
{
addr[5] = chain;
2016-09-22 15:31:41 +01:00
}
void set_hash_addr(uint32_t addr[8], uint32_t hash)
{
addr[6] = hash;
2016-09-22 15:31:41 +01:00
}
/* This function is used for L-tree addresses. */
2016-09-22 15:31:41 +01:00
void set_ltree_addr(uint32_t addr[8], uint32_t ltree)
{
addr[4] = ltree;
2016-09-22 15:31:41 +01:00
}
/* These functions are used for hash tree addresses. */
2016-09-22 15:31:41 +01:00
void set_tree_height(uint32_t addr[8], uint32_t tree_height)
{
addr[5] = tree_height;
2016-09-22 15:31:41 +01:00
}
void set_tree_index(uint32_t addr[8], uint32_t tree_index)
{
addr[6] = tree_index;
}