aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Gierlings <[email protected]>2017-10-21 01:15:41 +0200
committerMatthias Gierlings <[email protected]>2017-11-21 21:03:16 +0100
commit407760dc7876ed1af47233cd1f523f514c9be75e (patch)
tree8facf0003ca4a1e1d5152428eb4659911e1fb1df /src
parent306a665f07e21eefa19f1f9c047ed9e5bd9ba224 (diff)
Adds guards for environments without threads
Diffstat (limited to 'src')
-rw-r--r--src/lib/pubkey/xmss/xmss_privatekey.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/pubkey/xmss/xmss_privatekey.cpp b/src/lib/pubkey/xmss/xmss_privatekey.cpp
index cb1afbb54..51e67bc18 100644
--- a/src/lib/pubkey/xmss/xmss_privatekey.cpp
+++ b/src/lib/pubkey/xmss/xmss_privatekey.cpp
@@ -18,7 +18,9 @@
#include <botan/xmss_privatekey.h>
#include <botan/internal/xmss_signature_operation.h>
#include <cmath>
-#include <thread>
+#if defined(BOTAN_TARGET_OS_HAS_THREADS)
+ #include <thread>
+#endif
namespace Botan {
@@ -92,6 +94,7 @@ XMSS_PrivateKey::tree_hash(size_t start_idx,
BOTAN_ASSERT((start_idx % (1 << target_node_height)) == 0,
"Start index must be divisible by 2^{target node height}.");
+#if defined(BOTAN_TARGET_OS_HAS_THREADS)
// dertermine number of parallel tasks to split the tree_hashing into.
size_t split_level = std::min(
{
@@ -103,9 +106,11 @@ XMSS_PrivateKey::tree_hash(size_t start_idx,
// skip parallelization overhead for leaf nodes.
if(split_level == 0)
{
+#endif
secure_vector<uint8_t> result;
tree_hash_subtree(result, start_idx, target_node_height, adrs);
return result;
+#if defined(BOTAN_TARGET_OS_HAS_THREADS)
}
size_t subtrees = 1 << split_level;
@@ -202,6 +207,7 @@ XMSS_PrivateKey::tree_hash(size_t start_idx,
node_addresses[0],
this->public_seed());
return nodes[0];
+#endif
}
void