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

Linux/macOS: Remove TrueCrypt support

This commit is contained in:
Mounir IDRASSI
2023-07-24 08:48:52 +02:00
parent ba74b9d5b8
commit 3f976c24d2
42 changed files with 133 additions and 348 deletions

View File

@@ -5822,11 +5822,6 @@ void handleError (HWND hwndDlg, int code, const char* srcPos)
// A non-error // A non-error
break; 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 #ifndef SETUP
case ERR_RAND_INIT_FAILED: case ERR_RAND_INIT_FAILED:
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("INIT_RAND"), SRC_POS, GetLastError ()); StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("INIT_RAND"), SRC_POS, GetLastError ());

View File

@@ -487,9 +487,8 @@ enum
ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG = 31, ERR_SYS_HIDVOL_HEAD_REENC_MODE_WRONG = 31,
ERR_NONSYS_INPLACE_ENC_INCOMPLETE = 32, ERR_NONSYS_INPLACE_ENC_INCOMPLETE = 32,
ERR_USER_ABORT = 33, ERR_USER_ABORT = 33,
ERR_UNSUPPORTED_TRUECRYPT_FORMAT = 34, ERR_RAND_INIT_FAILED = 34,
ERR_RAND_INIT_FAILED = 35, ERR_CAPI_INIT_FAILED = 35
ERR_CAPI_INIT_FAILED = 36
}; };
#endif // #ifndef TCDEFS_H #endif // #ifndef TCDEFS_H

View File

@@ -75,7 +75,6 @@ namespace VeraCrypt
shared_ptr <VolumePassword> m_password; shared_ptr <VolumePassword> m_password;
int m_pim; int m_pim;
shared_ptr <Pkcs5Kdf> m_kdf; shared_ptr <Pkcs5Kdf> m_kdf;
bool m_truecryptMode;
shared_ptr <KeyfileList> m_keyfiles; shared_ptr <KeyfileList> m_keyfiles;
shared_ptr <VolumePassword> m_newPassword; shared_ptr <VolumePassword> m_newPassword;
int m_newPim; int m_newPim;
@@ -83,9 +82,9 @@ namespace VeraCrypt
shared_ptr <Pkcs5Kdf> m_newPkcs5Kdf; shared_ptr <Pkcs5Kdf> m_newPkcs5Kdf;
int m_wipeCount; int m_wipeCount;
bool m_emvSupportEnabled; bool m_emvSupportEnabled;
ChangePasswordThreadRoutine(shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> 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> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> 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 ~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 class OpenVolumeThreadRoutine : public WaitThreadRoutine
@@ -96,7 +95,6 @@ namespace VeraCrypt
shared_ptr <VolumePassword> m_password; shared_ptr <VolumePassword> m_password;
int m_pim; int m_pim;
shared_ptr<Pkcs5Kdf> m_Kdf; shared_ptr<Pkcs5Kdf> m_Kdf;
bool m_truecryptMode;
shared_ptr <KeyfileList> m_keyfiles; shared_ptr <KeyfileList> m_keyfiles;
VolumeProtection::Enum m_protection; VolumeProtection::Enum m_protection;
shared_ptr <VolumePassword> m_protectionPassword; shared_ptr <VolumePassword> m_protectionPassword;
@@ -110,14 +108,14 @@ namespace VeraCrypt
shared_ptr <Volume> m_pVolume; shared_ptr <Volume> m_pVolume;
bool m_emvSupportEnabled; bool m_emvSupportEnabled;
OpenVolumeThreadRoutine(shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> Kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr<Pkcs5Kdf> protectionKdf = shared_ptr<Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false): OpenVolumeThreadRoutine(shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> Kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr<Pkcs5Kdf> protectionKdf = shared_ptr<Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), 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), 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_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) {} m_partitionInSystemEncryptionScope(partitionInSystemEncryptionScope), m_emvSupportEnabled(emvSupportEnabled) {}
~OpenVolumeThreadRoutine() {} ~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; const VolumePassword &m_password;
int m_pim; int m_pim;
shared_ptr <Pkcs5Kdf> m_kdf; shared_ptr <Pkcs5Kdf> m_kdf;
bool m_truecryptMode;
const Pkcs5KdfList &m_keyDerivationFunctions; const Pkcs5KdfList &m_keyDerivationFunctions;
const EncryptionAlgorithmList &m_encryptionAlgorithms; const EncryptionAlgorithmList &m_encryptionAlgorithms;
const EncryptionModeList &m_encryptionModes; const EncryptionModeList &m_encryptionModes;
bool m_bResult; bool m_bResult;
DecryptThreadRoutine(shared_ptr <VolumeHeader> header, const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes) DecryptThreadRoutine(shared_ptr <VolumeHeader> header, const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> 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_truecryptMode(truecryptMode), m_keyDerivationFunctions(keyDerivationFunctions), m_encryptionAlgorithms(encryptionAlgorithms), m_encryptionModes(encryptionModes), m_bResult(false){} : 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 ~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 class WaitThreadUI

View File

@@ -37,13 +37,7 @@ namespace VeraCrypt
if (!newPkcs5Kdf) if (!newPkcs5Kdf)
{ {
if (openVolume->GetPkcs5Kdf()->GetTrueCryptMode ()) newPkcs5Kdf = openVolume->GetPkcs5Kdf();
{
newPkcs5Kdf.reset (openVolume->GetPkcs5Kdf()->Clone());
newPkcs5Kdf->SetTrueCryptMode (false);
}
else
newPkcs5Kdf = openVolume->GetPkcs5Kdf();
} }
if ((openVolume->GetHeader()->GetFlags() & TC_HEADER_FLAG_ENCRYPTED_SYSTEM) != 0 if ((openVolume->GetHeader()->GetFlags() & TC_HEADER_FLAG_ENCRYPTED_SYSTEM) != 0
@@ -83,9 +77,9 @@ namespace VeraCrypt
} }
} }
void CoreBase::ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount) const void CoreBase::ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount) const
{ {
shared_ptr <Volume> volume = OpenVolume (volumePath, preserveTimestamps, password, pim, kdf, truecryptMode, keyfiles, emvSupportEnabled); shared_ptr <Volume> volume = OpenVolume (volumePath, preserveTimestamps, password, pim, kdf, keyfiles, emvSupportEnabled);
ChangePassword (volume, newPassword, newPim, newKeyfiles, emvSupportEnabled, newPkcs5Kdf, wipeCount); ChangePassword (volume, newPassword, newPim, newKeyfiles, emvSupportEnabled, newPkcs5Kdf, wipeCount);
} }
@@ -261,10 +255,10 @@ namespace VeraCrypt
return false; return false;
} }
shared_ptr <Volume> CoreBase::OpenVolume (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr<Pkcs5Kdf> protectionKdf, shared_ptr <KeyfileList> protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) const shared_ptr <Volume> CoreBase::OpenVolume (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr<Pkcs5Kdf> protectionKdf, shared_ptr <KeyfileList> protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) const
{ {
make_shared_auto (Volume, volume); 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; return volume;
} }

View File

@@ -34,7 +34,7 @@ namespace VeraCrypt
virtual ~CoreBase (); virtual ~CoreBase ();
virtual void ChangePassword (shared_ptr <Volume> openVolume, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const; virtual void ChangePassword (shared_ptr <Volume> openVolume, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const;
virtual void ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const; virtual void ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const;
virtual void CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair = false) const = 0; virtual void CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair = false) const = 0;
virtual void CoalesceSlotNumberAndMountPoint (MountOptions &options) const; virtual void CoalesceSlotNumberAndMountPoint (MountOptions &options) const;
virtual void CreateKeyfile (const FilePath &keyfilePath) const; virtual void CreateKeyfile (const FilePath &keyfilePath) const;
@@ -69,7 +69,7 @@ namespace VeraCrypt
virtual bool IsVolumeMounted (const VolumePath &volumePath) const; virtual bool IsVolumeMounted (const VolumePath &volumePath) const;
virtual VolumeSlotNumber MountPointToSlotNumber (const DirectoryPath &mountPoint) const = 0; virtual VolumeSlotNumber MountPointToSlotNumber (const DirectoryPath &mountPoint) const = 0;
virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options) = 0; virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options) = 0;
virtual shared_ptr <Volume> OpenVolume (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> Kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr<Pkcs5Kdf> protectionKdf = shared_ptr<Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false) const; virtual shared_ptr <Volume> OpenVolume (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr<Pkcs5Kdf> Kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr<Pkcs5Kdf> protectionKdf = shared_ptr<Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false) const;
virtual void RandomizeEncryptionAlgorithmKey (shared_ptr <EncryptionAlgorithm> encryptionAlgorithm) const; virtual void RandomizeEncryptionAlgorithmKey (shared_ptr <EncryptionAlgorithm> encryptionAlgorithm) const;
virtual void ReEncryptVolumeHeaderWithNewSalt (const BufferPtr &newHeaderBuffer, shared_ptr <VolumeHeader> header, shared_ptr <VolumePassword> password, int pim, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled) const; virtual void ReEncryptVolumeHeaderWithNewSalt (const BufferPtr &newHeaderBuffer, shared_ptr <VolumeHeader> header, shared_ptr <VolumePassword> password, int pim, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled) const;
virtual void SetAdminPasswordCallback (shared_ptr <GetStringFunctor> functor) { } virtual void SetAdminPasswordCallback (shared_ptr <GetStringFunctor> functor) { }

View File

@@ -52,7 +52,6 @@ namespace VeraCrypt
TC_CLONE (SharedAccessAllowed); TC_CLONE (SharedAccessAllowed);
TC_CLONE (SlotNumber); TC_CLONE (SlotNumber);
TC_CLONE (UseBackupHeaders); TC_CLONE (UseBackupHeaders);
TC_CLONE (TrueCryptMode);
} }
void MountOptions::Deserialize (shared_ptr <Stream> stream) void MountOptions::Deserialize (shared_ptr <Stream> stream)
@@ -101,14 +100,12 @@ namespace VeraCrypt
sr.Deserialize ("SlotNumber", SlotNumber); sr.Deserialize ("SlotNumber", SlotNumber);
sr.Deserialize ("UseBackupHeaders", UseBackupHeaders); sr.Deserialize ("UseBackupHeaders", UseBackupHeaders);
sr.Deserialize ("TrueCryptMode", TrueCryptMode);
try try
{ {
if (!sr.DeserializeBool ("KdfNull")) if (!sr.DeserializeBool ("KdfNull"))
{ {
sr.Deserialize ("Kdf", nameValue); sr.Deserialize ("Kdf", nameValue);
Kdf = Pkcs5Kdf::GetAlgorithm (nameValue, TrueCryptMode); Kdf = Pkcs5Kdf::GetAlgorithm (nameValue);
} }
} }
catch(...) {} catch(...) {}
@@ -118,7 +115,7 @@ namespace VeraCrypt
if (!sr.DeserializeBool ("ProtectionKdfNull")) if (!sr.DeserializeBool ("ProtectionKdfNull"))
{ {
sr.Deserialize ("ProtectionKdf", nameValue); sr.Deserialize ("ProtectionKdf", nameValue);
ProtectionKdf = Pkcs5Kdf::GetAlgorithm (nameValue, TrueCryptMode); ProtectionKdf = Pkcs5Kdf::GetAlgorithm (nameValue);
} }
} }
catch(...) {} catch(...) {}
@@ -167,8 +164,6 @@ namespace VeraCrypt
sr.Serialize ("SlotNumber", SlotNumber); sr.Serialize ("SlotNumber", SlotNumber);
sr.Serialize ("UseBackupHeaders", UseBackupHeaders); sr.Serialize ("UseBackupHeaders", UseBackupHeaders);
sr.Serialize ("TrueCryptMode", TrueCryptMode);
sr.Serialize ("KdfNull", Kdf == nullptr); sr.Serialize ("KdfNull", Kdf == nullptr);
if (Kdf) if (Kdf)
sr.Serialize ("Kdf", Kdf->GetName()); sr.Serialize ("Kdf", Kdf->GetName());

