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