diff options
author | Jack Lloyd <[email protected]> | 2017-09-21 13:49:14 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-21 13:49:14 -0400 |
commit | 5cc5e1bd3fac87186f511a48cee9cda86e4607ca (patch) | |
tree | ea64916bb405f215bc5aed2cddfecdc85322bada /src/lib/pubkey | |
parent | b331caf9ae61410aaa6e7e7fc4b33267562bd78e (diff) |
Clean up header includes
Avoid including build.h or assert.h directly, instead always take
them though types.h
Avoid math.h in favor of cmath
Diffstat (limited to 'src/lib/pubkey')
-rw-r--r-- | src/lib/pubkey/xmss/xmss_common_ops.h | 1 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_hash.h | 5 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_parameters.cpp | 1 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_parameters.h | 7 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_privatekey.cpp | 3 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_privatekey.h | 1 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_publickey.h | 1 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_signature.cpp | 3 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_signature_operation.h | 1 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_verification_operation.h | 1 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_wots_parameters.cpp | 6 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_wots_parameters.h | 11 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_wots_privatekey.h | 1 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_wots_publickey.h | 1 | ||||
-rw-r--r-- | src/lib/pubkey/xmss/xmss_wots_signature_operation.h | 1 |
15 files changed, 13 insertions, 31 deletions
diff --git a/src/lib/pubkey/xmss/xmss_common_ops.h b/src/lib/pubkey/xmss/xmss_common_ops.h index 66fc76ef0..176582efe 100644 --- a/src/lib/pubkey/xmss/xmss_common_ops.h +++ b/src/lib/pubkey/xmss/xmss_common_ops.h @@ -10,7 +10,6 @@ #include <vector> #include <botan/secmem.h> -#include <botan/assert.h> #include <botan/xmss_parameters.h> #include <botan/xmss_address.h> #include <botan/xmss_hash.h> diff --git a/src/lib/pubkey/xmss/xmss_hash.h b/src/lib/pubkey/xmss/xmss_hash.h index d507c96f6..7dcfb8465 100644 --- a/src/lib/pubkey/xmss/xmss_hash.h +++ b/src/lib/pubkey/xmss/xmss_hash.h @@ -8,12 +8,7 @@ #ifndef BOTAN_XMSS_HASH_H_ #define BOTAN_XMSS_HASH_H_ -#include <cstddef> -#include <string> -#include <botan/assert.h> #include <botan/hash.h> -#include <botan/secmem.h> -#include <botan/types.h> namespace Botan { diff --git a/src/lib/pubkey/xmss/xmss_parameters.cpp b/src/lib/pubkey/xmss/xmss_parameters.cpp index cc4d923dd..f6d630875 100644 --- a/src/lib/pubkey/xmss/xmss_parameters.cpp +++ b/src/lib/pubkey/xmss/xmss_parameters.cpp @@ -13,6 +13,7 @@ **/ #include <botan/xmss_parameters.h> +#include <botan/exceptn.h> namespace Botan { diff --git a/src/lib/pubkey/xmss/xmss_parameters.h b/src/lib/pubkey/xmss/xmss_parameters.h index 413941b4c..a2f763d97 100644 --- a/src/lib/pubkey/xmss/xmss_parameters.h +++ b/src/lib/pubkey/xmss/xmss_parameters.h @@ -8,12 +8,9 @@ #ifndef BOTAN_XMSS_PARAMETERS_H_ #define BOTAN_XMSS_PARAMETERS_H_ -#include <cstddef> -#include <map> -#include <string> -#include <botan/assert.h> -#include <botan/types.h> #include <botan/xmss_wots_parameters.h> +#include <string> +#include <map> namespace Botan { diff --git a/src/lib/pubkey/xmss/xmss_privatekey.cpp b/src/lib/pubkey/xmss/xmss_privatekey.cpp index 3f2f949ca..753893c8c 100644 --- a/src/lib/pubkey/xmss/xmss_privatekey.cpp +++ b/src/lib/pubkey/xmss/xmss_privatekey.cpp @@ -17,6 +17,7 @@ #include <botan/internal/xmss_signature_operation.h> #include <botan/xmss_privatekey.h> +#include <cmath> namespace Botan { @@ -26,7 +27,7 @@ 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) >= ceil( + 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."); diff --git a/src/lib/pubkey/xmss/xmss_privatekey.h b/src/lib/pubkey/xmss/xmss_privatekey.h index 335f3120d..b5cbf9cac 100644 --- a/src/lib/pubkey/xmss/xmss_privatekey.h +++ b/src/lib/pubkey/xmss/xmss_privatekey.h @@ -12,7 +12,6 @@ #include <iterator> #include <memory> #include <botan/alg_id.h> -#include <botan/assert.h> #include <botan/exceptn.h> #include <botan/pk_keys.h> #include <botan/rng.h> diff --git a/src/lib/pubkey/xmss/xmss_publickey.h b/src/lib/pubkey/xmss/xmss_publickey.h index fbf474793..af14b15b6 100644 --- a/src/lib/pubkey/xmss/xmss_publickey.h +++ b/src/lib/pubkey/xmss/xmss_publickey.h @@ -15,7 +15,6 @@ #include <botan/alg_id.h> #include <botan/asn1_oid.h> #include <botan/der_enc.h> -#include <botan/assert.h> #include <botan/exceptn.h> #include <botan/rng.h> #include <botan/types.h> diff --git a/src/lib/pubkey/xmss/xmss_signature.cpp b/src/lib/pubkey/xmss/xmss_signature.cpp index 497a25f2b..8dbb17909 100644 --- a/src/lib/pubkey/xmss/xmss_signature.cpp +++ b/src/lib/pubkey/xmss/xmss_signature.cpp @@ -6,6 +6,7 @@ **/ #include <botan/internal/xmss_signature.h> +#include <cmath> namespace Botan { @@ -13,7 +14,7 @@ XMSS_Signature::XMSS_Signature(XMSS_Parameters::xmss_algorithm_t oid, const secure_vector<uint8_t>& raw_sig) : m_leaf_idx(0), m_randomness(0, 0x00), m_tree_sig() { - BOTAN_ASSERT(sizeof(size_t) >= ceil(static_cast<float>( + BOTAN_ASSERT(sizeof(size_t) >= std::ceil(static_cast<float>( (XMSS_Parameters(oid)).tree_height()) / 8.f), "System type \"size_t\" not big enough to support" " leaf index."); diff --git a/src/lib/pubkey/xmss/xmss_signature_operation.h b/src/lib/pubkey/xmss/xmss_signature_operation.h index 10197a093..7a5845818 100644 --- a/src/lib/pubkey/xmss/xmss_signature_operation.h +++ b/src/lib/pubkey/xmss/xmss_signature_operation.h @@ -12,7 +12,6 @@ #include <string> #include <botan/secmem.h> #include <botan/types.h> -#include <botan/assert.h> #include <botan/xmss_parameters.h> #include <botan/xmss_privatekey.h> #include <botan/xmss_address.h> diff --git a/src/lib/pubkey/xmss/xmss_verification_operation.h b/src/lib/pubkey/xmss/xmss_verification_operation.h index 948550193..de8816134 100644 --- a/src/lib/pubkey/xmss/xmss_verification_operation.h +++ b/src/lib/pubkey/xmss/xmss_verification_operation.h @@ -12,7 +12,6 @@ #include <cstddef> #include <iterator> #include <string> -#include <botan/assert.h> #include <botan/types.h> #include <botan/xmss_publickey.h> #include <botan/xmss_common_ops.h> diff --git a/src/lib/pubkey/xmss/xmss_wots_parameters.cpp b/src/lib/pubkey/xmss/xmss_wots_parameters.cpp index 704bcab36..20f758ed2 100644 --- a/src/lib/pubkey/xmss/xmss_wots_parameters.cpp +++ b/src/lib/pubkey/xmss/xmss_wots_parameters.cpp @@ -14,6 +14,8 @@ **/ #include <botan/xmss_wots_parameters.h> +#include <botan/exceptn.h> +#include <cmath> namespace Botan { @@ -80,7 +82,7 @@ XMSS_WOTS_Parameters::XMSS_WOTS_Parameters(ots_algorithm_t oid) } m_w == 16 ? m_lg_w = 4 : m_lg_w = 2; - m_len_1 = static_cast<size_t>(ceil((8 * element_size()) / m_lg_w)); + m_len_1 = static_cast<size_t>(std::ceil((8 * element_size()) / m_lg_w)); m_len_2 = static_cast<size_t>( floor(log2(m_len_1 * (wots_parameter() - 1)) / m_lg_w) + 1); BOTAN_ASSERT(m_len == m_len_1 + m_len_2, "Invalid XMSS WOTS parameter " @@ -114,7 +116,7 @@ XMSS_WOTS_Parameters::base_w(size_t value) const { value <<= (8 - ((m_len_2 * m_lg_w) % 8)); size_t len_2_bytes = static_cast<size_t>( - ceil(static_cast<float>(m_len_2 * m_lg_w) / 8.f)); + std::ceil(static_cast<float>(m_len_2 * m_lg_w) / 8.f)); secure_vector<uint8_t> result; XMSS_Tools::concat(result, value, len_2_bytes); return base_w(result, m_len_2); diff --git a/src/lib/pubkey/xmss/xmss_wots_parameters.h b/src/lib/pubkey/xmss/xmss_wots_parameters.h index a1cd8e971..0e16b900b 100644 --- a/src/lib/pubkey/xmss/xmss_wots_parameters.h +++ b/src/lib/pubkey/xmss/xmss_wots_parameters.h @@ -8,17 +8,10 @@ #ifndef BOTAN_XMSS_WOTS_PARAMETERS_H_ #define BOTAN_XMSS_WOTS_PARAMETERS_H_ -#include <cstddef> -#include <cstdint> -#include <iterator> +#include <botan/xmss_tools.h> +#include <botan/secmem.h> #include <map> #include <string> -#include <math.h> -#include <botan/assert.h> -#include <botan/types.h> -#include <botan/secmem.h> -#include <botan/exceptn.h> -#include <botan/xmss_tools.h> namespace Botan { diff --git a/src/lib/pubkey/xmss/xmss_wots_privatekey.h b/src/lib/pubkey/xmss/xmss_wots_privatekey.h index 69d4234c4..fa8a23cad 100644 --- a/src/lib/pubkey/xmss/xmss_wots_privatekey.h +++ b/src/lib/pubkey/xmss/xmss_wots_privatekey.h @@ -11,7 +11,6 @@ #include <cstddef> #include <memory> #include <botan/alg_id.h> -#include <botan/assert.h> #include <botan/exceptn.h> #include <botan/pk_keys.h> #include <botan/types.h> diff --git a/src/lib/pubkey/xmss/xmss_wots_publickey.h b/src/lib/pubkey/xmss/xmss_wots_publickey.h index e111702be..86b4bc803 100644 --- a/src/lib/pubkey/xmss/xmss_wots_publickey.h +++ b/src/lib/pubkey/xmss/xmss_wots_publickey.h @@ -13,7 +13,6 @@ #include <vector> #include <botan/alg_id.h> #include <botan/asn1_oid.h> -#include <botan/assert.h> #include <botan/exceptn.h> #include <botan/pk_keys.h> #include <botan/types.h> diff --git a/src/lib/pubkey/xmss/xmss_wots_signature_operation.h b/src/lib/pubkey/xmss/xmss_wots_signature_operation.h index d9d559cb2..271766e87 100644 --- a/src/lib/pubkey/xmss/xmss_wots_signature_operation.h +++ b/src/lib/pubkey/xmss/xmss_wots_signature_operation.h @@ -10,7 +10,6 @@ #include <cstddef> #include <iterator> -#include <botan/assert.h> #include <botan/types.h> #include <botan/pk_ops.h> #include <botan/internal/xmss_wots_addressed_privatekey.h> |