mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 02:58:02 -06:00
SIMD speed optimization for Kuznyechik cipher implementation (up to 2x speedup). Based on https://github.com/aprelev/libgost15.
This commit is contained in:
@@ -254,6 +254,20 @@ void EncipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
|
||||
else if (cipher == CAMELLIA) {
|
||||
camellia_encrypt_blocks(ks, data, data, (uint32) blockCount);
|
||||
}
|
||||
#endif
|
||||
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined (_UEFI)
|
||||
else if (cipher == KUZNYECHIK
|
||||
&& HasSSE2()
|
||||
#if defined (TC_WINDOWS_DRIVER) && !defined (_WIN64)
|
||||
&& (blockCount >= 4) && NT_SUCCESS (KeSaveFloatingPointState (&floatingPointState))
|
||||
#endif
|
||||
)
|
||||
{
|
||||
kuznyechik_encrypt_blocks (data, data, blockCount, ks);
|
||||
#if defined (TC_WINDOWS_DRIVER) && !defined (_WIN64)
|
||||
KeRestoreFloatingPointState (&floatingPointState);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
else if (cipher == GOST89) {
|
||||
gost_encrypt(data, data, ks, (int)blockCount);
|
||||
@@ -357,6 +371,20 @@ void DecipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
|
||||
else if (cipher == CAMELLIA) {
|
||||
camellia_decrypt_blocks(ks, data, data, (uint32) blockCount);
|
||||
}
|
||||
#endif
|
||||
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined (_UEFI)
|
||||
else if (cipher == KUZNYECHIK
|
||||
&& HasSSE2()
|
||||
#if defined (TC_WINDOWS_DRIVER) && !defined (_WIN64)
|
||||
&& (blockCount >= 4) && NT_SUCCESS (KeSaveFloatingPointState (&floatingPointState))
|
||||
#endif
|
||||
)
|
||||
{
|
||||
kuznyechik_decrypt_blocks (data, data, blockCount, ks);
|
||||
#if defined (TC_WINDOWS_DRIVER) && !defined (_WIN64)
|
||||
KeRestoreFloatingPointState (&floatingPointState);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
else if (cipher == GOST89) {
|
||||
gost_decrypt(data, data, ks, (int)blockCount);
|
||||
@@ -429,6 +457,7 @@ BOOL CipherSupportsIntraDataUnitParallelization (int cipher)
|
||||
|| (cipher == GOST89)
|
||||
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined (_UEFI)
|
||||
|| (cipher == SERPENT && HasSSE2())
|
||||
|| (cipher == KUZNYECHIK && HasSSE2())
|
||||
#endif
|
||||
#if CRYPTOPP_BOOL_X64
|
||||
|| (cipher == TWOFISH)
|
||||
|
||||
Reference in New Issue
Block a user