Cleared issues 11,12,13 (Clang integrated assembler), 58 (RC rollup), 66 (Coverity rollup)

pull/75/head
Jeffrey Walton 2015-11-18 15:45:32 -05:00
parent 628f40755a
commit c15be9178a
4 changed files with 827 additions and 634 deletions

View File

@ -1,4 +1,4 @@
# Doxyfile 1.8.9.1 # Doxyfile 1.8.9
# This file describes the settings to be used by the documentation system # This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project. # doxygen (www.doxygen.org) for a project.
@ -47,14 +47,16 @@ PROJECT_NUMBER = 5.6.3
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short. # quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF = # Without the HTML escape characters, Doxygen concatenates the string below...
PROJECT_BRIEF = Free C++ class library of cryptographic schemes
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included # With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55 # in the documentation. The maximum height of the logo should not exceed 55
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory. # the logo to the output directory.
PROJECT_LOGO = # The logo looks really bad here. Don't use it.
# PROJECT_LOGO = Logo-Steel.png
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is # into which the generated documentation will be written. If a relative path is
@ -219,7 +221,7 @@ SEPARATE_MEMBER_PAGES = NO
# uses this value to replace tabs by spaces in code fragments. # uses this value to replace tabs by spaces in code fragments.
# Minimum value: 1, maximum value: 16, default value: 4. # Minimum value: 1, maximum value: 16, default value: 4.
TAB_SIZE = 8 TAB_SIZE = 4
# This tag can be used to specify a number of aliases that act as commands in # This tag can be used to specify a number of aliases that act as commands in
# the documentation. An alias has the form: # the documentation. An alias has the form:
@ -294,7 +296,7 @@ EXTENSION_MAPPING =
# case of backward compatibilities issues. # case of backward compatibilities issues.
# The default value is: YES. # The default value is: YES.
MARKDOWN_SUPPORT = YES MARKDOWN_SUPPORT = NO
# When enabled doxygen tries to link words that correspond to documented # When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can # classes, or namespaces to their corresponding documentation. Such a link can
@ -312,7 +314,7 @@ AUTOLINK_SUPPORT = YES
# diagrams that involve STL classes more complete and accurate. # diagrams that involve STL classes more complete and accurate.
# The default value is: NO. # The default value is: NO.
BUILTIN_STL_SUPPORT = NO BUILTIN_STL_SUPPORT = YES
# If you use Microsoft's C++/CLI language, you should set this option to YES to # If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support. # enable parsing support.
@ -336,7 +338,7 @@ SIP_SUPPORT = NO
# should set this option to NO. # should set this option to NO.
# The default value is: YES. # The default value is: YES.
IDL_PROPERTY_SUPPORT = YES IDL_PROPERTY_SUPPORT = NO
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES then doxygen will reuse the documentation of the first # tag is set to YES then doxygen will reuse the documentation of the first
@ -625,7 +627,7 @@ GENERATE_DEPRECATEDLIST= YES
# sections, marked by \if <section_label> ... \endif and \cond <section_label> # sections, marked by \if <section_label> ... \endif and \cond <section_label>
# ... \endcond blocks. # ... \endcond blocks.
ENABLED_SECTIONS = ENABLED_SECTIONS = NO
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the # The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
# initial value of a variable or macro / define can have for it to appear in the # initial value of a variable or macro / define can have for it to appear in the

View File

