2 /* $OpenBSD: xmss_fast.h,v 1.2 2018/02/26 03:56:44 dtucker Exp $ */
4 xmss_fast.h version 20160722
10 #include "xmss_wots.h"
16 unsigned long long subtree
;
32 unsigned int index_len
;
37 unsigned int next_idx
;
38 unsigned int stackusage
;
39 unsigned char completed
;
45 unsigned int stackoffset
;
46 unsigned char *stacklevels
;
49 treehash_inst
*treehash
;
50 unsigned char *retain
;
51 unsigned int next_leaf
;
55 * Initialize BDS state struct
56 * parameter names are the same as used in the description of the BDS traversal
58 void xmss_set_bds_state(bds_state
*state
, unsigned char *stack
, int stackoffset
, unsigned char *stacklevels
, unsigned char *auth
, unsigned char *keep
, treehash_inst
*treehash
, unsigned char *retain
, int next_leaf
);
60 * Initializes parameter set.
61 * Needed, for any of the other methods.
63 int xmss_set_params(xmss_params
*params
, int n
, int h
, int w
, int k
);
65 * Initialize xmssmt_params struct
66 * parameter names are the same as in the draft
68 * Especially h is the total tree height, i.e. the XMSS trees have height h/d
70 int xmssmt_set_params(xmssmt_params
*params
, int n
, int h
, int d
, int w
, int k
);
72 * Generates a XMSS key pair for a given parameter set.
73 * Format sk: [(32bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
74 * Format pk: [root || PUB_SEED] omitting algo oid.
76 int xmss_keypair(unsigned char *pk
, unsigned char *sk
, bds_state
*state
, xmss_params
*params
);
80 * 1. an array containing the signature followed by the message AND
81 * 2. an updated secret key!
84 int xmss_sign(unsigned char *sk
, bds_state
*state
, unsigned char *sig_msg
, unsigned long long *sig_msg_len
, const unsigned char *msg
,unsigned long long msglen
, const xmss_params
*params
);
86 * Verifies a given message signature pair under a given public key.
88 * Note: msg and msglen are pure outputs which carry the message in case verification succeeds. The (input) message is assumed to be within sig_msg which has the form (sig||msg).
90 int xmss_sign_open(unsigned char *msg
,unsigned long long *msglen
, const unsigned char *sig_msg
,unsigned long long sig_msg_len
, const unsigned char *pk
, const xmss_params
*params
);
93 * Generates a XMSSMT key pair for a given parameter set.
94 * Format sk: [(ceil(h/8) bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
95 * Format pk: [root || PUB_SEED] omitting algo oid.
97 int xmssmt_keypair(unsigned char *pk
, unsigned char *sk
, bds_state
*states
, unsigned char *wots_sigs
, xmssmt_params
*params
);
101 * 1. an array containing the signature followed by the message AND
102 * 2. an updated secret key!
105 int xmssmt_sign(unsigned char *sk
, bds_state
*state
, unsigned char *wots_sigs
, unsigned char *sig_msg
, unsigned long long *sig_msg_len
, const unsigned char *msg
, unsigned long long msglen
, const xmssmt_params
*params
);
107 * Verifies a given message signature pair under a given public key.
109 int xmssmt_sign_open(unsigned char *msg
, unsigned long long *msglen
, const unsigned char *sig_msg
, unsigned long long sig_msg_len
, const unsigned char *pk
, const xmssmt_params
*params
);
111 #endif /* WITH_XMSS */