VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Driver
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-04-14 08:52:06 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-04-14 08:53:41 +0200
commitf5606a44a6331715e9a8a43d6f4441f0cd89cb3a (patch)
tree364f47eba30fb566c62c1047bff9592dc347b8ac /src/Driver
parent60575d9a496bd4b796bab73888b69c249a1f8048 (diff)
downloadVeraCrypt-f5606a44a6331715e9a8a43d6f4441f0cd89cb3a.tar.gz
VeraCrypt-f5606a44a6331715e9a8a43d6f4441f0cd89cb3a.zip
Windows: Finalize implementation of the new volume ID mechanism. Use SHA-256 instead of SHA-512 to compute volume ID to reduce string size and make more convenient to use.
Diffstat (limited to 'src/Driver')
-rw-r--r--src/Driver/Ntdriver.c14
-rw-r--r--src/Driver/Ntdriver.h2
-rw-r--r--src/Driver/Ntvol.c2
3 files changed, 9 insertions, 9 deletions
diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c
index cd3309d2..eeea7815 100644
--- a/src/Driver/Ntdriver.c
+++ b/src/Driver/Ntdriver.c
@@ -1049,7 +1049,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
if (opentest->bMatchVolumeID)
{
int volumeType;
- BYTE volumeID[SHA512_DIGEST_SIZE];
+ BYTE volumeID[VOLUME_ID_SIZE];
// Go through all volume types (e.g., normal, hidden)
for (volumeType = TC_VOLUME_TYPE_NORMAL;
@@ -1069,7 +1069,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
break;
}
- ntStatus = ZwReadFile (Extension->hDeviceFile,
+ ntStatus = ZwReadFile (NtFileHandle,
NULL,
NULL,
NULL,
@@ -1081,10 +1081,10 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
if (NT_SUCCESS (ntStatus))
{
- /* compute the ID of this volume: SHA-512 of the effective header */
- sha512 (volumeID, readBuffer, TC_VOLUME_HEADER_EFFECTIVE_SIZE);
+ /* compute the ID of this volume: SHA-256 of the effective header */
+ sha256 (volumeID, readBuffer, TC_VOLUME_HEADER_EFFECTIVE_SIZE);
- if (0 == memcmp (volumeID, opentest->volumeID, SHA512_DIGEST_SIZE))
+ if (0 == memcmp (volumeID, opentest->volumeID, VOLUME_ID_SIZE))
{
opentest->VolumeIDMatched = TRUE;
break;
@@ -1265,7 +1265,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
list->ulMountedDrives |= (1 << ListExtension->nDosDriveNo);
RtlStringCbCopyW (list->wszVolume[ListExtension->nDosDriveNo], sizeof(list->wszVolume[ListExtension->nDosDriveNo]),ListExtension->wszVolume);
RtlStringCbCopyW (list->wszLabel[ListExtension->nDosDriveNo], sizeof(list->wszLabel[ListExtension->nDosDriveNo]),ListExtension->wszLabel);
- memcpy (list->volumeID[ListExtension->nDosDriveNo], ListExtension->volumeID, SHA512_DIGEST_SIZE);
+ memcpy (list->volumeID[ListExtension->nDosDriveNo], ListExtension->volumeID, VOLUME_ID_SIZE);
list->diskLength[ListExtension->nDosDriveNo] = ListExtension->DiskLength;
list->ea[ListExtension->nDosDriveNo] = ListExtension->cryptoInfo->ea;
if (ListExtension->cryptoInfo->hiddenVolume)
@@ -1317,7 +1317,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
prop->uniqueId = ListExtension->UniqueVolumeId;
RtlStringCbCopyW (prop->wszVolume, sizeof(prop->wszVolume),ListExtension->wszVolume);
RtlStringCbCopyW (prop->wszLabel, sizeof(prop->wszLabel),ListExtension->wszLabel);
- memcpy (prop->volumeID, ListExtension->volumeID, SHA512_DIGEST_SIZE);
+ memcpy (prop->volumeID, ListExtension->volumeID, VOLUME_ID_SIZE);
prop->bDriverSetLabel = ListExtension->bDriverSetLabel;
prop->diskLength = ListExtension->DiskLength;
prop->ea = ListExtension->cryptoInfo->ea;
diff --git a/src/Driver/Ntdriver.h b/src/Driver/Ntdriver.h
index ae91f3af..59634760 100644
--- a/src/Driver/Ntdriver.h
+++ b/src/Driver/Ntdriver.h
@@ -81,7 +81,7 @@ typedef struct EXTENSION
BOOL bIsNTFS;
BOOL bDriverSetLabel;
- unsigned char volumeID[SHA512_DIGESTSIZE];
+ unsigned char volumeID[VOLUME_ID_SIZE];
LARGE_INTEGER fileCreationTime;
LARGE_INTEGER fileLastAccessTime;
diff --git a/src/Driver/Ntvol.c b/src/Driver/Ntvol.c
index 317e3653..4f35323b 100644
--- a/src/Driver/Ntvol.c
+++ b/src/Driver/Ntvol.c
@@ -518,7 +518,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
Extension->cryptoInfo->bPartitionInInactiveSysEncScope = mount->bPartitionInInactiveSysEncScope;
/* compute the ID of this volume: SHA-512 of the effective header */
- sha512 (Extension->volumeID, readBuffer, TC_VOLUME_HEADER_EFFECTIVE_SIZE);
+ sha256 (Extension->volumeID, readBuffer, TC_VOLUME_HEADER_EFFECTIVE_SIZE);
if (volumeType == TC_VOLUME_TYPE_NORMAL)
{