Initial support of SM4 cipher for normal volumes

This commit is contained in:
Mounir IDRASSI
2025-05-04 02:27:05 +09:00
parent 798985bf25
commit 7924f06e39
97 changed files with 2596 additions and 368 deletions

View File

@@ -17,6 +17,7 @@
#include "Crypto/Twofish.h"
#include "Crypto/Camellia.h"
#include "Crypto/kuznyechik.h"
#include "Crypto/sm4.h"
#ifdef TC_AES_HW_CPU
# include "Crypto/Aes_hw_cpu.h"
@@ -99,6 +100,7 @@ namespace VeraCrypt
l.push_back (shared_ptr <Cipher> (new CipherTwofish ()));
l.push_back (shared_ptr <Cipher> (new CipherCamellia ()));
l.push_back (shared_ptr <Cipher> (new CipherKuznyechik ()));
l.push_back (shared_ptr <Cipher> (new CipherSM4 ()));
#endif
return l;
}
@@ -518,6 +520,73 @@ namespace VeraCrypt
return false;
#endif
}
// SM4
void CipherSM4::Decrypt (uint8 *data) const
{
sm4_decrypt_block (data, data, (sm4_kds *) ScheduledKey.Ptr());
}
void CipherSM4::Encrypt (uint8 *data) const
{
sm4_encrypt_block (data, data, (sm4_kds *) ScheduledKey.Ptr());
}
size_t CipherSM4::GetScheduledKeySize () const
{
return SM4_KS;
}
void CipherSM4::SetCipherKey (const uint8 *key)
{
sm4_set_key (key, (sm4_kds *) ScheduledKey.Ptr());
}
void CipherSM4::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
if ((blockCount >= 4)
&& IsHwSupportAvailable())
{
sm4_encrypt_blocks (data, data, blockCount, (sm4_kds *) ScheduledKey.Ptr());
}
else
Cipher::EncryptBlocks (data, blockCount);
}
void CipherSM4::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
if ((blockCount >= 4)
&& IsHwSupportAvailable())
{
sm4_decrypt_blocks (data, data, blockCount, (sm4_kds *) ScheduledKey.Ptr());
}
else
Cipher::DecryptBlocks (data, blockCount);
}
bool CipherSM4::IsHwSupportAvailable () const
{
#if CRYPTOPP_BOOL_X64 || CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
static bool state = false;
static bool stateValid = false;
if (!stateValid)
{
state = HasSSE41() && HasAESNI();
stateValid = true;
}
return state;
#else
return false;
#endif
}
#endif
bool Cipher::HwSupportEnabled = true;
}

View File

@@ -148,6 +148,7 @@ namespace VeraCrypt
TC_CIPHER (Twofish, 16, 32);
TC_CIPHER (Camellia, 16, 32);
TC_CIPHER (Kuznyechik, 16, 32);
TC_CIPHER (SM4, 16, 16);
#undef TC_CIPHER_ADD_METHODS
#define TC_CIPHER_ADD_METHODS

View File

@@ -70,6 +70,7 @@ namespace VeraCrypt
l.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new Kuznyechik ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new SM4 ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new AESTwofish ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new AESTwofishSerpent ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new CamelliaKuznyechik ()));
@@ -80,6 +81,10 @@ namespace VeraCrypt
l.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentAES ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentTwofishAES ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new KuznyechikSM4 ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentSM4 ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new SM4Twofish ()));
l.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpentSM4 ()));
#endif
return l;
}
@@ -380,5 +385,50 @@ namespace VeraCrypt
SupportedModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
}
// SM4
SM4::SM4 ()
{
Ciphers.push_back (shared_ptr <Cipher> (new CipherSM4()));
SupportedModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
}
// Kuznyechik-SM4
KuznyechikSM4::KuznyechikSM4 ()
{
Ciphers.push_back (shared_ptr <Cipher> (new CipherSM4 ()));
Ciphers.push_back (shared_ptr <Cipher> (new CipherKuznyechik ()));
SupportedModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
}
// Serpent-SM4
SerpentSM4::SerpentSM4 ()
{
Ciphers.push_back (shared_ptr <Cipher> (new CipherSM4 ()));
Ciphers.push_back (shared_ptr <Cipher> (new CipherSerpent ()));
SupportedModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
}
// SM4-Twofish
SM4Twofish::SM4Twofish ()
{
Ciphers.push_back (shared_ptr <Cipher> (new CipherTwofish ()));
Ciphers.push_back (shared_ptr <Cipher> (new CipherSM4 ()));
SupportedModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
}
// Twofish-Serpent-SM4
TwofishSerpentSM4::TwofishSerpentSM4 ()
{
Ciphers.push_back (shared_ptr <Cipher> (new CipherSM4 ()));
Ciphers.push_back (shared_ptr <Cipher> (new CipherSerpent ()));
Ciphers.push_back (shared_ptr <Cipher> (new CipherTwofish ()));
SupportedModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
}
#endif
}

