diff options
author | Jeffrey Walton <noloader@gmail.com> | 2020-04-05 23:16:21 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2020-04-05 23:16:21 -0400 |
commit | 117a39bafdab5fd847c46fc7af26b976fdb558aa (patch) | |
tree | 0baf7b80031af928c24a3a16fb7f7ce5949e69f0 /blake2s_simd.cpp | |
parent | 61513acb94fdae061beac9a589bc7114e1170a32 (diff) | |
download | cryptopp-git-117a39bafdab5fd847c46fc7af26b976fdb558aa.tar.gz |
Fix unaligned PPC64 loads in BLAKSE2s
Diffstat (limited to 'blake2s_simd.cpp')
-rw-r--r-- | blake2s_simd.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/blake2s_simd.cpp b/blake2s_simd.cpp index a6e7bbb2..12387bf2 100644 --- a/blake2s_simd.cpp +++ b/blake2s_simd.cpp @@ -699,34 +699,38 @@ void BLAKE2_Compress32_NEON(const byte* input, BLAKE2s_State& state) #if (CRYPTOPP_ALTIVEC_AVAILABLE)
-inline uint32x4_p VecLoad32(const void* p)
+template <class T>
+inline uint32x4_p VecLoad32(const T* p)
{
- return VecLoad((const word32*)p);
+ return VecLoad(p);
}
-inline uint32x4_p VecLoad32LE(const void* p)
+template <class T>
+inline uint32x4_p VecLoad32LE(const T* p)
{
#if __BIG_ENDIAN__
const uint8x16_p m = {3,2,1,0, 7,6,5,4, 11,10,9,8, 15,14,13,12};
- const uint32x4_p v = VecLoad((const word32*)p);
+ const uint32x4_p v = VecLoad(p);
return VecPermute(v, v, m);
#else
- return VecLoad((const word32*)p);
+ return VecLoad(p);
#endif
}
-inline void VecStore32(void* p, const uint32x4_p x)
+template <class T>
+inline void VecStore32(T* p, const uint32x4_p x)
{
- VecStore(x, (word32*)p);
+ VecStore(x, p);
}
-inline void VecStore32LE(void* p, const uint32x4_p x)
+template <class T>
+inline void VecStore32LE(T* p, const uint32x4_p x)
{
#if __BIG_ENDIAN__
const uint8x16_p m = {3,2,1,0, 7,6,5,4, 11,10,9,8, 15,14,13,12};
- VecStore(VecPermute(x, x, m), (word32*)p);
+ VecStore(VecPermute(x, x, m), p);
#else
- VecStore(x, (word32*)p);
+ VecStore(x, p);
#endif
}
|