Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 **/
25 class XMSS_Common_Ops
26 {
27 public:
28 XMSS_Common_Ops(XMSS_Parameters::xmss_algorithm_t oid)
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 **/
43 void randomize_tree_hash(
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:
68 XMSS_Parameters m_xmss_params;
69 XMSS_Hash m_hash;
70
71 };
72
73 }
74
75 #endif
Botan::XMSS_Common_Ops
Definition: xmss_common_ops.h:25
Botan::XMSS_Common_Ops::XMSS_Common_Ops
XMSS_Common_Ops(XMSS_Parameters::xmss_algorithm_t oid)
Definition: xmss_common_ops.h:28
Botan::XMSS_Common_Ops::create_l_tree
void create_l_tree(secure_vector< uint8_t > &result, wots_keysig_t pk, XMSS_Address &adrs, const secure_vector< uint8_t > &seed)
Definition: xmss_common_ops.cpp:45
Botan::XMSS_Hash
Definition: xmss_hash.h:24
Botan::XMSS_Address
Definition: xmss_address.h:23
Botan::XMSS_Parameters
Definition: xmss_parameters.h:28
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Botan::XMSS_Common_Ops::m_xmss_params
XMSS_Parameters m_xmss_params
Definition: xmss_common_ops.h:68
Botan::XMSS_Common_Ops::randomize_tree_hash
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: xmss_common_ops.cpp:14
Botan::XMSS_Common_Ops::m_hash
XMSS_Hash m_hash
Definition: xmss_common_ops.h:69
Botan
Definition: alg_id.cpp:13
Botan::wots_keysig_t
std::vector< secure_vector< uint8_t > > wots_keysig_t
Definition: xmss_common_ops.h:20
Botan::XMSS_Parameters::xmss_algorithm_t
xmss_algorithm_t
Definition: xmss_parameters.h:31