diff options
author | Jeffrey Walton <noloader@gmail.com> | 2018-10-24 01:11:45 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2018-10-24 01:11:45 -0400 |
commit | d230999b408740d604b136bdfa28f1a60b0211fe (patch) | |
tree | 730fe45b37261b47af65a1ac6a1861d39aaf73f9 /chacha.cpp | |
parent | 6a5d2ab03d05cdde8d3fbf96fc2db9ac80b11e7e (diff) | |
download | cryptopp-git-d230999b408740d604b136bdfa28f1a60b0211fe.tar.gz |
Fix ChaCha compile on ARM and MIPS
Diffstat (limited to 'chacha.cpp')
-rw-r--r-- | chacha.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -11,10 +11,14 @@ NAMESPACE_BEGIN(CryptoPP)
-#if defined(CRYPTOPP_SSE2_INTRIN_AVAILABLE)
+#if (CRYPTOPP_SSE2_INTRIN_AVAILABLE || CRYPTOPP_SSE2_ASM_AVAILABLE)
extern void ChaCha_OperateKeystream_SSE2(const word32 *state, byte *message, unsigned int rounds);
#endif
+#if (CRYPTOPP_ARM_NEON_AVAILABLE)
+extern void ChaCha_OperateKeystream_NEON(const word32 *state, byte *message, unsigned int rounds);
+#endif
+
#define CHACHA_QUARTER_ROUND(a,b,c,d) \
a += b; d ^= a; d = rotlConstant<16,word32>(d); \
c += d; b ^= c; b = rotlConstant<12,word32>(b); \
@@ -30,7 +34,7 @@ void ChaCha_TestInstantiations() std::string ChaCha_Policy::AlgorithmProvider() const
{
-#if CRYPTOPP_SSE2_INTRIN_AVAILABLE
+#if (CRYPTOPP_SSE2_INTRIN_AVAILABLE || CRYPTOPP_SSE2_ASM_AVAILABLE)
if (HasSSE2())
return "SSE2";
#endif
@@ -77,7 +81,7 @@ void ChaCha_Policy::SeekToIteration(lword iterationCount) unsigned int ChaCha_Policy::GetAlignment() const
{
-#if CRYPTOPP_SSE2_INTRIN_AVAILABLE
+#if (CRYPTOPP_SSE2_INTRIN_AVAILABLE || CRYPTOPP_SSE2_ASM_AVAILABLE)
if (HasSSE2())
return 16;
else
@@ -87,7 +91,7 @@ unsigned int ChaCha_Policy::GetAlignment() const unsigned int ChaCha_Policy::GetOptimalBlockSize() const
{
-#if CRYPTOPP_SSE2_INTRIN_AVAILABLE
+#if (CRYPTOPP_SSE2_INTRIN_AVAILABLE || CRYPTOPP_SSE2_ASM_AVAILABLE)
if (HasSSE2())
return 4*BYTES_PER_ITERATION;
else
@@ -98,7 +102,7 @@ unsigned int ChaCha_Policy::GetOptimalBlockSize() const void ChaCha_Policy::OperateKeystream(KeystreamOperation operation,
byte *output, const byte *input, size_t iterationCount)
{
-#if CRYPTOPP_SSE2_INTRIN_AVAILABLE
+#if (CRYPTOPP_SSE2_INTRIN_AVAILABLE || CRYPTOPP_SSE2_ASM_AVAILABLE)
if (HasSSE2())
{
while (iterationCount >= 4)
|