From 6ef41abdd2122c36d9387cc4bbdbcfc81315b94b Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sat, 11 Jul 2015 01:48:52 +0200 Subject: Use Pim name for internal variables instead of the old name Pin --- src/Common/Apidrvr.h | 8 ++++---- src/Common/BootEncryption.cpp | 18 +++++++++--------- src/Common/BootEncryption.h | 6 +++--- src/Common/Cache.c | 6 +++--- src/Common/Cache.h | 2 +- src/Common/Common.h | 2 +- src/Common/Crypto.h | 2 +- src/Common/Dlgcode.c | 32 ++++++++++++++++---------------- src/Common/Dlgcode.h | 10 +++++----- src/Common/Format.c | 6 +++--- src/Common/Format.h | 2 +- src/Common/Password.c | 14 +++++++------- src/Common/Password.h | 4 ++-- src/Common/Pkcs5.c | 22 +++++++++++----------- src/Common/Pkcs5.h | 2 +- src/Common/Volumes.c | 22 +++++++++++----------- src/Common/Volumes.h | 6 +++--- 17 files changed, 82 insertions(+), 82 deletions(-) (limited to 'src/Common') diff --git a/src/Common/Apidrvr.h b/src/Common/Apidrvr.h index b61370c7..ee40aa8a 100644 --- a/src/Common/Apidrvr.h +++ b/src/Common/Apidrvr.h @@ -104,8 +104,8 @@ typedef struct int ProtectedHidVolPkcs5Prf; BOOL bTrueCryptMode; uint32 BytesPerPhysicalSector; - int VolumePin; - int ProtectedHidVolPin; + int VolumePim; + int ProtectedHidVolPim; } MOUNT_STRUCT; typedef struct @@ -145,7 +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; + int volumePim; } VOLUME_PROPERTIES_STRUCT; typedef struct @@ -244,7 +244,7 @@ typedef struct { Password VolumePassword; int pkcs5_prf; - int pin; + int pim; } ReopenBootVolumeHeaderRequest; diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp index 5670a1ac..2964e04d 100644 --- a/src/Common/BootEncryption.cpp +++ b/src/Common/BootEncryption.cpp @@ -1737,21 +1737,21 @@ namespace VeraCrypt #ifndef SETUP - void BootEncryption::CreateVolumeHeader (uint64 volumeSize, uint64 encryptedAreaStart, Password *password, int ea, int mode, int pkcs5, int pin) + void BootEncryption::CreateVolumeHeader (uint64 volumeSize, uint64 encryptedAreaStart, Password *password, int ea, int mode, int pkcs5, int pim) { PCRYPTO_INFO cryptoInfo = NULL; if (!IsRandomNumberGeneratorStarted()) throw ParameterIncorrect (SRC_POS); - throw_sys_if (CreateVolumeHeaderInMemory (ParentWindow, TRUE, (char *) VolumeHeader, ea, mode, password, pkcs5, pin, NULL, &cryptoInfo, + throw_sys_if (CreateVolumeHeaderInMemory (ParentWindow, TRUE, (char *) VolumeHeader, ea, mode, password, pkcs5, pim, NULL, &cryptoInfo, volumeSize, 0, encryptedAreaStart, 0, TC_SYSENC_KEYSCOPE_MIN_REQ_PROG_VERSION, TC_HEADER_FLAG_ENCRYPTED_SYSTEM, TC_SECTOR_SIZE_BIOS, FALSE) != 0); finally_do_arg (PCRYPTO_INFO*, &cryptoInfo, { crypto_close (*finally_arg); }); // Initial rescue disk assumes encryption of the drive has been completed (EncryptedAreaLength == volumeSize) memcpy (RescueVolumeHeader, VolumeHeader, sizeof (RescueVolumeHeader)); - if (0 != ReadVolumeHeader (TRUE, (char *) RescueVolumeHeader, password, pkcs5, pin, FALSE, NULL, cryptoInfo)) + if (0 != ReadVolumeHeader (TRUE, (char *) RescueVolumeHeader, password, pkcs5, pim, FALSE, NULL, cryptoInfo)) throw ParameterIncorrect (SRC_POS); DecryptBuffer (RescueVolumeHeader + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, cryptoInfo); @@ -2234,7 +2234,7 @@ namespace VeraCrypt } - int BootEncryption::ChangePassword (Password *oldPassword, int old_pkcs5, int old_pin, Password *newPassword, int pkcs5, int pin, int wipePassCount, HWND hwndDlg) + int BootEncryption::ChangePassword (Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg) { BootEncryptionStatus encStatus = GetStatus(); @@ -2277,7 +2277,7 @@ namespace VeraCrypt PCRYPTO_INFO cryptoInfo = NULL; - int status = ReadVolumeHeader (!encStatus.HiddenSystem, header, oldPassword, old_pkcs5, old_pin, FALSE, &cryptoInfo, NULL); + int status = ReadVolumeHeader (!encStatus.HiddenSystem, header, oldPassword, old_pkcs5, old_pim, FALSE, &cryptoInfo, NULL); finally_do_arg (PCRYPTO_INFO, cryptoInfo, { if (finally_arg) crypto_close (finally_arg); }); if (status != 0) @@ -2339,7 +2339,7 @@ namespace VeraCrypt cryptoInfo->mode, newPassword, cryptoInfo->pkcs5, - pin, + pim, (char *) cryptoInfo->master_keydata, &tmpCryptoInfo, cryptoInfo->VolumeSize.Value, @@ -2383,7 +2383,7 @@ namespace VeraCrypt ReopenBootVolumeHeaderRequest reopenRequest; reopenRequest.VolumePassword = *newPassword; reopenRequest.pkcs5_prf = cryptoInfo->pkcs5; - reopenRequest.pin = pin; + reopenRequest.pim = pim; finally_do_arg (ReopenBootVolumeHeaderRequest*, &reopenRequest, { burn (finally_arg, sizeof (*finally_arg)); }); CallDriver (TC_IOCTL_REOPEN_BOOT_VOLUME_HEADER, &reopenRequest, sizeof (reopenRequest)); @@ -2444,7 +2444,7 @@ namespace VeraCrypt } - void BootEncryption::PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pin, const string &rescueIsoImagePath) + void BootEncryption::PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pim, const string &rescueIsoImagePath) { BootEncryptionStatus encStatus = GetStatus(); if (encStatus.DriveMounted) @@ -2497,7 +2497,7 @@ namespace VeraCrypt SelectedEncryptionAlgorithmId = ea; SelectedPrfAlgorithmId = pkcs5; - CreateVolumeHeader (volumeSize, encryptedAreaStart, &password, ea, mode, pkcs5, pin); + CreateVolumeHeader (volumeSize, encryptedAreaStart, &password, ea, mode, pkcs5, pim); if (!rescueIsoImagePath.empty()) CreateRescueIsoImage (true, rescueIsoImagePath); diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h index e8b57211..745c343b 100644 --- a/src/Common/BootEncryption.h +++ b/src/Common/BootEncryption.h @@ -144,7 +144,7 @@ namespace VeraCrypt void AbortSetup (); void AbortSetupWait (); void CallDriver (DWORD ioctl, void *input = nullptr, DWORD inputSize = 0, void *output = nullptr, DWORD outputSize = 0); - int ChangePassword (Password *oldPassword, int old_pkcs5, int old_pin, Password *newPassword, int pkcs5, int pin, int wipePassCount, HWND hwndDlg); + int ChangePassword (Password *oldPassword, int old_pkcs5, int old_pim, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg); void CheckDecoyOSWipeResult (); void CheckEncryptionSetupResult (); void CheckRequirements (); @@ -170,7 +170,7 @@ namespace VeraCrypt bool IsHiddenSystemRunning (); bool IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly); void PrepareHiddenOSCreation (int ea, int mode, int pkcs5); - void PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pin, const string &rescueIsoImagePath); + void PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pim, const string &rescueIsoImagePath); void ProbeRealSystemDriveSize (); void ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig = nullptr, string *customUserMessage = nullptr, uint16 *bootLoaderVersion = nullptr); uint32 ReadDriverConfigurationFlags (); @@ -204,7 +204,7 @@ namespace VeraCrypt void BackupSystemLoader (); void CreateBootLoaderInMemory (byte *buffer, size_t bufferSize, bool rescueDisk, bool hiddenOSCreation = false); - void CreateVolumeHeader (uint64 volumeSize, uint64 encryptedAreaStart, Password *password, int ea, int mode, int pkcs5, int pin); + void CreateVolumeHeader (uint64 volumeSize, uint64 encryptedAreaStart, Password *password, int ea, int mode, int pkcs5, int pim); string GetSystemLoaderBackupPath (); uint32 GetChecksum (byte *data, size_t size); DISK_GEOMETRY GetDriveGeometry (int driveNumber); diff --git a/src/Common/Cache.c b/src/Common/Cache.c index f4489ccf..1fcbe665 100644 --- a/src/Common/Cache.c +++ b/src/Common/Cache.c @@ -21,7 +21,7 @@ Password CachedPasswords[CACHE_SIZE]; int cacheEmpty = 1; static int nPasswordIdx = 0; -int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *password, int pkcs5_prf, int pin, BOOL truecryptMode, PCRYPTO_INFO *retInfo) +int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo) { int nReturnCode = ERR_PASSWORD_WRONG; int i; @@ -29,7 +29,7 @@ int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *pas /* Attempt to recognize volume using mount password */ if (password->Length > 0) { - nReturnCode = ReadVolumeHeader (bBoot, header, password, pkcs5_prf, pin, truecryptMode, retInfo, NULL); + nReturnCode = ReadVolumeHeader (bBoot, header, password, pkcs5_prf, pim, truecryptMode, retInfo, NULL); /* Save mount passwords back into cache if asked to do so */ if (bCache && (nReturnCode == 0 || nReturnCode == ERR_CIPHER_INIT_WEAK_KEY)) @@ -59,7 +59,7 @@ int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *pas { if (CachedPasswords[i].Length > 0) { - nReturnCode = ReadVolumeHeader (bBoot, header, &CachedPasswords[i], pkcs5_prf, pin, truecryptMode, retInfo, NULL); + nReturnCode = ReadVolumeHeader (bBoot, header, &CachedPasswords[i], pkcs5_prf, pim, truecryptMode, retInfo, NULL); if (nReturnCode != ERR_PASSWORD_WRONG) break; diff --git a/src/Common/Cache.h b/src/Common/Cache.h index bdd96e98..5378b498 100644 --- a/src/Common/Cache.h +++ b/src/Common/Cache.h @@ -19,5 +19,5 @@ extern int cacheEmpty; void AddPasswordToCache (Password *password); -int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *password, int pkcs5_prf, int pin, BOOL truecryptMode, PCRYPTO_INFO *retInfo); +int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo); void WipeCache (void); diff --git a/src/Common/Common.h b/src/Common/Common.h index 5893a268..ca8a7571 100644 --- a/src/Common/Common.h +++ b/src/Common/Common.h @@ -76,7 +76,7 @@ typedef struct BOOL UseBackupHeader; BOOL RecoveryMode; int ProtectedHidVolPkcs5Prf; - int ProtectedHidVolPin; + int ProtectedHidVolPim; } MountOptions; #endif diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h index ff743890..df1b9f4b 100644 --- a/src/Common/Crypto.h +++ b/src/Common/Crypto.h @@ -213,7 +213,7 @@ typedef struct CRYPTO_INFO_t unsigned __int8 salt[PKCS5_SALT_SIZE]; int noIterations; BOOL bTrueCryptMode; - int volumePin; + int volumePim; uint64 volume_creation_time; // Legacy uint64 header_creation_time; // Legacy diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index a317f607..478af87c 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -6543,7 +6543,7 @@ int MountVolume (HWND hwndDlg, char *volumePath, Password *password, int pkcs5, - int pin, + int pim, BOOL truecryptMode, BOOL cachePassword, BOOL sharedAccess, @@ -6606,7 +6606,7 @@ retry: mount.ProtectedHidVolPassword = mountOptions->ProtectedHidVolPassword; mount.bProtectHiddenVolume = TRUE; mount.ProtectedHidVolPkcs5Prf = mountOptions->ProtectedHidVolPkcs5Prf; - mount.ProtectedHidVolPin = mountOptions->ProtectedHidVolPin; + mount.ProtectedHidVolPim = mountOptions->ProtectedHidVolPim; } else mount.bProtectHiddenVolume = FALSE; @@ -6618,7 +6618,7 @@ retry: mount.bMountManager = TRUE; mount.pkcs5_prf = pkcs5; mount.bTrueCryptMode = truecryptMode; - mount.VolumePin = pin; + mount.VolumePim = pim; // Windows 2000 mount manager causes problems with remounted volumes if (CurrentOSMajor == 5 && CurrentOSMinor == 0) @@ -9314,7 +9314,7 @@ void ReportUnexpectedState (char *techInfo) #ifndef SETUP -int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *password, int pkcs5_prf, int pin, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader) +int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader) { int status = ERR_PARAMETER_INCORRECT; int volumeType; @@ -9464,7 +9464,7 @@ int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *pa } // Decrypt volume header - status = ReadVolumeHeader (FALSE, buffer, password, pkcs5_prf, pin, truecryptMode, &context->CryptoInfo, NULL); + status = ReadVolumeHeader (FALSE, buffer, password, pkcs5_prf, pim, truecryptMode, &context->CryptoInfo, NULL); if (status == ERR_PASSWORD_WRONG) continue; // Try next volume type @@ -9509,7 +9509,7 @@ void CloseVolume (OpenVolumeContext *context) } -int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pin, BOOL wipeMode) +int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pim, BOOL wipeMode) { CRYPTO_INFO *newCryptoInfo = NULL; @@ -9531,7 +9531,7 @@ int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO * cryptoInfo->mode, password, cryptoInfo->pkcs5, - pin, + pim, (char *) cryptoInfo->master_keydata, &newCryptoInfo, cryptoInfo->VolumeSize.Value, @@ -10762,29 +10762,29 @@ std::string FindLatestFileOrDirectory (const std::string &directory, const char return string (directory) + "\\" + name; } -int GetPin (HWND hwndDlg, UINT ctrlId) +int GetPim (HWND hwndDlg, UINT ctrlId) { - int pin = 0; + int pim = 0; if (IsWindowEnabled (GetDlgItem (hwndDlg, ctrlId))) { char szTmp[MAX_PIM + 1] = {0}; if (GetDlgItemText (hwndDlg, ctrlId, szTmp, MAX_PIM + 1) > 0) { char* endPtr = NULL; - pin = strtol(szTmp, &endPtr, 10); - if (pin < 0 || endPtr == szTmp || !endPtr || *endPtr != '\0') - pin = 0; + pim = strtol(szTmp, &endPtr, 10); + if (pim < 0 || endPtr == szTmp || !endPtr || *endPtr != '\0') + pim = 0; } } - return pin; + return pim; } -void SetPin (HWND hwndDlg, UINT ctrlId, int pin) +void SetPim (HWND hwndDlg, UINT ctrlId, int pim) { - if (pin > 0) + if (pim > 0) { char szTmp[MAX_PIM + 1]; - StringCbPrintfA (szTmp, sizeof(szTmp), "%d", pin); + StringCbPrintfA (szTmp, sizeof(szTmp), "%d", pim); SetDlgItemText (hwndDlg, ctrlId, szTmp); } else diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index 1d0db30c..175282fe 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -334,7 +334,7 @@ BOOL IsDriveAvailable (int driveNo); BOOL IsDeviceMounted (char *deviceName); int DriverUnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forced); void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap); -int MountVolume (HWND hwndDlg, int driveNo, char *volumePath, Password *password, int pkcs5, int pin, BOOL truecryptMode, BOOL cachePassword, BOOL sharedAccess, const MountOptions* const mountOptions, BOOL quiet, BOOL bReportWrongPassword); +int MountVolume (HWND hwndDlg, int driveNo, char *volumePath, Password *password, int pkcs5, int pim, BOOL truecryptMode, BOOL cachePassword, BOOL sharedAccess, const MountOptions* const mountOptions, BOOL quiet, BOOL bReportWrongPassword); BOOL UnmountVolume (HWND hwndDlg , int nDosDriveNo, BOOL forceUnmount); BOOL UnmountVolumeAfterFormatExCall (HWND hwndDlg, int nDosDriveNo); BOOL IsPasswordCacheEmpty (void); @@ -462,9 +462,9 @@ void AccommodateTextField (HWND hwndDlg, UINT ctrlId, BOOL bFirstUpdate, HFONT h BOOL GetDriveLabel (int driveNo, wchar_t *label, int labelSize); BOOL GetSysDevicePaths (HWND hwndDlg); BOOL DoDriverInstall (HWND hwndDlg); -int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *password, int pkcs5_prf, int pin, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader); +int OpenVolume (OpenVolumeContext *context, const char *volumePath, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, BOOL write, BOOL preserveTimestamps, BOOL useBackupHeader); void CloseVolume (OpenVolumeContext *context); -int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pin, BOOL wipeMode); +int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pim, BOOL wipeMode); BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly); BOOL IsPagingFileWildcardActive (); BOOL DisablePagingFile (); @@ -483,8 +483,8 @@ BOOL VolumePathExists (const char *volumePath); BOOL IsWindowsIsoBurnerAvailable (); BOOL LaunchWindowsIsoBurner (HWND hwnd, const char *isoPath); BOOL IsApplicationInstalled (const char *appName); -int GetPin (HWND hwndDlg, UINT ctrlId); -void SetPin (HWND hwndDlg, UINT ctrlId, int pin); +int GetPim (HWND hwndDlg, UINT ctrlId); +void SetPim (HWND hwndDlg, UINT ctrlId, int pim); #ifdef __cplusplus } diff --git a/src/Common/Format.c b/src/Common/Format.c index 43686a8c..3c6ea295 100644 --- a/src/Common/Format.c +++ b/src/Common/Format.c @@ -150,7 +150,7 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams) FIRST_MODE_OF_OPERATION_ID, volParams->password, volParams->pkcs5, - volParams->pin, + volParams->pim, NULL, &cryptoInfo, dataAreaSize, @@ -543,7 +543,7 @@ begin_format: FIRST_MODE_OF_OPERATION_ID, volParams->password, volParams->pkcs5, - volParams->pin, + volParams->pim, cryptoInfo->master_keydata, &cryptoInfo, dataAreaSize, @@ -630,7 +630,7 @@ error: mountOptions.PartitionInInactiveSysEncScope = FALSE; mountOptions.UseBackupHeader = FALSE; - if (MountVolume (volParams->hwndDlg, driveNo, volParams->volumePath, volParams->password, volParams->pkcs5, volParams->pin, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1) + if (MountVolume (volParams->hwndDlg, driveNo, volParams->volumePath, volParams->password, volParams->pkcs5, volParams->pim, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1) { MessageBoxW (volParams->hwndDlg, GetString ("CANT_MOUNT_VOLUME"), lpszTitle, ICON_HAND); MessageBoxW (volParams->hwndDlg, GetString ("FORMAT_NTFS_STOP"), lpszTitle, ICON_HAND); diff --git a/src/Common/Format.h b/src/Common/Format.h index dd2a920d..a272ee01 100644 --- a/src/Common/Format.h +++ b/src/Common/Format.h @@ -39,7 +39,7 @@ typedef struct int sectorSize; int *realClusterSize; Password *password; - int pin; + int pim; HWND hwndDlg; } FORMAT_VOL_PARAMETERS; diff --git a/src/Common/Password.c b/src/Common/Password.c index b3dd54bb..f8cf4616 100644 --- a/src/Common/Password.c +++ b/src/Common/Password.c @@ -111,12 +111,12 @@ BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw) } -BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pin, BOOL bForBoot, BOOL bSkipPasswordWarning) +BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, BOOL bSkipPasswordWarning) { - BOOL bCustomPinSmall = ((pin != 0) && (pin < (bForBoot? 98 : 485)))? TRUE : FALSE; + BOOL bCustomPimSmall = ((pim != 0) && (pim < (bForBoot? 98 : 485)))? TRUE : FALSE; if (passwordLength < PASSWORD_LEN_WARNING) { - if (bCustomPinSmall) + if (bCustomPimSmall) { Error (bForBoot? "BOOT_PIM_REQUIRE_LONG_PASSWORD": "PIM_REQUIRE_LONG_PASSWORD", hwndDlg); return FALSE; @@ -128,7 +128,7 @@ BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pin #endif } #ifndef _DEBUG - else if (bCustomPinSmall) + else if (bCustomPimSmall) { if (MessageBoxW (hwndDlg, GetString ("PIM_SMALL_WARNING"), lpszTitle, MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2) != IDYES) return FALSE; @@ -137,7 +137,7 @@ BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pin return TRUE; } -int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pin, BOOL truecryptMode, Password *newPassword, int pkcs5, int pin, int wipePassCount, HWND hwndDlg) +int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg) { int nDosLinkCreated = 1, nStatus = ERR_OS_ERROR; char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH]; @@ -305,7 +305,7 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int /* Try to decrypt the header */ - nStatus = ReadVolumeHeader (FALSE, buffer, oldPassword, old_pkcs5, old_pin, truecryptMode, &cryptoInfo, NULL); + nStatus = ReadVolumeHeader (FALSE, buffer, oldPassword, old_pkcs5, old_pim, truecryptMode, &cryptoInfo, NULL); if (nStatus == ERR_CIPHER_INIT_WEAK_KEY) nStatus = 0; // We can ignore this error here @@ -371,7 +371,7 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int cryptoInfo->mode, newPassword, cryptoInfo->pkcs5, - pin, + pim, cryptoInfo->master_keydata, &ci, cryptoInfo->VolumeSize.Value, diff --git a/src/Common/Password.h b/src/Common/Password.h index 1aa45117..b3d2e628 100644 --- a/src/Common/Password.h +++ b/src/Common/Password.h @@ -36,9 +36,9 @@ typedef struct #if defined(_WIN32) && !defined(TC_WINDOWS_DRIVER) void VerifyPasswordAndUpdate ( HWND hwndDlg , HWND hButton , HWND hPassword , HWND hVerify , unsigned char *szPassword , char *szVerify, BOOL keyFilesEnabled ); -BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pin, BOOL bForBoot, BOOL bSkipPasswordWarning); +BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, BOOL bSkipPasswordWarning); BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw); -int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pin, BOOL truecryptMode, Password *newPassword, int pkcs5, int pin, int wipePassCount, HWND hwndDlg); +int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg); #endif // defined(_WIN32) && !defined(TC_WINDOWS_DRIVER) diff --git a/src/Common/Pkcs5.c b/src/Common/Pkcs5.c index 3e03ade2..ea0a9874 100644 --- a/src/Common/Pkcs5.c +++ b/src/Common/Pkcs5.c @@ -129,7 +129,7 @@ static void derive_u_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, u #ifdef TC_WINDOWS_BOOT /* In bootloader mode, least significant bit of iterations is a boolean (TRUE for boot derivation mode, FALSE otherwise) - * and the most significant 16 bits hold the pin value + * and the most significant 16 bits hold the pim value * This enables us to save code space needed for implementing other features. */ c = iterations >> 16; @@ -483,7 +483,7 @@ static void derive_u_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len #ifdef TC_WINDOWS_BOOT /* In bootloader mode, least significant bit of iterations is a boolean (TRUE for boot derivation mode, FALSE otherwise) - * and the most significant 16 bits hold the pin value + * and the most significant 16 bits hold the pim value * This enables us to save code space needed for implementing other features. */ c = iterations >> 16; @@ -757,10 +757,10 @@ char *get_pkcs5_prf_name (int pkcs5_prf_id) -int get_pkcs5_iteration_count (int pkcs5_prf_id, int pin, BOOL truecryptMode, BOOL bBoot) +int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BOOL bBoot) { - if ( (pin < 0) - || (truecryptMode && pin > 0) /* No PIM for TrueCrypt mode */ + if ( (pim < 0) + || (truecryptMode && pim > 0) /* No PIM for TrueCrypt mode */ ) { return 0; @@ -772,27 +772,27 @@ int get_pkcs5_iteration_count (int pkcs5_prf_id, int pin, BOOL truecryptMode, BO case RIPEMD160: if (truecryptMode) return bBoot ? 1000 : 2000; - else if (pin == 0) + else if (pim == 0) return bBoot? 327661 : 655331; else { - return bBoot? pin * 2048 : 15000 + pin * 1000; + return bBoot? pim * 2048 : 15000 + pim * 1000; } case SHA512: - return truecryptMode? 1000 : ((pin == 0)? 500000 : 15000 + pin * 1000); + return truecryptMode? 1000 : ((pim == 0)? 500000 : 15000 + pim * 1000); case WHIRLPOOL: - return truecryptMode? 1000 : ((pin == 0)? 500000 : 15000 + pin * 1000); + return truecryptMode? 1000 : ((pim == 0)? 500000 : 15000 + pim * 1000); case SHA256: if (truecryptMode) return 0; // SHA-256 not supported by TrueCrypt - else if (pin == 0) + else if (pim == 0) return bBoot? 200000 : 500000; else { - return bBoot? pin * 2048 : 15000 + pin * 1000; + return bBoot? pim * 2048 : 15000 + pim * 1000; } default: diff --git a/src/Common/Pkcs5.h b/src/Common/Pkcs5.h index d1dca7e3..1ad585d0 100644 --- a/src/Common/Pkcs5.h +++ b/src/Common/Pkcs5.h @@ -34,7 +34,7 @@ void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, uin void hmac_whirlpool (char *k, int lk, char *d, int ld); void derive_key_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen); -int get_pkcs5_iteration_count (int pkcs5_prf_id, int pin, BOOL truecryptMode, BOOL bBoot); +int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BOOL bBoot); char *get_pkcs5_prf_name (int pkcs5_prf_id); #if defined(__cplusplus) diff --git a/src/Common/Volumes.c b/src/Common/Volumes.c index 283be2ea..d557d171 100644 --- a/src/Common/Volumes.c +++ b/src/Common/Volumes.c @@ -163,7 +163,7 @@ typedef struct BOOL ReadVolumeHeaderRecoveryMode = FALSE; -int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int selected_pkcs5_prf, int pin, BOOL truecryptMode, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo) +int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int selected_pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo) { char header[TC_VOLUME_HEADER_EFFECTIVE_SIZE]; KEY_INFO keyInfo; @@ -274,7 +274,7 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int EncryptionThreadPoolBeginKeyDerivation (&keyDerivationCompletedEvent, &noOutstandingWorkItemEvent, &item->KeyReady, &outstandingWorkItemCount, enqPkcs5Prf, keyInfo.userKey, - keyInfo.keyLength, keyInfo.salt, get_pkcs5_iteration_count (enqPkcs5Prf, pin, truecryptMode, bBoot), item->DerivedKey); + keyInfo.keyLength, keyInfo.salt, get_pkcs5_iteration_count (enqPkcs5Prf, pim, truecryptMode, bBoot), item->DerivedKey); ++queuedWorkItems; break; @@ -296,7 +296,7 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int if (!item->Free && InterlockedExchangeAdd (&item->KeyReady, 0) == TRUE) { pkcs5_prf = item->Pkcs5Prf; - keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, pin, truecryptMode, bBoot); + keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, pim, truecryptMode, bBoot); memcpy (dk, item->DerivedKey, sizeof (dk)); item->Free = TRUE; @@ -314,7 +314,7 @@ KeyReady: ; else { pkcs5_prf = enqPkcs5Prf; - keyInfo.noIterations = get_pkcs5_iteration_count (enqPkcs5Prf, pin, truecryptMode, bBoot); + keyInfo.noIterations = get_pkcs5_iteration_count (enqPkcs5Prf, pim, truecryptMode, bBoot); switch (pkcs5_prf) { @@ -494,7 +494,7 @@ KeyReady: ; cryptoInfo->pkcs5 = pkcs5_prf; cryptoInfo->noIterations = keyInfo.noIterations; cryptoInfo->bTrueCryptMode = truecryptMode; - cryptoInfo->volumePin = pin; + cryptoInfo->volumePim = pim; goto ret; } @@ -517,7 +517,7 @@ KeyReady: ; cryptoInfo->pkcs5 = pkcs5_prf; cryptoInfo->noIterations = keyInfo.noIterations; cryptoInfo->bTrueCryptMode = truecryptMode; - cryptoInfo->volumePin = pin; + cryptoInfo->volumePim = pim; // Init the cipher with the decrypted master key status = EAInit (cryptoInfo->ea, keyInfo.master_keydata + primaryKeyOffset, cryptoInfo->ks); @@ -580,7 +580,7 @@ ret: #else // TC_WINDOWS_BOOT -int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pin, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo) +int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pim, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo) { #ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE char dk[32 * 2]; // 2 * 256-bit key @@ -590,7 +590,7 @@ int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pin, PCR PCRYPTO_INFO cryptoInfo; int status = ERR_SUCCESS; - uint32 iterations = pin; + uint32 iterations = pim; iterations <<= 16; iterations |= bBoot; @@ -750,7 +750,7 @@ ret: // Creates a volume header in memory int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea, int mode, Password *password, - int pkcs5_prf, int pin, char *masterKeydata, PCRYPTO_INFO *retInfo, + int pkcs5_prf, int pim, char *masterKeydata, PCRYPTO_INFO *retInfo, unsigned __int64 volumeSize, unsigned __int64 hiddenVolumeSize, unsigned __int64 encryptedAreaStart, unsigned __int64 encryptedAreaLength, uint16 requiredProgramVersion, uint32 headerFlags, uint32 sectorSize, BOOL bWipeMode) { @@ -799,7 +799,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea, // User key memcpy (keyInfo.userKey, password->Text, nUserKeyLen); keyInfo.keyLength = nUserKeyLen; - keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, pin, FALSE, bBoot); + keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, pim, FALSE, bBoot); // User selected encryption algorithm cryptoInfo->ea = ea; @@ -808,7 +808,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea, cryptoInfo->pkcs5 = pkcs5_prf; cryptoInfo->bTrueCryptMode = FALSE; cryptoInfo->noIterations = keyInfo.noIterations; - cryptoInfo->volumePin = pin; + cryptoInfo->volumePim = pim; // Mode of operation cryptoInfo->mode = mode; diff --git a/src/Common/Volumes.h b/src/Common/Volumes.h index 080589ff..76a14966 100644 --- a/src/Common/Volumes.h +++ b/src/Common/Volumes.h @@ -127,13 +127,13 @@ uint16 GetHeaderField16 (byte *header, int offset); uint32 GetHeaderField32 (byte *header, int offset); UINT64_STRUCT GetHeaderField64 (byte *header, int offset); #ifdef TC_WINDOWS_BOOT -int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pin, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo); +int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pim, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo); #else -int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pkcs5_prf, int pin, BOOL truecryptMode, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo); +int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pkcs5_prf, int pim, BOOL truecryptMode, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo); #endif #if !defined (DEVICE_DRIVER) && !defined (TC_WINDOWS_BOOT) -int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *encryptedHeader, int ea, int mode, Password *password, int pkcs5_prf, int pin, char *masterKeydata, PCRYPTO_INFO *retInfo, unsigned __int64 volumeSize, unsigned __int64 hiddenVolumeSize, unsigned __int64 encryptedAreaStart, unsigned __int64 encryptedAreaLength, uint16 requiredProgramVersion, uint32 headerFlags, uint32 sectorSize, BOOL bWipeMode); +int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *encryptedHeader, int ea, int mode, Password *password, int pkcs5_prf, int pim, char *masterKeydata, PCRYPTO_INFO *retInfo, unsigned __int64 volumeSize, unsigned __int64 hiddenVolumeSize, unsigned __int64 encryptedAreaStart, unsigned __int64 encryptedAreaLength, uint16 requiredProgramVersion, uint32 headerFlags, uint32 sectorSize, BOOL bWipeMode); BOOL ReadEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header, DWORD *bytesRead); BOOL WriteEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header); int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO *cryptoInfo, uint64 dataAreaSize, BOOL bPrimaryOnly, BOOL bBackupOnly); -- cgit v1.2.3