View File

@@ -95,6 +95,12 @@ namespace VeraCrypt
TC_ENCRYPTION_ALGORITHM (KuznyechikSerpentCamellia);
TC_ENCRYPTION_ALGORITHM (CamelliaKuznyechik);
TC_ENCRYPTION_ALGORITHM (CamelliaSerpent);
TC_ENCRYPTION_ALGORITHM (SM4);
TC_ENCRYPTION_ALGORITHM (KuznyechikSM4);
TC_ENCRYPTION_ALGORITHM (SerpentSM4);
TC_ENCRYPTION_ALGORITHM (SM4Twofish);
TC_ENCRYPTION_ALGORITHM (TwofishSerpentSM4);
#undef TC_ENCRYPTION_ALGORITHM
}

View File

@@ -51,6 +51,13 @@ namespace VeraCrypt
uint8 Ciphertext[16];
};
struct Cipher128TestVector
{
uint8 Key[16];
uint8 Plaintext[16];
uint8 Ciphertext[16];
};
static const CipherTestVector AESTestVectors[] =
{
{
@@ -155,6 +162,91 @@ namespace VeraCrypt
}
}
};
static const CipherTestVector SM4TestVectors[] =
{
{
// KEY 0
{ 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // dummy
},
{ 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10 },
{ 0x68,0x1e,0xdf,0x34,0xd2,0x06,0x96,0x5e,0x86,0xb3,0xe9,0x4f,0x53,0x6e,0x42,0x46 }
},
{
// KEY 1
{ 0x68,0x1e,0xdf,0x34,0xd2,0x06,0x96,0x5e,0x86,0xb3,0xe9,0x4f,0x53,0x6e,0x42,0x46
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // dummy
},
{ 0xf4,0x21,0x31,0xb0,0x02,0x42,0x5b,0x6f,0x5c,0xf5,0x2a,0x81,0x06,0x82,0xa0,0x9d },
{ 0xec,0x4b,0x7b,0x17,0x57,0xfe,0xe9,0xce,0x45,0x51,0x97,0xe5,0xbf,0x9c,0x3a,0x90 }
},
{
// After KEY 1, PT/CT pairs
{ 0x68,0x1e,0xdf,0x34,0xd2,0x06,0x96,0x5e,0x86,0xb3,0xe9,0x4f,0x53,0x6e,0x42,0x46
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // dummy
},
{ 0x07,0xbc,0xae,0x6a,0x83,0x88,0xe1,0x46,0x51,0xfe,0xd8,0x4b,0x37,0x49,0xd3,0x86 },
{ 0x89,0xf2,0xc4,0x1e,0xd9,0x7d,0xbb,0x1b,0x74,0xa2,0xad,0x93,0xb9,0x03,0xbb,0xc9 }
},
{
{ 0x68,0x1e,0xdf,0x34,0xd2,0x06,0x96,0x5e,0x86,0xb3,0xe9,0x4f,0x53,0x6e,0x42,0x46
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // dummy
},
{ 0xf4,0x76,0x26,0x15,0xb3,0x2c,0x00,0x0a,0x16,0x5e,0x1d,0x72,0x2d,0x70,0x80,0x52 },
{ 0xf4,0x5a,0x41,0x05,0x2f,0x9b,0xf3,0xd5,0xb6,0x5d,0xf8,0xcc,0x1c,0x75,0xb4,0xcf }
},
{
{ 0x68,0x1e,0xdf,0x34,0xd2,0x06,0x96,0x5e,0x86,0xb3,0xe9,0x4f,0x53,0x6e,0x42,0x46
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // dummy
},
{ 0xba,0x3c,0x19,0xd8,0x92,0x63,0x56,0xed,0x14,0x91,0xc6,0xe4,0xe5,0x28,0x78,0x2f },
{ 0x3e,0x1f,0x30,0xd5,0x7d,0xf4,0xb6,0x06,0x94,0xf5,0x66,0xde,0x44,0x48,0x4f,0xaf }
},
{
// KEY 2
{ 0x78,0x1e,0xdf,0x34,0xd2,0x06,0x96,0x5e,0x86,0xb3,0xe9,0x4f,0x53,0x6e,0x42,0x47
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // dummy
},
{ 0x91,0x08,0x95,0x7f,0xf9,0x17,0xe3,0xd6,0x1c,0x4e,0xa3,0x3e,0x53,0xdb,0x6e,0xf3 },
{ 0x6a,0x52,0x9a,0xc0,0x93,0xa5,0xf3,0x04,0x5a,0xed,0x78,0x7f,0x70,0xcc,0xb7,0xf5 }
},
{
{ 0x78,0x1e,0xdf,0x34,0xd2,0x06,0x96,0x5e,0x86,0xb3,0xe9,0x4f,0x53,0x6e,0x42,0x47
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // dummy
},
{ 0xcb,0xa0,0xf0,0x56,0x75,0x35,0xd6,0x61,0x48,0xb3,0x5a,0x92,0x58,0x72,0x9c,0x23 },
{ 0x63,0x46,0xf0,0xe4,0xc5,0x95,0x32,0xd4,0x18,0xce,0x31,0x5b,0x9f,0x22,0xa0,0xf4 }
},
{
{ 0x78,0x1e,0xdf,0x34,0xd2,0x06,0x96,0x5e,0x86,0xb3,0xe9,0x4f,0x53,0x6e,0x42,0x47
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // dummy
},
{ 0xfa,0x59,0x80,0x11,0xf7,0xc2,0x10,0x07,0x99,0x45,0x1e,0x62,0xf3,0xb5,0xcf,0x09 },
{ 0x62,0x55,0x45,0x91,0x00,0x95,0x8f,0x4d,0x95,0x3a,0x9d,0x56,0x67,0x69,0x2d,0x6d }
},
{
{ 0x78,0x1e,0xdf,0x34,0xd2,0x06,0x96,0x5e,0x86,0xb3,0xe9,0x4f,0x53,0x6e,0x42,0x47
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // dummy
},
{ 0xba,0x1f,0x85,0x55,0xb2,0xdd,0xab,0x0e,0x4e,0x4d,0x80,0x26,0xb0,0x5a,0xf3,0x89 },
{ 0x37,0x6f,0xeb,0x09,0x78,0xb5,0x2a,0xb9,0xc9,0x84,0xa1,0x4d,0x7e,0x66,0xf6,0x71 }
},
{
{ 0x78,0x1e,0xdf,0x34,0xd2,0x06,0x96,0x5e,0x86,0xb3,0xe9,0x4f,0x53,0x6e,0x42,0x47
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // dummy
},
{ 0x50,0xc6,0x3c,0xe2,0x55,0x82,0x57,0x1a,0xa5,0xd8,0xee,0x22,0x08,0x9c,0x1b,0x59 },
{ 0x31,0xff,0xaf,0x2c,0xad,0x65,0x49,0xf3,0xd9,0xfc,0xd7,0xf0,0x2d,0xf5,0x81,0x24 }
},
{
{ 0x78,0x1e,0xdf,0x34,0xd2,0x06,0x96,0x5e,0x86,0xb3,0xe9,0x4f,0x53,0x6e,0x42,0x47
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 // dummy
},
{ 0x22,0x9a,0xd7,0xa8,0xa8,0x3c,0x5e,0x23,0x84,0xb4,0x08,0x2e,0x50,0xd0,0x6e,0xbf },
{ 0x76,0xf2,0x9e,0x93,0xdd,0xf5,0x79,0x32,0xa4,0x1e,0x83,0xbb,0x7b,0x61,0xa4,0x06 }
}
};
#endif
static void TestCipher (Cipher &cipher, const CipherTestVector *testVector, size_t testVectorCount)
@@ -207,6 +299,9 @@ namespace VeraCrypt
CipherKuznyechik kuznyechik;
TestCipher (kuznyechik, KuznyechikTestVectors, array_capacity (KuznyechikTestVectors));
CipherSM4 sm4;
TestCipher (sm4, SM4TestVectors, array_capacity (SM4TestVectors));
#endif
}
@@ -682,6 +777,32 @@ namespace VeraCrypt
break;
}
}
else if (typeid (ea) == typeid (SM4))
{
switch (testCase)
{
case 0:
if (crc != 0x561b1367)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 1:
if (crc != 0x8f72e14d)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 2:
if (crc != 0xf96df16f)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 3:
if (crc != 0x8997e6eb)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
}
}
else if (typeid (ea) == typeid (AESTwofish))
{
switch (testCase)
@@ -942,6 +1063,110 @@ namespace VeraCrypt
break;
}
}
else if (typeid (ea) == typeid (KuznyechikSM4))
{
switch (testCase)
{
case 0:
if (crc != 0xb126b7f8)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 1:
if (crc != 0xa117004a)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 2:
if (crc != 0xc561be46)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 3:
if (crc != 0x47106ce3)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
}
}
else if (typeid (ea) == typeid (SerpentSM4))
{
switch (testCase)
{
case 0:
if (crc != 0x40a9eaa5)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 1:
if (crc != 0xce6873f1)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 2:
if (crc != 0x92cafcad)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 3:
if (crc != 0x7e1463ca)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
}
}
else if (typeid (ea) == typeid (SM4Twofish))
{
switch (testCase)
{
case 0:
if (crc != 0xd9a46a64)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 1:
if (crc != 0x371fdc08)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 2:
if (crc != 0x231c5104)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 3:
if (crc != 0xa920424b)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
}
}
else if (typeid (ea) == typeid (TwofishSerpentSM4))
{
switch (testCase)
{
case 0:
if (crc != 0x881b6e3d)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 1:
if (crc != 0x37ed1418)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 2:
if (crc != 0x8e563eef)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
case 3:
if (crc != 0xdcbc41ac)
throw TestFailed (SRC_POS);
nTestsPerformed++;
break;
}
}
#endif
if (crc == 0x9f5edd58)
throw TestFailed (SRC_POS);
@@ -1028,6 +1253,12 @@ namespace VeraCrypt
throw TestFailed (SRC_POS);
nTestsPerformed++;
}
else if (typeid (ea) == typeid (SM4))
{
if (crc != 0x7b600d06)
throw TestFailed (SRC_POS);
nTestsPerformed++;
}
else if (typeid (ea) == typeid (AESTwofish))
{
if (crc != 0x14ce7385)
@@ -1088,6 +1319,30 @@ namespace VeraCrypt
throw TestFailed (SRC_POS);
nTestsPerformed++;
}
else if (typeid (ea) == typeid (KuznyechikSM4))
{
if (crc != 0x8190551b)
throw TestFailed (SRC_POS);
nTestsPerformed++;
}
else if (typeid (ea) == typeid (SerpentSM4))
{
if (crc != 0x31408c47)
throw TestFailed (SRC_POS);
nTestsPerformed++;
}
else if (typeid (ea) == typeid (SM4Twofish))
{
if (crc != 0x1eaede31)
throw TestFailed (SRC_POS);
nTestsPerformed++;
}
else if (typeid (ea) == typeid (TwofishSerpentSM4))
{
if (crc != 0x033093e5)
throw TestFailed (SRC_POS);
nTestsPerformed++;
}
#endif
if (crc == 0x9f5edd58)
@@ -1101,7 +1356,7 @@ namespace VeraCrypt
nTestsPerformed++;
}
#ifndef WOLFCRYPT_BACKEND
if (nTestsPerformed != 150)
if (nTestsPerformed != 200)
#else
if (nTestsPerformed != 10)
#endif