View File

@@ -37,8 +37,7 @@ namespace VeraCrypt
Removable (false), Removable (false),
SharedAccessAllowed (false), SharedAccessAllowed (false),
SlotNumber (0), SlotNumber (0),
UseBackupHeaders (false), UseBackupHeaders (false)
TrueCryptMode (false)
{ {
} }
@@ -72,7 +71,6 @@ namespace VeraCrypt
bool SharedAccessAllowed; bool SharedAccessAllowed;
VolumeSlotNumber SlotNumber; VolumeSlotNumber SlotNumber;
bool UseBackupHeaders; bool UseBackupHeaders;
bool TrueCryptMode;
bool EMVSupportEnabled; bool EMVSupportEnabled;
protected: protected:

View File

@@ -546,7 +546,6 @@ namespace VeraCrypt
options.Password, options.Password,
options.Pim, options.Pim,
options.Kdf, options.Kdf,
options.TrueCryptMode,
options.Keyfiles, options.Keyfiles,
options.EMVSupportEnabled, options.EMVSupportEnabled,
options.Protection, options.Protection,

View File

@@ -29,7 +29,6 @@ namespace VeraCrypt
ArgPim (-1), ArgPim (-1),
ArgSize (0), ArgSize (0),
ArgVolumeType (VolumeType::Unknown), ArgVolumeType (VolumeType::Unknown),
ArgTrueCryptMode (false),
ArgDisableFileSizeCheck (false), ArgDisableFileSizeCheck (false),
ArgUseLegacyPassword (false), ArgUseLegacyPassword (false),
#if defined(TC_LINUX ) || defined (TC_FREEBSD) #if defined(TC_LINUX ) || defined (TC_FREEBSD)
@@ -92,7 +91,6 @@ namespace VeraCrypt
parser.AddSwitch (L"", L"quick", _("Enable quick format")); parser.AddSwitch (L"", L"quick", _("Enable quick format"));
parser.AddOption (L"", L"size", _("Size in bytes")); parser.AddOption (L"", L"size", _("Size in bytes"));
parser.AddOption (L"", L"slot", _("Volume slot number")); 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"", L"test", _("Test internal algorithms"));
parser.AddSwitch (L"t", L"text", _("Use text user interface")); parser.AddSwitch (L"t", L"text", _("Use text user interface"));
parser.AddOption (L"", L"token-lib", _("Security token library")); parser.AddOption (L"", L"token-lib", _("Security token library"));
@@ -357,9 +355,8 @@ namespace VeraCrypt
ArgForce = parser.Found (L"force"); ArgForce = parser.Found (L"force");
ArgTrueCryptMode = parser.Found (L"truecrypt");
ArgDisableFileSizeCheck = parser.Found (L"no-size-check"); 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) #if defined(TC_LINUX ) || defined (TC_FREEBSD)
ArgUseDummySudoPassword = parser.Found (L"use-dummy-sudo-password"); ArgUseDummySudoPassword = parser.Found (L"use-dummy-sudo-password");
#endif #endif
@@ -449,8 +446,6 @@ namespace VeraCrypt
if (ArgNewPim < 0 || ArgNewPim > (ArgMountOptions.PartitionInSystemEncryptionScope? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE)) if (ArgNewPim < 0 || ArgNewPim > (ArgMountOptions.PartitionInSystemEncryptionScope? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE))
throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); 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")) 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)) if (ArgPim < 0 || ArgPim > (ArgMountOptions.PartitionInSystemEncryptionScope? MAX_BOOT_PIM_VALUE: MAX_PIM_VALUE))
throw_err (LangString["PARAMETER_INCORRECT"] + L": " + str); 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)) if (parser.Found (L"protect-hidden", &str))
@@ -545,7 +538,7 @@ namespace VeraCrypt
if (hashName.IsSameAs (str, false) || hashAltName.IsSameAs (str, false)) if (hashName.IsSameAs (str, false) || hashAltName.IsSameAs (str, false))
{ {
bHashFound = true; bHashFound = true;
ArgMountOptions.ProtectionKdf = Pkcs5Kdf::GetAlgorithm (*hash, ArgTrueCryptMode); ArgMountOptions.ProtectionKdf = Pkcs5Kdf::GetAlgorithm (*hash);
} }
} }

View File

@@ -83,7 +83,6 @@ namespace VeraCrypt
shared_ptr <VolumePath> ArgVolumePath; shared_ptr <VolumePath> ArgVolumePath;
VolumeInfoList ArgVolumes; VolumeInfoList ArgVolumes;
VolumeType::Enum ArgVolumeType; VolumeType::Enum ArgVolumeType;
bool ArgTrueCryptMode;
shared_ptr<SecureBuffer> ArgTokenPin; shared_ptr<SecureBuffer> ArgTokenPin;
bool ArgDisableFileSizeCheck; bool ArgDisableFileSizeCheck;
bool ArgUseLegacyPassword; bool ArgUseLegacyPassword;

View File

@@ -273,7 +273,7 @@ namespace VeraCrypt
Buffer salt(64); 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"}; 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; unsigned long pim;
Pkcs5KdfList prfList = Pkcs5Kdf::GetAvailableAlgorithms (false); Pkcs5KdfList prfList = Pkcs5Kdf::GetAvailableAlgorithms ();
VolumePassword password ((const byte*) "passphrase-1234567890", 21); VolumePassword password ((const byte*) "passphrase-1234567890", 21);
memcpy (&pim, buffer.Ptr (), sizeof (unsigned long)); memcpy (&pim, buffer.Ptr (), sizeof (unsigned long));

View File

@@ -35,12 +35,6 @@ namespace VeraCrypt
bool enableNewPassword = false; bool enableNewPassword = false;
bool enableNewKeyfiles = false; bool enableNewKeyfiles = false;
bool enablePkcs5Prf = false; bool enablePkcs5Prf = false;
bool isTrueCryptFile = false;
if (volumePath && volumePath->HasTrueCryptExtension ())
{
isTrueCryptFile = true;
}
switch (mode) switch (mode)
{ {
@@ -73,12 +67,11 @@ namespace VeraCrypt
GraphicUserInterface::InstallPasswordEntryCustomKeyboardShortcuts (this); GraphicUserInterface::InstallPasswordEntryCustomKeyboardShortcuts (this);
#endif #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 <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate)); CurrentPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate));
CurrentPasswordPanel->SetTrueCryptMode (isTrueCryptFile);
CurrentPasswordPanelSizer->Add (CurrentPasswordPanel, 1, wxALL | wxEXPAND); 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 <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate)); NewPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate));
NewPasswordPanelSizer->Add (NewPasswordPanel, 1, wxALL | wxEXPAND); NewPasswordPanelSizer->Add (NewPasswordPanel, 1, wxALL | wxEXPAND);
@@ -107,13 +100,7 @@ namespace VeraCrypt
try try
{ {
bool bUnsupportedKdf = false; shared_ptr <Pkcs5Kdf> currentKdf = CurrentPasswordPanel->GetPkcs5Kdf();
shared_ptr <Pkcs5Kdf> currentKdf = CurrentPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf);
if (bUnsupportedKdf)
{
Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
return;
}
int currentPim = CurrentPasswordPanel->GetVolumePim(); int currentPim = CurrentPasswordPanel->GetVolumePim();
if (-1 == currentPim) if (-1 == currentPim)
{ {
@@ -182,7 +169,7 @@ namespace VeraCrypt
/* force the display of the random enriching interface */ /* force the display of the random enriching interface */
RandomNumberGenerator::SetEnrichedByUserStatus (false); RandomNumberGenerator::SetEnrichedByUserStatus (false);
Gui->UserEnrichRandomPool (this, NewPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf) ? NewPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf)->GetHash() : shared_ptr <Hash>()); Gui->UserEnrichRandomPool (this, NewPasswordPanel->GetPkcs5Kdf() ? NewPasswordPanel->GetPkcs5Kdf()->GetHash() : shared_ptr <Hash>());
{ {
#ifdef TC_UNIX #ifdef TC_UNIX
@@ -203,8 +190,8 @@ namespace VeraCrypt
#endif #endif
wxBusyCursor busy; wxBusyCursor busy;
ChangePasswordThreadRoutine routine(Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps, ChangePasswordThreadRoutine routine(Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps,
CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetVolumePim(), CurrentPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf), CurrentPasswordPanel->GetTrueCryptMode(),CurrentPasswordPanel->GetKeyfiles(), CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetVolumePim(), CurrentPasswordPanel->GetPkcs5Kdf(), CurrentPasswordPanel->GetKeyfiles(),
newPassword, newPim, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(bUnsupportedKdf), NewPasswordPanel->GetHeaderWipeCount(), Gui->GetPreferences().EMVSupportEnabled); newPassword, newPim, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(), NewPasswordPanel->GetHeaderWipeCount(), Gui->GetPreferences().EMVSupportEnabled);
Gui->ExecuteWaitThreadRoutine (this, &routine); Gui->ExecuteWaitThreadRoutine (this, &routine);
} }

View File

