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