VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2024-11-16 01:50:06 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2024-11-16 01:50:06 +0100
commit9c9870b1038ca4c91f7cce556e5f16f783a309fc (patch)
tree18e6a1760521f0c7eddfadd3ccf6766078852c8f
parentc86577fc0ed481f622793e66627058928ade02a9 (diff)
downloadVeraCrypt-9c9870b1038ca4c91f7cce556e5f16f783a309fc.tar.gz
VeraCrypt-9c9870b1038ca4c91f7cce556e5f16f783a309fc.zip
Windows: Avoid modifying BootArguments structure and use __unaligned keyword to inform compiler that pointer is unaligned.HEADmaster
This avoids issues with existing bootloaders
-rw-r--r--src/Boot/Windows/BootCommon.h3
-rw-r--r--src/Common/Cache.c2
-rw-r--r--src/Common/Cache.h2
-rw-r--r--src/Driver/DriveFilter.c2
4 files changed, 4 insertions, 5 deletions
diff --git a/src/Boot/Windows/BootCommon.h b/src/Boot/Windows/BootCommon.h
index 0e6c973c..45a1a650 100644
--- a/src/Boot/Windows/BootCommon.h
+++ b/src/Boot/Windows/BootCommon.h
@@ -14,7 +14,6 @@
#define TC_HEADER_Boot_BootCommon
#include "Common/Password.h"
-#include "Crypto/config.h"
#include "BootDefs.h"
// The user will be advised to upgrade the rescue disk if upgrading from the following or any previous version
@@ -59,7 +58,7 @@ typedef struct
uint16 CryptoInfoOffset;
uint16 CryptoInfoLength;
uint32 HeaderSaltCrc32;
- CRYPTOPP_ALIGN_DATA(8) PasswordLegacy BootPassword;
+ PasswordLegacy BootPassword;
uint64 HiddenSystemPartitionStart;
uint64 DecoySystemPartitionStart;
uint32 Flags;
diff --git a/src/Common/Cache.c b/src/Common/Cache.c
index c72aa79d..60b2f04a 100644
--- a/src/Common/Cache.c
+++ b/src/Common/Cache.c
@@ -170,7 +170,7 @@ void AddPasswordToCache (Password *password, int pim, BOOL bCachePim)
burn (&tmpPass, sizeof (Password));
}
-void AddLegacyPasswordToCache (PasswordLegacy *password, int pim)
+void AddLegacyPasswordToCache (__unaligned PasswordLegacy *password, int pim)
{
Password inputPass = {0};
inputPass.Length = password->Length;
diff --git a/src/Common/Cache.h b/src/Common/Cache.h
index 84bb6937..cfab6f4f 100644
--- a/src/Common/Cache.h
+++ b/src/Common/Cache.h
@@ -21,6 +21,6 @@
extern int cacheEmpty;
void AddPasswordToCache (Password *password, int pim, BOOL bCachePim);
-void AddLegacyPasswordToCache (PasswordLegacy *password, int pim);
+void AddLegacyPasswordToCache (__unaligned PasswordLegacy *password, int pim);
int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, BOOL bCachePim, unsigned char *header, Password *password, int pkcs5_prf, int pim, PCRYPTO_INFO *retInfo);
void WipeCache (void);
diff --git a/src/Driver/DriveFilter.c b/src/Driver/DriveFilter.c
index f549cc08..7503a8ee 100644
--- a/src/Driver/DriveFilter.c
+++ b/src/Driver/DriveFilter.c
@@ -411,7 +411,7 @@ static void ComputeBootLoaderFingerprint(PDEVICE_OBJECT LowerDeviceObject, uint8
}
-static NTSTATUS MountDrive (DriveFilterExtension *Extension, Password *password, uint32 *headerSaltCrc32)
+static NTSTATUS MountDrive (DriveFilterExtension *Extension, Password *password, __unaligned uint32 *headerSaltCrc32)
{
BOOL hiddenVolume = (BootArgs.HiddenSystemPartitionStart != 0);
int64 hiddenHeaderOffset = BootArgs.HiddenSystemPartitionStart + TC_HIDDEN_VOLUME_HEADER_OFFSET;