Botan 3.0.0-rc1
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 <vector>
12#include <botan/secmem.h>
13#include <botan/xmss_parameters.h>
14#include <botan/internal/xmss_address.h>
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 {
27 public:
28 /**
29 * Algorithm 7: "RAND_HASH"
30 *
31 * Generates a randomized hash.
32 *
33 * This overload is used in multithreaded scenarios, where it is
34 * required to provide seperate instances of XMSS_Hash to each
35 * thread.
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 * @param[in] hash Instance of XMSS_Hash, that may only by the thread
43 * executing generate_public_key.
44 * @param[in] params parameters
45 **/
46 static void randomize_tree_hash(
48 const secure_vector<uint8_t>& left,
49 const secure_vector<uint8_t>& right,
50 XMSS_Address& adrs,
51 const secure_vector<uint8_t>& seed,
53 const XMSS_Parameters& params);
54
55 /**
56 * Algorithm 8: "ltree"
57 * Create an L-tree used to compute the leaves of the binary hash tree.
58 * Takes a WOTS+ public key and compresses it to a single n-byte value.
59 *
60 * This overload is used in multithreaded scenarios, where it is
61 * required to provide seperate instances of XMSS_Hash to each thread.
62 *
63 * @param[out] result Public key compressed to a single n-byte value
64 * pk[0].
65 * @param[in] pk Winternitz One Time Signatures+ public key.
66 * @param[in] adrs Address encoding the address of the L-Tree
67 * @param[in] seed The seed generated during the public key generation.
68 * @param[in] hash Instance of XMSS_Hash, that may only be used by the
69 * thread executing create_l_tree.
70 * @param[in] params parameters
71 **/
72 static void create_l_tree(secure_vector<uint8_t>& result,
74 XMSS_Address& adrs,
75 const secure_vector<uint8_t>& seed,
77 const XMSS_Parameters& params);
78 };
79
80}
81
82#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)
Definition: alg_id.cpp:12
std::vector< secure_vector< uint8_t > > wots_keysig_t
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:64
MechanismType hash