View File

@@ -16,6 +16,7 @@ OBJSNOOPT :=
OBJSSSE41 :=
OBJSSSSE3 :=
OBJSHANI :=
OBJAESNI :=
OBJS += Cipher.o
OBJS += EncryptionAlgorithm.o
OBJS += EncryptionMode.o
@@ -97,8 +98,10 @@ else
endif
ifeq "$(GCC_GTEQ_500)" "1"
OBJSHANI += ../Crypto/Sha2Intel.oshani
OBJAESNI += ../Crypto/sm4-impl-aesni.oaesni
else
OBJS += ../Crypto/Sha2Intel.o
OBJS += ../Crypto/sm4-impl-aesni.o
endif
else
OBJS += ../Crypto/wolfCrypt.o
@@ -118,6 +121,7 @@ OBJS += ../Crypto/Camellia.o
OBJS += ../Crypto/Streebog.o
OBJS += ../Crypto/kuznyechik.o
OBJS += ../Crypto/kuznyechik_simd.o
OBJS += ../Crypto/sm4.o
OBJS += ../Common/Pkcs5.o
endif

View File

@@ -109,6 +109,7 @@ namespace VeraCrypt
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Kuznyechik ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SM4 ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AESTwofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AESTwofishSerpent ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new CamelliaKuznyechik ()));
@@ -119,6 +120,10 @@ namespace VeraCrypt
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentAES ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentTwofishAES ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new KuznyechikSM4 ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentSM4 ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SM4Twofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpentSM4 ()));
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
#else
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeWolfCryptXTS ()));
@@ -158,6 +163,7 @@ namespace VeraCrypt
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Kuznyechik ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SM4 ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AESTwofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AESTwofishSerpent ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new CamelliaKuznyechik ()));
@@ -168,6 +174,10 @@ namespace VeraCrypt
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentAES ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentTwofishAES ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new KuznyechikSM4 ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentSM4 ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SM4Twofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpentSM4 ()));
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
#else
@@ -214,6 +224,7 @@ namespace VeraCrypt
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Twofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Camellia ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new Kuznyechik ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SM4 ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AESTwofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new AESTwofishSerpent ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new CamelliaKuznyechik ()));
@@ -224,6 +235,10 @@ namespace VeraCrypt
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentAES ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentTwofishAES ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpent ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new KuznyechikSM4 ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SerpentSM4 ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new SM4Twofish ()));
SupportedEncryptionAlgorithms.push_back (shared_ptr <EncryptionAlgorithm> (new TwofishSerpentSM4 ()));
SupportedEncryptionModes.push_back (shared_ptr <EncryptionMode> (new EncryptionModeXTS ()));
#else