@@ -642,13 +642,9 @@ namespace VeraCrypt
try try
{ {
MountOptions mountOptions (GetPreferences().DefaultMountOptions); MountOptions mountOptions (GetPreferences().DefaultMountOptions);
if (CmdLine->ArgTrueCryptMode)
{
mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode;
}
if (CmdLine->ArgHash) if (CmdLine->ArgHash)
{ {
mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
} }
if (CmdLine->ArgPim > 0) if (CmdLine->ArgPim > 0)
{ {
@@ -671,13 +667,9 @@ namespace VeraCrypt
try try
{ {
MountOptions mountOptions (GetPreferences().DefaultMountOptions); MountOptions mountOptions (GetPreferences().DefaultMountOptions);
if (CmdLine->ArgTrueCryptMode)
{
mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode;
}
if (CmdLine->ArgHash) if (CmdLine->ArgHash)
{ {
mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
} }
if (CmdLine->ArgPim > 0) if (CmdLine->ArgPim > 0)
{ {
@@ -706,13 +698,9 @@ namespace VeraCrypt
MountOptions mountOptions (GetPreferences().DefaultMountOptions); MountOptions mountOptions (GetPreferences().DefaultMountOptions);
mountOptions.SlotNumber = SelectedSlotNumber; mountOptions.SlotNumber = SelectedSlotNumber;
mountOptions.Path = GetSelectedVolumePath(); mountOptions.Path = GetSelectedVolumePath();
if (CmdLine->ArgTrueCryptMode)
{
mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode;
}
if (CmdLine->ArgHash) if (CmdLine->ArgHash)
{ {
mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
} }
if (CmdLine->ArgPim > 0) if (CmdLine->ArgPim > 0)
{ {
@@ -964,13 +952,9 @@ namespace VeraCrypt
SetVolumePath (favorite.Path); SetVolumePath (favorite.Path);
MountOptions mountOptions (GetPreferences().DefaultMountOptions); MountOptions mountOptions (GetPreferences().DefaultMountOptions);
if (CmdLine->ArgTrueCryptMode)
{
mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode;
}
if (CmdLine->ArgHash) if (CmdLine->ArgHash)
{ {
mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
} }
if (CmdLine->ArgPim > 0) if (CmdLine->ArgPim > 0)
{ {
@@ -1706,7 +1690,7 @@ namespace VeraCrypt
#endif #endif
fields[ColumnPath] = volume->Path; fields[ColumnPath] = volume->Path;
fields[ColumnSize] = Gui->SizeToString (volume->Size); 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) if (volume->HiddenVolumeProtectionTriggered)
{ {

View File

@@ -50,14 +50,8 @@ namespace VeraCrypt
GraphicUserInterface::InstallPasswordEntryCustomKeyboardShortcuts (this); GraphicUserInterface::InstallPasswordEntryCustomKeyboardShortcuts (this);
#endif #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)); 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); PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);
@@ -88,7 +82,7 @@ namespace VeraCrypt
OptionsButton->SetLabel (OptionsButtonLabel + L" >"); OptionsButton->SetLabel (OptionsButtonLabel + L" >");
OptionsPanel->Show (false); 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; ProtectionPasswordPanel->TopOwnerParent = this;
ProtectionPasswordSizer->Add (ProtectionPasswordPanel, 1, wxALL | wxEXPAND); ProtectionPasswordSizer->Add (ProtectionPasswordPanel, 1, wxALL | wxEXPAND);
@@ -110,8 +104,6 @@ namespace VeraCrypt
void MountOptionsDialog::OnOKButtonClick (wxCommandEvent& event) void MountOptionsDialog::OnOKButtonClick (wxCommandEvent& event)
{ {
bool bUnsupportedKdf = false;
/* verify that PIM values are valid before continuing*/ /* verify that PIM values are valid before continuing*/
int Pim = PasswordPanel->GetVolumePim(); int Pim = PasswordPanel->GetVolumePim();
int ProtectionPim = (!ReadOnlyCheckBox->IsChecked() && ProtectionCheckBox->IsChecked())? int ProtectionPim = (!ReadOnlyCheckBox->IsChecked() && ProtectionCheckBox->IsChecked())?
@@ -149,13 +141,7 @@ namespace VeraCrypt
} }
Options.Pim = Pim; Options.Pim = Pim;
Options.Kdf = PasswordPanel->GetPkcs5Kdf(bUnsupportedKdf); Options.Kdf = PasswordPanel->GetPkcs5Kdf();
if (bUnsupportedKdf)
{
Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
return;
}
Options.TrueCryptMode = PasswordPanel->GetTrueCryptMode();
Options.Keyfiles = PasswordPanel->GetKeyfiles(); Options.Keyfiles = PasswordPanel->GetKeyfiles();
if (ReadOnlyCheckBox->IsChecked()) if (ReadOnlyCheckBox->IsChecked())
@@ -166,7 +152,7 @@ namespace VeraCrypt
{ {
try try
{ {
Options.ProtectionPassword = ProtectionPasswordPanel->GetPassword(Options.TrueCryptMode); Options.ProtectionPassword = ProtectionPasswordPanel->GetPassword(false);
} }
catch (PasswordException& e) catch (PasswordException& e)
{ {
@@ -175,12 +161,7 @@ namespace VeraCrypt
} }
Options.Protection = VolumeProtection::HiddenVolumeReadOnly; Options.Protection = VolumeProtection::HiddenVolumeReadOnly;
Options.ProtectionPim = ProtectionPim; Options.ProtectionPim = ProtectionPim;
Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf(Options.TrueCryptMode, bUnsupportedKdf); Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf();
if (bUnsupportedKdf)
{
Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
return;
}
Options.ProtectionKeyfiles = ProtectionPasswordPanel->GetKeyfiles(); Options.ProtectionKeyfiles = ProtectionPasswordPanel->GetKeyfiles();
} }
else else

View File

@@ -53,12 +53,10 @@ namespace VeraCrypt
FilesystemOptionsTextCtrl->SetValue (Preferences.DefaultMountOptions.FilesystemOptions); FilesystemOptionsTextCtrl->SetValue (Preferences.DefaultMountOptions.FilesystemOptions);
TrueCryptModeCheckBox->SetValidator (wxGenericValidator (&Preferences.DefaultMountOptions.TrueCryptMode));
int index, prfInitialIndex = 0; int index, prfInitialIndex = 0;
Pkcs5PrfChoice->Append (LangString["AUTODETECTION"]); Pkcs5PrfChoice->Append (LangString["AUTODETECTION"]);
foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms(false)) foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms())
{ {
index = Pkcs5PrfChoice->Append (kdf.GetName()); index = Pkcs5PrfChoice->Append (kdf.GetName());
if (Preferences.DefaultMountOptions.Kdf if (Preferences.DefaultMountOptions.Kdf
@@ -370,11 +368,10 @@ namespace VeraCrypt
{ {
try try
{ {
selectedKdf = Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection ()), TrueCryptModeCheckBox->IsChecked ()); selectedKdf = Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection ()));
} }
catch (ParameterIncorrect&) catch (ParameterIncorrect&)
{ {
Gui->ShowWarning ("ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE");
return; return;
} }
} }

View File

@@ -479,7 +479,6 @@ namespace VeraCrypt
mountOptions.Pim = Pim; mountOptions.Pim = Pim;
mountOptions.Keyfiles = Keyfiles; mountOptions.Keyfiles = Keyfiles;
mountOptions.Kdf = Kdf; mountOptions.Kdf = Kdf;
mountOptions.TrueCryptMode = false;
shared_ptr <VolumeInfo> volume = Core->MountVolume (mountOptions); shared_ptr <VolumeInfo> volume = Core->MountVolume (mountOptions);
finally_do_arg (shared_ptr <VolumeInfo>, volume, { Core->DismountVolume (finally_arg, true); }); finally_do_arg (shared_ptr <VolumeInfo>, volume, { Core->DismountVolume (finally_arg, true); });
@@ -1031,7 +1030,7 @@ namespace VeraCrypt
options->Quick = QuickFormatEnabled; options->Quick = QuickFormatEnabled;
options->Size = VolumeSize; options->Size = VolumeSize;
options->Type = OuterVolume ? VolumeType::Normal : SelectedVolumeType; options->Type = OuterVolume ? VolumeType::Normal : SelectedVolumeType;
options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*SelectedHash, false); options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*SelectedHash);
options->EMVSupportEnabled = Gui->GetPreferences().EMVSupportEnabled; options->EMVSupportEnabled = Gui->GetPreferences().EMVSupportEnabled;
@@ -1127,7 +1126,7 @@ namespace VeraCrypt
}); });
#endif #endif
shared_ptr <Volume> outerVolume = Core->OpenVolume (make_shared <VolumePath> (SelectedVolumePath), true, Password, Pim, Kdf, false, Keyfiles, VolumeProtection::ReadOnly); shared_ptr <Volume> outerVolume = Core->OpenVolume (make_shared <VolumePath> (SelectedVolumePath), true, Password, Pim, Kdf, Keyfiles, VolumeProtection::ReadOnly);
try try
{ {
MaxHiddenVolumeSize = Core->GetMaxHiddenVolumeSize (outerVolume); MaxHiddenVolumeSize = Core->GetMaxHiddenVolumeSize (outerVolume);

View File

@@ -18,7 +18,7 @@
namespace VeraCrypt namespace VeraCrypt
{ {
VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> keyfiles, bool enableCache, bool enablePassword, bool enableKeyfiles, bool enableConfirmation, bool enablePkcs5Prf, bool isMountPassword, const wxString &passwordLabel) VolumePasswordPanel::VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr <VolumePassword> password, shared_ptr <KeyfileList> 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) : VolumePasswordPanelBase (parent), TopOwnerParent(NULL), Keyfiles (new KeyfileList), EnablePimEntry (true)
{ {
size_t maxPasswordLength = CmdLine->ArgUseLegacyPassword? VolumePassword::MaxLegacySize : VolumePassword::MaxSize; size_t maxPasswordLength = CmdLine->ArgUseLegacyPassword? VolumePassword::MaxLegacySize : VolumePassword::MaxSize;
@@ -78,22 +78,9 @@ namespace VeraCrypt
Pkcs5PrfStaticText->Show (enablePkcs5Prf); Pkcs5PrfStaticText->Show (enablePkcs5Prf);
Pkcs5PrfChoice->Show (enablePkcs5Prf); Pkcs5PrfChoice->Show (enablePkcs5Prf);
TrueCryptModeCheckBox->Show (!disableTruecryptMode);
HeaderWipeCountText->Show (enablePkcs5Prf && !isMountPassword); HeaderWipeCountText->Show (enablePkcs5Prf && !isMountPassword);
HeaderWipeCount->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) if (EnablePimEntry && options && options->Pim > 0)
{ {
PimCheckBox->SetValue (true); PimCheckBox->SetValue (true);
@@ -113,7 +100,7 @@ namespace VeraCrypt
Pkcs5PrfChoice->Delete (0); Pkcs5PrfChoice->Delete (0);
Pkcs5PrfChoice->Append (LangString["AUTODETECTION"]); Pkcs5PrfChoice->Append (LangString["AUTODETECTION"]);
} }
foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms(false)) foreach_ref (const Pkcs5Kdf &kdf, Pkcs5Kdf::GetAvailableAlgorithms())
{ {
if (!kdf.IsDeprecated() || isMountPassword) if (!kdf.IsDeprecated() || isMountPassword)
{ {
@@ -221,7 +208,7 @@ namespace VeraCrypt
shared_ptr <VolumePassword> VolumePasswordPanel::GetPassword (bool bForceLegacyPassword) const shared_ptr <VolumePassword> VolumePasswordPanel::GetPassword (bool bForceLegacyPassword) const
{ {
return GetPassword (PasswordTextCtrl, bForceLegacyPassword || GetTrueCryptMode()); return GetPassword (PasswordTextCtrl, bForceLegacyPassword);
} }
shared_ptr <VolumePassword> VolumePasswordPanel::GetPassword (wxTextCtrl *textCtrl, bool bLegacyPassword) const shared_ptr <VolumePassword> VolumePasswordPanel::GetPassword (wxTextCtrl *textCtrl, bool bLegacyPassword) const
@@ -246,14 +233,8 @@ namespace VeraCrypt
return password; return password;
} }
shared_ptr <Pkcs5Kdf> VolumePasswordPanel::GetPkcs5Kdf (bool &bUnsupportedKdf) const shared_ptr <Pkcs5Kdf> VolumePasswordPanel::GetPkcs5Kdf () const
{ {
return GetPkcs5Kdf (GetTrueCryptMode(), bUnsupportedKdf);
}
shared_ptr <Pkcs5Kdf> VolumePasswordPanel::GetPkcs5Kdf (bool bTrueCryptMode, bool &bUnsupportedKdf) const
{
bUnsupportedKdf = false;
try try
{ {
int index = Pkcs5PrfChoice->GetSelection (); int index = Pkcs5PrfChoice->GetSelection ();
@@ -263,11 +244,10 @@ namespace VeraCrypt
return shared_ptr <Pkcs5Kdf> (); return shared_ptr <Pkcs5Kdf> ();
} }
else else
return Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection()), bTrueCryptMode); return Pkcs5Kdf::GetAlgorithm (wstring (Pkcs5PrfChoice->GetStringSelection()));
} }
catch (ParameterIncorrect&) catch (ParameterIncorrect&)
{ {
bUnsupportedKdf = true;
return shared_ptr <Pkcs5Kdf> (); return shared_ptr <Pkcs5Kdf> ();
} }
} }
@@ -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 int VolumePasswordPanel::GetHeaderWipeCount () const
{ {
try try
@@ -515,13 +480,4 @@ namespace VeraCrypt
layoutParent->Fit(); layoutParent->Fit();
} }
} }
void VolumePasswordPanel::OnTrueCryptModeChecked( wxCommandEvent& event )
{
bool bEnablePIM = !GetTrueCryptMode ();
PimCheckBox->Enable (bEnablePIM);
VolumePimStaticText->Enable (bEnablePIM);
VolumePimTextCtrl->Enable (bEnablePIM);
VolumePimHelpStaticText->Enable (bEnablePIM);
}
} }

View File

@@ -22,17 +22,14 @@ namespace VeraCrypt
class VolumePasswordPanel : public VolumePasswordPanelBase class VolumePasswordPanel : public VolumePasswordPanelBase
{ {
public: public:
VolumePasswordPanel (wxWindow* parent, MountOptions* options, shared_ptr <VolumePassword> password, bool disableTruecryptMode, shared_ptr <KeyfileList> 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 <VolumePassword> password, shared_ptr <KeyfileList> 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 (); virtual ~VolumePasswordPanel ();
void AddKeyfile (shared_ptr <Keyfile> keyfile); void AddKeyfile (shared_ptr <Keyfile> keyfile);
shared_ptr <KeyfileList> GetKeyfiles () const { return UseKeyfilesCheckBox->IsChecked() ? Keyfiles : shared_ptr <KeyfileList> (); } shared_ptr <KeyfileList> GetKeyfiles () const { return UseKeyfilesCheckBox->IsChecked() ? Keyfiles : shared_ptr <KeyfileList> (); }
shared_ptr <VolumePassword> GetPassword (bool bForceLegacyPassword = false) const; shared_ptr <VolumePassword> GetPassword (bool bForceLegacyPassword = false) const;
shared_ptr <Pkcs5Kdf> GetPkcs5Kdf (bool &bUnsupportedKdf) const; shared_ptr <Pkcs5Kdf> GetPkcs5Kdf () const;
shared_ptr <Pkcs5Kdf> GetPkcs5Kdf (bool bTrueCryptMode, bool &bUnsupportedKdf) const;
int GetVolumePim () const; int GetVolumePim () const;
bool GetTrueCryptMode () const;
void SetTrueCryptMode (bool trueCryptMode);
int GetHeaderWipeCount () const; int GetHeaderWipeCount () const;
void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); } void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); }
void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); } void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); }
@@ -64,7 +61,6 @@ namespace VeraCrypt
void OnUpdate () { UpdateEvent.Raise(); } void OnUpdate () { UpdateEvent.Raise(); }
void OnUseKeyfilesCheckBoxClick (wxCommandEvent& event) { OnUpdate(); } void OnUseKeyfilesCheckBoxClick (wxCommandEvent& event) { OnUpdate(); }
void WipeTextCtrl (wxTextCtrl *textCtrl); void WipeTextCtrl (wxTextCtrl *textCtrl);
void OnTrueCryptModeChecked( wxCommandEvent& event );
shared_ptr <KeyfileList> Keyfiles; shared_ptr <KeyfileList> Keyfiles;
shared_ptr <Functor> UpdateCallback; shared_ptr <Functor> UpdateCallback;

