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/Format/InPlace.c | 18 +++++++------- src/Format/InPlace.h | 2 +- src/Format/Tcformat.c | 68 +++++++++++++++++++++++++-------------------------- src/Format/Tcformat.h | 2 +- 4 files changed, 45 insertions(+), 45 deletions(-) (limited to 'src/Format') diff --git a/src/Format/InPlace.c b/src/Format/InPlace.c index 80d6ab3e..c60a26f8 100644 --- a/src/Format/InPlace.c +++ b/src/Format/InPlace.c @@ -570,7 +570,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol FIRST_MODE_OF_OPERATION_ID, volParams->password, volParams->pkcs5, - volParams->pin, + volParams->pim, wipePass == 0 ? NULL : (char *) cryptoInfo->master_keydata, &cryptoInfo, dataAreaSize, @@ -610,7 +610,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol /* Now we will try to decrypt the backup header to verify it has been correctly written. */ - nStatus = OpenBackupHeader (dev, volParams->volumePath, volParams->password, volParams->pkcs5, volParams->pin, &cryptoInfo2, NULL, deviceSize); + nStatus = OpenBackupHeader (dev, volParams->volumePath, volParams->password, volParams->pkcs5, volParams->pim, &cryptoInfo2, NULL, deviceSize); if (nStatus != ERR_SUCCESS || cryptoInfo->EncryptedAreaStart.Value != cryptoInfo2->EncryptedAreaStart.Value @@ -726,7 +726,7 @@ int EncryptPartitionInPlaceResume (HANDLE dev, char *devicePath = volParams->volumePath; Password *password = volParams->password; int pkcs5_prf = volParams->pkcs5; - int pin = volParams->pin; + int pim = volParams->pim; DISK_GEOMETRY driveGeometry; HWND hwndDlg = volParams->hwndDlg; @@ -820,7 +820,7 @@ int EncryptPartitionInPlaceResume (HANDLE dev, sectorSize = driveGeometry.BytesPerSector; - nStatus = OpenBackupHeader (dev, devicePath, password, pkcs5_prf, pin, &masterCryptoInfo, headerCryptoInfo, deviceSize); + nStatus = OpenBackupHeader (dev, devicePath, password, pkcs5_prf, pim, &masterCryptoInfo, headerCryptoInfo, deviceSize); if (nStatus != ERR_SUCCESS) goto closing_seq; @@ -1050,7 +1050,7 @@ inplace_enc_read: headerCryptoInfo->mode, password, masterCryptoInfo->pkcs5, - pin, + pim, (char *) masterCryptoInfo->master_keydata, &tmpCryptoInfo, masterCryptoInfo->VolumeSize.Value, @@ -1201,7 +1201,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile Password *password = volParams->password; HWND hwndDlg = volParams->hwndDlg; int pkcs5_prf = volParams->pkcs5; - int pin = volParams->pin; + int pim = volParams->pim; DISK_GEOMETRY driveGeometry; @@ -1295,7 +1295,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile } - nStatus = OpenBackupHeader (dev, devicePath, password, pkcs5_prf, pin, &masterCryptoInfo, headerCryptoInfo, deviceSize); + nStatus = OpenBackupHeader (dev, devicePath, password, pkcs5_prf, pim, &masterCryptoInfo, headerCryptoInfo, deviceSize); if (nStatus != ERR_SUCCESS) goto closing_seq; @@ -2085,7 +2085,7 @@ closing_seq: } -static int OpenBackupHeader (HANDLE dev, const char *devicePath, Password *password, int pkcs5, int pin, PCRYPTO_INFO *retMasterCryptoInfo, CRYPTO_INFO *headerCryptoInfo, __int64 deviceSize) +static int OpenBackupHeader (HANDLE dev, const char *devicePath, Password *password, int pkcs5, int pim, PCRYPTO_INFO *retMasterCryptoInfo, CRYPTO_INFO *headerCryptoInfo, __int64 deviceSize) { LARGE_INTEGER offset; DWORD n; @@ -2111,7 +2111,7 @@ static int OpenBackupHeader (HANDLE dev, const char *devicePath, Password *passw } - nStatus = ReadVolumeHeader (FALSE, header, password, pkcs5, pin, FALSE, retMasterCryptoInfo, headerCryptoInfo); + nStatus = ReadVolumeHeader (FALSE, header, password, pkcs5, pim, FALSE, retMasterCryptoInfo, headerCryptoInfo); if (nStatus != ERR_SUCCESS) goto closing_seq; diff --git a/src/Format/InPlace.h b/src/Format/InPlace.h index d482c714..50af1805 100644 --- a/src/Format/InPlace.h +++ b/src/Format/InPlace.h @@ -40,7 +40,7 @@ static int ConcealNTFS (HANDLE dev); BOOL SaveNonSysInPlaceEncSettings (int delta, WipeAlgorithmId wipeAlgorithm, BOOL bDecrypting); static void ExportProgressStats (__int64 bytesDone, __int64 totalSize); int ZeroUnreadableSectors (HANDLE dev, LARGE_INTEGER startOffset, int64 size, int sectorSize, uint64 *zeroedSectorCount); -static int OpenBackupHeader (HANDLE dev, const char *devicePath, Password *password, int pkcs5, int pin, PCRYPTO_INFO *retCryptoInfo, CRYPTO_INFO *headerCryptoInfo, __int64 deviceSize); +static int OpenBackupHeader (HANDLE dev, const char *devicePath, Password *password, int pkcs5, int pim, PCRYPTO_INFO *retCryptoInfo, CRYPTO_INFO *headerCryptoInfo, __int64 deviceSize); BOOL MoveClustersBeforeThreshold (HANDLE volumeHandle, PWSTR volumeDevicePath, int64 clusterThreshold); #ifdef __cplusplus diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 523c069b..3e8fa7dd 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -229,7 +229,7 @@ Password volumePassword; /* User password */ char szVerify[MAX_PASSWORD + 1]; /* Tmp password buffer */ char szRawPassword[MAX_PASSWORD + 1]; /* Password before keyfile was applied to it */ -int volumePin = 0; +int volumePim = 0; BOOL bHistoryCmdLine = FALSE; /* History control is always disabled */ BOOL ComServerMode = FALSE; @@ -280,7 +280,7 @@ void CALLBACK ResumeInPlaceEncWaitThreadProc(void* pArg, HWND hwndDlg) if (device.Path == szDevicePath) { OpenVolumeContext volume; - int status = OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePin, FALSE, FALSE, FALSE, TRUE); + int status = OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePim, FALSE, FALSE, FALSE, TRUE); if ( status == ERR_SUCCESS) { @@ -326,7 +326,7 @@ void CALLBACK ResumeInPlaceEncWaitThreadProc(void* pArg, HWND hwndDlg) OpenVolumeContext volume; - if (OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePin, FALSE, FALSE, FALSE, TRUE) == ERR_SUCCESS) + if (OpenVolume (&volume, device.Path.c_str(), &volumePassword, hash_algo, volumePim, FALSE, FALSE, FALSE, TRUE) == ERR_SUCCESS) { if ((volume.CryptoInfo->HeaderFlags & TC_HEADER_FLAG_NONSYS_INPLACE_ENC) != 0 && volume.CryptoInfo->EncryptedAreaLength.Value != volume.CryptoInfo->VolumeSize.Value) @@ -382,7 +382,7 @@ static void WipePasswordsAndKeyfiles (void) burn (&szVerify[0], sizeof (szVerify)); burn (&volumePassword, sizeof (volumePassword)); burn (&szRawPassword[0], sizeof (szRawPassword)); - burn (&volumePin, sizeof (volumePin)); + burn (&volumePim, sizeof (volumePim)); SetWindowText (hPasswordInputField, ""); SetWindowText (hVerifyPasswordInputField, ""); @@ -2555,7 +2555,7 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg) volParams->sectorSize = GetFormatSectorSize(); volParams->realClusterSize = &realClusterSize; volParams->password = &volumePassword; - volParams->pin = volumePin; + volParams->pim = volumePim; volParams->hwndDlg = hwndDlg; if (bInPlaceDecNonSys) @@ -2627,7 +2627,7 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg) if (bHiddenVolHost && !bVolTransformThreadCancel && nStatus == 0) { /* Auto mount the newly created hidden volume host */ - switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePin, FALSE)) + switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePim, FALSE)) { case ERR_NO_FREE_DRIVES: MessageBoxW (hwndDlg, GetString ("NO_FREE_DRIVE_FOR_OUTER_VOL"), lpszTitle, ICON_HAND); @@ -2748,7 +2748,7 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg) // Clear the outer volume password memset(&szVerify[0], 0, sizeof (szVerify)); memset(&szRawPassword[0], 0, sizeof (szRawPassword)); - memset(&volumePin, 0, sizeof (volumePin)); + memset(&volumePim, 0, sizeof (volumePim)); MessageBeep (MB_OK); } @@ -3538,14 +3538,14 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { WORD lw = LOWORD (wParam); WORD hw = HIWORD (wParam); - static BOOL PinValueChangedWarning = FALSE; + static BOOL PimValueChangedWarning = FALSE; hCurPage = hwndDlg; switch (uMsg) { case WM_INITDIALOG: - PinValueChangedWarning = FALSE; + PimValueChangedWarning = FALSE; LocalizeDialog (hwndDlg, "IDD_VOL_CREATION_WIZARD_DLG"); UpdateLastDialogId (); @@ -4128,10 +4128,10 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetFocus (GetDlgItem (hwndDlg, IDC_PASSWORD_DIRECT)); SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, MAX_PIM, 0); - if (volumePin > 0) + if (volumePim > 0) { char szTmp[MAX_PIM + 1]; - StringCbPrintfA(szTmp, sizeof(szTmp), "%d", volumePin); + StringCbPrintfA(szTmp, sizeof(szTmp), "%d", volumePim); SetWindowText (GetDlgItem (hwndDlg, IDC_PIM), szTmp); } @@ -4242,13 +4242,13 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa case PIM_PAGE: { SendMessage (GetDlgItem (hwndDlg, IDC_PIM), EM_LIMITTEXT, SysEncInEffect()? MAX_BOOT_PIM: MAX_PIM, 0); - if (volumePin > 0) + if (volumePim > 0) { char szTmp[MAX_PIM + 1]; - StringCbPrintfA(szTmp, sizeof(szTmp), "%d", volumePin); + StringCbPrintfA(szTmp, sizeof(szTmp), "%d", volumePim); SetWindowText (GetDlgItem (hwndDlg, IDC_PIM), szTmp); - PinValueChangedWarning = TRUE; + PimValueChangedWarning = TRUE; SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING")); } @@ -5002,7 +5002,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa case WM_CTLCOLORSTATIC: { - if (PinValueChangedWarning && ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PIM_HELP)) ) + if (PimValueChangedWarning && ((HWND)lParam == GetDlgItem(hwndDlg, IDC_PIM_HELP)) ) { // we're about to draw the static // set the text colour in (HDC)lParam @@ -5396,14 +5396,14 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (lw == IDC_PIM) { - if(GetPin (hwndDlg, IDC_PIM) != 0) + if(GetPim (hwndDlg, IDC_PIM) != 0) { - PinValueChangedWarning = TRUE; + PimValueChangedWarning = TRUE; SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING")); } else { - PinValueChangedWarning = FALSE; + PimValueChangedWarning = FALSE; SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, (wchar_t *) GetDictionaryValueByInt (IDC_PIM_HELP)); } } @@ -5415,14 +5415,14 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { if (lw == IDC_PIM) { - if(GetPin (hwndDlg, IDC_PIM) != 0) + if(GetPim (hwndDlg, IDC_PIM) != 0) { - PinValueChangedWarning = TRUE; + PimValueChangedWarning = TRUE; SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, GetString (SysEncInEffect ()? "PIM_SYSENC_CHANGE_WARNING" : "PIM_CHANGE_WARNING")); } else { - PinValueChangedWarning = FALSE; + PimValueChangedWarning = FALSE; SetDlgItemTextW (hwndDlg, IDC_PIM_HELP, (wchar_t *) GetDictionaryValueByInt (IDC_PIM_HELP)); } } @@ -7146,19 +7146,19 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa else if (nCurPageNo == PIM_PAGE) { - volumePin = GetPin (hCurPage, IDC_PIM); + volumePim = GetPim (hCurPage, IDC_PIM); if (volumePassword.Length > 0) { // Password character encoding - if (SysEncInEffect() && (volumePin > MAX_BOOT_PIM_VALUE)) + if (SysEncInEffect() && (volumePim > MAX_BOOT_PIM_VALUE)) { SetFocus (GetDlgItem(hCurPage, IDC_PIM)); Error ("PIM_SYSENC_TOO_BIG", hwndDlg); return 1; } // Check password length (check also done for outer volume which is not the case in TrueCrypt). - else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, volumePin, SysEncInEffect(), TRUE)) + else if (!CheckPasswordLength (hwndDlg, volumePassword.Length, volumePim, SysEncInEffect(), TRUE)) { return 1; } @@ -7192,7 +7192,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa hash_algo = (int) SendMessage (GetDlgItem (hCurPage, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hCurPage, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0); - volumePin = GetPin (hCurPage, IDC_PIM); + volumePim = GetPim (hCurPage, IDC_PIM); // Store the password in case we need to restore it after keyfile is applied to it GetWindowText (GetDlgItem (hCurPage, IDC_PASSWORD_DIRECT), szRawPassword, sizeof (szRawPassword)); @@ -7231,7 +7231,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa // Mount the hidden volume host as read-only (to ensure consistent and secure // results of the volume bitmap scanning) - switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePin, TRUE)) + switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePim, TRUE)) { case ERR_NO_FREE_DRIVES: NormalCursor (); @@ -7399,7 +7399,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa // Check that it is not a hidden or legacy volume - if (MountVolume (hwndDlg, driveNo, szFileName, &volumePassword, hash_algo, volumePin, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1) + if (MountVolume (hwndDlg, driveNo, szFileName, &volumePassword, hash_algo, volumePim, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1) { NormalCursor(); return 1; @@ -7441,7 +7441,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa mountOptions.UseBackupHeader = TRUE; // This must be TRUE at this point (we won't be using the regular header, which will be lost soon after the decryption process starts) - if (MountVolume (hwndDlg, driveNo, szFileName, &volumePassword, hash_algo, volumePin, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1) + if (MountVolume (hwndDlg, driveNo, szFileName, &volumePassword, hash_algo, volumePim, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1) { NormalCursor(); return 1; @@ -7507,7 +7507,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa try { WaitCursor(); - BootEncObj->PrepareInstallation (!bWholeSysDrive, volumePassword, nVolumeEA, FIRST_MODE_OF_OPERATION_ID, hash_algo, volumePin, ""); + BootEncObj->PrepareInstallation (!bWholeSysDrive, volumePassword, nVolumeEA, FIRST_MODE_OF_OPERATION_ID, hash_algo, volumePim, ""); } catch (Exception &e) { @@ -8053,7 +8053,7 @@ retryCDDriveCheck: { // Remount the hidden volume host as read-only (to ensure consistent and secure // results of the volume bitmap scanning) - switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePin, TRUE)) + switch (MountHiddenVolHost (hwndDlg, szDiskFile, &hiddenVolHostDriveNo, &volumePassword, hash_algo, volumePim, TRUE)) { case ERR_NO_FREE_DRIVES: MessageBoxW (hwndDlg, GetString ("NO_FREE_DRIVE_FOR_OUTER_VOL"), lpszTitle, ICON_HAND); @@ -8301,7 +8301,7 @@ ovf_end: else if (nCurPageNo == PIM_PAGE) { - volumePin = GetPin (hCurPage, IDC_PIM); + volumePim = GetPim (hCurPage, IDC_PIM); } else if (nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE @@ -8878,7 +8878,7 @@ efsf_error: // Mounts a volume within which the user intends to create a hidden volume -int MountHiddenVolHost (HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pin, BOOL bReadOnly) +int MountHiddenVolHost (HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pim, BOOL bReadOnly) { MountOptions mountOptions; ZeroMemory (&mountOptions, sizeof (mountOptions)); @@ -8898,7 +8898,7 @@ int MountHiddenVolHost (HWND hwndDlg, char *volumePath, int *driveNo, Password * mountOptions.PartitionInInactiveSysEncScope = FALSE; mountOptions.UseBackupHeader = FALSE; - if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5_prf, pin, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1) + if (MountVolume (hwndDlg, *driveNo, volumePath, password, pkcs5_prf, pim, FALSE, FALSE, TRUE, &mountOptions, FALSE, TRUE) < 1) { *driveNo = -3; return ERR_VOL_MOUNT_FAILED; @@ -9592,7 +9592,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, char *lpszComm VirtualLock (&volumePassword, sizeof(volumePassword)); VirtualLock (szVerify, sizeof(szVerify)); VirtualLock (szRawPassword, sizeof(szRawPassword)); - VirtualLock (&volumePin, sizeof(volumePin)); + VirtualLock (&volumePim, sizeof(volumePim)); VirtualLock (MasterKeyGUIView, sizeof(MasterKeyGUIView)); VirtualLock (HeaderKeyGUIView, sizeof(HeaderKeyGUIView)); diff --git a/src/Format/Tcformat.h b/src/Format/Tcformat.h index 11d5b354..628e7223 100644 --- a/src/Format/Tcformat.h +++ b/src/Format/Tcformat.h @@ -68,7 +68,7 @@ static void NonSysInplaceEncPause (void); static void NonSysInplaceEncResume (void); void ShowNonSysInPlaceEncUIStatus (void); void UpdateNonSysInPlaceEncControls (void); -int MountHiddenVolHost ( HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pin, BOOL bReadOnly ); +int MountHiddenVolHost ( HWND hwndDlg, char *volumePath, int *driveNo, Password *password, int pkcs5_prf, int pim, BOOL bReadOnly ); int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSize, int *realClusterSize, __int64 *pnbrFreeClusters); int ScanVolClusterBitmap ( HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int64 *nbrFreeClusters); static void WipeStart (void); -- cgit v1.2.3