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

Windows: use correct default PIM value for Argon2 when validating small PIM values

This commit is contained in:
Mounir IDRASSI
2025-06-26 00:05:28 +09:00
parent 90e315dae2
commit 6949417181
3 changed files with 6 additions and 6 deletions

View File

@@ -137,7 +137,7 @@ BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw)
BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, int bootPRF, BOOL bSkipPasswordWarning, BOOL bSkipPimWarning) BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, int bootPRF, BOOL bSkipPasswordWarning, BOOL bSkipPimWarning)
{ {
BOOL bootPimCondition = (bForBoot && (bootPRF != SHA512 && bootPRF != WHIRLPOOL))? TRUE : FALSE; BOOL bootPimCondition = (bForBoot && (bootPRF != SHA512 && bootPRF != WHIRLPOOL))? TRUE : FALSE;
BOOL bCustomPimSmall = ((pim != 0) && (pim < (bootPimCondition? 98 : 485)))? TRUE : FALSE; BOOL bCustomPimSmall = ((pim != 0) && (pim < (bootPimCondition? 98 : bootPRF == ARGON2? 12 : 485)))? TRUE : FALSE;
if (passwordLength < PASSWORD_LEN_WARNING) if (passwordLength < PASSWORD_LEN_WARNING)
{ {
if (bCustomPimSmall) if (bCustomPimSmall)
@@ -159,7 +159,7 @@ BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim
} }
#endif #endif
if ((pim != 0) && (pim > (bootPimCondition? 98 : 485))) if ((pim != 0) && (pim > (bootPimCondition? 98 : bootPRF == ARGON2? 12 : 485)))
{ {
// warn that mount/boot will take more time // warn that mount/boot will take more time
Warning ("PIM_LARGE_WARNING", hwndDlg); Warning ("PIM_LARGE_WARNING", hwndDlg);

View File

@@ -6434,7 +6434,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if (volumePassword.Length > 0) if (volumePassword.Length > 0)
{ {
// Check password length (check also done for outer volume which is not the case in TrueCrypt). // Check password length (check also done for outer volume which is not the case in TrueCrypt).
if (!CheckPasswordLength (NULL, volumePassword.Length, volumePim, FALSE, 0, Silent, Silent)) if (!CheckPasswordLength (NULL, volumePassword.Length, volumePim, FALSE, hash_algo, Silent, Silent))
{ {
exit (1); exit (1);
} }
@@ -7699,7 +7699,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
return 1; return 1;
} }
// Check password length (check also done for outer volume which is not the case in TrueCrypt). // Check password length (check also done for outer volume which is not the case in TrueCrypt).
else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, 0, SysEncInEffect(), SysEncInEffect()? hash_algo : 0, FALSE, FALSE)) else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, 0, SysEncInEffect(), hash_algo, FALSE, FALSE))
{ {
return 1; return 1;
} }
@@ -7810,7 +7810,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
return 1; return 1;
} }
// Check password length (check also done for outer volume which is not the case in TrueCrypt). // Check password length (check also done for outer volume which is not the case in TrueCrypt).
else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, volumePim, SysEncInEffect(), SysEncInEffect()? hash_algo : 0, TRUE, FALSE)) else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, volumePim, SysEncInEffect(), hash_algo, TRUE, FALSE))
{ {
return 1; return 1;
} }

View File

@@ -2860,7 +2860,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
else if (!(newKeyFilesParam.EnableKeyFiles && newKeyFilesParam.FirstKeyFile != NULL) else if (!(newKeyFilesParam.EnableKeyFiles && newKeyFilesParam.FirstKeyFile != NULL)
&& pwdChangeDlgMode == PCDM_CHANGE_PASSWORD) && pwdChangeDlgMode == PCDM_CHANGE_PASSWORD)
{ {
int bootPRF = 0; int bootPRF = pkcs5;
if (bSysEncPwdChangeDlgMode) if (bSysEncPwdChangeDlgMode)
{ {
try try