diff options
author | markus@openbsd.org <markus@openbsd.org> | 2018-02-23 15:58:37 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2018-02-26 11:40:41 +1100 |
commit | 1b11ea7c58cd5c59838b5fa574cd456d6047b2d4 (patch) | |
tree | 7e96cb41b5234b9d327f7c8f41392f09aed0994e /xmss_hash_address.c | |
parent | 7d330a1ac02076de98cfc8fda05353d57b603755 (diff) |
upstream: Add experimental support for PQC XMSS keys (Extended
Hash-Based Signatures) The code is not compiled in by default (see WITH_XMSS
in Makefile.inc) Joint work with stefan-lukas_gazdag at genua.eu See
https://tools.ietf.org/html/draft-irtf-cfrg-xmss-hash-based-signatures-12 ok
djm@
OpenBSD-Commit-ID: ef3eccb96762a5d6f135d7daeef608df7776a7ac
Diffstat (limited to 'xmss_hash_address.c')
-rw-r--r-- | xmss_hash_address.c | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/xmss_hash_address.c b/xmss_hash_address.c new file mode 100644 index 000000000..223c6f8ab --- /dev/null +++ b/xmss_hash_address.c | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | hash_address.c version 20160722 | ||
3 | Andreas Hülsing | ||
4 | Joost Rijneveld | ||
5 | Public domain. | ||
6 | */ | ||
7 | #include <stdint.h> | ||
8 | #include "xmss_hash_address.h" /* prototypes */ | ||
9 | |||
10 | void setLayerADRS(uint32_t adrs[8], uint32_t layer){ | ||
11 | adrs[0] = layer; | ||
12 | } | ||
13 | |||
14 | void setTreeADRS(uint32_t adrs[8], uint64_t tree){ | ||
15 | adrs[1] = (uint32_t) (tree >> 32); | ||
16 | adrs[2] = (uint32_t) tree; | ||
17 | } | ||
18 | |||
19 | void setType(uint32_t adrs[8], uint32_t type){ | ||
20 | adrs[3] = type; | ||
21 | int i; | ||
22 | for(i = 4; i < 8; i++){ | ||
23 | adrs[i] = 0; | ||
24 | } | ||
25 | } | ||
26 | |||
27 | void setKeyAndMask(uint32_t adrs[8], uint32_t keyAndMask){ | ||
28 | adrs[7] = keyAndMask; | ||
29 | } | ||
30 | |||
31 | // OTS | ||
32 | |||
33 | void setOTSADRS(uint32_t adrs[8], uint32_t ots){ | ||
34 | adrs[4] = ots; | ||
35 | } | ||
36 | |||
37 | void setChainADRS(uint32_t adrs[8], uint32_t chain){ | ||
38 | adrs[5] = chain; | ||
39 | } | ||
40 | |||
41 | void setHashADRS(uint32_t adrs[8], uint32_t hash){ | ||
42 | adrs[6] = hash; | ||
43 | } | ||
44 | |||
45 | // L-tree | ||
46 | |||
47 | void setLtreeADRS(uint32_t adrs[8], uint32_t ltree){ | ||
48 | adrs[4] = ltree; | ||
49 | } | ||
50 | |||
51 | // Hash Tree & L-tree | ||
52 | |||
53 | void setTreeHeight(uint32_t adrs[8], uint32_t treeHeight){ | ||
54 | adrs[5] = treeHeight; | ||
55 | } | ||
56 | |||
57 | void setTreeIndex(uint32_t adrs[8], uint32_t treeIndex){ | ||
58 | adrs[6] = treeIndex; | ||
59 | } | ||