xmss-KAT-generator/hash_address.c

54 lines
1.1 KiB
C
Raw Normal View History

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) {
int i;
addr[3] = type;
for (i = 4; i < 8; i++) {
addr[i] = 0;
}
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
}
/* 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-trees. */
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 treeHeight) {
addr[5] = treeHeight;
2016-09-22 15:31:41 +01:00
}
void set_tree_index(uint32_t addr[8], uint32_t treeIndex) {
addr[6] = treeIndex;
}