View File

@@ -19,7 +19,7 @@ namespace VeraCrypt
VolumePasswordWizardPage::VolumePasswordWizardPage (wxPanel* parent, shared_ptr <VolumePassword> password, shared_ptr <KeyfileList> keyfiles, bool enableConfirmation) VolumePasswordWizardPage::VolumePasswordWizardPage (wxPanel* parent, shared_ptr <VolumePassword> password, shared_ptr <KeyfileList> keyfiles, bool enableConfirmation)
: VolumePasswordWizardPageBase (parent), ConfirmationMode (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 <VolumePasswordWizardPage> (this, &VolumePasswordWizardPage::OnPasswordPanelUpdate)); PasswordPanel->UpdateEvent.Connect (EventConnector <VolumePasswordWizardPage> (this, &VolumePasswordWizardPage::OnPasswordPanelUpdate));
PasswordPanelSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND); PasswordPanelSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);

View File

@@ -30,7 +30,7 @@ namespace VeraCrypt
bool IsPimSelected () const { return PasswordPanel->IsUsePimChecked ();} bool IsPimSelected () const { return PasswordPanel->IsUsePimChecked ();}
void SetPimSelected (bool selected) const { PasswordPanel->SetUsePimChecked (selected);} void SetPimSelected (bool selected) const { PasswordPanel->SetUsePimChecked (selected);}
shared_ptr <Pkcs5Kdf> GetPkcs5Kdf () const { bool bUnsupportedKdf; return PasswordPanel->GetPkcs5Kdf(bUnsupportedKdf); } shared_ptr <Pkcs5Kdf> GetPkcs5Kdf () const { return PasswordPanel->GetPkcs5Kdf(); }
bool IsValid (); bool IsValid ();
void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); } void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); }
void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); }

View File

@@ -36,7 +36,7 @@ namespace VeraCrypt
AppendToList ("VIRTUAL_DEVICE", wstring (volumeInfo.VirtualDevice)); AppendToList ("VIRTUAL_DEVICE", wstring (volumeInfo.VirtualDevice));
#endif #endif
AppendToList ("SIZE", Gui->SizeToString (volumeInfo.Size)); 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"]); AppendToList ("READ_ONLY", LangString [volumeInfo.Protection == VolumeProtection::ReadOnly ? "UISTR_YES" : "UISTR_NO"]);
wxString protection; wxString protection;

View File

@@ -96,8 +96,6 @@ namespace VeraCrypt
VC_CONVERT_EXCEPTION (SecurityTokenLibraryNotInitialized); VC_CONVERT_EXCEPTION (SecurityTokenLibraryNotInitialized);
VC_CONVERT_EXCEPTION (SecurityTokenKeyfileAlreadyExists); VC_CONVERT_EXCEPTION (SecurityTokenKeyfileAlreadyExists);
VC_CONVERT_EXCEPTION (SecurityTokenKeyfileNotFound); VC_CONVERT_EXCEPTION (SecurityTokenKeyfileNotFound);
VC_CONVERT_EXCEPTION (UnsupportedAlgoInTrueCryptMode);
VC_CONVERT_EXCEPTION (UnsupportedTrueCryptFormat);
VC_CONVERT_EXCEPTION (SystemException); VC_CONVERT_EXCEPTION (SystemException);
VC_CONVERT_EXCEPTION (CipherException); VC_CONVERT_EXCEPTION (CipherException);
VC_CONVERT_EXCEPTION (VolumeException); VC_CONVERT_EXCEPTION (VolumeException);

View File

