Botan 3.6.1
Crypto and TLS for C&
xmss_common_ops.h
Go to the documentation of this file.
1/*
2 * XMSS Common Ops
3 * (C) 2016,2017 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 <botan/secmem.h>
12#include <botan/xmss_parameters.h>
13#include <botan/internal/xmss_address.h>
14#include <vector>
15
16namespace Botan {
17
18class XMSS_Hash;
19
20typedef std::vector<secure_vector<uint8_t>> wots_keysig_t;
21
22/**
23 * Operations shared by XMSS signature generation and verification operations.
24 **/
26 public:
27 /**
28 * Algorithm 7: "RAND_HASH"
29 *
30 * Generates a randomized hash.
31 *
32 * This overload is used in multithreaded scenarios, where it is
33 * required to provide seperate instances of XMSS_Hash to each
34 * thread.
35 *
36 * @param[out] result The resulting randomized hash.
37 * @param[in] left Left half of the hash function input.
38 * @param[in] right Right half of the hash function input.
39 * @param[in] adrs Adress of the hash function call.
40 * @param[in] seed The seed for G.
41 * @param[in] hash Instance of XMSS_Hash, that may only by the thread
42 * executing generate_public_key.
43 * @param[in] params parameters
44 **/
46 const secure_vector<uint8_t>& left,
47 const secure_vector<uint8_t>& right,
48 XMSS_Address& adrs,
49 const secure_vector<uint8_t>& seed,
50 XMSS_Hash& hash,
51 const XMSS_Parameters& params);
52
53 /**
54 * Algorithm 8: "ltree"
55 * Create an L-tree used to compute the leaves of the binary hash tree.
56 * Takes a WOTS+ public key and compresses it to a single n-byte value.
57 *
58 * This overload is used in multithreaded scenarios, where it is
59 * required to provide seperate instances of XMSS_Hash to each thread.
60 *
61 * @param[out] result Public key compressed to a single n-byte value
62 * pk[0].
63 * @param[in] pk Winternitz One Time Signatures+ public key.
64 * @param[in] adrs Address encoding the address of the L-Tree
65 * @param[in] seed The seed generated during the public key generation.
66 * @param[in] hash Instance of XMSS_Hash, that may only be used by the
67 * thread executing create_l_tree.
68 * @param[in] params parameters
69 **/
70 static void create_l_tree(secure_vector<uint8_t>& result,
72 XMSS_Address& adrs,
73 const secure_vector<uint8_t>& seed,
74 XMSS_Hash& hash,
75 const XMSS_Parameters& params);
76};
77
78} // namespace Botan
79
80#endif
static void create_l_tree(secure_vector< uint8_t > &result, wots_keysig_t pk, XMSS_Address &adrs, const secure_vector< uint8_t > &seed, XMSS_Hash &hash, const XMSS_Parameters &params)
static 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, XMSS_Hash &hash, const XMSS_Parameters &params)
std::vector< secure_vector< uint8_t > > wots_keysig_t
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61