VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main')
-rw-r--r--src/Main/Application.cpp2
-rw-r--r--src/Main/CommandLineInterface.cpp14
-rw-r--r--src/Main/Forms/BenchmarkDialog.cpp2
-rw-r--r--src/Main/Forms/EncryptionTestDialog.cpp4
-rw-r--r--src/Main/Forms/KeyfileGeneratorDialog.cpp6
-rw-r--r--src/Main/Forms/MainFrame.cpp2
-rw-r--r--src/Main/Forms/PreferencesDialog.cpp18
-rw-r--r--src/Main/Forms/RandomPoolEnrichmentDialog.cpp6
-rw-r--r--src/Main/Forms/SecurityTokenKeyfilesDialog.cpp4
-rw-r--r--src/Main/Forms/VolumeCreationWizard.cpp10
-rw-r--r--src/Main/Forms/VolumePasswordPanel.cpp2
-rw-r--r--src/Main/GraphicUserInterface.cpp2
-rw-r--r--src/Main/LanguageStrings.cpp2
-rwxr-xr-xsrc/Main/Main.make7
-rw-r--r--src/Main/Resources.cpp22
-rw-r--r--src/Main/StringFormatter.h2
-rw-r--r--src/Main/TextUserInterface.cpp26
-rw-r--r--src/Main/UserInterface.cpp4
-rw-r--r--src/Main/Xml.cpp2
19 files changed, 81 insertions, 56 deletions
diff --git a/src/Main/Application.cpp b/src/Main/Application.cpp
index c72e2cc6..27b8f55a 100644
--- a/src/Main/Application.cpp
+++ b/src/Main/Application.cpp
@@ -89,7 +89,7 @@ namespace VeraCrypt
FilePath Application::GetConfigFilePath (const wxString &configFileName, bool createConfigDir)
{
- static wxScopedPtr<const wxString> configDirC;
+ static std::unique_ptr<const wxString> configDirC;
static bool configDirExists = false;
if (!configDirExists)
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp
index 2bbc73ea..1b4a0c1b 100644
--- a/src/Main/CommandLineInterface.cpp
+++ b/src/Main/CommandLineInterface.cpp
@@ -347,6 +347,16 @@ namespace VeraCrypt
#elif defined (TC_FREEBSD) || defined (TC_SOLARIS)
else if (str.IsSameAs (L"UFS", false))
ArgFilesystem = VolumeCreationOptions::FilesystemType::UFS;
+ else if (str.IsSameAs (L"Ext2", false))
+ ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext2;
+ else if (str.IsSameAs (L"Ext3", false))
+ ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext3;
+ else if (str.IsSameAs (L"Ext4", false))
+ ArgFilesystem = VolumeCreationOptions::FilesystemType::Ext4;
+ else if (str.IsSameAs (L"NTFS", false))
+ ArgFilesystem = VolumeCreationOptions::FilesystemType::NTFS;
+ else if (str.IsSameAs (L"exFAT", false))
+ ArgFilesystem = VolumeCreationOptions::FilesystemType::exFAT;
#endif
else
throw_err (LangString["UNKNOWN_OPTION"] + L": " + str);
@@ -824,7 +834,7 @@ namespace VeraCrypt
if (wxCONV_FAILED == ulen)
throw PasswordUTF8Invalid (SRC_POS);
SecureBuffer passwordBuf(ulen);
- ulen = utf8.FromWChar ((char*) (byte*) passwordBuf, ulen, str, charCount);
+ ulen = utf8.FromWChar ((char*) (uint8*) passwordBuf, ulen, str, charCount);
if (wxCONV_FAILED == ulen)
throw PasswordUTF8Invalid (SRC_POS);
if (ulen > maxUtf8Len)
@@ -835,7 +845,7 @@ namespace VeraCrypt
throw PasswordUTF8TooLong (SRC_POS);
}
- ConstBufferPtr utf8Buffer ((byte*) passwordBuf, ulen);
+ ConstBufferPtr utf8Buffer ((uint8*) passwordBuf, ulen);
return shared_ptr<SecureBuffer>(new SecureBuffer (utf8Buffer));
}
else
diff --git a/src/Main/Forms/BenchmarkDialog.cpp b/src/Main/Forms/BenchmarkDialog.cpp
index 47f00610..6e2cff64 100644
--- a/src/Main/Forms/BenchmarkDialog.cpp
+++ b/src/Main/Forms/BenchmarkDialog.cpp
@@ -281,7 +281,7 @@ namespace VeraCrypt
const char *tmp_salt = {"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF"};
unsigned long pim;
Pkcs5KdfList prfList = Pkcs5Kdf::GetAvailableAlgorithms ();
- VolumePassword password ((const byte*) "passphrase-1234567890", 21);
+ VolumePassword password ((const uint8*) "passphrase-1234567890", 21);
memcpy (&pim, buffer.Ptr (), sizeof (unsigned long));
memcpy (salt.Ptr(), tmp_salt, 64);
diff --git a/src/Main/Forms/EncryptionTestDialog.cpp b/src/Main/Forms/EncryptionTestDialog.cpp
index a85bbc94..af3f9833 100644
--- a/src/Main/Forms/EncryptionTestDialog.cpp
+++ b/src/Main/Forms/EncryptionTestDialog.cpp
@@ -141,7 +141,7 @@ namespace VeraCrypt
void EncryptionTestDialog::GetTextCtrlData (wxTextCtrl *textCtrl, Buffer &buffer) const
{
- vector <byte> data;
+ vector <uint8> data;
string dataStr = StringConverter::ToSingle (wstring (textCtrl->GetValue()));
for (size_t i = 0; i < dataStr.size() / 2; ++i)
@@ -153,7 +153,7 @@ namespace VeraCrypt
throw StringConversionFailed (SRC_POS);
}
- data.push_back ((byte) dataByte);
+ data.push_back ((uint8) dataByte);
}
if (data.empty())
diff --git a/src/Main/Forms/KeyfileGeneratorDialog.cpp b/src/Main/Forms/KeyfileGeneratorDialog.cpp
index 2d729ccf..85443f45 100644
--- a/src/Main/Forms/KeyfileGeneratorDialog.cpp
+++ b/src/Main/Forms/KeyfileGeneratorDialog.cpp
@@ -164,12 +164,12 @@ namespace VeraCrypt
{
event.Skip();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&event), sizeof (event)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&event), sizeof (event)));
long coord = event.GetX();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
coord = event.GetY();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
if (ShowRandomPoolCheckBox->IsChecked())
ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24));
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index 07b876ac..6355f139 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -1437,7 +1437,7 @@ namespace VeraCrypt
#if defined(TC_UNIX) && !defined(TC_MACOSX)
try
{
- byte buf[128];
+ uint8 buf[128];
if (read (ShowRequestFifo, buf, sizeof (buf)) > 0 && Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
}
diff --git a/src/Main/Forms/PreferencesDialog.cpp b/src/Main/Forms/PreferencesDialog.cpp
index 90a668e6..c4d5140f 100644
--- a/src/Main/Forms/PreferencesDialog.cpp
+++ b/src/Main/Forms/PreferencesDialog.cpp
@@ -82,14 +82,16 @@ namespace VeraCrypt
LanguageListBox->Append("System default");
LanguageListBox->Append("English");
- size_t langCount;
- langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES);
- for (size_t i = 0; i < langCount; ++i) {
- wxFileName filename(langArray[i]);
- wxString langId = filename.GetName().AfterLast('.');
- wxString langNative = langEntries[langId];
- if (!langNative.empty()) {
- LanguageListBox->Append(langNative);
+ if (wxDir::Exists(languagesFolder.GetName())) {
+ size_t langCount;
+ langCount = wxDir::GetAllFiles(languagesFolder.GetName(), &langArray, wxEmptyString, wxDIR_FILES);
+ for (size_t i = 0; i < langCount; ++i) {
+ wxFileName filename(langArray[i]);
+ wxString langId = filename.GetName().AfterLast('.');
+ wxString langNative = langEntries[langId];
+ if (!langNative.empty()) {
+ LanguageListBox->Append(langNative);
+ }
}
}
#endif
diff --git a/src/Main/Forms/RandomPoolEnrichmentDialog.cpp b/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
index e5ef160b..b48d5af6 100644
--- a/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
+++ b/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
@@ -63,12 +63,12 @@ namespace VeraCrypt
{
event.Skip();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&event), sizeof (event)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&event), sizeof (event)));
long coord = event.GetX();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
coord = event.GetY();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
if (ShowRandomPoolCheckBox->IsChecked())
ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24));
diff --git a/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp b/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
index 8f51cfa8..bbbeff74 100644
--- a/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
+++ b/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
@@ -103,7 +103,7 @@ namespace VeraCrypt
{
wxBusyCursor busy;
- vector <byte> keyfileData;
+ vector <uint8> keyfileData;
keyfile->GetKeyfileData (keyfileData);
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
@@ -141,7 +141,7 @@ namespace VeraCrypt
if (keyfile.Length() > 0)
{
- vector <byte> keyfileData (keyfile.Length());
+ vector <uint8> keyfileData (keyfile.Length());
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
keyfile.ReadCompleteBuffer (keyfileDataBuf);
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index 2653ff66..3f09e39f 100644
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -390,12 +390,12 @@ namespace VeraCrypt
event.Skip();
if (!IsWorkInProgress() && RandomNumberGenerator::IsRunning())
{
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&event), sizeof (event)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&event), sizeof (event)));
long coord = event.GetX();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
coord = event.GetY();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
VolumeCreationProgressWizardPage *page = dynamic_cast <VolumeCreationProgressWizardPage *> (GetCurrentPage());
if (page)
@@ -442,7 +442,7 @@ namespace VeraCrypt
if (!IsWorkInProgress())
{
wxLongLong time = wxGetLocalTimeMillis();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&time), sizeof (time)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&time), sizeof (time)));
}
}
@@ -975,7 +975,7 @@ namespace VeraCrypt
if (OuterVolume && VolumeSize > TC_MAX_FAT_SECTOR_COUNT * SectorSize)
{
uint64 limit = TC_MAX_FAT_SECTOR_COUNT * SectorSize / BYTES_PER_TB;
- wstring err = StringFormatter (LangString["LINUX_ERROR_SIZE_HIDDEN_VOL"], limit, limit * 1024);
+ wstring err = static_cast<wstring>(StringFormatter (LangString["LINUX_ERROR_SIZE_HIDDEN_VOL"], limit, limit * 1024));
if (SectorSize < 4096)
{
diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp
index 56804a49..0555f339 100644
--- a/src/Main/Forms/VolumePasswordPanel.cpp
+++ b/src/Main/Forms/VolumePasswordPanel.cpp
@@ -214,7 +214,7 @@ namespace VeraCrypt
shared_ptr <VolumePassword> password;
wchar_t passwordBuf[VolumePassword::MaxSize + 1];
size_t maxPasswordLength = (bLegacyPassword || CmdLine->ArgUseLegacyPassword)? VolumePassword::MaxLegacySize: VolumePassword::MaxSize;
- finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <byte *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
+ finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <uint8 *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
#ifdef TC_WINDOWS
int len = GetWindowText (static_cast <HWND> (textCtrl->GetHandle()), passwordBuf, VolumePassword::MaxSize + 1);
diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
index 16db8f83..af2db217 100644
--- a/src/Main/GraphicUserInterface.cpp
+++ b/src/Main/GraphicUserInterface.cpp
@@ -992,7 +992,7 @@ namespace VeraCrypt
int showFifo = open (string (MainFrame::GetShowRequestFifoPath()).c_str(), O_WRONLY | O_NONBLOCK);
throw_sys_if (showFifo == -1);
- byte buf[1] = { 1 };
+ uint8 buf[1] = { 1 };
if (write (showFifo, buf, 1) == 1)
{
close (showFifo);
diff --git a/src/Main/LanguageStrings.cpp b/src/Main/LanguageStrings.cpp
index 0e13ebc7..9a983712 100644
--- a/src/Main/LanguageStrings.cpp
+++ b/src/Main/LanguageStrings.cpp
@@ -43,7 +43,7 @@ namespace VeraCrypt
void LanguageStrings::Init ()
{
- static byte LanguageXml[] =
+ static uint8 LanguageXml[] =
{
# include "Common/Language.xml.h"
, 0
diff --git a/src/Main/Main.make b/src/Main/Main.make
index dd85f842..9f907aef 100755
--- a/src/Main/Main.make
+++ b/src/Main/Main.make
@@ -210,7 +210,9 @@ else
sed -e 's/_VERSION_/$(patsubst %a,%.1,$(patsubst %b,%.2,$(TC_VERSION)))/' ../Build/Resources/MacOSX/Info.plist.xml >$(APPNAME).app/Contents/Info.plist
endif
chmod -R go-w $(APPNAME).app
+ifneq ("$(LOCAL_DEVELOPMENT_BUILD)","true")
codesign -s "Developer ID Application: IDRIX (Z933746L2S)" --timestamp $(APPNAME).app
+endif
install: prepare
cp -R $(APPNAME).app /Applications/.
@@ -222,7 +224,12 @@ ifdef VC_LEGACY_BUILD
rm -f $(APPNAME)_Legacy_$(TC_VERSION).dmg
else
/usr/local/bin/packagesbuild $(BASE_DIR)/Setup/MacOSX/veracrypt.pkgproj
+ifneq ("$(LOCAL_DEVELOPMENT_BUILD)","true")
productsign --sign "Developer ID Installer: IDRIX (Z933746L2S)" --timestamp "$(BASE_DIR)/Setup/MacOSX/VeraCrypt $(TC_VERSION).pkg" $(BASE_DIR)/Setup/MacOSX/VeraCrypt_$(TC_VERSION).pkg
+else
+ # copy the unsigned package to the expected location
+ cp "$(BASE_DIR)/Setup/MacOSX/VeraCrypt $(TC_VERSION).pkg" $(BASE_DIR)/Setup/MacOSX/VeraCrypt_$(TC_VERSION).pkg
+endif
rm -f $(APPNAME)_$(TC_VERSION).dmg
endif
rm -f "$(BASE_DIR)/Setup/MacOSX/template.dmg"
diff --git a/src/Main/Resources.cpp b/src/Main/Resources.cpp
index d8bab977..f00c14f7 100644
--- a/src/Main/Resources.cpp
+++ b/src/Main/Resources.cpp
@@ -40,7 +40,7 @@ namespace VeraCrypt
hResL = LoadResource (NULL, hRes);
throw_sys_if (!hResL);
- const byte *resPtr = (const byte *) LockResource (hResL);
+ const uint8 *resPtr = (const uint8 *) LockResource (hResL);
throw_sys_if (!resPtr);
return ConstBufferPtr (resPtr, SizeofResource (NULL, hRes));
@@ -71,12 +71,12 @@ namespace VeraCrypt
UserPreferences Preferences;
Preferences.Load();
- wstring preferredLang = Preferences.Language;
+ string preferredLang = string(Preferences.Language.begin(), Preferences.Language.end());
#ifdef DEBUG
std::cout << "Config language: " << preferredLang << std::endl;
#endif
- if (preferredLang == L"system") {
+ if (preferredLang == "system") {
if (const char *env_p = getenv("LANG")) {
string lang(env_p);
#ifdef DEBUG
@@ -132,14 +132,14 @@ namespace VeraCrypt
if ( xml.IsFile() ){
File file;
file.Open (xml, File::OpenRead, File::ShareRead);
- vector <byte> keyfileData (file.Length());
+ vector <uint8> keyfileData (file.Length());
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
file.ReadCompleteBuffer (keyfileDataBuf);
file.Close();
string langxml(keyfileData.begin(), keyfileData.end());
return langxml;
}
- static byte LanguageXml[] =
+ static uint8 LanguageXml[] =
{
# include "Common/Language.xml.h"
, 0
@@ -158,7 +158,7 @@ namespace VeraCrypt
strBuf.CopyFrom (res);
return string (reinterpret_cast <char *> (strBuf.Ptr()));
#else
- static byte License[] =
+ static uint8 License[] =
{
# include "License.txt.h"
, 0
@@ -176,7 +176,7 @@ namespace VeraCrypt
#ifdef TC_WINDOWS
return wxBitmap (L"IDB_DRIVE_ICON", wxBITMAP_TYPE_BMP_RESOURCE).ConvertToImage().Resize (wxSize (16, 12), wxPoint (0, 0));
#else
- static const byte DriveIcon[] =
+ static const uint8 DriveIcon[] =
{
# include "Mount/Drive_icon_96dpi.bmp.h"
};
@@ -192,7 +192,7 @@ namespace VeraCrypt
wxImage image = wxBitmap (L"IDB_DRIVE_ICON_MASK", wxBITMAP_TYPE_BMP_RESOURCE).ConvertToImage().Resize (wxSize (16, 12), wxPoint (0, 0));
return wxBitmap (image.ConvertToMono (0, 0, 0), 1);
#else
- static const byte DriveIconMask[] =
+ static const uint8 DriveIconMask[] =
{
# include "Mount/Drive_icon_mask_96dpi.bmp.h"
};
@@ -215,7 +215,7 @@ namespace VeraCrypt
#ifdef TC_WINDOWS
return wxBitmap (L"IDB_LOGO", wxBITMAP_TYPE_BMP_RESOURCE);
#else
- static const byte Logo[] =
+ static const uint8 Logo[] =
{
# include "Mount/Logo_96dpi.bmp.h"
};
@@ -230,7 +230,7 @@ namespace VeraCrypt
#ifdef TC_WINDOWS
return wxBitmap (L"IDB_TEXTUAL_LOGO", wxBITMAP_TYPE_BMP_RESOURCE);
#else
- static const byte Logo[] =
+ static const uint8 Logo[] =
{
# include "Common/Textual_logo_96dpi.bmp.h"
};
@@ -255,7 +255,7 @@ namespace VeraCrypt
#ifdef TC_WINDOWS
return wxBitmap (L"IDB_VOLUME_WIZARD_BITMAP", wxBITMAP_TYPE_BMP_RESOURCE);
#else
- static const byte VolumeWizardIcon[] =
+ static const uint8 VolumeWizardIcon[] =
{
# include "Format/VeraCrypt_Wizard.bmp.h"
};
diff --git a/src/Main/StringFormatter.h b/src/Main/StringFormatter.h
index 33a47a35..97c39ae2 100644
--- a/src/Main/StringFormatter.h
+++ b/src/Main/StringFormatter.h
@@ -52,7 +52,7 @@ namespace VeraCrypt
StringFormatter (const wxString &format, StringFormatterArg arg0 = StringFormatterArg(), StringFormatterArg arg1 = StringFormatterArg(), StringFormatterArg arg2 = StringFormatterArg(), StringFormatterArg arg3 = StringFormatterArg(), StringFormatterArg arg4 = StringFormatterArg(), StringFormatterArg arg5 = StringFormatterArg(), StringFormatterArg arg6 = StringFormatterArg(), StringFormatterArg arg7 = StringFormatterArg(), StringFormatterArg arg8 = StringFormatterArg(), StringFormatterArg arg9 = StringFormatterArg());
virtual ~StringFormatter ();
- operator wstring () const { return wstring (FormattedString); }
+ explicit operator wstring () const { return wstring (FormattedString); }
operator wxString () const { return FormattedString; }
operator StringFormatterArg () const { return FormattedString; }
diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
index 0de76c6b..3346ee3e 100644
--- a/src/Main/TextUserInterface.cpp
+++ b/src/Main/TextUserInterface.cpp
@@ -100,7 +100,7 @@ namespace VeraCrypt
finally_do ({ TextUserInterface::SetTerminalEcho (true); });
wchar_t passwordBuf[4096];
- finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <byte *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
+ finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <uint8 *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
shared_ptr<VolumePassword> password;
@@ -668,7 +668,7 @@ namespace VeraCrypt
{
parentDir = wxT(".");
}
- if (wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace))
+ if (options->Type == VolumeType::Normal && wxDirExists(parentDir) && wxGetDiskSpace (parentDir, nullptr, &diskSpace))
{
AvailableDiskSpace = (uint64) diskSpace.GetValue ();
if (maxVolumeSize > AvailableDiskSpace)
@@ -678,10 +678,13 @@ namespace VeraCrypt
if (options->Size == (uint64) (-1))
{
- if (AvailableDiskSpace)
+ if (options->Type == VolumeType::Hidden) {
+ throw_err (_("Please do not use maximum size for hidden volume. As we do not mount the outer volume to determine the available space, it is your responsibility to choose a value so that the hidden volume does not overlap the outer volume."));
+ }
+ else if (AvailableDiskSpace)
{
// caller requesting maximum size
- // we use maxVolumeSize because it is guaranteed to be less of equal to AvailableDiskSpace
+ // we use maxVolumeSize because it is guaranteed to be less or equal to AvailableDiskSpace for outer volumes
options->Size = maxVolumeSize;
}
else
@@ -702,14 +705,17 @@ namespace VeraCrypt
throw MissingArgument (SRC_POS);
uint64 multiplier = 1024 * 1024;
- wxString sizeStr = AskString (options->Type == VolumeType::Hidden ? _("\nEnter hidden volume size (sizeK/size[M]/sizeG/sizeT/max): ") : _("\nEnter volume size (sizeK/size[M]/sizeG.sizeT/max): "));
+ wxString sizeStr = AskString (options->Type == VolumeType::Hidden ? _("\nEnter hidden volume size (sizeK/size[M]/sizeG/sizeT): ") : _("\nEnter volume size (sizeK/size[M]/sizeG.sizeT/max): "));
if (sizeStr.CmpNoCase(wxT("max")) == 0)
{
multiplier = 1;
- if (AvailableDiskSpace)
+ if (options->Type == VolumeType::Hidden) {
+ throw_err (_("Please do not use maximum size for hidden volume. As we do not mount the outer volume to determine the available space, it is your responsibility to choose a value so that the hidden volume does not overlap the outer volume."));
+ }
+ else if (AvailableDiskSpace)
{
// caller requesting maximum size
- // we use maxVolumeSize because it is guaranteed to be less of equal to AvailableDiskSpace
+ // we use maxVolumeSize because it is guaranteed to be less or equal to AvailableDiskSpace for outer volumes
options->Size = maxVolumeSize;
}
else
@@ -1071,7 +1077,7 @@ namespace VeraCrypt
shared_ptr<TokenKeyfile> tokenKeyfile = Token::getTokenKeyfile(keyfilePath);
- vector <byte> keyfileData;
+ vector <uint8> keyfileData;
tokenKeyfile->GetKeyfileData (keyfileData);
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
@@ -1158,7 +1164,7 @@ namespace VeraCrypt
if (keyfile.Length() > 0)
{
- vector <byte> keyfileData (keyfile.Length());
+ vector <uint8> keyfileData (keyfile.Length());
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
keyfile.ReadCompleteBuffer (keyfileDataBuf);
@@ -1778,7 +1784,7 @@ namespace VeraCrypt
while (randCharsRequired > 0)
{
wstring randStr = AskString();
- RandomNumberGenerator::AddToPool (ConstBufferPtr ((byte *) randStr.c_str(), randStr.size() * sizeof (wchar_t)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr ((uint8 *) randStr.c_str(), randStr.size() * sizeof (wchar_t)));
randCharsRequired -= randStr.size();
diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp
index 3ec2e8dc..09b1fcdd 100644
--- a/src/Main/UserInterface.cpp
+++ b/src/Main/UserInterface.cpp
@@ -390,7 +390,7 @@ namespace VeraCrypt
errOutput += StringConverter::ToWide (execEx->GetErrorOutput());
if (errOutput.empty())
- return errOutput + StringFormatter (LangString["LINUX_COMMAND_GET_ERROR"], execEx->GetCommand(), execEx->GetExitCode());
+ return errOutput + static_cast<wstring>(StringFormatter (LangString["LINUX_COMMAND_GET_ERROR"], execEx->GetCommand(), execEx->GetExitCode()));
return wxString (errOutput).Trim (true);
}
@@ -1516,7 +1516,7 @@ namespace VeraCrypt
EncryptionTest::TestAll();
// StringFormatter
- if (StringFormatter (L"{9} {8} {7} {6} {5} {4} {3} {2} {1} {0} {{0}}", "1", L"2", '3', L'4', 5, 6, 7, 8, 9, 10) != L"10 9 8 7 6 5 4 3 2 1 {0}")
+ if (static_cast<wstring>(StringFormatter (L"{9} {8} {7} {6} {5} {4} {3} {2} {1} {0} {{0}}", "1", L"2", '3', L'4', 5, 6, 7, 8, 9, 10)) != L"10 9 8 7 6 5 4 3 2 1 {0}")
throw TestFailed (SRC_POS);
try
{
diff --git a/src/Main/Xml.cpp b/src/Main/Xml.cpp
index 6d0faa18..bf286a55 100644
--- a/src/Main/Xml.cpp
+++ b/src/Main/Xml.cpp
@@ -108,7 +108,7 @@ namespace VeraCrypt
*TextOutStream << L"</VeraCrypt>" << endl;
wxStreamBuffer *buf = MemOutStream->GetOutputStreamBuffer();
- OutFile.Write (ConstBufferPtr (reinterpret_cast <byte *> (buf->GetBufferStart()), buf->GetBufferSize()));
+ OutFile.Write (ConstBufferPtr (reinterpret_cast <uint8 *> (buf->GetBufferStart()), buf->GetBufferSize()));
OutFile.Close();
TextOutStream.reset();