diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2016-06-17 23:50:44 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2016-06-17 23:52:03 +0200 |
commit | 2faa1290c0634392dfdace39921b10fb47a47b68 (patch) | |
tree | 36543190afa17a391715ab579717199b7f2ab7f9 /src/Driver | |
parent | bdc5782f16651bca9f6c885f57a00a63ac9adb2c (diff) | |
download | VeraCrypt-2faa1290c0634392dfdace39921b10fb47a47b68.tar.gz VeraCrypt-2faa1290c0634392dfdace39921b10fb47a47b68.zip |
Windows Driver: save FPU state in 32-bit mode before run Whirlpool SSE implementation to avoid issues (https://msdn.microsoft.com/fr-fr/library/ff565388(v=vs.85).aspx)
Diffstat (limited to 'src/Driver')
-rw-r--r-- | src/Driver/DriveFilter.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Driver/DriveFilter.c b/src/Driver/DriveFilter.c index 49563592..78cdf254 100644 --- a/src/Driver/DriveFilter.c +++ b/src/Driver/DriveFilter.c @@ -27,6 +27,7 @@ #include "Wipe.h" #include "DriveFilter.h" #include "Boot/Windows/BootCommon.h" +#include "cpu.h" static BOOL DeviceFilterActive = FALSE; @@ -258,6 +259,12 @@ static void ComputeBootLoaderFingerprint(PDEVICE_OBJECT LowerDeviceObject, byte* status = TCReadDevice (LowerDeviceObject, ioBuffer, offset, TC_SECTOR_SIZE_BIOS); if (NT_SUCCESS (status)) { +#if !defined (_WIN64) + KFLOATING_SAVE floatingPointState; + NTSTATUS saveStatus = STATUS_SUCCESS; + if (HasISSE()) + saveStatus = KeSaveFloatingPointState (&floatingPointState); +#endif WHIRLPOOL_add (ioBuffer, TC_BOOT_SECTOR_PIM_VALUE_OFFSET * 8, &whirlpool); WHIRLPOOL_add (ioBuffer + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH, (TC_BOOT_SECTOR_USER_CONFIG_OFFSET - (TC_BOOT_SECTOR_USER_MESSAGE_OFFSET + TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH)) * 8, &whirlpool); WHIRLPOOL_add (ioBuffer + TC_BOOT_SECTOR_USER_CONFIG_OFFSET + 1, (TC_MAX_MBR_BOOT_CODE_SIZE - (TC_BOOT_SECTOR_USER_CONFIG_OFFSET + 1)) * 8, &whirlpool); @@ -293,6 +300,11 @@ static void ComputeBootLoaderFingerprint(PDEVICE_OBJECT LowerDeviceObject, byte* WHIRLPOOL_finalize (&whirlpool, BootLoaderFingerprint); sha512_end (&BootLoaderFingerprint [WHIRLPOOL_DIGESTSIZE], &sha2); } + +#if !defined (_WIN64) + if (NT_SUCCESS (saveStatus) && HasISSE()) + KeRestoreFloatingPointState (&floatingPointState); +#endif } else { |