Merge branch 'master' into hmqv

pull/263/head
Jeffrey Walton 2016-08-21 15:10:58 -04:00
commit 6f4bcfd88f
4 changed files with 45 additions and 3 deletions

View File

@ -286,7 +286,14 @@ set(export_name "cryptopp-targets")
# Runtime package # Runtime package
if (BUILD_SHARED) if (BUILD_SHARED)
install(TARGETS cryptopp-shared EXPORT ${export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(
TARGETS cryptopp-shared
EXPORT ${export_name}
DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif() endif()
# Development package # Development package

View File

@ -23,9 +23,9 @@ NAMESPACE_BEGIN(CryptoPP)
# undef CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE # undef CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE
#endif #endif
// Sun Studio 12.3 and earlier lack SSE2's _mm_set_epi64x. // Sun Studio 12.3 and earlier lack SSE2's _mm_set_epi64x. Win32 lacks _mm_set_epi64x (Win64 supplies it except for VS2008).
// Also see http://stackoverflow.com/a/38547909/608639 // Also see http://stackoverflow.com/a/38547909/608639
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && ((__SUNPRO_CC >= 0x5100 && __SUNPRO_CC < 0x5130) || (_MSC_VER >= 1200 && _MSC_VER < 1600)) #if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && ((__SUNPRO_CC >= 0x5100 && __SUNPRO_CC < 0x5130) || (_MSC_VER >= 1200 && _MSC_VER < 1600) || (defined(_M_IX86) && _MSC_VER >= 1600))
inline __m128i _mm_set_epi64x(const word64 a, const word64 b) inline __m128i _mm_set_epi64x(const word64 a, const word64 b)
{ {
union INT_128_64x2 { union INT_128_64x2 {

View File

@ -87,6 +87,8 @@ bool ValidateAll(bool thorough)
pass=TestSecBlock() && pass; pass=TestSecBlock() && pass;
// http://github.com/weidai11/cryptopp/issues/64 // http://github.com/weidai11/cryptopp/issues/64
pass=TestPolynomialMod2() && pass; pass=TestPolynomialMod2() && pass;
// http://github.com/weidai11/cryptopp/pull/242
pass=TestHuffmanCodes() && pass;
#endif #endif
pass=ValidateCRC32() && pass; pass=ValidateCRC32() && pass;
@ -808,6 +810,38 @@ bool TestSecBlock()
} }
#endif #endif
#if !defined(NDEBUG) && !defined(CRYPTOPP_IMPORTS)
bool TestHuffmanCodes()
{
cout << "\nTesting Huffman codes...\n\n";
static const size_t nCodes = 30;
const unsigned int codeCounts[nCodes] = {
1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
static const unsigned int maxCodeBits = nCodes >> 1;
unsigned int codeBits[nCodes] = {
~0u, ~0u, ~0u, ~0u, ~0u,
~0u, ~0u, ~0u, ~0u, ~0u,
~0u, ~0u, ~0u, ~0u, ~0u,
};
try
{
HuffmanEncoder::GenerateCodeLengths(codeBits, maxCodeBits, codeCounts, nCodes);
}
catch(const Exception& ex)
{
CRYPTOPP_UNUSED(ex);
return false;
}
return true;
}
#endif
bool TestOS_RNG() bool TestOS_RNG()
{ {
bool pass = true; bool pass = true;

View File

@ -93,6 +93,7 @@ bool ValidateESIGN();
#if !defined(NDEBUG) #if !defined(NDEBUG)
bool TestSecBlock(); bool TestSecBlock();
bool TestPolynomialMod2(); bool TestPolynomialMod2();
bool TestHuffmanCodes();
#endif #endif
// Coverity finding // Coverity finding