diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-09-16 08:53:18 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-09-16 08:53:18 -0700 |
| commit | 8d2e20ede621a3fa5295725f33459a95251c9644 (patch) | |
| tree | bef4c70d1a43a89fe0082b9399a0ef1799a20d00 /node | |
| parent | 5c1c70a6043a6406b58fcf2f13e4cdd629c9757e (diff) | |
| download | infinitytier-8d2e20ede621a3fa5295725f33459a95251c9644.tar.gz infinitytier-8d2e20ede621a3fa5295725f33459a95251c9644.zip | |
Get rid of __align stuff in Salsa20 -- not portable, does not seem to help much on newer chips.
Diffstat (limited to 'node')
| -rw-r--r-- | node/Salsa20.cpp | 8 | ||||
| -rw-r--r-- | node/Salsa20.hpp | 13 |
2 files changed, 7 insertions, 14 deletions
diff --git a/node/Salsa20.cpp b/node/Salsa20.cpp index 1ec6a272..030c1cf4 100644 --- a/node/Salsa20.cpp +++ b/node/Salsa20.cpp @@ -144,10 +144,10 @@ void Salsa20::encrypt(const void *in,void *out,unsigned int bytes) } #ifdef ZT_SALSA20_SSE - __m128i X0 = _mm_load_si128((const __m128i *)&(_state.v[0])); - __m128i X1 = _mm_load_si128((const __m128i *)&(_state.v[1])); - __m128i X2 = _mm_load_si128((const __m128i *)&(_state.v[2])); - __m128i X3 = _mm_load_si128((const __m128i *)&(_state.v[3])); + __m128i X0 = _mm_loadu_si128((const __m128i *)&(_state.v[0])); + __m128i X1 = _mm_loadu_si128((const __m128i *)&(_state.v[1])); + __m128i X2 = _mm_loadu_si128((const __m128i *)&(_state.v[2])); + __m128i X3 = _mm_loadu_si128((const __m128i *)&(_state.v[3])); __m128i X0s = X0; __m128i X1s = X1; __m128i X2s = X2; diff --git a/node/Salsa20.hpp b/node/Salsa20.hpp index 6e485bac..0c1f3be4 100644 --- a/node/Salsa20.hpp +++ b/node/Salsa20.hpp @@ -13,14 +13,7 @@ #ifdef ZT_SALSA20_SSE #include <emmintrin.h> -#ifdef __GCC__ -#define ZT_SALSA20_SSE_ALIGN __attribute__((aligned (16))) -#else -#define ZT_SALSA20_SSE_ALIGN __declspec(align(16)) -#endif -#else -#define ZT_SALSA20_SSE_ALIGN -#endif +#endif // ZT_SALSA20_SSE namespace ZeroTier { @@ -79,10 +72,10 @@ public: } private: - volatile ZT_SALSA20_SSE_ALIGN union { + volatile union { #ifdef ZT_SALSA20_SSE __m128i v[4]; -#endif +#endif // ZT_SALSA20_SSE uint32_t i[16]; } _state; unsigned int _roundsDiv2; |
