Security Scol plugin
config_cpu.h
Go to the documentation of this file.
1// config_cpu.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
23
24#ifndef CRYPTOPP_CONFIG_CPU_H
25#define CRYPTOPP_CONFIG_CPU_H
26
27#include "config_ver.h"
28
29#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
44 #define CRYPTOPP_BOOL_X32 ...
48 #define CRYPTOPP_BOOL_X64 ...
52 #define CRYPTOPP_BOOL_X86 ...
53#elif (defined(__ILP32__) || defined(_ILP32)) && defined(__x86_64__)
54 #define CRYPTOPP_BOOL_X32 1
55#elif (defined(_M_X64) || defined(__x86_64__))
56 #define CRYPTOPP_BOOL_X64 1
57#elif (defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_X86_) || defined(__I86__) || defined(__INTEL__))
58 #define CRYPTOPP_BOOL_X86 1
59#endif
60
61#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
67 #define CRYPTOPP_BOOL_ARMV8 ...
72 #define CRYPTOPP_BOOL_ARM64 ...
77 #define CRYPTOPP_BOOL_ARM32 ...
78#elif defined(__arm64__) || defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
79 // Microsoft added ARM64 define December 2017.
80 #define CRYPTOPP_BOOL_ARMV8 1
81#endif
82#if defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64)
83 #define CRYPTOPP_BOOL_ARM64 1
84#elif defined(__arm__) || defined(_M_ARM)
85 #define CRYPTOPP_BOOL_ARM32 1
86#endif
87
88#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
92 #define CRYPTOPP_BOOL_PPC64 ...
96 #define CRYPTOPP_BOOL_PPC32 ...
97#elif defined(__ppc64__) || defined(__powerpc64__) || defined(__PPC64__) || defined(_ARCH_PPC64)
98 #define CRYPTOPP_BOOL_PPC64 1
99#elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) || defined(_ARCH_PPC)
100 #define CRYPTOPP_BOOL_PPC32 1
101#endif
102
103#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
107 #define CRYPTOPP_BOOL_MIPS64 ...
111 #define CRYPTOPP_BOOL_MIPS32 ...
112#elif defined(__mips64__)
113 #define CRYPTOPP_BOOL_MIPS64 1
114#elif defined(__mips__)
115 #define CRYPTOPP_BOOL_MIPS32 1
116#endif
117
118#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
122 #define CRYPTOPP_BOOL_SPARC64 ...
126 #define CRYPTOPP_BOOL_SPARC32 ...
127#elif defined(__sparc64__) || defined(__sparc64) || defined(__sparcv9) || defined(__sparc_v9__)
128 #define CRYPTOPP_BOOL_SPARC64 1
129#elif defined(__sparc__) || defined(__sparc) || defined(__sparcv8) || defined(__sparc_v8__)
130 #define CRYPTOPP_BOOL_SPARC32 1
131#endif
132
133#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
147 #define CRYPTOPP_L1_CACHE_LINE_SIZE ...
148#else
149 #ifndef CRYPTOPP_L1_CACHE_LINE_SIZE
150 #if defined(CRYPTOPP_BOOL_X32) || defined(CRYPTOPP_BOOL_X64) || defined(CRYPTOPP_BOOL_ARMV8) || \
151 defined(CRYPTOPP_BOOL_MIPS64) || defined(CRYPTOPP_BOOL_SPARC64)
152 #define CRYPTOPP_L1_CACHE_LINE_SIZE 64
153 #elif defined(CRYPTOPP_BOOL_PPC32) || defined(CRYPTOPP_BOOL_PPC64)
154 // http://lists.llvm.org/pipermail/llvm-dev/2017-March/110982.html
155 #define CRYPTOPP_L1_CACHE_LINE_SIZE 128
156 #else
157 // L1 cache line size is 32 on Pentium III and earlier
158 #define CRYPTOPP_L1_CACHE_LINE_SIZE 32
159 #endif
160 #endif
161#endif
162
163#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
168 #define CRYPTOPP_SECTION_INIT ...
169#else
170 // The section attribute attempts to initialize CPU flags to avoid Valgrind findings above -O1
171 #if ((defined(__MACH__) && defined(__APPLE__)) && ((CRYPTOPP_LLVM_CLANG_VERSION >= 30600) || \
172 (CRYPTOPP_APPLE_CLANG_VERSION >= 70100) || (CRYPTOPP_GCC_VERSION >= 40300)))
173 #define CRYPTOPP_SECTION_INIT __attribute__((section ("__DATA,__data")))
174 #elif (defined(__ELF__) && (CRYPTOPP_GCC_VERSION >= 40300))
175 #define CRYPTOPP_SECTION_INIT __attribute__((section ("nocommon")))
176 #elif defined(__ELF__) && (defined(__xlC__) || defined(__ibmxl__))
177 #define CRYPTOPP_SECTION_INIT __attribute__((section ("nocommon")))
178 #else
179 #define CRYPTOPP_SECTION_INIT
180 #endif
181#endif
182
183// How to disable CPU feature probing. We determine machine
184// capabilities by performing an os/platform *query* first,
185// like getauxv(). If the *query* fails, we move onto a
186// cpu *probe*. The cpu *probe* tries to exeute an instruction
187// and then catches a SIGILL on Linux or the exception
188// EXCEPTION_ILLEGAL_INSTRUCTION on Windows. Some OSes
189// fail to hangle a SIGILL gracefully, like Apple OSes. Apple
190// machines corrupt memory and variables around the probe.
191#if defined(__APPLE__)
192 #define CRYPTOPP_NO_CPU_FEATURE_PROBES 1
193#endif
194
195// Flavor of inline assembly language
196#if defined(CRYPTOPP_DOXYGEN_PROCESSING)
200 #define CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY ...
204 #define CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY ...
205#elif defined(_MSC_VER) || defined(__BORLANDC__)
206 #define CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY 1
207#else
208 #define CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY 1
209#endif
210
211#endif // CRYPTOPP_CONFIG_CPU_H
Library configuration file.