Crypto++
8.3
Free C++ class library of cryptographic schemes
config_misc.h
Go to the documentation of this file.
1
// config_misc.h - written and placed in public domain by Jeffrey Walton
2
// the bits that make up this source file are from the
3
// library's monolithic config.h.
4
5
/// \file config_misc.h
6
/// \brief Library configuration file
7
/// \details <tt>config.h</tt> was split into components in May 2019 to better
8
/// integrate with Autoconf and its feature tests. The splitting occurred so
9
/// users could continue to include <tt>config.h</tt> while allowing Autoconf
10
/// to write new <tt>config_asm.h</tt> and new <tt>config_cxx.h</tt> using
11
/// its feature tests.
12
/// \sa <A HREF="https://github.com/weidai11/cryptopp/issues/835">Issue 835</A>
13
/// \since Crypto++ 8.3
14
15
#ifndef CRYPTOPP_CONFIG_MISC_H
16
#define CRYPTOPP_CONFIG_MISC_H
17
18
#include "
config_asm.h
"
19
#include "
config_cxx.h
"
20
#include "
config_os.h
"
21
#include "
config_ver.h
"
22
23
// Define this if running on a big-endian CPU
24
// big endian will be assumed if CRYPTOPP_LITTLE_ENDIAN is not non-0
25
#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__)))
26
# define CRYPTOPP_BIG_ENDIAN 1
27
#endif
28
29
// Define this if running on a little-endian CPU
30
// big endian will be assumed if CRYPTOPP_LITTLE_ENDIAN is not non-0
31
#if !defined(CRYPTOPP_BIG_ENDIAN) && !defined(CRYPTOPP_LITTLE_ENDIAN)
32
# define CRYPTOPP_LITTLE_ENDIAN 1
33
#endif
34
35
// Define this if you want to set a prefix for TestData/ and TestVectors/
36
// Be sure to add the trailing slash since its simple concatenation.
37
// After https://github.com/weidai11/cryptopp/issues/760 the library
38
// should find the test vectors and data without much effort. It
39
// will search in "./" and "$ORIGIN/../share/cryptopp" automatically.
40
#ifndef CRYPTOPP_DATA_DIR
41
# define CRYPTOPP_DATA_DIR ""
42
#endif
43
44
// Define this to disable the test suite from searching for test
45
// vectors and data in "./" and "$ORIGIN/../share/cryptopp". The
46
// library will still search in CRYPTOPP_DATA_DIR, regardless.
47
// Some distros may want to disable this feature. Also see
48
// https://github.com/weidai11/cryptopp/issues/760
49
// #ifndef CRYPTOPP_DISABLE_DATA_DIR_SEARCH
50
// # define CRYPTOPP_DISABLE_DATA_DIR_SEARCH
51
// #endif
52
53
// Define this if you want or need the library's memcpy_s and memmove_s.
54
// See http://github.com/weidai11/cryptopp/issues/28.
55
// #if !defined(CRYPTOPP_WANT_SECURE_LIB)
56
// # define CRYPTOPP_WANT_SECURE_LIB
57
// #endif
58
59
// Define this if ARMv8 shifts are slow. ARM Cortex-A53 and Cortex-A57 shift
60
// operation perform poorly, so NEON and ASIMD code that relies on shifts
61
// or rotates often performs worse than C/C++ code. Also see
62
// http://github.com/weidai11/cryptopp/issues/367.
63
#define CRYPTOPP_SLOW_ARMV8_SHIFT 1
64
65
// CRYPTOPP_DEBUG enables the library's CRYPTOPP_ASSERT. CRYPTOPP_ASSERT
66
// raises a SIGTRAP (Unix) or calls DebugBreak() (Windows). CRYPTOPP_ASSERT
67
// is only in effect when CRYPTOPP_DEBUG, DEBUG or _DEBUG is defined. Unlike
68
// Posix assert, CRYPTOPP_ASSERT is not affected by NDEBUG (or failure to
69
// define it).
70
// Also see http://github.com/weidai11/cryptopp/issues/277, CVE-2016-7420
71
#if (defined(DEBUG) || defined(_DEBUG)) && !defined(CRYPTOPP_DEBUG)
72
# define CRYPTOPP_DEBUG 1
73
#endif
74
75
// File system code to use when creating GZIP archive.
76
// http://www.gzip.org/format.txt
77
#if !defined(GZIP_OS_CODE)
78
# if defined(__macintosh__)
79
# define GZIP_OS_CODE 7
80
# elif defined(__unix__) || defined(__linux__)
81
# define GZIP_OS_CODE 3
82
# else
83
# define GZIP_OS_CODE 0
84
# endif
85
#endif
86
87
// Try this if your CPU has 256K internal cache or a slow multiply instruction
88
// and you want a (possibly) faster IDEA implementation using log tables
89
// #define IDEA_LARGECACHE
90
91
// Define this if, for the linear congruential RNG, you want to use
92
// the original constants as specified in S.K. Park and K.W. Miller's
93
// CACM paper.
94
// #define LCRNG_ORIGINAL_NUMBERS
95
96
// Define this if you want Integer's operator<< to honor std::showbase (and
97
// std::noshowbase). If defined, Integer will use a suffix of 'b', 'o', 'h'
98
// or '.' (the last for decimal) when std::showbase is in effect. If
99
// std::noshowbase is set, then the suffix is not added to the Integer. If
100
// not defined, existing behavior is preserved and Integer will use a suffix
101
// of 'b', 'o', 'h' or '.' (the last for decimal).
102
// #define CRYPTOPP_USE_STD_SHOWBASE
103
104
// Define this if you want to decouple AlgorithmParameters and Integer
105
// The decoupling should make it easier for the linker to remove Integer
106
// related code for those who do not need Integer, and avoid a potential
107
// race during AssignIntToInteger pointer initialization. Also
108
// see http://github.com/weidai11/cryptopp/issues/389.
109
// #define CRYPTOPP_NO_ASSIGN_TO_INTEGER
110
111
// Need GCC 4.6/Clang 1.7/Apple Clang 2.0 or above due to "GCC diagnostic {push|pop}"
112
#if (CRYPTOPP_GCC_VERSION >= 40600) || (CRYPTOPP_LLVM_CLANG_VERSION >= 10700) || \
113
(CRYPTOPP_APPLE_CLANG_VERSION >= 20000)
114
#define CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE 1
115
#endif
116
117
// Portable way to suppress warnings.
118
// Moved from misc.h due to circular depenedencies.
119
#ifndef CRYPTOPP_UNUSED
120
#define CRYPTOPP_UNUSED(x) ((void)(x))
121
#endif
122
123
// how to disable inlining
124
#if defined(_MSC_VER)
125
# define CRYPTOPP_NOINLINE_DOTDOTDOT
126
# define CRYPTOPP_NOINLINE __declspec(noinline)
127
#elif defined(__xlc__) || defined(__xlC__) || defined(__ibmxl__)
128
# define CRYPTOPP_NOINLINE_DOTDOTDOT ...
129
# define CRYPTOPP_NOINLINE __attribute__((noinline))
130
#elif defined(__GNUC__)
131
# define CRYPTOPP_NOINLINE_DOTDOTDOT
132
# define CRYPTOPP_NOINLINE __attribute__((noinline))
133
#else
134
# define CRYPTOPP_NOINLINE_DOTDOTDOT ...
135
# define CRYPTOPP_NOINLINE
136
#endif
137
138
// http://stackoverflow.com/a/13867690/608639
139
#if defined(CRYPTOPP_CXX11_CONSTEXPR)
140
# define CRYPTOPP_STATIC_CONSTEXPR static constexpr
141
# define CRYPTOPP_CONSTEXPR constexpr
142
#else
143
# define CRYPTOPP_STATIC_CONSTEXPR static
144
# define CRYPTOPP_CONSTEXPR
145
#endif // CRYPTOPP_CXX11_CONSTEXPR
146
147
#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
148
# define CRYPTOPP_CONSTANT(x) static const int x
149
#elif defined(CRYPTOPP_CXX11_STRONG_ENUM)
150
# define CRYPTOPP_CONSTANT(x) enum : int { x }
151
#elif defined(CRYPTOPP_CXX11_CONSTEXPR)
152
# define CRYPTOPP_CONSTANT(x) constexpr static int x
153
#else
154
# define CRYPTOPP_CONSTANT(x) static const int x
155
#endif
156
157
// Warnings
158
#ifdef _MSC_VER
159
// 4127: conditional expression is constant
160
// 4512: assignment operator not generated
161
// 4661: no suitable definition provided for explicit template instantiation request
162
// 4910: '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
163
# pragma warning(disable: 4127 4512 4661 4910)
164
// _MSC_VER 1920 is VS2019
165
# if _MSC_VER >= 1920
166
// 5054: operator '|': deprecated between enumerations of different types
167
# pragma warning(disable: 5054)
168
# endif
169
// Security related, possible defects
170
// http://blogs.msdn.com/b/vcblog/archive/2010/12/14/off-by-default-compiler-warnings-in-visual-c.aspx
171
# pragma warning(once: 4191 4242 4263 4264 4266 4302 4826 4905 4906 4928)
172
#endif
173
174
#ifdef __BORLANDC__
175
// 8037: non-const function called for const object. needed to work around BCB2006 bug
176
# pragma warn -8037
177
#endif
178
179
// [GCC Bug 53431] "C++ preprocessor ignores #pragma GCC diagnostic". Clang honors it.
180
#if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
181
# pragma GCC diagnostic ignored "-Wunknown-pragmas"
182
# pragma GCC diagnostic ignored "-Wunused-function"
183
#endif
184
185
#endif // CRYPTOPP_CONFIG_MISC_H
config_asm.h
Library configuration file.
config_cxx.h
Library configuration file.
config_os.h
Library configuration file.
config_ver.h
Library configuration file.
Generated on Fri Dec 25 2020 17:16:54 for Crypto++ by
1.8.20