aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-12-20 20:22:03 -0500
committerJack Lloyd <[email protected]>2018-12-21 10:07:15 -0500
commit43875971d5d6c04035b4e1c27558e2ba9a48fe97 (patch)
treeb8231e9c7d8836a899d23d5bb0e11fcff50f21d3 /src
parent2f60e29e5688bf81719f0f907d658c083378811b (diff)
Avoid including rotate.h in bswap.h
It was only needed for one case which is easily hardcoded. Include rotate.h in all the source files that actually use rotr/rotl but implicitly picked it up via loadstor.h -> bswap.h -> rotate.h include chain.
Diffstat (limited to 'src')
-rw-r--r--src/lib/block/aes/aes.cpp1
-rw-r--r--src/lib/block/aria/aria.cpp1
-rw-r--r--src/lib/block/camellia/camellia.cpp1
-rw-r--r--src/lib/block/cast128/cast128.cpp1
-rw-r--r--src/lib/block/cast256/cast256.cpp1
-rw-r--r--src/lib/block/des/des.cpp1
-rw-r--r--src/lib/block/gost_28147/gost_28147.cpp1
-rw-r--r--src/lib/block/kasumi/kasumi.cpp1
-rw-r--r--src/lib/block/noekeon/noekeon.cpp1
-rw-r--r--src/lib/block/serpent/serpent.cpp1
-rw-r--r--src/lib/block/shacal2/shacal2.cpp1
-rw-r--r--src/lib/block/sm4/sm4.cpp1
-rw-r--r--src/lib/block/threefish_512/threefish_512.cpp1
-rw-r--r--src/lib/hash/md4/md4.cpp1
-rw-r--r--src/lib/hash/md5/md5.cpp1
-rw-r--r--src/lib/hash/rmd160/rmd160.cpp1
-rw-r--r--src/lib/hash/sha1/sha160.cpp1
-rw-r--r--src/lib/hash/sha1/sha1_sse2/sha1_sse2.cpp1
-rw-r--r--src/lib/hash/sha2_32/sha2_32.cpp1
-rw-r--r--src/lib/hash/sha2_64/sha2_64.cpp1
-rw-r--r--src/lib/hash/sha3/sha3.cpp1
-rw-r--r--src/lib/hash/sm3/sm3.cpp1
-rw-r--r--src/lib/mac/siphash/siphash.cpp1
-rw-r--r--src/lib/stream/chacha/chacha.cpp1
-rw-r--r--src/lib/stream/salsa20/salsa20.cpp1
-rw-r--r--src/lib/utils/bswap.h3
-rw-r--r--src/lib/utils/simd/simd_32.h3
-rw-r--r--src/tests/test_simd.cpp1
28 files changed, 30 insertions, 2 deletions
diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp
index 0c18e93ee..54a2668c1 100644
--- a/src/lib/block/aes/aes.cpp
+++ b/src/lib/block/aes/aes.cpp
@@ -10,6 +10,7 @@
#include <botan/aes.h>
#include <botan/loadstor.h>
#include <botan/cpuid.h>
+#include <botan/rotate.h>
#include <type_traits>
/*
diff --git a/src/lib/block/aria/aria.cpp b/src/lib/block/aria/aria.cpp
index 71df4836b..e92580361 100644
--- a/src/lib/block/aria/aria.cpp
+++ b/src/lib/block/aria/aria.cpp
@@ -18,6 +18,7 @@
#include <botan/aria.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
#include <botan/cpuid.h>
namespace Botan {
diff --git a/src/lib/block/camellia/camellia.cpp b/src/lib/block/camellia/camellia.cpp
index fa0200a16..31aafd838 100644
--- a/src/lib/block/camellia/camellia.cpp
+++ b/src/lib/block/camellia/camellia.cpp
@@ -7,6 +7,7 @@
#include <botan/camellia.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/block/cast128/cast128.cpp b/src/lib/block/cast128/cast128.cpp
index 442c6fc58..7ed7aa5e7 100644
--- a/src/lib/block/cast128/cast128.cpp
+++ b/src/lib/block/cast128/cast128.cpp
@@ -8,6 +8,7 @@
#include <botan/cast128.h>
#include <botan/internal/cast_sboxes.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/block/cast256/cast256.cpp b/src/lib/block/cast256/cast256.cpp
index cd5175dd7..226955f7c 100644
--- a/src/lib/block/cast256/cast256.cpp
+++ b/src/lib/block/cast256/cast256.cpp
@@ -8,6 +8,7 @@
#include <botan/cast256.h>
#include <botan/internal/cast_sboxes.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/block/des/des.cpp b/src/lib/block/des/des.cpp
index 885daa05c..1e6539d87 100644
--- a/src/lib/block/des/des.cpp
+++ b/src/lib/block/des/des.cpp
@@ -10,6 +10,7 @@
#include <botan/des.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/block/gost_28147/gost_28147.cpp b/src/lib/block/gost_28147/gost_28147.cpp
index 45b23d55f..2b8aa031e 100644
--- a/src/lib/block/gost_28147/gost_28147.cpp
+++ b/src/lib/block/gost_28147/gost_28147.cpp
@@ -8,6 +8,7 @@
#include <botan/gost_28147.h>
#include <botan/exceptn.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/block/kasumi/kasumi.cpp b/src/lib/block/kasumi/kasumi.cpp
index a40a9d9d5..a715cfc13 100644
--- a/src/lib/block/kasumi/kasumi.cpp
+++ b/src/lib/block/kasumi/kasumi.cpp
@@ -7,6 +7,7 @@
#include <botan/kasumi.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/block/noekeon/noekeon.cpp b/src/lib/block/noekeon/noekeon.cpp
index 5fd5be82a..0a820c701 100644
--- a/src/lib/block/noekeon/noekeon.cpp
+++ b/src/lib/block/noekeon/noekeon.cpp
@@ -7,6 +7,7 @@
#include <botan/noekeon.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
#include <botan/cpuid.h>
namespace Botan {
diff --git a/src/lib/block/serpent/serpent.cpp b/src/lib/block/serpent/serpent.cpp
index 77cf9f32b..35231cab5 100644
--- a/src/lib/block/serpent/serpent.cpp
+++ b/src/lib/block/serpent/serpent.cpp
@@ -7,6 +7,7 @@
#include <botan/serpent.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
#include <botan/internal/serpent_sbox.h>
#if defined(BOTAN_HAS_SERPENT_SIMD)
diff --git a/src/lib/block/shacal2/shacal2.cpp b/src/lib/block/shacal2/shacal2.cpp
index 3de838329..6fe08800a 100644
--- a/src/lib/block/shacal2/shacal2.cpp
+++ b/src/lib/block/shacal2/shacal2.cpp
@@ -7,6 +7,7 @@
#include <botan/shacal2.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
#include <botan/cpuid.h>
namespace Botan {
diff --git a/src/lib/block/sm4/sm4.cpp b/src/lib/block/sm4/sm4.cpp
index e8f73e185..eb30af9d7 100644
--- a/src/lib/block/sm4/sm4.cpp
+++ b/src/lib/block/sm4/sm4.cpp
@@ -8,6 +8,7 @@
#include <botan/sm4.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
#include <botan/cpuid.h>
namespace Botan {
diff --git a/src/lib/block/threefish_512/threefish_512.cpp b/src/lib/block/threefish_512/threefish_512.cpp
index 7c368b409..e34a9e0dc 100644
--- a/src/lib/block/threefish_512/threefish_512.cpp
+++ b/src/lib/block/threefish_512/threefish_512.cpp
@@ -7,6 +7,7 @@
#include <botan/threefish_512.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
#include <botan/cpuid.h>
namespace Botan {
diff --git a/src/lib/hash/md4/md4.cpp b/src/lib/hash/md4/md4.cpp
index 1c048a6b3..c0c3472de 100644
--- a/src/lib/hash/md4/md4.cpp
+++ b/src/lib/hash/md4/md4.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/md4.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/hash/md5/md5.cpp b/src/lib/hash/md5/md5.cpp
index de75ab2d1..3b9b4d281 100644
--- a/src/lib/hash/md5/md5.cpp
+++ b/src/lib/hash/md5/md5.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/md5.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/hash/rmd160/rmd160.cpp b/src/lib/hash/rmd160/rmd160.cpp
index 4c84ff422..e85feec08 100644
--- a/src/lib/hash/rmd160/rmd160.cpp
+++ b/src/lib/hash/rmd160/rmd160.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/rmd160.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/hash/sha1/sha160.cpp b/src/lib/hash/sha1/sha160.cpp
index 8c12a4f04..4170722b1 100644
--- a/src/lib/hash/sha1/sha160.cpp
+++ b/src/lib/hash/sha1/sha160.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/sha160.h>
+#include <botan/rotate.h>
#include <botan/cpuid.h>
namespace Botan {
diff --git a/src/lib/hash/sha1/sha1_sse2/sha1_sse2.cpp b/src/lib/hash/sha1/sha1_sse2/sha1_sse2.cpp
index 88e5a0d2c..7371ca08f 100644
--- a/src/lib/hash/sha1/sha1_sse2/sha1_sse2.cpp
+++ b/src/lib/hash/sha1/sha1_sse2/sha1_sse2.cpp
@@ -8,6 +8,7 @@
*/
#include <botan/sha160.h>
+#include <botan/rotate.h>
#include <emmintrin.h>
namespace Botan {
diff --git a/src/lib/hash/sha2_32/sha2_32.cpp b/src/lib/hash/sha2_32/sha2_32.cpp
index 99cc2a6ff..9f1cfd2dc 100644
--- a/src/lib/hash/sha2_32/sha2_32.cpp
+++ b/src/lib/hash/sha2_32/sha2_32.cpp
@@ -7,6 +7,7 @@
*/
#include <botan/sha2_32.h>
+#include <botan/rotate.h>
#include <botan/cpuid.h>
namespace Botan {
diff --git a/src/lib/hash/sha2_64/sha2_64.cpp b/src/lib/hash/sha2_64/sha2_64.cpp
index 45992e996..e614e6b28 100644
--- a/src/lib/hash/sha2_64/sha2_64.cpp
+++ b/src/lib/hash/sha2_64/sha2_64.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/sha2_64.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/hash/sha3/sha3.cpp b/src/lib/hash/sha3/sha3.cpp
index b69ef515a..09c2d8c1b 100644
--- a/src/lib/hash/sha3/sha3.cpp
+++ b/src/lib/hash/sha3/sha3.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/sha3.h>
+#include <botan/rotate.h>
#include <botan/exceptn.h>
namespace Botan {
diff --git a/src/lib/hash/sm3/sm3.cpp b/src/lib/hash/sm3/sm3.cpp
index 83a390008..4c746ce2f 100644
--- a/src/lib/hash/sm3/sm3.cpp
+++ b/src/lib/hash/sm3/sm3.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/sm3.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/mac/siphash/siphash.cpp b/src/lib/mac/siphash/siphash.cpp
index 7d8931c07..30fe354b7 100644
--- a/src/lib/mac/siphash/siphash.cpp
+++ b/src/lib/mac/siphash/siphash.cpp
@@ -6,6 +6,7 @@
*/
#include <botan/siphash.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/stream/chacha/chacha.cpp b/src/lib/stream/chacha/chacha.cpp
index 327454d79..c8d567e5e 100644
--- a/src/lib/stream/chacha/chacha.cpp
+++ b/src/lib/stream/chacha/chacha.cpp
@@ -8,6 +8,7 @@
#include <botan/chacha.h>
#include <botan/exceptn.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
#include <botan/cpuid.h>
namespace Botan {
diff --git a/src/lib/stream/salsa20/salsa20.cpp b/src/lib/stream/salsa20/salsa20.cpp
index 7e22b37be..407a3183e 100644
--- a/src/lib/stream/salsa20/salsa20.cpp
+++ b/src/lib/stream/salsa20/salsa20.cpp
@@ -8,6 +8,7 @@
#include <botan/salsa20.h>
#include <botan/exceptn.h>
#include <botan/loadstor.h>
+#include <botan/rotate.h>
namespace Botan {
diff --git a/src/lib/utils/bswap.h b/src/lib/utils/bswap.h
index 509e911e0..03bebfefa 100644
--- a/src/lib/utils/bswap.h
+++ b/src/lib/utils/bswap.h
@@ -10,7 +10,6 @@
#define BOTAN_BYTE_SWAP_H_
#include <botan/types.h>
-#include <botan/rotate.h>
#if defined(BOTAN_BUILD_COMPILER_IS_MSVC)
#include <stdlib.h>
@@ -26,7 +25,7 @@ inline uint16_t reverse_bytes(uint16_t val)
#if defined(BOTAN_BUILD_COMPILER_IS_GCC) || defined(BOTAN_BUILD_COMPILER_IS_CLANG)
return __builtin_bswap16(val);
#else
- return rotl<8>(val);
+ return static_cast<uint16_t>((val << 8) | (val >> 8));
#endif
}
diff --git a/src/lib/utils/simd/simd_32.h b/src/lib/utils/simd/simd_32.h
index 14e2d47c4..a2e41c20f 100644
--- a/src/lib/utils/simd/simd_32.h
+++ b/src/lib/utils/simd/simd_32.h
@@ -26,6 +26,9 @@
#elif defined(BOTAN_TARGET_SUPPORTS_NEON)
#include <arm_neon.h>
#define BOTAN_SIMD_USE_NEON
+
+#else
+ #include <botan/rotate.h>
#endif
namespace Botan {
diff --git a/src/tests/test_simd.cpp b/src/tests/test_simd.cpp
index 5ff6047a9..3603cb8e9 100644
--- a/src/tests/test_simd.cpp
+++ b/src/tests/test_simd.cpp
@@ -9,6 +9,7 @@
#if defined(BOTAN_HAS_SIMD_32)
#include <botan/internal/simd_32.h>
#include <botan/cpuid.h>
+ #include <botan/rotate.h>
#endif
namespace Botan_Tests {