@@ -191,7 +191,6 @@ namespace VeraCrypt
options->Password, options->Password,
options->Pim, options->Pim,
options->Kdf, options->Kdf,
false,
options->Keyfiles, options->Keyfiles,
options->EMVSupportEnabled, options->EMVSupportEnabled,
options->Protection, options->Protection,
@@ -220,7 +219,6 @@ namespace VeraCrypt
options->Password, options->Password,
options->Pim, options->Pim,
options->Kdf, options->Kdf,
false,
options->Keyfiles, options->Keyfiles,
options->EMVSupportEnabled, options->EMVSupportEnabled,
options->Protection, options->Protection,
@@ -835,7 +833,7 @@ namespace VeraCrypt
options.Keyfiles = make_shared <KeyfileList> (GetPreferences().DefaultKeyfiles); options.Keyfiles = make_shared <KeyfileList> (GetPreferences().DefaultKeyfiles);
if ((options.Password && !options.Password->IsEmpty()) if ((options.Password && !options.Password->IsEmpty())
|| (options.Keyfiles && !options.Keyfiles->empty() && (options.TrueCryptMode || options.Password))) || (options.Keyfiles && !options.Keyfiles->empty() && options.Password))
{ {
try try
{ {
@@ -1466,7 +1464,6 @@ namespace VeraCrypt
options.Password, options.Password,
options.Pim, options.Pim,
options.Kdf, options.Kdf,
options.TrueCryptMode,
options.Keyfiles, options.Keyfiles,
options.EMVSupportEnabled, options.EMVSupportEnabled,
options.Protection, options.Protection,
@@ -1583,11 +1580,11 @@ namespace VeraCrypt
// Decrypt header // Decrypt header
shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password, options.EMVSupportEnabled); shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password, options.EMVSupportEnabled);
Pkcs5KdfList keyDerivationFunctions = layout->GetSupportedKeyDerivationFunctions(options.TrueCryptMode); Pkcs5KdfList keyDerivationFunctions = layout->GetSupportedKeyDerivationFunctions();
EncryptionAlgorithmList encryptionAlgorithms = layout->GetSupportedEncryptionAlgorithms(); EncryptionAlgorithmList encryptionAlgorithms = layout->GetSupportedEncryptionAlgorithms();
EncryptionModeList encryptionModes = layout->GetSupportedEncryptionModes(); 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); ExecuteWaitThreadRoutine (parent, &decryptRoutine);

View File

@@ -34,7 +34,7 @@ namespace VeraCrypt
virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const; virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const;
virtual void BeginBusyState () const { wxBeginBusyCursor(); } virtual void BeginBusyState () const { wxBeginBusyCursor(); }
virtual void BeginInteractiveBusyState (wxWindow *window); virtual void BeginInteractiveBusyState (wxWindow *window);
virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const { ThrowTextModeRequired(); } virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const { ThrowTextModeRequired(); }
wxHyperlinkCtrl *CreateHyperlink (wxWindow *parent, const wxString &linkUrl, const wxString &linkText) const; wxHyperlinkCtrl *CreateHyperlink (wxWindow *parent, const wxString &linkUrl, const wxString &linkText) const;
virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const; virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const;
virtual void CreateVolume (shared_ptr <VolumeCreationOptions> options) const { ThrowTextModeRequired(); } virtual void CreateVolume (shared_ptr <VolumeCreationOptions> options) const { ThrowTextModeRequired(); }

View File

@@ -277,7 +277,7 @@ namespace VeraCrypt
shared_ptr <Pkcs5Kdf> kdf; shared_ptr <Pkcs5Kdf> kdf;
if (CmdLine->ArgHash) if (CmdLine->ArgHash)
{ {
kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, false); kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
} }
shared_ptr <Volume> normalVolume; shared_ptr <Volume> normalVolume;
@@ -315,7 +315,6 @@ namespace VeraCrypt
options->Password, options->Password,
options->Pim, options->Pim,
kdf, kdf,
false,
options->Keyfiles, options->Keyfiles,
options->EMVSupportEnabled, options->EMVSupportEnabled,
options->Protection, options->Protection,
@@ -341,7 +340,6 @@ namespace VeraCrypt
options->Password, options->Password,
options->Pim, options->Pim,
kdf, kdf,
false,
options->Keyfiles, options->Keyfiles,
options->EMVSupportEnabled, options->EMVSupportEnabled,
options->Protection, options->Protection,
@@ -437,7 +435,7 @@ namespace VeraCrypt
ShowInfo ("VOL_HEADER_BACKED_UP"); ShowInfo ("VOL_HEADER_BACKED_UP");
} }
void TextUserInterface::ChangePassword (shared_ptr <VolumePath> volumePath, shared_ptr <VolumePassword> password, int pim, shared_ptr <Hash> currentHash, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Hash> newHash) const void TextUserInterface::ChangePassword (shared_ptr <VolumePath> volumePath, shared_ptr <VolumePassword> password, int pim, shared_ptr <Hash> currentHash, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Hash> newHash) const
{ {
shared_ptr <Volume> volume; shared_ptr <Volume> volume;
@@ -459,7 +457,7 @@ namespace VeraCrypt
shared_ptr<Pkcs5Kdf> kdf; shared_ptr<Pkcs5Kdf> kdf;
if (currentHash) if (currentHash)
{ {
kdf = Pkcs5Kdf::GetAlgorithm (*currentHash, truecryptMode); kdf = Pkcs5Kdf::GetAlgorithm (*currentHash);
} }
while (true) while (true)
@@ -475,7 +473,7 @@ namespace VeraCrypt
} }
// current PIM // current PIM
if (!truecryptMode && !Preferences.NonInteractive && (pim < 0)) if (!Preferences.NonInteractive && (pim < 0))
{ {
pim = AskPim (_("Enter current PIM")); pim = AskPim (_("Enter current PIM"));
} }
@@ -489,7 +487,7 @@ namespace VeraCrypt
try try
{ {
keyfiles.reset (new KeyfileList); 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&) catch (PasswordException&)
{ {
@@ -499,7 +497,7 @@ namespace VeraCrypt
} }
if (!volume.get()) 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) catch (PasswordException &e)
{ {
@@ -535,7 +533,7 @@ namespace VeraCrypt
UserEnrichRandomPool(); UserEnrichRandomPool();
Core->ChangePassword (volume, newPassword, newPim, newKeyfiles, true, Core->ChangePassword (volume, newPassword, newPim, newKeyfiles, true,
newHash ? Pkcs5Kdf::GetAlgorithm (*newHash, false) : shared_ptr <Pkcs5Kdf>()); newHash ? Pkcs5Kdf::GetAlgorithm (*newHash) : shared_ptr <Pkcs5Kdf>());
ShowInfo ("PASSWORD_CHANGED"); ShowInfo ("PASSWORD_CHANGED");
} }
@@ -815,7 +813,7 @@ namespace VeraCrypt
shared_ptr <Hash> selectedHash = hashes[AskSelection (hashes.size(), 1) - 1]; shared_ptr <Hash> selectedHash = hashes[AskSelection (hashes.size(), 1) - 1];
RandomNumberGenerator::SetHash (selectedHash); RandomNumberGenerator::SetHash (selectedHash);
options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*selectedHash, false); options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*selectedHash);
} }
@@ -1266,7 +1264,7 @@ namespace VeraCrypt
if (!options.Password) if (!options.Password)
options.Password = AskPassword(); options.Password = AskPassword();
if (!options.TrueCryptMode && (options.Pim < 0)) if (options.Pim < 0)
options.Pim = AskPim (_("Enter PIM")); options.Pim = AskPim (_("Enter PIM"));
if (!options.Keyfiles) if (!options.Keyfiles)
@@ -1336,7 +1334,7 @@ namespace VeraCrypt
options.Password = AskPassword (StringFormatter (_("Enter password for {0}"), wstring (*options.Path))); 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))); options.Pim = AskPim (StringFormatter (_("Enter PIM for {0}"), wstring (*options.Path)));
} }
@@ -1355,7 +1353,7 @@ namespace VeraCrypt
{ {
if (!options.ProtectionPassword) if (!options.ProtectionPassword)
options.ProtectionPassword = AskPassword (_("Enter password for hidden volume")); 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")); options.ProtectionPim = AskPim (_("Enter PIM for hidden volume"));
if (!options.ProtectionKeyfiles) if (!options.ProtectionKeyfiles)
options.ProtectionKeyfiles = AskKeyfiles (_("Enter keyfile for hidden volume")); options.ProtectionKeyfiles = AskKeyfiles (_("Enter keyfile for hidden volume"));
@@ -1504,7 +1502,7 @@ namespace VeraCrypt
shared_ptr <Pkcs5Kdf> kdf; shared_ptr <Pkcs5Kdf> kdf;
if (CmdLine->ArgHash) if (CmdLine->ArgHash)
{ {
kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, false); kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
} }
ShowInfo (LangString["HEADER_RESTORE_EXTERNAL_INTERNAL"]); ShowInfo (LangString["HEADER_RESTORE_EXTERNAL_INTERNAL"]);
@@ -1551,7 +1549,6 @@ namespace VeraCrypt
options.Password, options.Password,
options.Pim, options.Pim,
kdf, kdf,
false,
options.Keyfiles, options.Keyfiles,
options.EMVSupportEnabled, options.EMVSupportEnabled,
options.Protection, options.Protection,
@@ -1660,7 +1657,7 @@ namespace VeraCrypt
// Decrypt header // Decrypt header
shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password, options.EMVSupportEnabled); shared_ptr <VolumePassword> 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; decryptedLayout = layout;
break; break;

View File

@@ -35,7 +35,7 @@ namespace VeraCrypt
virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const; virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const;
virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const; virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const;
virtual void BeginBusyState () const { } virtual void BeginBusyState () const { }
virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const; virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const;
virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const; virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const;
virtual void CreateVolume (shared_ptr <VolumeCreationOptions> options) const; virtual void CreateVolume (shared_ptr <VolumeCreationOptions> options) const;
virtual void DeleteSecurityTokenKeyfiles () const; virtual void DeleteSecurityTokenKeyfiles () const;

View File

@@ -255,7 +255,7 @@ namespace VeraCrypt
#endif #endif
prop << LangString["MOUNT_POINT"] << L": " << wstring (volume.MountPoint) << L'\n'; prop << LangString["MOUNT_POINT"] << L": " << wstring (volume.MountPoint) << L'\n';
prop << LangString["SIZE"] << L": " << SizeToString (volume.Size) << 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'; 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 (VolumeEncryptionNotCompleted, LangString["ERR_ENCRYPTION_NOT_COMPLETED"]);
EX2MSG (VolumeHostInUse, LangString["LINUX_EX2MSG_VOLUMEHOSTINUSE"]); EX2MSG (VolumeHostInUse, LangString["LINUX_EX2MSG_VOLUMEHOSTINUSE"]);
EX2MSG (VolumeSlotUnavailable, LangString["LINUX_EX2MSG_VOLUMESLOTUNAVAILABLE"]); EX2MSG (VolumeSlotUnavailable, LangString["LINUX_EX2MSG_VOLUMESLOTUNAVAILABLE"]);
EX2MSG (UnsupportedAlgoInTrueCryptMode, LangString["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
EX2MSG (UnsupportedTrueCryptFormat, LangString["UNSUPPORTED_TRUECRYPT_FORMAT"]);
#ifdef TC_MACOSX #ifdef TC_MACOSX
EX2MSG (HigherFuseVersionRequired, LangString["LINUX_EX2MSG_HIGHERFUSEVERSIONREQUIRED"]); EX2MSG (HigherFuseVersionRequired, LangString["LINUX_EX2MSG_HIGHERFUSEVERSIONREQUIRED"]);
@@ -967,10 +965,9 @@ namespace VeraCrypt
cmdLine.ArgMountOptions.Pim = cmdLine.ArgPim; cmdLine.ArgMountOptions.Pim = cmdLine.ArgPim;
cmdLine.ArgMountOptions.Keyfiles = cmdLine.ArgKeyfiles; cmdLine.ArgMountOptions.Keyfiles = cmdLine.ArgKeyfiles;
cmdLine.ArgMountOptions.SharedAccessAllowed = cmdLine.ArgForce; cmdLine.ArgMountOptions.SharedAccessAllowed = cmdLine.ArgForce;
cmdLine.ArgMountOptions.TrueCryptMode = cmdLine.ArgTrueCryptMode;
if (cmdLine.ArgHash) 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; return true;
case CommandId::ChangePassword: 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; return true;
case CommandId::CreateKeyfile: case CommandId::CreateKeyfile:
@@ -1068,7 +1065,7 @@ namespace VeraCrypt
if (cmdLine.ArgHash) if (cmdLine.ArgHash)
{ {
options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash, false); options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*cmdLine.ArgHash);
RandomNumberGenerator::SetHash (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" " Use text user interface. Graphical user interface is used by default if\n"
" available. This option must be specified as the first argument.\n" " available. This option must be specified as the first argument.\n"
"\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" "--token-lib=LIB_PATH\n"
" Use specified PKCS #11 security token library.\n" " Use specified PKCS #11 security token library.\n"
"\n" "\n"
@@ -1600,7 +1592,7 @@ namespace VeraCrypt
return dateStr; 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; wxString sResult;
switch (type) switch (type)
@@ -1618,8 +1610,6 @@ namespace VeraCrypt
break; break;
} }
if (truecryptMode)
sResult = wxT("TrueCrypt-") + sResult;
return sResult; return sResult;
} }
@@ -1693,8 +1683,6 @@ namespace VeraCrypt
VC_CONVERT_EXCEPTION (SecurityTokenLibraryNotInitialized); VC_CONVERT_EXCEPTION (SecurityTokenLibraryNotInitialized);
VC_CONVERT_EXCEPTION (SecurityTokenKeyfileAlreadyExists); VC_CONVERT_EXCEPTION (SecurityTokenKeyfileAlreadyExists);
VC_CONVERT_EXCEPTION (SecurityTokenKeyfileNotFound); VC_CONVERT_EXCEPTION (SecurityTokenKeyfileNotFound);
VC_CONVERT_EXCEPTION (UnsupportedAlgoInTrueCryptMode);
VC_CONVERT_EXCEPTION (UnsupportedTrueCryptFormat);
VC_CONVERT_EXCEPTION (SystemException); VC_CONVERT_EXCEPTION (SystemException);
VC_CONVERT_EXCEPTION (CipherException); VC_CONVERT_EXCEPTION (CipherException);
VC_CONVERT_EXCEPTION (VolumeException); VC_CONVERT_EXCEPTION (VolumeException);

