VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/BootEncryption.h
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2024-06-12 12:30:04 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2024-06-12 12:30:04 +0200
commit455a4f2176a5cfbe325e1e40cea20dd3e466b64c (patch)
tree7a84d0f768ee375ea9f648bbbdeac7a4906f13fb /src/Common/BootEncryption.h
parentbf9f3ec4f0a987ae1591ab5466f6eee599203c85 (diff)
downloadVeraCrypt-455a4f2176a5cfbe325e1e40cea20dd3e466b64c.tar.gz
VeraCrypt-455a4f2176a5cfbe325e1e40cea20dd3e466b64c.zip
Avoid conflict with C++17 features std::byte by using uint8 type instead of byte
Diffstat (limited to 'src/Common/BootEncryption.h')
-rw-r--r--src/Common/BootEncryption.h62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h
index ddf6f3e5..2ec92503 100644
--- a/src/Common/BootEncryption.h
+++ b/src/Common/BootEncryption.h
@@ -37,8 +37,8 @@ namespace VeraCrypt
bool IsOpened () const { return FileOpen;}
void CheckOpened (const char* srcPos) { if (!FileOpen) { SetLastError (LastError); throw SystemException (srcPos);} }
void Close ();
- DWORD Read (byte *buffer, DWORD size);
- void Write (byte *buffer, DWORD size);
+ DWORD Read (uint8 *buffer, DWORD size);
+ void Write (uint8 *buffer, DWORD size);
void SeekAt (int64 position);
void GetFileSize (unsigned __int64& size);
void GetFileSize (DWORD& dwSize);
@@ -70,19 +70,19 @@ namespace VeraCrypt
public:
Buffer (size_t size) : DataSize (size)
{
- DataPtr = new byte[size];
+ DataPtr = new uint8[size];
if (!DataPtr)
throw bad_alloc();
}
~Buffer () { delete[] DataPtr; }
- byte *Ptr () const { return DataPtr; }
+ uint8 *Ptr () const { return DataPtr; }
size_t Size () const { return DataSize; }
void Resize (size_t newSize)
{
if (newSize > DataSize)
{
- byte *tmp = new byte[newSize];
+ uint8 *tmp = new uint8[newSize];
if (!tmp)
throw bad_alloc();
memcpy (tmp, DataPtr, DataSize);
@@ -93,7 +93,7 @@ namespace VeraCrypt
}
protected:
- byte *DataPtr;
+ uint8 *DataPtr;
size_t DataSize;
};
@@ -115,17 +115,17 @@ namespace VeraCrypt
struct PartitionEntryMBR
{
- byte BootIndicator;
+ uint8 BootIndicator;
- byte StartHead;
- byte StartCylSector;
- byte StartCylinder;
+ uint8 StartHead;
+ uint8 StartCylSector;
+ uint8 StartCylinder;
- byte Type;
+ uint8 Type;
- byte EndHead;
- byte EndSector;
- byte EndCylinder;
+ uint8 EndHead;
+ uint8 EndSector;
+ uint8 EndCylinder;
uint32 StartLBA;
uint32 SectorCountLBA;
@@ -133,7 +133,7 @@ namespace VeraCrypt
struct MBR
{
- byte Code[446];
+ uint8 Code[446];
PartitionEntryMBR Partitions[4];
uint16 Signature;
};
@@ -200,13 +200,13 @@ namespace VeraCrypt
void DeleteStartExec(uint16 statrtOrderNum = 0xDC5B, wchar_t* type = NULL);
void SetStartExec(wstring description, wstring execPath, bool setBootEntry = true, bool forceFirstBootEntry = true, bool setBootNext = true, uint16 statrtOrderNum = 0xDC5B, wchar_t* type = NULL, uint32 attr = 1);
- void SaveFile(const wchar_t* name, byte* data, DWORD size);
+ void SaveFile(const wchar_t* name, uint8* data, DWORD size);
void GetFileSize(const wchar_t* name, unsigned __int64& size);
- void ReadFile(const wchar_t* name, byte* data, DWORD size);
+ void ReadFile(const wchar_t* name, uint8* data, DWORD size);
void CopyFile(const wchar_t* name, const wchar_t* targetName);
bool FileExists(const wchar_t* name);
static bool CompareFiles (const wchar_t* fileName1, const wchar_t* fileName2);
- static bool CompareFileData (const wchar_t* fileName, const byte* data, DWORD size);
+ static bool CompareFileData (const wchar_t* fileName, const uint8* data, DWORD size);
BOOL RenameFile(const wchar_t* name, const wchar_t* nameNew, BOOL bForce);
BOOL DelFile(const wchar_t* name);
@@ -258,7 +258,7 @@ namespace VeraCrypt
DWORD GetDriverServiceStartType ();
unsigned int GetHiddenOSCreationPhase ();
uint16 GetInstalledBootLoaderVersion ();
- void GetInstalledBootLoaderFingerprint (byte fingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE]);
+ void GetInstalledBootLoaderFingerprint (uint8 fingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE]);
Partition GetPartitionForHiddenOS ();
bool IsBootLoaderOnDrive (wchar_t *devicePath);
BootEncryptionStatus GetStatus ();
@@ -275,7 +275,7 @@ namespace VeraCrypt
void PrepareHiddenOSCreation (int ea, int mode, int pkcs5);
void PrepareInstallation (bool systemPartitionOnly, Password &password, int ea, int mode, int pkcs5, int pim, const wstring &rescueIsoImagePath);
void ProbeRealSystemDriveSize ();
- bool ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig = nullptr, string *customUserMessage = nullptr, uint16 *bootLoaderVersion = nullptr);
+ bool ReadBootSectorConfig (uint8 *config, size_t bufLength, uint8 *userConfig = nullptr, string *customUserMessage = nullptr, uint16 *bootLoaderVersion = nullptr);
uint32 ReadDriverConfigurationFlags ();
uint32 ReadServiceConfigurationFlags ();
void RegisterBootDriver (bool hiddenSystem);
@@ -295,7 +295,7 @@ namespace VeraCrypt
void StartDecryption (BOOL discardUnreadableEncryptedSectors);
void StartDecoyOSWipe (WipeAlgorithmId wipeAlgorithm);
void StartEncryption (WipeAlgorithmId wipeAlgorithm, bool zeroUnreadableSectors);
- bool SystemDriveContainsPartitionType (byte type);
+ bool SystemDriveContainsPartitionType (uint8 type);
bool SystemDriveContainsExtendedPartition ();
bool SystemDriveContainsNonStandardPartitions ();
bool SystemPartitionCoversWholeDrive ();
@@ -303,10 +303,10 @@ namespace VeraCrypt
bool VerifyRescueDisk ();
bool VerifyRescueDiskImage (const wchar_t* imageFile);
void WipeHiddenOSCreationConfig ();
- void WriteBootDriveSector (uint64 offset, byte *data);
- void WriteBootSectorConfig (const byte newConfig[]);
- void WriteBootSectorUserConfig (byte userConfig, const string &customUserMessage, int pim, int hashAlg);
- void WriteEfiBootSectorUserConfig (byte userConfig, const string &customUserMessage, int pim, int hashAlg);
+ void WriteBootDriveSector (uint64 offset, uint8 *data);
+ void WriteBootSectorConfig (const uint8 newConfig[]);
+ void WriteBootSectorUserConfig (uint8 userConfig, const string &customUserMessage, int pim, int hashAlg);
+ void WriteEfiBootSectorUserConfig (uint8 userConfig, const string &customUserMessage, int pim, int hashAlg);
void WriteLocalMachineRegistryDwordValue (wchar_t *keyPath, wchar_t *valueName, DWORD value);
void GetEfiBootDeviceNumber (PSTORAGE_DEVICE_NUMBER pSdn);
void BackupSystemLoader ();
@@ -318,10 +318,10 @@ namespace VeraCrypt
protected:
static const uint32 RescueIsoImageSize = 1835008; // Size of ISO9660 image with bootable emulated 1.44MB floppy disk image
- void CreateBootLoaderInMemory (byte *buffer, size_t bufferSize, bool rescueDisk, bool hiddenOSCreation = false);
+ void CreateBootLoaderInMemory (uint8 *buffer, size_t bufferSize, bool rescueDisk, bool hiddenOSCreation = false);
void CreateVolumeHeader (uint64 volumeSize, uint64 encryptedAreaStart, Password *password, int ea, int mode, int pkcs5, int pim);
wstring GetSystemLoaderBackupPath ();
- uint32 GetChecksum (byte *data, size_t size);
+ uint32 GetChecksum (uint8 *data, size_t size);
DISK_GEOMETRY_EX GetDriveGeometry (int driveNumber);
PartitionList GetDrivePartitions (int driveNumber);
wstring GetRemarksOnHiddenOS ();
@@ -334,11 +334,11 @@ namespace VeraCrypt
int SelectedEncryptionAlgorithmId;
int SelectedPrfAlgorithmId;
Partition HiddenOSCandidatePartition;
- byte *RescueIsoImage;
- byte *RescueZipData;
+ uint8 *RescueIsoImage;
+ uint8 *RescueZipData;
unsigned long RescueZipSize;
- byte RescueVolumeHeader[TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE];
- byte VolumeHeader[TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE];
+ uint8 RescueVolumeHeader[TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE];
+ uint8 VolumeHeader[TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE];
bool DriveConfigValid;
bool RealSystemDriveSizeValid;
bool RescueVolumeHeaderValid;