Merge branch 'master' into hmqv

pull/263/head
Jeffrey Walton 2016-07-24 00:35:46 -04:00
commit 0176e9155f
5 changed files with 34 additions and 10 deletions

View File

@ -13,7 +13,8 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
// Uncomment for benchmarking C++ against NEON // Uncomment for benchmarking C++ against SSE2 or NEON
#undef CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE
// #undef CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE // #undef CRYPTOPP_BOOL_NEON_INTRINSICS_AVAILABLE
// Visual Studio needs both VS2005 (1400) and _M_64 for SSE2 and _mm_set_epi64x() // Visual Studio needs both VS2005 (1400) and _M_64 for SSE2 and _mm_set_epi64x()
@ -34,10 +35,20 @@ NAMESPACE_BEGIN(CryptoPP)
# undef CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE # undef CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE
#endif #endif
// SunCC needs 12.4 for _mm_set_epi64x, _mm_blend_epi16, _mm_shuffle_epi16, etc // Sun Studio 12.3 and earlier lack SSE2's _mm_set_epi64x.
// Also see http://stackoverflow.com/a/38547909/608639
#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5130) #if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5130)
# undef CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE inline __m128i _mm_set_epi64x(const uint64_t a, const uint64_t b)
# undef CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE {
union INT_128_64x2 {
__m128i v128;
uint64_t v64[2];
};
INT_128_64x2 val;
val.v64[0] = b; val.v64[1] = a;
return val.v128;
}
#endif #endif
// C/C++ implementation // C/C++ implementation

View File

@ -1,6 +1,6 @@
// chacha.cpp - written and placed in the public domain by Jeffrey Walton. // chacha.cpp - written and placed in the public domain by Jeffrey Walton.
// Copyright assigned to the Crypto++ project. // Copyright assigned to the Crypto++ project.
// Based on Wei Dai's Salsa20 and Bernstein's reference ChaCha // Based on Wei Dai's Salsa20 and Bernstein's reference ChaCha
// family implementation at http://cr.yp.to/chacha.html. // family implementation at http://cr.yp.to/chacha.html.
#include "pch.h" #include "pch.h"
@ -141,7 +141,7 @@ void ChaCha_Policy<R>::OperateKeystream(KeystreamOperation operation, byte *outp
#endif #endif
++m_state[12]; ++m_state[12];
m_state[13] += !!(m_state[12] == 0); m_state[13] += static_cast<word32>(m_state[12] == 0);
} }
} }

View File

@ -1,6 +1,6 @@
// chacha.h - written and placed in the public domain by Jeffrey Walton. // chacha.h - written and placed in the public domain by Jeffrey Walton.
// Copyright assigned to the Crypto++ project. // Copyright assigned to the Crypto++ project.
// Based on Wei Dai's Salsa20 and Bernstein's reference ChaCha // Based on Wei Dai's Salsa20 and Bernstein's reference ChaCha
// family implementation at http://cr.yp.to/chacha.html. // family implementation at http://cr.yp.to/chacha.html.
//! \file chacha.h //! \file chacha.h

View File

@ -522,6 +522,11 @@ if [[ ("$IS_ARM32" -ne "0" || "$IS_ARM64" -ne "0") ]]; then
if [[ ("$HAVE_ARM_VFPV4" -gt "0") ]]; then HAVE_ARM_VFPV4=1; fi if [[ ("$HAVE_ARM_VFPV4" -gt "0") ]]; then HAVE_ARM_VFPV4=1; fi
fi fi
if [[ (-z "$HAVE_ARM_VFPV5") ]]; then
HAVE_ARM_VFPV5=$(echo "$ARM_FEATURES" | "$GREP" -i -c 'fpv5')
if [[ ("$HAVE_ARM_VFPV5" -gt "0") ]]; then HAVE_ARM_VFPV5=1; fi
fi
if [[ (-z "$HAVE_ARM_VFPD32") ]]; then if [[ (-z "$HAVE_ARM_VFPD32") ]]; then
HAVE_ARM_VFPD32=$(echo "$ARM_FEATURES" | "$GREP" -i -c 'vfpd32') HAVE_ARM_VFPD32=$(echo "$ARM_FEATURES" | "$GREP" -i -c 'vfpd32')
if [[ ("$HAVE_ARM_VFPD32" -gt "0") ]]; then HAVE_ARM_VFPD32=1; fi if [[ ("$HAVE_ARM_VFPD32" -gt "0") ]]; then HAVE_ARM_VFPD32=1; fi
@ -859,10 +864,18 @@ if [[ ("$IS_ARM32" -ne "0" || "$IS_ARM64" -ne "0") ]]; then
# Also see http://lists.linaro.org/pipermail/linaro-toolchain/2016-July/005821.html # Also see http://lists.linaro.org/pipermail/linaro-toolchain/2016-July/005821.html
if [[ ("$HAVE_ARM_NEON" -ne "0" && "$HAVE_ARM_VFPV4" -ne "0") ]]; then if [[ ("$HAVE_ARM_NEON" -ne "0" && "$HAVE_ARM_VFPV4" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=neon-vfpv4 ") PLATFORM_CXXFLAGS+=("-mfpu=neon-vfpv4 ")
elif [[ ("$HAVE_ARM_VFPV3" -ne "0" || "$HAVE_ARM_VFPV4" -ne "0") && "$HAVE_ARM_VFPD32" -ne "0" ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=neon ")
elif [[ ("$HAVE_ARM_NEON" -ne "0") ]]; then elif [[ ("$HAVE_ARM_NEON" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=neon ") PLATFORM_CXXFLAGS+=("-mfpu=neon ")
elif [[ ("$HAVE_ARM_VFPV3" -ne "0" || "$HAVE_ARM_VFPV4" -ne "0") && "$HAVE_ARM_VFPD32" -ne "0" ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=neon ")
elif [[ ("$HAVE_ARM_VFPV5" -ne "0" && "$HAVE_ARM_VFPD32" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=fpv5 ")
elif [[ ("$HAVE_ARM_VFPV4" -ne "0" && "$HAVE_ARM_VFPD32" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=vfpv4 ")
elif [[ ("$HAVE_ARM_VFPV3" -ne "0" && "$HAVE_ARM_VFPD32" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=vfpv3 ")
elif [[ ("$HAVE_ARM_VFPV5" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=fpv5-d16 ")
elif [[ ("$HAVE_ARM_VFPV4" -ne "0") ]]; then elif [[ ("$HAVE_ARM_VFPV4" -ne "0") ]]; then
PLATFORM_CXXFLAGS+=("-mfpu=vfpv4-d16 ") PLATFORM_CXXFLAGS+=("-mfpu=vfpv4-d16 ")
elif [[ ("$HAVE_ARM_VFPV3" -ne "0") ]]; then elif [[ ("$HAVE_ARM_VFPV3" -ne "0") ]]; then

View File

@ -11,7 +11,7 @@
#include "secblock.h" #include "secblock.h"
// Clang 3.3 integrated assembler crash on Linux. Clang 3.4 due to compiler error with .intel_syntax // Clang 3.3 integrated assembler crash on Linux. Clang 3.4 due to compiler error with .intel_syntax
#if CRYPTOPP_BOOL_X32 || (defined(CRYPTOPP_LLVM_CLANG_VERSION) && (CRYPTOPP_LLVM_CLANG_VERSION < 30500)) #if CRYPTOPP_BOOL_X32 || defined(CRYPTOPP_DISABLE_INTEL_ASM)
# define CRYPTOPP_DISABLE_PANAMA_ASM # define CRYPTOPP_DISABLE_PANAMA_ASM
#endif #endif