VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/TextUserInterface.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2014-12-30 16:01:49 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2014-12-30 16:06:20 (GMT)
commitc178e325b807258199ae45b2c50c265b4d7ce7af (patch)
tree905297a12e86b71d4611ff13d1df7e99c1e20b61 /src/Main/TextUserInterface.cpp
parent8d787dcd7128fce554f473da62e20162b0b6c9c4 (diff)
downloadVeraCrypt-c178e325b807258199ae45b2c50c265b4d7ce7af.zip
VeraCrypt-c178e325b807258199ae45b2c50c265b4d7ce7af.tar.gz
Linux/MacOSX: Implement TrueCrypt conversion and loading support. Correct many GTK issues linked to multi-threaded origine of events by implementing an automatic mechanism for handling such requests in the main thread.
Diffstat (limited to 'src/Main/TextUserInterface.cpp')
-rw-r--r--[-rwxr-xr-x]src/Main/TextUserInterface.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
index cf5c915..62fdc23 100755..100644
--- a/src/Main/TextUserInterface.cpp
+++ b/src/Main/TextUserInterface.cpp
@@ -248,7 +248,7 @@ namespace VeraCrypt
shared_ptr <Pkcs5Kdf> kdf;
if (CmdLine->ArgHash)
{
- kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
+ kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, false);
}
shared_ptr <Volume> normalVolume;
@@ -281,6 +281,7 @@ namespace VeraCrypt
options->PreserveTimestamps,
options->Password,
kdf,
+ false,
options->Keyfiles,
options->Protection,
options->ProtectionPassword,
@@ -367,7 +368,7 @@ namespace VeraCrypt
ShowInfo ("VOL_HEADER_BACKED_UP");
}
- void TextUserInterface::ChangePassword (shared_ptr <VolumePath> volumePath, shared_ptr <VolumePassword> password, shared_ptr <Hash> currentHash, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Hash> newHash) const
+ void TextUserInterface::ChangePassword (shared_ptr <VolumePath> volumePath, shared_ptr <VolumePassword> password, shared_ptr <Hash> currentHash, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Hash> newHash) const
{
shared_ptr <Volume> volume;
@@ -389,7 +390,7 @@ namespace VeraCrypt
shared_ptr<Pkcs5Kdf> kdf;
if (currentHash)
{
- kdf = Pkcs5Kdf::GetAlgorithm (*currentHash);
+ kdf = Pkcs5Kdf::GetAlgorithm (*currentHash, truecryptMode);
}
while (true)
@@ -420,7 +421,7 @@ namespace VeraCrypt
try
{
keyfiles.reset (new KeyfileList);
- volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, kdf, keyfiles);
+ volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, kdf, truecryptMode, keyfiles);
}
catch (PasswordException&)
{
@@ -430,7 +431,7 @@ namespace VeraCrypt
}
if (!volume.get())
- volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, kdf, keyfiles);
+ volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, kdf, truecryptMode, keyfiles);
}
catch (PasswordException &e)
{
@@ -464,7 +465,7 @@ namespace VeraCrypt
UserEnrichRandomPool();
Core->ChangePassword (volume, newPassword, newKeyfiles,
- newHash ? Pkcs5Kdf::GetAlgorithm (*newHash) : shared_ptr <Pkcs5Kdf>());
+ newHash ? Pkcs5Kdf::GetAlgorithm (*newHash, false) : shared_ptr <Pkcs5Kdf>());
ShowInfo ("PASSWORD_CHANGED");
}
@@ -692,7 +693,7 @@ namespace VeraCrypt
shared_ptr <Hash> selectedHash = hashes[AskSelection (hashes.size(), 1) - 1];
RandomNumberGenerator::SetHash (selectedHash);
- options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*selectedHash);
+ options->VolumeHeaderKdf = Pkcs5Kdf::GetAlgorithm (*selectedHash, false);
}
@@ -1298,11 +1299,10 @@ namespace VeraCrypt
// Ask whether to restore internal or external backup
bool restoreInternalBackup;
-
shared_ptr <Pkcs5Kdf> kdf;
if (CmdLine->ArgHash)
{
- kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash);
+ kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, false);
}
ShowInfo (LangString["HEADER_RESTORE_EXTERNAL_INTERNAL"]);
@@ -1346,6 +1346,7 @@ namespace VeraCrypt
options.PreserveTimestamps,
options.Password,
kdf,
+ false,
options.Keyfiles,
options.Protection,
options.ProtectionPassword,
@@ -1454,7 +1455,7 @@ namespace VeraCrypt
// Decrypt header
shared_ptr <VolumePassword> passwordKey = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password);
- if (layout->GetHeader()->Decrypt (headerBuffer, *passwordKey, kdf, layout->GetSupportedKeyDerivationFunctions(), layout->GetSupportedEncryptionAlgorithms(), layout->GetSupportedEncryptionModes()))
+ if (layout->GetHeader()->Decrypt (headerBuffer, *passwordKey, kdf, false, layout->GetSupportedKeyDerivationFunctions(false), layout->GetSupportedEncryptionAlgorithms(), layout->GetSupportedEncryptionModes()))
{
decryptedLayout = layout;
break;