VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Common/BootEncryption.cpp8
-rw-r--r--src/Common/BootEncryption.h2
-rw-r--r--src/Common/Dlgcode.c19
-rw-r--r--src/Common/Dlgcode.h2
-rw-r--r--src/Common/Password.c8
-rw-r--r--src/Common/Password.h2
-rw-r--r--src/Common/Wipe.c4
-rw-r--r--src/Common/Wipe.h3
-rw-r--r--src/Format/Tcformat.c11
-rw-r--r--src/Mount/MainCom.cpp8
-rw-r--r--src/Mount/MainCom.h2
-rw-r--r--src/Mount/MainCom.idl2
-rw-r--r--src/Mount/Mount.c15
-rw-r--r--src/Mount/Mount.rc10
-rw-r--r--src/Mount/Mount.vcproj4
-rw-r--r--src/Mount/Resource.h2
16 files changed, 67 insertions, 35 deletions
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index 0fec2878..e57a434e 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -2060,7 +2060,7 @@ namespace VeraCrypt
2060 } 2060 }
2061 2061
2062 2062
2063 int BootEncryption::ChangePassword (Password *oldPassword, Password *newPassword, int pkcs5) 2063 int BootEncryption::ChangePassword (Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount)
2064 { 2064 {
2065 BootEncryptionStatus encStatus = GetStatus(); 2065 BootEncryptionStatus encStatus = GetStatus();
2066 2066
@@ -2125,7 +2125,7 @@ namespace VeraCrypt
2125 UserEnrichRandomPool (ParentWindow); 2125 UserEnrichRandomPool (ParentWindow);
2126 WaitCursor(); 2126 WaitCursor();
2127 2127
2128 /* The header will be re-encrypted PRAND_DISK_WIPE_PASSES times to prevent adversaries from using 2128 /* The header will be re-encrypted wipePassCount times to prevent adversaries from using
2129 techniques such as magnetic force microscopy or magnetic force scanning tunnelling microscopy 2129 techniques such as magnetic force microscopy or magnetic force scanning tunnelling microscopy
2130 to recover the overwritten header. According to Peter Gutmann, data should be overwritten 22 2130 to recover the overwritten header. According to Peter Gutmann, data should be overwritten 22
2131 times (ideally, 35 times) using non-random patterns and pseudorandom data. However, as users might 2131 times (ideally, 35 times) using non-random patterns and pseudorandom data. However, as users might
@@ -2145,7 +2145,7 @@ namespace VeraCrypt
2145 BOOL backupHeader = FALSE; 2145 BOOL backupHeader = FALSE;
2146 while (TRUE) 2146 while (TRUE)
2147 { 2147 {
2148 for (int wipePass = 0; wipePass < PRAND_DISK_WIPE_PASSES; wipePass++) 2148 for (int wipePass = 0; wipePass < wipePassCount; wipePass++)
2149 { 2149 {
2150 PCRYPTO_INFO tmpCryptoInfo = NULL; 2150 PCRYPTO_INFO tmpCryptoInfo = NULL;
2151 2151
@@ -2164,7 +2164,7 @@ namespace VeraCrypt
2164 cryptoInfo->RequiredProgramVersion, 2164 cryptoInfo->RequiredProgramVersion,
2165 cryptoInfo->HeaderFlags | TC_HEADER_FLAG_ENCRYPTED_SYSTEM, 2165 cryptoInfo->HeaderFlags | TC_HEADER_FLAG_ENCRYPTED_SYSTEM,
2166 cryptoInfo->SectorSize, 2166 cryptoInfo->SectorSize,
2167 wipePass < PRAND_DISK_WIPE_PASSES - 1); 2167 wipePass < wipePassCount - 1);
2168 2168
2169 if (tmpCryptoInfo) 2169 if (tmpCryptoInfo)
2170 crypto_close (tmpCryptoInfo); 2170 crypto_close (tmpCryptoInfo);
diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h
index 88830988..a52f286b 100644
--- a/src/Common/BootEncryption.h
+++ b/src/Common/BootEncryption.h
@@ -141,7 +141,7 @@ namespace VeraCrypt
141 void AbortSetup (); 141 void AbortSetup ();
142 void AbortSetupWait (); 142 void AbortSetupWait ();
143 void CallDriver (DWORD ioctl, void *input = nullptr, DWORD inputSize = 0, void *output = nullptr, DWORD outputSize = 0); 143 void CallDriver (DWORD ioctl, void *input = nullptr, DWORD inputSize = 0, void *output = nullptr, DWORD outputSize = 0);
144 int ChangePassword (Password *oldPassword, Password *newPassword, int pkcs5); 144 int ChangePassword (Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount);
145 void CheckDecoyOSWipeResult (); 145 void CheckDecoyOSWipeResult ();
146 void CheckEncryptionSetupResult (); 146 void CheckEncryptionSetupResult ();
147 void CheckRequirements (); 147 void CheckRequirements ();
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 092c8c6f..a7c5e788 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -1565,7 +1565,7 @@ SelectAlgo (HWND hComboBox, int *algo_id)
1565 1565
1566} 1566}
1567 1567
1568void PopulateWipeModeCombo (HWND hComboBox, BOOL bNA, BOOL bInPlaceEncryption) 1568void PopulateWipeModeCombo (HWND hComboBox, BOOL bNA, BOOL bInPlaceEncryption, BOOL bHeaderWipe)
1569{ 1569{
1570 if (bNA) 1570 if (bNA)
1571 { 1571 {
@@ -1573,14 +1573,20 @@ void PopulateWipeModeCombo (HWND hComboBox, BOOL bNA, BOOL bInPlaceEncryption)
1573 } 1573 }
1574 else 1574 else
1575 { 1575 {
1576 if (bInPlaceEncryption) 1576 if (!bHeaderWipe)
1577 AddComboPairW (hComboBox, GetString ("WIPE_MODE_NONE"), TC_WIPE_NONE); 1577 {
1578 else 1578 if (bInPlaceEncryption)
1579 AddComboPairW (hComboBox, GetString ("WIPE_MODE_1_RAND"), TC_WIPE_1_RAND); 1579 AddComboPairW (hComboBox, GetString ("WIPE_MODE_NONE"), TC_WIPE_NONE);
1580 else
1581 AddComboPairW (hComboBox, GetString ("WIPE_MODE_1_RAND"), TC_WIPE_1_RAND);
1582 }
1580 1583
1581 AddComboPairW (hComboBox, GetString ("WIPE_MODE_3_DOD_5220"), TC_WIPE_3_DOD_5220); 1584 AddComboPairW (hComboBox, GetString ("WIPE_MODE_3_DOD_5220"), TC_WIPE_3_DOD_5220);
1582 AddComboPairW (hComboBox, GetString ("WIPE_MODE_7_DOD_5220"), TC_WIPE_7_DOD_5220); 1585 AddComboPairW (hComboBox, GetString ("WIPE_MODE_7_DOD_5220"), TC_WIPE_7_DOD_5220);
1583 AddComboPairW (hComboBox, GetString ("WIPE_MODE_35_GUTMANN"), TC_WIPE_35_GUTMANN); 1586 AddComboPairW (hComboBox, GetString ("WIPE_MODE_35_GUTMANN"), TC_WIPE_35_GUTMANN);
1587
1588 if (bHeaderWipe)
1589 AddComboPairW (hComboBox, GetString ("WIPE_MODE_256"), TC_WIPE_256); // paranoid wipe for volume header
1584 } 1590 }
1585} 1591}
1586 1592
@@ -1603,6 +1609,9 @@ wchar_t *GetWipeModeName (WipeAlgorithmId modeId)
1603 case TC_WIPE_35_GUTMANN: 1609 case TC_WIPE_35_GUTMANN:
1604 return GetString ("WIPE_MODE_35_GUTMANN"); 1610 return GetString ("WIPE_MODE_35_GUTMANN");
1605 1611
1612 case TC_WIPE_256:
1613 return GetString ("WIPE_MODE_256");
1614
1606 default: 1615 default:
1607 return GetString ("NOT_APPLICABLE_OR_NOT_AVAILABLE"); 1616 return GetString ("NOT_APPLICABLE_OR_NOT_AVAILABLE");
1608 } 1617 }
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 11686f89..7faf6bc0 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -259,7 +259,7 @@ void HandCursor ();
259void AddComboPair (HWND hComboBox, const char *lpszItem, int value); 259void AddComboPair (HWND hComboBox, const char *lpszItem, int value);
260void AddComboPairW (HWND hComboBox, const wchar_t *lpszItem, int value); 260void AddComboPairW (HWND hComboBox, const wchar_t *lpszItem, int value);
261void SelectAlgo ( HWND hComboBox , int *nCipher ); 261void SelectAlgo ( HWND hComboBox , int *nCipher );
262void PopulateWipeModeCombo (HWND hComboBox, BOOL bNA, BOOL bInPlaceEncryption); 262void PopulateWipeModeCombo (HWND hComboBox, BOOL bNA, BOOL bInPlaceEncryption, BOOL bHeaderWipe);
263wchar_t *GetWipeModeName (WipeAlgorithmId modeId); 263wchar_t *GetWipeModeName (WipeAlgorithmId modeId);
264wchar_t *GetPathType (const char *path, BOOL bUpperCase, BOOL *bIsPartition); 264wchar_t *GetPathType (const char *path, BOOL bUpperCase, BOOL *bIsPartition);
265LRESULT CALLBACK CustomDlgProc ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam ); 265LRESULT CALLBACK CustomDlgProc ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam );
diff --git a/src/Common/Password.c b/src/Common/Password.c
index ca86f9c4..c23bd4fa 100644
--- a/src/Common/Password.c
+++ b/src/Common/Password.c
@@ -119,7 +119,7 @@ BOOL CheckPasswordLength (HWND hwndDlg, HWND hwndItem)
119 return TRUE; 119 return TRUE;
120} 120}
121 121
122int ChangePwd (const char *lpszVolume, Password *oldPassword, Password *newPassword, int pkcs5, HWND hwndDlg) 122int ChangePwd (const char *lpszVolume, Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount, HWND hwndDlg)
123{ 123{
124 int nDosLinkCreated = 1, nStatus = ERR_OS_ERROR; 124 int nDosLinkCreated = 1, nStatus = ERR_OS_ERROR;
125 char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH]; 125 char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
@@ -323,7 +323,7 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, Password *newPassw
323 323
324 while (TRUE) 324 while (TRUE)
325 { 325 {
326 /* The header will be re-encrypted PRAND_DISK_WIPE_PASSES times to prevent adversaries from using 326 /* The header will be re-encrypted wipePassCount times to prevent adversaries from using
327 techniques such as magnetic force microscopy or magnetic force scanning tunnelling microscopy 327 techniques such as magnetic force microscopy or magnetic force scanning tunnelling microscopy
328 to recover the overwritten header. According to Peter Gutmann, data should be overwritten 22 328 to recover the overwritten header. According to Peter Gutmann, data should be overwritten 22
329 times (ideally, 35 times) using non-random patterns and pseudorandom data. However, as users might 329 times (ideally, 35 times) using non-random patterns and pseudorandom data. However, as users might
@@ -335,7 +335,7 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, Password *newPassw
335 of the header to differ substantially and in a random manner from the versions written during the 335 of the header to differ substantially and in a random manner from the versions written during the
336 other passes. */ 336 other passes. */
337 337
338 for (wipePass = 0; wipePass < PRAND_DISK_WIPE_PASSES; wipePass++) 338 for (wipePass = 0; wipePass < wipePassCount; wipePass++)
339 { 339 {
340 // Prepare new volume header 340 // Prepare new volume header
341 nStatus = CreateVolumeHeaderInMemory (FALSE, 341 nStatus = CreateVolumeHeaderInMemory (FALSE,
@@ -353,7 +353,7 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, Password *newPassw
353 cryptoInfo->RequiredProgramVersion, 353 cryptoInfo->RequiredProgramVersion,
354 cryptoInfo->HeaderFlags, 354 cryptoInfo->HeaderFlags,
355 cryptoInfo->SectorSize, 355 cryptoInfo->SectorSize,
356 wipePass < PRAND_DISK_WIPE_PASSES - 1); 356 wipePass < wipePassCount - 1);
357 357
358 if (ci != NULL) 358 if (ci != NULL)
359 crypto_close (ci); 359 crypto_close (ci);
diff --git a/src/Common/Password.h b/src/Common/Password.h
index d4f1f928..887c6160 100644
--- a/src/Common/Password.h
+++ b/src/Common/Password.h
@@ -35,7 +35,7 @@ typedef struct
35void VerifyPasswordAndUpdate ( HWND hwndDlg , HWND hButton , HWND hPassword , HWND hVerify , unsigned char *szPassword , char *szVerify, BOOL keyFilesEnabled ); 35void VerifyPasswordAndUpdate ( HWND hwndDlg , HWND hButton , HWND hPassword , HWND hVerify , unsigned char *szPassword , char *szVerify, BOOL keyFilesEnabled );
36BOOL CheckPasswordLength (HWND hwndDlg, HWND hwndItem); 36BOOL CheckPasswordLength (HWND hwndDlg, HWND hwndItem);
37BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw); 37BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw);
38int ChangePwd (const char *lpszVolume, Password *oldPassword, Password *newPassword, int pkcs5, HWND hwndDlg); 38int ChangePwd (const char *lpszVolume, Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount, HWND hwndDlg);
39 39
40#endif // defined(_WIN32) && !defined(TC_WINDOWS_DRIVER) 40#endif // defined(_WIN32) && !defined(TC_WINDOWS_DRIVER)
41 41
diff --git a/src/Common/Wipe.c b/src/Common/Wipe.c
index 265ac217..f06862e2 100644
--- a/src/Common/Wipe.c
+++ b/src/Common/Wipe.c
@@ -155,6 +155,9 @@ int GetWipePassCount (WipeAlgorithmId algorithm)
155 case TC_WIPE_35_GUTMANN: 155 case TC_WIPE_35_GUTMANN:
156 return 35; 156 return 35;
157 157
158 case TC_WIPE_256:
159 return 256;
160
158 default: 161 default:
159 TC_THROW_FATAL_EXCEPTION; 162 TC_THROW_FATAL_EXCEPTION;
160 } 163 }
@@ -168,6 +171,7 @@ BOOL WipeBuffer (WipeAlgorithmId algorithm, byte randChars[TC_WIPE_RAND_CHAR_COU
168 switch (algorithm) 171 switch (algorithm)
169 { 172 {
170 case TC_WIPE_1_RAND: 173 case TC_WIPE_1_RAND:
174 case TC_WIPE_256:
171 return Wipe1PseudoRandom (pass, buffer, size); 175 return Wipe1PseudoRandom (pass, buffer, size);
172 176
173 case TC_WIPE_3_DOD_5220: 177 case TC_WIPE_3_DOD_5220:
diff --git a/src/Common/Wipe.h b/src/Common/Wipe.h
index dd331c9d..a30a9139 100644
--- a/src/Common/Wipe.h
+++ b/src/Common/Wipe.h
@@ -24,7 +24,8 @@ typedef enum
24 TC_WIPE_1_RAND = 100, 24 TC_WIPE_1_RAND = 100,
25 TC_WIPE_3_DOD_5220 = 300, 25 TC_WIPE_3_DOD_5220 = 300,
26 TC_WIPE_7_DOD_5220 = 700, 26 TC_WIPE_7_DOD_5220 = 700,
27 TC_WIPE_35_GUTMANN = 3500 27 TC_WIPE_35_GUTMANN = 3500,
28 TC_WIPE_256 = 25600
28 29
29} WipeAlgorithmId; 30} WipeAlgorithmId;
30 31
diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c
index d0b247fa..3fd9ea31 100644
--- a/src/Format/Tcformat.c
+++ b/src/Format/Tcformat.c
@@ -4102,7 +4102,8 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
4102 4102
4103 PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), 4103 PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE),
4104 SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING && !bInPlaceEncNonSys, 4104 SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING && !bInPlaceEncNonSys,
4105 TRUE); 4105 TRUE,
4106 FALSE);
4106 4107
4107 SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode); 4108 SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode);
4108 4109
@@ -4212,13 +4213,13 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
4212 nWipeMode = TC_WIPE_NONE; 4213 nWipeMode = TC_WIPE_NONE;
4213 EnableWindow (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE); 4214 EnableWindow (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE);
4214 EnableWindow (GetDlgItem (hwndDlg, IDT_WIPE_MODE), FALSE); 4215 EnableWindow (GetDlgItem (hwndDlg, IDT_WIPE_MODE), FALSE);
4215 PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), TRUE, TRUE); 4216 PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), TRUE, TRUE, FALSE);
4216 SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode); 4217 SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode);
4217 } 4218 }
4218 else 4219 else
4219 { 4220 {
4220 EnableWindow (GetDlgItem (hwndDlg, IDC_WIPE_MODE), !bSystemEncryptionInProgress); 4221 EnableWindow (GetDlgItem (hwndDlg, IDC_WIPE_MODE), !bSystemEncryptionInProgress);
4221 PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE, TRUE); 4222 PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE, TRUE, FALSE);
4222 SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode); 4223 SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode);
4223 } 4224 }
4224 4225
@@ -4283,7 +4284,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
4283 ShowWindow (GetDlgItem (hwndDlg, IDC_MORE_INFO_SYS_ENCRYPTION), SW_HIDE); 4284 ShowWindow (GetDlgItem (hwndDlg, IDC_MORE_INFO_SYS_ENCRYPTION), SW_HIDE);
4284 4285
4285 EnableWindow (GetDlgItem (hwndDlg, IDC_WIPE_MODE), TRUE); 4286 EnableWindow (GetDlgItem (hwndDlg, IDC_WIPE_MODE), TRUE);
4286 PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE, TRUE); 4287 PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE, TRUE, FALSE);
4287 SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode); 4288 SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode);
4288 4289
4289 break; 4290 break;
@@ -4584,7 +4585,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
4584 SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("WIPE_MODE_TITLE")); 4585 SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("WIPE_MODE_TITLE"));
4585 SetWindowTextW (GetDlgItem (hwndDlg, IDT_WIPE_MODE_INFO), GetString ("WIPE_MODE_INFO")); 4586 SetWindowTextW (GetDlgItem (hwndDlg, IDT_WIPE_MODE_INFO), GetString ("WIPE_MODE_INFO"));
4586 4587
4587 PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE, FALSE); 4588 PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE, FALSE, FALSE);
4588 4589
4589 SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode); 4590 SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &nWipeMode);
4590 4591
diff --git a/src/Mount/MainCom.cpp b/src/Mount/MainCom.cpp
index 537a187f..829cd21f 100644
--- a/src/Mount/MainCom.cpp
+++ b/src/Mount/MainCom.cpp
@@ -100,13 +100,13 @@ public:
100 return BaseCom::CallDriver (ioctl, input, output); 100 return BaseCom::CallDriver (ioctl, input, output);
101 } 101 }
102 102
103 virtual int STDMETHODCALLTYPE ChangePassword (BSTR volumePath, Password *oldPassword, Password *newPassword, int pkcs5, LONG_PTR hWnd) 103 virtual int STDMETHODCALLTYPE ChangePassword (BSTR volumePath, Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount, LONG_PTR hWnd)
104 { 104 {
105 USES_CONVERSION; 105 USES_CONVERSION;
106 CW2A volumePathA(volumePath); 106 CW2A volumePathA(volumePath);
107 MainDlg = (HWND) hWnd; 107 MainDlg = (HWND) hWnd;
108 if (volumePathA.m_psz) 108 if (volumePathA.m_psz)
109 return ::ChangePwd (volumePathA.m_psz, oldPassword, newPassword, pkcs5, (HWND) hWnd); 109 return ::ChangePwd (volumePathA.m_psz, oldPassword, newPassword, pkcs5, wipePassCount,(HWND) hWnd);
110 else 110 else
111 return ERR_OUTOFMEMORY; 111 return ERR_OUTOFMEMORY;
112 } 112 }
@@ -261,7 +261,7 @@ extern "C" int UacRestoreVolumeHeader (HWND hwndDlg, char *lpszVolume)
261} 261}
262 262
263 263
264extern "C" int UacChangePwd (char *lpszVolume, Password *oldPassword, Password *newPassword, int pkcs5, HWND hwndDlg) 264extern "C" int UacChangePwd (char *lpszVolume, Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount, HWND hwndDlg)
265{ 265{
266 CComPtr<ITrueCryptMainCom> tc; 266 CComPtr<ITrueCryptMainCom> tc;
267 int r; 267 int r;
@@ -269,7 +269,7 @@ extern "C" int UacChangePwd (char *lpszVolume, Password *oldPassword, Password *
269 if (ComGetInstance (hwndDlg, &tc)) 269 if (ComGetInstance (hwndDlg, &tc))
270 { 270 {
271 WaitCursor (); 271 WaitCursor ();
272 r = tc->ChangePassword (CComBSTR (lpszVolume), oldPassword, newPassword, pkcs5, (LONG_PTR) hwndDlg); 272 r = tc->ChangePassword (CComBSTR (lpszVolume), oldPassword, newPassword, pkcs5, wipePassCount, (LONG_PTR) hwndDlg);
273 NormalCursor (); 273 NormalCursor ();
274 } 274 }
275 else 275 else
diff --git a/src/Mount/MainCom.h b/src/Mount/MainCom.h
index 44d9db45..a22eb345 100644
--- a/src/Mount/MainCom.h
+++ b/src/Mount/MainCom.h
@@ -23,7 +23,7 @@ BOOL ComServerMain ();
23void UacAnalyzeKernelMiniDump (HWND hwndDlg); 23void UacAnalyzeKernelMiniDump (HWND hwndDlg);
24int UacBackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, char *lpszVolume); 24int UacBackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, char *lpszVolume);
25int UacRestoreVolumeHeader (HWND hwndDlg, char *lpszVolume); 25int UacRestoreVolumeHeader (HWND hwndDlg, char *lpszVolume);
26int UacChangePwd (char *lpszVolume, Password *oldPassword, Password *newPassword, int pkcs5, HWND hwndDlg); 26int UacChangePwd (char *lpszVolume, Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount, HWND hwndDlg);
27 27
28#ifdef __cplusplus 28#ifdef __cplusplus
29} 29}
diff --git a/src/Mount/MainCom.idl b/src/Mount/MainCom.idl
index 8999d4ec..8550fe8f 100644
--- a/src/Mount/MainCom.idl
+++ b/src/Mount/MainCom.idl
@@ -27,7 +27,7 @@ library TrueCryptMainCom
27 void AnalyzeKernelMiniDump (LONG_PTR hwndDlg); 27 void AnalyzeKernelMiniDump (LONG_PTR hwndDlg);
28 int BackupVolumeHeader (LONG_PTR hwndDlg, BOOL bRequireConfirmation, BSTR lpszVolume); 28 int BackupVolumeHeader (LONG_PTR hwndDlg, BOOL bRequireConfirmation, BSTR lpszVolume);
29 DWORD CallDriver (DWORD ioctl, BSTR input, BSTR *output); 29 DWORD CallDriver (DWORD ioctl, BSTR input, BSTR *output);
30 int ChangePassword (BSTR volumePath, Password *oldPassword, Password *newPassword, int pkcs5, LONG_PTR hWnd); 30 int ChangePassword (BSTR volumePath, Password *oldPassword, Password *newPassword, int pkcs5, int wipePassCount, LONG_PTR hWnd);
31 DWORD CopyFile (BSTR sourceFile, BSTR destinationFile); 31 DWORD CopyFile (BSTR sourceFile, BSTR destinationFile);
32 DWORD DeleteFile (BSTR file); 32 DWORD DeleteFile (BSTR file);
33 BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly); 33 BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly);
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 380cd04a..6b11c178 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -1396,6 +1396,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
1396 LPARAM nIndex; 1396 LPARAM nIndex;
1397 HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID); 1397 HWND hComboBox = GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID);
1398 int i; 1398 int i;
1399 WipeAlgorithmId headerWipeMode = TC_WIPE_3_DOD_5220;
1399 1400
1400 ZeroMemory (&newKeyFilesParam, sizeof (newKeyFilesParam)); 1401 ZeroMemory (&newKeyFilesParam, sizeof (newKeyFilesParam));
1401 1402
@@ -1427,6 +1428,9 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
1427 1428
1428 SendMessage (hComboBox, CB_SETCURSEL, 0, 0); 1429 SendMessage (hComboBox, CB_SETCURSEL, 0, 0);
1429 1430
1431 PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), FALSE, FALSE, TRUE);
1432 SelectAlgo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), (int *) &headerWipeMode);
1433
1430 switch (pwdChangeDlgMode) 1434 switch (pwdChangeDlgMode)
1431 { 1435 {
1432 case PCDM_CHANGE_PKCS5_PRF: 1436 case PCDM_CHANGE_PKCS5_PRF:
@@ -1751,6 +1755,11 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
1751 HWND hParent = GetParent (hwndDlg); 1755 HWND hParent = GetParent (hwndDlg);
1752 Password oldPassword; 1756 Password oldPassword;
1753 Password newPassword; 1757 Password newPassword;
1758 WipeAlgorithmId headerWiperMode = (WipeAlgorithmId) SendMessage (
1759 GetDlgItem (hwndDlg, IDC_WIPE_MODE),
1760 CB_GETITEMDATA,
1761 SendMessage (GetDlgItem (hwndDlg, IDC_WIPE_MODE), CB_GETCURSEL, 0, 0),
1762 0);
1754 int nStatus; 1763 int nStatus;
1755 int pkcs5 = SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, 1764 int pkcs5 = SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA,
1756 SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0); 1765 SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0);
@@ -1813,7 +1822,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
1813 1822
1814 try 1823 try
1815 { 1824 {
1816 nStatus = BootEncObj->ChangePassword (&oldPassword, &newPassword, pkcs5); 1825 nStatus = BootEncObj->ChangePassword (&oldPassword, &newPassword, pkcs5, GetWipePassCount(headerWiperMode));
1817 } 1826 }
1818 catch (Exception &e) 1827 catch (Exception &e)
1819 { 1828 {
@@ -1825,14 +1834,14 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
1825 { 1834 {
1826 // Non-system 1835 // Non-system
1827 1836
1828 nStatus = ChangePwd (szFileName, &oldPassword, &newPassword, pkcs5, hwndDlg); 1837 nStatus = ChangePwd (szFileName, &oldPassword, &newPassword, pkcs5, GetWipePassCount(headerWiperMode), hwndDlg);
1829 1838
1830 if (nStatus == ERR_OS_ERROR 1839 if (nStatus == ERR_OS_ERROR
1831 && GetLastError () == ERROR_ACCESS_DENIED 1840 && GetLastError () == ERROR_ACCESS_DENIED
1832 && IsUacSupported () 1841 && IsUacSupported ()
1833 && IsVolumeDeviceHosted (szFileName)) 1842 && IsVolumeDeviceHosted (szFileName))
1834 { 1843 {
1835 nStatus = UacChangePwd (szFileName, &oldPassword, &newPassword, pkcs5, hwndDlg); 1844 nStatus = UacChangePwd (szFileName, &oldPassword, &newPassword, pkcs5, GetWipePassCount(headerWiperMode), hwndDlg);
1836 } 1845 }
1837 } 1846 }
1838 1847
diff --git a/src/Mount/Mount.rc b/src/Mount/Mount.rc
index 05dc0f23..fcae0c36 100644
--- a/src/Mount/Mount.rc
+++ b/src/Mount/Mount.rc
@@ -101,7 +101,7 @@ BEGIN
101 CONTROL "",IDC_VOLUME_PROPERTIES_LIST,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,6,269,154 101 CONTROL "",IDC_VOLUME_PROPERTIES_LIST,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,6,269,154
102END 102END
103 103
104IDD_PASSWORDCHANGE_DLG DIALOGEX 0, 0, 316, 162 104IDD_PASSWORDCHANGE_DLG DIALOGEX 0, 0, 316, 183
105STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU 105STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
106CAPTION "Change Password or Keyfiles" 106CAPTION "Change Password or Keyfiles"
107CLASS "CustomDlg" 107CLASS "CustomDlg"
@@ -124,7 +124,9 @@ BEGIN
124 RTEXT "Confirm Password:",IDT_CONFIRM_PASSWORD,9,93,75,16 124 RTEXT "Confirm Password:",IDT_CONFIRM_PASSWORD,9,93,75,16
125 RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,9,137,74,10,SS_CENTERIMAGE 125 RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,9,137,74,10,SS_CENTERIMAGE
126 GROUPBOX "Current",IDT_CURRENT,6,3,238,58 126 GROUPBOX "Current",IDT_CURRENT,6,3,238,58
127 GROUPBOX "New",IDT_NEW,6,63,238,93 127 GROUPBOX "New",IDT_NEW,6,63,238,113
128 COMBOBOX IDC_WIPE_MODE,89,155,125,90,CBS_DROPDOWNLIST | WS_TABSTOP
129 RTEXT "Wipe mode:",IDT_WIPE_MODE,9,157,74,8,0,WS_EX_RIGHT
128END 130END
129 131
130IDD_MOUNT_DLG DIALOGEX 0, 0, 375, 271 132IDD_MOUNT_DLG DIALOGEX 0, 0, 375, 271
@@ -351,7 +353,7 @@ BEGIN
351 LEFTMARGIN, 7 353 LEFTMARGIN, 7
352 RIGHTMARGIN, 309 354 RIGHTMARGIN, 309
353 TOPMARGIN, 7 355 TOPMARGIN, 7
354 BOTTOMMARGIN, 155 356 BOTTOMMARGIN, 176
355 END 357 END
356 358
357 IDD_MOUNT_DLG, DIALOG 359 IDD_MOUNT_DLG, DIALOG
@@ -593,7 +595,7 @@ BEGIN
593 MENUITEM "Beginner's Tutorial", IDM_ONLINE_TUTORIAL 595 MENUITEM "Beginner's Tutorial", IDM_ONLINE_TUTORIAL
594 MENUITEM "Frequently Asked Questions", IDM_FAQ 596 MENUITEM "Frequently Asked Questions", IDM_FAQ
595 MENUITEM SEPARATOR 597 MENUITEM SEPARATOR
596 MENUITEM "VeraCrypt Website", IDM_WEBSITE 598 MENUITEM "VeraCrypt Website", IDM_WEBSITE
597 MENUITEM "Downloads", IDM_TC_DOWNLOADS 599 MENUITEM "Downloads", IDM_TC_DOWNLOADS
598 MENUITEM "News", IDM_NEWS 600 MENUITEM "News", IDM_NEWS
599 MENUITEM "Version History", IDM_VERSION_HISTORY 601 MENUITEM "Version History", IDM_VERSION_HISTORY
diff --git a/src/Mount/Mount.vcproj b/src/Mount/Mount.vcproj
index f2c3f63f..cb0be04e 100644
--- a/src/Mount/Mount.vcproj
+++ b/src/Mount/Mount.vcproj
@@ -374,6 +374,10 @@
374 > 374 >
375 </File> 375 </File>
376 <File 376 <File
377 RelativePath="..\Common\Wipe.c"
378 >
379 </File>
380 <File
377 RelativePath="..\Common\Wipe.h" 381 RelativePath="..\Common\Wipe.h"
378 > 382 >
379 </File> 383 </File>
diff --git a/src/Mount/Resource.h b/src/Mount/Resource.h
index c410d36b..7ed08e06 100644
--- a/src/Mount/Resource.h
+++ b/src/Mount/Resource.h
@@ -106,11 +106,13 @@
106#define IDC_SHOW_PASSWORD_CHPWD_ORI 1083 106#define IDC_SHOW_PASSWORD_CHPWD_ORI 1083
107#define IDC_HK_DISMOUNT_PLAY_SOUND 1084 107#define IDC_HK_DISMOUNT_PLAY_SOUND 1084
108#define IDC_HOTKEY_ASSIGN 1085 108#define IDC_HOTKEY_ASSIGN 1085
109#define IDC_WIPE_MODE 1085
109#define IDC_HOTKEY_REMOVE 1086 110#define IDC_HOTKEY_REMOVE 1086
110#define IDC_HOTKEY_KEY 1087 111#define IDC_HOTKEY_KEY 1087
111#define IDT_HOTKEY_KEY 1088 112#define IDT_HOTKEY_KEY 1088
112#define IDC_HOTKEY_LIST 1089 113#define IDC_HOTKEY_LIST 1089
113#define IDC_RESET_HOTKEYS 1090 114#define IDC_RESET_HOTKEYS 1090
115#define IDT_WIPE_MODE 1090
114#define IDT_DISMOUNT_ACTION 1091 116#define IDT_DISMOUNT_ACTION 1091
115#define IDT_ASSIGN_HOTKEY 1092 117#define IDT_ASSIGN_HOTKEY 1092
116#define IDC_HK_MOD_SHIFT 1093 118#define IDC_HK_MOD_SHIFT 1093