View File

@@ -33,7 +33,7 @@ namespace VeraCrypt
virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const = 0; virtual bool AskYesNo (const wxString &message, bool defaultYes = false, bool warning = false) const = 0;
virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const = 0; virtual void BackupVolumeHeaders (shared_ptr <VolumePath> volumePath) const = 0;
virtual void BeginBusyState () const = 0; virtual void BeginBusyState () const = 0;
virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), bool truecryptMode = false, shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const = 0; virtual void ChangePassword (shared_ptr <VolumePath> volumePath = shared_ptr <VolumePath>(), shared_ptr <VolumePassword> password = shared_ptr <VolumePassword>(), int pim = 0, shared_ptr <Hash> currentHash = shared_ptr <Hash>(), shared_ptr <KeyfileList> keyfiles = shared_ptr <KeyfileList>(), shared_ptr <VolumePassword> newPassword = shared_ptr <VolumePassword>(), int newPim = 0, shared_ptr <KeyfileList> newKeyfiles = shared_ptr <KeyfileList>(), shared_ptr <Hash> newHash = shared_ptr <Hash>()) const = 0;
virtual void CheckRequirementsForMountingVolume () const; virtual void CheckRequirementsForMountingVolume () const;
virtual void CloseExplorerWindows (shared_ptr <VolumeInfo> mountedVolume) const; virtual void CloseExplorerWindows (shared_ptr <VolumeInfo> mountedVolume) const;
virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const = 0; virtual void CreateKeyfile (shared_ptr <FilePath> keyfilePath = shared_ptr <FilePath>()) const = 0;
@@ -85,7 +85,7 @@ namespace VeraCrypt
virtual WaitThreadUI* GetWaitThreadUI(WaitThreadRoutine *pRoutine) const { return new WaitThreadUI(pRoutine);} 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 wxDateTime VolumeTimeToDateTime (VolumeTime volumeTime) const { return wxDateTime ((time_t) (volumeTime / 1000ULL / 1000 / 10 - 134774ULL * 24 * 3600)); }
virtual wxString VolumeTimeToString (VolumeTime volumeTime) const; 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; Event PreferencesUpdatedEvent;

View File

@@ -110,8 +110,6 @@ namespace VeraCrypt
TC_CONFIG_SET (WipeCacheOnAutoDismount); TC_CONFIG_SET (WipeCacheOnAutoDismount);
TC_CONFIG_SET (WipeCacheOnClose); TC_CONFIG_SET (WipeCacheOnClose);
SetValue (configMap[L"DefaultTrueCryptMode"], DefaultMountOptions.TrueCryptMode);
wstring defaultPrf; wstring defaultPrf;
SetValue (configMap[L"DefaultPRF"], defaultPrf); SetValue (configMap[L"DefaultPRF"], defaultPrf);
@@ -119,7 +117,7 @@ namespace VeraCrypt
try try
{ {
if (defaultPrf != L"autodetection") if (defaultPrf != L"autodetection")
savedKdf = Pkcs5Kdf::GetAlgorithm (defaultPrf, DefaultMountOptions.TrueCryptMode); savedKdf = Pkcs5Kdf::GetAlgorithm (defaultPrf);
} }
catch (ParameterIncorrect&) catch (ParameterIncorrect&)
{ {
@@ -225,8 +223,6 @@ namespace VeraCrypt
TC_CONFIG_ADD (WipeCacheOnAutoDismount); TC_CONFIG_ADD (WipeCacheOnAutoDismount);
TC_CONFIG_ADD (WipeCacheOnClose); TC_CONFIG_ADD (WipeCacheOnClose);
formatter.AddEntry (L"DefaultTrueCryptMode", DefaultMountOptions.TrueCryptMode);
wstring defaultPrf = L"autodetection"; wstring defaultPrf = L"autodetection";
if (DefaultMountOptions.Kdf) if (DefaultMountOptions.Kdf)
defaultPrf = DefaultMountOptions.Kdf->GetName (); defaultPrf = DefaultMountOptions.Kdf->GetName ();

View File

@@ -96,8 +96,6 @@ namespace VeraCrypt
TC_EXCEPTION (TestFailed); \ TC_EXCEPTION (TestFailed); \
TC_EXCEPTION (TimeOut); \ TC_EXCEPTION (TimeOut); \
TC_EXCEPTION (UnknownException); \ TC_EXCEPTION (UnknownException); \
TC_EXCEPTION (UnsupportedAlgoInTrueCryptMode); \
TC_EXCEPTION (UnsupportedTrueCryptFormat); \
TC_EXCEPTION (UserAbort) TC_EXCEPTION (UserAbort)
TC_EXCEPTION_SET; TC_EXCEPTION_SET;

View File

@@ -1151,11 +1151,6 @@ void handleError_Dll (MSIHANDLE hInstaller, int code, const char* srcPos)
// A non-error // A non-error
break; 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: default:
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("ERR_UNKNOWN"), code); StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("ERR_UNKNOWN"), code);
MSILogAndShow (hInstaller, MSI_ERROR_LEVEL, AppendSrcPos (szTmp, srcPos).c_str()); MSILogAndShow (hInstaller, MSI_ERROR_LEVEL, AppendSrcPos (szTmp, srcPos).c_str());

View File

@@ -1086,12 +1086,12 @@ namespace VeraCrypt
if (memcmp (derivedKey.Ptr(), "\x8d\x51\xfa\x31", 4) != 0) if (memcmp (derivedKey.Ptr(), "\x8d\x51\xfa\x31", 4) != 0)
throw TestFailed (SRC_POS); throw TestFailed (SRC_POS);
Pkcs5HmacSha512 pkcs5HmacSha512(false); Pkcs5HmacSha512 pkcs5HmacSha512;
pkcs5HmacSha512.DeriveKey (derivedKey, password, salt, 5); pkcs5HmacSha512.DeriveKey (derivedKey, password, salt, 5);
if (memcmp (derivedKey.Ptr(), "\x13\x64\xae\xf8", 4) != 0) if (memcmp (derivedKey.Ptr(), "\x13\x64\xae\xf8", 4) != 0)
throw TestFailed (SRC_POS); throw TestFailed (SRC_POS);
Pkcs5HmacWhirlpool pkcs5HmacWhirlpool(false); Pkcs5HmacWhirlpool pkcs5HmacWhirlpool;
pkcs5HmacWhirlpool.DeriveKey (derivedKey, password, salt, 5); pkcs5HmacWhirlpool.DeriveKey (derivedKey, password, salt, 5);
if (memcmp (derivedKey.Ptr(), "\x50\x7c\x36\x6f", 4) != 0) if (memcmp (derivedKey.Ptr(), "\x50\x7c\x36\x6f", 4) != 0)
throw TestFailed (SRC_POS); throw TestFailed (SRC_POS);

View File

@@ -16,7 +16,7 @@
namespace VeraCrypt namespace VeraCrypt
{ {
Pkcs5Kdf::Pkcs5Kdf (bool truecryptMode) : m_truecryptMode(truecryptMode) Pkcs5Kdf::Pkcs5Kdf ()
{ {
} }
@@ -29,9 +29,9 @@ namespace VeraCrypt
DeriveKey (key, password, salt, GetIterationCount(pim)); DeriveKey (key, password, salt, GetIterationCount(pim));
} }
shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const wstring &name, bool truecryptMode) shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const wstring &name)
{ {
foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms(truecryptMode)) foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms())
{ {
if (kdf->GetName() == name) if (kdf->GetName() == name)
return kdf; return kdf;
@@ -39,9 +39,9 @@ namespace VeraCrypt
throw ParameterIncorrect (SRC_POS); throw ParameterIncorrect (SRC_POS);
} }
shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const Hash &hash, bool truecryptMode) shared_ptr <Pkcs5Kdf> Pkcs5Kdf::GetAlgorithm (const Hash &hash)
{ {
foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms(truecryptMode)) foreach (shared_ptr <Pkcs5Kdf> kdf, GetAvailableAlgorithms())
{ {
if (typeid (*kdf->GetHash()) == typeid (hash)) if (typeid (*kdf->GetHash()) == typeid (hash))
return kdf; return kdf;
@@ -50,23 +50,15 @@ namespace VeraCrypt
throw ParameterIncorrect (SRC_POS); throw ParameterIncorrect (SRC_POS);
} }
Pkcs5KdfList Pkcs5Kdf::GetAvailableAlgorithms (bool truecryptMode) Pkcs5KdfList Pkcs5Kdf::GetAvailableAlgorithms ()
{ {
Pkcs5KdfList l; Pkcs5KdfList l;
if (truecryptMode) l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 ()));
{ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256 ()));
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 (true))); l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s ()));
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool (true))); l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool ()));
} l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacStreebog ()));
else
{
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 (false)));
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256 ()));
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s ()));
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool (false)));
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacStreebog ()));
}
return l; return l;
} }

View File

