Crypto++  8.4
Free C++ class library of cryptographic schemes
config_asm.h
Go to the documentation of this file.
1 // config_asm.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_asm.h
6 /// \brief Library configuration file
7 /// \details <tt>config_asm.h</tt> provides defines for instruction set
8 /// architectures
9 /// and inline assembly.
10 /// \details <tt>config.h</tt> was split into components in May 2019 to better
11 /// integrate with Autoconf and its feature tests. The splitting occurred so
12 /// users could continue to include <tt>config.h</tt> while allowing Autoconf
13 /// to write new <tt>config_asm.h</tt> and new <tt>config_cxx.h</tt> using
14 /// its feature tests.
15 /// \note You should include <tt>config.h</tt> rather than <tt>config_asm.h</tt>
16 /// directly.
17 /// \sa <A HREF="https://github.com/weidai11/cryptopp/issues/835">Issue 835,
18 /// Make config.h more autoconf friendly</A>,
19 /// <A HREF="https://www.cryptopp.com/wiki/Configure.sh">Configure.sh script</A>
20 /// on the Crypto++ wiki
21 /// \since Crypto++ 8.3
22 
23 #ifndef CRYPTOPP_CONFIG_ASM_H
24 #define CRYPTOPP_CONFIG_ASM_H
25 
26 #include "config_os.h"
27 #include "config_cpu.h"
28 #include "config_ver.h"
29 
30 // Define this to disable ASM, intrinsics and built-ins. The library will be
31 // compiled using C++ only. The library code will not include SSE2 (and
32 // above), NEON, Aarch32, Aarch64, or Altivec (and above). Note the compiler
33 // may use higher ISAs depending on compiler options, but the library will not
34 // explictly use the ISAs. When disabling ASM, it is best to do it from
35 // config.h to ensure the library and all programs share the setting.
36 // #define CRYPTOPP_DISABLE_ASM 1
37 
38 // https://github.com/weidai11/cryptopp/issues/719
39 #if defined(__native_client__)
40 # undef CRYPTOPP_DISABLE_ASM
41 # define CRYPTOPP_DISABLE_ASM 1
42 #endif
43 
44 // Some Clang and SunCC cannot handle mixed asm with positional arguments,
45 // where the body is Intel style with no prefix and the templates are
46 // AT&T style. Define this if the Makefile misdetects the configuration.
47 // Also see https://bugs.llvm.org/show_bug.cgi?id=39895 .
48 // #define CRYPTOPP_DISABLE_MIXED_ASM 1
49 
50 #if defined(__clang__) || (defined(__APPLE__) && defined(__GNUC__)) || defined(__SUNPRO_CC)
51 # undef CRYPTOPP_DISABLE_MIXED_ASM
52 # define CRYPTOPP_DISABLE_MIXED_ASM 1
53 #endif
54 
55 // CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS is no longer honored. It
56 // was removed at https://github.com/weidai11/cryptopp/issues/682
57 // #define CRYPTOPP_ALLOW_UNALIGNED_DATA_ACCESS 1
58 
59 // ***************** IA32 CPU features ********************
60 
61 #if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
62 
63 // Apple Clang prior to 5.0 cannot handle SSE2
64 #if defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION < 50000)
65 # define CRYPTOPP_DISABLE_ASM 1
66 #endif
67 
68 // Sun Studio 12.1 provides GCC inline assembly
69 // http://blogs.oracle.com/x86be/entry/gcc_style_asm_inlining_support
70 #if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5100)
71 # define CRYPTOPP_DISABLE_ASM 1
72 #endif
73 
74 // Guard everything in CRYPTOPP_DISABLE_ASM
75 #if !defined(CRYPTOPP_DISABLE_ASM)
76 
77 #if (defined(_MSC_VER) && defined(_M_IX86)) || ((defined(__GNUC__) && (defined(__i386__)) || defined(__x86_64__)))
78  // C++Builder 2010 does not allow "call label" where label is defined within inline assembly
79  #define CRYPTOPP_X86_ASM_AVAILABLE 1
80 
81  #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__))
82  #define CRYPTOPP_SSE2_ASM_AVAILABLE 1
83  #endif
84 
85  #if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1500 || CRYPTOPP_GCC_VERSION >= 40300 || defined(__SSSE3__))
86  #define CRYPTOPP_SSSE3_ASM_AVAILABLE 1
87  #endif
88 #endif
89 
90 #if defined(_MSC_VER) && defined(_M_X64)
91  #define CRYPTOPP_X64_MASM_AVAILABLE 1
92 #endif
93 
94 #if defined(__GNUC__) && defined(__x86_64__)
95  #define CRYPTOPP_X64_ASM_AVAILABLE 1
96 #endif
97 
98 // 32-bit SunCC does not enable SSE2 by default.
99 #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__) || (__SUNPRO_CC >= 0x5100))
100  #define CRYPTOPP_SSE2_INTRIN_AVAILABLE 1
101 #endif
102 
103 #if !defined(CRYPTOPP_DISABLE_SSSE3)
104 # if defined(__SSSE3__) || (_MSC_VER >= 1500) || \
105  (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || (__SUNPRO_CC >= 0x5110) || \
106  (CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000)
107  #define CRYPTOPP_SSSE3_AVAILABLE 1
108 # endif
109 #endif
110 
111 // Intrinsics availible in GCC 4.3 (http://gcc.gnu.org/gcc-4.3/changes.html) and
112 // MSVC 2008 (http://msdn.microsoft.com/en-us/library/bb892950%28v=vs.90%29.aspx)
113 // SunCC could generate SSE4 at 12.1, but the intrinsics are missing until 12.4.
114 #if !defined(CRYPTOPP_DISABLE_SSE4) && defined(CRYPTOPP_SSSE3_AVAILABLE) && \
115  (defined(__SSE4_1__) || (CRYPTOPP_MSC_VERSION >= 1500) || \
116  (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || (__SUNPRO_CC >= 0x5110) || \
117  (CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000))
118  #define CRYPTOPP_SSE41_AVAILABLE 1
119 #endif
120 
121 #if !defined(CRYPTOPP_DISABLE_SSE4) && defined(CRYPTOPP_SSSE3_AVAILABLE) && \
122  (defined(__SSE4_2__) || (CRYPTOPP_MSC_VERSION >= 1500) || (__SUNPRO_CC >= 0x5110) || \
123  (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || \
124  (CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000))
125  #define CRYPTOPP_SSE42_AVAILABLE 1
126 #endif
127 
128 // Couple to CRYPTOPP_DISABLE_AESNI, but use CRYPTOPP_CLMUL_AVAILABLE so we can selectively
129 // disable for misbehaving platofrms and compilers, like Solaris or some Clang.
130 #if defined(CRYPTOPP_DISABLE_AESNI)
131  #define CRYPTOPP_DISABLE_CLMUL 1
132 #endif
133 
134 // Requires Sun Studio 12.3 (SunCC 0x5120) in theory.
135 #if !defined(CRYPTOPP_DISABLE_CLMUL) && defined(CRYPTOPP_SSE42_AVAILABLE) && \
136  (defined(__PCLMUL__) || (_MSC_FULL_VER >= 150030729) || (__SUNPRO_CC >= 0x5120) || \
137  (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1110) || \
138  (CRYPTOPP_LLVM_CLANG_VERSION >= 30200) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300))
139  #define CRYPTOPP_CLMUL_AVAILABLE 1
140 #endif
141 
142 // Requires Sun Studio 12.3 (SunCC 0x5120)
143 #if !defined(CRYPTOPP_DISABLE_AESNI) && defined(CRYPTOPP_SSE42_AVAILABLE) && \
144  (defined(__AES__) || (_MSC_FULL_VER >= 150030729) || (__SUNPRO_CC >= 0x5120) || \
145  (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1110) || \
146  (CRYPTOPP_LLVM_CLANG_VERSION >= 30200) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300))
147  #define CRYPTOPP_AESNI_AVAILABLE 1
148 #endif
149 
150 // Requires Binutils 2.24
151 #if !defined(CRYPTOPP_DISABLE_AVX) && defined(CRYPTOPP_SSE42_AVAILABLE) && \
152  (defined(__AVX2__) || (CRYPTOPP_MSC_VERSION >= 1800) || (__SUNPRO_CC >= 0x5130) || \
153  (CRYPTOPP_GCC_VERSION >= 40700) || (__INTEL_COMPILER >= 1400) || \
154  (CRYPTOPP_LLVM_CLANG_VERSION >= 30100) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40600))
155 #define CRYPTOPP_AVX_AVAILABLE 1
156 #endif
157 
158 // Requires Binutils 2.24
159 #if !defined(CRYPTOPP_DISABLE_AVX2) && defined(CRYPTOPP_AVX_AVAILABLE) && \
160  (defined(__AVX2__) || (CRYPTOPP_MSC_VERSION >= 1800) || (__SUNPRO_CC >= 0x5130) || \
161  (CRYPTOPP_GCC_VERSION >= 40900) || (__INTEL_COMPILER >= 1400) || \
162  (CRYPTOPP_LLVM_CLANG_VERSION >= 30100) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40600))
163 #define CRYPTOPP_AVX2_AVAILABLE 1
164 #endif
165 
166 // Guessing at SHA for SunCC. Its not in Sun Studio 12.6. Also see
167 // http://stackoverflow.com/questions/45872180/which-xarch-for-sha-extensions-on-solaris
168 #if !defined(CRYPTOPP_DISABLE_SHANI) && defined(CRYPTOPP_SSE42_AVAILABLE) && \
169  (defined(__SHA__) || (CRYPTOPP_MSC_VERSION >= 1900) || (__SUNPRO_CC >= 0x5160) || \
170  (CRYPTOPP_GCC_VERSION >= 40900) || (__INTEL_COMPILER >= 1300) || \
171  (CRYPTOPP_LLVM_CLANG_VERSION >= 30400) || (CRYPTOPP_APPLE_CLANG_VERSION >= 50100))
172  #define CRYPTOPP_SHANI_AVAILABLE 1
173 #endif
174 
175 // RDRAND uses byte codes. All we need is x86 ASM for it.
176 // However tie it to AES-NI since SecureKey was available with it.
177 #if !defined(CRYPTOPP_DISABLE_RDRAND) && defined(CRYPTOPP_AESNI_AVAILABLE)
178  #define CRYPTOPP_RDRAND_AVAILABLE 1
179 #endif
180 
181 // RDSEED uses byte codes. All we need is x86 ASM for it.
182 // However tie it to AES-NI since SecureKey was available with it.
183 #if !defined(CRYPTOPP_DISABLE_RDSEED) && defined(CRYPTOPP_AESNI_AVAILABLE)
184  #define CRYPTOPP_RDSEED_AVAILABLE 1
185 #endif
186 
187 // PadlockRNG uses byte codes. All we need is x86 ASM for it.
188 #if !defined(CRYPTOPP_DISABLE_PADLOCK) && \
189  !(defined(__ANDROID__) || defined(ANDROID) || defined(__APPLE__)) && \
190  defined(CRYPTOPP_X86_ASM_AVAILABLE)
191  #define CRYPTOPP_PADLOCK_AVAILABLE 1
192  #define CRYPTOPP_PADLOCK_RNG_AVAILABLE 1
193  #define CRYPTOPP_PADLOCK_ACE_AVAILABLE 1
194  #define CRYPTOPP_PADLOCK_ACE2_AVAILABLE 1
195  #define CRYPTOPP_PADLOCK_PHE_AVAILABLE 1
196  #define CRYPTOPP_PADLOCK_PMM_AVAILABLE 1
197 #endif
198 
199 // Fixup Android and SSE, Crypto. It may be enabled based on compiler version.
200 // Also see https://developer.android.com/ndk/guides/abis
201 #if defined(__ANDROID__) || defined(ANDROID)
202 # if (CRYPTOPP_BOOL_X86)
203 # undef CRYPTOPP_SSE41_AVAILABLE
204 # undef CRYPTOPP_SSE42_AVAILABLE
205 # undef CRYPTOPP_CLMUL_AVAILABLE
206 # undef CRYPTOPP_AESNI_AVAILABLE
207 # undef CRYPTOPP_SHANI_AVAILABLE
208 # undef CRYPTOPP_RDRAND_AVAILABLE
209 # undef CRYPTOPP_RDSEED_AVAILABLE
210 # undef CRYPTOPP_AVX_AVAILABLE
211 # undef CRYPTOPP_AVX2_AVAILABLE
212 # endif
213 # if (CRYPTOPP_BOOL_X64)
214 # undef CRYPTOPP_CLMUL_AVAILABLE
215 # undef CRYPTOPP_AESNI_AVAILABLE
216 # undef CRYPTOPP_SHANI_AVAILABLE
217 # undef CRYPTOPP_RDRAND_AVAILABLE
218 # undef CRYPTOPP_RDSEED_AVAILABLE
219 # undef CRYPTOPP_AVX_AVAILABLE
220 # undef CRYPTOPP_AVX2_AVAILABLE
221 # endif
222 #endif
223 
224 // Fixup for SunCC 12.1-12.4. Bad code generation in AES_Encrypt and friends.
225 #if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5130)
226 # undef CRYPTOPP_AESNI_AVAILABLE
227 #endif
228 
229 // Fixup for SunCC 12.1-12.6. Compiler crash on GCM_Reduce_CLMUL.
230 // http://github.com/weidai11/cryptopp/issues/226
231 #if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5150)
232 # undef CRYPTOPP_CLMUL_AVAILABLE
233 #endif
234 
235 #endif // CRYPTOPP_DISABLE_ASM
236 
237 #endif // X86, X32, X64
238 
239 // ***************** ARM CPU features ********************
240 
241 #if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8)
242 
243 // We don't have an ARM big endian test rig. Disable
244 // ARM-BE ASM and instrinsics until we can test it.
245 #if (CRYPTOPP_BIG_ENDIAN)
246 # define CRYPTOPP_DISABLE_ASM 1
247 #endif
248 
249 // Guard everything in CRYPTOPP_DISABLE_ASM
250 #if !defined(CRYPTOPP_DISABLE_ASM)
251 
252 // Requires ACLE 1.0. -mfpu=neon or above must be present
253 // Requires GCC 4.3, Clang 2.8 or Visual Studio 2012
254 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
255 #if !defined(CRYPTOPP_ARM_NEON_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_NEON)
256 # if defined(__arm__) || defined(__ARM_NEON) || defined(__ARM_FEATURE_NEON) || defined(_M_ARM)
257 # if (CRYPTOPP_GCC_VERSION >= 40300) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20800) || \
258  (CRYPTOPP_MSC_VERSION >= 1700)
259 # define CRYPTOPP_ARM_NEON_AVAILABLE 1
260 # endif // Compilers
261 # endif // Platforms
262 #endif
263 
264 // ARMv8 and ASIMD. -march=armv8-a or above must be present
265 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
266 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
267 #if !defined(CRYPTOPP_ARM_ASIMD_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_ASIMD)
268 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
269 # if defined(__ARM_NEON) || defined(__ARM_FEATURE_NEON) || defined(__ARM_FEATURE_ASIMD) || \
270  (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || \
271  (CRYPTOPP_MSC_VERSION >= 1916)
272 # define CRYPTOPP_ARM_NEON_AVAILABLE 1
273 # define CRYPTOPP_ARM_ASIMD_AVAILABLE 1
274 # endif // Compilers
275 # endif // Platforms
276 #endif
277 
278 // ARMv8 and ASIMD. -march=armv8-a+crc or above must be present
279 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
280 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
281 #if !defined(CRYPTOPP_ARM_CRC32_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_CRC32)
282 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
283 # if defined(__ARM_FEATURE_CRC32) || (CRYPTOPP_GCC_VERSION >= 40800) || \
284  (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_MSC_VERSION >= 1916)
285 # define CRYPTOPP_ARM_CRC32_AVAILABLE 1
286 # endif // Compilers
287 # endif // Platforms
288 #endif
289 
290 // ARMv8 and ASIMD. -march=armv8-a+crypto or above must be present
291 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
292 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
293 #if !defined(CRYPTOPP_ARM_PMULL_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_PMULL)
294 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
295 # if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_GCC_VERSION >= 40800) || \
296  (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_MSC_VERSION >= 1916)
297 # define CRYPTOPP_ARM_PMULL_AVAILABLE 1
298 # endif // Compilers
299 # endif // Platforms
300 #endif
301 
302 // ARMv8 and AES. -march=armv8-a+crypto or above must be present
303 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
304 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
305 #if !defined(CRYPTOPP_ARM_AES_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_AES)
306 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
307 # if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_GCC_VERSION >= 40800) || \
308  (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_MSC_VERSION >= 1916)
309 # define CRYPTOPP_ARM_AES_AVAILABLE 1
310 # endif // Compilers
311 # endif // Platforms
312 #endif
313 
314 // ARMv8 and SHA-1, SHA-256. -march=armv8-a+crypto or above must be present
315 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
316 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
317 #if !defined(CRYPTOPP_ARM_SHA_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_SHA)
318 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
319 # if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_GCC_VERSION >= 40800) || \
320  (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_MSC_VERSION >= 1916)
321 # define CRYPTOPP_ARM_SHA1_AVAILABLE 1
322 # define CRYPTOPP_ARM_SHA2_AVAILABLE 1
323 # endif // Compilers
324 # endif // Platforms
325 #endif
326 
327 // ARMv8 and SHA-512, SHA-3. -march=armv8.4-a+crypto or above must be present
328 // Requires GCC 8.0, Clang ??? or Visual Studio 20??
329 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
330 #if !defined(CRYPTOPP_ARM_SHA3_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_SHA)
331 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
332 # if defined(__ARM_FEATURE_SHA3) || (CRYPTOPP_GCC_VERSION >= 80000)
333 # define CRYPTOPP_ARM_SHA512_AVAILABLE 1
334 # define CRYPTOPP_ARM_SHA3_AVAILABLE 1
335 # endif // Compilers
336 # endif // Platforms
337 #endif
338 
339 // ARMv8 and SM3, SM4. -march=armv8.4-a+crypto or above must be present
340 // Requires GCC 8.0, Clang ??? or Visual Studio 20??
341 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
342 #if !defined(CRYPTOPP_ARM_SM3_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_SM3)
343 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
344 # if defined(__ARM_FEATURE_SM3) || (CRYPTOPP_GCC_VERSION >= 80000)
345 # define CRYPTOPP_ARM_SM3_AVAILABLE 1
346 # define CRYPTOPP_ARM_SM4_AVAILABLE 1
347 # endif // Compilers
348 # endif // Platforms
349 #endif
350 
351 // Limit the <arm_neon.h> include.
352 #if !defined(CRYPTOPP_ARM_NEON_HEADER)
353 # if defined(CRYPTOPP_ARM_NEON_AVAILABLE) || defined (CRYPTOPP_ARM_ASIMD_AVAILABLE)
354 # if !defined(_M_ARM64)
355 # define CRYPTOPP_ARM_NEON_HEADER 1
356 # endif
357 # endif
358 #endif
359 
360 // Limit the <arm_acle.h> include.
361 #if !defined(CRYPTOPP_ARM_ACLE_HEADER)
362 # if defined(__aarch32__) || defined(__aarch64__) || (__ARM_ARCH >= 8) || defined(__ARM_ACLE)
363 # if !defined(__ANDROID__) && !defined(ANDROID) && !defined(__APPLE__)
364 # define CRYPTOPP_ARM_ACLE_HEADER 1
365 # endif
366 # endif
367 #endif
368 
369 // Fixup Apple Clang and PMULL. Apple defines __ARM_FEATURE_CRYPTO for Xcode 6
370 // but does not provide PMULL. TODO: determine when PMULL is available.
371 #if defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION < 70000)
372 # undef CRYPTOPP_ARM_PMULL_AVAILABLE
373 #endif
374 
375 // Disable for Android. Android only offers the base Aarch64 architecture.
376 // Also see https://developer.android.com/ndk/guides/abis
377 #if defined(__ANDROID__) || defined(ANDROID)
378 # undef CRYPTOPP_ARM_CRC32_AVAILABLE
379 # undef CRYPTOPP_ARM_PMULL_AVAILABLE
380 # undef CRYPTOPP_ARM_AES_AVAILABLE
381 # undef CRYPTOPP_ARM_SHA1_AVAILABLE
382 # undef CRYPTOPP_ARM_SHA2_AVAILABLE
383 # undef CRYPTOPP_ARM_SHA3_AVAILABLE
384 # undef CRYPTOPP_ARM_SHA512_AVAILABLE
385 # undef CRYPTOPP_ARM_SM3_AVAILABLE
386 # undef CRYPTOPP_ARM_SM4_AVAILABLE
387 #endif
388 
389 // Cryptogams offers an ARM asm implementations for AES and SHA. Crypto++ does
390 // not provide an asm implementation. The Cryptogams AES implementation is
391 // about 50% faster than C/C++, and SHA implementation is about 30% faster
392 // than C/C++. Define this to use the Cryptogams AES and SHA implementations
393 // on GNU Linux systems. When defined, Crypto++ will use aes_armv4.S,
394 // sha1_armv4.S and sha256_armv4.S. https://www.cryptopp.com/wiki/Cryptogams.
395 #if defined(__arm__) && defined(__linux__)
396 # if defined(__GNUC__) || defined(__clang__)
397 # define CRYPTOGAMS_ARM_AES 1
398 # define CRYPTOGAMS_ARM_SHA1 1
399 # define CRYPTOGAMS_ARM_SHA256 1
400 # define CRYPTOGAMS_ARM_SHA512 1
401 # endif
402 #endif
403 
404 #endif // CRYPTOPP_DISABLE_ASM
405 
406 #endif // ARM32, ARM64
407 
408 // ***************** AltiVec and Power8 ********************
409 
410 #if (CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64)
411 
412 // Guard everything in CRYPTOPP_DISABLE_ASM
413 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_ALTIVEC)
414 
415 // An old Apple G5 with GCC 4.01 has AltiVec, but its only Power4 or so.
416 #if !defined(CRYPTOPP_ALTIVEC_AVAILABLE)
417 # if defined(_ARCH_PWR4) || defined(__ALTIVEC__) || \
418  (CRYPTOPP_XLC_VERSION >= 100000) || (CRYPTOPP_GCC_VERSION >= 40001) || \
419  (CRYPTOPP_LLVM_CLANG_VERSION >= 20900)
420 # define CRYPTOPP_ALTIVEC_AVAILABLE 1
421 # endif
422 #endif
423 
424 #if defined(CRYPTOPP_ALTIVEC_AVAILABLE)
425 
426 // We need Power7 for unaligned loads and stores
427 #if !defined(CRYPTOPP_POWER7_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER7)
428 # if defined(_ARCH_PWR7) || (CRYPTOPP_XLC_VERSION >= 100000) || \
429  (CRYPTOPP_GCC_VERSION >= 40100) || (CRYPTOPP_LLVM_CLANG_VERSION >= 30100)
430 # define CRYPTOPP_POWER7_AVAILABLE 1
431 # endif
432 #endif
433 
434 #if defined(CRYPTOPP_POWER7_AVAILABLE)
435 
436 // We need Power8 for in-core crypto and 64-bit vector types
437 #if !defined(CRYPTOPP_POWER8_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER8)
438 # if defined(_ARCH_PWR8) || (CRYPTOPP_XLC_VERSION >= 130000) || \
439  (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_CLANG_VERSION >= 70000)
440 # define CRYPTOPP_POWER8_AVAILABLE 1
441 # endif
442 #endif
443 
444 #if !defined(CRYPTOPP_POWER8_AES_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER8_AES) && defined(CRYPTOPP_POWER8_AVAILABLE)
445 # if defined(__CRYPTO__) || defined(_ARCH_PWR8) || (CRYPTOPP_XLC_VERSION >= 130000) || \
446  (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_CLANG_VERSION >= 70000)
447 //# define CRYPTOPP_POWER8_CRC_AVAILABLE 1
448 # define CRYPTOPP_POWER8_AES_AVAILABLE 1
449 # define CRYPTOPP_POWER8_VMULL_AVAILABLE 1
450 # define CRYPTOPP_POWER8_SHA_AVAILABLE 1
451 # endif
452 #endif
453 
454 #if defined(CRYPTOPP_POWER8_AVAILABLE)
455 
456 // Power9 for random numbers
457 #if !defined(CRYPTOPP_POWER9_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER9)
458 # if defined(_ARCH_PWR9) || (CRYPTOPP_XLC_VERSION >= 130200) || \
459  (CRYPTOPP_GCC_VERSION >= 70000) || (CRYPTOPP_LLVM_CLANG_VERSION >= 80000)
460 # define CRYPTOPP_POWER9_AVAILABLE 1
461 # endif
462 #endif
463 
464 #endif // CRYPTOPP_POWER8_AVAILABLE
465 #endif // CRYPTOPP_POWER7_AVAILABLE
466 #endif // CRYPTOPP_ALTIVEC_AVAILABLE
467 #endif // CRYPTOPP_DISABLE_ASM
468 #endif // PPC32, PPC64
469 
470 #endif // CRYPTOPP_CONFIG_ASM_H
Library configuration file.
Library configuration file.
Library configuration file.