diff options
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r-- | src/Common/Dlgcode.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index a6700e29..5cf6dbaf 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -4679,24 +4679,24 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg) {
case SHA512:
/* PKCS-5 test with HMAC-SHA-512 used as the PRF */
- derive_key_sha512 ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, FALSE, FALSE), dk, MASTER_KEYDATA_SIZE);
+ derive_key_sha512 ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, 0, FALSE, FALSE), dk, MASTER_KEYDATA_SIZE);
break;
case SHA256:
/* PKCS-5 test with HMAC-SHA-256 used as the PRF */
- derive_key_sha256 ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, FALSE, FALSE), dk, MASTER_KEYDATA_SIZE);
+ derive_key_sha256 ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, 0, FALSE, FALSE), dk, MASTER_KEYDATA_SIZE);
break;
case RIPEMD160:
/* PKCS-5 test with HMAC-RIPEMD-160 used as the PRF */
- derive_key_ripemd160 ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, FALSE, FALSE), dk, MASTER_KEYDATA_SIZE);
+ derive_key_ripemd160 ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, 0, FALSE, FALSE), dk, MASTER_KEYDATA_SIZE);
break;
case WHIRLPOOL:
/* PKCS-5 test with HMAC-Whirlpool used as the PRF */
- derive_key_whirlpool ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, FALSE, FALSE), dk, MASTER_KEYDATA_SIZE);
+ derive_key_whirlpool ("passphrase-1234567890", 21, tmp_salt, 64, get_pkcs5_iteration_count(thid, 0, FALSE, FALSE), dk, MASTER_KEYDATA_SIZE);
break;
}
}
@@ -6521,8 +6521,9 @@ int MountVolume (HWND hwndDlg, int driveNo,
char *volumePath,
Password *password,
int pkcs5,
+ int pin,
BOOL truecryptMode,
BOOL cachePassword,
BOOL sharedAccess,
const MountOptions* const mountOptions,
@@ -6583,8 +6584,9 @@ retry: {
mount.ProtectedHidVolPassword = mountOptions->ProtectedHidVolPassword;
mount.bProtectHiddenVolume = TRUE;
mount.ProtectedHidVolPkcs5Prf = mountOptions->ProtectedHidVolPkcs5Prf;
+ mount.ProtectedHidVolPin = mountOptions->ProtectedHidVolPin;
}
else
mount.bProtectHiddenVolume = FALSE;
@@ -6594,8 +6596,9 @@ retry: mount.bMountManager = TRUE;
mount.pkcs5_prf = pkcs5;
mount.bTrueCryptMode = truecryptMode;
+ mount.VolumePin = pin;
// Windows 2000 mount manager causes problems with remounted volumes
if (CurrentOSMajor == 5 && CurrentOSMinor == 0)
mount.bMountManager = FALSE;
@@ -7314,9 +7317,9 @@ int64 FindString (const char *buf, const char *str, int64 bufLen, int64 strLen, }
for (int64 i = startOffset; i <= bufLen - strLen; i++)
{
- if (memcmp (buf + i, str, strLen) == 0)
+ if (memcmp (buf + i, str, (size_t) strLen) == 0)
return i;
}
return -1;
@@ -8802,8 +8805,11 @@ BOOL IsOSVersionAtLeast (OSVersionEnum reqMinOS, int reqMinServicePack) BOOL Is64BitOs ()
{
+#ifdef _WIN64
+ return TRUE;
+#else
static BOOL isWow64 = FALSE;
static BOOL valid = FALSE;
typedef BOOL (__stdcall *LPFN_ISWOW64PROCESS ) (HANDLE hProcess,PBOOL Wow64Process);
LPFN_ISWOW64PROCESS fnIsWow64Process;
@@ -8818,8 +8824,9 @@ BOOL Is64BitOs () isWow64 = FALSE;
valid = TRUE;
return isWow64;
+#endif
}
BOOL IsServerOS ()
@@ -9246,9 +9253,9 @@ void ReportUnexpectedState (char *techInfo) #ifndef SETUP
-int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *password, int pkcs5_prf, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader)
+int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *password, int pkcs5_prf, int pin, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader)
{
int status = ERR_PARAMETER_INCORRECT;
int volumeType;
char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
@@ -9396,9 +9403,9 @@ int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *pa memset (buffer, 0, sizeof (buffer));
}
// Decrypt volume header
- status = ReadVolumeHeader (FALSE, buffer, password, pkcs5_prf, truecryptMode, &context->CryptoInfo, NULL);
+ status = ReadVolumeHeader (FALSE, buffer, password, pkcs5_prf, pin, truecryptMode, &context->CryptoInfo, NULL);
if (status == ERR_PASSWORD_WRONG)
continue; // Try next volume type
@@ -9441,9 +9448,9 @@ void CloseVolume (OpenVolumeContext *context) context->VolumeIsOpen = FALSE;
}
-int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, BOOL wipeMode)
+int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pin, BOOL wipeMode)
{
CRYPTO_INFO *newCryptoInfo = NULL;
RandSetHashFunction (cryptoInfo->pkcs5);
@@ -9463,8 +9470,9 @@ int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO * cryptoInfo->ea,
cryptoInfo->mode,
password,
cryptoInfo->pkcs5,
+ pin,
(char *) cryptoInfo->master_keydata,
&newCryptoInfo,
cryptoInfo->VolumeSize.Value,
cryptoInfo->hiddenVolume ? cryptoInfo->hiddenVolumeSize : 0,
@@ -10692,4 +10700,19 @@ std::string FindLatestFileOrDirectory (const std::string &directory, const char return name;
return string (directory) + "\\" + name;
}
+
+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;
+ }
+ return pin;
+}
|