@@ -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, int pim, const ConstBufferPtr &salt) const;
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const = 0; virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const = 0;
static shared_ptr <Pkcs5Kdf> GetAlgorithm (const wstring &name, bool truecryptMode); static shared_ptr <Pkcs5Kdf> GetAlgorithm (const wstring &name);
static shared_ptr <Pkcs5Kdf> GetAlgorithm (const Hash &hash, bool truecryptMode); static shared_ptr <Pkcs5Kdf> GetAlgorithm (const Hash &hash);
static Pkcs5KdfList GetAvailableAlgorithms (bool truecryptMode); static Pkcs5KdfList GetAvailableAlgorithms ();
virtual shared_ptr <Hash> GetHash () const = 0; virtual shared_ptr <Hash> GetHash () const = 0;
virtual int GetIterationCount (int pim) const = 0; virtual int GetIterationCount (int pim) const = 0;
virtual wstring GetName () const = 0; virtual wstring GetName () const = 0;
virtual Pkcs5Kdf* Clone () const = 0; virtual Pkcs5Kdf* Clone () const = 0;
virtual bool IsDeprecated () const { return GetHash()->IsDeprecated(); } virtual bool IsDeprecated () const { return GetHash()->IsDeprecated(); }
bool GetTrueCryptMode () const { return m_truecryptMode;}
void SetTrueCryptMode (bool truecryptMode) { m_truecryptMode = truecryptMode;}
protected: protected:
bool m_truecryptMode; Pkcs5Kdf ();
Pkcs5Kdf (bool truecryptMode);
void ValidateParameters (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; 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 class Pkcs5HmacBlake2s_Boot : public Pkcs5Kdf
{ {
public: public:
Pkcs5HmacBlake2s_Boot () : Pkcs5Kdf(false) { } Pkcs5HmacBlake2s_Boot () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacBlake2s_Boot () { } virtual ~Pkcs5HmacBlake2s_Boot () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; 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 class Pkcs5HmacBlake2s : public Pkcs5Kdf
{ {
public: public:
Pkcs5HmacBlake2s () : Pkcs5Kdf(false) { } Pkcs5HmacBlake2s () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacBlake2s () { } virtual ~Pkcs5HmacBlake2s () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; 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 class Pkcs5HmacSha256_Boot : public Pkcs5Kdf
{ {
public: public:
Pkcs5HmacSha256_Boot () : Pkcs5Kdf(false) { } Pkcs5HmacSha256_Boot () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacSha256_Boot () { } virtual ~Pkcs5HmacSha256_Boot () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; 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 class Pkcs5HmacSha256 : public Pkcs5Kdf
{ {
public: public:
Pkcs5HmacSha256 () : Pkcs5Kdf(false) { } Pkcs5HmacSha256 () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacSha256 () { } virtual ~Pkcs5HmacSha256 () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; 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 class Pkcs5HmacSha512 : public Pkcs5Kdf
{ {
public: public:
Pkcs5HmacSha512 (bool truecryptMode) : Pkcs5Kdf(truecryptMode) { } Pkcs5HmacSha512 () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacSha512 () { } virtual ~Pkcs5HmacSha512 () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (new Sha512); } virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (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 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: private:
Pkcs5HmacSha512 (const Pkcs5HmacSha512 &); Pkcs5HmacSha512 (const Pkcs5HmacSha512 &);
@@ -139,14 +136,14 @@ namespace VeraCrypt
class Pkcs5HmacWhirlpool : public Pkcs5Kdf class Pkcs5HmacWhirlpool : public Pkcs5Kdf
{ {
public: public:
Pkcs5HmacWhirlpool (bool truecryptMode) : Pkcs5Kdf(truecryptMode) { } Pkcs5HmacWhirlpool () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacWhirlpool () { } virtual ~Pkcs5HmacWhirlpool () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;
virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (new Whirlpool); } virtual shared_ptr <Hash> GetHash () const { return shared_ptr <Hash> (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 wstring GetName () const { return L"HMAC-Whirlpool"; }
virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacWhirlpool(m_truecryptMode); } virtual Pkcs5Kdf* Clone () const { return new Pkcs5HmacWhirlpool(); }
private: private:
Pkcs5HmacWhirlpool (const Pkcs5HmacWhirlpool &); Pkcs5HmacWhirlpool (const Pkcs5HmacWhirlpool &);
@@ -156,7 +153,7 @@ namespace VeraCrypt
class Pkcs5HmacStreebog : public Pkcs5Kdf class Pkcs5HmacStreebog : public Pkcs5Kdf
{ {
public: public:
Pkcs5HmacStreebog () : Pkcs5Kdf(false) { } Pkcs5HmacStreebog () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacStreebog () { } virtual ~Pkcs5HmacStreebog () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; 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 class Pkcs5HmacStreebog_Boot : public Pkcs5Kdf
{ {
public: public:
Pkcs5HmacStreebog_Boot () : Pkcs5Kdf(false) { } Pkcs5HmacStreebog_Boot () : Pkcs5Kdf() { }
virtual ~Pkcs5HmacStreebog_Boot () { } virtual ~Pkcs5HmacStreebog_Boot () { }
virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const; virtual void DeriveKey (const BufferPtr &key, const VolumePassword &password, const ConstBufferPtr &salt, int iterationCount) const;

View File

@@ -30,7 +30,6 @@ namespace VeraCrypt
TopWriteOffset (0), TopWriteOffset (0),
TotalDataRead (0), TotalDataRead (0),
TotalDataWritten (0), TotalDataWritten (0),
TrueCryptMode (false),
Pim (0), Pim (0),
EncryptionNotCompleted (false) EncryptionNotCompleted (false)
{ {
@@ -71,7 +70,7 @@ namespace VeraCrypt
return EA->GetMode(); return EA->GetMode();
} }
void Volume::Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr <Pkcs5Kdf> protectionKdf, shared_ptr <KeyfileList> protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) void Volume::Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr <Pkcs5Kdf> protectionKdf, shared_ptr <KeyfileList> protectionKeyfiles, bool sharedAccessAllowed, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope)
{ {
make_shared_auto (File, file); make_shared_auto (File, file);
@@ -102,18 +101,14 @@ namespace VeraCrypt
throw; 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 <File> volumeFile, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr <Pkcs5Kdf> protectionKdf,shared_ptr <KeyfileList> protectionKeyfiles, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope) void Volume::Open (shared_ptr <File> volumeFile, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection, shared_ptr <VolumePassword> protectionPassword, int protectionPim, shared_ptr <Pkcs5Kdf> protectionKdf,shared_ptr <KeyfileList> protectionKeyfiles, VolumeType::Enum volumeType, bool useBackupHeaders, bool partitionInSystemEncryptionScope)
{ {
if (!volumeFile) if (!volumeFile)
throw ParameterIncorrect (SRC_POS); 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; Protection = protection;
VolumeFile = volumeFile; VolumeFile = volumeFile;
SystemEncryption = partitionInSystemEncryptionScope; SystemEncryption = partitionInSystemEncryptionScope;
@@ -190,11 +185,11 @@ namespace VeraCrypt
shared_ptr <VolumeHeader> header = layout->GetHeader(); shared_ptr <VolumeHeader> 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 // 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 // VolumeLayoutV1Normal has been opened as VolumeLayoutV2Normal
layout.reset (new VolumeLayoutV1Normal); layout.reset (new VolumeLayoutV1Normal);
@@ -202,7 +197,6 @@ namespace VeraCrypt
layout->SetHeader (header); layout->SetHeader (header);
} }
TrueCryptMode = truecryptMode;
Pim = pim; Pim = pim;
Type = layout->GetType(); Type = layout->GetType();
SectorSize = header->GetSectorSize(); SectorSize = header->GetSectorSize();
@@ -248,7 +242,7 @@ namespace VeraCrypt
Volume protectedVolume; Volume protectedVolume;
protectedVolume.Open (VolumeFile, protectedVolume.Open (VolumeFile,
protectionPassword, protectionPim, protectionKdf, truecryptMode, protectionKeyfiles, protectionPassword, protectionPim, protectionKdf, protectionKeyfiles,
emvSupportEnabled, emvSupportEnabled,
VolumeProtection::ReadOnly, VolumeProtection::ReadOnly,
shared_ptr <VolumePassword> (), 0, shared_ptr <Pkcs5Kdf> (),shared_ptr <KeyfileList> (), shared_ptr <VolumePassword> (), 0, shared_ptr <Pkcs5Kdf> (),shared_ptr <KeyfileList> (),
@@ -287,8 +281,8 @@ namespace VeraCrypt
Buffer mbr (VolumeFile->GetDeviceSectorSize()); Buffer mbr (VolumeFile->GetDeviceSectorSize());
driveDevice.ReadAt (mbr, 0); driveDevice.ReadAt (mbr, 0);
// Search for the string "VeraCrypt" or "TrueCrypt" // Search for the string "VeraCrypt"
const char* bootSignature = truecryptMode? "TrueCrypt" : TC_APP_NAME; const char* bootSignature = TC_APP_NAME;
size_t nameLen = strlen (bootSignature); size_t nameLen = strlen (bootSignature);
for (size_t i = 0; i < mbr.Size() - nameLen; ++i) for (size_t i = 0; i < mbr.Size() - nameLen; ++i)
{ {

View File

@@ -52,20 +52,6 @@ namespace VeraCrypt
return Data.substr (pos + 1); 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: protected:
wstring Data; wstring Data;
@@ -118,13 +104,12 @@ namespace VeraCrypt
uint64 GetTotalDataRead () const { return TotalDataRead; } uint64 GetTotalDataRead () const { return TotalDataRead; }
uint64 GetTotalDataWritten () const { return TotalDataWritten; } uint64 GetTotalDataWritten () const { return TotalDataWritten; }
VolumeType::Enum GetType () const { return Type; } VolumeType::Enum GetType () const { return Type; }
bool GetTrueCryptMode() const { return TrueCryptMode; }
int GetPim() const { return Pim;} int GetPim() const { return Pim;}
uint64 GetVolumeCreationTime () const { return Header->GetVolumeCreationTime(); } uint64 GetVolumeCreationTime () const { return Header->GetVolumeCreationTime(); }
bool IsHiddenVolumeProtectionTriggered () const { return HiddenVolumeProtectionTriggered; } bool IsHiddenVolumeProtectionTriggered () const { return HiddenVolumeProtectionTriggered; }
bool IsInSystemEncryptionScope () const { return SystemEncryption; } bool IsInSystemEncryptionScope () const { return SystemEncryption; }
void Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr <Pkcs5Kdf> protectionKdf = shared_ptr <Pkcs5Kdf> (),shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false); void Open (const VolumePath &volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr <Pkcs5Kdf> protectionKdf = shared_ptr <Pkcs5Kdf> (),shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), bool sharedAccessAllowed = false, VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false);
void Open (shared_ptr <File> volumeFile, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr <Pkcs5Kdf> protectionKdf = shared_ptr <Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false); void Open (shared_ptr <File> volumeFile, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, bool emvSupportEnabled, VolumeProtection::Enum protection = VolumeProtection::None, shared_ptr <VolumePassword> protectionPassword = shared_ptr <VolumePassword> (), int protectionPim = 0, shared_ptr <Pkcs5Kdf> protectionKdf = shared_ptr <Pkcs5Kdf> (), shared_ptr <KeyfileList> protectionKeyfiles = shared_ptr <KeyfileList> (), VolumeType::Enum volumeType = VolumeType::Unknown, bool useBackupHeaders = false, bool partitionInSystemEncryptionScope = false);
void ReadSectors (const BufferPtr &buffer, uint64 byteOffset); void ReadSectors (const BufferPtr &buffer, uint64 byteOffset);
void ReEncryptHeader (bool backupHeader, const ConstBufferPtr &newSalt, const ConstBufferPtr &newHeaderKey, shared_ptr <Pkcs5Kdf> newPkcs5Kdf); void ReEncryptHeader (bool backupHeader, const ConstBufferPtr &newSalt, const ConstBufferPtr &newHeaderKey, shared_ptr <Pkcs5Kdf> newPkcs5Kdf);
void WriteSectors (const ConstBufferPtr &buffer, uint64 byteOffset); void WriteSectors (const ConstBufferPtr &buffer, uint64 byteOffset);
@@ -152,7 +137,6 @@ namespace VeraCrypt
uint64 TopWriteOffset; uint64 TopWriteOffset;
uint64 TotalDataRead; uint64 TotalDataRead;
uint64 TotalDataWritten; uint64 TotalDataWritten;
bool TrueCryptMode;
int Pim; int Pim;
bool EncryptionNotCompleted; bool EncryptionNotCompleted;

View File

@@ -82,7 +82,7 @@ namespace VeraCrypt
EncryptNew (headerBuffer, options.Salt, options.HeaderKey, options.Kdf); EncryptNew (headerBuffer, options.Salt, options.HeaderKey, options.Kdf);
} }
bool VolumeHeader::Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> 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 <Pkcs5Kdf> kdf, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes)
{ {
if (password.Size() < 1) if (password.Size() < 1)
throw PasswordEmpty (SRC_POS); throw PasswordEmpty (SRC_POS);
@@ -125,7 +125,7 @@ namespace VeraCrypt
header.CopyFrom (encryptedData.GetRange (EncryptedHeaderDataOffset, EncryptedHeaderDataSize)); header.CopyFrom (encryptedData.GetRange (EncryptedHeaderDataOffset, EncryptedHeaderDataSize));
ea->Decrypt (header); ea->Decrypt (header);
if (Deserialize (header, ea, mode, truecryptMode)) if (Deserialize (header, ea, mode))
{ {
EA = ea; EA = ea;
Pkcs5 = pkcs5; Pkcs5 = pkcs5;
@@ -138,18 +138,12 @@ namespace VeraCrypt
return false; return false;
} }
bool VolumeHeader::Deserialize (const ConstBufferPtr &header, shared_ptr <EncryptionAlgorithm> &ea, shared_ptr <EncryptionMode> &mode, bool truecryptMode) bool VolumeHeader::Deserialize (const ConstBufferPtr &header, shared_ptr <EncryptionAlgorithm> &ea, shared_ptr <EncryptionMode> &mode)
{ {
if (header.Size() != EncryptedHeaderDataSize) if (header.Size() != EncryptedHeaderDataSize)
throw ParameterIncorrect (SRC_POS); throw ParameterIncorrect (SRC_POS);
if (truecryptMode && (header[0] != 'T' || if ((header[0] != 'V' ||
header[1] != 'R' ||
header[2] != 'U' ||
header[3] != 'E'))
return false;
if (!truecryptMode && (header[0] != 'V' ||
header[1] != 'E' || header[1] != 'E' ||
header[2] != 'R' || header[2] != 'R' ||
header[3] != 'A')) header[3] != 'A'))
@@ -173,16 +167,9 @@ namespace VeraCrypt
RequiredMinProgramVersion = DeserializeEntry <uint16> (header, offset); RequiredMinProgramVersion = DeserializeEntry <uint16> (header, offset);
if (!truecryptMode && (RequiredMinProgramVersion > Version::Number())) if ((RequiredMinProgramVersion > Version::Number()))
throw HigherVersionRequired (SRC_POS); throw HigherVersionRequired (SRC_POS);
if (truecryptMode)
{
if (RequiredMinProgramVersion < 0x600 || RequiredMinProgramVersion > 0x71a)
throw UnsupportedTrueCryptFormat (SRC_POS);
RequiredMinProgramVersion = CurrentRequiredMinProgramVersion;
}
VolumeKeyAreaCrc32 = DeserializeEntry <uint32> (header, offset); VolumeKeyAreaCrc32 = DeserializeEntry <uint32> (header, offset);
VolumeCreationTime = DeserializeEntry <uint64> (header, offset); VolumeCreationTime = DeserializeEntry <uint64> (header, offset);
HeaderCreationTime = DeserializeEntry <uint64> (header, offset); HeaderCreationTime = DeserializeEntry <uint64> (header, offset);

View File

@@ -60,7 +60,7 @@ namespace VeraCrypt
virtual ~VolumeHeader (); virtual ~VolumeHeader ();
void Create (const BufferPtr &headerBuffer, VolumeHeaderCreationOptions &options); void Create (const BufferPtr &headerBuffer, VolumeHeaderCreationOptions &options);
bool Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes); bool Decrypt (const ConstBufferPtr &encryptedData, const VolumePassword &password, int pim, shared_ptr <Pkcs5Kdf> kdf, const Pkcs5KdfList &keyDerivationFunctions, const EncryptionAlgorithmList &encryptionAlgorithms, const EncryptionModeList &encryptionModes);
void EncryptNew (const BufferPtr &newHeaderBuffer, const ConstBufferPtr &newSalt, const ConstBufferPtr &newHeaderKey, shared_ptr <Pkcs5Kdf> newPkcs5Kdf); void EncryptNew (const BufferPtr &newHeaderBuffer, const ConstBufferPtr &newSalt, const ConstBufferPtr &newHeaderKey, shared_ptr <Pkcs5Kdf> newPkcs5Kdf);
uint64 GetEncryptedAreaStart () const { return EncryptedAreaStart; } uint64 GetEncryptedAreaStart () const { return EncryptedAreaStart; }
uint64 GetEncryptedAreaLength () const { return EncryptedAreaLength; } uint64 GetEncryptedAreaLength () const { return EncryptedAreaLength; }
@@ -78,7 +78,7 @@ namespace VeraCrypt
void SetSize (uint32 headerSize); void SetSize (uint32 headerSize);
protected: protected:
bool Deserialize (const ConstBufferPtr &header, shared_ptr <EncryptionAlgorithm> &ea, shared_ptr <EncryptionMode> &mode, bool truecryptMode); bool Deserialize (const ConstBufferPtr &header, shared_ptr <EncryptionAlgorithm> &ea, shared_ptr <EncryptionMode> &mode);
template <typename T> T DeserializeEntry (const ConstBufferPtr &header, size_t &offset) const; template <typename T> T DeserializeEntry (const ConstBufferPtr &header, size_t &offset) const;
template <typename T> T DeserializeEntryAt (const ConstBufferPtr &header, const size_t &offset) const; template <typename T> T DeserializeEntryAt (const ConstBufferPtr &header, const size_t &offset) const;
void Init (); void Init ();

View File

@@ -54,7 +54,6 @@ namespace VeraCrypt
Type = static_cast <VolumeType::Enum> (sr.DeserializeInt32 ("Type")); Type = static_cast <VolumeType::Enum> (sr.DeserializeInt32 ("Type"));
VirtualDevice = sr.DeserializeWString ("VirtualDevice"); VirtualDevice = sr.DeserializeWString ("VirtualDevice");
sr.Deserialize ("VolumeCreationTime", VolumeCreationTime); sr.Deserialize ("VolumeCreationTime", VolumeCreationTime);
sr.Deserialize ("TrueCryptMode", TrueCryptMode);
sr.Deserialize ("Pim", Pim); sr.Deserialize ("Pim", Pim);
} }
@@ -95,7 +94,6 @@ namespace VeraCrypt
sr.Serialize ("Type", static_cast <uint32> (Type)); sr.Serialize ("Type", static_cast <uint32> (Type));
sr.Serialize ("VirtualDevice", wstring (VirtualDevice)); sr.Serialize ("VirtualDevice", wstring (VirtualDevice));
sr.Serialize ("VolumeCreationTime", VolumeCreationTime); sr.Serialize ("VolumeCreationTime", VolumeCreationTime);
sr.Serialize ("TrueCryptMode", TrueCryptMode);
sr.Serialize ("Pim", Pim); sr.Serialize ("Pim", Pim);
} }
@@ -120,7 +118,6 @@ namespace VeraCrypt
TopWriteOffset = volume.GetTopWriteOffset(); TopWriteOffset = volume.GetTopWriteOffset();
TotalDataRead = volume.GetTotalDataRead(); TotalDataRead = volume.GetTotalDataRead();
TotalDataWritten = volume.GetTotalDataWritten(); TotalDataWritten = volume.GetTotalDataWritten();
TrueCryptMode = volume.GetTrueCryptMode();
Pim = volume.GetPim (); Pim = volume.GetPim ();
} }

View File

@@ -60,7 +60,6 @@ namespace VeraCrypt
VolumeType::Enum Type; VolumeType::Enum Type;
DevicePath VirtualDevice; DevicePath VirtualDevice;
VolumeTime VolumeCreationTime; VolumeTime VolumeCreationTime;
bool TrueCryptMode;
int Pim; int Pim;
private: private:

View File

@@ -222,17 +222,14 @@ namespace VeraCrypt
return volumeHostSize; return volumeHostSize;
} }
Pkcs5KdfList VolumeLayoutSystemEncryption::GetSupportedKeyDerivationFunctions (bool truecryptMode) const Pkcs5KdfList VolumeLayoutSystemEncryption::GetSupportedKeyDerivationFunctions () const
{ {
Pkcs5KdfList l; Pkcs5KdfList l;
if (!truecryptMode) l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256_Boot ()));
{ l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s_Boot ()));
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha256_Boot ())); l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 ()));
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacBlake2s_Boot ())); l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool ()));
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacSha512 (false))); l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacStreebog ()));
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacWhirlpool (false)));
l.push_back (shared_ptr <Pkcs5Kdf> (new Pkcs5HmacStreebog ()));
}
return l; return l;
} }
} }

