mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Windows Driver: Add registry settings to control driver internal encryption queue Under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\veracrypt: - VeraCryptEncryptionFragmentSize (REG_DWORD): size of encryption data fragment in KiB. Default is 256. - VeraCryptEncryptionIoRequestCount (REG_DWORD): maximum number of parallel I/O requests. Default is 16. - VeraCryptEncryptionItemCount (REG_DWORD): maximum number of encryption queue items processed in parallel. Default is 8.
This commit is contained in:
@@ -148,6 +148,9 @@ static KeAreAllApcsDisabledFn KeAreAllApcsDisabledPtr = NULL;
|
||||
static KeSetSystemGroupAffinityThreadFn KeSetSystemGroupAffinityThreadPtr = NULL;
|
||||
static KeQueryActiveGroupCountFn KeQueryActiveGroupCountPtr = NULL;
|
||||
static KeQueryActiveProcessorCountExFn KeQueryActiveProcessorCountExPtr = NULL;
|
||||
int EncryptionIoRequestCount = 0;
|
||||
int EncryptionItemCount = 0;
|
||||
int EncryptionFragmentSize = 0;
|
||||
|
||||
POOL_TYPE ExDefaultNonPagedPoolType = NonPagedPool;
|
||||
ULONG ExDefaultMdlProtection = 0;
|
||||
@@ -4795,6 +4798,50 @@ NTSTATUS ReadRegistryConfigFlags (BOOL driverEntry)
|
||||
TCfree (data);
|
||||
}
|
||||
|
||||
if (driverEntry && NT_SUCCESS (TCReadRegistryKey (&name, VC_ENCRYPTION_IO_REQUEST_COUNT, &data)))
|
||||
{
|
||||
if (data->Type == REG_DWORD)
|
||||
EncryptionIoRequestCount = *(uint32 *) data->Data;
|
||||
|
||||
TCfree (data);
|
||||
}
|
||||
|
||||
if (driverEntry && NT_SUCCESS (TCReadRegistryKey (&name, VC_ENCRYPTION_ITEM_COUNT, &data)))
|
||||
{
|
||||
if (data->Type == REG_DWORD)
|
||||
EncryptionItemCount = *(uint32 *) data->Data;
|
||||
|
||||
TCfree (data);
|
||||
}
|
||||
|
||||
if (driverEntry && NT_SUCCESS (TCReadRegistryKey (&name, VC_ENCRYPTION_FRAGMENT_SIZE, &data)))
|
||||
{
|
||||
if (data->Type == REG_DWORD)
|
||||
EncryptionFragmentSize = *(uint32 *) data->Data;
|
||||
|
||||
TCfree (data);
|
||||
}
|
||||
|
||||
if (driverEntry)
|
||||
{
|
||||
if (EncryptionIoRequestCount < TC_ENC_IO_QUEUE_PREALLOCATED_IO_REQUEST_COUNT)
|
||||
EncryptionIoRequestCount = TC_ENC_IO_QUEUE_PREALLOCATED_IO_REQUEST_COUNT;
|
||||
|
||||
if (EncryptionItemCount == 0)
|
||||
EncryptionItemCount = EncryptionIoRequestCount / 2;
|
||||
else if (EncryptionItemCount >= EncryptionIoRequestCount)
|
||||
EncryptionItemCount = EncryptionIoRequestCount - 1;
|
||||
|
||||
/* EncryptionFragmentSize value in registry is expressed in KiB */
|
||||
if (EncryptionFragmentSize == 0)
|
||||
EncryptionFragmentSize = TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE / 1024;
|
||||
else if (EncryptionFragmentSize > (8 * TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE / 1024))
|
||||
EncryptionFragmentSize = 8 * TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE / 1024;
|
||||
|
||||
EncryptionFragmentSize = EncryptionFragmentSize * 1024;
|
||||
}
|
||||
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user