summaryrefslogtreecommitdiff
path: root/simon.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-08-12 09:21:09 -0400
committerJeffrey Walton <noloader@gmail.com>2018-08-12 09:21:09 -0400
commit6c621f91cec8c5c921e3b2374536932ddeaff81e (patch)
treeb24529defb1e315ce424048d3be5caa05f398a8d /simon.cpp
parentaa806f34751bdb998ddc9d504cf01adaaa73312a (diff)
downloadcryptopp-git-6c621f91cec8c5c921e3b2374536932ddeaff81e.tar.gz
Add POWER8 SIMON-128 implementation
Performance went from about 30 to 40 cpb to 5.5 to 9 cpb, depending on endian-ness
Diffstat (limited to 'simon.cpp')
-rw-r--r--simon.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/simon.cpp b/simon.cpp
index 3329a78e..2f306933 100644
--- a/simon.cpp
+++ b/simon.cpp
@@ -225,6 +225,14 @@ extern size_t SIMON128_Dec_AdvancedProcessBlocks_SSSE3(const word64* subKeys, si
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
#endif
+#if (CRYPTOPP_POWER8_AVAILABLE)
+extern size_t SIMON128_Enc_AdvancedProcessBlocks_POWER8(const word64* subKeys, size_t rounds,
+ const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
+
+extern size_t SIMON128_Dec_AdvancedProcessBlocks_POWER8(const word64* subKeys, size_t rounds,
+ const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
+#endif
+
std::string SIMON64::Base::AlgorithmProvider() const
{
#if defined(CRYPTOPP_SSE41_AVAILABLE)
@@ -327,6 +335,10 @@ std::string SIMON128::Base::AlgorithmProvider() const
if (HasNEON())
return "NEON";
#endif
+#if (CRYPTOPP_POWER8_AVAILABLE)
+ if (HasPower8())
+ return "Power8";
+#endif
return "C++";
}
@@ -466,6 +478,11 @@ size_t SIMON128::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xo
return SIMON128_Enc_AdvancedProcessBlocks_NEON(m_rkeys, (size_t)m_rounds,
inBlocks, xorBlocks, outBlocks, length, flags);
#endif
+#if (CRYPTOPP_POWER8_AVAILABLE)
+ if (HasPower8())
+ return SIMON128_Enc_AdvancedProcessBlocks_POWER8(m_rkeys, (size_t)m_rounds,
+ inBlocks, xorBlocks, outBlocks, length, flags);
+#endif
return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags);
}
@@ -482,6 +499,11 @@ size_t SIMON128::Dec::AdvancedProcessBlocks(const byte *inBlocks, const byte *xo
return SIMON128_Dec_AdvancedProcessBlocks_NEON(m_rkeys, (size_t)m_rounds,
inBlocks, xorBlocks, outBlocks, length, flags);
#endif
+#if (CRYPTOPP_POWER8_AVAILABLE)
+ if (HasPower8())
+ return SIMON128_Dec_AdvancedProcessBlocks_POWER8(m_rkeys, (size_t)m_rounds,
+ inBlocks, xorBlocks, outBlocks, length, flags);
+#endif
return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags);
}
#endif // CRYPTOPP_SIMON128_ADVANCED_PROCESS_BLOCKS