forked from kj3moraes/further-testing-xmss
-
Notifications
You must be signed in to change notification settings - Fork 1
/
hash_address.c
65 lines (51 loc) · 1.15 KB
/
hash_address.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <stdint.h>
void set_layer_addr(uint32_t addr[8], uint32_t layer)
{
addr[0] = layer;
}
void set_tree_addr(uint32_t addr[8], uint64_t tree)
{
addr[1] = (uint32_t) (tree >> 32);
addr[2] = (uint32_t) tree;
}
void set_type(uint32_t addr[8], uint32_t type)
{
addr[3] = type;
}
void set_key_and_mask(uint32_t addr[8], uint32_t key_and_mask)
{
addr[7] = key_and_mask;
}
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. */
void set_ots_addr(uint32_t addr[8], uint32_t ots)
{
addr[4] = ots;
}
void set_chain_addr(uint32_t addr[8], uint32_t chain)
{
addr[5] = chain;
}
void set_hash_addr(uint32_t addr[8], uint32_t hash)
{
addr[6] = hash;
}
/* This function is used for L-tree addresses. */
void set_ltree_addr(uint32_t addr[8], uint32_t ltree)
{
addr[4] = ltree;
}
/* These functions are used for hash tree addresses. */
void set_tree_height(uint32_t addr[8], uint32_t tree_height)
{
addr[5] = tree_height;
}
void set_tree_index(uint32_t addr[8], uint32_t tree_index)
{
addr[6] = tree_index;
}