aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-08-23 10:38:39 -0400
committerJack Lloyd <[email protected]>2017-08-23 10:38:39 -0400
commit767b4018ab2b5a651ec1db105778e29317366d97 (patch)
treea8a45fdc0269235d0352e2234b017f49599e29e8
parentd97fd8356fc1eaacf44f636dcf31b4dae057cb74 (diff)
Fix bug affecting AltiVec on ppc64le processors
-rw-r--r--news.rst3
-rw-r--r--src/lib/utils/simd/simd_32.h10
2 files changed, 5 insertions, 8 deletions
diff --git a/news.rst b/news.rst
index 3624280e5..c3304302b 100644
--- a/news.rst
+++ b/news.rst
@@ -35,6 +35,9 @@ Version 2.3.0, Not Yet Released
* Workaround a GCC 7 bug that caused miscompilation of the GOST-34.11 hash
function on x86-32. (GH #882 #1148)
+* Fix a bug in SIMD_4x32 which affected little-endian PowerPC processors.
+ This would cause test failures for Serpent, among other problems.
+
* Fix Altivec runtime detection, which was broken starting in Botan 2.1.0
* Silence a Clang warning in create_private_key (GH #1150)
diff --git a/src/lib/utils/simd/simd_32.h b/src/lib/utils/simd/simd_32.h
index def933f4a..6d9223a38 100644
--- a/src/lib/utils/simd/simd_32.h
+++ b/src/lib/utils/simd/simd_32.h
@@ -214,18 +214,12 @@ class SIMD_4x32 final
#elif defined(BOTAN_SIMD_USE_ALTIVEC)
- __vector unsigned char perm = vec_lvsl(0, static_cast<uint32_t*>(nullptr));
- if(CPUID::is_big_endian())
- {
- perm = vec_xor(perm, vec_splat_u8(3)); // bswap vector
- }
-
union {
__vector unsigned int V;
uint32_t R[4];
} vec;
- vec.V = vec_perm(m_vmx, m_vmx, perm);
- Botan::store_be(out, vec.R[0], vec.R[1], vec.R[2], vec.R[3]);
+ vec.V = m_vmx;
+ Botan::store_le(out, vec.R[0], vec.R[1], vec.R[2], vec.R[3]);
#elif defined(BOTAN_SIMD_USE_NEON)