aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-03-26 10:19:58 -0400
committerJack Lloyd <[email protected]>2019-03-26 10:19:58 -0400
commit9a6dc4dc7489fe087668488e17b82830a9d64a39 (patch)
treef37925539dcc079d700c06687683c27c6ee99ce0 /src
parent9d4dc5b82c42d2e94ff8c72957a34f473345bc8e (diff)
Remove unnecessary cmath includes
Diffstat (limited to 'src')
-rw-r--r--src/lib/pubkey/xmss/xmss_privatekey.cpp14
-rw-r--r--src/lib/pubkey/xmss/xmss_signature.cpp1
2 files changed, 9 insertions, 6 deletions
diff --git a/src/lib/pubkey/xmss/xmss_privatekey.cpp b/src/lib/pubkey/xmss/xmss_privatekey.cpp
index a5b64d559..0cdcc57ce 100644
--- a/src/lib/pubkey/xmss/xmss_privatekey.cpp
+++ b/src/lib/pubkey/xmss/xmss_privatekey.cpp
@@ -18,7 +18,6 @@
#include <botan/xmss_privatekey.h>
#include <botan/internal/xmss_signature_operation.h>
-#include <cmath>
#if defined(BOTAN_HAS_THREAD_UTILS)
#include <botan/internal/thread_pool.h>
@@ -32,10 +31,15 @@ XMSS_PrivateKey::XMSS_PrivateKey(const secure_vector<uint8_t>& raw_key)
m_wots_priv_key(m_wots_params.oid(), m_public_seed),
m_index_reg(XMSS_Index_Registry::get_instance())
{
- BOTAN_ASSERT(sizeof(size_t) >= std::ceil(
- static_cast<float>(XMSS_PublicKey::m_xmss_params.tree_height()) / 8.f),
- "System type \"size_t\" not big enough to support"
- " leaf index.");
+ /*
+ The code requires sizeof(size_t) >= ceil(tree_height / 8)
+
+ Maximum supported tree height is 20, ceil(20/8) == 3, so 4 byte
+ size_t is sufficient for all defined parameters, or even a
+ (hypothetical) tree height 32, which would be extremely slow to
+ compute.
+ */
+ static_assert(sizeof(size_t) >= 4, "size_t is big enough to support leaf index");
if(raw_key.size() != size())
{
diff --git a/src/lib/pubkey/xmss/xmss_signature.cpp b/src/lib/pubkey/xmss/xmss_signature.cpp
index 2ba8a1965..7e194a0eb 100644
--- a/src/lib/pubkey/xmss/xmss_signature.cpp
+++ b/src/lib/pubkey/xmss/xmss_signature.cpp
@@ -6,7 +6,6 @@
**/
#include <botan/internal/xmss_signature.h>
-#include <cmath>
namespace Botan {