Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Botan::XMSS_WOTS_Signature_Operation Class Reference

`#include <xmss_wots_signature_operation.h>`

Inheritance diagram for Botan::XMSS_WOTS_Signature_Operation:

## Public Member Functions
secure_vector< uint8_t > | sign (RandomNumberGenerator &) override
void | update (const uint8_t msg[], size_t msg_len) override
| XMSS_WOTS_Signature_Operation (const XMSS_WOTS_Addressed_PrivateKey &private_key)
virtual | ~XMSS_WOTS_Signature_Operation ()=default

## Protected Member Functions
void | chain (secure_vector< uint8_t > &result, size_t start_idx, size_t steps, XMSS_Address &adrs, const secure_vector< uint8_t > &seed)

## Protected Attributes
XMSS_Hash | m_hash
XMSS_WOTS_Parameters | m_wots_params

## Detailed Description

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.

Definition at line 28 of file xmss_wots_signature_operation.h.

## Constructor & Destructor Documentation

Botan::XMSS_WOTS_Signature_Operation::XMSS_WOTS_Signature_Operation | ( | const XMSS_WOTS_Addressed_PrivateKey & | private_key | ) |

Definition at line 18 of file xmss_wots_signature_operation.cpp.

References Botan::XMSS_WOTS_Parameters::element_size(), Botan::XMSS_WOTS_Addressed_PrivateKey::private_key(), and Botan::XMSS_WOTS_PublicKey::wots_parameters().

20 : XMSS_WOTS_Common_Ops(private_key.private_key().wots_parameters().oid()),
21 m_priv_key(private_key),
22 m_msg_buf(0)
23 {
24 m_msg_buf.reserve(
25 m_priv_key.private_key().wots_parameters().element_size());
26 }
Botan::XMSS_WOTS_Addressed_PrivateKey::private_key
const XMSS_WOTS_PrivateKey & private_key() const
Definition: xmss_wots_addressed_privatekey.h:48
Botan::XMSS_WOTS_Parameters::element_size
size_t element_size() const
Definition: xmss_wots_parameters.h:87
Botan::XMSS_WOTS_Common_Ops::XMSS_WOTS_Common_Ops
XMSS_WOTS_Common_Ops(XMSS_WOTS_Parameters::ots_algorithm_t oid)
Definition: xmss_wots_common_ops.h:26
Botan::XMSS_WOTS_PublicKey::wots_parameters
const XMSS_WOTS_Parameters & wots_parameters() const
Definition: xmss_wots_publickey.h:229

virtual Botan::XMSS_WOTS_Signature_Operation::~XMSS_WOTS_Signature_Operation | ( |  | ) |
| virtual default

## Member Function Documentation

void Botan::XMSS_WOTS_Common_Ops::chain | ( | secure_vector< uint8_t > & | result,
|  | size_t | start_idx,
|  | size_t | steps,
|  | XMSS_Address & | adrs,
|  | const secure_vector< uint8_t > & | seed
| ) |  |
| protected inherited

Algorithm 2: Chaining Function.

Parameters

  [out] | result | Contains the n-byte input string "x" upon call to chain(), that will be replaced with the value obtained by iterating the cryptographic hash function "F" steps times on the input x using the outputs of the PRNG "G".
  [in] | start_idx | The start index.
  [in] | steps | A number of steps.
  [in] | adrs | An OTS Hash Address.
  [in] | seed | A Seed.

Definition at line 16 of file xmss_wots_common_ops.cpp.

References Botan::XMSS_Address::bytes(), Botan::XMSS_Hash::f(), Botan::XMSS_Address::Key_Mode, Botan::XMSS_WOTS_Common_Ops::m_hash, Botan::XMSS_WOTS_Common_Ops::m_wots_params, Botan::XMSS_Address::Mask_Mode, Botan::XMSS_Hash::prf(), Botan::XMSS_Address::set_hash_address(), Botan::XMSS_Address::set_key_mask_mode(), Botan::XMSS_WOTS_Parameters::wots_parameter(), and Botan::xor_buf().

