VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-06-07 01:37:23 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-06-07 01:38:34 +0200
commitc3c1bdd29d932f2b38e7c3995498f9a4eab8702b (patch)
tree17442ccd96111eae10c729ac719f236e5e2ead21 /src/Common
parent550e2bcf3bc1626ccb950c6bc97f1348e94cca76 (diff)
downloadVeraCrypt-c3c1bdd29d932f2b38e7c3995498f9a4eab8702b.tar.gz
VeraCrypt-c3c1bdd29d932f2b38e7c3995498f9a4eab8702b.zip
Windows: Add support for PIN in favorites. Several enhancements to GUI handling of Dynamic Mode.
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Apidrvr.h1
-rw-r--r--src/Common/Crypto.h1
-rw-r--r--src/Common/Dlgcode.c34
-rw-r--r--src/Common/Dlgcode.h2
-rw-r--r--src/Common/Language.xml12
-rw-r--r--src/Common/Volumes.c4
6 files changed, 41 insertions, 13 deletions
diff --git a/src/Common/Apidrvr.h b/src/Common/Apidrvr.h
index d168cf74..b61370c7 100644
--- a/src/Common/Apidrvr.h
+++ b/src/Common/Apidrvr.h
@@ -145,6 +145,7 @@ typedef struct
unsigned __int64 totalBytesWritten;
int hiddenVolProtection; /* Hidden volume protection status (e.g. HIDVOL_PROT_STATUS_NONE, HIDVOL_PROT_STATUS_ACTIVE, etc.) */
int volFormatVersion;
+ int volumePin;
} VOLUME_PROPERTIES_STRUCT;
typedef struct
diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h
index 038e5430..ff743890 100644
--- a/src/Common/Crypto.h
+++ b/src/Common/Crypto.h
@@ -213,6 +213,7 @@ typedef struct CRYPTO_INFO_t
unsigned __int8 salt[PKCS5_SALT_SIZE];
int noIterations;
BOOL bTrueCryptMode;
+ int volumePin;
uint64 volume_creation_time; // Legacy
uint64 header_creation_time; // Legacy
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index bfa8a32e..cc66506c 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -4353,6 +4353,22 @@ string GetUserFriendlyVersionString (int version)
return (versionString);
}
+string IntToString (int val)
+{
+ char szTmp [64];
+ StringCbPrintfA (szTmp, sizeof(szTmp), "%d", val);
+
+ return szTmp;
+}
+
+wstring IntToWideString (int val)
+{
+ wchar_t szTmp [64];
+ StringCbPrintfW (szTmp, sizeof(szTmp), L"%d", val);
+
+ return szTmp;
+}
+
void GetSizeString (unsigned __int64 size, wchar_t *str, size_t cbStr)
{
static wchar_t *b, *kb, *mb, *gb, *tb, *pb;
@@ -10720,14 +10736,16 @@ std::string FindLatestFileOrDirectory (const std::string &directory, const char
int GetPin (HWND hwndDlg, UINT ctrlId)
{
int pin = 0;
- char szTmp[MAX_PIN + 1] = {0};
- GetDlgItemText (hwndDlg, ctrlId, szTmp, MAX_PIN + 1);
- if (strlen(szTmp))
- {
- char* endPtr = NULL;
- pin = strtol(szTmp, &endPtr, 0);
- if (pin < 0 || endPtr == szTmp || !endPtr || *endPtr != '\0')
- pin = 0;
+ if (IsWindowEnabled (GetDlgItem (hwndDlg, ctrlId)))
+ {
+ char szTmp[MAX_PIN + 1] = {0};
+ if (GetDlgItemText (hwndDlg, ctrlId, szTmp, MAX_PIN + 1) > 0)
+ {
+ char* endPtr = NULL;
+ pin = strtol(szTmp, &endPtr, 10);
+ if (pin < 0 || endPtr == szTmp || !endPtr || *endPtr != '\0')
+ pin = 0;
+ }
}
return pin;
}
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 781efeee..a8d571dd 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -548,6 +548,8 @@ std::string VolumeGuidPathToDevicePath (std::string volumeGuidPath);
std::string HarddiskVolumePathToPartitionPath (const std::string &harddiskVolumePath);
std::string FindLatestFileOrDirectory (const std::string &directory, const char *namePattern, bool findDirectory, bool findFile);
std::string GetUserFriendlyVersionString (int version);
+std::string IntToString (int val);
+std::wstring IntToWideString (int val);
// Display a wait dialog while calling the provided callback with the given parameter
typedef void (CALLBACK* WaitThreadProc)(void* pArg, HWND hWaitDlg);
diff --git a/src/Common/Language.xml b/src/Common/Language.xml
index e1cdcde7..fe94ab2e 100644
--- a/src/Common/Language.xml
+++ b/src/Common/Language.xml
@@ -597,7 +597,7 @@
<string lang="en" key="NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE_HELP">Please enter the password and/or keyfile(s) for the non-system volume where you want to resume the process of in-place encryption/decryption.\n\nRemark: After you click Next, VeraCrypt will attempt to find all non-system volumes where the process of encryption/decryption has been interrupted and where the VeraCrypt volume header can be deciphered using the supplied password and/or keyfile(s). If more than one such volume is found, you will need to select one of them in the next step.</string>
<string lang="en" key="NONSYS_INPLACE_ENC_RESUME_VOL_SELECT_HELP">Please select one of the listed volumes. The list contains each accessible non-system volume where the process of encryption/decryption has been interrupted and where the volume header was successfully deciphered using the supplied password and/or keyfile(s).</string>
<string lang="en" key="NONSYS_INPLACE_DEC_PASSWORD_PAGE_HELP">Please enter the password and/or keyfile(s) for the non-system VeraCrypt volume that you want to decrypt.</string>
- <string lang="en" key="PASSWORD_HELP">It is very important that you choose a good password. You should avoid choosing one that contains only a single word that can be found in a dictionary (or a combination of 2, 3, or 4 such words). It should not contain any names or dates of birth. It should not be easy to guess. A good password is a random combination of upper and lower case letters, numbers, and special characters, such as @ ^ = $ * + etc. We recommend choosing a password consisting of more than 20 characters (the longer, the better). The maximum possible length is 64 characters.</string>
+ <string lang="en" key="PASSWORD_HELP">It is very important that you choose a good password. You should avoid choosing one that contains only a single word that can be found in a dictionary (or a combination of 2, 3, or 4 such words). It should not contain any names or dates of birth. It should not be easy to guess. A good password is a random combination of upper and lower case letters, numbers, and special characters, such as @ ^ = $ * + etc. We recommend choosing a password consisting of 20 or more characters (the longer, the better). The maximum possible length is 64 characters.</string>
<string lang="en" key="PASSWORD_HIDDENVOL_HELP">Please choose a password for the hidden volume. </string>
<string lang="en" key="PASSWORD_HIDDEN_OS_HELP">Please choose a password for the hidden operating system (i.e. for the hidden volume). </string>
<string lang="en" key="PASSWORD_HIDDEN_OS_NOTE">IMPORTANT: The password that you choose for the hidden operating system in this step must be substantially different from the other two passwords (i.e. from the password for the outer volume and from the password for the decoy operating system).</string>
@@ -607,7 +607,7 @@
<string lang="en" key="PASSWORD_HIDVOL_HOST_TITLE">Outer Volume Password</string>
<string lang="en" key="PASSWORD_HIDVOL_TITLE">Hidden Volume Password</string>
<string lang="en" key="PASSWORD_HIDDEN_OS_TITLE">Password for Hidden Operating System</string>
- <string lang="en" key="PASSWORD_LENGTH_WARNING">WARNING: Short passwords are easy to crack using brute force techniques!\n\nWe recommend choosing a password consisting of more than 20 characters. Are you sure you want to use a short password?</string>
+ <string lang="en" key="PASSWORD_LENGTH_WARNING">WARNING: Short passwords are easy to crack using brute force techniques!\n\nWe recommend choosing a password consisting of 20 or more characters. Are you sure you want to use a short password?</string>
<string lang="en" key="PASSWORD_TITLE">Volume Password</string>
<string lang="en" key="PASSWORD_WRONG">Incorrect password/PRF or not a valid volume.</string>
<string lang="en" key="PASSWORD_OR_KEYFILE_WRONG">Incorrect keyfile(s) and/or password/PRF or not a valid volume.</string>
@@ -616,6 +616,8 @@
<string lang="en" key="PASSWORD_WRONG_AUTOMOUNT">Incorrect password/PRF or no valid volume found.</string>
<string lang="en" key="PASSWORD_OR_KEYFILE_WRONG_AUTOMOUNT">Incorrect keyfile(s)/password/PRF or no valid volume found.</string>
<string lang="en" key="PASSWORD_WRONG_CAPSLOCK_ON">\n\nWarning: Caps Lock is on. This may cause you to enter your password incorrectly.</string>
+ <string lang="en" key="PIN_CHANGE_WARNING">Remember Number to Mount Volume</string>
+ <string lang="en" key="PIN_SYSENC_CHANGE_WARNING">Remember Number to Boot System</string>
<string lang="en" key="PIN_SMALL_WARNING">You have chosen a Personal Iteration Number (PIN) 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?</string>
<string lang="en" key="PIN_SYSENC_TOO_BIG">Personal Iteration Number (PIN) maximum value for system encryption is 65535.</string>
<string lang="en" key="HIDDEN_FILES_PRESENT_IN_KEYFILE_PATH">\n\nWARNING: Hidden file(s) have been found in a keyfile search path. Such hidden files cannot be used as keyfiles. If you need to use them as keyfiles, remove their 'Hidden' attribute (right-click each of them, select 'Properties', uncheck 'Hidden' and click OK). Note: Hidden files are visible only if the corresponding option is enabled (Computer > Organize > 'Folder and search options' > View).</string>
@@ -1068,9 +1070,9 @@
<string lang="en" key="GAP_BETWEEN_SYS_AND_HIDDEN_OS_PARTITION">Warning: There is unallocated space between the system partition and the first partition behind it. After you create the hidden operating system, you must not create any new partitions in that unallocated space. Otherwise, the hidden operating system will be impossible to boot (until you delete such newly created partitions).</string>
<string lang="en" key="ALGO_NOT_SUPPORTED_FOR_SYS_ENCRYPTION">This algorithm is currently not supported for system encryption.</string>
<string lang="en" key="ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE">This algorithm is not supported for TrueCrypt mode.</string>
- <string lang="en" key="PIN_NOT_SUPPORTED_FOR_TRUECRYPT_MODE">PIN (Personal Iteration Count) not supported for TrueCrypt mode.</string>
- <string lang="en" key="PIN_REQUIRE_LONG_PASSWORD">Password must contain more than 20 characters in order to use the specified PIN.\nShorter passwords can only be used if the PIN is greater than 485.</string>
- <string lang="en" key="BOOT_PIN_REQUIRE_LONG_PASSWORD">Pre-boot authentication Password must contain more than 20 characters in order to use the specified PIN.\nShorter passwords can only be used if the PIN is greater than 98.</string>
+ <string lang="en" key="PIN_NOT_SUPPORTED_FOR_TRUECRYPT_MODE">PIN (Personal Iteration Number) not supported for TrueCrypt mode.</string>
+ <string lang="en" key="PIN_REQUIRE_LONG_PASSWORD">Password must contain 20 or more characters in order to use the specified PIN.\nShorter passwords can only be used if the PIN is 485 or greater.</string>
+ <string lang="en" key="BOOT_PIN_REQUIRE_LONG_PASSWORD">Pre-boot authentication Password must contain 20 or more characters in order to use the specified PIN.\nShorter passwords can only be used if the PIN is 98 or greater.</string>
<string lang="en" key="KEYFILES_NOT_SUPPORTED_FOR_SYS_ENCRYPTION">Keyfiles are currently not supported for system encryption.</string>
<string lang="en" key="CANNOT_RESTORE_KEYBOARD_LAYOUT">Warning: VeraCrypt could not restore the original keyboard layout. This may cause you to enter a password incorrectly.</string>
<string lang="en" key="CANT_CHANGE_KEYB_LAYOUT_FOR_SYS_ENCRYPTION">Error: Cannot set the keyboard layout for VeraCrypt to the standard US keyboard layout.\n\nNote that the password needs to be typed in the pre-boot environment (before Windows starts) where non-US Windows keyboard layouts are not available. Therefore, the password must always be typed using the standard US keyboard layout.</string>
diff --git a/src/Common/Volumes.c b/src/Common/Volumes.c
index 567df7ee..283be2ea 100644
--- a/src/Common/Volumes.c
+++ b/src/Common/Volumes.c
@@ -494,6 +494,7 @@ KeyReady: ;
cryptoInfo->pkcs5 = pkcs5_prf;
cryptoInfo->noIterations = keyInfo.noIterations;
cryptoInfo->bTrueCryptMode = truecryptMode;
+ cryptoInfo->volumePin = pin;
goto ret;
}
@@ -516,6 +517,7 @@ KeyReady: ;
cryptoInfo->pkcs5 = pkcs5_prf;
cryptoInfo->noIterations = keyInfo.noIterations;
cryptoInfo->bTrueCryptMode = truecryptMode;
+ cryptoInfo->volumePin = pin;
// Init the cipher with the decrypted master key
status = EAInit (cryptoInfo->ea, keyInfo.master_keydata + primaryKeyOffset, cryptoInfo->ks);
@@ -805,6 +807,8 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
// User selected PRF
cryptoInfo->pkcs5 = pkcs5_prf;
cryptoInfo->bTrueCryptMode = FALSE;
+ cryptoInfo->noIterations = keyInfo.noIterations;
+ cryptoInfo->volumePin = pin;
// Mode of operation
cryptoInfo->mode = mode;