diff options
author | Jeffrey Walton <noloader@gmail.com> | 2020-04-05 09:51:34 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2020-04-05 09:51:34 -0400 |
commit | 57ba87bdc9666034dce1a460ecc7b8d00aa1b380 (patch) | |
tree | 777f8fb6c3400a9d2de2ca70250784bd98ecb92d /simon128_simd.cpp | |
parent | 5017d9c91c853a508f25123a277dd65d60edcf3b (diff) | |
download | cryptopp-git-57ba87bdc9666034dce1a460ecc7b8d00aa1b380.tar.gz |
Add 64-bit overload for VecLoadAligned
Diffstat (limited to 'simon128_simd.cpp')
-rw-r--r-- | simon128_simd.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/simon128_simd.cpp b/simon128_simd.cpp index b780cf7e..88d5b0cc 100644 --- a/simon128_simd.cpp +++ b/simon128_simd.cpp @@ -537,6 +537,7 @@ using CryptoPP::uint64x2_p; using CryptoPP::VecAnd;
using CryptoPP::VecXor;
using CryptoPP::VecLoad;
+using CryptoPP::VecLoadAligned;
using CryptoPP::VecPermute;
// Rotate left by bit count
@@ -578,8 +579,8 @@ inline void SIMON128_Enc_Block(uint32x4_p &block, const word64 *subkeys, unsigne for (int i = 0; i < static_cast<int>(rounds & ~1)-1; i += 2)
{
// Round keys are pre-splated in forward direction
- const uint64x2_p rk1 = VecLoad(subkeys+i*2);
- const uint64x2_p rk2 = VecLoad(subkeys+i*2+2);
+ const uint64x2_p rk1 = VecLoadAligned(subkeys+i*2);
+ const uint64x2_p rk2 = VecLoadAligned(subkeys+i*2+2);
y1 = VecXor(VecXor(y1, SIMON128_f(x1)), rk1);
x1 = VecXor(VecXor(x1, SIMON128_f(y1)), rk2);
@@ -588,7 +589,7 @@ inline void SIMON128_Enc_Block(uint32x4_p &block, const word64 *subkeys, unsigne if (rounds & 1)
{
// Round keys are pre-splated in forward direction
- const uint64x2_p rk = VecLoad(subkeys+rounds*2-2);
+ const uint64x2_p rk = VecLoadAligned(subkeys+rounds*2-2);
y1 = VecXor(VecXor(y1, SIMON128_f(x1)), rk);
std::swap(x1, y1);
}
@@ -671,8 +672,8 @@ inline void SIMON128_Enc_6_Blocks(uint32x4_p &block0, uint32x4_p &block1, for (int i = 0; i < static_cast<int>(rounds & ~1)-1; i += 2)
{
// Round keys are pre-splated in forward direction
- const uint64x2_p rk1 = VecLoad(subkeys+i*2);
- const uint64x2_p rk2 = VecLoad(subkeys+i*2+2);
+ const uint64x2_p rk1 = VecLoadAligned(subkeys+i*2);
+ const uint64x2_p rk2 = VecLoadAligned(subkeys+i*2+2);
y1 = VecXor(VecXor(y1, SIMON128_f(x1)), rk1);
y2 = VecXor(VecXor(y2, SIMON128_f(x2)), rk1);
@@ -686,7 +687,7 @@ inline void SIMON128_Enc_6_Blocks(uint32x4_p &block0, uint32x4_p &block1, if (rounds & 1)
{
// Round keys are pre-splated in forward direction
- const uint64x2_p rk = VecLoad(subkeys+rounds*2-2);
+ const uint64x2_p rk = VecLoadAligned(subkeys+rounds*2-2);
y1 = VecXor(VecXor(y1, SIMON128_f(x1)), rk);
y2 = VecXor(VecXor(y2, SIMON128_f(x2)), rk);
|