Botan 2.19.3
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/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 {
30 public:
31 XMSS_Signature_Operation(const XMSS_PrivateKey& private_key);
32
33 /**
34 * Creates an XMSS signature for the message provided through call to
35 * update().
36 *
37 * @return serialized XMSS signature.
38 **/
40
41 void update(const uint8_t msg[], size_t msg_len) override;
42
43 size_t signature_length() const override;
44
45 private:
46 /**
47 * Algorithm 11: "treeSig"
48 * Generate a WOTS+ signature on a message with corresponding auth path.
49 *
50 * @param msg A message.
51 * @param xmss_priv_key A XMSS private key.
52 * @param adrs A XMSS Address.
53 **/
54 XMSS_WOTS_PublicKey::TreeSignature generate_tree_signature(
55 const secure_vector<uint8_t>& msg,
56 XMSS_PrivateKey& xmss_priv_key,
57 XMSS_Address& adrs);
58
59 /**
60 * Algorithm 12: "XMSS_sign"
61 * Generate an XMSS signature and update the XMSS secret key
62 *
63 * @param msg A message to sign of arbitrary length.
64 * @param [out] xmss_priv_key A XMSS private key. The private key will be
65 * updated during the signing process.
66 *
67 * @return The signature of msg signed using xmss_priv_key.
68 **/
70 const secure_vector<uint8_t>& msg,
71 XMSS_PrivateKey& xmss_priv_key);
72
73 wots_keysig_t build_auth_path(XMSS_PrivateKey& priv_key,
74 XMSS_Address& adrs);
75
76 void initialize();
77
78 XMSS_PrivateKey m_priv_key;
79 const XMSS_Parameters m_xmss_params;
80 XMSS_Hash m_hash;
81 secure_vector<uint8_t> m_randomness;
82 uint32_t m_leaf_idx;
83 bool m_is_initialized;
84 };
85
86}
87
88#endif
89
secure_vector< uint8_t > sign(RandomNumberGenerator &) 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:65