Botan 3.4.0
Crypto and TLS for C&
xmss_signature_operation.h
Go to the documentation of this file.
1/*
2 * XMSS Signature Operation
3 * (C) 2016,2017,2018 Matthias Gierlings
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 **/
7
8#ifndef BOTAN_XMSS_SIGNATURE_OPERATION_H_
9#define BOTAN_XMSS_SIGNATURE_OPERATION_H_
10
11#include <botan/pk_ops.h>
12#include <botan/xmss.h>
13#include <botan/internal/xmss_address.h>
14#include <botan/internal/xmss_signature.h>
15#include <botan/internal/xmss_wots.h>
16
17namespace Botan {
18
19/**
20 * Signature generation operation for Extended Hash-Based Signatures (XMSS) as
21 * defined in:
22 *
23 * [1] XMSS: Extended Hash-Based Signatures,
24 * Request for Comments: 8391
25 * Release: May 2018.
26 * https://datatracker.ietf.org/doc/rfc8391/
27 **/
29 public:
30 XMSS_Signature_Operation(const XMSS_PrivateKey& private_key);
31
32 /**
33 * Creates an XMSS signature for the message provided through call to
34 * update().
35 *
36 * @return serialized XMSS signature.
37 **/
39
40 void update(const uint8_t msg[], size_t msg_len) override;
41
42 size_t signature_length() const override;
43
45
46 std::string hash_function() const override { return m_hash.hash_function(); }
47
48 private:
49 /**
50 * Algorithm 11: "treeSig"
51 * Generate a WOTS+ signature on a message with corresponding auth path.
52 *
53 * @param msg A message.
54 * @param xmss_priv_key A XMSS private key.
55 * @param adrs A XMSS Address.
56 **/
57 XMSS_Signature::TreeSignature generate_tree_signature(const secure_vector<uint8_t>& msg,
58 XMSS_PrivateKey& xmss_priv_key,
59 XMSS_Address& adrs);
60
61 /**
62 * Algorithm 12: "XMSS_sign"
63 * Generate an XMSS signature and update the XMSS secret key
64 *
65 * @param msg A message to sign of arbitrary length.
66 * @param [out] xmss_priv_key A XMSS private key. The private key will be
67 * updated during the signing process.
68 *
69 * @return The signature of msg signed using xmss_priv_key.
70 **/
72
73 wots_keysig_t build_auth_path(XMSS_PrivateKey& priv_key, XMSS_Address& adrs);
74
75 void initialize();
76
77 XMSS_PrivateKey m_priv_key;
78 XMSS_Hash m_hash;
79 secure_vector<uint8_t> m_randomness;
80 uint32_t m_leaf_idx;
81 bool m_is_initialized;
82};
83
84} // namespace Botan
85
86#endif
std::string hash_function() const
Definition xmss_hash.h:34
XMSS_Signature_Operation(const XMSS_PrivateKey &private_key)
AlgorithmIdentifier algorithm_identifier() const override
secure_vector< uint8_t > sign(RandomNumberGenerator &) override
std::string hash_function() const override
int(* update)(CTX *, const void *, CC_LONG len)
int(* final)(unsigned char *, CTX *)
std::vector< secure_vector< uint8_t > > wots_keysig_t
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61