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 | Static Public Member Functions | List of all members
Botan::XMSS_Tools Class Reference

`#include <xmss_tools.h>`

## Public Member Functions
void | operator= (const XMSS_Tools &)=delete
| XMSS_Tools (const XMSS_Tools &)=delete

## Static Public Member Functions
template<typename T , typename U = typename std::enable_if<std::is_integral<T>::value, void>::type>
static void | concat (secure_vector< uint8_t > &target, const T &src)
template<typename T , typename U = typename std::enable_if<std::is_integral<T>::value, void>::type>
static void | concat (secure_vector< uint8_t > &target, const T &src, size_t len)

## Detailed Description

Helper tools for low level byte operations required for the XMSS implementation.

Definition at line 24 of file xmss_tools.h.

## Constructor & Destructor Documentation

Botan::XMSS_Tools::XMSS_Tools | ( | const XMSS_Tools & |  | ) |
| delete

## Member Function Documentation

template<typename T , typename U >

void Botan::XMSS_Tools::concat | ( | secure_vector< uint8_t > & | target,
|  | const T & | src
| ) |  |
| static

Concatenates the byte representation in big-endian order of any integral value to a secure_vector.

Parameters

  target | Vector to concatenate the byte representation of the integral value to.
  src | integral value to concatenate.

Definition at line 63 of file xmss_tools.h.

References Botan::CPUID::is_little_endian().

Referenced by Botan::XMSS_WOTS_Parameters::base_w(), and Botan::XMSS_WOTS_PrivateKey::operator[]().

64 {
65 const uint8_t* src_bytes = reinterpret_cast<const uint8_t*>(&src);
66 if(CPUID::is_little_endian())
67 {
68 std::reverse_copy(src_bytes,
69 src_bytes + sizeof(src),
70 std::back_inserter(target));
71 }
72 else
73 {
74 std::copy(src_bytes,
75 src_bytes + sizeof(src),
76 std::back_inserter(target));
77 }
78 }
Botan::CPUID::is_little_endian
static bool is_little_endian()
Definition: cpuid.h:74
template<typename T , typename U >

void Botan::XMSS_Tools::concat | ( | secure_vector< uint8_t > & | target,
|  | const T & | src,
|  | size_t | len
| ) |  |
| static

Concatenates the last n bytes of the byte representation in big-endian order of any integral value to a to a secure_vector.

Parameters

  target | Vector to concatenate the byte representation of the integral value to.
  src | Integral value to concatenate.
  len | number of bytes to concatenate. This value must be smaller or equal to the size of type T.

Definition at line 82 of file xmss_tools.h.

References Botan::CPUID::is_little_endian(), and Botan::CT::min().

85 {
86 size_t c = static_cast<size_t>(std::min(len, sizeof(src)));
87 if(len > sizeof(src))
88 {
89 target.resize(target.size() + len - sizeof(src), 0);
90 }
91
92 const uint8_t* src_bytes = reinterpret_cast<const uint8_t*>(&src);
93 if(CPUID::is_little_endian())
94 {
95 std::reverse_copy(src_bytes,
96 src_bytes + c,
97 std::back_inserter(target));
98 }
99 else
100 {
101 std::copy(src_bytes + sizeof(src) - c,
102 src_bytes + sizeof(src),
103 std::back_inserter(target));
104 }
105 }
Botan::CPUID::is_little_endian
static bool is_little_endian()
Definition: cpuid.h:74
Botan::CT::min
T min(T a, T b)
Definition: ct_utils.h:180

void Botan::XMSS_Tools::operator= | ( | const XMSS_Tools & |  | ) |
| delete

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

- src/lib/pubkey/xmss/xmss_tools.h