1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Windows: Fix keyfiles path passed as CLI argument and set as default not always cleared from RAM when VeraCrypt exits

This commit is contained in:
Mounir IDRASSI
2020-03-02 17:44:12 +01:00
parent 68b9c9c72d
commit 6550030540
2 changed files with 9 additions and 4 deletions

View File

@@ -179,7 +179,7 @@ BOOL bInPlaceEncNonSysPending = FALSE; // TRUE if the non-system in-place encry
BOOL PimEnable = FALSE; BOOL PimEnable = FALSE;
BOOL KeyFilesEnable = FALSE; BOOL KeyFilesEnable = FALSE;
KeyFile *FirstKeyFile = NULL; KeyFile *FirstKeyFile = NULL;
KeyFilesDlgParam defaultKeyFilesParam; KeyFilesDlgParam defaultKeyFilesParam = {0};
BOOL IgnoreWmDeviceChange = FALSE; BOOL IgnoreWmDeviceChange = FALSE;
BOOL DeviceChangeBroadcastDisabled = FALSE; BOOL DeviceChangeBroadcastDisabled = FALSE;
@@ -487,6 +487,8 @@ void FinalizeGlobalLocks ()
void cleanup () void cleanup ()
{ {
burn (&CmdTokenPin, sizeof (CmdTokenPin)); burn (&CmdTokenPin, sizeof (CmdTokenPin));
KeyFileRemoveAll (&FirstKeyFile);
KeyFileRemoveAll (&defaultKeyFilesParam.FirstKeyFile);
/* Cleanup the GDI fonts */ /* Cleanup the GDI fonts */
if (hFixedFont != NULL) if (hFixedFont != NULL)

View File

@@ -158,14 +158,14 @@ MountOptions CmdMountOptions;
BOOL CmdMountOptionsValid = FALSE; BOOL CmdMountOptionsValid = FALSE;
MountOptions mountOptions; MountOptions mountOptions;
MountOptions defaultMountOptions; MountOptions defaultMountOptions;
KeyFile *FirstCmdKeyFile; KeyFile *FirstCmdKeyFile = NULL;
HBITMAP hbmLogoBitmapRescaled = NULL; HBITMAP hbmLogoBitmapRescaled = NULL;
wchar_t OrigKeyboardLayout [8+1] = L"00000409"; wchar_t OrigKeyboardLayout [8+1] = L"00000409";
BOOL bKeyboardLayoutChanged = FALSE; /* TRUE if the keyboard layout was changed to the standard US keyboard layout (from any other layout). */ BOOL bKeyboardLayoutChanged = FALSE; /* TRUE if the keyboard layout was changed to the standard US keyboard layout (from any other layout). */
BOOL bKeybLayoutAltKeyWarningShown = FALSE; /* TRUE if the user has been informed that it is not possible to type characters by pressing keys while the right Alt key is held down. */ BOOL bKeybLayoutAltKeyWarningShown = FALSE; /* TRUE if the user has been informed that it is not possible to type characters by pressing keys while the right Alt key is held down. */
static KeyFilesDlgParam hidVolProtKeyFilesParam; static KeyFilesDlgParam hidVolProtKeyFilesParam = {0};
static MOUNT_LIST_STRUCT LastKnownMountList = {0}; static MOUNT_LIST_STRUCT LastKnownMountList = {0};
VOLUME_NOTIFICATIONS_LIST VolumeNotificationsList; VOLUME_NOTIFICATIONS_LIST VolumeNotificationsList;
@@ -377,6 +377,9 @@ static void localcleanup (void)
burn (&defaultMountOptions, sizeof (defaultMountOptions)); burn (&defaultMountOptions, sizeof (defaultMountOptions));
burn (szFileName, sizeof(szFileName)); burn (szFileName, sizeof(szFileName));
KeyFileRemoveAll (&FirstCmdKeyFile);
KeyFileRemoveAll (&hidVolProtKeyFilesParam.FirstKeyFile);
/* Cleanup common code resources */ /* Cleanup common code resources */
cleanup (); cleanup ();
@@ -7034,7 +7037,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (FirstCmdKeyFile) if (FirstCmdKeyFile)
{ {
KeyFileRemoveAll (&FirstKeyFile); KeyFileRemoveAll (&FirstKeyFile);
FirstKeyFile = FirstCmdKeyFile; KeyFileCloneAll (FirstCmdKeyFile, &FirstKeyFile);
KeyFilesEnable = TRUE; KeyFilesEnable = TRUE;
} }