13 #if (CRYPTOPP_SSE42_AVAILABLE) 14 # include <nmmintrin.h> 17 #if (CRYPTOPP_ARM_ACLE_HEADER) 19 # include <arm_acle.h> 22 #if (CRYPTOPP_ARM_CRC32_AVAILABLE) 26 #ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY 31 #ifndef EXCEPTION_EXECUTE_HANDLER 32 # define EXCEPTION_EXECUTE_HANDLER 1 35 #define CONST_WORD32_CAST(x) ((const word32 *)(void*)(x)) 38 extern const char CRC_SIMD_FNAME[] = __FILE__;
42 #ifdef CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY 44 typedef void (*SigHandler)(int);
46 static jmp_buf s_jmpSIGILL;
47 static void SigIllHandler(
int)
49 longjmp(s_jmpSIGILL, 1);
52 #endif // Not CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY 54 #if (CRYPTOPP_BOOL_ARM32 || CRYPTOPP_BOOL_ARMV8) 58 #if defined(CRYPTOPP_NO_CPU_FEATURE_PROBES) 60 #elif (CRYPTOPP_ARM_CRC32_AVAILABLE) 61 # if defined(CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY) 62 volatile bool result =
true;
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))
91 signal(SIGILL, oldHandler);
95 if (setjmp(s_jmpSIGILL))
109 sigprocmask(SIG_SETMASK, (sigset_t*)&oldMask, NULLPTR);
110 signal(SIGILL, oldHandler);
115 #endif // CRYPTOPP_ARM_CRC32_AVAILABLE 117 #endif // ARM32 or ARM64 119 #if (CRYPTOPP_ARM_CRC32_AVAILABLE) 120 void CRC32_Update_ARMV8(
const byte *s,
size_t n,
word32& c)
122 for(; !IsAligned<word32>(s) && n > 0; s++, n--)
125 for(; n >= 16; s+=16, n-=16)
126 c =
CRC32Wx4(c, CONST_WORD32_CAST(s));
128 for(; n >= 4; s+=4, n-=4)
129 c =
CRC32W(c, *CONST_WORD32_CAST(s));
131 for(; n > 0; s++, n--)
135 void CRC32C_Update_ARMV8(
const byte *s,
size_t n,
word32& c)
137 for(; !IsAligned<word32>(s) && n > 0; s++, n--)
140 for(; n >= 16; s+=16, n-=16)
143 for(; n >= 4; s+=4, n-=4)
144 c =
CRC32CW(c, *CONST_WORD32_CAST(s));
146 for(; n > 0; s++, n--)
151 #if (CRYPTOPP_SSE42_AVAILABLE) 152 void CRC32C_Update_SSE42(
const byte *s,
size_t n,
word32& c)
154 for(; !IsAligned<word32>(s) && n > 0; s++, n--)
155 c = _mm_crc32_u8(c, *s);
157 for(; n >= 16; s+=16, n-=16)
159 c = _mm_crc32_u32(_mm_crc32_u32(_mm_crc32_u32(_mm_crc32_u32(c,
160 *CONST_WORD32_CAST(s+ 0)), *CONST_WORD32_CAST(s+ 4)),
161 *CONST_WORD32_CAST(s+ 8)), *CONST_WORD32_CAST(s+12));
164 for(; n >= 4; s+=4, n-=4)
165 c = _mm_crc32_u32(c, *CONST_WORD32_CAST(s));
167 for(; n > 0; s++, n--)
168 c = _mm_crc32_u8(c, *s);
Utility functions for the Crypto++ library.
unsigned int word32
32-bit unsigned datatype
Library configuration file.
uint32_t CRC32W(uint32_t crc, uint32_t val)
CRC32 checksum.
uint32_t CRC32B(uint32_t crc, uint8_t val)
CRC32 checksum.
uint32_t CRC32CWx4(uint32_t crc, const uint32_t vals[4])
CRC32-C checksum.
unsigned char byte
8-bit unsigned datatype
Crypto++ library namespace.
uint32_t CRC32CB(uint32_t crc, uint8_t val)
CRC32-C checksum.
uint32_t CRC32Wx4(uint32_t crc, const uint32_t vals[4])
CRC32 checksum.
uint32_t CRC32CW(uint32_t crc, uint32_t val)
CRC32-C checksum.
Support functions for ARM and vector operations.