#include <xmss_tools.h>
|
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) |
|
Helper tools for low level byte operations required for the XMSS implementation.
Definition at line 23 of file xmss_tools.h.
◆ XMSS_Tools() [1/2]
Botan::XMSS_Tools::XMSS_Tools |
( |
| ) |
|
|
delete |
◆ XMSS_Tools() [2/2]
Botan::XMSS_Tools::XMSS_Tools |
( |
const XMSS_Tools & | | ) |
|
|
delete |
◆ 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
-
target | Vector to concatenate the byte representation of the integral value to. |
src | integral value to concatenate. |
Definition at line 55 of file xmss_tools.h.
55 {
56 const uint8_t* src_bytes = reinterpret_cast<const uint8_t*>(&src);
57 if constexpr(std::endian::native == std::endian::little) {
58 std::reverse_copy(src_bytes, src_bytes + sizeof(src), std::back_inserter(target));
59 } else {
60 std::copy(src_bytes, src_bytes + sizeof(src), std::back_inserter(target));
61 }
62}
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
-
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 65 of file xmss_tools.h.
65 {
66 size_t c = static_cast<size_t>(std::min(len, sizeof(src)));
67 if(len > sizeof(src)) {
68 target.resize(target.size() + len - sizeof(src), 0);
69 }
70
71 const uint8_t* src_bytes = reinterpret_cast<const uint8_t*>(&src);
72 if constexpr(std::endian::native == std::endian::little) {
73 std::reverse_copy(src_bytes, src_bytes + c, std::back_inserter(target));
74 } else {
75 std::copy(src_bytes + sizeof(src) - c, src_bytes + sizeof(src), std::back_inserter(target));
76 }
77}
◆ operator=()
void Botan::XMSS_Tools::operator= |
( |
const XMSS_Tools & | | ) |
|
|
delete |
The documentation for this class was generated from the following file: