summaryrefslogtreecommitdiff
path: root/blake2.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-11-18 14:43:48 -0500
committerJeffrey Walton <noloader@gmail.com>2018-11-18 14:43:48 -0500
commit2e68e95a928a921db1cb97d4433f6a4ff09fcac8 (patch)
treef627dc6c55c9b393d9b1eb72bab46d3630f74235 /blake2.cpp
parente28b2e0f02dfdbd4794202d5829e3bf4afe63826 (diff)
downloadcryptopp-git-2e68e95a928a921db1cb97d4433f6a4ff09fcac8.tar.gz
Add BLAKE2s and ChaCha CORE SIMD function (GH #656)
The CORE function provides the implementation for ChaCha_OperateKeystream_ALTIVEC, ChaCha_OperateKeystream_POWER7, BLAKE2_Compress32_ALTIVEC and BLAKE2_Compress32_POWER7. Depending on the options used to compile the source files, either POWER7 or ALTIVEC will be used. This is needed to support the "new toolchain, ancient hardware" use case.
Diffstat (limited to 'blake2.cpp')
-rw-r--r--blake2.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/blake2.cpp b/blake2.cpp
index 79b79c82..b0c54af2 100644
--- a/blake2.cpp
+++ b/blake2.cpp
@@ -162,10 +162,10 @@ extern void BLAKE2_Compress32_NEON(const byte* input, BLAKE2s_State& state);
extern void BLAKE2_Compress64_NEON(const byte* input, BLAKE2b_State& state);
#endif
-#if CRYPTOPP_ALTIVEC_AVAILABLE
-// BLAKE2_Compress32_POWER7 may be compiled with either -mcpu=power7 or
-// -mcpu=power4. The makefile drops to POWER4 if POWER7 is not available.
+#if CRYPTOPP_POWER7_AVAILABLE
extern void BLAKE2_Compress32_POWER7(const byte* input, BLAKE2s_State& state);
+#elif CRYPTOPP_ALTIVEC_AVAILABLE
+extern void BLAKE2_Compress32_ALTIVEC(const byte* input, BLAKE2s_State& state);
#endif
#if CRYPTOPP_POWER8_AVAILABLE
@@ -670,14 +670,12 @@ void BLAKE2s::Compress(const byte *input)
#if CRYPTOPP_POWER7_AVAILABLE
if(HasPower7())
{
- // BLAKE2_Compress32_POWER7 compiled with -mcpu=power7 and -DCRYPTOPP_POWER7_AVAILABLE
return BLAKE2_Compress32_POWER7(input, *m_state.data());
}
#elif CRYPTOPP_ALTIVEC_AVAILABLE
if(HasAltivec())
{
- // BLAKE2_Compress32_POWER7 compiled with -mcpu=power4 and -DCRYPTOPP_ALTIVEC_AVAILABLE
- return BLAKE2_Compress32_POWER7(input, *m_state.data());
+ return BLAKE2_Compress32_ALTIVEC(input, *m_state.data());
}
#endif
return BLAKE2_Compress32_CXX(input, *m_state.data());