21 {
22 for(size_t i = start_idx;
23 i < (start_idx + steps) && i < m_wots_params.wots_parameter();
24 i++)
25 {
26 adrs.set_hash_address(i);
27
28 //Calculate tmp XOR bitmask
29 adrs.set_key_mask_mode(XMSS_Address::Key_Mask::Mask_Mode);
30 xor_buf(result, m_hash.prf(seed, adrs.bytes()), result.size());
31
32 // Calculate key
33 adrs.set_key_mask_mode(XMSS_Address::Key_Mask::Key_Mode);
34
35 //Calculate f(key, tmp XOR bitmask)
36 m_hash.f(result, m_hash.prf(seed, adrs.bytes()), result);
37 }
38 }
Botan::xor_buf
void xor_buf(T out[], const T in[], size_t length)
Definition: mem_ops.h:115
Botan::XMSS_WOTS_Common_Ops::m_hash
XMSS_Hash m_hash
Definition: xmss_wots_common_ops.h:50
Botan::XMSS_Hash::f
void f(secure_vector< uint8_t > &result, const secure_vector< uint8_t > &key, const secure_vector< uint8_t > &data)
Definition: xmss_hash.h:74
Botan::XMSS_WOTS_Common_Ops::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_common_ops.h:49
Botan::XMSS_Hash::prf
void prf(secure_vector< uint8_t > &result, const secure_vector< uint8_t > &key, const secure_vector< uint8_t > &data)
Definition: xmss_hash.h:38
Botan::XMSS_WOTS_Parameters::wots_parameter
size_t wots_parameter() const
Definition: xmss_wots_parameters.h:95
Botan::XMSS_Address::Key_Mask::Mask_Mode
Botan::XMSS_Address::Key_Mask::Key_Mode

secure_vector< uint8_t > Botan::XMSS_WOTS_Signature_Operation::sign | ( | RandomNumberGenerator & |  | ) |
| override virtual

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.

Returns
  serialized Winternitz One Time Signature.

Implements Botan::PK_Ops::Signature.

Definition at line 41 of file xmss_wots_signature_operation.cpp.

References Botan::XMSS_WOTS_Addressed_PublicKey::address(), Botan::XMSS_WOTS_Parameters::element_size(), Botan::XMSS_WOTS_Parameters::len(), Botan::XMSS_WOTS_Common_Ops::m_wots_params, Botan::XMSS_WOTS_Addressed_PrivateKey::private_key(), and Botan::XMSS_WOTS_PrivateKey::sign().

42 {
43 secure_vector<uint8_t> result(0);
44 result.reserve(m_wots_params.len() * m_wots_params.element_size());
45 XMSS_WOTS_PrivateKey& priv_key = m_priv_key.private_key();
46 for(const auto& node : priv_key.sign(m_msg_buf, m_priv_key.address()))
47 {
48 std::copy(node.begin(), node.end(), std::back_inserter(result));
49 }
50
51 return result;
52 }
Botan::XMSS_WOTS_Addressed_PrivateKey::private_key
const XMSS_WOTS_PrivateKey & private_key() const
Definition: xmss_wots_addressed_privatekey.h:48
Botan::XMSS_WOTS_Parameters::element_size
size_t element_size() const
Definition: xmss_wots_parameters.h:87
Botan::XMSS_WOTS_Parameters::len
size_t len() const
Definition: xmss_wots_parameters.h:97
Botan::XMSS_WOTS_Common_Ops::m_wots_params
XMSS_WOTS_Parameters m_wots_params
Definition: xmss_wots_common_ops.h:49
Botan::XMSS_WOTS_Addressed_PublicKey::address
const XMSS_Address & address() const
Definition: xmss_wots_addressed_publickey.h:44

void Botan::XMSS_WOTS_Signature_Operation::update | ( | const uint8_t | msg[],
|  | size_t | msg_len
| ) |  |
| override virtual

Implements Botan::PK_Ops::Signature.

Definition at line 29 of file xmss_wots_signature_operation.cpp.

References BOTAN_ASSERT, Botan::XMSS_WOTS_Addressed_PrivateKey::private_key(), and Botan::XMSS_WOTS_PublicKey::wots_parameters().

30 {
31 BOTAN_ASSERT(msg_len == m_priv_key.private_key().wots_parameters().
32 element_size() &&
33 m_msg_buf.size() == 0,
34 "XMSS WOTS only supports one message part of size n.");
35
36 for(size_t i = 0; i < msg_len; i++)
37 m_msg_buf.push_back(msg[i]);
38 }
Botan::XMSS_WOTS_Addressed_PrivateKey::private_key
const XMSS_WOTS_PrivateKey & private_key() const
Definition: xmss_wots_addressed_privatekey.h:48
BOTAN_ASSERT
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:27
Botan::XMSS_WOTS_PublicKey::wots_parameters
const XMSS_WOTS_Parameters & wots_parameters() const
Definition: xmss_wots_publickey.h:229

## Member Data Documentation

XMSS_Hash Botan::XMSS_WOTS_Common_Ops::m_hash
| protected inherited

Definition at line 50 of file xmss_wots_common_ops.h.

Referenced by Botan::XMSS_WOTS_Common_Ops::chain().

XMSS_WOTS_Parameters Botan::XMSS_WOTS_Common_Ops::m_wots_params
| protected inherited

Definition at line 49 of file xmss_wots_common_ops.h.

Referenced by Botan::XMSS_WOTS_Common_Ops::chain(), and sign().

The documentation for this class was generated from the following files:

- src/lib/pubkey/xmss/xmss_wots_signature_operation.h
- src/lib/pubkey/xmss/xmss_wots_signature_operation.cpp