Botan 3.4.0
Crypto and TLS for C&
Public Member Functions | Static Public Member Functions | List of all members
Botan::XMSS_Tools Class Referencefinal

#include <xmss_tools.h>

Public Member Functions

void operator= (const XMSS_Tools &)=delete
 
 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 22 of file xmss_tools.h.

Constructor & Destructor Documentation

◆ XMSS_Tools() [1/2]

Botan::XMSS_Tools::XMSS_Tools ( )
delete

◆ XMSS_Tools() [2/2]

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

Member Function Documentation

◆ concat() [1/2]

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
targetVector to concatenate the byte representation of the integral value to.
srcintegral value to concatenate.

Definition at line 54 of file xmss_tools.h.

54 {
55 const uint8_t* src_bytes = reinterpret_cast<const uint8_t*>(&src);
57 std::reverse_copy(src_bytes, src_bytes + sizeof(src), std::back_inserter(target));
58 } else {
59 std::copy(src_bytes, src_bytes + sizeof(src), std::back_inserter(target));
60 }
61}
static bool is_little_endian()
Definition cpuid.h:59

References Botan::CPUID::is_little_endian().

Referenced by Botan::XMSS_WOTS_Parameters::base_w().

◆ concat() [2/2]

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
targetVector to concatenate the byte representation of the integral value to.
srcIntegral value to concatenate.
lennumber of bytes to concatenate. This value must be smaller or equal to the size of type T.

Definition at line 64 of file xmss_tools.h.

64 {
65 size_t c = static_cast<size_t>(std::min(len, sizeof(src)));
66 if(len > sizeof(src)) {
67 target.resize(target.size() + len - sizeof(src), 0);
68 }
69
70 const uint8_t* src_bytes = reinterpret_cast<const uint8_t*>(&src);
72 std::reverse_copy(src_bytes, src_bytes + c, std::back_inserter(target));
73 } else {
74 std::copy(src_bytes + sizeof(src) - c, src_bytes + sizeof(src), std::back_inserter(target));
75 }
76}

References Botan::CPUID::is_little_endian().

◆ operator=()

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

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