1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Crypto: Add optimized Twofish assembly implementation for x86_64.

This commit is contained in:
Mounir IDRASSI
2016-11-28 00:29:36 +01:00
parent 68fababbe8
commit 263abeee3a
13 changed files with 1049 additions and 421 deletions

View File

@@ -296,6 +296,39 @@ namespace VeraCrypt
twofish_set_key ((TwofishInstance *) ScheduledKey.Ptr(), (unsigned int *) key);
}
void CipherTwofish::EncryptBlocks (byte *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
#if CRYPTOPP_BOOL_X64
twofish_encrypt_blocks ( (TwofishInstance *) ScheduledKey.Ptr(), data, data, blockCount);
#else
Cipher::EncryptBlocks (data, blockCount);
#endif
}
void CipherTwofish::DecryptBlocks (byte *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
#if CRYPTOPP_BOOL_X64
twofish_decrypt_blocks ( (TwofishInstance *) ScheduledKey.Ptr(), data, data, blockCount);
#else
Cipher::DecryptBlocks (data, blockCount);
#endif
}
bool CipherTwofish::IsHwSupportAvailable () const
{
#if CRYPTOPP_BOOL_X64
return true;
#else
return false;
#endif
}
// Camellia
void CipherCamellia::Decrypt (byte *data) const
{