VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/TextUserInterface.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-05-10 22:34:27 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-05-10 22:34:27 +0200
commit268ef2d8e904db5068dbdc0fdc7ce3940d6452ea (patch)
treeb1afa687c97fbf5e1ba2c92c5a10479ae5f832f5 /src/Main/TextUserInterface.cpp
parent6d61f06a5348aebe7dbc0bf44d3e2729c20f7fd0 (diff)
parent5f47d8b6f11cdb3c4c2f43e04e5acfc6ffcb3035 (diff)
downloadVeraCrypt-268ef2d8e904db5068dbdc0fdc7ce3940d6452ea.tar.gz
VeraCrypt-268ef2d8e904db5068dbdc0fdc7ce3940d6452ea.zip
Merge pull request #61 from davidfoerster/normalize-line-terminators
Normalize line terminators
Diffstat (limited to 'src/Main/TextUserInterface.cpp')
-rw-r--r--src/Main/TextUserInterface.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
index bddfc0b2..902f4616 100644
--- a/src/Main/TextUserInterface.cpp
+++ b/src/Main/TextUserInterface.cpp
@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
- Modifications and additions to the original source code (contained in this file)
+ Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -165,7 +165,7 @@ namespace VeraCrypt
return password;
}
-
+
int TextUserInterface::AskPim (const wxString &message) const
{
int pim = -1;
@@ -196,10 +196,10 @@ namespace VeraCrypt
}
}
}
-
+
return pim;
}
-
+
ssize_t TextUserInterface::AskSelection (ssize_t optionCount, ssize_t defaultOption) const
{
while (true)
@@ -229,7 +229,7 @@ namespace VeraCrypt
ShowString (message);
return wstring (ReadInputStreamLine());
}
-
+
bool TextUserInterface::AskYesNo (const wxString &message, bool defaultYes, bool warning) const
{
while (true)
@@ -264,7 +264,7 @@ namespace VeraCrypt
#endif
ShowInfo ("EXTERNAL_VOL_HEADER_BAK_FIRST_INFO");
-
+
shared_ptr <Pkcs5Kdf> kdf;
if (CmdLine->ArgHash)
{
@@ -426,7 +426,7 @@ namespace VeraCrypt
{
password = AskPassword ();
}
-
+
// current PIM
if (!truecryptMode && !Preferences.NonInteractive && (pim < 0))
{
@@ -449,7 +449,7 @@ namespace VeraCrypt
if (!Preferences.NonInteractive)
keyfiles = AskKeyfiles ();
}
- }
+ }
if (!volume.get())
volume = Core->OpenVolume (volumePath, Preferences.DefaultMountOptions.PreserveTimestamps, password, pim, kdf, truecryptMode, keyfiles);
@@ -469,7 +469,7 @@ namespace VeraCrypt
// New password
if (!newPassword.get() && !Preferences.NonInteractive)
newPassword = AskPassword (_("Enter new password"), true);
-
+
// New PIM
if ((newPim < 0) && !Preferences.NonInteractive)
newPim = AskPim (_("Enter new PIM"));
@@ -769,7 +769,7 @@ namespace VeraCrypt
ShowString (L"\n");
options->Password = AskPassword (_("Enter password"), true);
}
-
+
// PIM
if ((options->Pim < 0) && !Preferences.NonInteractive)
{
@@ -784,7 +784,7 @@ namespace VeraCrypt
options->Keyfiles = AskKeyfiles (_("Enter keyfile path"));
}
- if ((!options->Keyfiles || options->Keyfiles->empty())
+ if ((!options->Keyfiles || options->Keyfiles->empty())
&& (!options->Password || options->Password->IsEmpty()))
{
throw_err (_("Password cannot be empty when no keyfile is specified"));
@@ -909,7 +909,7 @@ namespace VeraCrypt
ShowInfo (options->Type == VolumeType::Hidden ? "HIDVOL_FORMAT_FINISHED_HELP" : "FORMAT_FINISHED_INFO");
}
-
+
void TextUserInterface::DeleteSecurityTokenKeyfiles () const
{
shared_ptr <KeyfileList> keyfiles = AskKeyfiles();
@@ -956,7 +956,7 @@ namespace VeraCrypt
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
finally_do_arg (BufferPtr, keyfileDataBuf, { finally_arg.Erase(); });
-
+
FilePath exportFilePath = AskFilePath();
if (exportFilePath.IsEmpty())
@@ -978,7 +978,7 @@ namespace VeraCrypt
TextUserInterface::SetTerminalEcho (false);
finally_do ({ TextUserInterface::SetTerminalEcho (true); });
-
+
wstring wPassword (UI->ReadInputStreamLine());
finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); });
@@ -988,7 +988,7 @@ namespace VeraCrypt
}
TextUserInterface *UI;
};
-
+
return shared_ptr <GetStringFunctor> (new AdminPasswordRequestHandler (this));
}
@@ -1060,7 +1060,7 @@ namespace VeraCrypt
TextUserInterface::SetTerminalEcho (false);
finally_do ({ TextUserInterface::SetTerminalEcho (true); });
-
+
wstring wPassword (UI->ReadInputStreamLine());
finally_do_arg (wstring *, &wPassword, { StringConverter::Erase (*finally_arg); });
@@ -1110,7 +1110,7 @@ namespace VeraCrypt
{
if (!options.Password)
options.Password = AskPassword();
-
+
if (!options.TrueCryptMode && (options.Pim < 0))
options.Pim = AskPim (_("Enter PIM"));
@@ -1118,7 +1118,7 @@ namespace VeraCrypt
options.Keyfiles = AskKeyfiles();
VolumeInfoList mountedVolumes = UserInterface::MountAllDeviceHostedVolumes (options);
-
+
if (!mountedVolumes.empty())
return mountedVolumes;
@@ -1126,7 +1126,7 @@ namespace VeraCrypt
options.Pim = -1;
}
}
-
+
shared_ptr <VolumeInfo> TextUserInterface::MountVolume (MountOptions &options) const
{
shared_ptr <VolumeInfo> volume;
@@ -1151,7 +1151,7 @@ namespace VeraCrypt
// Mount point
if (!options.MountPoint && !options.NoFilesystem)
options.MountPoint.reset (new DirectoryPath (AskString (_("Enter mount directory [default]: "))));
-
+
VolumePassword password;
KeyfileList keyfiles;
@@ -1176,7 +1176,7 @@ namespace VeraCrypt
{
options.Password = AskPassword (StringFormatter (_("Enter password for {0}"), wstring (*options.Path)));
}
-
+
if (!options.TrueCryptMode && (options.Pim < 0))
{
options.Pim = AskPim (StringFormatter (_("Enter PIM for {0}"), wstring (*options.Path)));
@@ -1276,7 +1276,7 @@ namespace VeraCrypt
}
int TextUserInterface::OnRun()
- {
+ {
try
{
if (ProcessCommandLine ())
@@ -1362,7 +1362,7 @@ namespace VeraCrypt
default:
throw UserAbort (SRC_POS);
}
-
+
/* force the display of the random enriching interface */
RandomNumberGenerator::SetEnrichedByUserStatus (false);
@@ -1513,7 +1513,7 @@ namespace VeraCrypt
File volumeFile;
volumeFile.Open (*volumePath, File::OpenReadWrite, File::ShareNone, File::PreserveTimestamps);
-
+
RandomNumberGenerator::Start();
UserEnrichRandomPool();
@@ -1534,7 +1534,7 @@ namespace VeraCrypt
{
// Re-encrypt backup volume header
Core->ReEncryptVolumeHeaderWithNewSalt (newHeaderBuffer, decryptedLayout->GetHeader(), options.Password, options.Pim, options.Keyfiles);
-
+
// Write backup volume header
headerOffset = decryptedLayout->GetBackupHeaderOffset();
if (headerOffset >= 0)
@@ -1572,7 +1572,7 @@ namespace VeraCrypt
}
#endif
}
-
+
void TextUserInterface::UserEnrichRandomPool () const
{
RandomNumberGenerator::Start();