VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-08-09 21:32:44 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-08-14 23:09:14 (GMT)
commitb146e235f893b62befc413ff547ee7bfba0de5c9 (patch)
tree1eef3e740f58a07f204fdafa3efb48338e953532 /src
parent07ee8c10691d05e4e290ecdaa634ad5311b3cbb1 (diff)
downloadVeraCrypt-b146e235f893b62befc413ff547ee7bfba0de5c9.zip
VeraCrypt-b146e235f893b62befc413ff547ee7bfba0de5c9.tar.gz
Windows: align buffers used for keys to avoid issues when SSE used.
Diffstat (limited to 'src')
-rw-r--r--src/Common/Apidrvr.h56
-rw-r--r--src/Common/Fat.c2
-rw-r--r--src/Common/Format.c4
-rw-r--r--src/ExpandVolume/InitDataArea.c4
-rw-r--r--src/Mount/Mount.c4
5 files changed, 62 insertions, 8 deletions
diff --git a/src/Common/Apidrvr.h b/src/Common/Apidrvr.h
index 9c16b37..36233d7 100644
--- a/src/Common/Apidrvr.h
+++ b/src/Common/Apidrvr.h
@@ -26,23 +26,77 @@
#define TC_IOCTL(CODE) (CTL_CODE (FILE_DEVICE_UNKNOWN, 0x800 + (CODE), METHOD_BUFFERED, FILE_ANY_ACCESS))
+// IOCTL interface to \\device\veracrypt
+
+// Gets version of driver
+// OUT struct - LONG
#define TC_IOCTL_GET_DRIVER_VERSION TC_IOCTL (1)
+
+// Gets boot loader version
+// OUT struct - int16
#define TC_IOCTL_GET_BOOT_LOADER_VERSION TC_IOCTL (2)
+
+// Mount volume to \\Device\VeraCryptVolume"X"
+// IN OUT - MOUNT_STRUCT
#define TC_IOCTL_MOUNT_VOLUME TC_IOCTL (3)
+
+// Dismount volume
+// IN OUT - UNMOUNT_STRUCT
#define TC_IOCTL_DISMOUNT_VOLUME TC_IOCTL (4)
+
+// Dismount all volumes
+// IN OUT - UNMOUNT_STRUCT
#define TC_IOCTL_DISMOUNT_ALL_VOLUMES TC_IOCTL (5)
+
+// Get list of all mounted volumes
+// IN OUT - MOUNT_LIST_STRUCT (only 26 volumes possible)
#define TC_IOCTL_GET_MOUNTED_VOLUMES TC_IOCTL (6)
+
+// Get properties of the volume selected by driveNo
+// In OUT - VOLUME_PROPERTIES_STRUCT
#define TC_IOCTL_GET_VOLUME_PROPERTIES TC_IOCTL (7)
+
+// Get reference count to main device object
+// OUT - int
#define TC_IOCTL_GET_DEVICE_REFCOUNT TC_IOCTL (8)
+
+// Is it possible to unload driver
+// It check file system cache of mounted drives via unmount IOCTL.
+// OUT - int
#define TC_IOCTL_IS_DRIVER_UNLOAD_DISABLED TC_IOCTL (9)
+
+// Is there any mounted device
+// OUT - int
#define TC_IOCTL_IS_ANY_VOLUME_MOUNTED TC_IOCTL (10)
+
+// Check password cache
+// Result in IOCTL result TRUE if there is chached passwords
#define TC_IOCTL_GET_PASSWORD_CACHE_STATUS TC_IOCTL (11)
+
+// Clean password cache
#define TC_IOCTL_WIPE_PASSWORD_CACHE TC_IOCTL (12)
+
+// Check file/drive container
+// IN OUT - OPEN_TEST_STRUCT
#define TC_IOCTL_OPEN_TEST TC_IOCTL (13)
+
+// result of IOCTL_DISK_GET_PARTITION_INFO
+// IN OUT - DISK_PARTITION_INFO_STRUCT
+// TODO: need IOCTL_DISK_GET_PARTITION_INFO_EX to support GPT
#define TC_IOCTL_GET_DRIVE_PARTITION_INFO TC_IOCTL (14)
+
+// result IOCTL_DISK_GET_DRIVE_GEOMETRY
+// IN OUT - DISK_GEOMETRY_STRUCT
#define TC_IOCTL_GET_DRIVE_GEOMETRY TC_IOCTL (15)
+
+// result IOCTL_DISK_GET_LENGTH_INFO
+// IN OUT - ProbeRealDriveSizeRequest
#define TC_IOCTL_PROBE_REAL_DRIVE_SIZE TC_IOCTL (16)
+
+// result of ZwQuerySymbolicLinkObject
+// IN OUT RESOLVE_SYMLINK_STRUCT
#define TC_IOCTL_GET_RESOLVED_SYMLINK TC_IOCTL (17)
+
#define TC_IOCTL_GET_BOOT_ENCRYPTION_STATUS TC_IOCTL (18)
#define TC_IOCTL_BOOT_ENCRYPTION_SETUP TC_IOCTL (19)
#define TC_IOCTL_ABORT_BOOT_ENCRYPTION_SETUP TC_IOCTL (20)
@@ -287,7 +341,7 @@ typedef struct
typedef struct
{
WipeAlgorithmId WipeAlgorithm;
- byte WipeKey[MASTER_KEYDATA_SIZE];
+ CRYPTOPP_ALIGN_DATA(16) byte WipeKey[MASTER_KEYDATA_SIZE];
} WipeDecoySystemRequest;
typedef struct
diff --git a/src/Common/Fat.c b/src/Common/Fat.c
index fb7dc1f..7625e86 100644
--- a/src/Common/Fat.c
+++ b/src/Common/Fat.c
@@ -262,7 +262,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
unsigned __int64 nSecNo = startSector;
int x, n;
int retVal;
- char temporaryKey[MASTER_KEYDATA_SIZE];
+ CRYPTOPP_ALIGN_DATA(16) char temporaryKey[MASTER_KEYDATA_SIZE];
HWND hwndDlg = (HWND) hwndDlgPtr;
LARGE_INTEGER startOffset;
diff --git a/src/Common/Format.c b/src/Common/Format.c
index 7d6f3ed..ead6546 100644
--- a/src/Common/Format.c
+++ b/src/Common/Format.c
@@ -753,8 +753,8 @@ int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, __int64 num_sectors,
unsigned __int64 nSecNo = startSector;
int retVal = 0;
DWORD err;
- char temporaryKey[MASTER_KEYDATA_SIZE];
- char originalK2[MASTER_KEYDATA_SIZE];
+ CRYPTOPP_ALIGN_DATA(16) char temporaryKey[MASTER_KEYDATA_SIZE];
+ CRYPTOPP_ALIGN_DATA(16) char originalK2[MASTER_KEYDATA_SIZE];
LARGE_INTEGER startOffset;
LARGE_INTEGER newOffset;
diff --git a/src/ExpandVolume/InitDataArea.c b/src/ExpandVolume/InitDataArea.c
index 3e2bf49..a687f3e 100644
--- a/src/ExpandVolume/InitDataArea.c
+++ b/src/ExpandVolume/InitDataArea.c
@@ -51,8 +51,8 @@ int FormatNoFs (HWND hwndDlg, unsigned __int64 startSector, __int64 num_sectors,
unsigned __int64 nSecNo = startSector;
int retVal = 0;
DWORD err;
- char temporaryKey[MASTER_KEYDATA_SIZE];
- char originalK2[MASTER_KEYDATA_SIZE];
+ CRYPTOPP_ALIGN_DATA(16) char temporaryKey[MASTER_KEYDATA_SIZE];
+ CRYPTOPP_ALIGN_DATA(16) char originalK2[MASTER_KEYDATA_SIZE];
LARGE_INTEGER startOffset;
LARGE_INTEGER newOffset;
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index a7e6da5..14b7eb5 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -9727,8 +9727,8 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const wchar_t *
OpenVolumeContext hiddenVolume;
Password hiddenVolPassword;
int hiddenVolPkcs5 = 0, hiddenVolPim = 0;
- byte temporaryKey[MASTER_KEYDATA_SIZE];
- byte originalK2[MASTER_KEYDATA_SIZE];
+ CRYPTOPP_ALIGN_DATA(16) byte temporaryKey[MASTER_KEYDATA_SIZE];
+ CRYPTOPP_ALIGN_DATA(16) byte originalK2[MASTER_KEYDATA_SIZE];
int EffectiveVolumePkcs5 = CmdVolumePkcs5;
int EffectiveVolumePim = CmdVolumePim;