13#if (CRYPTOPP_SSE42_AVAILABLE)
14# include <nmmintrin.h>
17#if (CRYPTOPP_ARM_ACLE_HEADER)
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))
38extern const char CRC_SIMD_FNAME[] = __FILE__;
40NAMESPACE_BEGIN(CryptoPP)
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);
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);
119#if (CRYPTOPP_ARM_CRC32_AVAILABLE)
120void 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--)
135void 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)
141 c = CRC32CWx4(c, CONST_WORD32_CAST(s));
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)
152void 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);
Support functions for ARM and vector operations.
Library configuration file.
unsigned int word32
32-bit unsigned datatype
Utility functions for the Crypto++ library.