From 3f976c24d2c991f8634991371cbb99662f979022 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 24 Jul 2023 08:48:52 +0200 Subject: Linux/macOS: Remove TrueCrypt support --- src/Common/Dlgcode.c | 5 --- src/Common/Tcdefs.h | 5 ++- src/Core/Core.h | 19 +++++----- src/Core/CoreBase.cpp | 16 +++------ src/Core/CoreBase.h | 4 +-- src/Core/MountOptions.cpp | 9 ++--- src/Core/MountOptions.h | 4 +-- src/Core/Unix/CoreUnix.cpp | 1 - src/Main/CommandLineInterface.cpp | 11 ++---- src/Main/CommandLineInterface.h | 1 - src/Main/Forms/BenchmarkDialog.cpp | 2 +- src/Main/Forms/ChangePasswordDialog.cpp | 25 ++++--------- src/Main/Forms/MainFrame.cpp | 26 +++----------- src/Main/Forms/MountOptionsDialog.cpp | 29 +++------------- src/Main/Forms/PreferencesDialog.cpp | 7 ++-- src/Main/Forms/VolumeCreationWizard.cpp | 5 ++- src/Main/Forms/VolumePasswordPanel.cpp | 54 +++-------------------------- src/Main/Forms/VolumePasswordPanel.h | 8 ++--- src/Main/Forms/VolumePasswordWizardPage.cpp | 2 +- src/Main/Forms/VolumePasswordWizardPage.h | 2 +- src/Main/Forms/VolumePropertiesDialog.cpp | 2 +- src/Main/Forms/WaitDialog.cpp | 2 -- src/Main/GraphicUserInterface.cpp | 9 ++--- src/Main/GraphicUserInterface.h | 2 +- src/Main/TextUserInterface.cpp | 29 +++++++--------- src/Main/TextUserInterface.h | 2 +- src/Main/UserInterface.cpp | 22 +++--------- src/Main/UserInterface.h | 4 +-- src/Main/UserPreferences.cpp | 6 +--- src/Platform/Exception.h | 2 -- src/SetupDLL/Setup.c | 5 --- src/Volume/EncryptionTest.cpp | 4 +-- src/Volume/Pkcs5Kdf.cpp | 30 ++++++---------- src/Volume/Pkcs5Kdf.h | 35 +++++++++---------- src/Volume/Volume.cpp | 22 +++++------- src/Volume/Volume.h | 20 ++--------- src/Volume/VolumeHeader.cpp | 23 +++--------- src/Volume/VolumeHeader.h | 4 +-- src/Volume/VolumeInfo.cpp | 3 -- src/Volume/VolumeInfo.h | 1 - src/Volume/VolumeLayout.cpp | 15 ++++---- src/Volume/VolumeLayout.h | 4 +-- 42 files changed, 133 insertions(+), 348 deletions(-) diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 6318d915..fabd39be 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -5822,11 +5822,6 @@ void handleError (HWND hwndDlg, int code, const char* srcPos) // A non-error break; - case ERR_UNSUPPORTED_TRUECRYPT_FORMAT: - StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("UNSUPPORTED_TRUECRYPT_FORMAT"), (code >> 24), (code >> 16) & 0x000000FF); - MessageBoxW (hwndDlg, AppendSrcPos (szTmp, srcPos).c_str(), lpszTitle, ICON_HAND); - break; - #ifndef SETUP case ERR_RAND_INIT_FAILED: StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("INIT_RAND"), SRC_POS, GetLastError ()); diff --git a/src/Common/Tcdefs.h b/src/Common/Tcdefs.h index 021b2d13..ce2243d5 100644 --- a/src/Common/Tcdefs.h +++ b/src/Common/Tcdefs.h @@ -487,9 +487,8 @@ enum ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG = 31, ERR_NONSYS_INPLACE_ENC_INCOMPLETE = 32, ERR_USER_ABORT = 33, - ERR_UNSUPPORTED_TRUECRYPT_FORMAT = 34, - ERR_RAND_INIT_FAILED = 35, - ERR_CAPI_INIT_FAILED = 36 + ERR_RAND_INIT_FAILED = 34, + ERR_CAPI_INIT_FAILED = 35 }; #endif // #ifndef TCDEFS_H diff --git a/src/Core/Core.h b/src/Core/Core.h index 78b2bf3d..65ea5bee 100644 --- a/src/Core/Core.h +++ b/src/Core/Core.h @@ -75,7 +75,6 @@ namespace VeraCrypt shared_ptr m_password; int m_pim; shared_ptr m_kdf; - bool m_truecryptMode; shared_ptr m_keyfiles; shared_ptr m_newPassword; int m_newPim; @@ -83,9 +82,9 @@ namespace VeraCrypt shared_ptr m_newPkcs5Kdf; int m_wipeCount; bool m_emvSupportEnabled; - ChangePasswordThreadRoutine(shared_ptr volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr kdf, bool truecryptMode, shared_ptr keyfiles, shared_ptr newPassword, int newPim, shared_ptr newKeyfiles, shared_ptr newPkcs5Kdf, int wipeCount, bool emvSupportEnabled) : m_volumePath(volumePath), m_preserveTimestamps(preserveTimestamps), m_password(password), m_pim(pim), m_kdf(kdf), m_truecryptMode(truecryptMode), m_keyfiles(keyfiles), m_newPassword(newPassword), m_newPim(newPim), m_newKeyfiles(newKeyfiles), m_newPkcs5Kdf(newPkcs5Kdf), m_wipeCount(wipeCount), m_emvSupportEnabled(emvSupportEnabled) {} + ChangePasswordThreadRoutine(shared_ptr volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr kdf, shared_ptr keyfiles, shared_ptr newPassword, int newPim, shared_ptr newKeyfiles, shared_ptr newPkcs5Kdf, int wipeCount, bool emvSupportEnabled) : m_volumePath(volumePath), m_preserveTimestamps(preserveTimestamps), m_password(password), m_pim(pim), m_kdf(kdf), m_keyfiles(keyfiles), m_newPassword(newPassword), m_newPim(newPim), m_newKeyfiles(newKeyfiles), m_newPkcs5Kdf(newPkcs5Kdf), m_wipeCount(wipeCount), m_emvSupportEnabled(emvSupportEnabled) {} virtual ~ChangePasswordThreadRoutine() { } - virtual void ExecutionCode(void) { Core->ChangePassword(m_volumePath, m_preserveTimestamps, m_password, m_pim, m_kdf, m_truecryptMode, m_keyfiles, m_newPassword, m_newPim, m_newKeyfiles, m_emvSupportEnabled, m_newPkcs5Kdf, m_wipeCount); } + virtual void ExecutionCode(void) { Core->ChangePassword(m_volumePath, m_preserveTimestamps, m_password, m_pim, m_kdf, m_keyfiles, m_newPassword, m_newPim, m_newKeyfiles, m_emvSupportEnabled, m_newPkcs5Kdf, m_wipeCount); } }; class OpenVolumeThreadRoutine : public WaitThreadRoutine @@ -96,7 +95,6 @@ namespace VeraCrypt shared_ptr m_password; int m_pim; shared_ptr m_Kdf; - bool m_truecryptMode; shared_ptr m_keyfiles; VolumeProtection::Enum m_protection; shared_ptr m_protectionPassword; @@ -110,14 +108,14 @@ namespace VeraCrypt shared_ptr m_pVolume; bool m_emvSupportEnabled; - OpenVolumeThreadRoutine(shared_ptr volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr Kdf, bool truecryptMode, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr protectionPassword = shared_ptr (), int protectionPim = 0, shared_ptr protectionKdf = shared_ptr (), shared_ptr protectionKeyfiles = shared_ptr (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false): - m_volumePath(volumePath), m_preserveTimestamps(preserveTimestamps), m_password(password), m_pim(pim), m_Kdf(Kdf), m_truecryptMode(truecryptMode), m_keyfiles(keyfiles), + OpenVolumeThreadRoutine(shared_ptr volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr Kdf, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr protectionPassword = shared_ptr (), int protectionPim = 0, shared_ptr protectionKdf = shared_ptr (), shared_ptr protectionKeyfiles = shared_ptr (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false): + m_volumePath(volumePath), m_preserveTimestamps(preserveTimestamps), m_password(password), m_pim(pim), m_Kdf(Kdf), m_keyfiles(keyfiles), m_protection(protection), m_protectionPassword(protectionPassword), m_protectionPim(protectionPim), m_protectionKdf(protectionKdf), m_protectionKeyfiles(protectionKeyfiles), m_sharedAccessAllowed(sharedAccessAllowed), m_volumeType(volumeType),m_useBackupHeaders(useBackupHeaders), m_partitionInSystemEncryptionScope(partitionInSystemEncryptionScope), m_emvSupportEnabled(emvSupportEnabled) {} ~OpenVolumeThreadRoutine() {} - virtual void ExecutionCode(void) { m_pVolume = Core->OpenVolume(m_volumePath,m_preserveTimestamps,m_password,m_pim,m_Kdf,m_truecryptMode,m_keyfiles, m_emvSupportEnabled, m_protection,m_protectionPassword,m_protectionPim,m_protectionKdf, m_protectionKeyfiles,m_sharedAccessAllowed,m_volumeType,m_useBackupHeaders, m_partitionInSystemEncryptionScope); } + virtual void ExecutionCode(void) { m_pVolume = Core->OpenVolume(m_volumePath,m_preserveTimestamps,m_password,m_pim,m_Kdf,m_keyfiles, m_emvSupportEnabled, m_protection,m_protectionPassword,m_protectionPim,m_protectionKdf, m_protectionKeyfiles,m_sharedAccessAllowed,m_volumeType,m_useBackupHeaders, m_partitionInSystemEncryptionScope); } }; @@ -144,15 +142,14 @@ namespace VeraCrypt const VolumePassword &m_password; int m_pim; shared_ptr m_kdf; - bool m_truecryptMode; const Pkcs5KdfList &m_keyDerivationFunctions; const EncryptionAlgorithmList &m_encryptionAlgorithms; const EncryptionModeList &m_encryptionModes; bool m_bResult; - DecryptThreadRoutine(shared_ptr header, const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr kdf, bool truecryptMode, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes) - : m_pHeader(header), m_encryptedData(encryptedData), m_password(password), m_pim(pim), m_kdf(kdf), m_truecryptMode(truecryptMode), m_keyDerivationFunctions(keyDerivationFunctions), m_encryptionAlgorithms(encryptionAlgorithms), m_encryptionModes(encryptionModes), m_bResult(false){} + DecryptThreadRoutine(shared_ptr header, const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr kdf, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes) + : m_pHeader(header), m_encryptedData(encryptedData), m_password(password), m_pim(pim), m_kdf(kdf), m_keyDerivationFunctions(keyDerivationFunctions), m_encryptionAlgorithms(encryptionAlgorithms), m_encryptionModes(encryptionModes), m_bResult(false){} virtual ~DecryptThreadRoutine() { } - virtual void ExecutionCode(void) { m_bResult = m_pHeader->Decrypt(m_encryptedData, m_password, m_pim, m_kdf, m_truecryptMode, m_keyDerivationFunctions, m_encryptionAlgorithms, m_encryptionModes); } + virtual void ExecutionCode(void) { m_bResult = m_pHeader->Decrypt(m_encryptedData, m_password, m_pim, m_kdf, m_keyDerivationFunctions, m_encryptionAlgorithms, m_encryptionModes); } }; class WaitThreadUI diff --git a/src/Core/CoreBase.cpp b/src/Core/CoreBase.cpp index d31c9689..c1016726 100644 --- a/src/Core/CoreBase.cpp +++ b/src/Core/CoreBase.cpp @@ -37,13 +37,7 @@ namespace VeraCrypt if (!newPkcs5Kdf) { - if (openVolume->GetPkcs5Kdf()->GetTrueCryptMode ()) - { - newPkcs5Kdf.reset (openVolume->GetPkcs5Kdf()->Clone()); - newPkcs5Kdf->SetTrueCryptMode (false); - } - else - newPkcs5Kdf = openVolume->GetPkcs5Kdf(); + newPkcs5Kdf = openVolume->GetPkcs5Kdf(); } if ((openVolume->GetHeader()->GetFlags() & TC_HEADER_FLAG_ENCRYPTED_SYSTEM) != 0 @@ -83,9 +77,9 @@ namespace VeraCrypt } } - void CoreBase::ChangePassword (shared_ptr volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr kdf, bool truecryptMode, shared_ptr keyfiles, shared_ptr newPassword, int newPim, shared_ptr newKeyfiles, bool emvSupportEnabled, shared_ptr newPkcs5Kdf, int wipeCount) const + void CoreBase::ChangePassword (shared_ptr volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr kdf, shared_ptr keyfiles, shared_ptr newPassword, int newPim, shared_ptr newKeyfiles, bool emvSupportEnabled, shared_ptr newPkcs5Kdf, int wipeCount) const { - shared_ptr volume = OpenVolume (volumePath, preserveTimestamps, password, pim, kdf, truecryptMode, keyfiles, emvSupportEnabled); + shared_ptr volume = OpenVolume (volumePath, preserveTimestamps, password, pim, kdf, keyfiles, emvSupportEnabled); ChangePassword (volume, newPassword, newPim, newKeyfiles, emvSupportEnabled, newPkcs5Kdf, wipeCount); } @@ -261,10 +255,10 @@ namespace VeraCrypt return false; } - shared_ptr CoreBase::OpenVolume (shared_ptr volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr kdf, bool truecryptMode, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr protectionPassword, int protectionPim, shared_ptr protectionKdf, shared_ptr protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) const + shared_ptr CoreBase::OpenVolume (shared_ptr volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr kdf, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr protectionPassword, int protectionPim, shared_ptr protectionKdf, shared_ptr protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) const { make_shared_auto (Volume, volume); - volume->Open (*volumePath, preserveTimestamps, password, pim, kdf, truecryptMode, keyfiles, emvSupportEnabled, protection, protectionPassword, protectionPim, protectionKdf, protectionKeyfiles, sharedAccessAllowed, volumeType, useBackupHeaders, partitionInSystemEncryptionScope); + volume->Open (*volumePath, preserveTimestamps, password, pim, kdf, keyfiles, emvSupportEnabled, protection, protectionPassword, protectionPim, protectionKdf, protectionKeyfiles, sharedAccessAllowed, volumeType, useBackupHeaders, partitionInSystemEncryptionScope); return volume; } diff --git a/src/Core/CoreBase.h b/src/Core/CoreBase.h index bd37ecb9..03aa922a 100644 --- a/src/Core/CoreBase.h +++ b/src/Core/CoreBase.h @@ -34,7 +34,7 @@ namespace VeraCrypt virtual ~CoreBase (); virtual void ChangePassword (shared_ptr openVolume, shared_ptr newPassword, int newPim, shared_ptr newKeyfiles, bool emvSupportEnabled, shared_ptr newPkcs5Kdf = shared_ptr (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const; - virtual void ChangePassword (shared_ptr volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr kdf, bool truecryptMode, shared_ptr keyfiles, shared_ptr newPassword, int newPim, shared_ptr newKeyfiles, bool emvSupportEnabled, shared_ptr newPkcs5Kdf = shared_ptr (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const; + virtual void ChangePassword (shared_ptr volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr kdf, shared_ptr keyfiles, shared_ptr newPassword, int newPim, shared_ptr newKeyfiles, bool emvSupportEnabled, shared_ptr newPkcs5Kdf = shared_ptr (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const; virtual void CheckFilesystem (shared_ptr mountedVolume, bool repair = false) const = 0; virtual void CoalesceSlotNumberAndMountPoint (MountOptions &options) const; virtual void CreateKeyfile (const FilePath &keyfilePath) const; @@ -69,7 +69,7 @@ namespace VeraCrypt virtual bool IsVolumeMounted (const VolumePath &volumePath) const; virtual VolumeSlotNumber MountPointToSlotNumber (const DirectoryPath &mountPoint) const = 0; virtual shared_ptr MountVolume (MountOptions &options) = 0; - virtual shared_ptr OpenVolume (shared_ptr volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr Kdf, bool truecryptMode, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr protectionPassword = shared_ptr (), int protectionPim = 0, shared_ptr protectionKdf = shared_ptr (), shared_ptr protectionKeyfiles = shared_ptr (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false) const; + virtual shared_ptr OpenVolume (shared_ptr volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr Kdf, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr protectionPassword = shared_ptr (), int protectionPim = 0, shared_ptr protectionKdf = shared_ptr (), shared_ptr protectionKeyfiles = shared_ptr (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false) const; virtual void RandomizeEncryptionAlgorithmKey (shared_ptr encryptionAlgorithm) const; virtual void ReEncryptVolumeHeaderWithNewSalt (const BufferPtr &newHeaderBuffer, shared_ptr header, shared_ptr password, int pim, shared_ptr keyfiles, bool emvSupportEnabled) const; virtual void SetAdminPasswordCallback (shared_ptr functor) { } diff --git a/src/Core/MountOptions.cpp b/src/Core/MountOptions.cpp index 52e12396..2f28c089 100644 --- a/src/Core/MountOptions.cpp +++ b/src/Core/MountOptions.cpp @@ -52,7 +52,6 @@ namespace VeraCrypt TC_CLONE (SharedAccessAllowed); TC_CLONE (SlotNumber); TC_CLONE (UseBackupHeaders); - TC_CLONE (TrueCryptMode); } void MountOptions::Deserialize (shared_ptr stream) @@ -101,14 +100,12 @@ namespace VeraCrypt sr.Deserialize ("SlotNumber", SlotNumber); sr.Deserialize ("UseBackupHeaders", UseBackupHeaders); - sr.Deserialize ("TrueCryptMode", TrueCryptMode); - try { if (!sr.DeserializeBool ("KdfNull")) { sr.Deserialize ("Kdf", nameValue); - Kdf = Pkcs5Kdf::GetAlgorithm (nameValue, TrueCryptMode); + Kdf = Pkcs5Kdf::GetAlgorithm (nameValue); } } catch(...) {} @@ -118,7 +115,7 @@ namespace VeraCrypt if (!sr.DeserializeBool ("ProtectionKdfNull")) { sr.Deserialize ("ProtectionKdf", nameValue); - ProtectionKdf = Pkcs5Kdf::GetAlgorithm (nameValue, TrueCryptMode); + ProtectionKdf = Pkcs5Kdf::GetAlgorithm (nameValue); } } catch(...) {} @@ -167,8 +164,6 @@ namespace VeraCrypt sr.Serialize ("SlotNumber", SlotNumber); sr.Serialize ("UseBackupHeaders", UseBackupHeaders); - sr.Serialize ("TrueCryptMode", TrueCryptMode); - sr.Serialize ("KdfNull", Kdf == nullptr); if (Kdf) sr.Serialize ("Kdf", Kdf->GetName()); diff --git a/src/Core/MountOptions.h b/src/Core/MountOptions.h index 02762806..3dcfa599 100644 --- a/src/Core/MountOptions.h +++ b/src/Core/MountOptions.h @@ -37,8 +37,7 @@ namespace VeraCrypt Removable (false), SharedAccessAllowed (false), SlotNumber (0), - UseBackupHeaders (false), - TrueCryptMode (false) + UseBackupHeaders (false) { } @@ -72,7 +71,6 @@ namespace VeraCrypt bool SharedAccessAllowed; VolumeSlotNumber SlotNumber; bool UseBackupHeaders; - bool TrueCryptMode; bool EMVSupportEnabled; protected: diff --git a/src/Core/Unix/CoreUnix.cpp b/src/Core/Unix/CoreUnix.cpp index bbc60e3c..a2b06f3d 100644 --- a/src/Core/Unix/CoreUnix.cpp +++ b/src/Core/Unix/CoreUnix.cpp @@ -546,7 +546,6 @@ namespace VeraCrypt options.Password, options.Pim, options.Kdf, - options.TrueCryptMode, options.Keyfiles, options.EMVSupportEnabled, options.Protection, diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp index a7189652..2bbc73ea 100644 --- a/src/Main/CommandLineInterface.cpp +++ b/src/Main/CommandLineInterface.cpp @@ -29,7 +29,6 @@ namespace VeraCrypt ArgPim (-1), ArgSize (0), ArgVolumeType (VolumeType::Unknown), - ArgTrueCryptMode (false), ArgDisableFileSizeCheck (false), ArgUseLegacyPassword (false), #if defined(TC_LINUX ) || defined (TC_FREEBSD) @@ -92,7 +91,6 @@ namespace VeraCrypt parser.AddSwitch (L"", L"quick", _("Enable quick format")); parser.AddOption (L"", L"size", _("Size in bytes")); parser.AddOption (L"", L"slot", _("Volume slot number")); - parser.AddSwitch (L"tc",L"truecrypt", _("Enable TrueCrypt mode. Should be put first to avoid issues.")); parser.AddSwitch (L"", L"test", _("Test internal algorithms")); parser.AddSwitch (L"t", L"text", _("Use text user interface")); parser.AddOption (L"", L"token-lib", _("Security token library")); @@ -357,9 +355,8 @@ namespace VeraCrypt ArgForce = parser.Found (L"force"); - ArgTrueCryptMode = parser.Found (L"truecrypt"); ArgDisableFileSizeCheck = parser.Found (L"no-size-check"); - ArgUseLegacyPassword = parser.Found (L"legacy-password-maxlength") || ArgTrueCryptMode; + ArgUseLegacyPassword = parser.Found (L"legacy-password-maxlength"); #if defined(TC_LINUX ) || defined (TC_FREEBSD) ArgUseDummySudoPassword = parser.Found (L"use-dummy-sudo-password"); #endif @@ -449,8 +446,6 @@ namespace VeraCrypt if (ArgNewPim < 0 || ArgNewPim > (ArgMountOptions.PartitionInSystemEncryptionScope? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE)) throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); - else if (ArgNewPim > 0 && ArgTrueCryptMode) - throw_err (LangString["PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]); } if (parser.Found (L"non-interactive")) @@ -489,8 +484,6 @@ namespace VeraCrypt if (ArgPim < 0 || ArgPim > (ArgMountOptions.PartitionInSystemEncryptionScope? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE)) throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); - else if (ArgPim > 0 && ArgTrueCryptMode) - throw_err (LangString["PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]); } if (parser.Found (L"protect-hidden", &str)) @@ -545,7 +538,7 @@ namespace VeraCrypt if (hashName.IsSameAs (str, false) || hashAltName.IsSameAs (str, false)) { bHashFound = true; - ArgMountOptions.ProtectionKdf = Pkcs5Kdf::GetAlgorithm (*hash, ArgTrueCryptMode); + ArgMountOptions.ProtectionKdf = Pkcs5Kdf::GetAlgorithm (*hash); } } diff --git a/src/Main/CommandLineInterface.h b/src/Main/CommandLineInterface.h index 6a31932e..4003dc05 100644 --- a/src/Main/CommandLineInterface.h +++ b/src/Main/CommandLineInterface.h @@ -83,7 +83,6 @@ namespace VeraCrypt shared_ptr ArgVolumePath; VolumeInfoList ArgVolumes; VolumeType::Enum ArgVolumeType; - bool ArgTrueCryptMode; shared_ptr ArgTokenPin; bool ArgDisableFileSizeCheck; bool ArgUseLegacyPassword; diff --git a/src/Main/Forms/BenchmarkDialog.cpp b/src/Main/Forms/BenchmarkDialog.cpp index 18712274..7b0209ff 100644 --- a/src/Main/Forms/BenchmarkDialog.cpp +++ b/src/Main/Forms/BenchmarkDialog.cpp @@ -273,7 +273,7 @@ namespace VeraCrypt Buffer salt(64); const char *tmp_salt = {"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF"}; unsigned long pim; - Pkcs5KdfList prfList = Pkcs5Kdf::GetAvailableAlgorithms (false); + Pkcs5KdfList prfList = Pkcs5Kdf::GetAvailableAlgorithms (); VolumePassword password ((const byte*) "passphrase-1234567890", 21); memcpy (&pim, buffer.Ptr (), sizeof (unsigned long)); diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp index 0b54fefc..397ee693 100644 --- a/src/Main/Forms/ChangePasswordDialog.cpp +++ b/src/Main/Forms/ChangePasswordDialog.cpp @@ -35,12 +35,6 @@ namespace VeraCrypt bool enableNewPassword = false; bool enableNewKeyfiles = false; bool enablePkcs5Prf = false; - bool isTrueCryptFile = false; - - if (volumePath && volumePath->HasTrueCryptExtension ()) - { - isTrueCryptFile = true; - } switch (mode) { @@ -73,12 +67,11 @@ namespace VeraCrypt GraphicUserInterface::InstallPasswordEntryCustomKeyboardShortcuts (this); #endif - CurrentPasswordPanel = new VolumePasswordPanel (this, NULL, password, false, keyfiles, false, true, true, false, true, true); + CurrentPasswordPanel = new VolumePasswordPanel (this, NULL, password, keyfiles, false, true, true, false, true, true); CurrentPasswordPanel->UpdateEvent.Connect (EventConnector (this, &ChangePasswordDialog::OnPasswordPanelUpdate)); - CurrentPasswordPanel->SetTrueCryptMode (isTrueCryptFile); CurrentPasswordPanelSizer->Add (CurrentPasswordPanel, 1, wxALL | wxEXPAND); - NewPasswordPanel = new VolumePasswordPanel (this, NULL, newPassword, true, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf); + NewPasswordPanel = new VolumePasswordPanel (this, NULL, newPassword, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf); NewPasswordPanel->UpdateEvent.Connect (EventConnector (this, &ChangePasswordDialog::OnPasswordPanelUpdate)); NewPasswordPanelSizer->Add (NewPasswordPanel, 1, wxALL | wxEXPAND); @@ -107,13 +100,7 @@ namespace VeraCrypt try { - bool bUnsupportedKdf = false; - shared_ptr currentKdf = CurrentPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf); - if (bUnsupportedKdf) - { - Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]); - return; - } + shared_ptr currentKdf = CurrentPasswordPanel->GetPkcs5Kdf(); int currentPim = CurrentPasswordPanel->GetVolumePim(); if (-1 == currentPim) { @@ -182,7 +169,7 @@ namespace VeraCrypt /* force the display of the random enriching interface */ RandomNumberGenerator::SetEnrichedByUserStatus (false); - Gui->UserEnrichRandomPool (this, NewPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf) ? NewPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf)->GetHash() : shared_ptr ()); + Gui->UserEnrichRandomPool (this, NewPasswordPanel->GetPkcs5Kdf() ? NewPasswordPanel->GetPkcs5Kdf()->GetHash() : shared_ptr ()); { #ifdef TC_UNIX @@ -203,8 +190,8 @@ namespace VeraCrypt #endif wxBusyCursor busy; ChangePasswordThreadRoutine routine(Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps, - CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetVolumePim(), CurrentPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf), CurrentPasswordPanel->GetTrueCryptMode(),CurrentPasswordPanel->GetKeyfiles(), - newPassword, newPim, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf), NewPasswordPanel->GetHeaderWipeCount(), Gui->GetPreferences().EMVSupportEnabled); + CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetVolumePim(), CurrentPasswordPanel->GetPkcs5Kdf(), CurrentPasswordPanel->GetKeyfiles(), + newPassword, newPim, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(), NewPasswordPanel->GetHeaderWipeCount(), Gui->GetPreferences().EMVSupportEnabled); Gui->ExecuteWaitThreadRoutine (this, &routine); } diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp index 4b9b9bf1..2e34ef85 100644 --- a/src/Main/Forms/MainFrame.cpp +++ b/src/Main/Forms/MainFrame.cpp @@ -642,13 +642,9 @@ namespace VeraCrypt try { MountOptions mountOptions (GetPreferences().DefaultMountOptions); - if (CmdLine->ArgTrueCryptMode) - { - mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode; - } if (CmdLine->ArgHash) { - mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); + mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash); } if (CmdLine->ArgPim > 0) { @@ -671,13 +667,9 @@ namespace VeraCrypt try { MountOptions mountOptions (GetPreferences().DefaultMountOptions); - if (CmdLine->ArgTrueCryptMode) - { - mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode; - } if (CmdLine->ArgHash) { - mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); + mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash); } if (CmdLine->ArgPim > 0) { @@ -706,13 +698,9 @@ namespace VeraCrypt MountOptions mountOptions (GetPreferences().DefaultMountOptions); mountOptions.SlotNumber = SelectedSlotNumber; mountOptions.Path = GetSelectedVolumePath(); - if (CmdLine->ArgTrueCryptMode) - { - mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode; - } if (CmdLine->ArgHash) { - mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); + mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash); } if (CmdLine->ArgPim > 0) { @@ -964,13 +952,9 @@ namespace VeraCrypt SetVolumePath (favorite.Path); MountOptions mountOptions (GetPreferences().DefaultMountOptions); - if (CmdLine->ArgTrueCryptMode) - { - mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode; - } if (CmdLine->ArgHash) { - mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); + mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash); } if (CmdLine->ArgPim > 0) { @@ -1706,7 +1690,7 @@ namespace VeraCrypt #endif fields[ColumnPath] = volume->Path; fields[ColumnSize] = Gui->SizeToString (volume->Size); - fields[ColumnType] = Gui->VolumeTypeToString (volume->Type, volume->TrueCryptMode, volume->Protection); + fields[ColumnType] = Gui->VolumeTypeToString (volume->Type, volume->Protection); if (volume->HiddenVolumeProtectionTriggered) { diff --git a/src/Main/Forms/MountOptionsDialog.cpp b/src/Main/Forms/MountOptionsDialog.cpp index 4b8f7ce5..85a06d1e 100644 --- a/src/Main/Forms/MountOptionsDialog.cpp +++ b/src/Main/Forms/MountOptionsDialog.cpp @@ -50,14 +50,8 @@ namespace VeraCrypt GraphicUserInterface::InstallPasswordEntryCustomKeyboardShortcuts (this); #endif - PasswordPanel = new VolumePasswordPanel (this, &options, options.Password, disableMountOptions, options.Keyfiles, !disableMountOptions, true, true, false, true, true); + PasswordPanel = new VolumePasswordPanel (this, &options, options.Password, options.Keyfiles, !disableMountOptions, true, true, false, true, true); PasswordPanel->SetCacheCheckBoxValidator (wxGenericValidator (&Options.CachePassword)); - - if (options.Path && options.Path->HasTrueCryptExtension() && !disableMountOptions - && !options.TrueCryptMode && (options.Pim <= 0)) - { - PasswordPanel->SetTrueCryptMode (true); - } PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND); @@ -88,7 +82,7 @@ namespace VeraCrypt OptionsButton->SetLabel (OptionsButtonLabel + L" >"); OptionsPanel->Show (false); - ProtectionPasswordPanel = new VolumePasswordPanel (ProtectionSizer->GetStaticBox(), &options, options.ProtectionPassword, true, options.ProtectionKeyfiles, false, true, true, false, true, true, LangString["IDT_HIDDEN_PROT_PASSWD"]); + ProtectionPasswordPanel = new VolumePasswordPanel (ProtectionSizer->GetStaticBox(), &options, options.ProtectionPassword, options.ProtectionKeyfiles, false, true, true, false, true, true, LangString["IDT_HIDDEN_PROT_PASSWD"]); ProtectionPasswordPanel->TopOwnerParent = this; ProtectionPasswordSizer->Add (ProtectionPasswordPanel, 1, wxALL | wxEXPAND); @@ -110,8 +104,6 @@ namespace VeraCrypt void MountOptionsDialog::OnOKButtonClick (wxCommandEvent& event) { - bool bUnsupportedKdf = false; - /* verify that PIM values are valid before continuing*/ int Pim = PasswordPanel->GetVolumePim(); int ProtectionPim = (!ReadOnlyCheckBox->IsChecked() && ProtectionCheckBox->IsChecked())? @@ -149,13 +141,7 @@ namespace VeraCrypt } Options.Pim = Pim; - Options.Kdf = PasswordPanel->GetPkcs5Kdf(bUnsupportedKdf); - if (bUnsupportedKdf) - { - Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]); - return; - } - Options.TrueCryptMode = PasswordPanel->GetTrueCryptMode(); + Options.Kdf = PasswordPanel->GetPkcs5Kdf(); Options.Keyfiles = PasswordPanel->GetKeyfiles(); if (ReadOnlyCheckBox->IsChecked()) @@ -166,7 +152,7 @@ namespace VeraCrypt { try { - Options.ProtectionPassword = ProtectionPasswordPanel->GetPassword(Options.TrueCryptMode); + Options.ProtectionPassword = ProtectionPasswordPanel->GetPassword(false); } catch (PasswordException& e) { @@ -175,12 +161,7 @@ namespace VeraCrypt } Options.Protection = VolumeProtection::HiddenVolumeReadOnly; Options.ProtectionPim = ProtectionPim; - Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf(Options.TrueCryptMode, bUnsupportedKdf); - if (bUnsupportedKdf) - { - Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]); - return; - } + Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf(); Options.ProtectionKeyfiles = ProtectionPasswordPanel->GetKeyfiles(); } else diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp index abf1d505..91204389 100644 --- a/src/Main/Forms/PreferencesDialog.cpp +++ b/src/Main/Forms/PreferencesDialog.cpp @@ -53,12 +53,10 @@ namespace VeraCrypt FilesystemOptionsTextCtrl->SetValue (Preferences.DefaultMountOptions.FilesystemOptions); - TrueCryptModeCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.TrueCryptMode)); - int index, prfInitialIndex = 0; Pkcs5PrfChoice->Append (LangString["AUTODETECTION"]); - foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms(false)) + foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms()) { index = Pkcs5PrfChoice->Append (kdf.GetName()); if (Preferences.DefaultMountOptions.Kdf @@ -370,11 +368,10 @@ namespace VeraCrypt { try { - selectedKdf = Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection ()), TrueCryptModeCheckBox->IsChecked ()); + selectedKdf = Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection ())); } catch (ParameterIncorrect&) { - Gui->ShowWarning ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"); return; } } diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp index 5939fc1b..2653ff66 100644 --- a/src/Main/Forms/VolumeCreationWizard.cpp +++ b/src/Main/Forms/VolumeCreationWizard.cpp @@ -479,7 +479,6 @@ namespace VeraCrypt mountOptions.Pim = Pim; mountOptions.Keyfiles = Keyfiles; mountOptions.Kdf = Kdf; - mountOptions.TrueCryptMode = false; shared_ptr volume = Core->MountVolume (mountOptions); finally_do_arg (shared_ptr , volume, { Core->DismountVolume (finally_arg, true); }); @@ -1031,7 +1030,7 @@ namespace VeraCrypt options->Quick = QuickFormatEnabled; options->Size = VolumeSize; options->Type = OuterVolume ? VolumeType::Normal : SelectedVolumeType; - options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*SelectedHash, false); + options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*SelectedHash); options->EMVSupportEnabled = Gui->GetPreferences().EMVSupportEnabled; @@ -1127,7 +1126,7 @@ namespace VeraCrypt }); #endif - shared_ptr outerVolume = Core->OpenVolume (make_shared (SelectedVolumePath), true, Password, Pim, Kdf, false, Keyfiles, VolumeProtection::ReadOnly); + shared_ptr outerVolume = Core->OpenVolume (make_shared (SelectedVolumePath), true, Password, Pim, Kdf, Keyfiles, VolumeProtection::ReadOnly); try { MaxHiddenVolumeSize = Core->GetMaxHiddenVolumeSize (outerVolume); diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp index 5bd98daa..32b92edc 100644 --- a/src/Main/Forms/VolumePasswordPanel.cpp +++ b/src/Main/Forms/VolumePasswordPanel.cpp @@ -18,7 +18,7 @@ namespace VeraCrypt { - VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr password, bool disableTruecryptMode, shared_ptr keyfiles, bool enableCache, bool enablePassword, bool enableKeyfiles, bool enableConfirmation, bool enablePkcs5Prf, bool isMountPassword, const wxString &passwordLabel) + VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr password, shared_ptr keyfiles, bool enableCache, bool enablePassword, bool enableKeyfiles, bool enableConfirmation, bool enablePkcs5Prf, bool isMountPassword, const wxString &passwordLabel) : VolumePasswordPanelBase (parent), TopOwnerParent(NULL), Keyfiles (new KeyfileList), EnablePimEntry (true) { size_t maxPasswordLength = CmdLine->ArgUseLegacyPassword? VolumePassword::MaxLegacySize : VolumePassword::MaxSize; @@ -78,22 +78,9 @@ namespace VeraCrypt Pkcs5PrfStaticText->Show (enablePkcs5Prf); Pkcs5PrfChoice->Show (enablePkcs5Prf); - TrueCryptModeCheckBox->Show (!disableTruecryptMode); HeaderWipeCountText->Show (enablePkcs5Prf && !isMountPassword); HeaderWipeCount->Show (enablePkcs5Prf && !isMountPassword); - if (options && !disableTruecryptMode) - { - TrueCryptModeCheckBox->SetValue (options->TrueCryptMode); - if (options->TrueCryptMode) - { - PimCheckBox->Enable (false); - VolumePimStaticText->Enable (false); - VolumePimTextCtrl->Enable (false); - VolumePimHelpStaticText->Enable (false); - } - } - if (EnablePimEntry && options && options->Pim > 0) { PimCheckBox->SetValue (true); @@ -113,7 +100,7 @@ namespace VeraCrypt Pkcs5PrfChoice->Delete (0); Pkcs5PrfChoice->Append (LangString["AUTODETECTION"]); } - foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms(false)) + foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms()) { if (!kdf.IsDeprecated() || isMountPassword) { @@ -221,7 +208,7 @@ namespace VeraCrypt shared_ptr VolumePasswordPanel::GetPassword (bool bForceLegacyPassword) const { - return GetPassword (PasswordTextCtrl, bForceLegacyPassword || GetTrueCryptMode()); + return GetPassword (PasswordTextCtrl, bForceLegacyPassword); } shared_ptr VolumePasswordPanel::GetPassword (wxTextCtrl *textCtrl, bool bLegacyPassword) const @@ -246,14 +233,8 @@ namespace VeraCrypt return password; } - shared_ptr VolumePasswordPanel::GetPkcs5Kdf (bool &bUnsupportedKdf) const - { - return GetPkcs5Kdf (GetTrueCryptMode(), bUnsupportedKdf); - } - - shared_ptr VolumePasswordPanel::GetPkcs5Kdf (bool bTrueCryptMode, bool &bUnsupportedKdf) const + shared_ptr VolumePasswordPanel::GetPkcs5Kdf () const { - bUnsupportedKdf = false; try { int index = Pkcs5PrfChoice->GetSelection (); @@ -263,11 +244,10 @@ namespace VeraCrypt return shared_ptr (); } else - return Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection()), bTrueCryptMode); + return Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection())); } catch (ParameterIncorrect&) { - bUnsupportedKdf = true; return shared_ptr (); } } @@ -303,21 +283,6 @@ namespace VeraCrypt } } - bool VolumePasswordPanel::GetTrueCryptMode () const - { - return TrueCryptModeCheckBox->GetValue (); - } - - void VolumePasswordPanel::SetTrueCryptMode (bool trueCryptMode) - { - bool bEnablePIM = !trueCryptMode; - TrueCryptModeCheckBox->SetValue (trueCryptMode); - PimCheckBox->Enable (bEnablePIM); - VolumePimStaticText->Enable (bEnablePIM); - VolumePimTextCtrl->Enable (bEnablePIM); - VolumePimHelpStaticText->Enable (bEnablePIM); - } - int VolumePasswordPanel::GetHeaderWipeCount () const { try @@ -515,13 +480,4 @@ namespace VeraCrypt layoutParent->Fit(); } } - - void VolumePasswordPanel::OnTrueCryptModeChecked( wxCommandEvent& event ) - { - bool bEnablePIM = !GetTrueCryptMode (); - PimCheckBox->Enable (bEnablePIM); - VolumePimStaticText->Enable (bEnablePIM); - VolumePimTextCtrl->Enable (bEnablePIM); - VolumePimHelpStaticText->Enable (bEnablePIM); - } } diff --git a/src/Main/Forms/VolumePasswordPanel.h b/src/Main/Forms/VolumePasswordPanel.h index e9b81e29..7019e8fd 100644 --- a/src/Main/Forms/VolumePasswordPanel.h +++ b/src/Main/Forms/VolumePasswordPanel.h @@ -22,17 +22,14 @@ namespace VeraCrypt class VolumePasswordPanel : public VolumePasswordPanelBase { public: - VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr password, bool disableTruecryptMode, shared_ptr keyfiles, bool enableCache = false, bool enablePassword = true, bool enableKeyfiles = true, bool enableConfirmation = false, bool enablePkcs5Prf = false, bool isMountPassword = false, const wxString &passwordLabel = wxString()); + VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr password, shared_ptr keyfiles, bool enableCache = false, bool enablePassword = true, bool enableKeyfiles = true, bool enableConfirmation = false, bool enablePkcs5Prf = false, bool isMountPassword = false, const wxString &passwordLabel = wxString()); virtual ~VolumePasswordPanel (); void AddKeyfile (shared_ptr keyfile); shared_ptr GetKeyfiles () const { return UseKeyfilesCheckBox->IsChecked() ? Keyfiles : shared_ptr (); } shared_ptr GetPassword (bool bForceLegacyPassword = false) const; - shared_ptr GetPkcs5Kdf (bool &bUnsupportedKdf) const; - shared_ptr GetPkcs5Kdf (bool bTrueCryptMode, bool &bUnsupportedKdf) const; + shared_ptr GetPkcs5Kdf () const; int GetVolumePim () const; - bool GetTrueCryptMode () const; - void SetTrueCryptMode (bool trueCryptMode); int GetHeaderWipeCount () const; void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); } void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); } @@ -64,7 +61,6 @@ namespace VeraCrypt void OnUpdate () { UpdateEvent.Raise(); } void OnUseKeyfilesCheckBoxClick (wxCommandEvent& event) { OnUpdate(); } void WipeTextCtrl (wxTextCtrl *textCtrl); - void OnTrueCryptModeChecked( wxCommandEvent& event ); shared_ptr Keyfiles; shared_ptr UpdateCallback; diff --git a/src/Main/Forms/VolumePasswordWizardPage.cpp b/src/Main/Forms/VolumePasswordWizardPage.cpp index 274a59f5..859a613a 100644 --- a/src/Main/Forms/VolumePasswordWizardPage.cpp +++ b/src/Main/Forms/VolumePasswordWizardPage.cpp @@ -19,7 +19,7 @@ namespace VeraCrypt VolumePasswordWizardPage::VolumePasswordWizardPage (wxPanel* parent, shared_ptr password, shared_ptr keyfiles, bool enableConfirmation) : VolumePasswordWizardPageBase (parent), ConfirmationMode (enableConfirmation) { - PasswordPanel = new VolumePasswordPanel (this, NULL, password, true, keyfiles, false, true, true, enableConfirmation, !enableConfirmation, !enableConfirmation); + PasswordPanel = new VolumePasswordPanel (this, NULL, password, keyfiles, false, true, true, enableConfirmation, !enableConfirmation, !enableConfirmation); PasswordPanel->UpdateEvent.Connect (EventConnector (this, &VolumePasswordWizardPage::OnPasswordPanelUpdate)); PasswordPanelSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND); diff --git a/src/Main/Forms/VolumePasswordWizardPage.h b/src/Main/Forms/VolumePasswordWizardPage.h index a9a2872c..525db216 100644 --- a/src/Main/Forms/VolumePasswordWizardPage.h +++ b/src/Main/Forms/VolumePasswordWizardPage.h @@ -30,7 +30,7 @@ namespace VeraCrypt bool IsPimSelected () const { return PasswordPanel->IsUsePimChecked ();} void SetPimSelected (bool selected) const { PasswordPanel->SetUsePimChecked (selected);} - shared_ptr GetPkcs5Kdf () const { bool bUnsupportedKdf; return PasswordPanel->GetPkcs5Kdf(bUnsupportedKdf); } + shared_ptr GetPkcs5Kdf () const { return PasswordPanel->GetPkcs5Kdf(); } bool IsValid (); void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); } void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } diff --git a/src/Main/Forms/VolumePropertiesDialog.cpp b/src/Main/Forms/VolumePropertiesDialog.cpp index 4332e844..3bba33bc 100644 --- a/src/Main/Forms/VolumePropertiesDialog.cpp +++ b/src/Main/Forms/VolumePropertiesDialog.cpp @@ -36,7 +36,7 @@ namespace VeraCrypt AppendToList ("VIRTUAL_DEVICE", wstring (volumeInfo.VirtualDevice)); #endif AppendToList ("SIZE", Gui->SizeToString (volumeInfo.Size)); - AppendToList ("TYPE", Gui->VolumeTypeToString (volumeInfo.Type, volumeInfo.TrueCryptMode, volumeInfo.Protection)); + AppendToList ("TYPE", Gui->VolumeTypeToString (volumeInfo.Type, volumeInfo.Protection)); AppendToList ("READ_ONLY", LangString [volumeInfo.Protection == VolumeProtection::ReadOnly ? "UISTR_YES" : "UISTR_NO"]); wxString protection; diff --git a/src/Main/Forms/WaitDialog.cpp b/src/Main/Forms/WaitDialog.cpp index 720c2bdc..d53656f9 100644 --- a/src/Main/Forms/WaitDialog.cpp +++ b/src/Main/Forms/WaitDialog.cpp @@ -96,8 +96,6 @@ namespace VeraCrypt VC_CONVERT_EXCEPTION (SecurityTokenLibraryNotInitialized); VC_CONVERT_EXCEPTION (SecurityTokenKeyfileAlreadyExists); VC_CONVERT_EXCEPTION (SecurityTokenKeyfileNotFound); - VC_CONVERT_EXCEPTION (UnsupportedAlgoInTrueCryptMode); - VC_CONVERT_EXCEPTION (UnsupportedTrueCryptFormat); VC_CONVERT_EXCEPTION (SystemException); VC_CONVERT_EXCEPTION (CipherException); VC_CONVERT_EXCEPTION (VolumeException); diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp index 6786e9a8..16db8f83 100644 --- a/src/Main/GraphicUserInterface.cpp +++ b/src/Main/GraphicUserInterface.cpp @@ -191,7 +191,6 @@ namespace VeraCrypt options->Password, options->Pim, options->Kdf, - false, options->Keyfiles, options->EMVSupportEnabled, options->Protection, @@ -220,7 +219,6 @@ namespace VeraCrypt options->Password, options->Pim, options->Kdf, - false, options->Keyfiles, options->EMVSupportEnabled, options->Protection, @@ -835,7 +833,7 @@ namespace VeraCrypt options.Keyfiles = make_shared (GetPreferences().DefaultKeyfiles); if ((options.Password && !options.Password->IsEmpty()) - || (options.Keyfiles && !options.Keyfiles->empty() && (options.TrueCryptMode || options.Password))) + || (options.Keyfiles && !options.Keyfiles->empty() && options.Password)) { try { @@ -1466,7 +1464,6 @@ namespace VeraCrypt options.Password, options.Pim, options.Kdf, - options.TrueCryptMode, options.Keyfiles, options.EMVSupportEnabled, options.Protection, @@ -1583,11 +1580,11 @@ namespace VeraCrypt // Decrypt header shared_ptr passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password, options.EMVSupportEnabled); - Pkcs5KdfList keyDerivationFunctions = layout->GetSupportedKeyDerivationFunctions(options.TrueCryptMode); + Pkcs5KdfList keyDerivationFunctions = layout->GetSupportedKeyDerivationFunctions(); EncryptionAlgorithmList encryptionAlgorithms = layout->GetSupportedEncryptionAlgorithms(); EncryptionModeList encryptionModes = layout->GetSupportedEncryptionModes(); - DecryptThreadRoutine decryptRoutine(layout->GetHeader(), headerBuffer, *passwordKey, options.Pim, options.Kdf, options.TrueCryptMode, keyDerivationFunctions, encryptionAlgorithms, encryptionModes); + DecryptThreadRoutine decryptRoutine(layout->GetHeader(), headerBuffer, *passwordKey, options.Pim, options.Kdf, keyDerivationFunctions, encryptionAlgorithms, encryptionModes); ExecuteWaitThreadRoutine (parent, &decryptRoutine); diff --git a/src/Main/GraphicUserInterface.h b/src/Main/GraphicUserInterface.h index 820a4831..d48b7973 100644 --- a/src/Main/GraphicUserInterface.h +++ b/src/Main/GraphicUserInterface.h @@ -34,7 +34,7 @@ namespace VeraCrypt virtual void BackupVolumeHeaders (shared_ptr volumePath) const; virtual void BeginBusyState () const { wxBeginBusyCursor(); } virtual void BeginInteractiveBusyState (wxWindow *window); - virtual void ChangePassword (shared_ptr volumePath = shared_ptr (), shared_ptr password = shared_ptr (), int pim = 0, shared_ptr currentHash = shared_ptr (), bool truecryptMode = false, shared_ptr keyfiles = shared_ptr (), shared_ptr newPassword = shared_ptr (), int newPim = 0, shared_ptr newKeyfiles = shared_ptr (), shared_ptr newHash = shared_ptr ()) const { ThrowTextModeRequired(); } + virtual void ChangePassword (shared_ptr volumePath = shared_ptr (), shared_ptr password = shared_ptr (), int pim = 0, shared_ptr currentHash = shared_ptr (), shared_ptr keyfiles = shared_ptr (), shared_ptr newPassword = shared_ptr (), int newPim = 0, shared_ptr newKeyfiles = shared_ptr (), shared_ptr newHash = shared_ptr ()) const { ThrowTextModeRequired(); } wxHyperlinkCtrl *CreateHyperlink (wxWindow *parent, const wxString &linkUrl, const wxString &linkText) const; virtual void CreateKeyfile (shared_ptr keyfilePath = shared_ptr ()) const; virtual void CreateVolume (shared_ptr options) const { ThrowTextModeRequired(); } diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp index 22df8e1f..37b346bd 100644 --- a/src/Main/TextUserInterface.cpp +++ b/src/Main/TextUserInterface.cpp @@ -277,7 +277,7 @@ namespace VeraCrypt shared_ptr kdf; if (CmdLine->ArgHash) { - kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, false); + kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash); } shared_ptr normalVolume; @@ -315,7 +315,6 @@ namespace VeraCrypt options->Password, options->Pim, kdf, - false, options->Keyfiles, options->EMVSupportEnabled, options->Protection, @@ -341,7 +340,6 @@ namespace VeraCrypt options->Password, options->Pim, kdf, - false, options->Keyfiles, options->EMVSupportEnabled, options->Protection, @@ -437,7 +435,7 @@ namespace VeraCrypt ShowInfo ("VOL_HEADER_BACKED_UP"); } - void TextUserInterface::ChangePassword (shared_ptr volumePath, shared_ptr password, int pim, shared_ptr currentHash, bool truecryptMode, shared_ptr keyfiles, shared_ptr newPassword, int newPim, shared_ptr newKeyfiles, shared_ptr newHash) const + void TextUserInterface::ChangePassword (shared_ptr volumePath, shared_ptr password, int pim, shared_ptr currentHash, shared_ptr keyfiles, shared_ptr newPassword, int newPim, shared_ptr newKeyfiles, shared_ptr newHash) const { shared_ptr volume; @@ -459,7 +457,7 @@ namespace VeraCrypt shared_ptr kdf; if (currentHash) { - kdf = Pkcs5Kdf::GetAlgorithm (*currentHash, truecryptMode); + kdf = Pkcs5Kdf::GetAlgorithm (*currentHash); } while (true) @@ -475,7 +473,7 @@ namespace VeraCrypt } // current PIM - if (!truecryptMode && !Preferences.NonInteractive && (pim < 0)) + if (!Preferences.NonInteractive && (pim < 0)) { pim = AskPim (_("Enter current PIM")); } @@ -489,7 +487,7 @@ namespace VeraCrypt try { keyfiles.reset (new KeyfileList); - volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, truecryptMode, keyfiles, true); + volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, keyfiles, true); } catch (PasswordException&) { @@ -499,7 +497,7 @@ namespace VeraCrypt } if (!volume.get()) - volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, truecryptMode, keyfiles, true); + volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, keyfiles, true); } catch (PasswordException &e) { @@ -535,7 +533,7 @@ namespace VeraCrypt UserEnrichRandomPool(); Core->ChangePassword (volume, newPassword, newPim, newKeyfiles, true, - newHash ? Pkcs5Kdf::GetAlgorithm (*newHash, false) : shared_ptr ()); + newHash ? Pkcs5Kdf::GetAlgorithm (*newHash) : shared_ptr ()); ShowInfo ("PASSWORD_CHANGED"); } @@ -815,7 +813,7 @@ namespace VeraCrypt shared_ptr selectedHash = hashes[AskSelection (hashes.size(), 1) - 1]; RandomNumberGenerator::SetHash (selectedHash); - options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*selectedHash, false); + options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*selectedHash); } @@ -1266,7 +1264,7 @@ namespace VeraCrypt if (!options.Password) options.Password = AskPassword(); - if (!options.TrueCryptMode && (options.Pim < 0)) + if (options.Pim < 0) options.Pim = AskPim (_("Enter PIM")); if (!options.Keyfiles) @@ -1336,7 +1334,7 @@ namespace VeraCrypt options.Password = AskPassword (StringFormatter (_("Enter password for {0}"), wstring (*options.Path))); } - if (!options.TrueCryptMode && (options.Pim < 0)) + if (options.Pim < 0) { options.Pim = AskPim (StringFormatter (_("Enter PIM for {0}"), wstring (*options.Path))); } @@ -1355,7 +1353,7 @@ namespace VeraCrypt { if (!options.ProtectionPassword) options.ProtectionPassword = AskPassword (_("Enter password for hidden volume")); - if (!options.TrueCryptMode && (options.ProtectionPim < 0)) + if (options.ProtectionPim < 0) options.ProtectionPim = AskPim (_("Enter PIM for hidden volume")); if (!options.ProtectionKeyfiles) options.ProtectionKeyfiles = AskKeyfiles (_("Enter keyfile for hidden volume")); @@ -1504,7 +1502,7 @@ namespace VeraCrypt shared_ptr kdf; if (CmdLine->ArgHash) { - kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, false); + kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash); } ShowInfo (LangString["HEADER_RESTORE_EXTERNAL_INTERNAL"]); @@ -1551,7 +1549,6 @@ namespace VeraCrypt options.Password, options.Pim, kdf, - false, options.Keyfiles, options.EMVSupportEnabled, options.Protection, @@ -1660,7 +1657,7 @@ namespace VeraCrypt // Decrypt header shared_ptr passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password, options.EMVSupportEnabled); - if (layout->GetHeader()->Decrypt (headerBuffer, *passwordKey, options.Pim, kdf, false, layout->GetSupportedKeyDerivationFunctions(false), layout->GetSupportedEncryptionAlgorithms(), layout->GetSupportedEncryptionModes())) + if (layout->GetHeader()->Decrypt (headerBuffer, *passwordKey, options.Pim, kdf, layout->GetSupportedKeyDerivationFunctions(), layout->GetSupportedEncryptionAlgorithms(), layout->GetSupportedEncryptionModes())) { decryptedLayout = layout; break; diff --git a/src/Main/TextUserInterface.h b/src/Main/TextUserInterface.h index dc16fe97..becb1d59 100644 --- a/src/Main/TextUserInterface.h +++ b/src/Main/TextUserInterface.h @@ -35,7 +35,7 @@ namespace VeraCrypt virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const; virtual void BackupVolumeHeaders (shared_ptr volumePath) const; virtual void BeginBusyState () const { } - virtual void ChangePassword (shared_ptr volumePath = shared_ptr (), shared_ptr password = shared_ptr (), int pim = 0, shared_ptr currentHash = shared_ptr (), bool truecryptMode = false, shared_ptr keyfiles = shared_ptr (), shared_ptr newPassword = shared_ptr (), int newPim = 0, shared_ptr newKeyfiles = shared_ptr (), shared_ptr newHash = shared_ptr ()) const; + virtual void ChangePassword (shared_ptr volumePath = shared_ptr (), shared_ptr password = shared_ptr (), int pim = 0, shared_ptr currentHash = shared_ptr (), shared_ptr keyfiles = shared_ptr (), shared_ptr newPassword = shared_ptr (), int newPim = 0, shared_ptr newKeyfiles = shared_ptr (), shared_ptr newHash = shared_ptr ()) const; virtual void CreateKeyfile (shared_ptr keyfilePath = shared_ptr ()) const; virtual void CreateVolume (shared_ptr options) const; virtual void DeleteSecurityTokenKeyfiles () const; diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp index 05f254ea..822c53c7 100644 --- a/src/Main/UserInterface.cpp +++ b/src/Main/UserInterface.cpp @@ -255,7 +255,7 @@ namespace VeraCrypt #endif prop << LangString["MOUNT_POINT"] << L": " << wstring (volume.MountPoint) << L'\n'; prop << LangString["SIZE"] << L": " << SizeToString (volume.Size) << L'\n'; - prop << LangString["TYPE"] << L": " << VolumeTypeToString (volume.Type, volume.TrueCryptMode, volume.Protection) << L'\n'; + prop << LangString["TYPE"] << L": " << VolumeTypeToString (volume.Type, volume.Protection) << L'\n'; prop << LangString["READ_ONLY"] << L": " << LangString [volume.Protection == VolumeProtection::ReadOnly ? "UISTR_YES" : "UISTR_NO"] << L'\n'; @@ -527,8 +527,6 @@ namespace VeraCrypt EX2MSG (VolumeEncryptionNotCompleted, LangString["ERR_ENCRYPTION_NOT_COMPLETED"]); EX2MSG (VolumeHostInUse, LangString["LINUX_EX2MSG_VOLUMEHOSTINUSE"]); EX2MSG (VolumeSlotUnavailable, LangString["LINUX_EX2MSG_VOLUMESLOTUNAVAILABLE"]); - EX2MSG (UnsupportedAlgoInTrueCryptMode, LangString["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]); - EX2MSG (UnsupportedTrueCryptFormat, LangString["UNSUPPORTED_TRUECRYPT_FORMAT"]); #ifdef TC_MACOSX EX2MSG (HigherFuseVersionRequired, LangString["LINUX_EX2MSG_HIGHERFUSEVERSIONREQUIRED"]); @@ -967,10 +965,9 @@ namespace VeraCrypt cmdLine.ArgMountOptions.Pim = cmdLine.ArgPim; cmdLine.ArgMountOptions.Keyfiles = cmdLine.ArgKeyfiles; cmdLine.ArgMountOptions.SharedAccessAllowed = cmdLine.ArgForce; - cmdLine.ArgMountOptions.TrueCryptMode = cmdLine.ArgTrueCryptMode; if (cmdLine.ArgHash) { - cmdLine.ArgMountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash, cmdLine.ArgTrueCryptMode); + cmdLine.ArgMountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash); } @@ -1055,7 +1052,7 @@ namespace VeraCrypt return true; case CommandId::ChangePassword: - ChangePassword (cmdLine.ArgVolumePath, cmdLine.ArgPassword, cmdLine.ArgPim, cmdLine.ArgHash, cmdLine.ArgTrueCryptMode, cmdLine.ArgKeyfiles, cmdLine.ArgNewPassword, cmdLine.ArgNewPim, cmdLine.ArgNewKeyfiles, cmdLine.ArgNewHash); + ChangePassword (cmdLine.ArgVolumePath, cmdLine.ArgPassword, cmdLine.ArgPim, cmdLine.ArgHash, cmdLine.ArgKeyfiles, cmdLine.ArgNewPassword, cmdLine.ArgNewPim, cmdLine.ArgNewKeyfiles, cmdLine.ArgNewHash); return true; case CommandId::CreateKeyfile: @@ -1068,7 +1065,7 @@ namespace VeraCrypt if (cmdLine.ArgHash) { - options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash, false); + options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash); RandomNumberGenerator::SetHash (cmdLine.ArgHash); } @@ -1324,11 +1321,6 @@ namespace VeraCrypt " Use text user interface. Graphical user interface is used by default if\n" " available. This option must be specified as the first argument.\n" "\n" - "-tc, --truecrypt\n" - " Enable TrueCrypt compatibility mode to enable mounting volumes created\n" - " by TrueCrypt 6.x or 7.x. This option must be specified as the first\n" - " argument, or immediately after --text.\n" - "\n" "--token-lib=LIB_PATH\n" " Use specified PKCS #11 security token library.\n" "\n" @@ -1600,7 +1592,7 @@ namespace VeraCrypt return dateStr; } - wxString UserInterface::VolumeTypeToString (VolumeType::Enum type, bool truecryptMode, VolumeProtection::Enum protection) const + wxString UserInterface::VolumeTypeToString (VolumeType::Enum type, VolumeProtection::Enum protection) const { wxString sResult; switch (type) @@ -1618,8 +1610,6 @@ namespace VeraCrypt break; } - if (truecryptMode) - sResult = wxT("TrueCrypt-") + sResult; return sResult; } @@ -1693,8 +1683,6 @@ namespace VeraCrypt VC_CONVERT_EXCEPTION (SecurityTokenLibraryNotInitialized); VC_CONVERT_EXCEPTION (SecurityTokenKeyfileAlreadyExists); VC_CONVERT_EXCEPTION (SecurityTokenKeyfileNotFound); - VC_CONVERT_EXCEPTION (UnsupportedAlgoInTrueCryptMode); - VC_CONVERT_EXCEPTION (UnsupportedTrueCryptFormat); VC_CONVERT_EXCEPTION (SystemException); VC_CONVERT_EXCEPTION (CipherException); VC_CONVERT_EXCEPTION (VolumeException); diff --git a/src/Main/UserInterface.h b/src/Main/UserInterface.h index 39c2be61..41415e9d 100644 --- a/src/Main/UserInterface.h +++ b/src/Main/UserInterface.h @@ -33,7 +33,7 @@ namespace VeraCrypt virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const = 0; virtual void BackupVolumeHeaders (shared_ptr volumePath) const = 0; virtual void BeginBusyState () const = 0; - virtual void ChangePassword (shared_ptr volumePath = shared_ptr (), shared_ptr password = shared_ptr (), int pim = 0, shared_ptr currentHash = shared_ptr (), bool truecryptMode = false, shared_ptr keyfiles = shared_ptr (), shared_ptr newPassword = shared_ptr (), int newPim = 0, shared_ptr newKeyfiles = shared_ptr (), shared_ptr newHash = shared_ptr ()) const = 0; + virtual void ChangePassword (shared_ptr volumePath = shared_ptr (), shared_ptr password = shared_ptr (), int pim = 0, shared_ptr currentHash = shared_ptr (), shared_ptr keyfiles = shared_ptr (), shared_ptr newPassword = shared_ptr (), int newPim = 0, shared_ptr newKeyfiles = shared_ptr (), shared_ptr newHash = shared_ptr ()) const = 0; virtual void CheckRequirementsForMountingVolume () const; virtual void CloseExplorerWindows (shared_ptr mountedVolume) const; virtual void CreateKeyfile (shared_ptr keyfilePath = shared_ptr ()) const = 0; @@ -85,7 +85,7 @@ namespace VeraCrypt virtual WaitThreadUI* GetWaitThreadUI(WaitThreadRoutine *pRoutine) const { return new WaitThreadUI(pRoutine);} virtual wxDateTime VolumeTimeToDateTime (VolumeTime volumeTime) const { return wxDateTime ((time_t) (volumeTime / 1000ULL / 1000 / 10 - 134774ULL * 24 * 3600)); } virtual wxString VolumeTimeToString (VolumeTime volumeTime) const; - virtual wxString VolumeTypeToString (VolumeType::Enum type, bool truecryptMode, VolumeProtection::Enum protection) const; + virtual wxString VolumeTypeToString (VolumeType::Enum type, VolumeProtection::Enum protection) const; Event PreferencesUpdatedEvent; diff --git a/src/Main/UserPreferences.cpp b/src/Main/UserPreferences.cpp index ef14b2c8..9dbd35f6 100644 --- a/src/Main/UserPreferences.cpp +++ b/src/Main/UserPreferences.cpp @@ -110,8 +110,6 @@ namespace VeraCrypt TC_CONFIG_SET (WipeCacheOnAutoDismount); TC_CONFIG_SET (WipeCacheOnClose); - SetValue (configMap[L"DefaultTrueCryptMode"], DefaultMountOptions.TrueCryptMode); - wstring defaultPrf; SetValue (configMap[L"DefaultPRF"], defaultPrf); @@ -119,7 +117,7 @@ namespace VeraCrypt try { if (defaultPrf != L"autodetection") - savedKdf = Pkcs5Kdf::GetAlgorithm (defaultPrf, DefaultMountOptions.TrueCryptMode); + savedKdf = Pkcs5Kdf::GetAlgorithm (defaultPrf); } catch (ParameterIncorrect&) { @@ -225,8 +223,6 @@ namespace VeraCrypt TC_CONFIG_ADD (WipeCacheOnAutoDismount); TC_CONFIG_ADD (WipeCacheOnClose); - formatter.AddEntry (L"DefaultTrueCryptMode", DefaultMountOptions.TrueCryptMode); - wstring defaultPrf = L"autodetection"; if (DefaultMountOptions.Kdf) defaultPrf = DefaultMountOptions.Kdf->GetName (); diff --git a/src/Platform/Exception.h b/src/Platform/Exception.h index c9635414..36981a74 100644 --- a/src/Platform/Exception.h +++ b/src/Platform/Exception.h @@ -96,8 +96,6 @@ namespace VeraCrypt TC_EXCEPTION (TestFailed); \ TC_EXCEPTION (TimeOut); \ TC_EXCEPTION (UnknownException); \ - TC_EXCEPTION (UnsupportedAlgoInTrueCryptMode); \ - TC_EXCEPTION (UnsupportedTrueCryptFormat); \ TC_EXCEPTION (UserAbort) TC_EXCEPTION_SET; diff --git a/src/SetupDLL/Setup.c b/src/SetupDLL/Setup.c index 63a0ccfb..ba0e860b 100644 --- a/src/SetupDLL/Setup.c +++ b/src/SetupDLL/Setup.c @@ -1151,11 +1151,6 @@ void handleError_Dll (MSIHANDLE hInstaller, int code, const char* srcPos) // A non-error break; - case ERR_UNSUPPORTED_TRUECRYPT_FORMAT: - StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("UNSUPPORTED_TRUECRYPT_FORMAT"), (code >> 24), (code >> 16) & 0x000000FF); - MSILogAndShow (hInstaller, MSI_ERROR_LEVEL, AppendSrcPos (szTmp, srcPos).c_str()); - break; - default: StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("ERR_UNKNOWN"), code); MSILogAndShow (hInstaller, MSI_ERROR_LEVEL, AppendSrcPos (szTmp, srcPos).c_str()); diff --git a/src/Volume/EncryptionTest.cpp b/src/Volume/EncryptionTest.cpp index 5c251bd5..bb9c3a0b 100644 --- a/src/Volume/EncryptionTest.cpp +++ b/src/Volume/EncryptionTest.cpp @@ -1086,12 +1086,12 @@ namespace VeraCrypt if (memcmp (derivedKey.Ptr(), "\x8d\x51\xfa\x31", 4) != 0) throw TestFailed (SRC_POS); - Pkcs5HmacSha512 pkcs5HmacSha512(false); + Pkcs5HmacSha512 pkcs5HmacSha512; pkcs5HmacSha512.DeriveKey (derivedKey, password, salt, 5); if (memcmp (derivedKey.Ptr(), "\x13\x64\xae\xf8", 4) != 0) throw TestFailed (SRC_POS); - Pkcs5HmacWhirlpool pkcs5HmacWhirlpool(false); + Pkcs5HmacWhirlpool pkcs5HmacWhirlpool; pkcs5HmacWhirlpool.DeriveKey (derivedKey, password, salt, 5); if (memcmp (derivedKey.Ptr(), "\x50\x7c\x36\x6f", 4) != 0) throw TestFailed (SRC_POS); diff --git a/src/Volume/Pkcs5Kdf.cpp b/src/Volume/Pkcs5Kdf.cpp index fee057a8..ff49cefe 100644 --- a/src/Volume/Pkcs5Kdf.cpp +++ b/src/Volume/Pkcs5Kdf.cpp @@ -16,7 +16,7 @@ namespace VeraCrypt { - Pkcs5Kdf::Pkcs5Kdf (bool truecryptMode) : m_truecryptMode(truecryptMode) + Pkcs5Kdf::Pkcs5Kdf () { } @@ -29,9 +29,9 @@ namespace VeraCrypt DeriveKey (key, password, salt, GetIterationCount(pim)); } - shared_ptr Pkcs5Kdf::GetAlgorithm (const wstring &name, bool truecryptMode) + shared_ptr Pkcs5Kdf::GetAlgorithm (const wstring &name) { - foreach (shared_ptr kdf, GetAvailableAlgorithms(truecryptMode)) + foreach (shared_ptr kdf, GetAvailableAlgorithms()) { if (kdf->GetName() == name) return kdf; @@ -39,9 +39,9 @@ namespace VeraCrypt throw ParameterIncorrect (SRC_POS); } - shared_ptr Pkcs5Kdf::GetAlgorithm (const Hash &hash, bool truecryptMode) + shared_ptr Pkcs5Kdf::GetAlgorithm (const Hash &hash) { - foreach (shared_ptr kdf, GetAvailableAlgorithms(truecryptMode)) + foreach (shared_ptr kdf, GetAvailableAlgorithms()) { if (typeid (*kdf->GetHash()) == typeid (hash)) return kdf; @@ -50,23 +50,15 @@ namespace VeraCrypt throw ParameterIncorrect (SRC_POS); } - Pkcs5KdfList Pkcs5Kdf::GetAvailableAlgorithms (bool truecryptMode) + Pkcs5KdfList Pkcs5Kdf::GetAvailableAlgorithms () { Pkcs5KdfList l; - if (truecryptMode) - { - l.push_back (shared_ptr (new Pkcs5HmacSha512 (true))); - l.push_back (shared_ptr (new Pkcs5HmacWhirlpool (true))); - } - else - { - l.push_back (shared_ptr (new Pkcs5HmacSha512 (false))); - l.push_back (shared_ptr (new Pkcs5HmacSha256 ())); - l.push_back (shared_ptr (new Pkcs5HmacBlake2s ())); - l.push_back (shared_ptr (new Pkcs5HmacWhirlpool (false))); - l.push_back (shared_ptr (new Pkcs5HmacStreebog ())); - } + l.push_back (shared_ptr (new Pkcs5HmacSha512 ())); + l.push_back (shared_ptr (new Pkcs5HmacSha256 ())); + l.push_back (shared_ptr (new Pkcs5HmacBlake2s ())); + l.push_back (shared_ptr (new Pkcs5HmacWhirlpool ())); + l.push_back (shared_ptr (new Pkcs5HmacStreebog ())); return l; } diff --git a/src/Volume/Pkcs5Kdf.h b/src/Volume/Pkcs5Kdf.h index 25ad76e8..9071caf0 100644 --- a/src/Volume/Pkcs5Kdf.h +++ b/src/Volume/Pkcs5Kdf.h @@ -29,20 +29,17 @@ namespace VeraCrypt virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, int pim, const ConstBufferPtr &salt) const; virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const = 0; - static shared_ptr GetAlgorithm (const wstring &name, bool truecryptMode); - static shared_ptr GetAlgorithm (const Hash &hash, bool truecryptMode); - static Pkcs5KdfList GetAvailableAlgorithms (bool truecryptMode); + static shared_ptr GetAlgorithm (const wstring &name); + static shared_ptr GetAlgorithm (const Hash &hash); + static Pkcs5KdfList GetAvailableAlgorithms (); virtual shared_ptr GetHash () const = 0; virtual int GetIterationCount (int pim) const = 0; virtual wstring GetName () const = 0; virtual Pkcs5Kdf* Clone () const = 0; virtual bool IsDeprecated () const { return GetHash()->IsDeprecated(); } - bool GetTrueCryptMode () const { return m_truecryptMode;} - void SetTrueCryptMode (bool truecryptMode) { m_truecryptMode = truecryptMode;} protected: - bool m_truecryptMode; - Pkcs5Kdf (bool truecryptMode); + Pkcs5Kdf (); void ValidateParameters (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; @@ -54,7 +51,7 @@ namespace VeraCrypt class Pkcs5HmacBlake2s_Boot : public Pkcs5Kdf { public: - Pkcs5HmacBlake2s_Boot () : Pkcs5Kdf(false) { } + Pkcs5HmacBlake2s_Boot () : Pkcs5Kdf() { } virtual ~Pkcs5HmacBlake2s_Boot () { } virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; @@ -71,7 +68,7 @@ namespace VeraCrypt class Pkcs5HmacBlake2s : public Pkcs5Kdf { public: - Pkcs5HmacBlake2s () : Pkcs5Kdf(false) { } + Pkcs5HmacBlake2s () : Pkcs5Kdf() { } virtual ~Pkcs5HmacBlake2s () { } virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; @@ -88,7 +85,7 @@ namespace VeraCrypt class Pkcs5HmacSha256_Boot : public Pkcs5Kdf { public: - Pkcs5HmacSha256_Boot () : Pkcs5Kdf(false) { } + Pkcs5HmacSha256_Boot () : Pkcs5Kdf() { } virtual ~Pkcs5HmacSha256_Boot () { } virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; @@ -105,7 +102,7 @@ namespace VeraCrypt class Pkcs5HmacSha256 : public Pkcs5Kdf { public: - Pkcs5HmacSha256 () : Pkcs5Kdf(false) { } + Pkcs5HmacSha256 () : Pkcs5Kdf() { } virtual ~Pkcs5HmacSha256 () { } virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; @@ -122,14 +119,14 @@ namespace VeraCrypt class Pkcs5HmacSha512 : public Pkcs5Kdf { public: - Pkcs5HmacSha512 (bool truecryptMode) : Pkcs5Kdf(truecryptMode) { } + Pkcs5HmacSha512 () : Pkcs5Kdf() { } virtual ~Pkcs5HmacSha512 () { } virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; virtual shared_ptr GetHash () const { return shared_ptr (new Sha512); } - virtual int GetIterationCount (int pim) const { return m_truecryptMode? 1000 : (pim <= 0 ? 500000 : (15000 + (pim * 1000))); } + virtual int GetIterationCount (int pim) const { return (pim <= 0 ? 500000 : (15000 + (pim * 1000))); } virtual wstring GetName () const { return L"HMAC-SHA-512"; } - virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacSha512(m_truecryptMode); } + virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacSha512(); } private: Pkcs5HmacSha512 (const Pkcs5HmacSha512 &); @@ -139,14 +136,14 @@ namespace VeraCrypt class Pkcs5HmacWhirlpool : public Pkcs5Kdf { public: - Pkcs5HmacWhirlpool (bool truecryptMode) : Pkcs5Kdf(truecryptMode) { } + Pkcs5HmacWhirlpool () : Pkcs5Kdf() { } virtual ~Pkcs5HmacWhirlpool () { } virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; virtual shared_ptr GetHash () const { return shared_ptr (new Whirlpool); } - virtual int GetIterationCount (int pim) const { return m_truecryptMode? 1000 : (pim <= 0 ? 500000 : (15000 + (pim * 1000))); } + virtual int GetIterationCount (int pim) const { return (pim <= 0 ? 500000 : (15000 + (pim * 1000))); } virtual wstring GetName () const { return L"HMAC-Whirlpool"; } - virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacWhirlpool(m_truecryptMode); } + virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacWhirlpool(); } private: Pkcs5HmacWhirlpool (const Pkcs5HmacWhirlpool &); @@ -156,7 +153,7 @@ namespace VeraCrypt class Pkcs5HmacStreebog : public Pkcs5Kdf { public: - Pkcs5HmacStreebog () : Pkcs5Kdf(false) { } + Pkcs5HmacStreebog () : Pkcs5Kdf() { } virtual ~Pkcs5HmacStreebog () { } virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; @@ -173,7 +170,7 @@ namespace VeraCrypt class Pkcs5HmacStreebog_Boot : public Pkcs5Kdf { public: - Pkcs5HmacStreebog_Boot () : Pkcs5Kdf(false) { } + Pkcs5HmacStreebog_Boot () : Pkcs5Kdf() { } virtual ~Pkcs5HmacStreebog_Boot () { } virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; diff --git a/src/Volume/Volume.cpp b/src/Volume/Volume.cpp index 57707726..524f2395 100644 --- a/src/Volume/Volume.cpp +++ b/src/Volume/Volume.cpp @@ -30,7 +30,6 @@ namespace VeraCrypt TopWriteOffset (0), TotalDataRead (0), TotalDataWritten (0), - TrueCryptMode (false), Pim (0), EncryptionNotCompleted (false) { @@ -71,7 +70,7 @@ namespace VeraCrypt return EA->GetMode(); } - void Volume::Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr kdf, bool truecryptMode, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr protectionPassword, int protectionPim, shared_ptr protectionKdf, shared_ptr protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) + void Volume::Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr kdf, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr protectionPassword, int protectionPim, shared_ptr protectionKdf, shared_ptr protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) { make_shared_auto (File, file); @@ -102,18 +101,14 @@ namespace VeraCrypt throw; } - return Open (file, password, pim, kdf, truecryptMode, keyfiles, emvSupportEnabled, protection, protectionPassword, protectionPim, protectionKdf,protectionKeyfiles, volumeType, useBackupHeaders, partitionInSystemEncryptionScope); + return Open (file, password, pim, kdf, keyfiles, emvSupportEnabled, protection, protectionPassword, protectionPim, protectionKdf,protectionKeyfiles, volumeType, useBackupHeaders, partitionInSystemEncryptionScope); } - void Volume::Open (shared_ptr volumeFile, shared_ptr password, int pim, shared_ptr kdf, bool truecryptMode, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr protectionPassword, int protectionPim, shared_ptr protectionKdf,shared_ptr protectionKeyfiles, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) + void Volume::Open (shared_ptr volumeFile, shared_ptr password, int pim, shared_ptr kdf, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr protectionPassword, int protectionPim, shared_ptr protectionKdf,shared_ptr protectionKeyfiles, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) { if (!volumeFile) throw ParameterIncorrect (SRC_POS); - // TrueCrypt doesn't support SHA-256 and Streebog - if (kdf && truecryptMode && (kdf->GetName() == L"HMAC-SHA-256" || kdf->GetName() == L"HMAC-Streebog")) - throw UnsupportedAlgoInTrueCryptMode (SRC_POS); - Protection = protection; VolumeFile = volumeFile; SystemEncryption = partitionInSystemEncryptionScope; @@ -190,11 +185,11 @@ namespace VeraCrypt shared_ptr header = layout->GetHeader(); - if (header->Decrypt (headerBuffer, *passwordKey, pim, kdf, truecryptMode, layout->GetSupportedKeyDerivationFunctions(truecryptMode), layoutEncryptionAlgorithms, layoutEncryptionModes)) + if (header->Decrypt (headerBuffer, *passwordKey, pim, kdf, layout->GetSupportedKeyDerivationFunctions(), layoutEncryptionAlgorithms, layoutEncryptionModes)) { // Header decrypted - if (!truecryptMode && typeid (*layout) == typeid (VolumeLayoutV2Normal) && header->GetRequiredMinProgramVersion() < 0x10b) + if (typeid (*layout) == typeid (VolumeLayoutV2Normal) && header->GetRequiredMinProgramVersion() < 0x10b) { // VolumeLayoutV1Normal has been opened as VolumeLayoutV2Normal layout.reset (new VolumeLayoutV1Normal); @@ -202,7 +197,6 @@ namespace VeraCrypt layout->SetHeader (header); } - TrueCryptMode = truecryptMode; Pim = pim; Type = layout->GetType(); SectorSize = header->GetSectorSize(); @@ -248,7 +242,7 @@ namespace VeraCrypt Volume protectedVolume; protectedVolume.Open (VolumeFile, - protectionPassword, protectionPim, protectionKdf, truecryptMode, protectionKeyfiles, + protectionPassword, protectionPim, protectionKdf, protectionKeyfiles, emvSupportEnabled, VolumeProtection::ReadOnly, shared_ptr (), 0, shared_ptr (),shared_ptr (), @@ -287,8 +281,8 @@ namespace VeraCrypt Buffer mbr (VolumeFile->GetDeviceSectorSize()); driveDevice.ReadAt (mbr, 0); - // Search for the string "VeraCrypt" or "TrueCrypt" - const char* bootSignature = truecryptMode? "TrueCrypt" : TC_APP_NAME; + // Search for the string "VeraCrypt" + const char* bootSignature = TC_APP_NAME; size_t nameLen = strlen (bootSignature); for (size_t i = 0; i < mbr.Size() - nameLen; ++i) { diff --git a/src/Volume/Volume.h b/src/Volume/Volume.h index e50dd0e7..c816da58 100644 --- a/src/Volume/Volume.h +++ b/src/Volume/Volume.h @@ -52,20 +52,6 @@ namespace VeraCrypt return Data.substr (pos + 1); } } - - bool HasTrueCryptExtension () const - { - wstring sExt = GetExtension (); - if ((sExt.size () == 2) - && (sExt[0] == L't' || sExt[0] == L'T') - && (sExt[1] == L'c' || sExt[1] == L'C') - ) - { - return true; - } - else - return false; - } protected: wstring Data; @@ -118,13 +104,12 @@ namespace VeraCrypt uint64 GetTotalDataRead () const { return TotalDataRead; } uint64 GetTotalDataWritten () const { return TotalDataWritten; } VolumeType::Enum GetType () const { return Type; } - bool GetTrueCryptMode() const { return TrueCryptMode; } int GetPim() const { return Pim;} uint64 GetVolumeCreationTime () const { return Header->GetVolumeCreationTime(); } bool IsHiddenVolumeProtectionTriggered () const { return HiddenVolumeProtectionTriggered; } bool IsInSystemEncryptionScope () const { return SystemEncryption; } - void Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr kdf, bool truecryptMode, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr protectionPassword = shared_ptr (), int protectionPim = 0, shared_ptr protectionKdf = shared_ptr (),shared_ptr protectionKeyfiles = shared_ptr (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false); - void Open (shared_ptr volumeFile, shared_ptr password, int pim, shared_ptr kdf, bool truecryptMode, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr protectionPassword = shared_ptr (), int protectionPim = 0, shared_ptr protectionKdf = shared_ptr (), shared_ptr protectionKeyfiles = shared_ptr (), VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false); + void Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr password, int pim, shared_ptr kdf, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr protectionPassword = shared_ptr (), int protectionPim = 0, shared_ptr protectionKdf = shared_ptr (),shared_ptr protectionKeyfiles = shared_ptr (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false); + void Open (shared_ptr volumeFile, shared_ptr password, int pim, shared_ptr kdf, shared_ptr keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr protectionPassword = shared_ptr (), int protectionPim = 0, shared_ptr protectionKdf = shared_ptr (), shared_ptr protectionKeyfiles = shared_ptr (), VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false); void ReadSectors (const BufferPtr &buffer, uint64 byteOffset); void ReEncryptHeader (bool backupHeader, const ConstBufferPtr &newSalt, const ConstBufferPtr &newHeaderKey, shared_ptr newPkcs5Kdf); void WriteSectors (const ConstBufferPtr &buffer, uint64 byteOffset); @@ -152,7 +137,6 @@ namespace VeraCrypt uint64 TopWriteOffset; uint64 TotalDataRead; uint64 TotalDataWritten; - bool TrueCryptMode; int Pim; bool EncryptionNotCompleted; diff --git a/src/Volume/VolumeHeader.cpp b/src/Volume/VolumeHeader.cpp index faed1fcb..d8527ed5 100644 --- a/src/Volume/VolumeHeader.cpp +++ b/src/Volume/VolumeHeader.cpp @@ -82,7 +82,7 @@ namespace VeraCrypt EncryptNew (headerBuffer, options.Salt, options.HeaderKey, options.Kdf); } - bool VolumeHeader::Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr kdf, bool truecryptMode, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes) + bool VolumeHeader::Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr kdf, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes) { if (password.Size() < 1) throw PasswordEmpty (SRC_POS); @@ -125,7 +125,7 @@ namespace VeraCrypt header.CopyFrom (encryptedData.GetRange (EncryptedHeaderDataOffset, EncryptedHeaderDataSize)); ea->Decrypt (header); - if (Deserialize (header, ea, mode, truecryptMode)) + if (Deserialize (header, ea, mode)) { EA = ea; Pkcs5 = pkcs5; @@ -138,18 +138,12 @@ namespace VeraCrypt return false; } - bool VolumeHeader::Deserialize (const ConstBufferPtr &header, shared_ptr &ea, shared_ptr &mode, bool truecryptMode) + bool VolumeHeader::Deserialize (const ConstBufferPtr &header, shared_ptr &ea, shared_ptr &mode) { if (header.Size() != EncryptedHeaderDataSize) throw ParameterIncorrect (SRC_POS); - if (truecryptMode && (header[0] != 'T' || - header[1] != 'R' || - header[2] != 'U' || - header[3] != 'E')) - return false; - - if (!truecryptMode && (header[0] != 'V' || + if ((header[0] != 'V' || header[1] != 'E' || header[2] != 'R' || header[3] != 'A')) @@ -173,16 +167,9 @@ namespace VeraCrypt RequiredMinProgramVersion = DeserializeEntry (header, offset); - if (!truecryptMode && (RequiredMinProgramVersion > Version::Number())) + if ((RequiredMinProgramVersion > Version::Number())) throw HigherVersionRequired (SRC_POS); - if (truecryptMode) - { - if (RequiredMinProgramVersion < 0x600 || RequiredMinProgramVersion > 0x71a) - throw UnsupportedTrueCryptFormat (SRC_POS); - RequiredMinProgramVersion = CurrentRequiredMinProgramVersion; - } - VolumeKeyAreaCrc32 = DeserializeEntry (header, offset); VolumeCreationTime = DeserializeEntry (header, offset); HeaderCreationTime = DeserializeEntry (header, offset); diff --git a/src/Volume/VolumeHeader.h b/src/Volume/VolumeHeader.h index 191547e3..85908711 100644 --- a/src/Volume/VolumeHeader.h +++ b/src/Volume/VolumeHeader.h @@ -60,7 +60,7 @@ namespace VeraCrypt virtual ~VolumeHeader (); void Create (const BufferPtr &headerBuffer, VolumeHeaderCreationOptions &options); - bool Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr kdf, bool truecryptMode, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes); + bool Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr kdf, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes); void EncryptNew (const BufferPtr &newHeaderBuffer, const ConstBufferPtr &newSalt, const ConstBufferPtr &newHeaderKey, shared_ptr newPkcs5Kdf); uint64 GetEncryptedAreaStart () const { return EncryptedAreaStart; } uint64 GetEncryptedAreaLength () const { return EncryptedAreaLength; } @@ -78,7 +78,7 @@ namespace VeraCrypt void SetSize (uint32 headerSize); protected: - bool Deserialize (const ConstBufferPtr &header, shared_ptr &ea, shared_ptr &mode, bool truecryptMode); + bool Deserialize (const ConstBufferPtr &header, shared_ptr &ea, shared_ptr &mode); template T DeserializeEntry (const ConstBufferPtr &header, size_t &offset) const; template T DeserializeEntryAt (const ConstBufferPtr &header, const size_t &offset) const; void Init (); diff --git a/src/Volume/VolumeInfo.cpp b/src/Volume/VolumeInfo.cpp index b30dafa2..699e203f 100644 --- a/src/Volume/VolumeInfo.cpp +++ b/src/Volume/VolumeInfo.cpp @@ -54,7 +54,6 @@ namespace VeraCrypt Type = static_cast (sr.DeserializeInt32 ("Type")); VirtualDevice = sr.DeserializeWString ("VirtualDevice"); sr.Deserialize ("VolumeCreationTime", VolumeCreationTime); - sr.Deserialize ("TrueCryptMode", TrueCryptMode); sr.Deserialize ("Pim", Pim); } @@ -95,7 +94,6 @@ namespace VeraCrypt sr.Serialize ("Type", static_cast (Type)); sr.Serialize ("VirtualDevice", wstring (VirtualDevice)); sr.Serialize ("VolumeCreationTime", VolumeCreationTime); - sr.Serialize ("TrueCryptMode", TrueCryptMode); sr.Serialize ("Pim", Pim); } @@ -120,7 +118,6 @@ namespace VeraCrypt TopWriteOffset = volume.GetTopWriteOffset(); TotalDataRead = volume.GetTotalDataRead(); TotalDataWritten = volume.GetTotalDataWritten(); - TrueCryptMode = volume.GetTrueCryptMode(); Pim = volume.GetPim (); } diff --git a/src/Volume/VolumeInfo.h b/src/Volume/VolumeInfo.h index f9e07a2e..1adc87e3 100644 --- a/src/Volume/VolumeInfo.h +++ b/src/Volume/VolumeInfo.h @@ -60,7 +60,6 @@ namespace VeraCrypt VolumeType::Enum Type; DevicePath VirtualDevice; VolumeTime VolumeCreationTime; - bool TrueCryptMode; int Pim; private: diff --git a/src/Volume/VolumeLayout.cpp b/src/Volume/VolumeLayout.cpp index 3045ba83..efb77649 100644 --- a/src/Volume/VolumeLayout.cpp +++ b/src/Volume/VolumeLayout.cpp @@ -222,17 +222,14 @@ namespace VeraCrypt return volumeHostSize; } - Pkcs5KdfList VolumeLayoutSystemEncryption::GetSupportedKeyDerivationFunctions (bool truecryptMode) const + Pkcs5KdfList VolumeLayoutSystemEncryption::GetSupportedKeyDerivationFunctions () const { Pkcs5KdfList l; - if (!truecryptMode) - { - l.push_back (shared_ptr (new Pkcs5HmacSha256_Boot ())); - l.push_back (shared_ptr (new Pkcs5HmacBlake2s_Boot ())); - l.push_back (shared_ptr (new Pkcs5HmacSha512 (false))); - l.push_back (shared_ptr (new Pkcs5HmacWhirlpool (false))); - l.push_back (shared_ptr (new Pkcs5HmacStreebog ())); - } + l.push_back (shared_ptr (new Pkcs5HmacSha256_Boot ())); + l.push_back (shared_ptr (new Pkcs5HmacBlake2s_Boot ())); + l.push_back (shared_ptr (new Pkcs5HmacSha512 ())); + l.push_back (shared_ptr (new Pkcs5HmacWhirlpool ())); + l.push_back (shared_ptr (new Pkcs5HmacStreebog ())); return l; } } diff --git a/src/Volume/VolumeLayout.h b/src/Volume/VolumeLayout.h index 40a8643d..32b646ad 100644 --- a/src/Volume/VolumeLayout.h +++ b/src/Volume/VolumeLayout.h @@ -38,7 +38,7 @@ namespace VeraCrypt virtual uint32 GetHeaderSize () const { return HeaderSize; } virtual uint64 GetMaxDataSize (uint64 volumeSize) const = 0; virtual EncryptionAlgorithmList GetSupportedEncryptionAlgorithms () const { return SupportedEncryptionAlgorithms; } - virtual Pkcs5KdfList GetSupportedKeyDerivationFunctions (bool truecryptMode) const { return Pkcs5Kdf::GetAvailableAlgorithms(truecryptMode); } + virtual Pkcs5KdfList GetSupportedKeyDerivationFunctions () const { return Pkcs5Kdf::GetAvailableAlgorithms(); } virtual EncryptionModeList GetSupportedEncryptionModes () const { return SupportedEncryptionModes; } virtual VolumeType::Enum GetType () const { return Type; } virtual bool HasBackupHeader () const = 0; @@ -126,7 +126,7 @@ namespace VeraCrypt virtual uint64 GetDataOffset (uint64 volumeHostSize) const; virtual uint64 GetDataSize (uint64 volumeHostSize) const; virtual uint64 GetMaxDataSize (uint64 volumeSize) const { throw NotApplicable (SRC_POS); } - virtual Pkcs5KdfList GetSupportedKeyDerivationFunctions (bool truecryptMode) const; + virtual Pkcs5KdfList GetSupportedKeyDerivationFunctions () const; virtual bool HasBackupHeader () const { return false; } virtual bool HasDriveHeader () const { return true; } -- cgit v1.2.3