mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-12 03:18:26 -06:00
Windows: Implement PIM caching, both for system encryption and for normal volumes. Add options to activate it in the Preferences and System Settings.
This commit is contained in:
@@ -125,7 +125,10 @@ NTSTATUS LoadBootArguments ()
|
||||
Dump ("BootArgumentsCrc32 = %x\n", BootArgs.BootArgumentsCrc32);
|
||||
|
||||
if (CacheBootPassword && BootArgs.BootPassword.Length > 0)
|
||||
AddPasswordToCache (&BootArgs.BootPassword);
|
||||
{
|
||||
int pim = CacheBootPim? (int) (BootArgs.Flags >> 16) : 0;
|
||||
AddPasswordToCache (&BootArgs.BootPassword, pim);
|
||||
}
|
||||
|
||||
// clear fingerprint
|
||||
burn (BootLoaderFingerprint, sizeof (BootLoaderFingerprint));
|
||||
|
||||
@@ -54,6 +54,7 @@ BOOL DriverUnloadDisabled = FALSE;
|
||||
BOOL PortableMode = FALSE;
|
||||
BOOL VolumeClassFilterRegistered = FALSE;
|
||||
BOOL CacheBootPassword = FALSE;
|
||||
BOOL CacheBootPim = FALSE;
|
||||
BOOL NonAdminSystemFavoritesAccessDisabled = FALSE;
|
||||
static size_t EncryptionThreadPoolFreeCpuCountLimit = 0;
|
||||
static BOOL SystemFavoriteVolumeDirty = FALSE;
|
||||
@@ -1444,7 +1445,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
|
||||
|
||||
if (mount->VolumePassword.Length > MAX_PASSWORD || mount->ProtectedHidVolPassword.Length > MAX_PASSWORD
|
||||
|| mount->pkcs5_prf < 0 || mount->pkcs5_prf > LAST_PRF_ID
|
||||
|| mount->VolumePim < 0 || mount->VolumePim == INT_MAX
|
||||
|| mount->VolumePim < -1 || mount->VolumePim == INT_MAX
|
||||
|| mount->ProtectedHidVolPkcs5Prf < 0 || mount->ProtectedHidVolPkcs5Prf > LAST_PRF_ID
|
||||
|| (mount->bTrueCryptMode != FALSE && mount->bTrueCryptMode != TRUE)
|
||||
)
|
||||
@@ -3293,6 +3294,9 @@ NTSTATUS ReadRegistryConfigFlags (BOOL driverEntry)
|
||||
|
||||
if (flags & TC_DRIVER_CONFIG_DISABLE_NONADMIN_SYS_FAVORITES_ACCESS)
|
||||
NonAdminSystemFavoritesAccessDisabled = TRUE;
|
||||
|
||||
if (flags & TC_DRIVER_CONFIG_CACHE_BOOT_PIM)
|
||||
CacheBootPim = TRUE;
|
||||
}
|
||||
|
||||
EnableHwEncryption ((flags & TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION) ? FALSE : TRUE);
|
||||
|
||||
@@ -114,6 +114,7 @@ extern ULONG OsMajorVersion;
|
||||
extern ULONG OsMinorVersion;
|
||||
extern BOOL VolumeClassFilterRegistered;
|
||||
extern BOOL CacheBootPassword;
|
||||
extern BOOL CacheBootPim;
|
||||
|
||||
/* Helper macro returning x seconds in units of 100 nanoseconds */
|
||||
#define WAIT_SECONDS(x) ((x)*10000000)
|
||||
|
||||
@@ -466,6 +466,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
|
||||
mount->nReturnCode = ReadVolumeHeaderWCache (
|
||||
FALSE,
|
||||
mount->bCache,
|
||||
mount->bCachePim,
|
||||
readBuffer,
|
||||
&mount->ProtectedHidVolPassword,
|
||||
mount->ProtectedHidVolPkcs5Prf,
|
||||
@@ -478,6 +479,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
|
||||
mount->nReturnCode = ReadVolumeHeaderWCache (
|
||||
mount->bPartitionInInactiveSysEncScope && volumeType == TC_VOLUME_TYPE_NORMAL,
|
||||
mount->bCache,
|
||||
mount->bCachePim,
|
||||
readBuffer,
|
||||
&mount->VolumePassword,
|
||||
mount->pkcs5_prf,
|
||||
|
||||
Reference in New Issue
Block a user