blob: 4656c3dd1c6ec53862d3ba7111530e5856cbb39f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/**
* XMSS WOTS Signature Operation
* (C) 2016 Matthias Gierlings
*
* Botan is released under the Simplified BSD License (see license.txt)
**/
#ifndef BOTAN_XMSS_WOTS_SIGNATURE_OPERATION_H__
#define BOTAN_XMSS_WOTS_SIGNATURE_OPERATION_H__
#include <cstddef>
#include <iterator>
#include <botan/assert.h>
#include <botan/types.h>
#include <botan/pk_ops.h>
#include <botan/internal/xmss_wots_addressed_privatekey.h>
#include <botan/internal/xmss_wots_common_ops.h>
namespace Botan {
/**
* Signature generation operation for Winternitz One Time Signatures for use
* in Extended Hash-Based Signatures (XMSS).
*
* This operation is not intended for stand-alone use and thus not registered
* in the Botan algorithm registry.
***/
class XMSS_WOTS_Signature_Operation : public virtual PK_Ops::Signature,
public XMSS_WOTS_Common_Ops
{
public:
XMSS_WOTS_Signature_Operation(
const XMSS_WOTS_Addressed_PrivateKey& private_key);
virtual ~XMSS_WOTS_Signature_Operation() = default;
/**
* Creates a XMSS WOTS signature for the message provided through call
* to update(). XMSS wots only supports one message part and a fixed
* message size of "n" bytes where "n" equals the element size of
* the chosen XMSS WOTS signature method. The random number generator
* argument is supplied for interface compatibility and remains unused.
*
* @return serialized Winternitz One Time Signature.
**/
secure_vector<uint8_t> sign(RandomNumberGenerator&) override;
void update(const uint8_t msg[], size_t msg_len) override;
private:
wots_keysig_t sign(const secure_vector<uint8_t>& msg,
const wots_keysig_t& priv_key,
XMSS_Address& adrs,
const secure_vector<uint8_t>& seed);
XMSS_WOTS_Addressed_PrivateKey m_priv_key;
secure_vector<uint8_t> m_msg_buf;
};
}
#endif
|