diff --git a/src/Common/Common.rc b/src/Common/Common.rc index 7df10586..652b407f 100644 --- a/src/Common/Common.rc +++ b/src/Common/Common.rc @@ -73,26 +73,27 @@ BEGIN CONTROL "Mount volume as read-&only",IDC_MOUNT_READONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,11,194,10 CONTROL "Mount volume as removable &medium",IDC_MOUNT_REMOVABLE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,25,195,10 + CONTROL "Use backup header embedded in &volume if available",IDC_USE_EMBEDDED_HEADER_BAK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,39,257,11 CONTROL "Mount partition &using system encryption without pre-boot authentication",IDC_MOUNT_SYSENC_PART_WITHOUT_PBA, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,53,259,11 CONTROL "&Protect hidden volume against damage caused by writing to outer volume",IDC_PROTECT_HIDDEN_VOL, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,86,252,10 EDITTEXT IDC_PASSWORD_PROT_HIDVOL,112,104,151,14,ES_PASSWORD | ES_AUTOHSCROLL + COMBOBOX IDC_PKCS5_PRF_ID,112,125,91,90,CBS_DROPDOWNLIST | WS_TABSTOP + EDITTEXT IDC_PIM,112,145,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE + LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,158,148,112,8,NOT WS_VISIBLE CONTROL "&Display password",IDC_SHOW_PASSWORD_MO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,165,90,10 CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE_HIDVOL_PROT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,178,90,10 - PUSHBUTTON "&Keyfiles...",IDC_KEYFILES_HIDVOL_PROT,203,167,60,14 - LTEXT "What is hidden volume protection?",IDC_LINK_HIDVOL_PROTECTION_INFO,16,193,247,10,SS_NOTIFY + PUSHBUTTON "&Keyfiles...",IDC_KEYFILES_HIDVOL_PROT,204,174,60,14 DEFPUSHBUTTON "OK",IDOK,211,7,60,14 PUSHBUTTON "Cancel",IDCANCEL,211,24,60,14 + LTEXT "What is hidden volume protection?",IDC_LINK_HIDVOL_PROTECTION_INFO,16,193,247,10,SS_NOTIFY RTEXT "P&assword to hidden volume:\n(if empty, cache is used)",IDT_HIDDEN_PROT_PASSWD,15,103,91,17,0,WS_EX_RIGHT GROUPBOX "Hidden Volume Protection",IDT_HIDDEN_VOL_PROTECTION,6,72,265,139 - CONTROL "Use backup header embedded in &volume if available",IDC_USE_EMBEDDED_HEADER_BAK, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,39,257,11 - COMBOBOX IDC_PKCS5_PRF_ID,112,125,91,90,CBS_DROPDOWNLIST | WS_TABSTOP RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,15,126,91,17 - EDITTEXT IDC_PIM,112,145,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - RTEXT "Volume PIM:",IDT_PIM,15,148,91,17 - LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,158,148,112,8 + RTEXT "Volume PIM:",IDT_PIM,15,148,91,17,NOT WS_VISIBLE + CONTROL "Use PIM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,152,97,10 END IDD_KEYFILES DIALOGEX 0, 0, 345, 237 diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 478af87c..2742317f 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -118,6 +118,7 @@ BOOL bPortableModeConfirmed = FALSE; // TRUE if it is certain that the instance BOOL bInPlaceEncNonSysPending = FALSE; // TRUE if the non-system in-place encryption config file indicates that one or more partitions are scheduled to be encrypted. This flag is set only when config files are loaded during app startup. /* Globals used by Mount and Format (separately per instance) */ +BOOL PimEnable = FALSE; BOOL KeyFilesEnable = FALSE; KeyFile *FirstKeyFile = NULL; KeyFilesDlgParam defaultKeyFilesParam; @@ -9185,6 +9186,10 @@ void Applink (char *dest, BOOL bSendOS, char *extraOutput) { StringCbCopyA (url, sizeof (url),"https://veracrypt.codeplex.com/wikipage?title=Contact"); } + else if (strcmp(dest, "pim") == 0) + { + StringCbCopyA (url, sizeof (url),"https://veracrypt.codeplex.com/wikipage?title=Personal%20Iterations%20Multiplier%20%28PIM%29"); + } else { StringCbCopyA (url, sizeof (url),TC_APPLINK); @@ -10765,7 +10770,8 @@ std::string FindLatestFileOrDirectory (const std::string &directory, const char int GetPim (HWND hwndDlg, UINT ctrlId) { int pim = 0; - if (IsWindowEnabled (GetDlgItem (hwndDlg, ctrlId))) + HWND hCtrl = GetDlgItem (hwndDlg, ctrlId); + if (IsWindowEnabled (hCtrl) && IsWindowVisible (hCtrl)) { char szTmp[MAX_PIM + 1] = {0}; if (GetDlgItemText (hwndDlg, ctrlId, szTmp, MAX_PIM + 1) > 0) diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index 175282fe..18e581f5 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -137,6 +137,7 @@ extern char bCachedSysDevicePathsValid; extern BOOL bHyperLinkBeingTracked; extern BOOL bInPlaceEncNonSysPending; +extern BOOL PimEnable; extern BOOL KeyFilesEnable; extern KeyFile *FirstKeyFile; extern KeyFilesDlgParam defaultKeyFilesParam; diff --git a/src/Common/Language.xml b/src/Common/Language.xml index 889d7bbb..a02da93c 100644 --- a/src/Common/Language.xml +++ b/src/Common/Language.xml @@ -48,6 +48,7 @@ &Keyfiles... Information on hash algorithms More information + Information on PIM &MB More information More information about system encryption @@ -57,6 +58,7 @@ &Never save history Open Outer Volume &Pause + Use PIM Quick Format &Display password &Display password @@ -617,14 +619,15 @@ Operation failed due to one or more of the following:\n - Wrong mount mode.\n - Incorrect keyfile(s).\n - Incorrect password.\n - Incorrect Volume PIM number.\n - Incorrect PRF (hash).\n - Not a valid volume. Auto-mount failed due to one or more of the following:\n - Incorrect password.\n - Incorrect Volume PIM number.\n - Incorrect PRF (hash).\n - No valid volume found. Auto-mount failed due to one or more of the following:\n - Incorrect keyfile(s).\n - Incorrect password.\n - Incorrect Volume PIM number.\n - Incorrect PRF (hash).\n - No valid volume found. - \n\nWarning: Caps Lock is on. This may cause you to enter your password incorrectly. + \n\nWarning: Caps Lock is on. This may cause you to enter your password incorrectly. Remember Number to Mount Volume Outer Volume PIM Hidden Volume PIM PIM for Hidden Operating System - PIM (Personal Iterations Multiplier) is a value that controls the number of iterations used by the header key derivation as follows:\n Iterations = 15000 + (PIM x 1000).\n\nWhen left empty or set to 0, VeraCrypt will use a default value (485) that ensures a high security.\n\nWhen the password is less than 20 characters, PIM can't be smaller than 485 in order to maintain a minimal security level.\n\nWhen the password is 20 characters or more, PIM can be set to any value.\n\nA small PIM value will lead to a quicker mount but it can reduce security if the password is not strong enough. - PIM (Personal Iterations Multiplier) is a value that controls the number of iterations used by the header key derivation as follows:\n Iterations = PIM x 2048.\n\nWhen left empty or set to 0, VeraCrypt will use a default value that ensures a high security.\n\nWhen the password is less than 20 characters, PIM can't be smaller than 98 in order to maintain a minimal security level.\n\nWhen the password is 20 characters or more, PIM can be set to any value.\n\nA small PIM value will lead to a quicker boot but it can reduce security if the password is not strong enough. + PIM (Personal Iterations Multiplier) is a value that controls the number of iterations used by the header key derivation as follows:\n Iterations = 15000 + (PIM x 1000).\n\nWhen left empty or set to 0, VeraCrypt will use a default value (485) that ensures a high security.\n\nWhen the password is less than 20 characters, PIM can't be smaller than 485 in order to maintain a minimal security level.\nWhen the password is 20 characters or more, PIM can be set to any value.\n\nA PIM value larger than 485 will lead to slower mount. A small PIM value (less than 485) will lead to a quicker mount but it can reduce security if the password is not strong enough. + PIM (Personal Iterations Multiplier) is a value that controls the number of iterations used by the header key derivation as follows:\n Iterations = PIM x 2048.\n\nWhen left empty or set to 0, VeraCrypt will use a default value that ensures a high security.\n\nWhen the password is less than 20 characters, PIM can't be smaller than 98 in order to maintain a minimal security level.\nWhen the password is 20 characters or more, PIM can be set to any value.\n\nA PIM value larger than 98 will lead to slower boot. A small PIM value (less than 98) will lead to a quicker boot but it can reduce security if the password is not strong enough. Remember Number to Boot System + You have chosen a PIM value that is larger than VeraCrypt default value.\nPlease note that this will lead to much slower mount/boot. You have chosen a Personal Iterations Multiplier (PIM) that is smaller than the default VeraCrypt value. Please note that if your password is not strong enough, this could lead to a weaker security.\n\nDo you confirm that you are using a strong password? Personal Iterations Multiplier (PIM) maximum value for system encryption is 65535. Volume PIM diff --git a/src/Common/Password.c b/src/Common/Password.c index f8cf4616..fe9a9370 100644 --- a/src/Common/Password.c +++ b/src/Common/Password.c @@ -134,6 +134,13 @@ BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim return FALSE; } #endif + + if ((pim != 0) && (pim > (bForBoot? 98 : 485))) + { + // warn that mount/boot will take more time + MessageBoxW (hwndDlg, GetString ("PIM_LARGE_WARNING"), lpszTitle, MB_OK|MB_ICONWARNING); + + } return TRUE; } diff --git a/src/Common/Resource.h b/src/Common/Resource.h index 2d593b65..f1c20214 100644 --- a/src/Common/Resource.h +++ b/src/Common/Resource.h @@ -191,6 +191,7 @@ #define IDT_PIM 5129 #define IDC_PIM 5130 #define IDC_PIM_HELP 5131 +#define IDC_PIM_ENABLE 5132 // Next default values for new objects // @@ -199,7 +200,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 542 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 5132 +#define _APS_NEXT_CONTROL_VALUE 5133 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/ExpandVolume/ExpandVolume.rc b/src/ExpandVolume/ExpandVolume.rc index 7f4d71ae..537a6a64 100644 --- a/src/ExpandVolume/ExpandVolume.rc +++ b/src/ExpandVolume/ExpandVolume.rc @@ -119,21 +119,22 @@ CAPTION "Enter VeraCrypt Volume Password" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_PASSWORD,69,8,166,14,ES_PASSWORD | ES_AUTOHSCROLL + COMBOBOX IDC_PKCS5_PRF_ID,69,26,86,90,CBS_DROPDOWNLIST | WS_TABSTOP + CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,28,76,10 + EDITTEXT IDC_PIM,69,43,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE + CONTROL "Use PIM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,49,97,10 CONTROL "Cache passwords and keyfil&es in memory",IDC_CACHE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,63,153,10 - CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,76,83,10 - CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,89,83,11 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,62,153,10 + CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,75,83,10 + CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,88,83,11 PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,171,86,64,14 PUSHBUTTON "Mount Opti&ons...",IDC_MOUNT_OPTIONS,243,86,64,14 DEFPUSHBUTTON "OK",IDOK,243,8,64,14 PUSHBUTTON "Cancel",IDCANCEL,243,25,64,14 RTEXT "Password:",IDT_PASSWORD,0,10,65,13 - COMBOBOX IDC_PKCS5_PRF_ID,69,26,86,90,CBS_DROPDOWNLIST | WS_TABSTOP RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,0,27,65,13 - CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,28,76,10 - RTEXT "Volume PIM:",IDT_PIM,0,46,65,13 - EDITTEXT IDC_PIM,69,43,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,115,46,189,8 + RTEXT "Volume PIM:",IDT_PIM,0,46,65,13,NOT WS_VISIBLE + LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,115,46,189,8,NOT WS_VISIBLE END IDD_EXPAND_PROGRESS_DLG DIALOGEX 0, 0, 376, 271 diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp index 18df1b4d..ec7a6f56 100644 --- a/src/ExpandVolume/WinMain.cpp +++ b/src/ExpandVolume/WinMain.cpp @@ -449,6 +449,15 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SetPim (hwndDlg, IDC_PIM, *pim); + /* make PIM field visible if a PIM value has been explicitely specified */ + if (*pim > 0) + { + ShowWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), SW_SHOW); + } + SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); mountOptions.PartitionInInactiveSysEncScope = bPrebootPasswordDlgMode; @@ -607,6 +616,15 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return 1; } + if (lw == IDC_PIM_ENABLE) + { + ShowWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), SW_SHOW); + return 1; + } + if (lw == IDC_SHOW_PASSWORD) { SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), @@ -659,11 +677,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA *pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0); *truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE); - GetWindowText (GetDlgItem (hwndDlg, IDC_PIM), tmp, MAX_PIM + 1); - if (strlen(tmp)) - *pim = (int) strtol(tmp, NULL, 10); /* IDC_PIM is configured to accept only numbers */ - else - *pim = 0; + *pim = GetPim (hwndDlg, IDC_PIM); /* SHA-256 is not supported by TrueCrypt */ if ( (*truecryptMode) diff --git a/src/Format/Format.rc b/src/Format/Format.rc index 13833f79..f34cae1f 100644 --- a/src/Format/Format.rc +++ b/src/Format/Format.rc @@ -119,9 +119,10 @@ BEGIN CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,35,95,10 PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,152,36,64,14,WS_DISABLED CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,45,95,11,WS_EX_TRANSPARENT + CONTROL "Use PIM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,53,56,97,10 RTEXT "Password:",IDT_PASSWORD,1,6,50,8 RTEXT "&Confirm:",IDT_CONFIRM,1,23,50,8 - LTEXT "",IDC_BOX_HELP,0,63,225,105 + LTEXT "",IDC_BOX_HELP,0,71,225,97 END IDD_SIZE_PAGE_DLG DIALOGEX 0, 0, 226, 172 @@ -224,15 +225,16 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_PASSWORD_DIRECT,50,2,149,14,ES_PASSWORD | ES_AUTOHSCROLL COMBOBOX IDC_PKCS5_PRF_ID,50,17,91,90,CBS_DROPDOWNLIST | WS_TABSTOP - EDITTEXT IDC_PIM,50,32,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_PIM,50,32,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE + LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,96,34,127,8,NOT WS_VISIBLE CONTROL "&Display password",IDC_SHOW_PASSWORD_SINGLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,46,84,11,WS_EX_TRANSPARENT CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,57,82,11 PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,142,54,64,14 LTEXT "",IDC_BOX_HELP,0,74,225,94 RTEXT "Password:",IDT_PASSWORD,0,6,48,8 RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,0,19,48,8 - RTEXT "Volume PIM:",IDT_PIM,0,34,48,8 - LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,96,34,127,8 + RTEXT "Volume PIM:",IDT_PIM,0,35,48,8,NOT WS_VISIBLE + CONTROL "Use PIM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,50,35,97,10 END IDD_VOLUME_TYPE_PAGE_DLG DIALOGEX 0, 0, 226, 172 @@ -436,9 +438,10 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT IDC_PIM,53,8,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER - LTEXT "",IDC_BOX_HELP,0,28,225,143 + LTEXT "",IDC_BOX_HELP,0,28,225,130 RTEXT "Volume PIM:",IDT_PIM,1,11,50,8 LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,97,11,126,8 + LTEXT "Information on PIM",IDC_LINK_PIM_INFO,0,161,213,8,SS_NOTIFY END diff --git a/src/Format/Resource.h b/src/Format/Resource.h index 1d2f4687..3b717e84 100644 --- a/src/Format/Resource.h +++ b/src/Format/Resource.h @@ -141,6 +141,7 @@ #define IDC_DEVICE_TRANSFORM_MODE_INPLACE 1102 #define IDC_DRIVE_LETTER_LIST 1103 #define IDT_DRIVE_LETTER 1104 +#define IDC_LINK_PIM_INFO 1105 // Next default values for new objects // @@ -149,7 +150,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 134 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1105 +#define _APS_NEXT_CONTROL_VALUE 1106 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index bd83078f..7106a230 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -2700,6 +2700,8 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg) RestoreDefaultKeyFilesParam (); + PimEnable = FALSE; + if (bDevice && !bInPlaceEncNonSys) { // Handle assigned drive letter (if any) @@ -4134,6 +4136,11 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowText (GetDlgItem (hwndDlg, IDC_PIM), szTmp); } + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_ENABLE), PimEnable? SW_HIDE : SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), PimEnable? SW_SHOW : SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), PimEnable? SW_SHOW : SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), PimEnable? SW_SHOW : SW_HIDE); + SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (bInPlaceEncNonSys ? (bInPlaceEncNonSysResumed ? "NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE_HELP" : "NONSYS_INPLACE_DEC_PASSWORD_PAGE_HELP") : "PASSWORD_HIDDENVOL_HOST_DIRECT_HELP")); @@ -4207,6 +4214,8 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowText (GetDlgItem (hwndDlg, IDC_VERIFY), szVerify); SetFocus (GetDlgItem (hwndDlg, IDC_PASSWORD)); + + SetCheckBox (hwndDlg, IDC_PIM_ENABLE, PimEnable); SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable && !SysEncInEffect()); EnableWindow (GetDlgItem (hwndDlg, IDC_KEY_FILES), KeyFilesEnable); @@ -4255,6 +4264,8 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString (SysEncInEffect ()? "PIM_SYSENC_HELP" : "PIM_HELP")); + ToHyperlink (hwndDlg, IDC_LINK_PIM_INFO); + if (CreatingHiddenSysVol()) SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("PIM_HIDDEN_OS_TITLE")); else if (bHiddenVol) @@ -5348,6 +5359,12 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa return 1; } + if (lw == IDC_LINK_PIM_INFO && nCurPageNo == PIM_PAGE) + { + Applink ("pim", TRUE, ""); + return 1; + } + if (hw == CBN_EDITCHANGE && nCurPageNo == VOLUME_LOCATION_PAGE) { EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), @@ -5393,20 +5410,6 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa KeyFilesEnable && FirstKeyFile!=NULL && !SysEncInEffect()); volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text); - if (lw == IDC_PIM) - { - if(GetPim (hwndDlg, IDC_PIM) != 0) - { - PimValueChangedWarning = TRUE; - SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING")); - } - else - { - PimValueChangedWarning = FALSE; - SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, (wchar_t *) GetDictionaryValueByInt (IDC_PIM_HELP)); - } - } - return 1; } @@ -5443,6 +5446,23 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa InvalidateRect (GetDlgItem (hwndDlg, IDC_VERIFY), NULL, TRUE); return 1; } + + if (lw == IDC_PIM_ENABLE) + { + PimEnable = GetCheckBox (hwndDlg, IDC_PIM_ENABLE); + if (!PimEnable) + volumePim = 0; + if (nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE + || nCurPageNo == NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE + ) + { + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_ENABLE), PimEnable? SW_HIDE : SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), PimEnable? SW_SHOW : SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), PimEnable? SW_SHOW : SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), PimEnable? SW_SHOW : SW_HIDE); + } + return 1; + } if (nCurPageNo == PASSWORD_PAGE || nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE @@ -7141,6 +7161,31 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } } + + if (!PimEnable) + { + // PIM not activated. Skip PIM page + volumePim = 0; + + if (SysEncInEffect ()) + { + nNewPageNo = SYSENC_COLLECTING_RANDOM_DATA_PAGE - 1; // Skip irrelevant pages + } + + if (bInPlaceEncNonSys) + { + nNewPageNo = NONSYS_INPLACE_ENC_RAND_DATA_PAGE - 1; // Skip irrelevant pages + } + else if (WizardMode != WIZARD_MODE_SYS_DEVICE + && !FileSize4GBLimitQuestionNeeded () + || CreatingHiddenSysVol()) // If we're creating a hidden volume for a hidden OS, we don't need to format it with any filesystem (the entire OS will be copied to the hidden volume sector by sector). + { + nNewPageNo = FORMAT_PAGE - 1; // Skip irrelevant pages + } + else + nNewPageNo = PIM_PAGE; // Skip PIM page + + } } else if (nCurPageNo == PIM_PAGE) @@ -8328,7 +8373,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa tmp [sizeof(tmp)-1] = 0; SetWindowText (hRandPoolSys, tmp); - nNewPageNo = PIM_PAGE + 1; // Skip irrelevant pages + nNewPageNo = (PimEnable? PIM_PAGE : PASSWORD_PAGE) + 1; // Skip irrelevant pages } else if (nCurPageNo == SYSENC_KEYS_GEN_PAGE) @@ -8372,7 +8417,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa nNewPageNo = FILESYS_PAGE + 1; } else - nNewPageNo = PIM_PAGE + 1; + nNewPageNo = (PimEnable? PIM_PAGE : PASSWORD_PAGE) + 1; } } diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index 212a5d39..3213a693 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -1953,6 +1953,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow (GetDlgItem (hwndDlg, IDT_PIM), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_PIM), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_HELP), FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_NEW_PIM_ENABLE), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_ENABLE_NEW_KEYFILES), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_SHOW_PASSWORD_CHPWD_NEW), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_NEW_KEYFILES), FALSE); @@ -1969,6 +1970,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow (GetDlgItem (hwndDlg, IDT_PIM), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_PIM), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_HELP), FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_NEW_PIM_ENABLE), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_SHOW_PASSWORD_CHPWD_NEW), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDT_NEW_PASSWORD), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDT_CONFIRM_PASSWORD), FALSE); @@ -1989,6 +1991,7 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow (GetDlgItem (hwndDlg, IDT_PIM), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_PIM), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_HELP), FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_NEW_PIM_ENABLE), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_ENABLE_NEW_KEYFILES), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_SHOW_PASSWORD_CHPWD_NEW), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_NEW_KEYFILES), FALSE); @@ -2182,6 +2185,37 @@ BOOL CALLBACK PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return 1; } + if (lw == IDC_PIM_ENABLE) + { + ShowWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDT_OLD_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_OLD_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_OLD_PIM_HELP), SW_SHOW); + + // check also the "Use PIM" for the new password if it is enabled + if (IsWindowEnabled (GetDlgItem (hwndDlg, IDC_NEW_PIM_ENABLE))) + { + SetCheckBox (hwndDlg, IDC_NEW_PIM_ENABLE, TRUE); + + ShowWindow (GetDlgItem (hwndDlg, IDC_NEW_PIM_ENABLE), SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), SW_SHOW); + } + + return 1; + } + + if (lw == IDC_NEW_PIM_ENABLE) + { + ShowWindow (GetDlgItem (hwndDlg, IDC_NEW_PIM_ENABLE), SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), SW_SHOW); + + return 1; + } + if (lw == IDC_KEYFILES) { if (bSysEncPwdChangeDlgMode) @@ -2546,6 +2580,16 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa SetPim (hwndDlg, IDC_PIM, *pim); + /* make PIM field visible if a PIM value has been explicitely specified */ + if (*pim > 0) + { + SetCheckBox (hwndDlg, IDC_PIM_ENABLE, TRUE); + ShowWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), SW_SHOW); + } + SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable); mountOptions.PartitionInInactiveSysEncScope = bPrebootPasswordDlgMode; @@ -2711,6 +2755,15 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa return 1; } + if (lw == IDC_PIM_ENABLE) + { + ShowWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), SW_SHOW); + return 1; + } + if (lw == IDC_SHOW_PASSWORD) { SendMessage (GetDlgItem (hwndDlg, IDC_PASSWORD), @@ -3173,6 +3226,7 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow (GetDlgItem (hwndDlg, IDT_PIM), protect); EnableWindow (GetDlgItem (hwndDlg, IDC_PIM), protect); EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_HELP), protect); + EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), protect); SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE_HIDVOL_PROT, hidVolProtKeyFilesParam.EnableKeyFiles); @@ -3183,6 +3237,16 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), (LPSTR) mountOptions->ProtectedHidVolPassword.Text); SetPim (hwndDlg, IDC_PIM, mountOptions->ProtectedHidVolPim); + + /* make PIM field visible if a PIM value has been explicitely specified */ + if (mountOptions->ProtectedHidVolPim > 0) + { + SetCheckBox (hwndDlg, IDC_PIM_ENABLE, TRUE); + ShowWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), SW_SHOW); + } ToHyperlink (hwndDlg, IDC_LINK_HIDVOL_PROTECTION_INFO); @@ -3239,6 +3303,15 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return 1; } + if (lw == IDC_PIM_ENABLE) + { + ShowWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), SW_HIDE); + ShowWindow (GetDlgItem( hwndDlg, IDT_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM), SW_SHOW); + ShowWindow (GetDlgItem( hwndDlg, IDC_PIM_HELP), SW_SHOW); + return 1; + } + if (lw == IDC_LINK_HIDVOL_PROTECTION_INFO) { Applink ("hiddenvolprotection", TRUE, ""); @@ -3320,6 +3393,7 @@ BOOL CALLBACK MountOptionsDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM EnableWindow (GetDlgItem (hwndDlg, IDT_PIM), protect); EnableWindow (GetDlgItem (hwndDlg, IDC_PIM), protect); EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_HELP), protect); + EnableWindow (GetDlgItem (hwndDlg, IDC_PIM_ENABLE), protect); return 1; } diff --git a/src/Mount/Mount.rc b/src/Mount/Mount.rc index e7ef8e19..c181741b 100644 --- a/src/Mount/Mount.rc +++ b/src/Mount/Mount.rc @@ -114,13 +114,15 @@ BEGIN EDITTEXT IDC_OLD_PASSWORD,89,14,162,13,ES_PASSWORD | ES_AUTOHSCROLL COMBOBOX IDC_PKCS5_OLD_PRF_ID,89,33,85,90,CBS_DROPDOWNLIST | WS_TABSTOP CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,179,35,78,10 - EDITTEXT IDC_OLD_PIM,89,51,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_OLD_PIM,89,51,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE + CONTROL "Use PIM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,59,97,10 CONTROL "Use keyfiles",IDC_ENABLE_KEYFILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,72,98,10 PUSHBUTTON "Keyfiles...",IDC_KEYFILES,192,70,59,14 CONTROL "Display password",IDC_SHOW_PASSWORD_CHPWD_ORI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,85,138,10,WS_EX_TRANSPARENT EDITTEXT IDC_PASSWORD,89,121,162,13,ES_PASSWORD | ES_AUTOHSCROLL EDITTEXT IDC_VERIFY,89,137,162,13,ES_PASSWORD | ES_AUTOHSCROLL - EDITTEXT IDC_PIM,89,154,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_PIM,89,154,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE + CONTROL "Use PIM",IDC_NEW_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,161,97,10 CONTROL "Use keyfiles",IDC_ENABLE_NEW_KEYFILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,172,99,11 PUSHBUTTON "Keyfiles...",IDC_NEW_KEYFILES,192,170,59,14 CONTROL "Display password",IDC_SHOW_PASSWORD_CHPWD_NEW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,89,184,160,11,WS_EX_TRANSPARENT @@ -136,10 +138,10 @@ BEGIN GROUPBOX "New",IDT_NEW,6,108,252,130 RTEXT "Wipe mode:",IDT_WIPE_MODE,9,220,74,8,0,WS_EX_RIGHT RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,12,34,74,10,SS_CENTERIMAGE - RTEXT "Volume PIM:",IDT_OLD_PIM,12,54,74,10 - LTEXT "(Empty or 0 for default iterations)",IDC_OLD_PIM_HELP,135,54,119,8 - RTEXT "Volume PIM:",IDT_PIM,9,157,75,16 - LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,135,157,119,8 + RTEXT "Volume PIM:",IDT_OLD_PIM,12,54,74,10,NOT WS_VISIBLE + LTEXT "(Empty or 0 for default iterations)",IDC_OLD_PIM_HELP,135,54,119,8,NOT WS_VISIBLE + RTEXT "Volume PIM:",IDT_PIM,9,157,75,16,NOT WS_VISIBLE + LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,135,157,119,8,NOT WS_VISIBLE END IDD_MOUNT_DLG DIALOGEX 0, 0, 375, 271 @@ -180,19 +182,20 @@ BEGIN EDITTEXT IDC_PASSWORD,69,8,166,14,ES_PASSWORD | ES_AUTOHSCROLL COMBOBOX IDC_PKCS5_PRF_ID,69,26,86,90,CBS_DROPDOWNLIST | WS_TABSTOP CONTROL "TrueCrypt Mode",IDC_TRUECRYPT_MODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,28,76,10 - EDITTEXT IDC_PIM,69,43,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + EDITTEXT IDC_PIM,69,43,42,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE + CONTROL "Use PIM",IDC_PIM_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,48,97,10 CONTROL "Cache passwords and keyfil&es in memory",IDC_CACHE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,61,153,10 CONTROL "&Display password",IDC_SHOW_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,74,83,10 CONTROL "U&se keyfiles",IDC_KEYFILES_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,70,87,83,11 PUSHBUTTON "&Keyfiles...",IDC_KEY_FILES,171,84,64,14 PUSHBUTTON "Mount Opti&ons...",IDC_MOUNT_OPTIONS,243,84,64,14 + LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,115,46,189,8,NOT WS_VISIBLE DEFPUSHBUTTON "OK",IDOK,243,8,64,14 PUSHBUTTON "Cancel",IDCANCEL,243,25,64,14 RTEXT "Password:",IDT_PASSWORD,0,10,65,13 RTEXT "PKCS-5 PRF:",IDT_PKCS5_PRF,0,27,65,11 - RTEXT "Volume PIM:",IDT_PIM,0,46,65,8 - LTEXT "(Empty or 0 for default iterations)",IDC_PIM_HELP,115,46,189,8 + RTEXT "Volume PIM:",IDT_PIM,0,46,65,8,NOT WS_VISIBLE END IDD_TRAVELER_DLG DIALOGEX 0, 0, 300, 269 diff --git a/src/Mount/Resource.h b/src/Mount/Resource.h index e8b4512a..81c64dc0 100644 --- a/src/Mount/Resource.h +++ b/src/Mount/Resource.h @@ -166,6 +166,7 @@ #define IDT_OLD_PIM 1142 #define IDC_OLD_PIM 1143 #define IDC_OLD_PIM_HELP 1144 +#define IDC_NEW_PIM_ENABLE 1145 #define IDM_HELP 40001 #define IDM_ABOUT 40002 #define IDM_UNMOUNT_VOLUME 40003 @@ -241,7 +242,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 119 #define _APS_NEXT_COMMAND_VALUE 40068 -#define _APS_NEXT_CONTROL_VALUE 1145 +#define _APS_NEXT_CONTROL_VALUE 1146 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif