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_Verification_Operation Class Reference

`#include <xmss_wots_verification_operation.h>`

Inheritance diagram for Botan::XMSS_WOTS_Verification_Operation:

## Public Member Functions
virtual bool | is_valid_signature (const uint8_t sig[], size_t sig_len) override
void | update (const uint8_t msg[], size_t msg_len) override
| XMSS_WOTS_Verification_Operation (const XMSS_WOTS_Addressed_PublicKey &public_key)
virtual | ~XMSS_WOTS_Verification_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

Provides signature verification capabilities for Winternitz One Time Signatures used in Extended Merkle Tree Signatures (XMSS).

This operation is not intended for stand-alone use and thus not registered in the Botan algorithm registry.

Definition at line 27 of file xmss_wots_verification_operation.h.

## Constructor & Destructor Documentation

Botan::XMSS_WOTS_Verification_Operation::XMSS_WOTS_Verification_Operation | ( | const XMSS_WOTS_Addressed_PublicKey & | public_key | ) |

Definition at line 18 of file xmss_wots_verification_operation.cpp.

References Botan::XMSS_WOTS_Addressed_PublicKey::public_key(), and Botan::XMSS_WOTS_PublicKey::wots_parameters().

20 : XMSS_WOTS_Common_Ops(public_key.public_key().wots_parameters().oid()),
21 m_pub_key(public_key),
22 m_msg_buf(0)
23 {
24 m_msg_buf.reserve(m_pub_key.public_key().wots_parameters().
25 element_size());
26 }
Botan::XMSS_WOTS_Addressed_PublicKey::public_key
const XMSS_WOTS_PublicKey & public_key() const
Definition: xmss_wots_addressed_publickey.h:41
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_Verification_Operation::~XMSS_WOTS_Verification_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

bool Botan::XMSS_WOTS_Verification_Operation::is_valid_signature | ( | const uint8_t | sig[],
|  | size_t | sig_len
| ) |  |
| override virtual

Implements Botan::PK_Ops::Verification.

Definition at line 42 of file xmss_wots_verification_operation.cpp.

References Botan::XMSS_WOTS_Addressed_PublicKey::address(), BOTAN_ASSERT, Botan::XMSS_WOTS_Parameters::element_size(), Botan::XMSS_WOTS_PublicKey::key_data(), Botan::XMSS_WOTS_Parameters::len(), Botan::XMSS_WOTS_Parameters::oid(), Botan::XMSS_WOTS_Addressed_PublicKey::public_key(), Botan::XMSS_WOTS_PublicKey::public_seed(), and Botan::XMSS_WOTS_PublicKey::wots_parameters().

44 {
45 const XMSS_WOTS_Parameters& w = m_pub_key.public_key().wots_parameters();
46
47 BOTAN_ASSERT(sig_len == w.element_size() * w.len(),
48 "Invalid signature size.");
49
50 wots_keysig_t signature(0);
51 signature.reserve(sig_len);
52
53 size_t begin = 0;
54 size_t end = 0;
55 while(signature.size() < w.len())
56 {
57 begin = end;
58 end = begin + w.element_size();
59 signature.push_back(secure_vector<uint8_t>(sig + begin, sig + end));
60 }
61
62 XMSS_WOTS_PublicKey pubkey_msg(w.oid(),
63 m_msg_buf,
64 signature,
65 m_pub_key.address(),
66 m_pub_key.public_key().public_seed());
67
68 return pubkey_msg.key_data() == m_pub_key.public_key().key_data();
69 }
Botan::XMSS_WOTS_Addressed_PublicKey::public_key
const XMSS_WOTS_PublicKey & public_key() const
Definition: xmss_wots_addressed_publickey.h:41
Botan::XMSS_WOTS_PublicKey::public_seed
const secure_vector< uint8_t > & public_seed() const
Definition: xmss_wots_publickey.h:201
BOTAN_ASSERT
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:27
Botan::wots_keysig_t
std::vector< secure_vector< uint8_t > > wots_keysig_t
Definition: xmss_common_ops.h:20
Botan::XMSS_WOTS_Addressed_PublicKey::address
const XMSS_Address & address() const
Definition: xmss_wots_addressed_publickey.h:44
Botan::XMSS_WOTS_PublicKey::wots_parameters
const XMSS_WOTS_Parameters & wots_parameters() const
Definition: xmss_wots_publickey.h:229
Botan::XMSS_WOTS_PublicKey::key_data
const wots_keysig_t & key_data() const
Definition: xmss_wots_publickey.h:215

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

Implements Botan::PK_Ops::Verification.

Definition at line 29 of file xmss_wots_verification_operation.cpp.

References BOTAN_ASSERT, Botan::XMSS_WOTS_Addressed_PublicKey::public_key(), and Botan::XMSS_WOTS_PublicKey::wots_parameters().

30 {
31 BOTAN_ASSERT(msg_len == m_pub_key.public_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 {
38 m_msg_buf.push_back(msg[i]);
39 }
40 }
Botan::XMSS_WOTS_Addressed_PublicKey::public_key
const XMSS_WOTS_PublicKey & public_key() const
Definition: xmss_wots_addressed_publickey.h:41
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 Botan::XMSS_WOTS_Signature_Operation::sign().

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

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