diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-11-10 21:08:00 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-11-10 21:08:00 +0100 |
commit | 04c747fb2df007eddc27e515acaa91f8993a70af (patch) | |
tree | f1ecf9078e500f022d78f2441834bcaf3985ccd1 /src/Crypto/cpu.h | |
parent | fcc0c8283679c696a9938791bf6f7a3ea2921716 (diff) | |
download | VeraCrypt-04c747fb2df007eddc27e515acaa91f8993a70af.tar.gz VeraCrypt-04c747fb2df007eddc27e515acaa91f8993a70af.zip |
Add support for SHA-256 x86 instrinsic for enhance performance of PBKDF2-HMAC-SHA256
Diffstat (limited to 'src/Crypto/cpu.h')
-rw-r--r-- | src/Crypto/cpu.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Crypto/cpu.h b/src/Crypto/cpu.h index 2661bf1c..b0df6462 100644 --- a/src/Crypto/cpu.h +++ b/src/Crypto/cpu.h @@ -207,6 +207,22 @@ extern __m128i _mm_aesdeclast_si128(__m128i v, __m128i rkey); #endif #endif +#if CRYPTOPP_SHANI_AVAILABLE +#if defined(TC_WINDOWS_DRIVER) || defined (_UEFI) +#if defined(__cplusplus) +extern "C" { +#endif +extern __m128i __cdecl _mm_sha256msg1_epu32(__m128i, __m128i); +extern __m128i __cdecl _mm_sha256msg2_epu32(__m128i, __m128i); +extern __m128i __cdecl _mm_sha256rnds2_epu32(__m128i, __m128i, __m128i); +#if defined(__cplusplus) +} +#endif +#else +#include <immintrin.h> +#endif +#endif + #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64 #if defined(__cplusplus) @@ -234,6 +250,7 @@ extern volatile int g_hasCLMUL; extern volatile int g_isP4; extern volatile int g_hasRDRAND; extern volatile int g_hasRDSEED; +extern volatile int g_hasSHA256; extern volatile int g_isIntel; extern volatile int g_isAMD; extern volatile uint32 g_cacheLineSize; @@ -262,6 +279,7 @@ void DisableCPUExtendedFeatures (); #define IsP4() g_isP4 #define HasRDRAND() g_hasRDRAND #define HasRDSEED() g_hasRDSEED +#define HasSHA256() g_hasSHA256 #define IsCpuIntel() g_isIntel #define IsCpuAMD() g_isAMD #define GetCacheLineSize() g_cacheLineSize |