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