Crypto++  8.3
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__)
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 #if defined(__ANDROID__) || defined(ANDROID)
201 # if (CRYPTOPP_BOOL_X86)
202 # undef CRYPTOPP_SSE41_AVAILABLE
203 # undef CRYPTOPP_SSE42_AVAILABLE
204 # undef CRYPTOPP_CLMUL_AVAILABLE
205 # undef CRYPTOPP_AESNI_AVAILABLE
206 # undef CRYPTOPP_SHANI_AVAILABLE
207 # undef CRYPTOPP_RDRAND_AVAILABLE
208 # undef CRYPTOPP_RDSEED_AVAILABLE
209 # undef CRYPTOPP_AVX_AVAILABLE
210 # undef CRYPTOPP_AVX2_AVAILABLE
211 # endif
212 # if (CRYPTOPP_BOOL_X64)
213 # undef CRYPTOPP_CLMUL_AVAILABLE
214 # undef CRYPTOPP_AESNI_AVAILABLE
215 # undef CRYPTOPP_SHANI_AVAILABLE
216 # undef CRYPTOPP_RDRAND_AVAILABLE
217 # undef CRYPTOPP_RDSEED_AVAILABLE
218 # undef CRYPTOPP_AVX_AVAILABLE
219 # undef CRYPTOPP_AVX2_AVAILABLE
220 # endif
221 #endif
222 
223 // Fixup for SunCC 12.1-12.4. Bad code generation in AES_Encrypt and friends.
224 #if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5130)
225 # undef CRYPTOPP_AESNI_AVAILABLE
226 #endif
227 
228 // Fixup for SunCC 12.1-12.6. Compiler crash on GCM_Reduce_CLMUL.
229 // http://github.com/weidai11/cryptopp/issues/226
230 #if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5150)
231 # undef CRYPTOPP_CLMUL_AVAILABLE
232 #endif
233 
234 #endif // CRYPTOPP_DISABLE_ASM
235 
236 #endif // X86, X32, X64
237 
238 // ***************** ARM CPU features ********************
239 
240 #if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8)
241 
242 // We don't have an ARM big endian test rig. Disable
243 // ARM-BE ASM and instrinsics until we can test it.
244 #if (CRYPTOPP_BIG_ENDIAN)
245 # define CRYPTOPP_DISABLE_ASM 1
246 #endif
247 
248 // Guard everything in CRYPTOPP_DISABLE_ASM
249 #if !defined(CRYPTOPP_DISABLE_ASM)
250 
251 // Requires ACLE 1.0. -mfpu=neon or above must be present
252 // Requires GCC 4.3, Clang 2.8 or Visual Studio 2012
253 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
254 #if !defined(CRYPTOPP_ARM_NEON_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_NEON)
255 # if defined(__arm__) || defined(__ARM_NEON) || defined(__ARM_FEATURE_NEON) || defined(_M_ARM)
256 # if (CRYPTOPP_GCC_VERSION >= 40300) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20800) || \
257  (CRYPTOPP_MSC_VERSION >= 1700)
258 # define CRYPTOPP_ARM_NEON_AVAILABLE 1
259 # endif // Compilers
260 # endif // Platforms
261 #endif
262 
263 // ARMv8 and ASIMD. -march=armv8-a or above must be present
264 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
265 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
266 #if !defined(CRYPTOPP_ARM_ASIMD_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_ASIMD)
267 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
268 # if defined(__ARM_NEON) || defined(__ARM_FEATURE_NEON) || defined(__ARM_FEATURE_ASIMD) || \
269  (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || \
270  (CRYPTOPP_MSC_VERSION >= 1916)
271 # define CRYPTOPP_ARM_NEON_AVAILABLE 1
272 # define CRYPTOPP_ARM_ASIMD_AVAILABLE 1
273 # endif // Compilers
274 # endif // Platforms
275 #endif
276 
277 // ARMv8 and ASIMD. -march=armv8-a+crc or above must be present
278 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
279 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
280 #if !defined(CRYPTOPP_ARM_CRC32_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_CRC32)
281 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
282 # if defined(__ARM_FEATURE_CRC32) || (CRYPTOPP_GCC_VERSION >= 40800) || \
283  (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_MSC_VERSION >= 1916)
284 # define CRYPTOPP_ARM_CRC32_AVAILABLE 1
285 # endif // Compilers
286 # endif // Platforms
287 #endif
288 
289 // ARMv8 and ASIMD. -march=armv8-a+crypto or above must be present
290 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
291 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
292 #if !defined(CRYPTOPP_ARM_PMULL_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_PMULL)
293 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
294 # if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_GCC_VERSION >= 40800) || \
295  (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_MSC_VERSION >= 1916)
296 # define CRYPTOPP_ARM_PMULL_AVAILABLE 1
297 # endif // Compilers
298 # endif // Platforms
299 #endif
300 
301 // ARMv8 and AES. -march=armv8-a+crypto or above must be present
302 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
303 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
304 #if !defined(CRYPTOPP_ARM_AES_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_AES)
305 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
306 # if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_GCC_VERSION >= 40800) || \
307  (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_MSC_VERSION >= 1916)
308 # define CRYPTOPP_ARM_AES_AVAILABLE 1
309 # endif // Compilers
310 # endif // Platforms
311 #endif
312 
313 // ARMv8 and SHA-1, SHA-256. -march=armv8-a+crypto or above must be present
314 // Requires GCC 4.8, Clang 3.3 or Visual Studio 2017
315 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
316 #if !defined(CRYPTOPP_ARM_SHA_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_SHA)
317 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
318 # if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_GCC_VERSION >= 40800) || \
319  (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_MSC_VERSION >= 1916)
320 # define CRYPTOPP_ARM_SHA1_AVAILABLE 1
321 # define CRYPTOPP_ARM_SHA2_AVAILABLE 1
322 # endif // Compilers
323 # endif // Platforms
324 #endif
325 
326 // ARMv8 and SHA-512, SHA-3. -march=armv8.4-a+crypto or above must be present
327 // Requires GCC 8.0, Clang ??? or Visual Studio 20??
328 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
329 #if !defined(CRYPTOPP_ARM_SHA3_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_SHA)
330 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
331 # if defined(__ARM_FEATURE_SHA3) || (CRYPTOPP_GCC_VERSION >= 80000)
332 # define CRYPTOPP_ARM_SHA512_AVAILABLE 1
333 # define CRYPTOPP_ARM_SHA3_AVAILABLE 1
334 # endif // Compilers
335 # endif // Platforms
336 #endif
337 
338 // ARMv8 and SM3, SM4. -march=armv8.4-a+crypto or above must be present
339 // Requires GCC 8.0, Clang ??? or Visual Studio 20??
340 // Do not use APPLE_CLANG_VERSION; use __ARM_FEATURE_XXX instead.
341 #if !defined(CRYPTOPP_ARM_SM3_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_SM3)
342 # if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
343 # if defined(__ARM_FEATURE_SM3) || (CRYPTOPP_GCC_VERSION >= 80000)
344 # define CRYPTOPP_ARM_SM3_AVAILABLE 1
345 # define CRYPTOPP_ARM_SM4_AVAILABLE 1
346 # endif // Compilers
347 # endif // Platforms
348 #endif
349 
350 // Limit the <arm_neon.h> include.
351 #if !defined(CRYPTOPP_ARM_NEON_HEADER)
352 # if defined(CRYPTOPP_ARM_NEON_AVAILABLE) || defined (CRYPTOPP_ARM_ASIMD_AVAILABLE)
353 # if !defined(_M_ARM64)
354 # define CRYPTOPP_ARM_NEON_HEADER 1
355 # endif
356 # endif
357 #endif
358 
359 // Limit the <arm_acle.h> include.
360 #if !defined(CRYPTOPP_ARM_ACLE_HEADER)
361 # if defined(__aarch32__) || defined(__aarch64__) || (__ARM_ARCH >= 8) || defined(__ARM_ACLE)
362 # if !defined(__ANDROID__) && !defined(ANDROID) && !defined(__APPLE__)
363 # define CRYPTOPP_ARM_ACLE_HEADER 1
364 # endif
365 # endif
366 #endif
367 
368 // Fixup Apple Clang and PMULL. Apple defines __ARM_FEATURE_CRYPTO for Xcode 6
369 // but does not provide PMULL. TODO: determine when PMULL is available.
370 #if defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION < 70000)
371 # undef CRYPTOPP_ARM_PMULL_AVAILABLE
372 #endif
373 
374 // Disable for Android. Android only offers the base Aarch64 architecture.
375 // https://developer.android.com/ndk/guides/abis
376 #if defined(__ANDROID__) || defined(ANDROID)
377 # undef CRYPTOPP_ARM_CRC32_AVAILABLE
378 # undef CRYPTOPP_ARM_PMULL_AVAILABLE
379 # undef CRYPTOPP_ARM_AES_AVAILABLE
380 # undef CRYPTOPP_ARM_SHA1_AVAILABLE
381 # undef CRYPTOPP_ARM_SHA2_AVAILABLE
382 # undef CRYPTOPP_ARM_SHA3_AVAILABLE
383 # undef CRYPTOPP_ARM_SHA512_AVAILABLE
384 # undef CRYPTOPP_ARM_SM3_AVAILABLE
385 # undef CRYPTOPP_ARM_SM4_AVAILABLE
386 #endif
387 
388 // Cryptogams offers an ARM asm implementations for AES and SHA. Crypto++ does
389 // not provide an asm implementation. The Cryptogams AES implementation is
390 // about 50% faster than C/C++, and SHA implementation is about 30% faster
391 // than C/C++. Define this to use the Cryptogams AES and SHA implementations
392 // on GNU Linux systems. When defined, Crypto++ will use aes_armv4.S,
393 // sha1_armv4.S and sha256_armv4.S. https://www.cryptopp.com/wiki/Cryptogams.
394 #if defined(__arm__) && defined(__linux__)
395 # if defined(__GNUC__) || defined(__clang__)
396 # define CRYPTOGAMS_ARM_AES 1
397 # define CRYPTOGAMS_ARM_SHA1 1
398 # define CRYPTOGAMS_ARM_SHA256 1
399 # define CRYPTOGAMS_ARM_SHA512 1
400 # endif
401 #endif
402 
403 #endif // CRYPTOPP_DISABLE_ASM
404 
405 #endif // ARM32, ARM64
406 
407 // ***************** AltiVec and Power8 ********************
408 
409 #if (CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64)
410 
411 // Guard everything in CRYPTOPP_DISABLE_ASM
412 #if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_ALTIVEC)
413 
414 // An old Apple G5 with GCC 4.01 has AltiVec, but its only Power4 or so.
415 #if !defined(CRYPTOPP_ALTIVEC_AVAILABLE)
416 # if defined(_ARCH_PWR4) || defined(__ALTIVEC__) || \
417  (CRYPTOPP_XLC_VERSION >= 100000) || (CRYPTOPP_GCC_VERSION >= 40001) || \
418  (CRYPTOPP_LLVM_CLANG_VERSION >= 20900)
419 # define CRYPTOPP_ALTIVEC_AVAILABLE 1
420 # endif
421 #endif
422 
423 #if defined(CRYPTOPP_ALTIVEC_AVAILABLE)
424 
425 // We need Power7 for unaligned loads and stores
426 #if !defined(CRYPTOPP_POWER7_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER7)
427 # if defined(_ARCH_PWR7) || (CRYPTOPP_XLC_VERSION >= 100000) || \
428  (CRYPTOPP_GCC_VERSION >= 40100) || (CRYPTOPP_LLVM_CLANG_VERSION >= 30100)
429 # define CRYPTOPP_POWER7_AVAILABLE 1
430 # endif
431 #endif
432 
433 #if defined(CRYPTOPP_POWER7_AVAILABLE)
434 
435 // We need Power8 for in-core crypto and 64-bit vector types
436 #if !defined(CRYPTOPP_POWER8_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER8)
437 # if defined(_ARCH_PWR8) || (CRYPTOPP_XLC_VERSION >= 130000) || \
438  (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_CLANG_VERSION >= 70000)
439 # define CRYPTOPP_POWER8_AVAILABLE 1
440 # endif
441 #endif
442 
443 #if !defined(CRYPTOPP_POWER8_AES_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER8_AES) && defined(CRYPTOPP_POWER8_AVAILABLE)
444 # if defined(__CRYPTO__) || defined(_ARCH_PWR8) || (CRYPTOPP_XLC_VERSION >= 130000) || \
445  (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_CLANG_VERSION >= 70000)
446 //# define CRYPTOPP_POWER8_CRC_AVAILABLE 1
447 # define CRYPTOPP_POWER8_AES_AVAILABLE 1
448 # define CRYPTOPP_POWER8_VMULL_AVAILABLE 1
449 # define CRYPTOPP_POWER8_SHA_AVAILABLE 1
450 # endif
451 #endif
452 
453 #if defined(CRYPTOPP_POWER8_AVAILABLE)
454 
455 // Power9 for random numbers
456 #if !defined(CRYPTOPP_POWER9_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER9)
457 # if defined(_ARCH_PWR9) || (CRYPTOPP_XLC_VERSION >= 130200) || \
458  (CRYPTOPP_GCC_VERSION >= 70000) || (CRYPTOPP_LLVM_CLANG_VERSION >= 80000)
459 # define CRYPTOPP_POWER9_AVAILABLE 1
460 # endif
461 #endif
462 
463 #endif // CRYPTOPP_POWER8_AVAILABLE
464 #endif // CRYPTOPP_POWER7_AVAILABLE
465 #endif // CRYPTOPP_ALTIVEC_AVAILABLE
466 #endif // CRYPTOPP_DISABLE_ASM
467 #endif // PPC32, PPC64
468 
469 #endif // CRYPTOPP_CONFIG_ASM_H
Library configuration file.
Library configuration file.
Library configuration file.