|
||||
File indexing completed on 2025-01-18 09:54:55
0001 // config_misc.h - written and placed in public domain by Jeffrey Walton 0002 // the bits that make up this source file are from the 0003 // library's monolithic config.h. 0004 0005 /// \file config_misc.h 0006 /// \brief Library configuration file 0007 /// \details <tt>config_misc.h</tt> provides miscellaneous defines. 0008 /// \details <tt>config.h</tt> was split into components in May 2019 to better 0009 /// integrate with Autoconf and its feature tests. The splitting occurred so 0010 /// users could continue to include <tt>config.h</tt> while allowing Autoconf 0011 /// to write new <tt>config_asm.h</tt> and new <tt>config_cxx.h</tt> using 0012 /// its feature tests. 0013 /// \note You should include <tt>config.h</tt> rather than <tt>config_misc.h</tt> 0014 /// directly. 0015 /// \sa <A HREF="https://github.com/weidai11/cryptopp/issues/835">Issue 835, 0016 /// Make config.h more autoconf friendly</A>, 0017 /// <A HREF="https://www.cryptopp.com/wiki/Configure.sh">Configure.sh script</A> 0018 /// on the Crypto++ wiki 0019 /// \since Crypto++ 8.3 0020 0021 #ifndef CRYPTOPP_CONFIG_MISC_H 0022 #define CRYPTOPP_CONFIG_MISC_H 0023 0024 #include "config_asm.h" 0025 #include "config_cxx.h" 0026 #include "config_os.h" 0027 #include "config_ver.h" 0028 0029 // Define this if running on a big-endian CPU 0030 // big endian will be assumed if CRYPTOPP_LITTLE_ENDIAN is not non-0 0031 #if !defined(CRYPTOPP_LITTLE_ENDIAN) && !defined(CRYPTOPP_BIG_ENDIAN) && (defined(__BIG_ENDIAN__) || (defined(__s390__) || defined(__s390x__) || defined(__zarch__)) || (defined(__m68k__) || defined(__MC68K__)) || defined(__sparc) || defined(__sparc__) || defined(__hppa__) || defined(__MIPSEB__) || defined(__ARMEB__) || (defined(__MWERKS__) && !defined(__INTEL__))) 0032 # define CRYPTOPP_BIG_ENDIAN 1 0033 #endif 0034 0035 // Define this if running on a little-endian CPU 0036 // big endian will be assumed if CRYPTOPP_LITTLE_ENDIAN is not non-0 0037 #if !defined(CRYPTOPP_BIG_ENDIAN) && !defined(CRYPTOPP_LITTLE_ENDIAN) 0038 # define CRYPTOPP_LITTLE_ENDIAN 1 0039 #endif 0040 0041 // Define this if you want to set a prefix for TestData/ and TestVectors/ 0042 // Be sure to add the trailing slash since its simple concatenation. 0043 // After https://github.com/weidai11/cryptopp/issues/760 the library 0044 // should find the test vectors and data without much effort. It 0045 // will search in "./" and "$ORIGIN/../share/cryptopp" automatically. 0046 #ifndef CRYPTOPP_DATA_DIR 0047 # define CRYPTOPP_DATA_DIR "" 0048 #endif 0049 0050 // Define this to disable the test suite from searching for test 0051 // vectors and data in "./" and "$ORIGIN/../share/cryptopp". The 0052 // library will still search in CRYPTOPP_DATA_DIR, regardless. 0053 // Some distros may want to disable this feature. Also see 0054 // https://github.com/weidai11/cryptopp/issues/760 0055 // #ifndef CRYPTOPP_DISABLE_DATA_DIR_SEARCH 0056 // # define CRYPTOPP_DISABLE_DATA_DIR_SEARCH 0057 // #endif 0058 0059 // Define this if you want or need the library's memcpy_s and memmove_s. 0060 // See http://github.com/weidai11/cryptopp/issues/28. 0061 // #if !defined(CRYPTOPP_WANT_SECURE_LIB) 0062 // # define CRYPTOPP_WANT_SECURE_LIB 0063 // #endif 0064 0065 // Define this if ARMv8 shifts are slow. ARM Cortex-A53 and Cortex-A57 shift 0066 // operation perform poorly, so NEON and ASIMD code that relies on shifts 0067 // or rotates often performs worse than C/C++ code. Also see 0068 // http://github.com/weidai11/cryptopp/issues/367. 0069 #define CRYPTOPP_SLOW_ARMV8_SHIFT 1 0070 0071 // CRYPTOPP_DEBUG enables the library's CRYPTOPP_ASSERT. CRYPTOPP_ASSERT 0072 // raises a SIGTRAP (Unix) or calls DebugBreak() (Windows). CRYPTOPP_ASSERT 0073 // is only in effect when CRYPTOPP_DEBUG, DEBUG or _DEBUG is defined. Unlike 0074 // Posix assert, CRYPTOPP_ASSERT is not affected by NDEBUG (or failure to 0075 // define it). According to the ndk-build docs, Android use NDK_DEBUG=1 to 0076 // signal a DEBUG build (and NDK_DEBUG=0 to signal non-DEBUG build). 0077 // Also see http://github.com/weidai11/cryptopp/issues/277, CVE-2016-7420 and 0078 // https://developer.android.com/ndk/guides/ndk-build 0079 #if (defined(DEBUG) || defined(_DEBUG)) || (defined(NDK_DEBUG) && (NDK_DEBUG > 0)) 0080 # undef CRYPTOPP_DEBUG 0081 # define CRYPTOPP_DEBUG 1 0082 #endif 0083 0084 // File system code to use when creating GZIP archive. 0085 // http://www.gzip.org/format.txt 0086 #if !defined(GZIP_OS_CODE) 0087 # if defined(__macintosh__) 0088 # define GZIP_OS_CODE 7 0089 # elif defined(__unix__) || defined(__linux__) 0090 # define GZIP_OS_CODE 3 0091 # else 0092 # define GZIP_OS_CODE 0 0093 # endif 0094 #endif 0095 0096 // Try this if your CPU has 256K internal cache or a slow multiply instruction 0097 // and you want a (possibly) faster IDEA implementation using log tables 0098 // #define IDEA_LARGECACHE 0099 0100 // Define this if, for the linear congruential RNG, you want to use 0101 // the original constants as specified in S.K. Park and K.W. Miller's 0102 // CACM paper. 0103 // #define LCRNG_ORIGINAL_NUMBERS 0104 0105 // Define this if you want Integer's operator<< to honor std::showbase (and 0106 // std::noshowbase). If defined, Integer will use a suffix of 'b', 'o', 'h' 0107 // or '.' (the last for decimal) when std::showbase is in effect. If 0108 // std::noshowbase is set, then the suffix is not added to the Integer. If 0109 // not defined, existing behavior is preserved and Integer will use a suffix 0110 // of 'b', 'o', 'h' or '.' (the last for decimal). 0111 // #define CRYPTOPP_USE_STD_SHOWBASE 0112 0113 // Define this if you want to decouple AlgorithmParameters and Integer 0114 // The decoupling should make it easier for the linker to remove Integer 0115 // related code for those who do not need Integer, and avoid a potential 0116 // race during AssignIntToInteger pointer initialization. Also 0117 // see http://github.com/weidai11/cryptopp/issues/389. 0118 // #define CRYPTOPP_NO_ASSIGN_TO_INTEGER 0119 0120 // Need GCC 4.6/Clang 1.7/Apple Clang 2.0 or above due to "GCC diagnostic {push|pop}" 0121 #if (CRYPTOPP_GCC_VERSION >= 40600) || (CRYPTOPP_LLVM_CLANG_VERSION >= 10700) || \ 0122 (CRYPTOPP_APPLE_CLANG_VERSION >= 20000) 0123 #define CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 1 0124 #endif 0125 0126 // Portable way to suppress warnings. 0127 // Moved from misc.h due to circular depenedencies. 0128 #ifndef CRYPTOPP_UNUSED 0129 #define CRYPTOPP_UNUSED(x) ((void)(x)) 0130 #endif 0131 0132 // how to disable inlining 0133 #if defined(CRYPTOPP_MSC_VERSION) 0134 # define CRYPTOPP_NOINLINE_DOTDOTDOT 0135 # define CRYPTOPP_NOINLINE __declspec(noinline) 0136 #elif defined(__xlc__) || defined(__xlC__) || defined(__ibmxl__) 0137 # define CRYPTOPP_NOINLINE_DOTDOTDOT ... 0138 # define CRYPTOPP_NOINLINE __attribute__((noinline)) 0139 #elif defined(__GNUC__) 0140 # define CRYPTOPP_NOINLINE_DOTDOTDOT 0141 # define CRYPTOPP_NOINLINE __attribute__((noinline)) 0142 #else 0143 # define CRYPTOPP_NOINLINE_DOTDOTDOT ... 0144 # define CRYPTOPP_NOINLINE 0145 #endif 0146 0147 // http://stackoverflow.com/a/13867690/608639 0148 // CRYPTOPP_CONST_OR_CONSTEXPR due to https://github.com/weidai11/cryptopp/issues/1185 0149 #if defined(CRYPTOPP_CXX11_CONSTEXPR) 0150 # define CRYPTOPP_STATIC_CONSTEXPR static constexpr 0151 # define CRYPTOPP_STATIC_CONST_OR_CONSTEXPR static constexpr 0152 # define CRYPTOPP_CONST_OR_CONSTEXPR constexpr 0153 # define CRYPTOPP_CONSTEXPR constexpr 0154 #else 0155 # define CRYPTOPP_STATIC_CONSTEXPR static 0156 # define CRYPTOPP_STATIC_CONST_OR_CONSTEXPR static const 0157 # define CRYPTOPP_CONST_OR_CONSTEXPR const 0158 # define CRYPTOPP_CONSTEXPR 0159 #endif // CRYPTOPP_CXX11_CONSTEXPR 0160 0161 #if defined(CRYPTOPP_DOXYGEN_PROCESSING) 0162 # define CRYPTOPP_CONSTANT(x) static const int x 0163 #elif defined(CRYPTOPP_CXX11_STRONG_ENUM) 0164 # define CRYPTOPP_CONSTANT(x) enum : int { x } 0165 #elif defined(CRYPTOPP_CXX11_CONSTEXPR) 0166 # define CRYPTOPP_CONSTANT(x) constexpr static int x 0167 #else 0168 # define CRYPTOPP_CONSTANT(x) static const int x 0169 #endif 0170 0171 // Warnings 0172 #ifdef CRYPTOPP_MSC_VERSION 0173 // 4127: conditional expression is constant 0174 // 4512: assignment operator not generated 0175 // 4661: no suitable definition provided for explicit template instantiation request 0176 // 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation 0177 # pragma warning(disable: 4127 4512 4661 4910) 0178 // CRYPTOPP_MSC_VERSION 1920 is VS2019 0179 # if CRYPTOPP_MSC_VERSION >= 1920 0180 // 5054: operator '|': deprecated between enumerations of different types 0181 # pragma warning(disable: 5054) 0182 # endif 0183 // Security related, possible defects 0184 // http://blogs.msdn.com/b/vcblog/archive/2010/12/14/off-by-default-compiler-warnings-in-visual-c.aspx 0185 # pragma warning(once: 4191 4242 4263 4264 4266 4302 4826 4905 4906 4928) 0186 #endif 0187 0188 #ifdef __BORLANDC__ 0189 // 8037: non-const function called for const object. needed to work around BCB2006 bug 0190 # pragma warn -8037 0191 #endif 0192 0193 // [GCC Bug 53431] "C++ preprocessor ignores #pragma GCC diagnostic". Clang honors it. 0194 #if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 0195 # pragma GCC diagnostic ignored "-Wunknown-pragmas" 0196 # pragma GCC diagnostic ignored "-Wunused-function" 0197 #endif 0198 0199 #endif // CRYPTOPP_CONFIG_MISC_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |