diff options
Diffstat (limited to 'src/Common')
-rw-r--r-- | src/Common/Apidrvr.h | 8 | ||||
-rw-r--r-- | src/Common/BootEncryption.cpp | 18 | ||||
-rw-r--r-- | src/Common/BootEncryption.h | 6 | ||||
-rw-r--r-- | src/Common/Cache.c | 6 | ||||
-rw-r--r-- | src/Common/Cache.h | 2 | ||||
-rw-r--r-- | src/Common/Common.h | 2 | ||||
-rw-r--r-- | src/Common/Crypto.h | 2 | ||||
-rw-r--r-- | src/Common/Dlgcode.c | 32 | ||||
-rw-r--r-- | src/Common/Dlgcode.h | 10 | ||||
-rw-r--r-- | src/Common/Format.c | 6 | ||||
-rw-r--r-- | src/Common/Format.h | 2 | ||||
-rw-r--r-- | src/Common/Password.c | 14 | ||||
-rw-r--r-- | src/Common/Password.h | 4 | ||||
-rw-r--r-- | src/Common/Pkcs5.c | 22 | ||||
-rw-r--r-- | src/Common/Pkcs5.h | 2 | ||||
-rw-r--r-- | src/Common/Volumes.c | 22 | ||||
-rw-r--r-- | src/Common/Volumes.h | 6 |
17 files changed, 82 insertions, 82 deletions
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 @@ -103,10 +103,10 @@ typedef struct int pkcs5_prf;
int ProtectedHidVolPkcs5Prf;
BOOL bTrueCryptMode;
uint32 BytesPerPhysicalSector;
- int VolumePin;
- int ProtectedHidVolPin;
+ int VolumePim;
+ int ProtectedHidVolPim;
} MOUNT_STRUCT;
typedef struct
{
@@ -144,9 +144,9 @@ typedef struct unsigned __int64 totalBytesRead;
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
{
@@ -243,9 +243,9 @@ typedef struct typedef struct
{
Password VolumePassword;
int pkcs5_prf;
- int pin;
+ int pim;
} ReopenBootVolumeHeaderRequest;
typedef struct
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 @@ -1736,23 +1736,23 @@ 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);
@@ -2233,9 +2233,9 @@ 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();
if (encStatus.SetupInProgress || (wipePassCount <= 0))
@@ -2276,9 +2276,9 @@ namespace VeraCrypt device.Read ((byte *) header, sizeof (header));
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)
{
@@ -2338,9 +2338,9 @@ namespace VeraCrypt cryptoInfo->ea,
cryptoInfo->mode,
newPassword,
cryptoInfo->pkcs5,
- pin,
+ pim,
(char *) cryptoInfo->master_keydata,
&tmpCryptoInfo,
cryptoInfo->VolumeSize.Value,
cryptoInfo->hiddenVolumeSize,
@@ -2382,9 +2382,9 @@ 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));
}
@@ -2443,9 +2443,9 @@ namespace VeraCrypt SelectedPrfAlgorithmId = pkcs5;
}
- 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)
throw ParameterIncorrect (SRC_POS);
@@ -2496,9 +2496,9 @@ 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 @@ -143,9 +143,9 @@ namespace VeraCrypt void AbortDecoyOSWipe ();
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 ();
void CheckRequirementsHiddenOS ();
@@ -169,9 +169,9 @@ namespace VeraCrypt bool IsCDDrivePresent ();
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 ();
void RegisterBootDriver (bool hiddenSystem);
@@ -203,9 +203,9 @@ namespace VeraCrypt static const uint32 RescueIsoImageSize = 1835008; // Size of ISO9660 image with bootable emulated 1.44MB floppy disk image
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);
PartitionList GetDrivePartitions (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 @@ -20,17 +20,17 @@ 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;
/* 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))
{
@@ -58,9 +58,9 @@ int ReadVolumeHeaderWCache (BOOL bBoot, BOOL bCache, char *header, Password *pas for (i = 0; i < CACHE_SIZE; i++)
{
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 @@ -18,6 +18,6 @@ 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 @@ -75,8 +75,8 @@ typedef struct Password ProtectedHidVolPassword; /* Password of hidden volume to protect against overwriting */
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 @@ -212,9 +212,9 @@ typedef struct CRYPTO_INFO_t unsigned __int8 k2[MASTER_KEYDATA_SIZE]; /* For XTS, this contains the secondary key (if cascade, multiple concatenated). For LRW (deprecated/legacy), it contains the tweak key. For CBC (deprecated/legacy), it contains the IV seed. */
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 @@ -6542,9 +6542,9 @@ int MountVolume (HWND hwndDlg, int driveNo,
char *volumePath,
Password *password,
int pkcs5,
- int pin,
+ int pim,
BOOL truecryptMode,
BOOL cachePassword,
BOOL sharedAccess,
const MountOptions* const mountOptions,
@@ -6605,9 +6605,9 @@ retry: {
mount.ProtectedHidVolPassword = mountOptions->ProtectedHidVolPassword;
mount.bProtectHiddenVolume = TRUE;
mount.ProtectedHidVolPkcs5Prf = mountOptions->ProtectedHidVolPkcs5Prf;
- mount.ProtectedHidVolPin = mountOptions->ProtectedHidVolPin;
+ mount.ProtectedHidVolPim = mountOptions->ProtectedHidVolPim;
}
else
mount.bProtectHiddenVolume = FALSE;
@@ -6617,9 +6617,9 @@ 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)
mount.bMountManager = FALSE;
@@ -9313,9 +9313,9 @@ 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;
char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH];
@@ -9463,9 +9463,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, 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
@@ -9508,9 +9508,9 @@ void CloseVolume (OpenVolumeContext *context) context->VolumeIsOpen = FALSE;
}
-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;
RandSetHashFunction (cryptoInfo->pkcs5);
@@ -9530,9 +9530,9 @@ int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO * cryptoInfo->ea,
cryptoInfo->mode,
password,
cryptoInfo->pkcs5,
- pin,
+ pim,
(char *) cryptoInfo->master_keydata,
&newCryptoInfo,
cryptoInfo->VolumeSize.Value,
cryptoInfo->hiddenVolume ? cryptoInfo->hiddenVolumeSize : 0,
@@ -10761,31 +10761,31 @@ 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
SetDlgItemText (hwndDlg, ctrlId, "");
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 @@ -333,9 +333,9 @@ int GetLastAvailableDrive (); 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);
BOOL IsMountedVolume (const char *volname);
@@ -461,11 +461,11 @@ void ToBootPwdField (HWND hwndDlg, UINT ctrlId); void AccommodateTextField (HWND hwndDlg, UINT ctrlId, BOOL bFirstUpdate, HFONT hFont);
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 ();
BOOL CALLBACK SecurityTokenPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -482,10 +482,10 @@ BOOL DisableFileCompression (HANDLE file); 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 @@ -149,9 +149,9 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams) volParams->ea,
FIRST_MODE_OF_OPERATION_ID,
volParams->password,
volParams->pkcs5,
- volParams->pin,
+ volParams->pim,
NULL,
&cryptoInfo,
dataAreaSize,
volParams->hiddenVol ? dataAreaSize : 0,
@@ -542,9 +542,9 @@ begin_format: volParams->ea,
FIRST_MODE_OF_OPERATION_ID,
volParams->password,
volParams->pkcs5,
- volParams->pin,
+ volParams->pim,
cryptoInfo->master_keydata,
&cryptoInfo,
dataAreaSize,
volParams->hiddenVol ? dataAreaSize : 0,
@@ -629,9 +629,9 @@ error: mountOptions.PreserveTimestamp = bPreserveTimestamp;
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);
nStatus = ERR_VOL_MOUNT_FAILED;
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 @@ -38,9 +38,9 @@ typedef struct BOOL quickFormat;
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 @@ -110,14 +110,14 @@ BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw) return TRUE;
}
-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;
}
@@ -127,18 +127,18 @@ BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pin return FALSE;
#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;
}
#endif
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];
char szDosDevice[TC_MAX_PATH];
@@ -304,9 +304,9 @@ 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
if (nStatus == ERR_PASSWORD_WRONG)
@@ -370,9 +370,9 @@ int ChangePwd (const char *lpszVolume, Password *oldPassword, int old_pkcs5, int cryptoInfo->ea,
cryptoInfo->mode,
newPassword,
cryptoInfo->pkcs5,
- pin,
+ pim,
cryptoInfo->master_keydata,
&ci,
cryptoInfo->VolumeSize.Value,
(volumeType == TC_VOLUME_TYPE_HIDDEN) ? cryptoInfo->hiddenVolumeSize : 0,
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 @@ -35,11 +35,11 @@ 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)
#ifdef __cplusplus
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 @@ -128,9 +128,9 @@ static void derive_u_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, u int i;
#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;
i = ((int) iterations) & 0x01;
@@ -482,9 +482,9 @@ static void derive_u_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len int i;
#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;
i = ((int) iterations) & 0x01;
@@ -756,12 +756,12 @@ 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;
}
@@ -771,29 +771,29 @@ 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:
TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID
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 @@ -33,9 +33,9 @@ void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, uin /* output written to d which must be at lease 64 bytes long */
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 @@ -162,9 +162,9 @@ 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;
PCRYPTO_INFO cryptoInfo;
@@ -273,9 +273,9 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int item->Pkcs5Prf = enqPkcs5Prf;
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;
}
@@ -295,9 +295,9 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int item = &keyDerivationWorkItems[i];
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;
--queuedWorkItems;
@@ -313,9 +313,9 @@ 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)
{
case RIPEMD160:
@@ -493,9 +493,9 @@ KeyReady: ; {
cryptoInfo->pkcs5 = pkcs5_prf;
cryptoInfo->noIterations = keyInfo.noIterations;
cryptoInfo->bTrueCryptMode = truecryptMode;
- cryptoInfo->volumePin = pin;
+ cryptoInfo->volumePim = pim;
goto ret;
}
cryptoInfo = *retInfo = crypto_open ();
@@ -516,9 +516,9 @@ KeyReady: ; memcpy (cryptoInfo->salt, keyInfo.salt, PKCS5_SALT_SIZE);
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);
if (status == ERR_CIPHER_INIT_FAILURE)
@@ -579,9 +579,9 @@ 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
#else
@@ -589,9 +589,9 @@ int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pin, PCR #endif
PCRYPTO_INFO cryptoInfo;
int status = ERR_SUCCESS;
- uint32 iterations = pin;
+ uint32 iterations = pim;
iterations <<= 16;
iterations |= bBoot;
if (retHeaderCryptoInfo != NULL)
@@ -749,9 +749,9 @@ ret: #endif
// 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)
{
unsigned char *p = (unsigned char *) header;
@@ -798,18 +798,18 @@ 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;
// User selected PRF
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 @@ -126,15 +126,15 @@ extern BOOL ReadVolumeHeaderRecoveryMode; 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);
#endif
|