aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/xmss/xmss_signature.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/pubkey/xmss/xmss_signature.cpp')
-rw-r--r--src/lib/pubkey/xmss/xmss_signature.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/lib/pubkey/xmss/xmss_signature.cpp b/src/lib/pubkey/xmss/xmss_signature.cpp
index 7e194a0eb..fddf8581f 100644
--- a/src/lib/pubkey/xmss/xmss_signature.cpp
+++ b/src/lib/pubkey/xmss/xmss_signature.cpp
@@ -16,12 +16,12 @@ XMSS_Signature::XMSS_Signature(XMSS_Parameters::xmss_algorithm_t oid,
XMSS_Parameters xmss_params(oid);
if(raw_sig.size() != (xmss_params.len() + xmss_params.tree_height() + 1)
- * xmss_params.element_size() + sizeof(m_leaf_idx))
+ * xmss_params.element_size() + sizeof(uint32_t))
{
throw Decoding_Error("XMSS signature size invalid.");
}
- for(size_t i = 0; i < 8; i++)
+ for(size_t i = 0; i < 4; i++)
{ m_leaf_idx = ((m_leaf_idx << 8) | raw_sig[i]); }
if(m_leaf_idx >= (1ull << xmss_params.tree_height()))
@@ -29,7 +29,7 @@ XMSS_Signature::XMSS_Signature(XMSS_Parameters::xmss_algorithm_t oid,
throw Decoding_Error("XMSS signature leaf index out of bounds.");
}
- auto begin = raw_sig.begin() + sizeof(m_leaf_idx);
+ auto begin = raw_sig.begin() + sizeof(uint32_t);
auto end = begin + xmss_params.element_size();
std::copy(begin, end, std::back_inserter(m_randomness));
@@ -62,10 +62,6 @@ secure_vector<uint8_t> XMSS_Signature::bytes() const
{
secure_vector<uint8_t> result
{
- static_cast<uint8_t>(m_leaf_idx >> 56U),
- static_cast<uint8_t>(m_leaf_idx >> 48U),
- static_cast<uint8_t>(m_leaf_idx >> 40U),
- static_cast<uint8_t>(m_leaf_idx >> 32U),
static_cast<uint8_t>(m_leaf_idx >> 24U),
static_cast<uint8_t>(m_leaf_idx >> 16U),
static_cast<uint8_t>(m_leaf_idx >> 8U),