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(_MSC_VER) || 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__) || (_MSC_VER >= 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
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
386#define UINT64_CAST(x) ((uint64_t *)(void *)(x))
387#define CONST_UINT64_CAST(x) ((const uint64_t *)(const void *)(x))
395#if (CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64)
398#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(CRYPTOPP_DISABLE_ALTIVEC)
401#if !defined(CRYPTOPP_ALTIVEC_AVAILABLE)
402# if defined(_ARCH_PWR4) || defined(__ALTIVEC__) || \
403 (CRYPTOPP_XLC_VERSION >= 100000) || (CRYPTOPP_GCC_VERSION >= 40001) || \
404 (CRYPTOPP_LLVM_CLANG_VERSION >= 20900)
405# define CRYPTOPP_ALTIVEC_AVAILABLE 1
409#if defined(CRYPTOPP_ALTIVEC_AVAILABLE)
412#if !defined(CRYPTOPP_POWER7_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER7)
413# if defined(_ARCH_PWR7) || (CRYPTOPP_XLC_VERSION >= 100000) || \
414 (CRYPTOPP_GCC_VERSION >= 40100) || (CRYPTOPP_LLVM_CLANG_VERSION >= 30100)
415# define CRYPTOPP_POWER7_AVAILABLE 1
419#if defined(CRYPTOPP_POWER7_AVAILABLE)
422#if !defined(CRYPTOPP_POWER8_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER8)
423# if defined(_ARCH_PWR8) || (CRYPTOPP_XLC_VERSION >= 130000) || \
424 (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_CLANG_VERSION >= 70000)
425# define CRYPTOPP_POWER8_AVAILABLE 1
429#if !defined(CRYPTOPP_POWER8_AES_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER8_AES) && defined(CRYPTOPP_POWER8_AVAILABLE)
430# if defined(__CRYPTO__) || defined(_ARCH_PWR8) || (CRYPTOPP_XLC_VERSION >= 130000) || \
431 (CRYPTOPP_GCC_VERSION >= 40800) || (CRYPTOPP_LLVM_CLANG_VERSION >= 70000)
433# define CRYPTOPP_POWER8_AES_AVAILABLE 1
434# define CRYPTOPP_POWER8_VMULL_AVAILABLE 1
435# define CRYPTOPP_POWER8_SHA_AVAILABLE 1
439#if defined(CRYPTOPP_POWER8_AVAILABLE)
442#if !defined(CRYPTOPP_POWER9_AVAILABLE) && !defined(CRYPTOPP_DISABLE_POWER9)
443# if defined(_ARCH_PWR9) || (CRYPTOPP_XLC_VERSION >= 130200) || \
444 (CRYPTOPP_GCC_VERSION >= 70000) || (CRYPTOPP_LLVM_CLANG_VERSION >= 80000)
445# define CRYPTOPP_POWER9_AVAILABLE 1
456#if defined(CRYPTOPP_DISABLE_ANDROID_ADVANCED_ISA)
457# if defined(__ANDROID__) || defined(ANDROID)
458# if (CRYPTOPP_BOOL_X86)
459# undef CRYPTOPP_SSE41_AVAILABLE
460# undef CRYPTOPP_SSE42_AVAILABLE
461# undef CRYPTOPP_CLMUL_AVAILABLE
462# undef CRYPTOPP_AESNI_AVAILABLE
463# undef CRYPTOPP_SHANI_AVAILABLE
464# undef CRYPTOPP_RDRAND_AVAILABLE
465# undef CRYPTOPP_RDSEED_AVAILABLE
466# undef CRYPTOPP_AVX_AVAILABLE
467# undef CRYPTOPP_AVX2_AVAILABLE
469# if (CRYPTOPP_BOOL_X64)
470# undef CRYPTOPP_CLMUL_AVAILABLE
471# undef CRYPTOPP_AESNI_AVAILABLE
472# undef CRYPTOPP_SHANI_AVAILABLE
473# undef CRYPTOPP_RDRAND_AVAILABLE
474# undef CRYPTOPP_RDSEED_AVAILABLE
475# undef CRYPTOPP_AVX_AVAILABLE
476# undef CRYPTOPP_AVX2_AVAILABLE
478# if (CRYPTOPP_BOOL_ARMV8)
479# undef CRYPTOPP_ARM_CRC32_AVAILABLE
480# undef CRYPTOPP_ARM_PMULL_AVAILABLE
481# undef CRYPTOPP_ARM_AES_AVAILABLE
482# undef CRYPTOPP_ARM_SHA1_AVAILABLE
483# undef CRYPTOPP_ARM_SHA2_AVAILABLE
Library configuration file.
Library configuration file.
Library configuration file.