36#if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
37# pragma GCC diagnostic push
38# pragma GCC diagnostic ignored "-Wconversion"
39# pragma GCC diagnostic ignored "-Wsign-conversion"
43#if defined(CRYPTOPP_LLVM_CLANG_VERSION) || defined(CRYPTOPP_APPLE_CLANG_VERSION)
45 #define INTEL_PREFIX ".intel_syntax;"
46 #define INTEL_NOPREFIX ".intel_syntax;"
47 #define ATT_PREFIX ".att_syntax;"
48 #define ATT_NOPREFIX ".att_syntax;"
49#elif defined(__GNUC__)
51 #define INTEL_PREFIX ".intel_syntax prefix;"
52 #define INTEL_NOPREFIX ".intel_syntax noprefix;"
53 #define ATT_PREFIX ".att_syntax prefix;"
54 #define ATT_NOPREFIX ".att_syntax noprefix;"
58 #define INTEL_NOPREFIX
64#define PERCENT_PASTE(x) "%" #x
65#define PERCENT_REG(x) PERCENT_PASTE(x)
67#ifdef CRYPTOPP_GENERATE_X64_MASM
69#define CRYPTOPP_X86_ASM_AVAILABLE
70#define CRYPTOPP_BOOL_X64 1
71#define CRYPTOPP_SSE2_ASM_AVAILABLE 1
80#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || CRYPTOPP_DOXYGEN_PROCESSING
82#define CRYPTOPP_CPUID_AVAILABLE 1
85#ifndef CRYPTOPP_DOXYGEN_PROCESSING
87extern CRYPTOPP_DLL
bool g_x86DetectionDone;
88extern CRYPTOPP_DLL
bool g_hasSSE2;
89extern CRYPTOPP_DLL
bool g_hasSSSE3;
90extern CRYPTOPP_DLL
bool g_hasSSE41;
91extern CRYPTOPP_DLL
bool g_hasSSE42;
92extern CRYPTOPP_DLL
bool g_hasMOVBE;
93extern CRYPTOPP_DLL
bool g_hasAESNI;
94extern CRYPTOPP_DLL
bool g_hasCLMUL;
95extern CRYPTOPP_DLL
bool g_hasAVX;
96extern CRYPTOPP_DLL
bool g_hasAVX2;
97extern CRYPTOPP_DLL
bool g_hasSHA;
98extern CRYPTOPP_DLL
bool g_hasADX;
99extern CRYPTOPP_DLL
bool g_isP4;
100extern CRYPTOPP_DLL
bool g_hasRDRAND;
101extern CRYPTOPP_DLL
bool g_hasRDSEED;
102extern CRYPTOPP_DLL
bool g_hasPadlockRNG;
103extern CRYPTOPP_DLL
bool g_hasPadlockACE;
104extern CRYPTOPP_DLL
bool g_hasPadlockACE2;
105extern CRYPTOPP_DLL
bool g_hasPadlockPHE;
106extern CRYPTOPP_DLL
bool g_hasPadlockPMM;
107extern CRYPTOPP_DLL
word32 g_cacheLineSize;
124#if (CRYPTOPP_SSE2_ASM_AVAILABLE || CRYPTOPP_SSE2_INTRIN_AVAILABLE)
125 if (!g_x86DetectionDone)
137inline bool HasSSSE3()
139#if CRYPTOPP_SSSE3_AVAILABLE
140 if (!g_x86DetectionDone)
152inline bool HasSSE41()
154#if CRYPTOPP_SSE41_AVAILABLE
155 if (!g_x86DetectionDone)
167inline bool HasSSE42()
169#if CRYPTOPP_SSE42_AVAILABLE
170 if (!g_x86DetectionDone)
183inline bool HasMOVBE()
185#if CRYPTOPP_SSE42_AVAILABLE
186 if (!g_x86DetectionDone)
199inline bool HasAESNI()
201#if CRYPTOPP_AESNI_AVAILABLE
202 if (!g_x86DetectionDone)
215inline bool HasCLMUL()
217#if CRYPTOPP_CLMUL_AVAILABLE
218 if (!g_x86DetectionDone)
233#if CRYPTOPP_SHANI_AVAILABLE
234 if (!g_x86DetectionDone)
249#if CRYPTOPP_ADX_AVAILABLE
250 if (!g_x86DetectionDone)
265#if CRYPTOPP_AVX_AVAILABLE
266 if (!g_x86DetectionDone)
281#if CRYPTOPP_AVX2_AVAILABLE
282 if (!g_x86DetectionDone)
294inline bool HasRDRAND()
296#if CRYPTOPP_RDRAND_AVAILABLE
297 if (!g_x86DetectionDone)
309inline bool HasRDSEED()
311#if CRYPTOPP_RDSEED_AVAILABLE
312 if (!g_x86DetectionDone)
324inline bool HasPadlockRNG()
326#if CRYPTOPP_PADLOCK_RNG_AVAILABLE
327 if (!g_x86DetectionDone)
329 return g_hasPadlockRNG;
339inline bool HasPadlockACE()
341#if CRYPTOPP_PADLOCK_ACE_AVAILABLE
342 if (!g_x86DetectionDone)
344 return g_hasPadlockACE;
354inline bool HasPadlockACE2()
356#if CRYPTOPP_PADLOCK_ACE2_AVAILABLE
357 if (!g_x86DetectionDone)
359 return g_hasPadlockACE2;
369inline bool HasPadlockPHE()
371#if CRYPTOPP_PADLOCK_PHE_AVAILABLE
372 if (!g_x86DetectionDone)
374 return g_hasPadlockPHE;
384inline bool HasPadlockPMM()
386#if CRYPTOPP_PADLOCK_PMM_AVAILABLE
387 if (!g_x86DetectionDone)
389 return g_hasPadlockPMM;
401 if (!g_x86DetectionDone)
414inline int GetCacheLineSize()
416 if (!g_x86DetectionDone)
418 return g_cacheLineSize;
426#if CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8 || CRYPTOPP_DOXYGEN_PROCESSING
429#ifndef CRYPTOPP_DOXYGEN_PROCESSING
430extern bool g_ArmDetectionDone;
431extern bool g_hasARMv7;
432extern bool g_hasNEON;
433extern bool g_hasPMULL;
434extern bool g_hasCRC32;
436extern bool g_hasSHA1;
437extern bool g_hasSHA2;
438extern bool g_hasSHA512;
439extern bool g_hasSHA3;
453inline bool HasARMv7()
456#if defined(__aarch32__) || defined(__aarch64__)
459 if (!g_ArmDetectionDone)
476#if defined(CRYPTOPP_ARM_ASIMD_AVAILABLE)
478#elif defined(CRYPTOPP_ARM_NEON_AVAILABLE)
479 if (!g_ArmDetectionDone)
497inline bool HasCRC32()
499#if defined(CRYPTOPP_ARM_CRC32_AVAILABLE)
500 if (!g_ArmDetectionDone)
519#if defined(CRYPTOPP_ARM_AES_AVAILABLE)
520 if (!g_ArmDetectionDone)
537inline bool HasPMULL()
539#if defined(CRYPTOPP_ARM_PMULL_AVAILABLE)
540 if (!g_ArmDetectionDone)
559#if defined(CRYPTOPP_ARM_SHA1_AVAILABLE)
560 if (!g_ArmDetectionDone)
579#if defined(CRYPTOPP_ARM_SHA2_AVAILABLE)
580 if (!g_ArmDetectionDone)
599#if defined(CRYPTOPP_ARM_SHA3_AVAILABLE)
600 if (!g_ArmDetectionDone)
617inline bool HasSHA512()
619#if defined(CRYPTOPP_ARM_SHA512_AVAILABLE)
620 if (!g_ArmDetectionDone)
639#if defined(CRYPTOPP_ARM_SM3_AVAILABLE)
640 if (!g_ArmDetectionDone)
659#if defined(CRYPTOPP_ARM_SM4_AVAILABLE)
660 if (!g_ArmDetectionDone)
674#if CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64 || CRYPTOPP_DOXYGEN_PROCESSING
677#ifndef CRYPTOPP_DOXYGEN_PROCESSING
678extern bool g_PowerPcDetectionDone;
679extern bool g_hasAltivec;
680extern bool g_hasPower7;
681extern bool g_hasPower8;
682extern bool g_hasPower9;
684extern bool g_hasPMULL;
685extern bool g_hasSHA256;
686extern bool g_hasSHA512;
687extern bool g_hasDARN;
688extern word32 g_cacheLineSize;
702inline bool HasAltivec()
704#if CRYPTOPP_ALTIVEC_AVAILABLE
705 if (!g_PowerPcDetectionDone)
706 DetectPowerPcFeatures();
719inline bool HasPower7()
721#if CRYPTOPP_POWER7_AVAILABLE
722 if (!g_PowerPcDetectionDone)
723 DetectPowerPcFeatures();
736inline bool HasPower8()
738#if CRYPTOPP_POWER8_AVAILABLE
739 if (!g_PowerPcDetectionDone)
740 DetectPowerPcFeatures();
753inline bool HasPower9()
755#if CRYPTOPP_POWER9_AVAILABLE
756 if (!g_PowerPcDetectionDone)
757 DetectPowerPcFeatures();
773#if CRYPTOPP_POWER8_AES_AVAILABLE
774 if (!g_PowerPcDetectionDone)
775 DetectPowerPcFeatures();
789inline bool HasPMULL()
791#if CRYPTOPP_POWER8_VMULL_AVAILABLE
792 if (!g_PowerPcDetectionDone)
793 DetectPowerPcFeatures();
807inline bool HasSHA256()
809#if CRYPTOPP_POWER8_SHA_AVAILABLE
810 if (!g_PowerPcDetectionDone)
811 DetectPowerPcFeatures();
825inline bool HasSHA512()
827#if CRYPTOPP_POWER8_SHA_AVAILABLE
828 if (!g_PowerPcDetectionDone)
829 DetectPowerPcFeatures();
844#if CRYPTOPP_POWER9_AVAILABLE
845 if (!g_PowerPcDetectionDone)
846 DetectPowerPcFeatures();
848# if defined(__ibmxl__) && defined(__linux__)
866inline int GetCacheLineSize()
868 if (!g_PowerPcDetectionDone)
869 DetectPowerPcFeatures();
870 return g_cacheLineSize;
880#if !(CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_PPC32 || CRYPTOPP_BOOL_PPC64)
889inline int GetCacheLineSize()
899#ifndef CRYPTOPP_DOXYGEN_PROCESSING
901#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64
903#ifdef CRYPTOPP_GENERATE_X64_MASM
904 #define AS1(x) x*newline*
905 #define AS2(x, y) x, y*newline*
906 #define AS3(x, y, z) x, y, z*newline*
907 #define ASS(x, y, a, b, c, d) x, y, a*64+b*16+c*4+d*newline*
908 #define ASL(x) label##x:*newline*
909 #define ASJ(x, y, z) x label##y*newline*
910 #define ASC(x, y) x label##y*newline*
911 #define AS_HEX(y) 0##y##h
912#elif defined(_MSC_VER) || defined(__BORLANDC__)
913 #define AS1(x) __asm {x}
914 #define AS2(x, y) __asm {x, y}
915 #define AS3(x, y, z) __asm {x, y, z}
916 #define ASS(x, y, a, b, c, d) __asm {x, y, (a)*64+(b)*16+(c)*4+(d)}
917 #define ASL(x) __asm {label##x:}
918 #define ASJ(x, y, z) __asm {x label##y}
919 #define ASC(x, y) __asm {x label##y}
920 #define CRYPTOPP_NAKED __declspec(naked)
921 #define AS_HEX(y) 0x##y
924 #define GNU_AS1(x) #x ";" NEW_LINE
925 #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE
926 #define GNU_AS3(x, y, z) #x ", " #y ", " #z ";" NEW_LINE
927 #define GNU_ASL(x) "\n" #x ":" NEW_LINE
929#if (CRYPTOPP_LLVM_CLANG_VERSION >= 50000) || (CRYPTOPP_APPLE_CLANG_VERSION >= 90000)
930 #define GNU_ASJ(x, y, z) ATT_PREFIX ";" NEW_LINE #x " " #y #z ";" NEW_LINE INTEL_PREFIX ";" NEW_LINE
932 #define GNU_ASJ(x, y, z) #x " " #y #z ";" NEW_LINE
934 #define AS1(x) GNU_AS1(x)
935 #define AS2(x, y) GNU_AS2(x, y)
936 #define AS3(x, y, z) GNU_AS3(x, y, z)
937 #define ASS(x, y, a, b, c, d) #x ", " #y ", " #a "*64+" #b "*16+" #c "*4+" #d ";"
938 #define ASL(x) GNU_ASL(x)
939 #define ASJ(x, y, z) GNU_ASJ(x, y, z)
940 #define ASC(x, y) #x " " #y ";"
941 #define CRYPTOPP_NAKED
942 #define AS_HEX(y) 0x##y
948#ifdef CRYPTOPP_GENERATE_X64_MASM
949#define ASM_MOD(x, y) ((x) MOD (y))
950#define XMMWORD_PTR XMMWORD PTR
953#define ASM_MOD(x, y) ((x)-((x)/(y))*(y))
966 #define AS_REG_1d ecx
967 #define AS_REG_2d edx
968 #define AS_REG_3d esi
969 #define AS_REG_4d edi
970 #define AS_REG_5d eax
971 #define AS_REG_6d ebx
972 #define AS_REG_7d ebp
974 #define WORD_REG(x) e##x
975 #define WORD_PTR DWORD PTR
976 #define AS_PUSH_IF86(x) AS1(push e##x)
977 #define AS_POP_IF86(x) AS1(pop e##x)
978 #define AS_JCXZ jecxz
979#elif CRYPTOPP_BOOL_X32
985 #define AS_REG_6 r10d
986 #define AS_REG_7 r11d
987 #define AS_REG_1d ecx
988 #define AS_REG_2d edx
989 #define AS_REG_3d r8d
990 #define AS_REG_4d r9d
991 #define AS_REG_5d eax
992 #define AS_REG_6d r10d
993 #define AS_REG_7d r11d
995 #define WORD_REG(x) e##x
996 #define WORD_PTR DWORD PTR
997 #define AS_PUSH_IF86(x) AS1(push r##x)
998 #define AS_POP_IF86(x) AS1(pop r##x)
999 #define AS_JCXZ jecxz
1000#elif CRYPTOPP_BOOL_X64
1001 #ifdef CRYPTOPP_GENERATE_X64_MASM
1002 #define AS_REG_1 rcx
1003 #define AS_REG_2 rdx
1006 #define AS_REG_5 rax
1007 #define AS_REG_6 r10
1008 #define AS_REG_7 r11
1009 #define AS_REG_1d ecx
1010 #define AS_REG_2d edx
1011 #define AS_REG_3d r8d
1012 #define AS_REG_4d r9d
1013 #define AS_REG_5d eax
1014 #define AS_REG_6d r10d
1015 #define AS_REG_7d r11d
1017 #define AS_REG_1 rdi
1018 #define AS_REG_2 rsi
1019 #define AS_REG_3 rdx
1020 #define AS_REG_4 rcx
1023 #define AS_REG_7 r10
1024 #define AS_REG_1d edi
1025 #define AS_REG_2d esi
1026 #define AS_REG_3d edx
1027 #define AS_REG_4d ecx
1028 #define AS_REG_5d r8d
1029 #define AS_REG_6d r9d
1030 #define AS_REG_7d r10d
1033 #define WORD_REG(x) r##x
1034 #define WORD_PTR QWORD PTR
1035 #define AS_PUSH_IF86(x)
1036 #define AS_POP_IF86(x)
1037 #define AS_JCXZ jrcxz
1041#define AS_XMM_OUTPUT4(labelPrefix, inputPtr, outputPtr, x0, x1, x2, x3, t, p0, p1, p2, p3, increment)\
1042 AS2( test inputPtr, inputPtr)\
1043 ASC( jz, labelPrefix##3)\
1044 AS2( test inputPtr, 15)\
1045 ASC( jnz, labelPrefix##7)\
1046 AS2( pxor xmm##x0, [inputPtr+p0*16])\
1047 AS2( pxor xmm##x1, [inputPtr+p1*16])\
1048 AS2( pxor xmm##x2, [inputPtr+p2*16])\
1049 AS2( pxor xmm##x3, [inputPtr+p3*16])\
1050 AS2( add inputPtr, increment*16)\
1051 ASC( jmp, labelPrefix##3)\
1052 ASL(labelPrefix##7)\
1053 AS2( movdqu xmm##t, [inputPtr+p0*16])\
1054 AS2( pxor xmm##x0, xmm##t)\
1055 AS2( movdqu xmm##t, [inputPtr+p1*16])\
1056 AS2( pxor xmm##x1, xmm##t)\
1057 AS2( movdqu xmm##t, [inputPtr+p2*16])\
1058 AS2( pxor xmm##x2, xmm##t)\
1059 AS2( movdqu xmm##t, [inputPtr+p3*16])\
1060 AS2( pxor xmm##x3, xmm##t)\
1061 AS2( add inputPtr, increment*16)\
1062 ASL(labelPrefix##3)\
1063 AS2( test outputPtr, 15)\
1064 ASC( jnz, labelPrefix##8)\
1065 AS2( movdqa [outputPtr+p0*16], xmm##x0)\
1066 AS2( movdqa [outputPtr+p1*16], xmm##x1)\
1067 AS2( movdqa [outputPtr+p2*16], xmm##x2)\
1068 AS2( movdqa [outputPtr+p3*16], xmm##x3)\
1069 ASC( jmp, labelPrefix##9)\
1070 ASL(labelPrefix##8)\
1071 AS2( movdqu [outputPtr+p0*16], xmm##x0)\
1072 AS2( movdqu [outputPtr+p1*16], xmm##x1)\
1073 AS2( movdqu [outputPtr+p2*16], xmm##x2)\
1074 AS2( movdqu [outputPtr+p3*16], xmm##x3)\
1075 ASL(labelPrefix##9)\
1076 AS2( add outputPtr, increment*16)
1085#if CRYPTOPP_GCC_DIAGNOSTIC_AVAILABLE
1086# pragma GCC diagnostic pop
Library configuration file.
#define CRYPTOPP_L1_CACHE_LINE_SIZE
L1 data cache line size.
#define CRYPTOPP_API
Win32 calling convention.
unsigned int word32
32-bit unsigned datatype
Crypto++ library namespace.