Skip to content

Commit 6949417

Browse files
committed
Windows: use correct default PIM value for Argon2 when validating small PIM values
1 parent 90e315d commit 6949417

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Common/Password.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw)
137137
BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, int bootPRF, BOOL bSkipPasswordWarning, BOOL bSkipPimWarning)
138138
{
139139
BOOL bootPimCondition = (bForBoot && (bootPRF != SHA512 && bootPRF != WHIRLPOOL))? TRUE : FALSE;
140-
BOOL bCustomPimSmall = ((pim != 0) && (pim < (bootPimCondition? 98 : 485)))? TRUE : FALSE;
140+
BOOL bCustomPimSmall = ((pim != 0) && (pim < (bootPimCondition? 98 : bootPRF == ARGON2? 12 : 485)))? TRUE : FALSE;
141141
if (passwordLength < PASSWORD_LEN_WARNING)
142142
{
143143
if (bCustomPimSmall)
@@ -159,7 +159,7 @@ BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim
159159
}
160160
#endif
161161

162-
if ((pim != 0) && (pim > (bootPimCondition? 98 : 485)))
162+
if ((pim != 0) && (pim > (bootPimCondition? 98 : bootPRF == ARGON2? 12 : 485)))
163163
{
164164
// warn that mount/boot will take more time
165165
Warning ("PIM_LARGE_WARNING", hwndDlg);

src/Format/Tcformat.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6434,7 +6434,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
64346434
if (volumePassword.Length > 0)
64356435
{
64366436
// Check password length (check also done for outer volume which is not the case in TrueCrypt).
6437-
if (!CheckPasswordLength (NULL, volumePassword.Length, volumePim, FALSE, 0, Silent, Silent))
6437+
if (!CheckPasswordLength (NULL, volumePassword.Length, volumePim, FALSE, hash_algo, Silent, Silent))
64386438
{
64396439
exit (1);
64406440
}
@@ -7699,7 +7699,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
76997699
return 1;
77007700
}
77017701
// Check password length (check also done for outer volume which is not the case in TrueCrypt).
7702-
else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, 0, SysEncInEffect(), SysEncInEffect()? hash_algo : 0, FALSE, FALSE))
7702+
else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, 0, SysEncInEffect(), hash_algo, FALSE, FALSE))
77037703
{
77047704
return 1;
77057705
}
@@ -7810,7 +7810,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
78107810
return 1;
78117811
}
78127812
// Check password length (check also done for outer volume which is not the case in TrueCrypt).
7813-
else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, volumePim, SysEncInEffect(), SysEncInEffect()? hash_algo : 0, TRUE, FALSE))
7813+
else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, volumePim, SysEncInEffect(), hash_algo, TRUE, FALSE))
78147814
{
78157815
return 1;
78167816
}

src/Mount/Mount.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2860,7 +2860,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
28602860
else if (!(newKeyFilesParam.EnableKeyFiles && newKeyFilesParam.FirstKeyFile != NULL)
28612861
&& pwdChangeDlgMode == PCDM_CHANGE_PASSWORD)
28622862
{
2863-
int bootPRF = 0;
2863+
int bootPRF = pkcs5;
28642864
if (bSysEncPwdChangeDlgMode)
28652865
{
28662866
try

0 commit comments

Comments
 (0)