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

Remove SM4 support!

This commit is contained in:
Mounir IDRASSI
2025-05-18 18:31:39 +09:00
parent ec0fa4f482
commit 44a9f8bcff
89 changed files with 22 additions and 1097 deletions

View File

@@ -69,7 +69,6 @@ static Cipher Ciphers[] =
{ TWOFISH, L"Twofish", 16, 32, TWOFISH_KS },
{ CAMELLIA, L"Camellia", 16, 32, CAMELLIA_KS },
{ KUZNYECHIK, L"Kuznyechik",16, 32, KUZNYECHIK_KS },
{ SM4, L"SM4", 16, 16, SM4_KS },
#endif
#endif
{ 0, 0, 0, 0, 0 }
@@ -90,7 +89,6 @@ static EncryptionAlgorithm EncryptionAlgorithms[] =
{ { TWOFISH, 0 }, { XTS, 0 }, 1, 1 },
{ { CAMELLIA, 0 }, { XTS, 0 }, 1, 1 },
{ { KUZNYECHIK, 0 }, { XTS, 0 }, 0, 1 },
{ { SM4, 0 }, { XTS, 0 }, 0, 1 },
{ { TWOFISH, AES, 0 }, { XTS, 0 }, 1, 1 },
{ { SERPENT, TWOFISH, AES, 0 }, { XTS, 0 }, 1, 1 },
{ { AES, SERPENT, 0 }, { XTS, 0 }, 1, 1 },
@@ -98,13 +96,9 @@ static EncryptionAlgorithm EncryptionAlgorithms[] =
{ { SERPENT, TWOFISH, 0 }, { XTS, 0 }, 1, 1 },
{ { KUZNYECHIK, CAMELLIA, 0 }, { XTS, 0 }, 0, 1 },
{ { TWOFISH, KUZNYECHIK, 0 }, { XTS, 0 }, 0, 1 },
{ { KUZNYECHIK, SM4, 0 }, { XTS, 0 }, 0, 1 },
{ { SERPENT, SM4, 0 }, { XTS, 0 }, 0, 1 },
{ { TWOFISH, SM4, 0 }, { XTS, 0 }, 0, 1 },
{ { SERPENT, CAMELLIA, 0 }, { XTS, 0 }, 0, 1 },
{ { AES, KUZNYECHIK, 0 }, { XTS, 0 }, 0, 1 },
{ { CAMELLIA, SERPENT, KUZNYECHIK, 0 }, { XTS, 0 }, 0, 1 },
{ { SERPENT, TWOFISH, SM4, 0 }, { XTS, 0 }, 0, 1 },
#endif
{ { 0, 0 }, { 0, 0}, 0, 0 } // Must be all-zero
@@ -183,9 +177,6 @@ int CipherInit (int cipher, unsigned char *key, unsigned __int8 *ks)
case KUZNYECHIK:
kuznyechik_set_key(key, (kuznyechik_kds*)ks);
break;
case SM4:
sm4_set_key(key, (sm4_kds*)ks);
break;
#endif // !defined(TC_WINDOWS_BOOT)
#endif
@@ -218,7 +209,6 @@ void EncipherBlock(int cipher, void *data, void *ks)
#endif
#if !defined(TC_WINDOWS_BOOT)
case KUZNYECHIK: kuznyechik_encrypt_block(data, data, ks); break;
case SM4: sm4_encrypt_block(data, data, ks); break;
#endif // !defined(TC_WINDOWS_BOOT)
#endif
default: TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID
@@ -270,12 +260,6 @@ void EncipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
{
kuznyechik_encrypt_blocks (data, data, blockCount, ks);
}
else if (cipher == SM4
&& HasSSE41() && HasAESNI()
)
{
sm4_encrypt_blocks(data, data, blockCount, ks);
}
#endif
#endif
else
@@ -303,7 +287,6 @@ void DecipherBlock(int cipher, void *data, void *ks)
#endif
#if !defined(TC_WINDOWS_BOOT)
case KUZNYECHIK: kuznyechik_decrypt_block(data, data, ks); break;
case SM4: sm4_decrypt_block(data, data, ks); break;
#endif // !defined(TC_WINDOWS_BOOT)
#endif
@@ -369,12 +352,6 @@ void DecipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
{
kuznyechik_decrypt_blocks (data, data, blockCount, ks);
}
else if (cipher == SM4
&& HasSSE41() && HasAESNI()
)
{
sm4_decrypt_blocks(data, data, blockCount, ks);
}
#endif
#endif
else
@@ -445,7 +422,6 @@ BOOL CipherSupportsIntraDataUnitParallelization (int cipher)
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined (_UEFI)
|| (cipher == SERPENT && HasSSE2())
|| (cipher == KUZNYECHIK && HasSSE2())
|| (cipher == SM4 && HasSSE41() && HasAESNI())
#endif
#if CRYPTOPP_BOOL_X64 && !defined(CRYPTOPP_DISABLE_ASM)
|| (cipher == TWOFISH)