From 767b4018ab2b5a651ec1db105778e29317366d97 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Wed, 23 Aug 2017 10:38:39 -0400 Subject: Fix bug affecting AltiVec on ppc64le processors --- news.rst | 3 +++ src/lib/utils/simd/simd_32.h | 10 ++-------- 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(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) -- cgit v1.2.3