summaryrefslogtreecommitdiff
path: root/xmss_hash_address.c
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2018-02-23 15:58:37 +0000
committerDamien Miller <djm@mindrot.org>2018-02-26 11:40:41 +1100
commit1b11ea7c58cd5c59838b5fa574cd456d6047b2d4 (patch)
tree7e96cb41b5234b9d327f7c8f41392f09aed0994e /xmss_hash_address.c
parent7d330a1ac02076de98cfc8fda05353d57b603755 (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.c59
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/*
2hash_address.c version 20160722
3Andreas Hülsing
4Joost Rijneveld
5Public domain.
6*/
7#include <stdint.h>
8#include "xmss_hash_address.h" /* prototypes */
9
10void setLayerADRS(uint32_t adrs[8], uint32_t layer){
11 adrs[0] = layer;
12}
13
14void setTreeADRS(uint32_t adrs[8], uint64_t tree){
15 adrs[1] = (uint32_t) (tree >> 32);
16 adrs[2] = (uint32_t) tree;
17}
18
19void 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
27void setKeyAndMask(uint32_t adrs[8], uint32_t keyAndMask){
28 adrs[7] = keyAndMask;
29}
30
31// OTS
32
33void setOTSADRS(uint32_t adrs[8], uint32_t ots){
34 adrs[4] = ots;
35}
36
37void setChainADRS(uint32_t adrs[8], uint32_t chain){
38 adrs[5] = chain;
39}
40
41void setHashADRS(uint32_t adrs[8], uint32_t hash){
42 adrs[6] = hash;
43}
44
45// L-tree
46
47void setLtreeADRS(uint32_t adrs[8], uint32_t ltree){
48 adrs[4] = ltree;
49}
50
51// Hash Tree & L-tree
52
53void setTreeHeight(uint32_t adrs[8], uint32_t treeHeight){
54 adrs[5] = treeHeight;
55}
56
57void setTreeIndex(uint32_t adrs[8], uint32_t treeIndex){
58 adrs[6] = treeIndex;
59}