13 #if (CRYPTOPP_SSE42_AVAILABLE) 14 # include <nmmintrin.h> 17 #if (CRYPTOPP_ARM_NEON_AVAILABLE) 18 # include <arm_neon.h> 21 #if (CRYPTOPP_ARM_ACLE_AVAILABLE) 23 # include <arm_acle.h> 26 #ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY 31 #ifndef EXCEPTION_EXECUTE_HANDLER 32 # define EXCEPTION_EXECUTE_HANDLER 1 36 extern const char CRC_SIMD_FNAME[] = __FILE__;
40 #ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY 42 typedef void (*SigHandler)(int);
44 static jmp_buf s_jmpSIGILL;
45 static void SigIllHandler(
int)
47 longjmp(s_jmpSIGILL, 1);
50 #endif // Not CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY 52 #if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8) 56 #if defined(CRYPTOPP_NO_CPU_FEATURE_PROBES) 58 #elif (CRYPTOPP_ARM_CRC32_AVAILABLE) 59 # if defined(CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY) 60 volatile bool result =
true;
63 word32 w=0, x=1; word16 y=2; byte z=3;
73 __except (EXCEPTION_EXECUTE_HANDLER)
82 volatile bool result =
true;
84 volatile SigHandler oldHandler = signal(SIGILL, SigIllHandler);
85 if (oldHandler == SIG_ERR)
88 volatile sigset_t oldMask;
89 if (sigprocmask(0, NULLPTR, (sigset_t*)&oldMask))
92 if (setjmp(s_jmpSIGILL))
96 word32 w=0, x=1; word16 y=2; byte z=3;
108 sigprocmask(SIG_SETMASK, (sigset_t*)&oldMask, NULLPTR);
109 signal(SIGILL, oldHandler);
114 #endif // CRYPTOPP_ARM_CRC32_AVAILABLE 116 #endif // ARM32 or ARM64 118 #if (CRYPTOPP_ARM_CRC32_AVAILABLE) 119 void CRC32_Update_ARMV8(
const byte *s,
size_t n, word32& c)
121 for(; !IsAligned<word32>(s) && n > 0; s++, n--)
124 for(; n > 4; s+=4, n-=4)
125 c = __crc32w(c, *(
const word32 *)(
void*)s);
127 for(; n > 0; s++, n--)
131 void CRC32C_Update_ARMV8(
const byte *s,
size_t n, word32& c)
133 for(; !IsAligned<word32>(s) && n > 0; s++, n--)
134 c = __crc32cb(c, *s);
136 for(; n > 4; s+=4, n-=4)
137 c = __crc32cw(c, *(
const word32 *)(
void*)s);
139 for(; n > 0; s++, n--)
140 c = __crc32cb(c, *s);
144 #if (CRYPTOPP_SSE42_AVAILABLE) 145 void CRC32C_Update_SSE42(
const byte *s,
size_t n, word32& c)
147 for(; !IsAligned<word32>(s) && n > 0; s++, n--)
148 c = _mm_crc32_u8(c, *s);
150 for(; n > 4; s+=4, n-=4)
151 c = _mm_crc32_u32(c, *(
const word32 *)(
void*)s);
153 for(; n > 0; s++, n--)
154 c = _mm_crc32_u8(c, *s);
Utility functions for the Crypto++ library.
Library configuration file.
Crypto++ library namespace.