View File

@@ -38,7 +38,7 @@ namespace VeraCrypt
virtual uint32 GetHeaderSize () const { return HeaderSize; } virtual uint32 GetHeaderSize () const { return HeaderSize; }
virtual uint64 GetMaxDataSize (uint64 volumeSize) const = 0; virtual uint64 GetMaxDataSize (uint64 volumeSize) const = 0;
virtual EncryptionAlgorithmList GetSupportedEncryptionAlgorithms () const { return SupportedEncryptionAlgorithms; } 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 EncryptionModeList GetSupportedEncryptionModes () const { return SupportedEncryptionModes; }
virtual VolumeType::Enum GetType () const { return Type; } virtual VolumeType::Enum GetType () const { return Type; }
virtual bool HasBackupHeader () const = 0; virtual bool HasBackupHeader () const = 0;
@@ -126,7 +126,7 @@ namespace VeraCrypt
virtual uint64 GetDataOffset (uint64 volumeHostSize) const; virtual uint64 GetDataOffset (uint64 volumeHostSize) const;
virtual uint64 GetDataSize (uint64 volumeHostSize) const; virtual uint64 GetDataSize (uint64 volumeHostSize) const;
virtual uint64 GetMaxDataSize (uint64 volumeSize) const { throw NotApplicable (SRC_POS); } 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 HasBackupHeader () const { return false; }
virtual bool HasDriveHeader () const { return true; } virtual bool HasDriveHeader () const { return true; }