23#ifndef CRYPTOPP_CONFIG_ASM_H
24#define CRYPTOPP_CONFIG_ASM_H
39#if defined(__native_client__)
40# undef CRYPTOPP_DISABLE_ASM
41# define CRYPTOPP_DISABLE_ASM 1
50#if defined(__clang__) || (defined(__APPLE__) && defined(__GNUC__)) || defined(__SUNPRO_CC)
51# undef CRYPTOPP_DISABLE_MIXED_ASM
52# define CRYPTOPP_DISABLE_MIXED_ASM 1
65#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
68#if defined(CRYPTOPP_APPLE_CLANG_VERSION) && (CRYPTOPP_APPLE_CLANG_VERSION < 50000)
69# define CRYPTOPP_DISABLE_ASM 1
74#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5100)
75# define CRYPTOPP_DISABLE_ASM 1
79#if !defined(CRYPTOPP_DISABLE_ASM)
81#if (defined(_MSC_VER) && defined(_M_IX86)) || ((defined(__GNUC__) && (defined(__i386__)) || defined(__x86_64__)))
83 #define CRYPTOPP_X86_ASM_AVAILABLE 1
85 #if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__))
86 #define CRYPTOPP_SSE2_ASM_AVAILABLE 1
89 #if !defined(CRYPTOPP_DISABLE_SSSE3) && (_MSC_VER >= 1500 || CRYPTOPP_GCC_VERSION >= 40300 || defined(__SSSE3__))
90 #define CRYPTOPP_SSSE3_ASM_AVAILABLE 1
94#if defined(_MSC_VER) && defined(_M_X64)
95 #define CRYPTOPP_X64_MASM_AVAILABLE 1
98#if defined(__GNUC__) && defined(__x86_64__)
99 #define CRYPTOPP_X64_ASM_AVAILABLE 1
103#if !defined(CRYPTOPP_DISABLE_SSE2) && (defined(CRYPTOPP_MSC_VERSION) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__) || (__SUNPRO_CC >= 0x5100))
104 #define CRYPTOPP_SSE2_INTRIN_AVAILABLE 1
107#if !defined(CRYPTOPP_DISABLE_SSSE3)
108# if defined(__SSSE3__) || (CRYPTOPP_MSC_VERSION >= 1500) || \
109 (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || (__SUNPRO_CC >= 0x5110) || \
110 (CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000)
111 #define CRYPTOPP_SSSE3_AVAILABLE 1
118#if !defined(CRYPTOPP_DISABLE_SSE4) && defined(CRYPTOPP_SSSE3_AVAILABLE) && \
119 (defined(__SSE4_1__) || (CRYPTOPP_MSC_VERSION >= 1500) || \
120 (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || (__SUNPRO_CC >= 0x5110) || \
121 (CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000))
122 #define CRYPTOPP_SSE41_AVAILABLE 1
125#if !defined(CRYPTOPP_DISABLE_SSE4) && defined(CRYPTOPP_SSSE3_AVAILABLE) && \
126 (defined(__SSE4_2__) || (CRYPTOPP_MSC_VERSION >= 1500) || (__SUNPRO_CC >= 0x5110) || \
127 (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1000) || \
128 (CRYPTOPP_LLVM_CLANG_VERSION >= 20300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000))
129 #define CRYPTOPP_SSE42_AVAILABLE 1
134#if defined(CRYPTOPP_DISABLE_AESNI)
135 #define CRYPTOPP_DISABLE_CLMUL 1
139#if !defined(CRYPTOPP_DISABLE_CLMUL) && defined(CRYPTOPP_SSE42_AVAILABLE) && \
140 (defined(__PCLMUL__) || (_MSC_FULL_VER >= 150030729) || (__SUNPRO_CC >= 0x5120) || \
141 (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1110) || \
142 (CRYPTOPP_LLVM_CLANG_VERSION >= 30200) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300))
143 #define CRYPTOPP_CLMUL_AVAILABLE 1
147#if !defined(CRYPTOPP_DISABLE_AESNI) && defined(CRYPTOPP_SSE42_AVAILABLE) && \
148 (defined(__AES__) || (_MSC_FULL_VER >= 150030729) || (__SUNPRO_CC >= 0x5120) || \
149 (CRYPTOPP_GCC_VERSION >= 40300) || (__INTEL_COMPILER >= 1110) || \
150 (CRYPTOPP_LLVM_CLANG_VERSION >= 30200) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300))
151 #define CRYPTOPP_AESNI_AVAILABLE 1
155#if !defined(CRYPTOPP_DISABLE_AVX) && defined(CRYPTOPP_SSE42_AVAILABLE) && \
156 (defined(__AVX2__) || (CRYPTOPP_MSC_VERSION >= 1800) || (__SUNPRO_CC >= 0x5130) || \
157 (CRYPTOPP_GCC_VERSION >= 40700) || (__INTEL_COMPILER >= 1400) || \
158 (CRYPTOPP_LLVM_CLANG_VERSION >= 30100) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40600))
159#define CRYPTOPP_AVX_AVAILABLE 1
163#if !defined(CRYPTOPP_DISABLE_AVX2) && defined(CRYPTOPP_AVX_AVAILABLE) && \
164 (defined(__AVX2__) || (CRYPTOPP_MSC_VERSION >= 1800) || (__SUNPRO_CC >= 0x5130) || \
165 (CRYPTOPP_GCC_VERSION >= 40900) || (__INTEL_COMPILER >= 1400) || \
166 (CRYPTOPP_LLVM_CLANG_VERSION >= 30100) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40600))
167#define CRYPTOPP_AVX2_AVAILABLE 1
174#if !defined(CRYPTOPP_DISABLE_SHANI) && defined(CRYPTOPP_SSE42_AVAILABLE) && \
175 (defined(__SHA__) || (CRYPTOPP_MSC_VERSION >= 1900) || (__SUNPRO_CC >= 0x5160) || \
176 (CRYPTOPP_GCC_VERSION >= 40900) || (__INTEL_COMPILER >= 1600) || \
177 (CRYPTOPP_LLVM_CLANG_VERSION >= 30400) || (CRYPTOPP_APPLE_CLANG_VERSION >= 50100))
178 #define CRYPTOPP_SHANI_AVAILABLE 1
183#if !defined(CRYPTOPP_DISABLE_RDRAND) && defined(CRYPTOPP_AESNI_AVAILABLE)
184 #define CRYPTOPP_RDRAND_AVAILABLE 1
189#if !defined(CRYPTOPP_DISABLE_RDSEED) && defined(CRYPTOPP_AESNI_AVAILABLE)
190 #define CRYPTOPP_RDSEED_AVAILABLE 1
194#if !defined(CRYPTOPP_DISABLE_PADLOCK) && \
195 !(defined(__ANDROID__) || defined(ANDROID) || defined(__APPLE__)) && \
196 defined(CRYPTOPP_X86_ASM_AVAILABLE)
197 #define CRYPTOPP_PADLOCK_AVAILABLE 1
198 #define CRYPTOPP_PADLOCK_RNG_AVAILABLE 1
199 #define CRYPTOPP_PADLOCK_ACE_AVAILABLE 1
200 #define CRYPTOPP_PADLOCK_ACE2_AVAILABLE 1
201 #define CRYPTOPP_PADLOCK_PHE_AVAILABLE 1
202 #define CRYPTOPP_PADLOCK_PMM_AVAILABLE 1
206#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5130)
207# undef CRYPTOPP_AESNI_AVAILABLE
212#if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x5150)
213# undef CRYPTOPP_CLMUL_AVAILABLE
217#define M128_CAST(x) ((__m128i *)(void *)(x))
218#define CONST_M128_CAST(x) ((const __m128i *)(const void *)(x))
219#define M256_CAST(x) ((__m256i *)(void *)(x))
220#define CONST_M256_CAST(x) ((const __m256i *)(const void *)(x))
228#if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8)
232#if (CRYPTOPP_BIG_ENDIAN)
233# define CRYPTOPP_DISABLE_ASM 1
237#if !defined(CRYPTOPP_DISABLE_ASM)
242#if !defined(CRYPTOPP_ARM_NEON_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_NEON)
243# if defined(__arm__) || defined(__ARM_NEON) || defined(__ARM_FEATURE_NEON) || defined(_M_ARM)
244# if (CRYPTOPP_GCC_VERSION >= 40300) || (CRYPTOPP_LLVM_CLANG_VERSION >= 20800) || \
245 (CRYPTOPP_APPLE_CLANG_VERSION >= 30200) || (CRYPTOPP_MSC_VERSION >= 1700)
246# define CRYPTOPP_ARM_NEON_AVAILABLE 1
254#if !defined(CRYPTOPP_ARM_ASIMD_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_ASIMD)
255# if defined(__aarch32__) || defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64)
256# if defined(__ARM_NEON) || defined(__ARM_ASIMD) || defined(__ARM_FEATURE_NEON) || defined(__ARM_FEATURE_ASIMD) || \
257 (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || \
258 (CRYPTOPP_APPLE_CLANG_VERSION >= 40000) || (CRYPTOPP_MSC_VERSION >= 1916)
259# define CRYPTOPP_ARM_NEON_AVAILABLE 1
260# define CRYPTOPP_ARM_ASIMD_AVAILABLE 1
267#if !defined(CRYPTOPP_ARM_CRC32_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_CRC32)
268# if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
269# if defined(__ARM_FEATURE_CRC32) || (CRYPTOPP_GCC_VERSION >= 40800) || \
270 (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300) || \
271 (CRYPTOPP_MSC_VERSION >= 1916)
272# define CRYPTOPP_ARM_CRC32_AVAILABLE 1
279#if !defined(CRYPTOPP_ARM_AES_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_AES)
280# if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
281# if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_GCC_VERSION >= 40800) || \
282 (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300) || \
283 (CRYPTOPP_MSC_VERSION >= 1916)
284# define CRYPTOPP_ARM_AES_AVAILABLE 1
291#if !defined(CRYPTOPP_ARM_PMULL_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_PMULL)
292# if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
293# if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_GCC_VERSION >= 40800) || \
294 (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300) || \
295 (CRYPTOPP_MSC_VERSION >= 1916)
296# define CRYPTOPP_ARM_PMULL_AVAILABLE 1
303#if !defined(CRYPTOPP_ARM_SHA_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_SHA)
304# if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
305# if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_GCC_VERSION >= 40800) || \
306 (CRYPTOPP_LLVM_CLANG_VERSION >= 30300) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40300) || \
307 (CRYPTOPP_MSC_VERSION >= 1916)
308# define CRYPTOPP_ARM_SHA1_AVAILABLE 1
309# define CRYPTOPP_ARM_SHA2_AVAILABLE 1
315#if defined(CRYPTOPP_MSC_VERSION)
316# undef CRYPTOPP_ARM_SHA1_AVAILABLE
317# undef CRYPTOPP_ARM_SHA2_AVAILABLE
322#if !defined(CRYPTOPP_ARM_SHA3_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_SHA)
323# if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
324# if defined(__ARM_FEATURE_SHA3) || (CRYPTOPP_GCC_VERSION >= 80000) || \
325 (CRYPTOPP_APPLE_CLANG_VERSION >= 120000) || (CRYPTOPP_LLVM_CLANG_VERSION >= 110000)
326# define CRYPTOPP_ARM_SHA512_AVAILABLE 1
327# define CRYPTOPP_ARM_SHA3_AVAILABLE 1
335#if !defined(CRYPTOPP_ARM_SM3_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ARM_SM3)
336# if defined(__aarch32__) || defined(__aarch64__) || defined(_M_ARM64)
337# if defined(__ARM_FEATURE_SM3) || (CRYPTOPP_GCC_VERSION >= 80000)
338# define CRYPTOPP_ARM_SM3_AVAILABLE 1
339# define CRYPTOPP_ARM_SM4_AVAILABLE 1
345#if !defined(CRYPTOPP_ARM_NEON_HEADER)
346# if defined(CRYPTOPP_ARM_NEON_AVAILABLE) || defined (CRYPTOPP_ARM_ASIMD_AVAILABLE)
347# if !defined(_M_ARM64)
348# define CRYPTOPP_ARM_NEON_HEADER 1
354#if !defined(CRYPTOPP_ARM_ACLE_HEADER)
355# if defined(__aarch32__) || defined(__aarch64__) || (__ARM_ARCH >= 8) || defined(__ARM_ACLE)
356# define CRYPTOPP_ARM_ACLE_HEADER 1
364#if defined(__APPLE__) && !defined(__ARM_FEATURE_CRC32)
365# undef CRYPTOPP_ARM_ACLE_HEADER
374#if !defined(CRYPTOPP_DISABLE_ARM_NEON)
375# if defined(__arm__) && defined(__linux__)
376# if defined(__GNUC__) || defined(__clang__)
377# define CRYPTOGAMS_ARM_AES 1
378# define CRYPTOGAMS_ARM_SHA1 1
379# define CRYPTOGAMS_ARM_SHA256 1
380# define CRYPTOGAMS_ARM_SHA512 1
387#undef CRYPTOGAMS_ARM_AES
390#define UINT64_CAST(x) ((uint64_t *)(void *)(x))
391#define CONST_UINT64_CAST(x) ((const uint64_t *)(const void *)(x))
399#if (CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64)
402#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_ALTIVEC)
405#if !defined(CRYPTOPP_ALTIVEC_AVAILABLE)
406# if defined(_ARCH_PWR4) || defined(__ALTIVEC__) || \
407 (CRYPTOPP_XLC_VERSION >= 100000) || (CRYPTOPP_GCC_VERSION >= 40001) || \
408 (CRYPTOPP_LLVM_CLANG_VERSION >= 20900)
409# define CRYPTOPP_ALTIVEC_AVAILABLE 1
413#if defined(CRYPTOPP_ALTIVEC_AVAILABLE)
416#if !defined(CRYPTOPP_POWER7_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER7)
417# if defined(_ARCH_PWR7) || (CRYPTOPP_XLC_VERSION >= 100000) || \
418 (CRYPTOPP_GCC_VERSION >= 40100) || (CRYPTOPP_LLVM_CLANG_VERSION >= 30100)
419# define CRYPTOPP_POWER7_AVAILABLE 1
423#if defined(CRYPTOPP_POWER7_AVAILABLE)
426#if !defined(CRYPTOPP_POWER8_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER8)
427# if defined(_ARCH_PWR8) || (CRYPTOPP_XLC_VERSION >= 130000) || \
428 (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_CLANG_VERSION >= 70000)
429# define CRYPTOPP_POWER8_AVAILABLE 1
433#if !defined(CRYPTOPP_POWER8_AES_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER8_AES) && defined(CRYPTOPP_POWER8_AVAILABLE)
434# if defined(__CRYPTO__) || defined(_ARCH_PWR8) || (CRYPTOPP_XLC_VERSION >= 130000) || \
435 (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_CLANG_VERSION >= 70000)
437# define CRYPTOPP_POWER8_AES_AVAILABLE 1
438# define CRYPTOPP_POWER8_VMULL_AVAILABLE 1
439# define CRYPTOPP_POWER8_SHA_AVAILABLE 1
443#if defined(CRYPTOPP_POWER8_AVAILABLE)
446#if !defined(CRYPTOPP_POWER9_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER9)
447# if defined(_ARCH_PWR9) || (CRYPTOPP_XLC_VERSION >= 130200) || \
448 (CRYPTOPP_GCC_VERSION >= 70000) || (CRYPTOPP_LLVM_CLANG_VERSION >= 80000)
449# define CRYPTOPP_POWER9_AVAILABLE 1
460#if defined(CRYPTOPP_DISABLE_ANDROID_ADVANCED_ISA)
461# if defined(__ANDROID__) || defined(ANDROID)
462# if (CRYPTOPP_BOOL_X86)
463# undef CRYPTOPP_SSE41_AVAILABLE
464# undef CRYPTOPP_SSE42_AVAILABLE
465# undef CRYPTOPP_CLMUL_AVAILABLE
466# undef CRYPTOPP_AESNI_AVAILABLE
467# undef CRYPTOPP_SHANI_AVAILABLE
468# undef CRYPTOPP_RDRAND_AVAILABLE
469# undef CRYPTOPP_RDSEED_AVAILABLE
470# undef CRYPTOPP_AVX_AVAILABLE
471# undef CRYPTOPP_AVX2_AVAILABLE
473# if (CRYPTOPP_BOOL_X64)
474# undef CRYPTOPP_CLMUL_AVAILABLE
475# undef CRYPTOPP_AESNI_AVAILABLE
476# undef CRYPTOPP_SHANI_AVAILABLE
477# undef CRYPTOPP_RDRAND_AVAILABLE
478# undef CRYPTOPP_RDSEED_AVAILABLE
479# undef CRYPTOPP_AVX_AVAILABLE
480# undef CRYPTOPP_AVX2_AVAILABLE
482# if (CRYPTOPP_BOOL_ARMV8)
483# undef CRYPTOPP_ARM_CRC32_AVAILABLE
484# undef CRYPTOPP_ARM_PMULL_AVAILABLE
485# undef CRYPTOPP_ARM_AES_AVAILABLE
486# undef CRYPTOPP_ARM_SHA1_AVAILABLE
487# undef CRYPTOPP_ARM_SHA2_AVAILABLE
Library configuration file.
Library configuration file.
Library configuration file.