@ -1,3 +1,8 @@
// config.h - written and placed in the public domain by Wei Dai
//! \file config.h
//! \brief Library configuration file
#ifndef CRYPTOPP_CONFIG_H #ifndef CRYPTOPP_CONFIG_H
#define CRYPTOPP_CONFIG_H #define CRYPTOPP_CONFIG_H
@ -54,8 +59,16 @@
# endif # endif
#endif #endif
// Define this if you want or need the library's memcpy_s and memmove_s.
// See http://github.com/weidai11/cryptopp/issues/28.
// #if !defined(CRYPTOPP_WANT_SECURE_LIB)
// # define CRYPTOPP_WANT_SECURE_LIB
// #endif
// File system code to write to GZIP archive. // File system code to write to GZIP archive.
#define GZIP_OS_CODE 0 #if !defined(GZIP_OS_CODE)
# define GZIP_OS_CODE 0
#endif
// Try this if your CPU has 256K internal cache or a slow multiply instruction // Try this if your CPU has 256K internal cache or a slow multiply instruction
// and you want a (possibly) faster IDEA implementation using log tables // and you want a (possibly) faster IDEA implementation using log tables
@ -66,9 +79,14 @@
// CACM paper. // CACM paper.
// #define LCRNG_ORIGINAL_NUMBERS // #define LCRNG_ORIGINAL_NUMBERS
// choose which style of sockets to wrap (mostly useful for cygwin which has both) // choose which style of sockets to wrap (mostly useful for MinGW which has both)
#define PREFER_BERKELEY_STYLE_SOCKETS #if !defined(NO_BERKELEY_STYLE_SOCKETS) && !defined(PREFER_BERKELEY_STYLE_SOCKETS)
// #define PREFER_WINDOWS_STYLE_SOCKETS # define PREFER_BERKELEY_STYLE_SOCKETS
#endif
// #if !defined(NO_WINDOWS_STYLE_SOCKETS) && !defined(PREFER_WINDOWS_STYLE_SOCKETS)
// # define PREFER_WINDOWS_STYLE_SOCKETS
// #endif
// set the name of Rijndael cipher, was "Rijndael" before version 5.3 // set the name of Rijndael cipher, was "Rijndael" before version 5.3
#define CRYPTOPP_RIJNDAEL_NAME "AES" #define CRYPTOPP_RIJNDAEL_NAME "AES"
@ -85,7 +103,7 @@
#if defined(CRYPTOPP_INIT_PRIORITY) && (CRYPTOPP_INIT_PRIORITY > 0) #if defined(CRYPTOPP_INIT_PRIORITY) && (CRYPTOPP_INIT_PRIORITY > 0)
# define CRYPTOPP_USER_PRIORITY (CRYPTOPP_INIT_PRIORITY + 101) # define CRYPTOPP_USER_PRIORITY (CRYPTOPP_INIT_PRIORITY + 101)
#else #else
# define CRYPTOPP_USER_PRIORITY 500 # define CRYPTOPP_USER_PRIORITY 250
#endif #endif
// ***************** Important Settings Again ******************** // ***************** Important Settings Again ********************
@ -102,18 +120,34 @@
#define WORKAROUND_MS_BUG_Q258000 #define WORKAROUND_MS_BUG_Q258000
#ifdef CRYPTOPP_DOXYGEN_PROCESSING #ifdef CRYPTOPP_DOXYGEN_PROCESSING
// Document the namespce exists. Put it here before CryptoPP is undefined below.
//! \namespace CryptoPP
//! \brief Crypto++ library namespace
//! \details Nearly all classes are located in the CryptoPP namespace. Within
//! the namespace, there are two additional namespaces.
//! <ul>
//! <li>Name - namespace for names used with \p NameValuePairs and documented in argnames.h
//! <li>Weak - namespace for weak and wounded algorithms, like ARC4, MD5 and Pananma
//! </ul>
namespace CryptoPP { }
// Bring in the symbols fund in the weak namespace; and fold Weak1 into Weak
# define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
# define Weak1 Weak
// Avoid putting "CryptoPP::" in front of everything in Doxygen output // Avoid putting "CryptoPP::" in front of everything in Doxygen output
# define CryptoPP # define CryptoPP
# define NAMESPACE_BEGIN(x) # define NAMESPACE_BEGIN(x)
# define NAMESPACE_END # define NAMESPACE_END
// Get Doxygen to generate better documentation for these typedefs // Get Doxygen to generate better documentation for these typedefs
# define DOCUMENTED_TYPEDEF(x, y) class y : public x {}; # define DOCUMENTED_TYPEDEF(x, y) class y : public x {};
// Make "protected" "private" so the functions and members are not documented
# define protected private
#else #else
# define NAMESPACE_BEGIN(x) namespace x { # define NAMESPACE_BEGIN(x) namespace x {
# define NAMESPACE_END } # define NAMESPACE_END }
# define DOCUMENTED_TYPEDEF(x, y) typedef x y; # define DOCUMENTED_TYPEDEF(x, y) typedef x y;
#endif #endif
#define ANONYMOUS_NAMESPACE_BEGIN namespace { #define ANONYMOUS_NAMESPACE_BEGIN namespace {
#define ANONYMOUS_NAMESPACE_END }
#define USING_NAMESPACE(x) using namespace x; #define USING_NAMESPACE(x) using namespace x;
#define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x { #define DOCUMENTED_NAMESPACE_BEGIN(x) namespace x {
#define DOCUMENTED_NAMESPACE_END } #define DOCUMENTED_NAMESPACE_END }
@ -157,32 +191,31 @@ const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
#define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #define CRYPTOPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif #endif
#ifdef __clang__ // Apple and LLVM's Clang. Apple Clang version 7.0 roughly equals LLVM Clang version 3.7
#if defined(__clang__ ) && !defined(__apple_build_version__)
#define CRYPTOPP_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) #define CRYPTOPP_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
#elif defined(__clang__ ) && defined(__apple_build_version__)
#define CRYPTOPP_APPLE_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
#endif #endif
#ifdef _MSC_VER #ifdef _MSC_VER
#define CRYPTOPP_MSC_VERSION (_MSC_VER) #define CRYPTOPP_MSC_VERSION (_MSC_VER)
#endif #endif
// Need GCC 4.6/Clang 1.7 or above due to "GCC diagnostic {push|pop}" // Need GCC 4.6/Clang 1.7/Apple Clang 2.0 or above due to "GCC diagnostic {push|pop}"
#if (CRYPTOPP_GCC_VERSION >= 40600) || (CRYPTOPP_CLANG_VERSION >= 10700) #if (CRYPTOPP_GCC_VERSION >= 40600) || (CRYPTOPP_CLANG_VERSION >= 10700) || (CRYPTOPP_APPLE_CLANG_VERSION >= 20000)
#define CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 1 #define CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 1
#endif #endif
// Detect availabliltiy of int128_t and uint128_t in preprocessor, http://gcc.gnu.org/ml/gcc-help/2015-08/msg00185.html. // Clang due to "Inline assembly operands don't work with .intel_syntax", http://llvm.org/bugs/show_bug.cgi?id=24232
// Both GCC and Clang respond to it. // TODO: supply the upper version when LLVM fixes it. We set it to 20.0 for compilation purposes.
#if ((defined(__GNUC__) || defined(__clang__) || defined(_INTEL_COMPILER)) && (__SIZEOF_INT128__ >= 16)) #if (defined(CRYPTOPP_CLANG_VERSION) && CRYPTOPP_CLANG_VERSION <= 200000) || (defined(CRYPTOPP_APPLE_CLANG_VERSION) && CRYPTOPP_APPLE_CLANG_VERSION <= 200000)
#define CRYPTOPP_NATIVE_DWORD_AVAILABLE #define CRYPTOPP_DISABLE_INTEL_ASM 1
#define CRYPTOPP_WORD128_AVAILABLE #endif
typedef word32 hword;
typedef word64 word;
typedef __uint128_t dword;
typedef __uint128_t word128;
// define hword, word, and dword. these are used for multiprecision integer arithmetic // define hword, word, and dword. these are used for multiprecision integer arithmetic
// Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx // Intel compiler won't have _umul128 until version 10.0. See http://softwarecommunity.intel.com/isn/Community/en-US/forums/thread/30231625.aspx
#elif (defined(_MSC_VER) && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1000) && (defined(_M_X64) || defined(_M_IA64))) || (defined(__DECCXX) && defined(__alpha__)) || (defined(__INTEL_COMPILER) && defined(__x86_64__)) || (defined(__SUNPRO_CC) && defined(__x86_64__)) #if (defined(_MSC_VER) && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1000) && (defined(_M_X64) || defined(_M_IA64))) || (defined(__DECCXX) && defined(__alpha__)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER < 1000) && defined(__x86_64__)) || (defined(__SUNPRO_CC) && defined(__x86_64__))
typedef word32 hword; typedef word32 hword;
typedef word64 word; typedef word64 word;
#else #else
@ -196,12 +229,26 @@ const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
typedef word64 word; typedef word64 word;
typedef __uint128_t dword; typedef __uint128_t dword;
typedef __uint128_t word128; typedef __uint128_t word128;
#elif defined(__GNUC__) && (__SIZEOF_INT128__ >= 16)
// Detect availabliltiy of int128_t and uint128_t in preprocessor, http://gcc.gnu.org/ml/gcc-help/2015-08/msg00185.html.
#define CRYPTOPP_WORD128_AVAILABLE
typedef word32 hword;
typedef word64 word;
typedef __uint128_t dword;
typedef __uint128_t word128;
#else #else
// if we're here, it means we're on a 64-bit CPU but we don't have a way to obtain 128-bit multiplication results // if we're here, it means we're on a 64-bit CPU but we don't have a way to obtain 128-bit multiplication results
typedef word16 hword; typedef word16 hword;
typedef word32 word; typedef word32 word;
typedef word64 dword; typedef word64 dword;
#endif #endif
#elif defined(__GNUC__) && (__SIZEOF_INT128__ >= 16)
// Detect availabliltiy of int128_t and uint128_t in preprocessor, http://gcc.gnu.org/ml/gcc-help/2015-08/msg00185.html.
#define CRYPTOPP_WORD128_AVAILABLE
typedef word32 hword;
typedef word64 word;
typedef __uint128_t dword;
typedef __uint128_t word128;
#else #else
// being here means the native register size is probably 32 bits or less // being here means the native register size is probably 32 bits or less
#define CRYPTOPP_BOOL_SLOW_WORD64 1 #define CRYPTOPP_BOOL_SLOW_WORD64 1
@ -215,7 +262,7 @@ const lword LWORD_MAX = W64LIT(0xffffffffffffffff);
#endif #endif
// Produce a compiler error. It can be commented out, but you may not get the benefit of the fastest integers. // Produce a compiler error. It can be commented out, but you may not get the benefit of the fastest integers.
#if (__SIZEOF_INT128__ >= 16) && !defined(CRYPTOPP_WORD128_AVAILABLE) #if (__SIZEOF_INT128__ >= 16) && !defined(CRYPTOPP_WORD128_AVAILABLE) && !defined(__aarch64__)
# error "An int128_t and uint128_t are available, but CRYPTOPP_WORD128_AVAILABLE is not defined" # error "An int128_t and uint128_t are available, but CRYPTOPP_WORD128_AVAILABLE is not defined"
#endif #endif
@ -334,6 +381,11 @@ NAMESPACE_END
#define CRYPTOPP_DISABLE_SSE2 #define CRYPTOPP_DISABLE_SSE2
#endif #endif
// Apple's Clang prior to 5.0 cannot handle SSE2 (and Apple does not use LLVM Clang numbering...)
#if defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION < 50000)
# define CRYPTOPP_DISABLE_ASM
#endif
#if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))) #if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))))
// C++Builder 2010 does not allow "call label" where label is defined within inline assembly // C++Builder 2010 does not allow "call label" where label is defined within inline assembly
#define CRYPTOPP_X86_ASM_AVAILABLE #define CRYPTOPP_X86_ASM_AVAILABLE
@ -362,7 +414,7 @@ NAMESPACE_END
#define CRYPTOPP_X64_ASM_AVAILABLE #define CRYPTOPP_X64_ASM_AVAILABLE
#endif #endif
#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__) || defined(__AES__)) #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSVC6PP_OR_LATER) || defined(__SSE2__))
#define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1 #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 1
#else #else
#define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0 #define CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE 0
@ -383,6 +435,8 @@ NAMESPACE_END
// how to allocate 16-byte aligned memory (for SSE2) // how to allocate 16-byte aligned memory (for SSE2)
#if defined(CRYPTOPP_MSVC6PP_OR_LATER) #if defined(CRYPTOPP_MSVC6PP_OR_LATER)
#define CRYPTOPP_MM_MALLOC_AVAILABLE #define CRYPTOPP_MM_MALLOC_AVAILABLE
#elif defined(__APPLE__)
#define CRYPTOPP_APPLE_MALLOC_AVAILABLE
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define CRYPTOPP_MALLOC_ALIGNMENT_IS_16 #define CRYPTOPP_MALLOC_ALIGNMENT_IS_16
#elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__) #elif defined(__linux__) || defined(__sun__) || defined(__CYGWIN__)
@ -391,6 +445,9 @@ NAMESPACE_END
#define CRYPTOPP_NO_ALIGNED_ALLOC #define CRYPTOPP_NO_ALIGNED_ALLOC
#endif #endif
// Apple always provides 16-byte aligned, and tells us to use calloc
// http://developer.apple.com/library/mac/documentation/Performance/Conceptual/ManagingMemory/Articles/MemoryAlloc.html
// how to disable inlining // how to disable inlining
#if defined(_MSC_VER) && _MSC_VER >= 1300 #if defined(_MSC_VER) && _MSC_VER >= 1300
# define CRYPTOPP_NOINLINE_DOTDOTDOT # define CRYPTOPP_NOINLINE_DOTDOTDOT
@ -444,13 +501,6 @@ NAMESPACE_END
#endif #endif
#endif #endif
// For use in template parameters; also see CRYPTOPP_BOOL_ALIGN16_ENABLED.
#if defined(CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS)
#define CRYPTOPP_BOOL_ALIGN 0
#else
#define CRYPTOPP_BOOL_ALIGN 1
#endif
// ***************** determine availability of OS features ******************** // ***************** determine availability of OS features ********************
#ifndef NO_OS_DEPENDENCE #ifndef NO_OS_DEPENDENCE
@ -463,6 +513,10 @@ NAMESPACE_END
#define CRYPTOPP_UNIX_AVAILABLE #define CRYPTOPP_UNIX_AVAILABLE
#endif #endif
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define CRYPTOPP_BSD_AVAILABLE
#endif
#if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE) #if defined(CRYPTOPP_WIN32_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
# define HIGHRES_TIMER_AVAILABLE # define HIGHRES_TIMER_AVAILABLE
#endif #endif
@ -525,7 +579,7 @@ NAMESPACE_END
#define CRYPTOPP_API __cdecl #define CRYPTOPP_API __cdecl
#else // CRYPTOPP_WIN32_AVAILABLE #else // not CRYPTOPP_WIN32_AVAILABLE
#define CRYPTOPP_DLL #define CRYPTOPP_DLL
#define CRYPTOPP_API #define CRYPTOPP_API
@ -561,14 +615,16 @@ NAMESPACE_END
#endif #endif
// ************** Unused variable *************** // ************** Unused variable ***************
// Portable way to suppress warning
// Portable way to suppress warnings.
// Moved from misc.h due to circular depenedencies.
#define CRYPTOPP_UNUSED(x) ((void)x) #define CRYPTOPP_UNUSED(x) ((void)x)
// ***************** C++11 related ******************** // ***************** C++11 related ********************
// Visual Studio and C++11 language features began at Visual Studio 2010, https://msdn.microsoft.com/en-us/library/hh567368%28v=vs.110%29.aspx. // Visual Studio began at VS2010, http://msdn.microsoft.com/en-us/library/hh567368%28v=vs.110%29.aspx.
// Intel and C++11 language features, https://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler // Intel and C++11 language features, http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler
// GCC and C++11 language features, https://gcc.gnu.org/projects/cxx0x.html // GCC and C++11 language features, http://gcc.gnu.org/projects/cxx0x.html
// Clang and C++11 language features, http://clang.llvm.org/cxx_status.html // Clang and C++11 language features, http://clang.llvm.org/cxx_status.html
#if (_MSC_VER >= 1600) || (__cplusplus >= 201103L) #if (_MSC_VER >= 1600) || (__cplusplus >= 201103L)
# define CRYPTOPP_CXX11 1 # define CRYPTOPP_CXX11 1
@ -579,8 +635,8 @@ NAMESPACE_END
// way. However, modern standard libraries have <forward_list>, so we test for it instead. // way. However, modern standard libraries have <forward_list>, so we test for it instead.
// Thanks to Jonathan Wakely for devising the clever test for modern/ancient versions. // Thanks to Jonathan Wakely for devising the clever test for modern/ancient versions.
// TODO: test under Xcode 3, where g++ is really g++. // TODO: test under Xcode 3, where g++ is really g++.
#if defined(__clang__) #if defined(__APPLE__) && defined(__clang__)
# if !(__has_include(<forward_list>)) # if !(defined(__has_include) && __has_include(<forward_list>))
# undef CRYPTOPP_CXX11 # undef CRYPTOPP_CXX11
# endif # endif
#endif #endif
@ -588,17 +644,54 @@ NAMESPACE_END
// C++11 or C++14 is available // C++11 or C++14 is available
#if defined(CRYPTOPP_CXX11) #if defined(CRYPTOPP_CXX11)
// alignof/alignas: MS at VS2013 (19.00); GCC at 4.8; Clang at 3.3; and Intel 15.0.
#if (CRYPTOPP_MSC_VERSION >= 1900)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
#elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
#elif defined(__clang__)
# if __has_feature(cxx_alignof)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40800)
# define CRYPTOPP_CXX11_ALIGNAS 1
# define CRYPTOPP_CXX11_ALIGNOF 1
#endif // alignof/alignas
// noexcept: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.0; and Intel 14.0. // noexcept: MS at VS2015 (19.00); GCC at 4.6; Clang at 3.0; and Intel 14.0.
#if (_MSC_VER >= 1900) || (__INTEL_COMPILER >= 1400) #if (CRYPTOPP_MSC_VERSION >= 1900)
# define CRYPTOPP_CXX11_NOEXCEPT 1
#elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1400)
# define CRYPTOPP_CXX11_NOEXCEPT 1 # define CRYPTOPP_CXX11_NOEXCEPT 1
#elif defined(__clang__) #elif defined(__clang__)
# if __has_feature(cxx_noexcept) # if __has_feature(cxx_noexcept)
# define CRYPTOPP_CXX11_NOEXCEPT 1 # define CRYPTOPP_CXX11_NOEXCEPT 1
# endif # endif
#elif (__GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #elif (CRYPTOPP_GCC_VERSION >= 40600)
# define CRYPTOPP_CXX11_NOEXCEPT 1 # define CRYPTOPP_CXX11_NOEXCEPT 1
#endif // noexcept compilers #endif // noexcept compilers
// variadic templates: MS at VS2013 (18.00); GCC at 4.3; Clang at 2.9; and Intel 12.1.
#if (CRYPTOPP_MSC_VERSION >= 1800)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1210)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#elif defined(__clang__)
# if __has_feature(cxx_variadic_templates)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
# endif
#elif (CRYPTOPP_GCC_VERSION >= 40300)
# define CRYPTOPP_CXX11_VARIADIC_TEMPLATES 1
#endif // variadic templates
// TODO: Emplacement, R-values and Move semantics
// Needed because we are catching warnings with GCC and MSC
#endif // CRYPTOPP_CXX11
#if defined(CRYPTOPP_CXX11_NOEXCEPT) #if defined(CRYPTOPP_CXX11_NOEXCEPT)
# define CRYPTOPP_THROW noexcept(false) # define CRYPTOPP_THROW noexcept(false)
# define CRYPTOPP_NO_THROW noexcept(true) # define CRYPTOPP_NO_THROW noexcept(true)
@ -607,13 +700,6 @@ NAMESPACE_END
# define CRYPTOPP_NO_THROW # define CRYPTOPP_NO_THROW
#endif // CRYPTOPP_CXX11_NOEXCEPT #endif // CRYPTOPP_CXX11_NOEXCEPT
#endif // CRYPTOPP_CXX11
#if !defined(CRYPTOPP_CXX11_NOEXCEPT)
# define CRYPTOPP_THROW
# define CRYPTOPP_NO_THROW
#endif
// OK to comment the following out, but please report it so we can fix it. // OK to comment the following out, but please report it so we can fix it.
#if (defined(__cplusplus) && (__cplusplus >= 199711L)) && !defined(CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE) #if (defined(__cplusplus) && (__cplusplus >= 199711L)) && !defined(CRYPTOPP_UNCAUGHT_EXCEPTION_AVAILABLE)
# error "std::uncaught_exception is not available. This is likely a configuration error." # error "std::uncaught_exception is not available. This is likely a configuration error."

