From 07156b6c09165cf61a6bd499d26151d1f32bf3a9 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Fri, 19 Dec 2014 18:18:23 +0100 Subject: Linux/MacOSX: Enhance performance by implementing the possibility to choose the correct hash algorithm of volumes during various operations (mount, change password...), both using the GUI and the command line. --- src/Main/CommandLineInterface.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/Main/CommandLineInterface.cpp') diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp index eed8cf22..68e644b5 100644 --- a/src/Main/CommandLineInterface.cpp +++ b/src/Main/CommandLineInterface.cpp @@ -36,6 +36,7 @@ namespace VeraCrypt parser.AddSwitch (L"C", L"change", _("Change password or keyfiles")); parser.AddSwitch (L"c", L"create", _("Create new volume")); parser.AddSwitch (L"", L"create-keyfile", _("Create new keyfile")); + parser.AddOption (L"", L"current-hash", _("Current hash algorithm for change password/keyfiles operation")); parser.AddSwitch (L"", L"delete-token-keyfiles", _("Delete security token keyfiles")); parser.AddSwitch (L"d", L"dismount", _("Dismount volume")); parser.AddSwitch (L"", L"display-password", _("Display password while typing")); @@ -61,6 +62,7 @@ namespace VeraCrypt parser.AddSwitch (L"", L"non-interactive", _("Do not interact with user")); parser.AddOption (L"p", L"password", _("Password")); parser.AddOption (L"", L"protect-hidden", _("Protect hidden volume")); + parser.AddOption (L"", L"protection-hash", _("Hash algorithm for protected hidden volume")); parser.AddOption (L"", L"protection-keyfiles", _("Keyfiles for protected hidden volume")); parser.AddOption (L"", L"protection-password", _("Password for protected hidden volume")); parser.AddOption (L"", L"random-source", _("Use file as source of random data")); @@ -306,6 +308,20 @@ namespace VeraCrypt throw_err (LangString["UNKNOWN_OPTION"] + L": " + str); } + if (parser.Found (L"current-hash", &str)) + { + ArgCurrentHash.reset(); + + foreach (shared_ptr hash, Hash::GetAvailableAlgorithms()) + { + if (wxString (hash->GetName()).IsSameAs (str, false)) + ArgCurrentHash = hash; + } + + if (!ArgCurrentHash) + throw_err (LangString["UNKNOWN_OPTION"] + L": " + str); + } + if (parser.Found (L"keyfiles", &str)) ArgKeyfiles = ToKeyfileList (str); @@ -377,6 +393,22 @@ namespace VeraCrypt ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly; } + if (parser.Found (L"protection-hash", &str)) + { + bool bHashFound = false; + foreach (shared_ptr hash, Hash::GetAvailableAlgorithms()) + { + if (wxString (hash->GetName()).IsSameAs (str, false)) + { + bHashFound = true; + ArgMountOptions.ProtectionKdf = Pkcs5Kdf::GetAlgorithm (*hash); + } + } + + if (!bHashFound) + throw_err (LangString["UNKNOWN_OPTION"] + L": " + str); + } + ArgQuick = parser.Found (L"quick"); if (parser.Found (L"random-source", &str)) -- cgit v1.2.3