Guard BLAKE2 on CRYPTOPP_ALTIVEC_AVAILABLE
parent
dfacc9f15c
commit
06867e5caf
|
|
@ -14,7 +14,7 @@
|
||||||
// Do so in both blake2.cpp and blake2-simd.cpp.
|
// Do so in both blake2.cpp and blake2-simd.cpp.
|
||||||
// #undef CRYPTOPP_SSE41_AVAILABLE
|
// #undef CRYPTOPP_SSE41_AVAILABLE
|
||||||
// #undef CRYPTOPP_ARM_NEON_AVAILABLE
|
// #undef CRYPTOPP_ARM_NEON_AVAILABLE
|
||||||
// #undef CRYPTOPP_POWER8_AVAILABLE
|
// #undef CRYPTOPP_ALTIVEC_AVAILABLE
|
||||||
|
|
||||||
// Disable NEON/ASIMD for Cortex-A53 and A57. The shifts are too slow and C/C++ is about
|
// Disable NEON/ASIMD for Cortex-A53 and A57. The shifts are too slow and C/C++ is about
|
||||||
// 3 cpb faster than NEON/ASIMD. Also see http://github.com/weidai11/cryptopp/issues/367.
|
// 3 cpb faster than NEON/ASIMD. Also see http://github.com/weidai11/cryptopp/issues/367.
|
||||||
|
|
@ -22,9 +22,9 @@
|
||||||
# undef CRYPTOPP_ARM_NEON_AVAILABLE
|
# undef CRYPTOPP_ARM_NEON_AVAILABLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Disable POWER7 on PowerPC big-endian machines. Blake2s/POWER7 runs slower than C++.
|
#if !(CRYPTOPP_ALTIVEC_AVAILABLE)
|
||||||
#if defined(__powerpc__) && defined(__BIG_ENDIAN__)
|
|
||||||
# undef CRYPTOPP_POWER7_AVAILABLE
|
# undef CRYPTOPP_POWER7_AVAILABLE
|
||||||
|
# undef CRYPTOPP_POWER8_AVAILABLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ANONYMOUS_NAMESPACE_BEGIN
|
ANONYMOUS_NAMESPACE_BEGIN
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
// blake2-simd.cpp - written and placed in the public domain by
|
// blake2-simd.cpp - written and placed in the public domain by
|
||||||
// Jeffrey Walton, Uri Blumenthal and Marcel Raad.
|
// Samuel Neves, Jeffrey Walton, Uri Blumenthal
|
||||||
|
// and Marcel Raad.
|
||||||
//
|
//
|
||||||
// This source file uses intrinsics to gain access to ARMv7a/ARMv8a
|
// This source file uses intrinsics to gain access to ARMv7a/ARMv8a
|
||||||
// NEON, Power8 and SSE4.1 instructions. A separate source file is
|
// NEON, Power8 and SSE4.1 instructions. A separate source file is
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
// Do so in both blake2.cpp and blake2-simd.cpp.
|
// Do so in both blake2.cpp and blake2-simd.cpp.
|
||||||
// #undef CRYPTOPP_SSE41_AVAILABLE
|
// #undef CRYPTOPP_SSE41_AVAILABLE
|
||||||
// #undef CRYPTOPP_ARM_NEON_AVAILABLE
|
// #undef CRYPTOPP_ARM_NEON_AVAILABLE
|
||||||
// #undef CRYPTOPP_POWER8_AVAILABLE
|
// #undef CRYPTOPP_ALTIVEC_AVAILABLE
|
||||||
|
|
||||||
// Disable NEON/ASIMD for Cortex-A53 and A57. The shifts are too slow and C/C++ is about
|
// Disable NEON/ASIMD for Cortex-A53 and A57. The shifts are too slow and C/C++ is about
|
||||||
// 3 cpb faster than NEON/ASIMD. Also see http://github.com/weidai11/cryptopp/issues/367.
|
// 3 cpb faster than NEON/ASIMD. Also see http://github.com/weidai11/cryptopp/issues/367.
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
# include <arm_acle.h>
|
# include <arm_acle.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CRYPTOPP_POWER8_AVAILABLE)
|
#if (CRYPTOPP_POWER8_AVAILABLE)
|
||||||
# include "ppc-simd.h"
|
# include "ppc-simd.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
// blake2-simd.cpp - written and placed in the public domain by
|
// blake2-simd.cpp - written and placed in the public domain by
|
||||||
// Jeffrey Walton, Uri Blumenthal and Marcel Raad.
|
// Samuel Neves, Jeffrey Walton, Uri Blumenthal
|
||||||
|
// and Marcel Raad.
|
||||||
//
|
//
|
||||||
// This source file uses intrinsics to gain access to ARMv7a/ARMv8a
|
// This source file uses intrinsics to gain access to ARMv7a/ARMv8a
|
||||||
// NEON, Power7 and SSE4.1 instructions. A separate source file is
|
// NEON, Power7 and SSE4.1 instructions. A separate source file is
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
// Do so in both blake2.cpp and blake2-simd.cpp.
|
// Do so in both blake2.cpp and blake2-simd.cpp.
|
||||||
// #undef CRYPTOPP_SSE41_AVAILABLE
|
// #undef CRYPTOPP_SSE41_AVAILABLE
|
||||||
// #undef CRYPTOPP_ARM_NEON_AVAILABLE
|
// #undef CRYPTOPP_ARM_NEON_AVAILABLE
|
||||||
// #undef CRYPTOPP_POWER7_AVAILABLE
|
// #undef CRYPTOPP_ALTIVEC_AVAILABLE
|
||||||
|
|
||||||
// Disable NEON/ASIMD for Cortex-A53 and A57. The shifts are too slow and C/C++ is about
|
// Disable NEON/ASIMD for Cortex-A53 and A57. The shifts are too slow and C/C++ is about
|
||||||
// 3 cpb faster than NEON/ASIMD. Also see http://github.com/weidai11/cryptopp/issues/367.
|
// 3 cpb faster than NEON/ASIMD. Also see http://github.com/weidai11/cryptopp/issues/367.
|
||||||
|
|
@ -41,15 +41,10 @@
|
||||||
# include <arm_acle.h>
|
# include <arm_acle.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CRYPTOPP_POWER7_AVAILABLE)
|
#if (CRYPTOPP_POWER7_AVAILABLE)
|
||||||
# include "ppc-simd.h"
|
# include "ppc-simd.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Disable POWER7 on PowerPC big-endian machines. Blake2s/POWER7 runs slower than C++.
|
|
||||||
#if defined(__powerpc__) && defined(__BIG_ENDIAN__)
|
|
||||||
# undef CRYPTOPP_POWER7_AVAILABLE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ANONYMOUS_NAMESPACE_BEGIN
|
ANONYMOUS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
using CryptoPP::word32;
|
using CryptoPP::word32;
|
||||||
|
|
|
||||||
15
ppc-simd.h
15
ppc-simd.h
|
|
@ -27,8 +27,6 @@
|
||||||
// We also need to handle the case of -DCRYPTOPP_ALTIVEC_AVAILABLE=0.
|
// We also need to handle the case of -DCRYPTOPP_ALTIVEC_AVAILABLE=0.
|
||||||
#if !defined(__ALTIVEC__)
|
#if !defined(__ALTIVEC__)
|
||||||
# undef CRYPTOPP_ALTIVEC_AVAILABLE
|
# undef CRYPTOPP_ALTIVEC_AVAILABLE
|
||||||
# undef CRYPTOPP_POWER7_AVAILABLE
|
|
||||||
# undef CRYPTOPP_POWER8_AVAILABLE
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_ARCH_PWR7)
|
#if !defined(_ARCH_PWR7)
|
||||||
|
|
@ -49,8 +47,19 @@
|
||||||
# undef bool
|
# undef bool
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !(CRYPTOPP_ALTIVEC_AVAILABLE)
|
||||||
|
# undef CRYPTOPP_POWER7_AVAILABLE
|
||||||
|
# undef CRYPTOPP_POWER8_AVAILABLE
|
||||||
|
# undef CRYPTOPP_POWER8_AES_AVAILABLE
|
||||||
|
# undef CRYPTOPP_POWER8_VMULL_AVAILABLE
|
||||||
|
# undef CRYPTOPP_POWER8_SHA_AVAILABLE
|
||||||
|
#endif
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
|
// Wrap everything in this file based on CRYPTOPP_ALTIVEC_AVAILABLE
|
||||||
|
#if (CRYPTOPP_ALTIVEC_AVAILABLE)
|
||||||
|
|
||||||
// Datatypes
|
// Datatypes
|
||||||
#if (CRYPTOPP_ALTIVEC_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if (CRYPTOPP_ALTIVEC_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
typedef __vector unsigned char uint8x16_p;
|
typedef __vector unsigned char uint8x16_p;
|
||||||
|
|
@ -842,6 +851,8 @@ inline T VectorSHA512(const T& vec)
|
||||||
|
|
||||||
#endif // POWER8 crypto
|
#endif // POWER8 crypto
|
||||||
|
|
||||||
|
#endif // CRYPTOPP_ALTIVEC_AVAILABLE
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
||||||
#endif // CRYPTOPP_PPC_CRYPTO_H
|
#endif // CRYPTOPP_PPC_CRYPTO_H
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue