Botan  2.1.0
Crypto and TLS for C++11
xmss_common_ops.h
Go to the documentation of this file.
1 /*
2  * XMSS Common Ops
3  * (C) 2016 Matthias Gierlings
4  *
5  * Botan is released under the Simplified BSD License (see license.txt)
6  **/
7 
8 #ifndef BOTAN_XMSS_COMMON_OPS_H__
9 #define BOTAN_XMSS_COMMON_OPS_H__
10 
11 #include <vector>
12 #include <botan/secmem.h>
13 #include <botan/assert.h>
14 #include <botan/xmss_parameters.h>
15 #include <botan/xmss_address.h>
16 #include <botan/xmss_hash.h>
17 
18 namespace Botan {
19 
20 typedef std::vector<secure_vector<uint8_t>> wots_keysig_t;
21 
22 /**
23  * Operations shared by XMSS signature generation and verification operations.
24  **/
26  {
27  public:
29  : m_xmss_params(oid), m_hash(m_xmss_params.hash_function_name()) {}
30 
31  protected:
32  /**
33  * Algorithm 7: "RAND_HASH"
34  *
35  * Generates a randomized hash.
36  *
37  * @param[out] result The resulting randomized hash.
38  * @param[in] left Left half of the hash function input.
39  * @param[in] right Right half of the hash function input.
40  * @param[in] adrs Adress of the hash function call.
41  * @param[in] seed The seed for G.
42  **/
44  secure_vector<uint8_t>& result,
45  const secure_vector<uint8_t>& left,
46  const secure_vector<uint8_t>& right,
47  XMSS_Address& adrs,
48  const secure_vector<uint8_t>& seed);
49 
50  /**
51  * Algorithm 8: "ltree"
52  * Create an L-tree used to compute the leaves of the binary hash tree.
53  * Takes a WOTS+ public key and compresses it to a single n-byte value.
54  *
55  * @param[out] result Public key compressed to a single n-byte value
56  * pk[0].
57  * @param[in] pk Winternitz One Time Signatures+ public key.
58  * @param[in] adrs Address encoding the address of the L-Tree
59  * @param[in] seed The seed generated during the public key generation.
60  **/
61  void create_l_tree(
62  secure_vector<uint8_t>& result,
63  wots_keysig_t pk,
64  XMSS_Address& adrs,
65  const secure_vector<uint8_t>& seed);
66 
67  protected:
70 
71  };
72 
73 }
74 
75 #endif
XMSS_Common_Ops(XMSS_Parameters::xmss_algorithm_t oid)
void create_l_tree(secure_vector< uint8_t > &result, wots_keysig_t pk, XMSS_Address &adrs, const secure_vector< uint8_t > &seed)
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
XMSS_Parameters m_xmss_params
void randomize_tree_hash(secure_vector< uint8_t > &result, const secure_vector< uint8_t > &left, const secure_vector< uint8_t > &right, XMSS_Address &adrs, const secure_vector< uint8_t > &seed)
Definition: alg_id.cpp:13
std::vector< secure_vector< uint8_t > > wots_keysig_t