View File

@ -13,6 +13,7 @@
# Set to suite your taste # Set to suite your taste
TEST_RESULTS=cryptest-result.txt TEST_RESULTS=cryptest-result.txt
BENCHMARK_RESULTS=cryptest-bench.txt
WARN_TEST_RESULTS=cryptest-warn-result.txt WARN_TEST_RESULTS=cryptest-warn-result.txt
# Respect user's preferred flags, but filter the stuff we expliclty test # Respect user's preferred flags, but filter the stuff we expliclty test
@ -58,6 +59,10 @@ else
MAKE=make MAKE=make
fi fi
if [ -z "$TMP" ]; then
TMP=/tmp
fi
# Use the compiler driver, and not cpp, to tell us if the flag is consumed. # Use the compiler driver, and not cpp, to tell us if the flag is consumed.
$CXX -x c++ -dM -E -std=c++11 - < /dev/null > /dev/null 2>&1 $CXX -x c++ -dM -E -std=c++11 - < /dev/null > /dev/null 2>&1
if [ "$?" -eq "0" ]; then if [ "$?" -eq "0" ]; then
@ -75,7 +80,7 @@ else
fi fi
# Set to 0 if you don't have UBsan # Set to 0 if you don't have UBsan
$CXX -x c++ -dM -E -fsanitize=undefined -std=c++11 - < /dev/null > /dev/null 2>&1 $CXX -x c++ -fsanitize=undefined adhoc.cpp.proto -o $TMP/adhoc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then if [ "$?" -eq "0" ]; then
HAVE_UBSAN=1 HAVE_UBSAN=1
else else
@ -88,7 +93,7 @@ if [ "$IS_CYGWIN" -ne "0" ] || [ "$IS_MINGW" -ne "0" ]; then
fi fi
# Set to 0 if you don't have Asan # Set to 0 if you don't have Asan
$CXX -x c++ -dM -E -fsanitize=address -std=c++11 - < /dev/null > /dev/null 2>&1 $CXX -x c++ -fsanitize=undefined adhoc.cpp.proto -o $TMP/adhoc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then if [ "$?" -eq "0" ]; then
HAVE_ASAN=1 HAVE_ASAN=1
else else
@ -100,6 +105,12 @@ if [ "$IS_CYGWIN" -ne "0" ] || [ "$IS_MINGW" -ne "0" ]; then
HAVE_ASAN=0 HAVE_ASAN=0
fi fi
#Final fixups for compilers liek GCC on ARM64
if [ "$HAVE_UBSAN" -eq "0" ] || [ "$HAVE_ASAN" -eq "0" ]; then
HAVE_UBAN=0
HAVE_ASAN=0
fi
# Set to 0 if you don't have Valgrind. Valgrind tests take a long time... # Set to 0 if you don't have Valgrind. Valgrind tests take a long time...
HAVE_VALGRIND=$(which valgrind 2>&1 | grep -v "no valgrind" | grep -i -c valgrind) HAVE_VALGRIND=$(which valgrind 2>&1 | grep -v "no valgrind" | grep -i -c valgrind)
@ -115,6 +126,7 @@ if [ "$HAVE_VALGRIND" -ne "0" ]; then
fi fi
if [ "$IS_DARWIN" -ne "0" ]; then if [ "$IS_DARWIN" -ne "0" ]; then
echo "IS_DARWIN: $IS_DARWIN" echo "IS_DARWIN: $IS_DARWIN"
unset MallocScribble MallocPreScribble MallocGuardEdges
fi fi
if [ "$IS_LINUX" -ne "0" ]; then if [ "$IS_LINUX" -ne "0" ]; then
echo "IS_LINUX: $IS_LINUX" echo "IS_LINUX: $IS_LINUX"
@ -593,6 +605,98 @@ if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX11" -ne "0" ]; then
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
fi fi
############################################
# Darwin, c++03, Malloc Guards
if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX03" -ne "0" ]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Darwin, c++03, Malloc Guards" | tee -a "$TEST_RESULTS"
echo
unset CXXFLAGS
"$MAKE" clean > /dev/null 2>&1
export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++03 $ADD_CXXFLAGS"
"$MAKE" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
export MallocScribble=1
export MallocPreScribble=1
export MallocGuardEdges=1
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
unset MallocScribble MallocPreScribble MallocGuardEdges
fi
############################################
# Darwin, c++11, Malloc Guards
if [ "$IS_DARWIN" -ne "0" ] && [ "$HAVE_CXX11" -ne "0" ]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Darwin, c++11, Malloc Guards" | tee -a "$TEST_RESULTS"
echo
unset CXXFLAGS
"$MAKE" clean > /dev/null 2>&1
export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 $ADD_CXXFLAGS"
"$MAKE" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
export MallocScribble=1
export MallocPreScribble=1
export MallocGuardEdges=1
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
unset MallocScribble MallocPreScribble MallocGuardEdges
fi
# Try to locate a Xcode compiler for testing under Darwin
XCODE_COMPILER=$(find /Applications/Xcode*.app/Contents/Developer -name clang++ | head -1)
############################################
# Xcode compiler
if [ "$IS_DARWIN" -ne "0" ] && [ -z "$XCODE_COMPILER" ]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Xcode Clang compiler" | tee -a "$TEST_RESULTS"
echo
unset CXXFLAGS
"$MAKE" clean > /dev/null 2>&1
expot CXX="$XCODE_COMPILER"
export CXXFLAGS="-DNDEBUG -g2 -O2 -std=c++11 $ADD_CXXFLAGS"
"$MAKE" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS"
./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS"
fi
############################################
# Benchmarks, c++03
if [ "$HAVE_CXX03" -ne "0" ]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Benchmarks, c++03" | tee -a "$TEST_RESULTS"
echo
unset CXXFLAGS
"$MAKE" clean > /dev/null 2>&1
export CXXFLAGS="-DNDEBUG -O3 -std=c++03 $ADD_CXXFLAGS"
"$MAKE" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
./cryptest.exe b 3 2.4+1e9 2>&1 | tee -a "$BENCHMARK_RESULTS"
fi
############################################
# Benchmarks, c++11
if [ "$HAVE_CXX11" -ne "0" ]; then
echo
echo "************************************" | tee -a "$TEST_RESULTS"
echo "Testing: Benchmarks, c++11" | tee -a "$TEST_RESULTS"
echo
unset CXXFLAGS
"$MAKE" clean > /dev/null 2>&1
export CXXFLAGS="-DNDEBUG -O3 -std=c++11 $ADD_CXXFLAGS"
"$MAKE" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS"
./cryptest.exe b 3 2.4+1e9 2>&1 | tee -a "$BENCHMARK_RESULTS"
fi
# For Cygwin, we need to test both PREFER_BERKELEY_STYLE_SOCKETS # For Cygwin, we need to test both PREFER_BERKELEY_STYLE_SOCKETS
# and PREFER_WINDOWS_STYLE_SOCKETS # and PREFER_WINDOWS_STYLE_SOCKETS
@ -712,15 +816,16 @@ fi
echo | tee -a "$TEST_RESULTS" echo | tee -a "$TEST_RESULTS"
# "FAILED" is from Crypto++ # "FAILED" is from Crypto++
# "Error" is from the GNU assembler
# "error" is from the sanitizers # "error" is from the sanitizers
# "Illegal", "0 errors" and "suppressed errors" are from Valgrind. # "Illegal", "0 errors" and "suppressed errors" are from Valgrind.
COUNT=$(egrep -a '(error|FAILED|Illegal)' cryptest-result.txt | egrep -v "( 0 errors|suppressed errors|memory error detector)" | wc -l) COUNT=$(egrep -a '(Error|error|FAILED|Illegal)' cryptest-result.txt | egrep -v "( 0 errors|suppressed errors|memory error detector)" | wc -l)
if [ "$COUNT" -eq "0" ]; then if [ "$COUNT" -eq "0" ]; then
echo "No failures detected" | tee -a "$TEST_RESULTS" echo "No failures detected" | tee -a "$TEST_RESULTS"
else else
echo "$COUNT errors detected" | tee -a "$TEST_RESULTS" echo "$COUNT errors detected" | tee -a "$TEST_RESULTS"
echo echo
egrep -an "(error|FAILED|Illegal)" cryptest-result.txt egrep -an "(Error|error|FAILED|Illegal)" cryptest-result.txt
fi fi
echo | tee -a "$TEST_RESULTS" echo | tee -a "$TEST_RESULTS"

Binary file not shown.