Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

xmss_wots_common_ops.cpp
Go to the documentation of this file.
1 /**
2 * XMSS WOTS Common Ops
3 * Operations shared by XMSS WOTS signature generation and verification
4 * operations.
5 *
6 * (C) 2016 Matthias Gierlings
7 *
8 * Botan is released under the Simplified BSD License (see license.txt)
9 **/
10
11 #include <botan/internal/xmss_wots_common_ops.h>
12
13 namespace Botan {
14
15 void
16 XMSS_WOTS_Common_Ops::chain(secure_vector<uint8_t>& result,
17 size_t start_idx,
18 size_t steps,
19 XMSS_Address& adrs,
20 const secure_vector<uint8_t>& seed)
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 }
39
40 }
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_WOTS_Common_Ops::chain
void chain(secure_vector< uint8_t > &result, size_t start_idx, size_t steps, XMSS_Address &adrs, const secure_vector< uint8_t > &seed)
Definition: xmss_wots_common_ops.cpp:16
Botan::XMSS_Address
Definition: xmss_address.h:23
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::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
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
Definition: alg_id.cpp:13
Botan::XMSS_Address::set_key_mask_mode
void set_key_mask_mode(Key_Mask value)
Definition: xmss_address.h:136
Botan::XMSS_Address::bytes
const secure_vector< uint8_t > & bytes() const
Definition: xmss_address.h:326
Botan::XMSS_Address::Key_Mask::Mask_Mode
Botan::XMSS_Address::set_hash_address
void set_hash_address(uint32_t value)
Definition: xmss_address.h:286
Botan::XMSS_Address::Key_Mask::Key_Mode