diff --git a/blake2.cpp b/blake2.cpp index 96dedfbc..9eb6997b 100644 --- a/blake2.cpp +++ b/blake2.cpp @@ -163,6 +163,8 @@ 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. extern void BLAKE2_Compress32_POWER7(const byte* input, BLAKE2s_State& state); #endif @@ -390,8 +392,7 @@ std::string BLAKE2s::AlgorithmProvider() const #if (CRYPTOPP_POWER7_AVAILABLE) if (HasPower7()) return "Power7"; -#endif -#if (CRYPTOPP_ALTIVEC_AVAILABLE) +#elif (CRYPTOPP_ALTIVEC_AVAILABLE) if (HasAltivec()) return "Altivec"; #endif @@ -666,9 +667,16 @@ void BLAKE2s::Compress(const byte *input) return BLAKE2_Compress32_NEON(input, *m_state.data()); } #endif -#if CRYPTOPP_ALTIVEC_AVAILABLE +#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()); } #endif