/src/openssh/xmss_hash_address.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* $OpenBSD: xmss_hash_address.c,v 1.2 2018/02/26 03:56:44 dtucker Exp $ */ |
2 | | /* |
3 | | hash_address.c version 20160722 |
4 | | Andreas Hülsing |
5 | | Joost Rijneveld |
6 | | Public 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 | | |
16 | 0 | void setLayerADRS(uint32_t adrs[8], uint32_t layer){ |
17 | 0 | adrs[0] = layer; |
18 | 0 | } |
19 | | |
20 | 0 | void setTreeADRS(uint32_t adrs[8], uint64_t tree){ |
21 | 0 | adrs[1] = (uint32_t) (tree >> 32); |
22 | 0 | adrs[2] = (uint32_t) tree; |
23 | 0 | } |
24 | | |
25 | 0 | void setType(uint32_t adrs[8], uint32_t type){ |
26 | 0 | adrs[3] = type; |
27 | 0 | int i; |
28 | 0 | for(i = 4; i < 8; i++){ |
29 | 0 | adrs[i] = 0; |
30 | 0 | } |
31 | 0 | } |
32 | | |
33 | 0 | void setKeyAndMask(uint32_t adrs[8], uint32_t keyAndMask){ |
34 | 0 | adrs[7] = keyAndMask; |
35 | 0 | } |
36 | | |
37 | | // OTS |
38 | | |
39 | 0 | void setOTSADRS(uint32_t adrs[8], uint32_t ots){ |
40 | 0 | adrs[4] = ots; |
41 | 0 | } |
42 | | |
43 | 0 | void setChainADRS(uint32_t adrs[8], uint32_t chain){ |
44 | 0 | adrs[5] = chain; |
45 | 0 | } |
46 | | |
47 | 0 | void setHashADRS(uint32_t adrs[8], uint32_t hash){ |
48 | 0 | adrs[6] = hash; |
49 | 0 | } |
50 | | |
51 | | // L-tree |
52 | | |
53 | 0 | void setLtreeADRS(uint32_t adrs[8], uint32_t ltree){ |
54 | 0 | adrs[4] = ltree; |
55 | 0 | } |
56 | | |
57 | | // Hash Tree & L-tree |
58 | | |
59 | 0 | void setTreeHeight(uint32_t adrs[8], uint32_t treeHeight){ |
60 | 0 | adrs[5] = treeHeight; |
61 | 0 | } |
62 | | |
63 | 0 | void setTreeIndex(uint32_t adrs[8], uint32_t treeIndex){ |
64 | 0 | adrs[6] = treeIndex; |
65 | 0 | } |
66 | | #endif /* WITH_XMSS */ |