aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2015-11-16 16:56:28 -0500
committerJack Lloyd <[email protected]>2015-11-16 16:56:28 -0500
commit9da0769c946cf7904745ed562a8c595806f29464 (patch)
tree80a5cc6126d62e2370909513c1eaaceef63f1889 /src/lib/math
parente2480dedcabf44fcc41641785c81bcafb16727fc (diff)
Remove mul128.h header from public view
The only reason mul128.h was included in mp_types.h was for the definition of dword. But dword is only needed by the generic version of mp_madd, which is an internal header. So move both the inclusion of the header and the dword definition to there. Previously mul128.h was very public (mp_types.h to bigint.h to rsa.h, for example) and use of __int128 causes problems in pedantic mode. So additionally, prefer using the TI attribute version since GCC does not complain about that. Clang's -Wpedantic does not seem to care about it either way. GH #330
Diffstat (limited to 'src/lib/math')
-rw-r--r--src/lib/math/mp/mp_generic/mp_madd.h21
-rw-r--r--src/lib/math/mp/mp_types.h13
2 files changed, 21 insertions, 13 deletions
diff --git a/src/lib/math/mp/mp_generic/mp_madd.h b/src/lib/math/mp/mp_generic/mp_madd.h
index 292c23e97..3b0487356 100644
--- a/src/lib/math/mp/mp_generic/mp_madd.h
+++ b/src/lib/math/mp/mp_generic/mp_madd.h
@@ -13,6 +13,27 @@
namespace Botan {
+#if (BOTAN_MP_WORD_BITS == 8)
+ typedef u16bit dword;
+ #define BOTAN_HAS_MP_DWORD
+#elif (BOTAN_MP_WORD_BITS == 16)
+ typedef u32bit dword;
+ #define BOTAN_HAS_MP_DWORD
+#elif (BOTAN_MP_WORD_BITS == 32)
+ typedef u64bit dword;
+ #define BOTAN_HAS_MP_DWORD
+#elif (BOTAN_MP_WORD_BITS == 64)
+
+ #include <botan/mul128.h>
+
+ #if defined(BOTAN_TARGET_HAS_NATIVE_UINT128)
+ typedef uint128_t dword;
+ #define BOTAN_HAS_MP_DWORD
+ #endif
+#else
+ #error BOTAN_MP_WORD_BITS must be 8, 16, 32, or 64
+#endif
+
/*
* Word Multiply/Add
*/
diff --git a/src/lib/math/mp/mp_types.h b/src/lib/math/mp/mp_types.h
index eab0d0c6c..69dc911fd 100644
--- a/src/lib/math/mp/mp_types.h
+++ b/src/lib/math/mp/mp_types.h
@@ -9,30 +9,17 @@
#define BOTAN_MPI_TYPES_H__
#include <botan/types.h>
-#include <botan/mul128.h>
namespace Botan {
#if (BOTAN_MP_WORD_BITS == 8)
typedef byte word;
- typedef u16bit dword;
- #define BOTAN_HAS_MP_DWORD
#elif (BOTAN_MP_WORD_BITS == 16)
typedef u16bit word;
- typedef u32bit dword;
- #define BOTAN_HAS_MP_DWORD
#elif (BOTAN_MP_WORD_BITS == 32)
typedef u32bit word;
- typedef u64bit dword;
- #define BOTAN_HAS_MP_DWORD
#elif (BOTAN_MP_WORD_BITS == 64)
typedef u64bit word;
-
- #if defined(BOTAN_TARGET_HAS_NATIVE_UINT128)
- typedef uint128_t dword;
- #define BOTAN_HAS_MP_DWORD
- #endif
-
#else
#error BOTAN_MP_WORD_BITS must be 8, 16, 32, or 64
#endif