VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Build/CMakeLists.txt17
-rwxr-xr-xsrc/Build/build_cmake_deb.sh105
-rw-r--r--src/Core/Unix/CoreService.cpp2
-rw-r--r--src/Core/Unix/FreeBSD/CoreFreeBSD.cpp47
-rw-r--r--src/Main/Application.cpp2
-rw-r--r--src/Main/CommandLineInterface.cpp10
-rw-r--r--src/Main/Forms/PreferencesDialog.cpp18
-rw-r--r--src/Main/Forms/VolumeCreationWizard.cpp2
-rw-r--r--src/Main/Resources.cpp4
-rw-r--r--src/Main/StringFormatter.h2
-rw-r--r--src/Main/TextUserInterface.cpp18
-rw-r--r--src/Main/UserInterface.cpp4
12 files changed, 154 insertions, 77 deletions
diff --git a/src/Build/CMakeLists.txt b/src/Build/CMakeLists.txt
index 288370dd..9da138ab 100644
--- a/src/Build/CMakeLists.txt
+++ b/src/Build/CMakeLists.txt
@@ -247,11 +247,24 @@ if ( ( PLATFORM STREQUAL "Debian" ) OR ( PLATFORM STREQUAL "Ubuntu" ) )
if (NOGUI)
# Link against statically built wxWidgets so that we don't depend on any GTK library
- set( CPACK_DEBIAN_PACKAGE_DEPENDS "libfuse2, dmsetup, sudo, libpcsclite1, pcscd" )
+ # In case of Ubuntu 24.04/ Debian 13 or newer, libfuse2 package was renamed libfuse2t64
+ if ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "13" ) )
+ OR ( ( PLATFORM STREQUAL "Ubuntu" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "24.04" ) ) )
+ set( CPACK_DEBIAN_PACKAGE_DEPENDS "libfuse2t64, dmsetup, sudo, libpcsclite1, pcscd" )
+ else ()
+ set( CPACK_DEBIAN_PACKAGE_DEPENDS "libfuse2, dmsetup, sudo, libpcsclite1, pcscd" )
+ endif()
else ()
# Link against gtk3 version of wxWidgets if >= Debian 10 or >= Ubuntu 18.04
# Otherwise, link against gtk2 version of wxWidgets
- if ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "12" ) )
+ # In case of Ubuntu 24.04, we depend on libfuse2t64 instead of libfuse2 and we link statically against wxWidgets
+ # because there is a bug in wxWidgets that ships with Ubuntu 24.04 and which was fixed in wxWidgets 3.2.5
+ if ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "13" ) )
+ OR ( ( PLATFORM STREQUAL "Ubuntu" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "24.04" ) ) )
+
+ set( CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk-3-0t64, libayatana-appindicator3-1, libfuse2t64, dmsetup, sudo, libpcsclite1, pcscd" )
+
+ elseif ( ( ( PLATFORM STREQUAL "Debian" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "12" ) )
OR ( ( PLATFORM STREQUAL "Ubuntu" ) AND ( PLATFORM_VERSION VERSION_GREATER_EQUAL "23.04" ) ) )
set( CPACK_DEBIAN_PACKAGE_DEPENDS "libwxgtk3.2-1, libayatana-appindicator3-1, libfuse2, dmsetup, sudo, libpcsclite1, pcscd" )
diff --git a/src/Build/build_cmake_deb.sh b/src/Build/build_cmake_deb.sh
index a6263a90..f756cd10 100755
--- a/src/Build/build_cmake_deb.sh
+++ b/src/Build/build_cmake_deb.sh
@@ -18,69 +18,74 @@ export SOURCEPATH=$(readlink -f "$SCRIPTPATH/..")
# Directory where the VeraCrypt has been checked out
export PARENTDIR=$(readlink -f "$SCRIPTPATH/../../..")
-# The sources of wxWidgets 3.2.2.1 must be extracted to the parent directory
-export WX_ROOT=$PARENTDIR/wxWidgets-3.2.2.1
+# The sources of wxWidgets 3.2.5 must be extracted to the parent directory
+export WX_ROOT=$PARENTDIR/wxWidgets-3.2.5
echo "Using wxWidgets sources in $WX_ROOT"
cd $SOURCEPATH
-if [ "$#" = "1" ] && [ "$1" = "WXSTATIC" ]
-then
-echo "Building GUI version of VeraCrypt for DEB using wxWidgets static libraries"
-
-# This will be the temporary wxWidgets directory
-export WX_BUILD_DIR=$PARENTDIR/wxBuildGUI
-
-# To build wxWidgets without GUI
-make WXSTATIC=1 wxbuild || exit 1
-make WXSTATIC=1 clean || exit 1
-make WXSTATIC=1 || exit 1
-make WXSTATIC=1 install DESTDIR="$PARENTDIR/VeraCrypt_Setup/GUI" || exit 1
-
-else
-
-echo "Building GUI version of VeraCrypt for DEB using system wxWidgets"
-make clean || exit 1
-
-if [ "$#" = "1" ] && [ "$1" = "INDICATOR" ]
-then
-
-make INDICATOR=1 || exit 1
-make INDICATOR=1 install DESTDIR="$PARENTDIR/VeraCrypt_Setup/GUI" || exit 1
-
-else
-
-make || exit 1
-make install DESTDIR="$PARENTDIR/VeraCrypt_Setup/GUI" || exit 1
-
-fi
-
-fi
+build_and_install() {
+ target=$1
+ wxstatic=$2
+ indicator=$3
+ nogui=""
+
+ # Determine wxWidgets build directory based on target
+ if [ "$target" = "Console" ]; then
+ export WX_BUILD_DIR="$PARENTDIR/wxBuildConsole"
+ nogui="NOGUI=1"
+ else
+ export WX_BUILD_DIR="$PARENTDIR/wxBuildGUI"
+ fi
+
+ wxstatic_value=""
+ if [ "$wxstatic" = "WXSTATIC" ]; then
+ wxstatic_value="WXSTATIC=1"
+ make $wxstatic_value $nogui wxbuild || exit 1
+ fi
+
+ indicator_value=""
+ if [ "$indicator" = "INDICATOR" ]; then
+ indicator_value="INDICATOR=1"
+ fi
+
+ make $wxstatic_value $indicator_value $nogui clean || exit 1
+ make $wxstatic_value $indicator_value $nogui || exit 1
+ make $wxstatic_value $indicator_value $nogui install DESTDIR="$PARENTDIR/VeraCrypt_Setup/$target" || exit 1
+}
+
+# Handle arguments
+case "$1$2" in
+"WXSTATIC")
+ echo "Building GUI version of VeraCrypt for DEB using wxWidgets static libraries"
+ build_and_install "GUI" "WXSTATIC" ""
+ ;;
+"INDICATOR")
+ echo "Building GUI version of VeraCrypt for DEB using system wxWidgets and indicator"
+ build_and_install "GUI" "" "INDICATOR"
+ ;;
+"WXSTATICINDICATOR"|"INDICATORWXSTATIC")
+ echo "Building GUI version of VeraCrypt for DEB using wxWidgets static libraries and indicator"
+ build_and_install "GUI" "WXSTATIC" "INDICATOR"
+ ;;
+*)
+ echo "Building GUI version of VeraCrypt for DEB using system wxWidgets"
+ build_and_install "GUI" "" ""
+ ;;
+esac
echo "Building console version of VeraCrypt for DEB using wxWidgets static libraries"
-
-# This is to avoid " Error: Unable to initialize GTK+, is DISPLAY set properly?"
-# when building over SSH without X11 Forwarding
-# export DISPLAY=:0.0
-
-# This will be the temporary wxWidgets directory
-export WX_BUILD_DIR=$PARENTDIR/wxBuildConsole
-
-# To build wxWidgets without GUI
-make WXSTATIC=1 NOGUI=1 wxbuild || exit 1
-make WXSTATIC=1 NOGUI=1 clean || exit 1
-make WXSTATIC=1 NOGUI=1 || exit 1
-make WXSTATIC=1 NOGUI=1 install DESTDIR="$PARENTDIR/VeraCrypt_Setup/Console" || exit 1
+build_and_install "Console" "WXSTATIC" ""
echo "Creating VeraCrypt DEB packages"
# -DCPACK_RPM_PACKAGE_DEBUG=TRUE for debugging cpack DEB
# -DCPACK_RPM_PACKAGE_DEBUG=TRUE for debugging cpack DEB
-mkdir -p $PARENTDIR/VeraCrypt_Packaging/GUI
-mkdir -p $PARENTDIR/VeraCrypt_Packaging/Console
+mkdir -p $PARENTDIR/VeraCrypt_Packaging/{GUI,Console}
cmake -H$SCRIPTPATH -B$PARENTDIR/VeraCrypt_Packaging/GUI -DVERACRYPT_BUILD_DIR="$PARENTDIR/VeraCrypt_Setup/GUI" -DNOGUI=FALSE || exit 1
cpack --config $PARENTDIR/VeraCrypt_Packaging/GUI/CPackConfig.cmake || exit 1
+
cmake -H$SCRIPTPATH -B$PARENTDIR/VeraCrypt_Packaging/Console -DVERACRYPT_BUILD_DIR="$PARENTDIR/VeraCrypt_Setup/Console" -DNOGUI=TRUE || exit 1
-cpack --config $PARENTDIR/VeraCrypt_Packaging/Console/CPackConfig.cmake || exit 1
+cpack --config $PARENTDIR/VeraCrypt_Packaging/Console/CPackConfig.cmake || exit 1
diff --git a/src/Core/Unix/CoreService.cpp b/src/Core/Unix/CoreService.cpp
index e543652a..e3fca20e 100644
--- a/src/Core/Unix/CoreService.cpp
+++ b/src/Core/Unix/CoreService.cpp
@@ -309,7 +309,7 @@ namespace VeraCrypt
std::vector<char> buffer(128, 0);
std::string result;
- FILE* pipe = popen("sudo -n uptime 2>&1 | grep 'load average' | wc -l", "r"); // We redirect stderr to stdout (2>&1) to be able to catch the result of the command
+ FILE* pipe = popen("sudo -n uptime 2>&1 | grep 'load average' | wc -l | tr -d '[:blank:]'", "r"); // We redirect stderr to stdout (2>&1) to be able to catch the result of the command
if (pipe)
{
while (!feof(pipe))
diff --git a/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp b/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp
index 01463c35..05520274 100644
--- a/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp
+++ b/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp
@@ -83,7 +83,7 @@ namespace VeraCrypt
#ifdef TC_MACOSX
const string busType = "rdisk";
#else
- foreach (const string &busType, StringConverter::Split ("ad da"))
+ foreach (const string &busType, StringConverter::Split ("ad da vtbd"))
#endif
{
for (int devNumber = 0; devNumber < 64; devNumber++)
@@ -185,10 +185,51 @@ namespace VeraCrypt
void CoreFreeBSD::MountFilesystem (const DevicePath &devicePath, const DirectoryPath &mountPoint, const string &filesystemType, bool readOnly, const string &systemMountOptions) const
{
+ std::string chosenFilesystem = "msdos";
+ std::string modifiedMountOptions = systemMountOptions;
+
+ if (filesystemType.empty() && modifiedMountOptions.find("mountprog") == string::npos) {
+ // No filesystem type specified through CLI, attempt to identify with blkid
+ // as mount is unable to probe filesystem type on BSD
+ // Make sure we don't override user defined mountprog
+ std::vector<char> buffer(128,0);
+ std::string cmd = "blkid -o value -s TYPE " + static_cast<std::string>(devicePath) + " 2>/dev/null";
+ std::string result;
+
+ FILE* pipe = popen(cmd.c_str(), "r");
+ if (pipe) {
+ while (!feof(pipe)) {
+ if (fgets(buffer.data(), 128, pipe) != nullptr)
+ result += buffer.data();
+ }
+ fflush(pipe);
+ pclose(pipe);
+ pipe = nullptr;
+ }
+
+ if (result.find("ext") == 0 || StringConverter::ToLower(filesystemType).find("ext") == 0) {
+ chosenFilesystem = "ext2fs";
+ }
+ else if (result.find("exfat") == 0 || StringConverter::ToLower(filesystemType) == "exfat") {
+ chosenFilesystem = "exfat";
+ modifiedMountOptions += string(!systemMountOptions.empty() ? "," : "")
+ + "mountprog=/usr/local/sbin/mount.exfat";
+ }
+ else if (result.find("ntfs") == 0 || StringConverter::ToLower(filesystemType) == "ntfs") {
+ chosenFilesystem = "ntfs";
+ modifiedMountOptions += string(!systemMountOptions.empty() ? "," : "")
+ + "mountprog=/usr/local/bin/ntfs-3g";
+ }
+ else if (!filesystemType.empty()) {
+ // Filesystem is specified but is none of the above, then supply as is
+ chosenFilesystem = filesystemType;
+ }
+ } else
+ chosenFilesystem = filesystemType;
+
try
{
- // Try to mount FAT by default as mount is unable to probe filesystem type on BSD
- CoreUnix::MountFilesystem (devicePath, mountPoint, filesystemType.empty() ? "msdos" : filesystemType, readOnly, systemMountOptions);
+ CoreUnix::MountFilesystem (devicePath, mountPoint, chosenFilesystem, readOnly, modifiedMountOptions);
}
catch (ExecutedProcessFailed&)
{
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..17d7c147 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);
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/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index 2653ff66..0eae11d6 100644
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -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/Resources.cpp b/src/Main/Resources.cpp
index d8bab977..18a58181 100644
--- a/src/Main/Resources.cpp
+++ b/src/Main/Resources.cpp
@@ -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
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..94919296 100644
--- a/src/Main/TextUserInterface.cpp
+++ b/src/Main/TextUserInterface.cpp
@@ -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
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
{