VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount/Mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mount/Mount.c')
-rw-r--r--src/Mount/Mount.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index a851ebef..6ae6e417 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -4215,79 +4215,79 @@ BOOL CALLBACK VolumePropertiesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP
s = GetString ("UISTR_YES");
else if (prop.hiddenVolProtection == HIDVOL_PROT_STATUS_ACTION_TAKEN)
s = GetString ("HID_VOL_DAMAGE_PREVENTED");
ListSubItemSet (list, i++, 1, s);
}
// Encryption algorithm
ListItemAdd (list, i, GetString ("ENCRYPTION_ALGORITHM"));
if (prop.ea < EAGetFirst() || prop.ea > EAGetCount ())
{
ListSubItemSet (list, i, 1, L"?");
return 1;
}
EAGetName (szTmp, ARRAYSIZE(szTmp), prop.ea, 1);
ListSubItemSet (list, i++, 1, szTmp);
// Key size(s)
{
wchar_t name[128];
int size = EAGetKeySize (prop.ea);
EAGetName (name, ARRAYSIZE(name), prop.ea, 1);
// Primary key
ListItemAdd (list, i, GetString ("KEY_SIZE"));
StringCbPrintfW (sw, sizeof(sw), L"%d %s", size * 8, GetString ("BITS"));
ListSubItemSet (list, i++, 1, sw);
- if (wcscmp (EAGetModeName (prop.ea, prop.mode, TRUE), L"XTS") == 0)
+ if (wcscmp (EAGetModeName (prop.mode), L"XTS") == 0)
{
// Secondary key (XTS)
ListItemAdd (list, i, GetString ("SECONDARY_KEY_SIZE_XTS"));
ListSubItemSet (list, i++, 1, sw);
}
}
// Block size
ListItemAdd (list, i, GetString ("BLOCK_SIZE"));
StringCbPrintfW (sw, sizeof(sw), L"%d ", CipherGetBlockSize (EAGetFirstCipher(prop.ea))*8);
StringCbCatW (sw, sizeof(sw), GetString ("BITS"));
ListSubItemSet (list, i++, 1, sw);
// Mode
ListItemAdd (list, i, GetString ("MODE_OF_OPERATION"));
- ListSubItemSet (list, i++, 1, EAGetModeName (prop.ea, prop.mode, TRUE));
+ ListSubItemSet (list, i++, 1, EAGetModeName (prop.mode));
// PKCS 5 PRF
ListItemAdd (list, i, GetString ("PKCS5_PRF"));
if (prop.volumePim == 0)
ListSubItemSet (list, i++, 1, get_pkcs5_prf_name (prop.pkcs5));
else
{
StringCbPrintfW (szTmp, sizeof(szTmp), L"%s (Dynamic)", get_pkcs5_prf_name (prop.pkcs5));
ListSubItemSet (list, i++, 1, szTmp);
}
#if 0
// PCKS 5 iterations
ListItemAdd (list, i, GetString ("PKCS5_ITERATIONS"));
sprintf (szTmp, "%d", prop.pkcs5Iterations);
ListSubItemSet (list, i++, 1, szTmp);
#endif
#if 0
{
// Legacy
FILETIME ft, curFt;
LARGE_INTEGER ft64, curFt64;
SYSTEMTIME st;
wchar_t date[128];
memset (date, 0, sizeof (date));
// Volume date
ListItemAdd (list, i, GetString ("VOLUME_CREATE_DATE"));
@@ -11020,67 +11020,67 @@ noHidden:
SetRandomPoolEnrichedByUserStatus (FALSE);
NormalCursor();
UserEnrichRandomPool (hwndDlg);
WaitCursor();
// Temporary keys
if (!RandgetBytes (hwndDlg, temporaryKey, EAGetKeySize (volume.CryptoInfo->ea), TRUE)
|| !RandgetBytes (hwndDlg, volume.CryptoInfo->k2, sizeof (volume.CryptoInfo->k2), FALSE))
{
nStatus = ERR_PARAMETER_INCORRECT;
goto error;
}
if (EAInit (volume.CryptoInfo->ea, temporaryKey, volume.CryptoInfo->ks) != ERR_SUCCESS || !EAInitMode (volume.CryptoInfo, volume.CryptoInfo->k2))
{
nStatus = ERR_PARAMETER_INCORRECT;
goto error;
}
EncryptBuffer (backup, backupFileSize, volume.CryptoInfo);
memcpy (volume.CryptoInfo->k2, originalK2, sizeof (volume.CryptoInfo->k2));
if (EAInit (volume.CryptoInfo->ea, volume.CryptoInfo->master_keydata, volume.CryptoInfo->ks) != ERR_SUCCESS || !EAInitMode (volume.CryptoInfo, volume.CryptoInfo->k2))
{
nStatus = ERR_PARAMETER_INCORRECT;
goto error;
}
// Store header encrypted with a new key
- nStatus = ReEncryptVolumeHeader (hwndDlg, (char *) backup, FALSE, volume.CryptoInfo, &VolumePassword, VolumePim, FALSE);
+ nStatus = ReEncryptVolumeHeader (hwndDlg, backup, FALSE, volume.CryptoInfo, &VolumePassword, VolumePim, FALSE);
if (nStatus != ERR_SUCCESS)
goto error;
if (hiddenVolume.VolumeIsOpen)
{
- nStatus = ReEncryptVolumeHeader (hwndDlg, (char *) backup + (legacyVolume ? TC_VOLUME_HEADER_SIZE_LEGACY : TC_VOLUME_HEADER_SIZE),
+ nStatus = ReEncryptVolumeHeader (hwndDlg, backup + (legacyVolume ? TC_VOLUME_HEADER_SIZE_LEGACY : TC_VOLUME_HEADER_SIZE),
FALSE, hiddenVolume.CryptoInfo, &hiddenVolPassword, hiddenVolPim, FALSE);
if (nStatus != ERR_SUCCESS)
goto error;
}
if (_write (fBackup, backup, backupFileSize) == -1)
{
nStatus = ERR_OS_ERROR;
goto error;
}
/* Backup has been successfully created */
Warning("VOL_HEADER_BACKED_UP", hwndDlg);
ret:
nStatus = ERR_SUCCESS;
error:
DWORD dwError = GetLastError ();
CloseVolume (&volume);
CloseVolume (&hiddenVolume);
if (fBackup != -1)
_close (fBackup);
SetLastError (dwError);
if (nStatus != 0)
handleError (hwndDlg, nStatus, SRC_POS);
@@ -11211,61 +11211,61 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
burn (&GuiPkcs5, sizeof (GuiPkcs5));
burn (&GuiPim, sizeof (GuiPim));
}
WaitCursor();
if (KeyFilesEnable && FirstKeyFile)
KeyFilesApply (hwndDlg, &VolumePassword, FirstKeyFile, lpszVolume);
nStatus = OpenVolume (&volume, lpszVolume, &VolumePassword, VolumePkcs5, VolumePim,TRUE, bPreserveTimestamp, TRUE);
NormalCursor();
if (nStatus == ERR_SUCCESS)
break;
if (nStatus != ERR_PASSWORD_WRONG)
goto error;
handleError (hwndDlg, nStatus, SRC_POS);
}
if (volume.CryptoInfo->LegacyVolume)
{
Error ("VOLUME_HAS_NO_BACKUP_HEADER", hwndDlg);
nStatus = ERROR_SUCCESS;
goto error;
}
// Create a new header with a new salt
- char buffer[TC_VOLUME_HEADER_EFFECTIVE_SIZE];
+ unsigned char buffer[TC_VOLUME_HEADER_EFFECTIVE_SIZE];
nStatus = ReEncryptVolumeHeader (hwndDlg, buffer, FALSE, volume.CryptoInfo, &VolumePassword, VolumePim, FALSE);
if (nStatus != 0)
goto error;
headerOffset.QuadPart = volume.CryptoInfo->hiddenVolume ? TC_HIDDEN_VOLUME_HEADER_OFFSET : TC_VOLUME_HEADER_OFFSET;
if (!SetFilePointerEx (volume.HostFileHandle, headerOffset, NULL, FILE_BEGIN))
{
nStatus = ERR_OS_ERROR;
goto error;
}
if (!WriteEffectiveVolumeHeader (volume.IsDevice, volume.HostFileHandle, (uint8 *) buffer))
{
nStatus = ERR_OS_ERROR;
goto error;
}
}
else
{
// Restore header from an external backup
StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("CONFIRM_VOL_HEADER_RESTORE"), lpszVolume);
if (MessageBoxW (hwndDlg, szTmp, lpszTitle, YES_NO|MB_ICONWARNING|MB_DEFBUTTON2) == IDNO)
{
nStatus = ERR_SUCCESS;
goto ret;
}
@@ -11371,61 +11371,61 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
}
else
{
goto error;
}
}
else
hostSize = ((PDISK_GEOMETRY_EX) dgBuffer)->DiskSize.QuadPart;
}
if (hostSize == 0)
{
nStatus = ERR_VOL_SIZE_WRONG;
goto error;
}
}
else
{
LARGE_INTEGER fileSize;
if (!GetFileSizeEx (dev, &fileSize))
{
nStatus = ERR_OS_ERROR;
goto error;
}
hostSize = fileSize.QuadPart;
}
/* Read the volume header from the backup file */
- char buffer[TC_VOLUME_HEADER_GROUP_SIZE];
+ unsigned char buffer[TC_VOLUME_HEADER_GROUP_SIZE];
DWORD bytesRead;
if (!ReadFile (fBackup, buffer, sizeof (buffer), &bytesRead, NULL))
{
nStatus = ERR_OS_ERROR;
goto error;
}
if (bytesRead != backupSize.QuadPart)
{
nStatus = ERR_VOL_SIZE_WRONG;
goto error;
}
LARGE_INTEGER headerOffset;
LARGE_INTEGER headerBackupOffset;
bool legacyBackup;
int headerOffsetBackupFile;
// Determine the format of the backup file
switch (backupSize.QuadPart)
{
case TC_VOLUME_HEADER_GROUP_SIZE:
legacyBackup = false;
break;
case TC_VOLUME_HEADER_SIZE_LEGACY * 2:
legacyBackup = true;
break;