summaryrefslogtreecommitdiff
path: root/xmss_hash_address.c
diff options
context:
space:
mode:
Diffstat (limited to 'xmss_hash_address.c')
-rw-r--r--xmss_hash_address.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/xmss_hash_address.c b/xmss_hash_address.c
new file mode 100644
index 000000000..c6c1347e9
--- /dev/null
+++ b/xmss_hash_address.c
@@ -0,0 +1,66 @@
1/* $OpenBSD: xmss_hash_address.c,v 1.2 2018/02/26 03:56:44 dtucker Exp $ */
2/*
3hash_address.c version 20160722
4Andreas Hülsing
5Joost Rijneveld
6Public domain.
7*/
8#include "includes.h"
9#ifdef WITH_XMSS
10
11#ifdef HAVE_STDINT_H
12#include <stdint.h>
13#endif
14#include "xmss_hash_address.h" /* prototypes */
15
16void setLayerADRS(uint32_t adrs[8], uint32_t layer){
17 adrs[0] = layer;
18}
19
20void setTreeADRS(uint32_t adrs[8], uint64_t tree){
21 adrs[1] = (uint32_t) (tree >> 32);
22 adrs[2] = (uint32_t) tree;
23}
24
25void setType(uint32_t adrs[8], uint32_t type){
26 adrs[3] = type;
27 int i;
28 for(i = 4; i < 8; i++){
29 adrs[i] = 0;
30 }
31}
32
33void setKeyAndMask(uint32_t adrs[8], uint32_t keyAndMask){
34 adrs[7] = keyAndMask;
35}
36
37// OTS
38
39void setOTSADRS(uint32_t adrs[8], uint32_t ots){
40 adrs[4] = ots;
41}
42
43void setChainADRS(uint32_t adrs[8], uint32_t chain){
44 adrs[5] = chain;
45}
46
47void setHashADRS(uint32_t adrs[8], uint32_t hash){
48 adrs[6] = hash;
49}
50
51// L-tree
52
53void setLtreeADRS(uint32_t adrs[8], uint32_t ltree){
54 adrs[4] = ltree;
55}
56
57// Hash Tree & L-tree
58
59void setTreeHeight(uint32_t adrs[8], uint32_t treeHeight){
60 adrs[5] = treeHeight;
61}
62
63void setTreeIndex(uint32_t adrs[8], uint32_t treeIndex){
64 adrs[6] = treeIndex;
65}
66#endif /* WITH_XMSS */