VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Core
diff options
context:
space:
mode:
Diffstat (limited to 'src/Core')
-rw-r--r--src/Core/Core.h10
-rw-r--r--src/Core/CoreBase.cpp10
-rw-r--r--src/Core/CoreBase.h19
-rw-r--r--src/Core/CoreException.cpp2
-rw-r--r--src/Core/CoreException.h2
-rw-r--r--src/Core/FatFormatter.cpp24
-rw-r--r--src/Core/FatFormatter.h2
-rw-r--r--src/Core/HostDevice.cpp2
-rw-r--r--src/Core/HostDevice.h2
-rw-r--r--src/Core/MountOptions.cpp2
-rw-r--r--src/Core/MountOptions.h2
-rw-r--r--src/Core/RandomNumberGenerator.cpp26
-rw-r--r--src/Core/RandomNumberGenerator.h2
-rw-r--r--src/Core/Unix/CoreService.cpp107
-rw-r--r--src/Core/Unix/CoreService.h2
-rw-r--r--src/Core/Unix/CoreServiceProxy.h2
-rw-r--r--src/Core/Unix/CoreServiceRequest.cpp8
-rw-r--r--src/Core/Unix/CoreServiceRequest.h7
-rw-r--r--src/Core/Unix/CoreServiceResponse.cpp2
-rw-r--r--src/Core/Unix/CoreServiceResponse.h2
-rw-r--r--src/Core/Unix/CoreUnix.cpp281
-rw-r--r--src/Core/Unix/CoreUnix.h4
-rw-r--r--src/Core/Unix/FreeBSD/CoreFreeBSD.cpp53
-rw-r--r--src/Core/Unix/FreeBSD/CoreFreeBSD.h2
-rw-r--r--src/Core/Unix/FreeBSD/System.h2
-rw-r--r--src/Core/Unix/Linux/CoreLinux.cpp16
-rw-r--r--src/Core/Unix/Linux/CoreLinux.h2
-rw-r--r--src/Core/Unix/Linux/System.h2
-rw-r--r--src/Core/Unix/MacOSX/CoreMacOSX.cpp23
-rw-r--r--src/Core/Unix/MacOSX/CoreMacOSX.h2
-rw-r--r--src/Core/Unix/MacOSX/System.h2
-rw-r--r--src/Core/Unix/MountedFilesystem.h2
-rw-r--r--src/Core/Unix/OpenBSD/CoreOpenBSD.cpp6
-rw-r--r--src/Core/Unix/OpenBSD/CoreOpenBSD.h2
-rw-r--r--src/Core/Unix/OpenBSD/System.h2
-rw-r--r--src/Core/Unix/Solaris/CoreSolaris.cpp6
-rw-r--r--src/Core/Unix/Solaris/CoreSolaris.h2
-rw-r--r--src/Core/Unix/Solaris/System.h2
-rw-r--r--src/Core/Unix/System.h2
-rw-r--r--src/Core/VolumeCreator.cpp14
-rw-r--r--src/Core/VolumeCreator.h2
41 files changed, 481 insertions, 183 deletions
diff --git a/src/Core/Core.h b/src/Core/Core.h
index 65ea5bee..b2573cd4 100644
--- a/src/Core/Core.h
+++ b/src/Core/Core.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -80,13 +80,17 @@ namespace VeraCrypt
int m_newPim;
shared_ptr <KeyfileList> m_newKeyfiles;
shared_ptr <Pkcs5Kdf> m_newPkcs5Kdf;
int m_wipeCount;
bool m_emvSupportEnabled;
- ChangePasswordThreadRoutine(shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount, bool emvSupportEnabled) : m_volumePath(volumePath), m_preserveTimestamps(preserveTimestamps), m_password(password), m_pim(pim), m_kdf(kdf), m_keyfiles(keyfiles), m_newPassword(newPassword), m_newPim(newPim), m_newKeyfiles(newKeyfiles), m_newPkcs5Kdf(newPkcs5Kdf), m_wipeCount(wipeCount), m_emvSupportEnabled(emvSupportEnabled) {}
+ bool m_masterKeyVulnerable;
+ ChangePasswordThreadRoutine(shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount, bool emvSupportEnabled) : m_volumePath(volumePath), m_preserveTimestamps(preserveTimestamps), m_password(password), m_pim(pim), m_kdf(kdf), m_keyfiles(keyfiles), m_newPassword(newPassword), m_newPim(newPim), m_newKeyfiles(newKeyfiles), m_newPkcs5Kdf(newPkcs5Kdf), m_wipeCount(wipeCount), m_emvSupportEnabled(emvSupportEnabled), m_masterKeyVulnerable(false) {}
virtual ~ChangePasswordThreadRoutine() { }
- virtual void ExecutionCode(void) { Core->ChangePassword(m_volumePath, m_preserveTimestamps, m_password, m_pim, m_kdf, m_keyfiles, m_newPassword, m_newPim, m_newKeyfiles, m_emvSupportEnabled, m_newPkcs5Kdf, m_wipeCount); }
+ virtual void ExecutionCode(void) {
+ shared_ptr <Volume> openVolume = Core->ChangePassword(m_volumePath, m_preserveTimestamps, m_password, m_pim, m_kdf, m_keyfiles, m_newPassword, m_newPim, m_newKeyfiles, m_emvSupportEnabled, m_newPkcs5Kdf, m_wipeCount);
+ m_masterKeyVulnerable = openVolume->IsMasterKeyVulnerable();
+ }
};
class OpenVolumeThreadRoutine : public WaitThreadRoutine
{
public:
diff --git a/src/Core/CoreBase.cpp b/src/Core/CoreBase.cpp
index c1016726..d2dbd6d7 100644
--- a/src/Core/CoreBase.cpp
+++ b/src/Core/CoreBase.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -21,10 +21,13 @@ namespace VeraCrypt
CoreBase::CoreBase ()
: DeviceChangeInProgress (false)
#if defined(TC_LINUX ) || defined (TC_FREEBSD)
, UseDummySudoPassword (false)
#endif
+#if defined(TC_UNIX)
+ ,AllowInsecureMount (false)
+#endif
{
}
CoreBase::~CoreBase ()
{
@@ -75,14 +78,15 @@ namespace VeraCrypt
backupHeader = true;
}
}
- void CoreBase::ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount) const
+ shared_ptr <Volume> CoreBase::ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount) const
{
shared_ptr <Volume> volume = OpenVolume (volumePath, preserveTimestamps, password, pim, kdf, keyfiles, emvSupportEnabled);
ChangePassword (volume, newPassword, newPim, newKeyfiles, emvSupportEnabled, newPkcs5Kdf, wipeCount);
+ return volume;
}
void CoreBase::CoalesceSlotNumberAndMountPoint (MountOptions &options) const
{
if (options.SlotNumber < GetFirstSlotNumber())
@@ -142,11 +146,11 @@ namespace VeraCrypt
SecureBuffer bootSectorBuffer (sectorSize);
outerVolume->ReadSectors (bootSectorBuffer, 0);
int fatType;
- byte *bootSector = bootSectorBuffer.Ptr();
+ uint8 *bootSector = bootSectorBuffer.Ptr();
if (memcmp (bootSector + 54, "FAT12", 5) == 0)
fatType = 12;
else if (memcmp (bootSector + 54, "FAT16", 5) == 0)
fatType = 16;
diff --git a/src/Core/CoreBase.h b/src/Core/CoreBase.h
index 03aa922a..e4ff0a94 100644
--- a/src/Core/CoreBase.h
+++ b/src/Core/CoreBase.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -32,11 +32,11 @@ namespace VeraCrypt
{
public:
virtual ~CoreBase ();
virtual void ChangePassword (shared_ptr <Volume> openVolume, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const;
- virtual void ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const;
+ virtual shared_ptr <Volume> ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, bool emvSupportEnabled, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const;
virtual void CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair = false) const = 0;
virtual void CoalesceSlotNumberAndMountPoint (MountOptions &options) const;
virtual void CreateKeyfile (const FilePath &keyfilePath) const;
virtual void DismountFilesystem (const DirectoryPath &mountPoint, bool force) const = 0;
virtual shared_ptr <VolumeInfo> DismountVolume (shared_ptr <VolumeInfo> mountedVolume, bool ignoreOpenFiles = false, bool syncVolumeInfo = false) = 0;
@@ -75,26 +75,37 @@ namespace VeraCrypt
virtual void SetAdminPasswordCallback (shared_ptr <GetStringFunctor> functor) { }
virtual void SetApplicationExecutablePath (const FilePath &path) { ApplicationExecutablePath = path; }
virtual void SetFileOwner (const FilesystemPath &path, const UserId &owner) const = 0;
virtual DirectoryPath SlotNumberToMountPoint (VolumeSlotNumber slotNumber) const = 0;
virtual void WipePasswordCache () const = 0;
-#if defined(TC_LINUX ) || defined (TC_FREEBSD)
virtual void ForceUseDummySudoPassword (bool useDummySudoPassword) { UseDummySudoPassword = useDummySudoPassword;}
virtual bool GetUseDummySudoPassword () const { return UseDummySudoPassword;}
+
+#if defined(TC_UNIX)
+ virtual bool IsProtectedSystemDirectory (const DirectoryPath &directory) const = 0;
+ virtual bool IsDirectoryOnUserPath(const DirectoryPath &directory) const = 0;
+ virtual void SetAllowInsecureMount (bool allowInsecureMount) { AllowInsecureMount = allowInsecureMount; }
+ virtual bool GetAllowInsecureMount () const { return AllowInsecureMount; }
#endif
+ virtual void SetUserEnvPATH (const string &path) { UserEnvPATH = path; }
+ virtual string GetUserEnvPATH () const { return UserEnvPATH; }
+
Event VolumeDismountedEvent;
Event VolumeMountedEvent;
Event WarningEvent;
protected:
CoreBase ();
bool DeviceChangeInProgress;
FilePath ApplicationExecutablePath;
-#if defined(TC_LINUX ) || defined (TC_FREEBSD)
+ string UserEnvPATH;
bool UseDummySudoPassword;
+
+#if defined(TC_UNIX)
+ bool AllowInsecureMount;
#endif
private:
CoreBase (const CoreBase &);
CoreBase &operator= (const CoreBase &);
diff --git a/src/Core/CoreException.cpp b/src/Core/CoreException.cpp
index 9284d714..a8123917 100644
--- a/src/Core/CoreException.cpp
+++ b/src/Core/CoreException.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/CoreException.h b/src/Core/CoreException.h
index 8eab1b8e..b2e6b0a1 100644
--- a/src/Core/CoreException.h
+++ b/src/Core/CoreException.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/FatFormatter.cpp b/src/Core/FatFormatter.cpp
index fa327837..0d29c33d 100644
--- a/src/Core/FatFormatter.cpp
+++ b/src/Core/FatFormatter.cpp
@@ -4,11 +4,11 @@
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages. */
#include "Common/Tcdefs.h"
@@ -147,11 +147,11 @@ namespace VeraCrypt
ft->sectors = (uint16) ft->num_sectors;
ft->total_sect = 0;
}
}
- static void PutBoot (fatparams * ft, byte *boot, uint32 volumeId)
+ static void PutBoot (fatparams * ft, uint8 *boot, uint32 volumeId)
{
int cnt = 0;
boot[cnt++] = 0xeb; /* boot jump */
boot[cnt++] = (ft->size_fat == 32)? 0x58: 0x3c;
@@ -242,11 +242,11 @@ namespace VeraCrypt
boot[cnt++] = 0xaa; /* boot sig */
}
/* FAT32 FSInfo */
- static void PutFSInfo (byte *sector, fatparams *ft)
+ static void PutFSInfo (uint8 *sector, fatparams *ft)
{
memset (sector, 0, ft->sector_size);
sector[3] = 0x41; /* LeadSig */
sector[2] = 0x61;
sector[1] = 0x52;
@@ -292,20 +292,20 @@ namespace VeraCrypt
/* Write the data area */
sector.Zero();
uint32 volumeId;
- RandomNumberGenerator::GetDataFast (BufferPtr ((byte *) &volumeId, sizeof (volumeId)));
+ RandomNumberGenerator::GetDataFast (BufferPtr ((uint8 *) &volumeId, sizeof (volumeId)));
- PutBoot (ft, (byte *) sector, volumeId);
+ PutBoot (ft, (uint8 *) sector, volumeId);
writeSector (sector); ++sectorNumber;
/* fat32 boot area */
if (ft->size_fat == 32)
{
/* fsinfo */
- PutFSInfo((byte *) sector, ft);
+ PutFSInfo((uint8 *) sector, ft);
writeSector (sector); ++sectorNumber;
/* reserved */
while (sectorNumber < 6)
{
@@ -315,14 +315,14 @@ namespace VeraCrypt
writeSector (sector); ++sectorNumber;
}
/* bootsector backup */
sector.Zero();
- PutBoot (ft, (byte *) sector, volumeId);
+ PutBoot (ft, (uint8 *) sector, volumeId);
writeSector (sector); ++sectorNumber;
- PutFSInfo((byte *) sector, ft);
+ PutFSInfo((uint8 *) sector, ft);
writeSector (sector); ++sectorNumber;
}
/* reserved */
while (sectorNumber < (uint32)ft->reserved)
@@ -338,33 +338,33 @@ namespace VeraCrypt
{
sector.Zero();
if (n == 0)
{
- byte fat_sig[12];
+ uint8 fat_sig[12];
if (ft->size_fat == 32)
{
- fat_sig[0] = (byte) ft->media;
+ fat_sig[0] = (uint8) ft->media;
fat_sig[1] = fat_sig[2] = 0xff;
fat_sig[3] = 0x0f;
fat_sig[4] = fat_sig[5] = fat_sig[6] = 0xff;
fat_sig[7] = 0x0f;
fat_sig[8] = fat_sig[9] = fat_sig[10] = 0xff;
fat_sig[11] = 0x0f;
memcpy (sector, fat_sig, 12);
}
else if (ft->size_fat == 16)
{
- fat_sig[0] = (byte) ft->media;
+ fat_sig[0] = (uint8) ft->media;
fat_sig[1] = 0xff;
fat_sig[2] = 0xff;
fat_sig[3] = 0xff;
memcpy (sector, fat_sig, 4);
}
else if (ft->size_fat == 12)
{
- fat_sig[0] = (byte) ft->media;
+ fat_sig[0] = (uint8) ft->media;
fat_sig[1] = 0xff;
fat_sig[2] = 0xff;
fat_sig[3] = 0x00;
memcpy (sector, fat_sig, 4);
}
diff --git a/src/Core/FatFormatter.h b/src/Core/FatFormatter.h
index 17f4dd39..1a7de26d 100644
--- a/src/Core/FatFormatter.h
+++ b/src/Core/FatFormatter.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/HostDevice.cpp b/src/Core/HostDevice.cpp
index f48d84d7..4b9f8f2f 100644
--- a/src/Core/HostDevice.cpp
+++ b/src/Core/HostDevice.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/HostDevice.h b/src/Core/HostDevice.h
index 48adf32a..93779281 100644
--- a/src/Core/HostDevice.h
+++ b/src/Core/HostDevice.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/MountOptions.cpp b/src/Core/MountOptions.cpp
index 2f28c089..6228d3cf 100644
--- a/src/Core/MountOptions.cpp
+++ b/src/Core/MountOptions.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/MountOptions.h b/src/Core/MountOptions.h
index 3dcfa599..449ccbae 100644
--- a/src/Core/MountOptions.h
+++ b/src/Core/MountOptions.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/RandomNumberGenerator.cpp b/src/Core/RandomNumberGenerator.cpp
index 6b401901..781d951e 100644
--- a/src/Core/RandomNumberGenerator.cpp
+++ b/src/Core/RandomNumberGenerator.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -112,11 +112,11 @@ namespace VeraCrypt
if (!allowAnyLength && (buffer.Size() > PoolSize))
throw ParameterIncorrect (SRC_POS);
ScopeLock lock (AccessMutex);
size_t bufferLen = buffer.Size(), loopLen;
- byte* pbBuffer = buffer.Get();
+ uint8* pbBuffer = buffer.Get();
// Initialize JitterEntropy RNG for this call
if (0 == jent_entropy_init ())
{
JitterRngCtx = jent_entropy_collector_alloc (1, 0);
@@ -255,29 +255,41 @@ namespace VeraCrypt
}
void RandomNumberGenerator::Test ()
{
shared_ptr <Hash> origPoolHash = PoolHash;
- PoolHash.reset (new Blake2s());
+ #ifndef WOLFCRYPT_BACKEND
+ PoolHash.reset (new Blake2s());
+ #else
+ PoolHash.reset (new Sha256());
+ #endif
Pool.Zero();
Buffer buffer (1);
for (size_t i = 0; i < PoolSize * 10; ++i)
{
- buffer[0] = (byte) i;
+ buffer[0] = (uint8) i;
AddToPool (buffer);
}
+ #ifndef WOLFCRYPT_BACKEND
if (Crc32::ProcessBuffer (Pool) != 0x9c743238)
- throw TestFailed (SRC_POS);
+ #else
+ if (Crc32::ProcessBuffer (Pool) != 0xac95ac1a)
+ #endif
+ throw TestFailed (SRC_POS);
buffer.Allocate (PoolSize);
buffer.CopyFrom (PeekPool());
AddToPool (buffer);
- if (Crc32::ProcessBuffer (Pool) != 0xd2d09c8d)
- throw TestFailed (SRC_POS);
+ #ifndef WOLFCRYPT_BACKEND
+ if (Crc32::ProcessBuffer (Pool) != 0xd2d09c8d)
+ #else
+ if (Crc32::ProcessBuffer (Pool) != 0xb79f3c12)
+ #endif
+ throw TestFailed (SRC_POS);
PoolHash = origPoolHash;
}
Mutex RandomNumberGenerator::AccessMutex;
diff --git a/src/Core/RandomNumberGenerator.h b/src/Core/RandomNumberGenerator.h
index 333a8e36..5fd769a7 100644
--- a/src/Core/RandomNumberGenerator.h
+++ b/src/Core/RandomNumberGenerator.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/CoreService.cpp b/src/Core/Unix/CoreService.cpp
index e543652a..9531069a 100644
--- a/src/Core/Unix/CoreService.cpp
+++ b/src/Core/Unix/CoreService.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -55,11 +55,11 @@ namespace VeraCrypt
throw_sys_if (dup2 (f, STDERR_FILENO) == -1);
// Wait for sync code
while (true)
{
- byte b;
+ uint8 b;
throw_sys_if (read (STDIN_FILENO, &b, 1) != 1);
if (b != 0x00)
continue;
throw_sys_if (read (STDIN_FILENO, &b, 1) != 1);
@@ -97,10 +97,15 @@ namespace VeraCrypt
while (true)
{
shared_ptr <CoreServiceRequest> request = Serializable::DeserializeNew <CoreServiceRequest> (inputStream);
+ // Update Core properties based on the received request
+ Core->SetUserEnvPATH (request->UserEnvPATH);
+ Core->ForceUseDummySudoPassword(request->UseDummySudoPassword);
+ Core->SetAllowInsecureMount(request->AllowInsecureMount);
+
try
{
// ExitRequest
if (dynamic_cast <ExitRequest*> (request.get()) != nullptr)
{
@@ -281,64 +286,70 @@ namespace VeraCrypt
unique_ptr <T> CoreService::SendRequest (CoreServiceRequest &request)
{
static Mutex mutex;
ScopeLock lock (mutex);
+ // Copy Core properties to the request so that they can be transferred to the elevated process
+ request.ApplicationExecutablePath = Core->GetApplicationExecutablePath();
+ request.UserEnvPATH = Core->GetUserEnvPATH();
+ request.UseDummySudoPassword = Core->GetUseDummySudoPassword();
+ request.AllowInsecureMount = Core->GetAllowInsecureMount();
+
if (request.RequiresElevation())
{
request.ElevateUserPrivileges = true;
request.FastElevation = !ElevatedServiceAvailable;
- request.ApplicationExecutablePath = Core->GetApplicationExecutablePath();
-
+
while (!ElevatedServiceAvailable)
{
// Test if the user has an active "sudo" session.
- // This is only done under Linux / FreeBSD by executing the command 'sudo -n uptime'.
- // In case a "sudo" session is active, the result of the command contains the string 'load average'.
- // Otherwise, the result contains "sudo: a password is required".
- // This may not work on all OSX versions because of a bug in sudo in its version 1.7.10,
- // therefore we keep the old behaviour of sending a 'dummy' password under OSX.
- // See : https://superuser.com/questions/902826/why-does-sudo-n-on-mac-os-x-always-return-0
- //
- // If for some reason we are getting empty output from pipe, we revert to old behavior
- // We also use the old way if the user is forcing the use of dummy password for sudo
-
-#if defined(TC_LINUX ) || defined (TC_FREEBSD)
bool authCheckDone = false;
if (!Core->GetUseDummySudoPassword ())
- {
- 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
+ {
+ // We are using -n to avoid prompting the user for a password.
+ // We are redirecting stderr to stdout and discarding both to avoid any output.
+ // This approach also works on newer macOS versions (12.0 and later).
+ std::string errorMsg;
+
+ string sudoAbsolutePath = Process::FindSystemBinary("sudo", errorMsg);
+ if (sudoAbsolutePath.empty())
+ throw SystemException(SRC_POS, errorMsg);
+
+ string trueAbsolutePath = Process::FindSystemBinary("true", errorMsg);
+ if (trueAbsolutePath.empty())
+ throw SystemException(SRC_POS, errorMsg);
+
+ std::string popenCommand = sudoAbsolutePath + " -n " + trueAbsolutePath + " > /dev/null 2>&1"; // We redirect stderr to stdout (2>&1) to be able to catch the result of the command
+ FILE* pipe = popen(popenCommand.c_str(), "r");
if (pipe)
{
- while (!feof(pipe))
- {
- if (fgets(buffer.data(), 128, pipe) != nullptr)
- result += buffer.data();
- }
-
- fflush(pipe);
- pclose(pipe);
+ // We only care about the exit code
+ char buf[128];
+ while (!feof(pipe))
+ {
+ if (fgets(buf, sizeof(buf), pipe) == NULL)
+ break;
+ }
+ int status = pclose(pipe);
pipe = NULL;
- if (!result.empty() && strlen(result.c_str()) != 0)
- {
- authCheckDone = true;
- if (result[0] == '0') // no line found with "load average" text, rerquest admin password
- (*AdminPasswordCallback) (request.AdminPassword);
+ authCheckDone = true;
+
+ // If exit code != 0, user does NOT have an active session => request password
+ if (status != 0)
+ {
+ (*AdminPasswordCallback)(request.AdminPassword);
}
}
if (authCheckDone)
{
// Set to false to force the 'WarningEvent' to be raised in case of and elevation exception.
request.FastElevation = false;
}
}
-#endif
+
try
{
request.Serialize (ServiceInputStream);
unique_ptr <T> response (GetResponse <T>());
ElevatedServiceAvailable = true;
@@ -351,13 +362,12 @@ namespace VeraCrypt
ExceptionEventArgs args (e);
Core->WarningEvent.Raise (args);
}
request.FastElevation = false;
-#if defined(TC_LINUX ) || defined (TC_FREEBSD)
+
if(!authCheckDone)
-#endif
(*AdminPasswordCallback) (request.AdminPassword);
}
}
}
@@ -403,19 +413,30 @@ namespace VeraCrypt
{
try
{
try
{
+ // Throw exception if sudo is not found in secure locations
+ std::string errorMsg;
+ string sudoPath = Process::FindSystemBinary("sudo", errorMsg);
+ if (sudoPath.empty())
+ throw SystemException(SRC_POS, errorMsg);
+
+ string appPath = request.ApplicationExecutablePath;
+ // if appPath is empty or not absolute, use FindSystemBinary to get the full path of veracrpyt executable
+ if (appPath.empty() || appPath[0] != '/')
+ {
+ appPath = Process::FindSystemBinary("veracrypt", errorMsg);
+ if (appPath.empty())
+ throw SystemException(SRC_POS, errorMsg);
+ }
+
throw_sys_if (dup2 (inPipe->GetReadFD(), STDIN_FILENO) == -1);
throw_sys_if (dup2 (outPipe->GetWriteFD(), STDOUT_FILENO) == -1);
throw_sys_if (dup2 (errPipe.GetWriteFD(), STDERR_FILENO) == -1);
- string appPath = request.ApplicationExecutablePath;
- if (appPath.empty())
- appPath = "veracrypt";
-
- const char *args[] = { "sudo", "-S", "-p", "", appPath.c_str(), TC_CORE_SERVICE_CMDLINE_OPTION, nullptr };
+ const char *args[] = { sudoPath.c_str(), "-S", "-p", "", appPath.c_str(), TC_CORE_SERVICE_CMDLINE_OPTION, nullptr };
execvp (args[0], ((char* const*) args));
throw SystemException (SRC_POS, args[0]);
}
catch (Exception &)
{
@@ -541,11 +562,11 @@ namespace VeraCrypt
unique_ptr <Serializable> deserializedObject;
Exception *deserializedException = nullptr;
try
{
- shared_ptr <Stream> stream (new MemoryStream (ConstBufferPtr ((byte *) &errOutput[0], errOutput.size())));
+ shared_ptr <Stream> stream (new MemoryStream (ConstBufferPtr ((uint8 *) &errOutput[0], errOutput.size())));
deserializedObject.reset (Serializable::DeserializeNew (stream));
deserializedException = dynamic_cast <Exception*> (deserializedObject.get());
}
catch (...) { }
@@ -573,11 +594,11 @@ namespace VeraCrypt
ServiceInputStream = shared_ptr <Stream> (new FileStream (inPipe->GetWriteFD()));
ServiceOutputStream = shared_ptr <Stream> (new FileStream (outPipe->GetReadFD()));
// Send sync code
- byte sync[] = { 0, 0x11, 0x22 };
+ uint8 sync[] = { 0, 0x11, 0x22 };
ServiceInputStream->Write (ConstBufferPtr (sync, array_capacity (sync)));
AdminInputPipe = move_ptr(inPipe);
AdminOutputPipe = move_ptr(outPipe);
}
diff --git a/src/Core/Unix/CoreService.h b/src/Core/Unix/CoreService.h
index dfb8b350..5c43f0ed 100644
--- a/src/Core/Unix/CoreService.h
+++ b/src/Core/Unix/CoreService.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/CoreServiceProxy.h b/src/Core/Unix/CoreServiceProxy.h
index d57d8163..896df3e6 100644
--- a/src/Core/Unix/CoreServiceProxy.h
+++ b/src/Core/Unix/CoreServiceProxy.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/CoreServiceRequest.cpp b/src/Core/Unix/CoreServiceRequest.cpp
index 98101ba4..14e2ec28 100644
--- a/src/Core/Unix/CoreServiceRequest.cpp
+++ b/src/Core/Unix/CoreServiceRequest.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -21,20 +21,26 @@ namespace VeraCrypt
Serializer sr (stream);
sr.Deserialize ("AdminPassword", AdminPassword);
ApplicationExecutablePath = sr.DeserializeWString ("ApplicationExecutablePath");
sr.Deserialize ("ElevateUserPrivileges", ElevateUserPrivileges);
sr.Deserialize ("FastElevation", FastElevation);
+ sr.Deserialize ("UserEnvPATH", UserEnvPATH);
+ sr.Deserialize ("UseDummySudoPassword", UseDummySudoPassword);
+ sr.Deserialize ("AllowInsecureMount", AllowInsecureMount);
}
void CoreServiceRequest::Serialize (shared_ptr <Stream> stream) const
{
Serializable::Serialize (stream);
Serializer sr (stream);
sr.Serialize ("AdminPassword", AdminPassword);
sr.Serialize ("ApplicationExecutablePath", wstring (ApplicationExecutablePath));
sr.Serialize ("ElevateUserPrivileges", ElevateUserPrivileges);
sr.Serialize ("FastElevation", FastElevation);
+ sr.Serialize ("UserEnvPATH", UserEnvPATH);
+ sr.Serialize ("UseDummySudoPassword", UseDummySudoPassword);
+ sr.Serialize ("AllowInsecureMount", AllowInsecureMount);
}
// CheckFilesystemRequest
void CheckFilesystemRequest::Deserialize (shared_ptr <Stream> stream)
{
diff --git a/src/Core/Unix/CoreServiceRequest.h b/src/Core/Unix/CoreServiceRequest.h
index 5b12cc11..77778ca2 100644
--- a/src/Core/Unix/CoreServiceRequest.h
+++ b/src/Core/Unix/CoreServiceRequest.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -18,19 +18,22 @@
namespace VeraCrypt
{
struct CoreServiceRequest : public Serializable
{
- CoreServiceRequest () : ElevateUserPrivileges (false), FastElevation (false) { }
+ CoreServiceRequest () : ElevateUserPrivileges (false), FastElevation (false), UseDummySudoPassword (false), AllowInsecureMount (false) { }
TC_SERIALIZABLE (CoreServiceRequest);
virtual bool RequiresElevation () const { return false; }
string AdminPassword;
FilePath ApplicationExecutablePath;
bool ElevateUserPrivileges;
bool FastElevation;
+ string UserEnvPATH;
+ bool UseDummySudoPassword;
+ bool AllowInsecureMount;
};
struct CheckFilesystemRequest : CoreServiceRequest
{
CheckFilesystemRequest () { }
diff --git a/src/Core/Unix/CoreServiceResponse.cpp b/src/Core/Unix/CoreServiceResponse.cpp
index b53b8a30..1eb0af3f 100644
--- a/src/Core/Unix/CoreServiceResponse.cpp
+++ b/src/Core/Unix/CoreServiceResponse.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/CoreServiceResponse.h b/src/Core/Unix/CoreServiceResponse.h
index 1f4c675e..91a2483b 100644
--- a/src/Core/Unix/CoreServiceResponse.h
+++ b/src/Core/Unix/CoreServiceResponse.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/CoreUnix.cpp b/src/Core/Unix/CoreUnix.cpp
index 258979b9..1f2d3125 100644
--- a/src/Core/Unix/CoreUnix.cpp
+++ b/src/Core/Unix/CoreUnix.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -27,10 +27,45 @@ namespace VeraCrypt
#ifdef TC_LINUX
static string GetTmpUser ();
static bool SamePath (const string& path1, const string& path2);
#endif
+ // Struct to hold terminal emulator information
+ struct TerminalInfo {
+ const char* name;
+ const char** args;
+ const char** dependency_path;
+ };
+
+ // Popular terminal emulators data and arguments
+ static const char* xterm_args[] = {"-T", "fsck", "-e", NULL};
+
+ static const char* gnome_args[] = {"--title", "fsck", "--", "sh", "-c", NULL};
+ static const char* gnome_deps[] = {"dbus-launch", NULL};
+
+ static const char* konsole_args[] = {"--hold", "-p", "tabtitle=fsck", "-e", "sh", "-c", NULL};
+ static const char* xfce4_args[] = {"--title=fsck", "-x", "sh", "-c", NULL};
+ static const char* mate_args[] = {"--title", "fsck", "--", "sh", "-c", NULL};
+ static const char* lxterminal_args[] = {"--title=fsck", "-e", "sh", "-c", NULL};
+ static const char* terminator_args[] = {"-T", "fsck", "-x", "sh", "-c", NULL};
+ static const char* urxvt_args[] = {"-title", "fsck", "-e", "sh", "-c", NULL};
+ static const char* st_args[] = {"-t", "fsck", "-e", "sh", "-c", NULL};
+
+ // List of popular terminal emulators
+ static const TerminalInfo TERMINALS[] = {
+ {"xterm", xterm_args, NULL},
+ {"gnome-terminal", gnome_args, gnome_deps},
+ {"konsole", konsole_args, NULL},
+ {"xfce4-terminal", xfce4_args, NULL},
+ {"mate-terminal", mate_args, NULL},
+ {"lxterminal", lxterminal_args, NULL},
+ {"terminator", terminator_args, NULL},
+ {"urxvt", urxvt_args, NULL},
+ {"st", st_args, NULL},
+ {NULL, NULL, NULL}
+ };
+
CoreUnix::CoreUnix ()
{
signal (SIGPIPE, SIG_IGN);
char *loc = setlocale (LC_ALL, "");
@@ -45,70 +80,71 @@ namespace VeraCrypt
void CoreUnix::CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair) const
{
if (!mountedVolume->MountPoint.IsEmpty())
DismountFilesystem (mountedVolume->MountPoint, false);
- list <string> args;
-
- args.push_back ("-T");
- args.push_back ("fsck");
+ // Find system fsck first
+ std::string errorMsg;
+ std::string fsckPath = Process::FindSystemBinary("fsck", errorMsg);
+ if (fsckPath.empty()) {
+ throw SystemException(SRC_POS, errorMsg);
+ }
- args.push_back ("-e");
+ list <string> args;
- string xargs = "fsck ";
+ string xargs = fsckPath + " "; // Use absolute fsck path
#ifdef TC_LINUX
if (!repair)
xargs += "-n ";
else
xargs += "-r ";
#endif
xargs += string (mountedVolume->VirtualDevice) + "; echo '[Done]'; read W";
- args.push_back (xargs);
+ // Try each terminal
+ for (const TerminalInfo* term = TERMINALS; term->name != NULL; ++term) {
+ errno = 0;
+ std::string termPath = Process::FindSystemBinary(term->name, errorMsg);
+ if (termPath.length() > 0) {
+ // check dependencies
+ if (term->dependency_path) {
+ bool depFound = true;
+ for (const char** dep = term->dependency_path; *dep != NULL; ++dep) {
+ string depPath = Process::FindSystemBinary(*dep, errorMsg);
+ if (depPath.empty()) {
+ depFound = false;
+ break;
+ }
+ }
- try
- {
- Process::Execute ("xterm", args, 1000);
- } catch (TimeOut&) { }
-#ifdef TC_LINUX
- catch (SystemException&)
- {
- // xterm not available. Try with KDE konsole if it exists
- struct stat sb;
- if (stat("/usr/bin/konsole", &sb) == 0)
- {
- args.clear ();
- args.push_back ("-p");
- args.push_back ("tabtitle=fsck");
- args.push_back ("-e");
- args.push_back ("sh");
- args.push_back ("-c");
- args.push_back (xargs);
- try
- {
- Process::Execute ("konsole", args, 1000);
- } catch (TimeOut&) { }
- }
- else if (stat("/usr/bin/gnome-terminal", &sb) == 0 && stat("/usr/bin/dbus-launch", &sb) == 0)
- {
- args.clear ();
- args.push_back ("--title");
- args.push_back ("fsck");
- args.push_back ("--");
- args.push_back ("sh");
- args.push_back ("-c");
- args.push_back (xargs);
- try
- {
- Process::Execute ("gnome-terminal", args, 1000);
- } catch (TimeOut&) { }
+ if (!depFound) {
+ continue; // dependency not found, skip
+ }
+ }
+
+ // Build args
+ std::list<std::string> args;
+ for (const char** arg = term->args; *arg != NULL; ++arg) {
+ args.push_back(*arg);
+ }
+ args.push_back(xargs);
+
+ try {
+ Process::Execute (termPath, args, 1000);
+ return;
+ }
+ catch (TimeOut&) {
+ return;
+ }
+ catch (SystemException&) {
+ // Continue to next terminal
+ }
}
- else
- throw TerminalNotFound();
}
-#endif
+
+ throw TerminalNotFound();
}
void CoreUnix::DismountFilesystem (const DirectoryPath &mountPoint, bool force) const
{
list <string> args;
@@ -239,11 +275,11 @@ namespace VeraCrypt
Buffer bootSector (device.GetDeviceSectorSize());
device.SeekAt (0);
device.ReadCompleteBuffer (bootSector);
- byte *b = bootSector.Ptr();
+ uint8 *b = bootSector.Ptr();
return memcmp (b + 3, "NTFS", 4) != 0
&& memcmp (b + 54, "FAT", 3) != 0
&& memcmp (b + 82, "FAT32", 5) != 0
&& memcmp (b + 3, "EXFAT", 5) != 0;
@@ -301,21 +337,49 @@ namespace VeraCrypt
{
if (string (mf.MountPoint).find (GetFuseMountDirPrefix()) == string::npos)
continue;
shared_ptr <VolumeInfo> mountedVol;
- try
+ // Introduce a retry mechanism with a timeout for control file access
+ // This workaround is limited to FUSE-T mounted volume under macOS for
+ // which md.Device starts with "fuse-t:"
+#ifdef VC_MACOSX_FUSET
+ bool isFuseT = wstring(mf.Device).find(L"fuse-t:") == 0;
+ int controlFileRetries = 10; // 10 retries with 500ms sleep each, total 5 seconds
+ while (!mountedVol && (controlFileRetries-- > 0))
+#endif
{
- shared_ptr <File> controlFile (new File);
- controlFile->Open (string (mf.MountPoint) + FuseService::GetControlPath());
+ try
+ {
+ shared_ptr <File> controlFile (new File);
+ controlFile->Open (string (mf.MountPoint) + FuseService::GetControlPath());
- shared_ptr <Stream> controlFileStream (new FileStream (controlFile));
- mountedVol = Serializable::DeserializeNew <VolumeInfo> (controlFileStream);
+ shared_ptr <Stream> controlFileStream (new FileStream (controlFile));
+ mountedVol = Serializable::DeserializeNew <VolumeInfo> (controlFileStream);
+ }
+ catch (const std::exception& e)
+ {
+#ifdef VC_MACOSX_FUSET
+ // if exception starts with "VeraCrypt::Serializer::ValidateName", then
+ // serialization is not ready yet and we need to wait before retrying
+ // this happens when FUSE-T is used under macOS and if it is the first time
+ // the volume is mounted
+ if (isFuseT && string (e.what()).find ("VeraCrypt::Serializer::ValidateName") != string::npos)
+ {
+ Thread::Sleep(500); // Wait before retrying
+ }
+ else
+ {
+ break; // Control file not found or other error
+ }
+#endif
+ }
}
- catch (...)
+
+ if (!mountedVol)
{
- continue;
+ continue; // Skip to the next mounted filesystem
}
if (!volumePath.IsEmpty() && wstring (mountedVol->Path).compare (volumePath) != 0)
continue;
@@ -530,10 +594,21 @@ namespace VeraCrypt
CoalesceSlotNumberAndMountPoint (options);
if (IsVolumeMounted (*options.Path))
throw VolumeAlreadyMounted (SRC_POS);
+ if (options.MountPoint && !options.MountPoint->IsEmpty())
+ {
+ // Reject if the mount point is a system directory
+ if (IsProtectedSystemDirectory(*options.MountPoint))
+ throw MountPointBlocked (SRC_POS);
+
+ // Reject if the mount point is in the user's PATH and the user has not explicitly allowed insecure mount points
+ if (!GetAllowInsecureMount() && IsDirectoryOnUserPath(*options.MountPoint))
+ throw MountPointNotAllowed (SRC_POS);
+ }
+
Cipher::EnableHwSupport (!options.NoHardwareCrypto);
shared_ptr <Volume> volume;
while (true)
@@ -762,6 +837,102 @@ namespace VeraCrypt
stringstream s;
s << GetDefaultMountPointPrefix() << slotNumber;
return s.str();
}
+
+ bool CoreUnix::IsProtectedSystemDirectory (const DirectoryPath &directory) const
+ {
+ static const char* systemDirs[] = {
+ "/usr",
+ "/bin",
+ "/sbin",
+ "/lib",
+#ifdef TC_LINUX
+ "/lib32",
+ "/lib64",
+ "/libx32",
+#endif
+ "/etc",
+ "/boot",
+ "/root",
+ "/proc",
+ "/sys",
+ "/dev",
+ NULL
+ };
+
+ // Resolve any symlinks in the path
+ string path(directory);
+ char* resolvedPathCStr = realpath(path.c_str(), NULL);
+ if (resolvedPathCStr)
+ {
+ path = resolvedPathCStr;
+ free(resolvedPathCStr); // Free the allocated memory
+ }
+
+ // reject of the path is the root directory "/"
+ if (path == "/")
+ return true;
+
+ // Check if resolved path matches any system directory
+ for (int i = 0; systemDirs[i] != NULL; ++i)
+ {
+ if (path == systemDirs[i] || path.find(string(systemDirs[i]) + "/") == 0)
+ return true;
+ }
+
+ return false;
+ }
+
+ bool CoreUnix::IsDirectoryOnUserPath(const DirectoryPath &directory) const
+ {
+ // Obtain the PATH environment variable
+ const char* pathEnv = UserEnvPATH.c_str();
+ if (!pathEnv[0])
+ return false;
+
+ // Resolve the given directory
+ string dirPath(directory);
+ char* resolvedDir = realpath(dirPath.c_str(), NULL);
+ if (resolvedDir)
+ {
+ dirPath = resolvedDir;
+ free(resolvedDir);
+ }
+
+ // Split PATH and compare each entry
+ stringstream ss(pathEnv);
+ string token;
+ while (getline(ss, token, ':'))
+ {
+ // remove any trailing slashes from the token
+ while (!token.empty() && token.back() == '/')
+ token.pop_back();
+
+ if (token.empty())
+ continue;
+
+ // check if the directory is the same as the entry or a subdirectory
+ if (dirPath == token || dirPath.find(token + "/") == 0)
+ return true;
+
+ // handle the case where the PATH entry is a symlink
+ char* resolvedEntry = realpath(token.c_str(), NULL);
+ if (!resolvedEntry)
+ continue; // skip to the next entry since the path does not exist
+
+ string entryPath(resolvedEntry);
+ free(resolvedEntry);
+
+ // remove any trailing slashes from the token
+ while (!entryPath.empty() && entryPath.back() == '/')
+ entryPath.pop_back();
+
+ // perform check again if the resolved path is different from the original (symlink)
+ if (dirPath == entryPath || dirPath.find(entryPath + "/") == 0)
+ return true;
+ }
+
+ return false;
+ }
}
diff --git a/src/Core/Unix/CoreUnix.h b/src/Core/Unix/CoreUnix.h
index 586d4df3..ae26bf0a 100644
--- a/src/Core/Unix/CoreUnix.h
+++ b/src/Core/Unix/CoreUnix.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -46,10 +46,12 @@ namespace VeraCrypt
virtual VolumeSlotNumber MountPointToSlotNumber (const DirectoryPath &mountPoint) const;
virtual shared_ptr <VolumeInfo> MountVolume (MountOptions &options);
virtual void SetFileOwner (const FilesystemPath &path, const UserId &owner) const;
virtual DirectoryPath SlotNumberToMountPoint (VolumeSlotNumber slotNumber) const;
virtual void WipePasswordCache () const { throw NotApplicable (SRC_POS); }
+ virtual bool IsProtectedSystemDirectory (const DirectoryPath &directory) const;
+ virtual bool IsDirectoryOnUserPath(const DirectoryPath &directory) const;
protected:
virtual DevicePath AttachFileToLoopDevice (const FilePath &filePath, bool readOnly) const { throw NotApplicable (SRC_POS); }
virtual void DetachLoopDevice (const DevicePath &devicePath) const { throw NotApplicable (SRC_POS); }
virtual void DismountNativeVolume (shared_ptr <VolumeInfo> mountedVolume) const { throw NotApplicable (SRC_POS); }
diff --git a/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp b/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp
index 01463c35..8f5b8048 100644
--- a/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp
+++ b/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -44,11 +44,11 @@ namespace VeraCrypt
}
args.push_back ("-f");
args.push_back (filePath);
- string dev = StringConverter::Trim (Process::Execute ("mdconfig", args));
+ string dev = StringConverter::Trim (Process::Execute ("/sbin/mdconfig", args));
if (dev.find ("/") == string::npos)
dev = string ("/dev/") + dev;
return dev;
@@ -63,11 +63,11 @@ namespace VeraCrypt
for (int t = 0; true; t++)
{
try
{
- Process::Execute ("mdconfig", args);
+ Process::Execute ("/sbin/mdconfig", args);
break;
}
catch (ExecutedProcessFailed&)
{
if (t > 5)
@@ -81,11 +81,11 @@ namespace VeraCrypt
{
HostDeviceList devices;
#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++)
{
stringstream devPath;
@@ -183,14 +183,55 @@ namespace VeraCrypt
return mountedFilesystems;
}
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&)
{
if (!filesystemType.empty())
throw;
diff --git a/src/Core/Unix/FreeBSD/CoreFreeBSD.h b/src/Core/Unix/FreeBSD/CoreFreeBSD.h
index 453f6440..5510aa2c 100644
--- a/src/Core/Unix/FreeBSD/CoreFreeBSD.h
+++ b/src/Core/Unix/FreeBSD/CoreFreeBSD.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/FreeBSD/System.h b/src/Core/Unix/FreeBSD/System.h
index b5e28f31..63f68aae 100644
--- a/src/Core/Unix/FreeBSD/System.h
+++ b/src/Core/Unix/FreeBSD/System.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/Linux/CoreLinux.cpp b/src/Core/Unix/Linux/CoreLinux.cpp
index e1da6dff..77ec874a 100644
--- a/src/Core/Unix/Linux/CoreLinux.cpp
+++ b/src/Core/Unix/Linux/CoreLinux.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -20,10 +20,13 @@
#include <sys/wait.h>
#include "CoreLinux.h"
#include "Platform/SystemInfo.h"
#include "Platform/TextReader.h"
#include "Volume/EncryptionModeXTS.h"
+#ifdef WOLFCRYPT_BACKEND
+#include "Volume/EncryptionModeWolfCryptXTS.h"
+#endif
#include "Driver/Fuse/FuseService.h"
#include "Core/Unix/CoreServiceProxy.h"
namespace VeraCrypt
{
@@ -300,12 +303,17 @@ namespace VeraCrypt
CoreUnix::MountFilesystem (devicePath, mountPoint, filesystemType, readOnly, systemMountOptions);
}
void CoreLinux::MountVolumeNative (shared_ptr <Volume> volume, MountOptions &options, const DirectoryPath &auxMountPoint) const
{
- bool xts = (typeid (*volume->GetEncryptionMode()) == typeid (EncryptionModeXTS));
- bool algoNotSupported = (typeid (*volume->GetEncryptionAlgorithm()) == typeid (Kuznyechik))
+ bool xts = (typeid (*volume->GetEncryptionMode()) ==
+ #ifdef WOLFCRYPT_BACKEND
+ typeid (EncryptionModeWolfCryptXTS));
+ #else
+ typeid (EncryptionModeXTS));
+ #endif
+ bool algoNotSupported = (typeid (*volume->GetEncryptionAlgorithm()) == typeid (Kuznyechik))
|| (typeid (*volume->GetEncryptionAlgorithm()) == typeid (CamelliaKuznyechik))
|| (typeid (*volume->GetEncryptionAlgorithm()) == typeid (KuznyechikTwofish))
|| (typeid (*volume->GetEncryptionAlgorithm()) == typeid (KuznyechikAES))
|| (typeid (*volume->GetEncryptionAlgorithm()) == typeid (KuznyechikSerpentCamellia));
@@ -376,11 +384,11 @@ namespace VeraCrypt
dmCreateArgs << string (volumePath) << ' ' << startSector;
else
dmCreateArgs << nativeDevPath << " 0";
SecureBuffer dmCreateArgsBuf (dmCreateArgs.str().size());
- dmCreateArgsBuf.CopyFrom (ConstBufferPtr ((byte *) dmCreateArgs.str().c_str(), dmCreateArgs.str().size()));
+ dmCreateArgsBuf.CopyFrom (ConstBufferPtr ((uint8 *) dmCreateArgs.str().c_str(), dmCreateArgs.str().size()));
// Keys
const SecureBuffer &cipherKey = cipher.GetKey();
secondaryKeyOffset -= cipherKey.Size();
ConstBufferPtr secondaryKey = volume->GetEncryptionMode()->GetKey().GetRange (xts ? secondaryKeyOffset : 0, xts ? cipherKey.Size() : 16);
diff --git a/src/Core/Unix/Linux/CoreLinux.h b/src/Core/Unix/Linux/CoreLinux.h
index 9af801ec..b851fc27 100644
--- a/src/Core/Unix/Linux/CoreLinux.h
+++ b/src/Core/Unix/Linux/CoreLinux.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/Linux/System.h b/src/Core/Unix/Linux/System.h
index 0ec1daf0..c98bfd0a 100644
--- a/src/Core/Unix/Linux/System.h
+++ b/src/Core/Unix/Linux/System.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/MacOSX/CoreMacOSX.cpp b/src/Core/Unix/MacOSX/CoreMacOSX.cpp
index b596e6e8..df8a40e2 100644
--- a/src/Core/Unix/MacOSX/CoreMacOSX.cpp
+++ b/src/Core/Unix/MacOSX/CoreMacOSX.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -45,11 +45,11 @@ namespace VeraCrypt
if (ignoreOpenFiles)
args.push_back ("-force");
try
{
- Process::Execute ("hdiutil", args);
+ Process::Execute ("/usr/bin/hdiutil", args);
}
catch (ExecutedProcessFailed &e)
{
if (!ignoreOpenFiles)
{
@@ -82,11 +82,11 @@ namespace VeraCrypt
for (int t = 0; true; t++)
{
try
{
- Process::Execute ("umount", args);
+ Process::Execute ("/sbin/umount", args);
break;
}
catch (ExecutedProcessFailed&)
{
if (t > 10)
@@ -105,16 +105,23 @@ namespace VeraCrypt
}
void CoreMacOSX::CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair) const
{
list <string> args;
- args.push_back ("/Applications/Utilities/Disk Utility.app");
- Process::Execute ("open", args);
+ struct stat sb;
+
+ if (stat("/Applications/Utilities/Disk Utility.app", &sb) == 0)
+ args.push_back ("/Applications/Utilities/Disk Utility.app");
+ else
+ args.push_back ("/System/Applications/Utilities/Disk Utility.app");
+
+ Process::Execute ("/usr/bin/open", args);
}
void CoreMacOSX::MountAuxVolumeImage (const DirectoryPath &auxMountPoint, const MountOptions &options) const
{
+#ifndef VC_MACOSX_FUSET
// Check FUSE version
char fuseVersionString[MAXHOSTNAMELEN + 1] = { 0 };
size_t fuseVersionStringLength = MAXHOSTNAMELEN;
int status;
@@ -145,11 +152,11 @@ namespace VeraCrypt
uint32 fuseVersionMajor = StringConverter::ToUInt32 (fuseVersion[0]);
uint32 fuseVersionMinor = StringConverter::ToUInt32 (fuseVersion[1]);
if (fuseVersionMajor < 2 || (fuseVersionMajor == 2 && fuseVersionMinor < 5))
throw HigherFuseVersionRequired (SRC_POS);
-
+#endif
// Mount volume image
string volImage = string (auxMountPoint) + FuseService::GetVolumeImagePath();
list <string> args;
args.push_back ("attach");
@@ -181,11 +188,11 @@ namespace VeraCrypt
while (true)
{
try
{
- xml = Process::Execute ("hdiutil", args);
+ xml = Process::Execute ("/usr/bin/hdiutil", args);
break;
}
catch (ExecutedProcessFailed &e)
{
if (e.GetErrorOutput().find ("noautofsck") != string::npos)
@@ -224,11 +231,11 @@ namespace VeraCrypt
list <string> args;
args.push_back ("detach");
args.push_back (volImage);
args.push_back ("-force");
- Process::Execute ("hdiutil", args);
+ Process::Execute ("/usr/bin/hdiutil", args);
}
catch (ExecutedProcessFailed&) { }
throw;
}
}
diff --git a/src/Core/Unix/MacOSX/CoreMacOSX.h b/src/Core/Unix/MacOSX/CoreMacOSX.h
index d2c70a87..da905708 100644
--- a/src/Core/Unix/MacOSX/CoreMacOSX.h
+++ b/src/Core/Unix/MacOSX/CoreMacOSX.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/MacOSX/System.h b/src/Core/Unix/MacOSX/System.h
index d187877f..af286829 100644
--- a/src/Core/Unix/MacOSX/System.h
+++ b/src/Core/Unix/MacOSX/System.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/MountedFilesystem.h b/src/Core/Unix/MountedFilesystem.h
index 3f6bd3e2..de9bc138 100644
--- a/src/Core/Unix/MountedFilesystem.h
+++ b/src/Core/Unix/MountedFilesystem.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/OpenBSD/CoreOpenBSD.cpp b/src/Core/Unix/OpenBSD/CoreOpenBSD.cpp
index 3064103b..161d4a79 100644
--- a/src/Core/Unix/OpenBSD/CoreOpenBSD.cpp
+++ b/src/Core/Unix/OpenBSD/CoreOpenBSD.cpp
@@ -5,11 +5,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -73,11 +73,11 @@ namespace VeraCrypt
freePath << "vnd" << freeVnd;
args.push_back (freePath.str());
args.push_back (filePath);
- Process::Execute ("vnconfig", args);
+ Process::Execute ("/sbin/vnconfig", args);
return "/dev/" + freePath.str() + "c";
}
void CoreOpenBSD::DetachLoopDevice (const DevicePath &devicePath) const
@@ -88,11 +88,11 @@ namespace VeraCrypt
for (int t = 0; true; t++)
{
try
{
- Process::Execute ("vnconfig", args);
+ Process::Execute ("/sbin/vnconfig", args);
break;
}
catch (ExecutedProcessFailed&)
{
if (t > 5)
diff --git a/src/Core/Unix/OpenBSD/CoreOpenBSD.h b/src/Core/Unix/OpenBSD/CoreOpenBSD.h
index 3f6c48b5..32129534 100644
--- a/src/Core/Unix/OpenBSD/CoreOpenBSD.h
+++ b/src/Core/Unix/OpenBSD/CoreOpenBSD.h
@@ -5,11 +5,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/OpenBSD/System.h b/src/Core/Unix/OpenBSD/System.h
index 90b24b2a..9c155a40 100644
--- a/src/Core/Unix/OpenBSD/System.h
+++ b/src/Core/Unix/OpenBSD/System.h
@@ -5,11 +5,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/Solaris/CoreSolaris.cpp b/src/Core/Unix/Solaris/CoreSolaris.cpp
index 15a79c49..c436be8f 100644
--- a/src/Core/Unix/Solaris/CoreSolaris.cpp
+++ b/src/Core/Unix/Solaris/CoreSolaris.cpp
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
@@ -33,11 +33,11 @@ namespace VeraCrypt
{
list <string> args;
args.push_back ("-a");
args.push_back (filePath);
- return StringConverter::Trim (Process::Execute ("lofiadm", args));
+ return StringConverter::Trim (Process::Execute ("/usr/sbin/lofiadm", args));
}
void CoreSolaris::DetachLoopDevice (const DevicePath &devicePath) const
{
list <string> args;
@@ -46,11 +46,11 @@ namespace VeraCrypt
for (int t = 0; true; t++)
{
try
{
- Process::Execute ("lofiadm", args);
+ Process::Execute ("/usr/sbin/lofiadm", args);
break;
}
catch (ExecutedProcessFailed&)
{
if (t > 5)
diff --git a/src/Core/Unix/Solaris/CoreSolaris.h b/src/Core/Unix/Solaris/CoreSolaris.h
index d36f03f9..6a55583a 100644
--- a/src/Core/Unix/Solaris/CoreSolaris.h
+++ b/src/Core/Unix/Solaris/CoreSolaris.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/Solaris/System.h b/src/Core/Unix/Solaris/System.h
index 73513467..7ee71da4 100644
--- a/src/Core/Unix/Solaris/System.h
+++ b/src/Core/Unix/Solaris/System.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/Unix/System.h b/src/Core/Unix/System.h
index 7225dae2..b6a6f092 100644
--- a/src/Core/Unix/System.h
+++ b/src/Core/Unix/System.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
diff --git a/src/Core/VolumeCreator.cpp b/src/Core/VolumeCreator.cpp
index 5f19a66d..a60b12ba 100644
--- a/src/Core/VolumeCreator.cpp
+++ b/src/Core/VolumeCreator.cpp
@@ -2,18 +2,21 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/
#include "Volume/EncryptionTest.h"
#include "Volume/EncryptionModeXTS.h"
+#ifdef WOLFCRYPT_BACKEND
+#include "Volume/EncryptionModeWolfCryptXTS.h"
+#endif
#include "Core.h"
#ifdef TC_UNIX
#include <sys/types.h>
#include <sys/stat.h>
@@ -358,12 +361,17 @@ namespace VeraCrypt
VolumeFile->Write (headerBuffer);
}
// Data area keys
options->EA->SetKey (MasterKey.GetRange (0, options->EA->GetKeySize()));
- shared_ptr <EncryptionMode> mode (new EncryptionModeXTS ());
- mode->SetKey (MasterKey.GetRange (options->EA->GetKeySize(), options->EA->GetKeySize()));
+ #ifdef WOLFCRYPT_BACKEND
+ shared_ptr <EncryptionMode> mode (new EncryptionModeWolfCryptXTS ());
+ options->EA->SetKeyXTS (MasterKey.GetRange (options->EA->GetKeySize(), options->EA->GetKeySize()));
+ #else
+ shared_ptr <EncryptionMode> mode (new EncryptionModeXTS ());
+ #endif
+ mode->SetKey (MasterKey.GetRange (options->EA->GetKeySize(), options->EA->GetKeySize()));
options->EA->SetMode (mode);
Options = options;
AbortRequested = false;
diff --git a/src/Core/VolumeCreator.h b/src/Core/VolumeCreator.h
index 781354b9..a25a9667 100644
--- a/src/Core/VolumeCreator.h
+++ b/src/Core/VolumeCreator.h
@@ -2,11 +2,11 @@
Derived from source code of TrueCrypt 7.1a, which is
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)
- and all other portions of this file are Copyright (c) 2013-2017 IDRIX
+ and all other portions of this file are Copyright (c) 2013-2025 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
code distribution packages.
*/