VeraCrypt
aboutsummaryrefslogtreecommitdiff
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
parentbf9f3ec4f0a987ae1591ab5466f6eee599203c85 (diff)
downloadVeraCrypt-455a4f2176a5cfbe325e1e40cea20dd3e466b64c.tar.gz
VeraCrypt-455a4f2176a5cfbe325e1e40cea20dd3e466b64c.zip
Avoid conflict with C++17 features std::byte by using uint8 type instead of byte
-rw-r--r--src/Boot/Windows/Bios.h2
-rw-r--r--src/Boot/Windows/BootCommon.h8
-rw-r--r--src/Boot/Windows/BootConfig.cpp10
-rw-r--r--src/Boot/Windows/BootConfig.h8
-rw-r--r--src/Boot/Windows/BootConsoleIo.cpp24
-rw-r--r--src/Boot/Windows/BootConsoleIo.h8
-rw-r--r--src/Boot/Windows/BootDebug.cpp8
-rw-r--r--src/Boot/Windows/BootDebug.h4
-rw-r--r--src/Boot/Windows/BootDiskIo.cpp58
-rw-r--r--src/Boot/Windows/BootDiskIo.h66
-rw-r--r--src/Boot/Windows/BootEncryptedIo.cpp4
-rw-r--r--src/Boot/Windows/BootEncryptedIo.h4
-rw-r--r--src/Boot/Windows/BootMain.cpp46
-rw-r--r--src/Boot/Windows/BootMain.h12
-rw-r--r--src/Boot/Windows/IntFilter.cpp14
-rw-r--r--src/Boot/Windows/Platform.cpp2
-rw-r--r--src/Common/Apidrvr.h10
-rw-r--r--src/Common/BaseCom.cpp2
-rw-r--r--src/Common/BootEncryption.cpp216
-rw-r--r--src/Common/BootEncryption.h62
-rw-r--r--src/Common/CommandAPDU.cpp66
-rw-r--r--src/Common/CommandAPDU.h32
-rw-r--r--src/Common/Crypto.c40
-rw-r--r--src/Common/Dlgcode.c48
-rw-r--r--src/Common/Dlgcode.h10
-rw-r--r--src/Common/EMVCard.cpp54
-rw-r--r--src/Common/EMVCard.h22
-rw-r--r--src/Common/EMVToken.cpp10
-rw-r--r--src/Common/EMVToken.h4
-rw-r--r--src/Common/EncryptionThreadPool.c6
-rw-r--r--src/Common/EncryptionThreadPool.h2
-rw-r--r--src/Common/Fat.h2
-rw-r--r--src/Common/Format.c4
-rw-r--r--src/Common/Keyfiles.c2
-rw-r--r--src/Common/ResponseAPDU.cpp32
-rw-r--r--src/Common/ResponseAPDU.h18
-rw-r--r--src/Common/SCardLoader.h4
-rw-r--r--src/Common/SCardReader.cpp18
-rw-r--r--src/Common/SCardReader.h114
-rw-r--r--src/Common/SecurityToken.cpp16
-rw-r--r--src/Common/SecurityToken.h8
-rw-r--r--src/Common/TLVParser.cpp12
-rw-r--r--src/Common/TLVParser.h14
-rw-r--r--src/Common/Tcdefs.h2
-rw-r--r--src/Common/Tests.c4
-rw-r--r--src/Common/Token.h2
-rw-r--r--src/Common/Volumes.c18
-rw-r--r--src/Common/Volumes.h12
-rw-r--r--src/Common/Wipe.c16
-rw-r--r--src/Common/Wipe.h2
-rw-r--r--src/Core/CoreBase.cpp2
-rw-r--r--src/Core/FatFormatter.cpp22
-rw-r--r--src/Core/RandomNumberGenerator.cpp4
-rw-r--r--src/Core/Unix/CoreService.cpp6
-rw-r--r--src/Core/Unix/CoreUnix.cpp2
-rw-r--r--src/Core/Unix/Linux/CoreLinux.cpp2
-rw-r--r--src/Crypto/Aes_hw_cpu.h10
-rw-r--r--src/Crypto/Camellia.c20
-rw-r--r--src/Crypto/Camellia.h4
-rw-r--r--src/Crypto/Sha2.c2
-rw-r--r--src/Crypto/Sha2Small.c2
-rw-r--r--src/Crypto/Streebog.c4
-rw-r--r--src/Crypto/Streebog.h4
-rw-r--r--src/Crypto/Twofish.c24
-rw-r--r--src/Crypto/Twofish.h8
-rw-r--r--src/Crypto/Whirlpool.c4
-rw-r--r--src/Crypto/chacha-xmm.c1
-rw-r--r--src/Crypto/config.h4
-rw-r--r--src/Crypto/kuznyechik.c64
-rw-r--r--src/Crypto/kuznyechik.h10
-rw-r--r--src/Crypto/kuznyechik_simd.c10
-rw-r--r--src/Crypto/rdrand.c4
-rw-r--r--src/Crypto/t1ha.h2
-rw-r--r--src/Crypto/wolfCrypt.c4
-rw-r--r--src/Driver/DriveFilter.c64
-rw-r--r--src/Driver/DumpFilter.c2
-rw-r--r--src/Driver/EncryptedIoQueue.c12
-rw-r--r--src/Driver/EncryptedIoQueue.h12
-rw-r--r--src/Driver/Fuse/FuseService.cpp12
-rw-r--r--src/Driver/Ntdriver.c12
-rw-r--r--src/Driver/Ntdriver.h2
-rw-r--r--src/Driver/Ntvol.c2
-rw-r--r--src/ExpandVolume/ExpandVolume.c10
-rw-r--r--src/ExpandVolume/InitDataArea.c2
-rw-r--r--src/Format/InPlace.c50
-rw-r--r--src/Main/CommandLineInterface.cpp4
-rw-r--r--src/Main/Forms/BenchmarkDialog.cpp2
-rw-r--r--src/Main/Forms/EncryptionTestDialog.cpp4
-rw-r--r--src/Main/Forms/KeyfileGeneratorDialog.cpp6
-rw-r--r--src/Main/Forms/MainFrame.cpp2
-rw-r--r--src/Main/Forms/RandomPoolEnrichmentDialog.cpp6
-rw-r--r--src/Main/Forms/SecurityTokenKeyfilesDialog.cpp4
-rw-r--r--src/Main/Forms/VolumeCreationWizard.cpp8
-rw-r--r--src/Main/Forms/VolumePasswordPanel.cpp2
-rw-r--r--src/Main/GraphicUserInterface.cpp2
-rw-r--r--src/Main/LanguageStrings.cpp2
-rw-r--r--src/Main/Resources.cpp18
-rw-r--r--src/Main/TextUserInterface.cpp8
-rw-r--r--src/Main/Xml.cpp2
-rw-r--r--src/Mount/Favorites.cpp2
-rw-r--r--src/Mount/Mount.c20
-rw-r--r--src/Platform/Buffer.cpp2
-rw-r--r--src/Platform/Buffer.h26
-rw-r--r--src/Platform/FileStream.h2
-rw-r--r--src/Platform/Memory.h28
-rw-r--r--src/Platform/MemoryStream.cpp2
-rw-r--r--src/Platform/MemoryStream.h2
-rw-r--r--src/Platform/PlatformBase.h4
-rw-r--r--src/Platform/PlatformTest.cpp6
-rw-r--r--src/Platform/Serializer.cpp26
-rw-r--r--src/Platform/Serializer.h4
-rw-r--r--src/Platform/StringConverter.cpp4
-rw-r--r--src/Platform/TextReader.cpp2
-rw-r--r--src/Platform/Unix/Process.cpp2
-rw-r--r--src/Volume/Cipher.cpp68
-rw-r--r--src/Volume/Cipher.h46
-rw-r--r--src/Volume/Crc32.h6
-rw-r--r--src/Volume/EncryptionAlgorithm.cpp8
-rw-r--r--src/Volume/EncryptionAlgorithm.h8
-rw-r--r--src/Volume/EncryptionMode.cpp8
-rw-r--r--src/Volume/EncryptionMode.h16
-rw-r--r--src/Volume/EncryptionModeWolfCryptXTS.cpp16
-rw-r--r--src/Volume/EncryptionModeWolfCryptXTS.h16
-rw-r--r--src/Volume/EncryptionModeXTS.cpp36
-rw-r--r--src/Volume/EncryptionModeXTS.h16
-rw-r--r--src/Volume/EncryptionTest.cpp18
-rw-r--r--src/Volume/EncryptionTest.h10
-rw-r--r--src/Volume/EncryptionThreadPool.cpp4
-rw-r--r--src/Volume/EncryptionThreadPool.h4
-rw-r--r--src/Volume/Keyfile.cpp18
-rw-r--r--src/Volume/VolumePassword.cpp2
-rw-r--r--src/Volume/VolumePassword.h6
132 files changed, 1033 insertions, 1036 deletions
diff --git a/src/Boot/Windows/Bios.h b/src/Boot/Windows/Bios.h
index 7085e7a2..0282fad7 100644
--- a/src/Boot/Windows/Bios.h
+++ b/src/Boot/Windows/Bios.h
@@ -28,6 +28,6 @@ enum
BiosResultTimeout = 0x80
};
-typedef byte BiosResult;
+typedef uint8 BiosResult;
#endif // TC_HEADER_Boot_Bios
diff --git a/src/Boot/Windows/BootCommon.h b/src/Boot/Windows/BootCommon.h
index d2ee42a1..45a1a650 100644
--- a/src/Boot/Windows/BootCommon.h
+++ b/src/Boot/Windows/BootCommon.h
@@ -43,7 +43,7 @@
typedef struct
{
- byte Flags;
+ uint8 Flags;
} BootSectorConfiguration;
@@ -120,7 +120,7 @@ typedef struct {
uint32 Data1;
uint16 Data2;
uint16 Data3;
- byte Data4[8];
+ uint8 Data4[8];
} DCS_GUID;
// DE types
@@ -155,7 +155,7 @@ typedef struct _DCS_DISK_ENTRY {
struct {
uint32 Type;
uint32 Offset;
- byte reserved[16];
+ uint8 reserved[16];
uint64 Length; // size of structure at Offset
};
DCS_DISK_ENTRY_SECTORS Sectors;
@@ -208,7 +208,7 @@ typedef struct _DCS_DEP_PWD_CACHE {
uint32 Count;
PasswordLegacy Pwd[4];
int32 Pim[4];
- byte pad[512 - 8 - 4 - 4 - (sizeof(PasswordLegacy) + 4) * 4];
+ uint8 pad[512 - 8 - 4 - 4 - (sizeof(PasswordLegacy) + 4) * 4];
} DCS_DEP_PWD_CACHE;
CSTATIC_ASSERT(sizeof(DCS_DEP_PWD_CACHE) == 512, Wrong_size_DCS_DEP_PWD_CACHE);
#pragma pack()
diff --git a/src/Boot/Windows/BootConfig.cpp b/src/Boot/Windows/BootConfig.cpp
index 0412d082..948dfd93 100644
--- a/src/Boot/Windows/BootConfig.cpp
+++ b/src/Boot/Windows/BootConfig.cpp
@@ -12,10 +12,10 @@
#include "BootConfig.h"
-byte BootSectorFlags;
+uint8 BootSectorFlags;
-byte BootLoaderDrive;
-byte BootDrive;
+uint8 BootLoaderDrive;
+uint8 BootDrive;
bool BootDriveGeometryValid = false;
bool PreventNormalSystemBoot = false;
bool PreventBootMenu = false;
@@ -39,7 +39,7 @@ uint64 HiddenVolumeStartSector;
void ReadBootSectorUserConfiguration ()
{
- byte userConfig;
+ uint8 userConfig;
AcquireSectorBuffer();
@@ -83,7 +83,7 @@ ret:
}
-BiosResult UpdateBootSectorConfiguration (byte drive)
+BiosResult UpdateBootSectorConfiguration (uint8 drive)
{
uint64 mbrSector;
mbrSector.HighPart = 0;
diff --git a/src/Boot/Windows/BootConfig.h b/src/Boot/Windows/BootConfig.h
index b66dc233..5338109f 100644
--- a/src/Boot/Windows/BootConfig.h
+++ b/src/Boot/Windows/BootConfig.h
@@ -17,10 +17,10 @@
#include "Platform.h"
#include "BootDiskIo.h"
-extern byte BootSectorFlags;
+extern uint8 BootSectorFlags;
-extern byte BootLoaderDrive;
-extern byte BootDrive;
+extern uint8 BootLoaderDrive;
+extern uint8 BootDrive;
extern bool BootDriveGeometryValid;
extern DriveGeometry BootDriveGeometry;
extern bool PreventNormalSystemBoot;
@@ -41,6 +41,6 @@ extern uint64 HiddenVolumeStartSector;
void ReadBootSectorUserConfiguration ();
-BiosResult UpdateBootSectorConfiguration (byte drive);
+BiosResult UpdateBootSectorConfiguration (uint8 drive);
#endif // TC_HEADER_Boot_BootConfig
diff --git a/src/Boot/Windows/BootConsoleIo.cpp b/src/Boot/Windows/BootConsoleIo.cpp
index 706e36f6..046f580b 100644
--- a/src/Boot/Windows/BootConsoleIo.cpp
+++ b/src/Boot/Windows/BootConsoleIo.cpp
@@ -101,7 +101,7 @@ void Print (const uint64 &number)
}
-void PrintHex (byte b)
+void PrintHex (uint8 b)
{
PrintChar (((b >> 4) >= 0xA ? 'A' - 0xA : '0') + (b >> 4));
PrintChar (((b & 0xF) >= 0xA ? 'A' - 0xA : '0') + (b & 0xF));
@@ -110,8 +110,8 @@ void PrintHex (byte b)
void PrintHex (uint16 data)
{
- PrintHex (byte (data >> 8));
- PrintHex (byte (data));
+ PrintHex (uint8 (data >> 8));
+ PrintHex (uint8 (data));
}
@@ -219,9 +219,9 @@ void PrintErrorNoEndl (const char *message)
}
-byte GetShiftFlags ()
+uint8 GetShiftFlags ()
{
- byte flags;
+ uint8 flags;
__asm
{
mov ah, 2
@@ -233,7 +233,7 @@ byte GetShiftFlags ()
}
-byte GetKeyboardChar ()
+uint8 GetKeyboardChar ()
{
return GetKeyboardChar (nullptr);
}
@@ -253,7 +253,7 @@ inline void Sleep ()
}
*/
-byte GetKeyboardChar (byte *scanCode)
+uint8 GetKeyboardChar (uint8 *scanCode)
{
// Work around potential BIOS bugs (Windows boot manager polls the keystroke buffer)
while (!IsKeyboardCharAvailable())
@@ -265,8 +265,8 @@ byte GetKeyboardChar (byte *scanCode)
}
}
- byte asciiCode;
- byte scan;
+ uint8 asciiCode;
+ uint8 scan;
__asm
{
mov ah, 0
@@ -302,7 +302,7 @@ bool EscKeyPressed ()
{
if (IsKeyboardCharAvailable ())
{
- byte keyScanCode;
+ uint8 keyScanCode;
GetKeyboardChar (&keyScanCode);
return keyScanCode == TC_BIOS_KEY_ESC;
}
@@ -346,8 +346,8 @@ bool IsDigit (char c)
int GetString (char *buffer, size_t bufferSize)
{
- byte c;
- byte scanCode;
+ uint8 c;
+ uint8 scanCode;
size_t pos = 0;
while (pos < bufferSize)
diff --git a/src/Boot/Windows/BootConsoleIo.h b/src/Boot/Windows/BootConsoleIo.h
index 349782eb..cf10d2c6 100644
--- a/src/Boot/Windows/BootConsoleIo.h
+++ b/src/Boot/Windows/BootConsoleIo.h
@@ -45,9 +45,9 @@ void ClearScreen ();
void DisableScreenOutput ();
void EnableScreenOutput ();
bool EscKeyPressed ();
-byte GetKeyboardChar ();
-byte GetKeyboardChar (byte *scanCode);
-byte GetShiftFlags ();
+uint8 GetKeyboardChar ();
+uint8 GetKeyboardChar (uint8 *scanCode);
+uint8 GetShiftFlags ();
int GetString (char *buffer, size_t bufferSize);
void InitVideoMode ();
bool IsKeyboardCharAvailable ();
@@ -64,7 +64,7 @@ void PrintEndl (int cnt);
void PrintRepeatedChar (char c, int n);
void PrintError (const char *message);
void PrintErrorNoEndl (const char *message);
-void PrintHex (byte b);
+void PrintHex (uint8 b);
void PrintHex (uint16 data);
void PrintHex (uint32 data);
void PrintHex (const uint64 &data);
diff --git a/src/Boot/Windows/BootDebug.cpp b/src/Boot/Windows/BootDebug.cpp
index bea063c1..b490f5e8 100644
--- a/src/Boot/Windows/BootDebug.cpp
+++ b/src/Boot/Windows/BootDebug.cpp
@@ -34,7 +34,7 @@ void InitDebugPort ()
}
-void WriteDebugPort (byte dataByte)
+void WriteDebugPort (uint8 dataByte)
{
__asm
{
@@ -82,7 +82,7 @@ void PrintVal (const char *message, const uint64 &value, bool newLine, bool hex)
}
-void PrintHexDump (byte *mem, size_t size, uint16 *memSegment)
+void PrintHexDump (uint8 *mem, size_t size, uint16 *memSegment)
{
const size_t width = 16;
for (size_t pos = 0; pos < size; )
@@ -92,7 +92,7 @@ void PrintHexDump (byte *mem, size_t size, uint16 *memSegment)
size_t i;
for (i = 0; i < width && pos < size; ++i)
{
- byte dataByte;
+ uint8 dataByte;
if (memSegment)
{
__asm
@@ -134,7 +134,7 @@ void PrintHexDump (byte *mem, size_t size, uint16 *memSegment)
void PrintHexDump (uint16 memSegment, uint16 memOffset, size_t size)
{
- PrintHexDump ((byte *) memOffset, size, &memSegment);
+ PrintHexDump ((uint8 *) memOffset, size, &memSegment);
}
#endif // TC_BOOT_DEBUG_ENABLED
diff --git a/src/Boot/Windows/BootDebug.h b/src/Boot/Windows/BootDebug.h
index f94ab900..35fce41f 100644
--- a/src/Boot/Windows/BootDebug.h
+++ b/src/Boot/Windows/BootDebug.h
@@ -51,8 +51,8 @@
void InitDebugPort ();
void InitStackChecker ();
-void WriteDebugPort (byte dataByte);
-void PrintHexDump (byte *mem, size_t size, uint16 *memSegment = nullptr);
+void WriteDebugPort (uint8 dataByte);
+void PrintHexDump (uint8 *mem, size_t size, uint16 *memSegment = nullptr);
void PrintHexDump (uint16 memSegment, uint16 memOffset, size_t size);
void PrintVal (const char *message, const uint32 value, bool newLine = true, bool hex = false);
void PrintVal (const char *message, const uint64 &value, bool newLine = true, bool hex = false);
diff --git a/src/Boot/Windows/BootDiskIo.cpp b/src/Boot/Windows/BootDiskIo.cpp
index 437c462e..ddd00e1c 100644
--- a/src/Boot/Windows/BootDiskIo.cpp
+++ b/src/Boot/Windows/BootDiskIo.cpp
@@ -19,7 +19,7 @@
#include "BootStrings.h"
-byte SectorBuffer[TC_LB_SIZE];
+uint8 SectorBuffer[TC_LB_SIZE];
#ifdef TC_BOOT_DEBUG_ENABLED
static bool SectorBufferInUse = false;
@@ -41,9 +41,9 @@ void ReleaseSectorBuffer ()
#endif
-bool IsLbaSupported (byte drive)
+bool IsLbaSupported (uint8 drive)
{
- static byte CachedDrive = TC_INVALID_BIOS_DRIVE;
+ static uint8 CachedDrive = TC_INVALID_BIOS_DRIVE;
static bool CachedStatus;
uint16 result = 0;
@@ -68,7 +68,7 @@ ret:
}
-void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs)
+void PrintDiskError (BiosResult error, bool write, uint8 drive, const uint64 *sector, const ChsAddress *chs)
{
PrintEndl();
Print (write ? "Write" : "Read"); Print (" error:");
@@ -109,17 +109,17 @@ void PrintSectorCountInMB (const uint64 &sectorCount)
}
-BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
+BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent)
{
CheckStack();
- byte cylinderLow = (byte) chs.Cylinder;
- byte sector = chs.Sector;
- sector |= byte (chs.Cylinder >> 2) & 0xc0;
- byte function = write ? 0x03 : 0x02;
+ uint8 cylinderLow = (uint8) chs.Cylinder;
+ uint8 sector = chs.Sector;
+ sector |= uint8 (chs.Cylinder >> 2) & 0xc0;
+ uint8 function = write ? 0x03 : 0x02;
BiosResult result;
- byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
+ uint8 tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
do
{
@@ -159,20 +159,20 @@ BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffs
#ifdef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
-BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
+BiosResult ReadWriteSectors (bool write, uint8 *buffer, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent)
{
uint16 codeSeg;
__asm mov codeSeg, cs
return ReadWriteSectors (write, codeSeg, (uint16) buffer, drive, chs, sectorCount, silent);
}
-BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
+BiosResult ReadSectors (uint8 *buffer, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent)
{
return ReadWriteSectors (false, buffer, drive, chs, sectorCount, silent);
}
#if 0
-BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
+BiosResult WriteSectors (uint8 *buffer, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent)
{
return ReadWriteSectors (true, buffer, drive, chs, sectorCount, silent);
}
@@ -180,7 +180,7 @@ BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte s
#endif
-static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
+static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
CheckStack();
@@ -202,10 +202,10 @@ static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, byte d
dapPacket.SectorCount = sectorCount;
dapPacket.Sector = sector;
- byte function = write ? 0x43 : 0x42;
+ uint8 function = write ? 0x43 : 0x42;
BiosResult result;
- byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
+ uint8 tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
do
{
@@ -237,7 +237,7 @@ static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, byte d
}
-BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
+BiosResult ReadWriteSectors (bool write, uint8 *buffer, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
BiosLbaPacket dapPacket;
dapPacket.Buffer = (uint32) buffer;
@@ -245,20 +245,20 @@ BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const uint64
}
-BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
+BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
BiosLbaPacket dapPacket;
dapPacket.Buffer = ((uint32) bufferSegment << 16) | bufferOffset;
return ReadWriteSectors (write, dapPacket, drive, sector, sectorCount, silent);
}
-BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
+BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
return ReadWriteSectors (false, bufferSegment, bufferOffset, drive, sector, sectorCount, silent);
}
-BiosResult ReadSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
+BiosResult ReadSectors (uint8 *buffer, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
BiosResult result;
uint16 codeSeg;
@@ -274,17 +274,17 @@ BiosResult ReadSectors (byte *buffer, byte drive, const uint64 &sector, uint16 s
}
-BiosResult WriteSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
+BiosResult WriteSectors (uint8 *buffer, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
return ReadWriteSectors (true, buffer, drive, sector, sectorCount, silent);
}
-BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent)
+BiosResult GetDriveGeometry (uint8 drive, DriveGeometry &geometry, bool silent)
{
CheckStack();
- byte maxCylinderLow, maxHead, maxSector;
+ uint8 maxCylinderLow, maxHead, maxSector;
BiosResult result;
__asm
{
@@ -329,9 +329,9 @@ void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba
void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs)
{
- chs.Sector = (byte) ((lba.LowPart % geometry.Sectors) + 1);
+ chs.Sector = (uint8) ((lba.LowPart % geometry.Sectors) + 1);
uint32 ch = lba.LowPart / geometry.Sectors;
- chs.Head = (byte) (ch % geometry.Heads);
+ chs.Head = (uint8) (ch % geometry.Heads);
chs.Cylinder = (uint16) (ch / geometry.Heads);
}
@@ -349,7 +349,7 @@ void PartitionEntryMBRToPartition (const PartitionEntryMBR &partEntry, Partition
}
-BiosResult ReadWriteMBR (bool write, byte drive, bool silent)
+BiosResult ReadWriteMBR (bool write, uint8 drive, bool silent)
{
uint64 mbrSector;
mbrSector.HighPart = 0;
@@ -362,7 +362,7 @@ BiosResult ReadWriteMBR (bool write, byte drive, bool silent)
}
-BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly, Partition *findPartitionFollowingThis, bool silent)
+BiosResult GetDrivePartitions (uint8 drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly, Partition *findPartitionFollowingThis, bool silent)
{
Partition *followingPartition;
Partition tmpPartition;
@@ -419,7 +419,7 @@ BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t par
MBR *extMbr = (MBR *) SectorBuffer;
while (partitionArrayPos < partitionArrayCapacity &&
- (result = ReadSectors ((byte *) extMbr, drive, extStartLBA, 1, silent)) == BiosResultSuccess
+ (result = ReadSectors ((uint8 *) extMbr, drive, extStartLBA, 1, silent)) == BiosResultSuccess
&& extMbr->Signature == 0xaa55)
{
if (extMbr->Partitions[0].SectorCountLBA > 0)
@@ -478,7 +478,7 @@ BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t par
}
-bool GetActivePartition (byte drive)
+bool GetActivePartition (uint8 drive)
{
size_t partCount;
diff --git a/src/Boot/Windows/BootDiskIo.h b/src/Boot/Windows/BootDiskIo.h
index 621acd8f..0b92aa29 100644
--- a/src/Boot/Windows/BootDiskIo.h
+++ b/src/Boot/Windows/BootDiskIo.h
@@ -28,17 +28,17 @@ enum
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;
@@ -46,15 +46,15 @@ struct PartitionEntryMBR
struct MBR
{
- byte Code[446];
+ uint8 Code[446];
PartitionEntryMBR Partitions[4];
uint16 Signature;
};
struct BiosLbaPacket
{
- byte Size;
- byte Reserved;
+ uint8 Size;
+ uint8 Reserved;
uint16 SectorCount;
uint32 Buffer;
uint64 Sector;
@@ -66,27 +66,27 @@ struct BiosLbaPacket
struct ChsAddress
{
uint16 Cylinder;
- byte Head;
- byte Sector;
+ uint8 Head;
+ uint8 Sector;
};
struct Partition
{
- byte Number;
- byte Drive;
+ uint8 Number;
+ uint8 Drive;
bool Active;
uint64 EndSector;
bool Primary;
uint64 SectorCount;
uint64 StartSector;
- byte Type;
+ uint8 Type;
};
struct DriveGeometry
{
uint16 Cylinders;
- byte Heads;
- byte Sectors;
+ uint8 Heads;
+ uint8 Sectors;
};
@@ -99,23 +99,23 @@ void ReleaseSectorBuffer ();
#endif
void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba);
-bool GetActivePartition (byte drive);
-BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent = false);
-BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly = false, Partition *findPartitionFollowingThis = nullptr, bool silent = false);
-bool IsLbaSupported (byte drive);
+bool GetActivePartition (uint8 drive);
+BiosResult GetDriveGeometry (uint8 drive, DriveGeometry &geometry, bool silent = false);
+BiosResult GetDrivePartitions (uint8 drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly = false, Partition *findPartitionFollowingThis = nullptr, bool silent = false);
+bool IsLbaSupported (uint8 drive);
void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs);
void Print (const ChsAddress &chs);
-void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs = nullptr);
+void PrintDiskError (BiosResult error, bool write, uint8 drive, const uint64 *sector, const ChsAddress *chs = nullptr);
void PrintSectorCountInMB (const uint64 &sectorCount);
-BiosResult ReadWriteMBR (bool write, byte drive, bool silent = false);
-BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
-BiosResult ReadSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
-BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
-BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent);
-BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent);
-BiosResult WriteSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
-BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
-
-extern byte SectorBuffer[TC_LB_SIZE];
+BiosResult ReadWriteMBR (bool write, uint8 drive, bool silent = false);
+BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
+BiosResult ReadSectors (uint8 *buffer, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
+BiosResult ReadSectors (uint8 *buffer, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent = false);
+BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent);
+BiosResult ReadWriteSectors (bool write, uint8 *buffer, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent);
+BiosResult WriteSectors (uint8 *buffer, uint8 drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
+BiosResult WriteSectors (uint8 *buffer, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent = false);
+
+extern uint8 SectorBuffer[TC_LB_SIZE];
#endif // TC_HEADER_Boot_BootDiskIo
diff --git a/src/Boot/Windows/BootEncryptedIo.cpp b/src/Boot/Windows/BootEncryptedIo.cpp
index 8ca55635..24fbbbd0 100644
--- a/src/Boot/Windows/BootEncryptedIo.cpp
+++ b/src/Boot/Windows/BootEncryptedIo.cpp
@@ -19,7 +19,7 @@
#include "BootEncryptedIo.h"
-BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte drive, uint64 sector, uint16 sectorCount)
+BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, uint8 drive, uint64 sector, uint16 sectorCount)
{
BiosResult result;
bool decrypt = true;
@@ -76,7 +76,7 @@ BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte dri
}
-BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byte drive, uint64 sector, uint16 sectorCount)
+BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, uint8 drive, uint64 sector, uint16 sectorCount)
{
BiosResult result = BiosResultSuccess;
AcquireSectorBuffer();
diff --git a/src/Boot/Windows/BootEncryptedIo.h b/src/Boot/Windows/BootEncryptedIo.h
index d1c9e5f3..d2fa6d96 100644
--- a/src/Boot/Windows/BootEncryptedIo.h
+++ b/src/Boot/Windows/BootEncryptedIo.h
@@ -15,8 +15,8 @@
#include "Platform.h"
-BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte drive, uint64 sector, uint16 sectorCount);
-BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byte drive, uint64 sector, uint16 sectorCount);
+BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, uint8 drive, uint64 sector, uint16 sectorCount);
+BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, uint8 drive, uint64 sector, uint16 sectorCount);
static bool ReadWritePartiallyCoversEncryptedArea (const uint64 &sector, uint16 sectorCount);
#endif // TC_HEADER_Boot_BootEncryptionIo
diff --git a/src/Boot/Windows/BootMain.cpp b/src/Boot/Windows/BootMain.cpp
index 8bfbe4b3..e85f2be5 100644
--- a/src/Boot/Windows/BootMain.cpp
+++ b/src/Boot/Windows/BootMain.cpp
@@ -84,7 +84,7 @@ static void PrintMainMenu ()
}
-static bool IsMenuKey (byte scanCode)
+static bool IsMenuKey (uint8 scanCode)
{
#ifdef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
return scanCode == TC_MENU_KEY_REPAIR;
@@ -149,12 +149,12 @@ static int AskSelection (const char *options[], size_t optionCount)
}
-static byte AskPassword (Password &password, int& pim)
+static uint8 AskPassword (Password &password, int& pim)
{
size_t pos = 0;
- byte scanCode;
- byte asciiCode;
- byte hidePassword = 1;
+ uint8 scanCode;
+ uint8 asciiCode;
+ uint8 hidePassword = 1;
pim = 0;
@@ -312,7 +312,7 @@ static byte AskPassword (Password &password, int& pim)
}
-static void ExecuteBootSector (byte drive, byte *sectorBuffer)
+static void ExecuteBootSector (uint8 drive, uint8 *sectorBuffer)
{
Print ("Booting...\r\n");
CopyMemory (sectorBuffer, 0x0000, 0x7c00, TC_LB_SIZE);
@@ -338,7 +338,7 @@ static void ExecuteBootSector (byte drive, byte *sectorBuffer)
}
-static bool OpenVolume (byte drive, Password &password, int pim, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32, bool skipNormal, bool skipHidden)
+static bool OpenVolume (uint8 drive, Password &password, int pim, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32, bool skipNormal, bool skipHidden)
{
int volumeType;
bool hiddenVolume;
@@ -420,7 +420,7 @@ static bool CheckMemoryRequirements ()
}
-static bool MountVolume (byte drive, byte &exitKey, bool skipNormal, bool skipHidden)
+static bool MountVolume (uint8 drive, uint8 &exitKey, bool skipNormal, bool skipHidden)
{
BootArguments *bootArguments = (BootArguments *) TC_BOOT_LOADER_ARGS_OFFSET;
int incorrectPasswordCount = 0, pim = 0;
@@ -499,7 +499,7 @@ static bool MountVolume (byte drive, byte &exitKey, bool skipNormal, bool skipHi
}
-static bool GetSystemPartitions (byte drive)
+static bool GetSystemPartitions (uint8 drive)
{
size_t partCount;
@@ -524,10 +524,10 @@ static bool GetSystemPartitions (byte drive)
}
-static byte BootEncryptedDrive ()
+static uint8 BootEncryptedDrive ()
{
BootArguments *bootArguments = (BootArguments *) TC_BOOT_LOADER_ARGS_OFFSET;
- byte exitKey;
+ uint8 exitKey;
BootCryptoInfo = NULL;
if (!GetSystemPartitions (BootDrive))
@@ -556,7 +556,7 @@ static byte BootEncryptedDrive ()
if (!InstallInterruptFilters())
goto err;
- bootArguments->BootArgumentsCrc32 = GetCrc32 ((byte *) bootArguments, (byte *) &bootArguments->BootArgumentsCrc32 - (byte *) bootArguments);
+ bootArguments->BootArgumentsCrc32 = GetCrc32 ((uint8 *) bootArguments, (uint8 *) &bootArguments->BootArgumentsCrc32 - (uint8 *) bootArguments);
while (true)
{
@@ -587,7 +587,7 @@ err:
EncryptedVirtualPartition.Drive = TC_INVALID_BIOS_DRIVE;
EraseMemory ((void *) TC_BOOT_LOADER_ARGS_OFFSET, sizeof (BootArguments));
- byte scanCode;
+ uint8 scanCode;
GetKeyboardChar (&scanCode);
return scanCode;
}
@@ -601,7 +601,7 @@ static void BootMenu ()
size_t partitionCount;
size_t bootablePartitionCount = 0;
- for (byte drive = TC_FIRST_BIOS_DRIVE; drive <= TC_LAST_BIOS_DRIVE; ++drive)
+ for (uint8 drive = TC_FIRST_BIOS_DRIVE; drive <= TC_LAST_BIOS_DRIVE; ++drive)
{
if (GetDrivePartitions (drive, partitions, array_capacity (partitions), partitionCount, false, nullptr, true) == BiosResultSuccess)
{
@@ -689,7 +689,7 @@ static void BootMenu ()
#ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
-static bool CopySystemPartitionToHiddenVolume (byte drive, byte &exitKey)
+static bool CopySystemPartitionToHiddenVolume (uint8 drive, uint8 &exitKey)
{
bool status = false;
@@ -812,9 +812,9 @@ ret:
#else // TC_WINDOWS_BOOT_RESCUE_DISK_MODE
-static void DecryptDrive (byte drive)
+static void DecryptDrive (uint8 drive)
{
- byte exitKey;
+ uint8 exitKey;
if (!MountVolume (drive, exitKey, false, true))
return;
@@ -925,7 +925,7 @@ askBadSectorSkip:
for (int i = 7; i >= 0; --i)
{
- SectorBuffer[TC_HEADER_OFFSET_ENCRYPTED_AREA_LENGTH + i] = (byte) encryptedAreaLength.LowPart;
+ SectorBuffer[TC_HEADER_OFFSET_ENCRYPTED_AREA_LENGTH + i] = (uint8) encryptedAreaLength.LowPart;
encryptedAreaLength = encryptedAreaLength >> 8;
}
@@ -933,7 +933,7 @@ askBadSectorSkip:
for (i = 3; i >= 0; --i)
{
- SectorBuffer[TC_HEADER_OFFSET_HEADER_CRC + i] = (byte) headerCrc32;
+ SectorBuffer[TC_HEADER_OFFSET_HEADER_CRC + i] = (uint8) headerCrc32;
headerCrc32 >>= 8;
}
@@ -1020,7 +1020,7 @@ static void RepairMenu ()
sector.HighPart = 0;
ChsAddress chs;
- byte mbrPartTable[TC_LB_SIZE - TC_MAX_MBR_BOOT_CODE_SIZE];
+ uint8 mbrPartTable[TC_LB_SIZE - TC_MAX_MBR_BOOT_CODE_SIZE];
AcquireSectorBuffer();
for (int i = (selection == RestoreVolumeHeader ? TC_BOOT_VOLUME_HEADER_SECTOR : TC_MBR_SECTOR);
@@ -1073,7 +1073,7 @@ static void RepairMenu ()
Password password;
int pim;
- byte exitKey = AskPassword (password, pim);
+ uint8 exitKey = AskPassword (password, pim);
if (exitKey != TC_BIOS_KEY_ENTER)
goto abort;
@@ -1221,13 +1221,13 @@ void main ()
while (true)
{
- byte exitKey;
+ uint8 exitKey;
InitScreen();
#ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
// Hidden system setup
- byte hiddenSystemCreationPhase = BootSectorFlags & TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE;
+ uint8 hiddenSystemCreationPhase = BootSectorFlags & TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE;
if (hiddenSystemCreationPhase != TC_HIDDEN_OS_CREATION_PHASE_NONE)
{
diff --git a/src/Boot/Windows/BootMain.h b/src/Boot/Windows/BootMain.h
index 52d5c8cc..af445024 100644
--- a/src/Boot/Windows/BootMain.h
+++ b/src/Boot/Windows/BootMain.h
@@ -16,16 +16,16 @@
#include "TCdefs.h"
#include "Platform.h"
-static byte AskPassword (Password &password, int& pim);
+static uint8 AskPassword (Password &password, int& pim);
static int AskSelection (const char *options[], size_t optionCount);
static bool AskYesNo (const char *message);
-static byte BootEncryptedDrive ();
+static uint8 BootEncryptedDrive ();
static void BootMenu ();
-static void ExecuteBootSector (byte drive, byte *sectorBuffer);
+static void ExecuteBootSector (uint8 drive, uint8 *sectorBuffer);
static void InitScreen ();
-static bool IsMenuKey (byte scanCode);
-static bool MountVolume (byte drive, byte &exitKey);
-static bool OpenVolume (byte drive, Password &password, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32 = nullptr, bool skipNormal = false, bool skipHidden = false);
+static bool IsMenuKey (uint8 scanCode);
+static bool MountVolume (uint8 drive, uint8 &exitKey);
+static bool OpenVolume (uint8 drive, Password &password, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32 = nullptr, bool skipNormal = false, bool skipHidden = false);
static void PrintMainMenu ();
static void RepairMenu ();
diff --git a/src/Boot/Windows/IntFilter.cpp b/src/Boot/Windows/IntFilter.cpp
index 9e5c8536..36837d58 100644
--- a/src/Boot/Windows/IntFilter.cpp
+++ b/src/Boot/Windows/IntFilter.cpp
@@ -38,7 +38,7 @@ bool Int13Filter ()
static int ReEntryCount = -1;
++ReEntryCount;
- byte function = (byte) (regs.AX >> 8);
+ uint8 function = (uint8) (regs.AX >> 8);
#ifdef TC_TRACE_INT13
DisableScreenOutput();
@@ -63,14 +63,14 @@ bool Int13Filter ()
case 0x2: // Read sectors
case 0x3: // Write sectors
{
- byte drive = (byte) regs.DX;
+ uint8 drive = (uint8) regs.DX;
ChsAddress chs;
chs.Cylinder = ((regs.CX << 2) & 0x300) | (regs.CX >> 8);
chs.Head = regs.DX >> 8;
chs.Sector = regs.CX & 0x3f;
- byte sectorCount = (byte) regs.AX;
+ uint8 sectorCount = (uint8) regs.AX;
#ifdef TC_TRACE_INT13
PrintVal (": Drive", drive - TC_FIRST_BIOS_DRIVE, false);
@@ -125,10 +125,10 @@ bool Int13Filter ()
case 0x42: // Read sectors LBA
case 0x43: // Write sectors LBA
{
- byte drive = (byte) regs.DX;
+ uint8 drive = (uint8) regs.DX;
BiosLbaPacket lba;
- CopyMemory (regs.DS, regs.SI, (byte *) &lba, sizeof (lba));
+ CopyMemory (regs.DS, regs.SI, (uint8 *) &lba, sizeof (lba));
#ifdef TC_TRACE_INT13
PrintVal (": Drive", drive - TC_FIRST_BIOS_DRIVE, false);
@@ -337,7 +337,7 @@ bool Int15Filter ()
}
else
{
- CopyMemory ((byte *) &BiosMemoryMap[IntRegisters.EBX], IntRegisters.ES, IntRegisters.DI, sizeof (BiosMemoryMap[0]));
+ CopyMemory ((uint8 *) &BiosMemoryMap[IntRegisters.EBX], IntRegisters.ES, IntRegisters.DI, sizeof (BiosMemoryMap[0]));
IntRegisters.Flags &= ~TC_X86_CARRY_FLAG;
IntRegisters.EAX = 0x534D4150UL;
@@ -380,7 +380,7 @@ bool Int15Filter ()
#ifdef TC_TRACE_INT15
BiosMemoryMapEntry entry;
- CopyMemory (IntRegisters.ES, IntRegisters.DI, (byte *) &entry, sizeof (entry));
+ CopyMemory (IntRegisters.ES, IntRegisters.DI, (uint8 *) &entry, sizeof (entry));
PrintHex (entry.Type); PrintChar (' ');
PrintHex (entry.BaseAddress); PrintChar (' ');
PrintHex (entry.Length); PrintChar (' ');
diff --git a/src/Boot/Windows/Platform.cpp b/src/Boot/Windows/Platform.cpp
index 046fa4a4..3b94d22c 100644
--- a/src/Boot/Windows/Platform.cpp
+++ b/src/Boot/Windows/Platform.cpp
@@ -84,7 +84,7 @@ uint64 operator>> (const uint64 &a, int shiftCount)
{
r.LowPart >>= 1;
- if ((byte) r.HighPart & 1)
+ if ((uint8) r.HighPart & 1)
r.LowPart |= 0x80000000UL;
r.HighPart >>= 1;
diff --git a/src/Common/Apidrvr.h b/src/Common/Apidrvr.h
index 463d4fa6..4074503d 100644
--- a/src/Common/Apidrvr.h
+++ b/src/Common/Apidrvr.h
@@ -344,23 +344,23 @@ typedef struct
typedef struct
{
- byte Fingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE];
+ uint8 Fingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE];
} BootLoaderFingerprintRequest;
typedef struct
{
wchar_t DevicePath[TC_MAX_PATH];
- byte Configuration;
+ uint8 Configuration;
BOOL DriveIsDynamic;
uint16 BootLoaderVersion;
- byte UserConfiguration;
+ uint8 UserConfiguration;
char CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1];
} GetSystemDriveConfigurationRequest;
typedef struct
{
WipeAlgorithmId WipeAlgorithm;
- CRYPTOPP_ALIGN_DATA(16) byte WipeKey[MASTER_KEYDATA_SIZE];
+ CRYPTOPP_ALIGN_DATA(16) uint8 WipeKey[MASTER_KEYDATA_SIZE];
} WipeDecoySystemRequest;
typedef struct
@@ -373,7 +373,7 @@ typedef struct
typedef struct
{
LARGE_INTEGER Offset;
- byte Data[TC_SECTOR_SIZE_BIOS];
+ uint8 Data[TC_SECTOR_SIZE_BIOS];
} WriteBootDriveSectorRequest;
typedef struct
diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp
index 3eaaf809..25c70963 100644
--- a/src/Common/BaseCom.cpp
+++ b/src/Common/BaseCom.cpp
@@ -450,7 +450,7 @@ DWORD BaseCom::WriteEfiBootSectorUserConfig (DWORD userConfig, BSTR customUserMe
msg [maxSize - 1] = 0;
std::string msgStr = maxSize > 0 ? msg : "";
BootEncryption bootEnc (NULL);
- bootEnc.WriteEfiBootSectorUserConfig ((byte) userConfig, msgStr, pim, hashAlg);
+ bootEnc.WriteEfiBootSectorUserConfig ((uint8) userConfig, msgStr, pim, hashAlg);
}
catch (SystemException &)
{
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index af6063e4..2080a44b 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -275,10 +275,10 @@ bool ZipAdd (zip_t *z, const char* name, const unsigned char* pbData, DWORD cbDa
return true;
}
-static BOOL IsWindowsMBR (const byte *buffer, size_t bufferSize)
+static BOOL IsWindowsMBR (const uint8 *buffer, size_t bufferSize)
{
BOOL bRet = FALSE;
- byte g_pbMsSignature[4] = {0x33, 0xc0, 0x8e, 0xd0};
+ uint8 g_pbMsSignature[4] = {0x33, 0xc0, 0x8e, 0xd0};
const char* g_szStr1 = "Invalid partition table";
const char* g_szStr2 = "Error loading operating system";
const char* g_szStr3 = "Missing operating system";
@@ -390,7 +390,7 @@ namespace VeraCrypt
}
}
- static void ReadWriteFile (BOOL write, BOOL device, const wstring &filePath, byte *buffer, uint64 offset, uint32 size, DWORD *sizeDone)
+ static void ReadWriteFile (BOOL write, BOOL device, const wstring &filePath, uint8 *buffer, uint64 offset, uint32 size, DWORD *sizeDone)
{
Elevate();
@@ -631,7 +631,7 @@ namespace VeraCrypt
}
}
- static void WriteEfiBootSectorUserConfig (byte userConfig, const string &customUserMessage, int pim, int hashAlg)
+ static void WriteEfiBootSectorUserConfig (uint8 userConfig, const string &customUserMessage, int pim, int hashAlg)
{
Elevate();
@@ -742,7 +742,7 @@ namespace VeraCrypt
public:
static void AddReference () { }
static void CallDriver (DWORD ioctl, void *input, DWORD inputSize, void *output, DWORD outputSize) { throw ParameterIncorrect (SRC_POS); }
- static void ReadWriteFile (BOOL write, BOOL device, const wstring &filePath, byte *buffer, uint64 offset, uint32 size, DWORD *sizeDone) { throw ParameterIncorrect (SRC_POS); }
+ static void ReadWriteFile (BOOL write, BOOL device, const wstring &filePath, uint8 *buffer, uint64 offset, uint32 size, DWORD *sizeDone) { throw ParameterIncorrect (SRC_POS); }
static void RegisterFilterDriver (bool registerDriver, BootEncryption::FilterType filterType) { throw ParameterIncorrect (SRC_POS); }
static void Release () { }
static void SetDriverServiceStartType (DWORD startType) { throw ParameterIncorrect (SRC_POS); }
@@ -752,7 +752,7 @@ namespace VeraCrypt
static void BackupEfiSystemLoader () { throw ParameterIncorrect (SRC_POS); }
static void RestoreEfiSystemLoader () { throw ParameterIncorrect (SRC_POS); }
static void GetEfiBootDeviceNumber (PSTORAGE_DEVICE_NUMBER pSdn) { throw ParameterIncorrect (SRC_POS); }
- static void WriteEfiBootSectorUserConfig (byte userConfig, const string &customUserMessage, int pim, int hashAlg) { throw ParameterIncorrect (SRC_POS); }
+ static void WriteEfiBootSectorUserConfig (uint8 userConfig, const string &customUserMessage, int pim, int hashAlg) { throw ParameterIncorrect (SRC_POS); }
static void UpdateSetupConfigFile (bool bForInstall) { throw ParameterIncorrect (SRC_POS); }
static void GetSecureBootConfig (BOOL* pSecureBootEnabled, BOOL *pVeraCryptKeysLoaded) { throw ParameterIncorrect (SRC_POS); }
};
@@ -796,7 +796,7 @@ namespace VeraCrypt
FileOpen = false;
}
- DWORD File::Read (byte *buffer, DWORD size)
+ DWORD File::Read (uint8 *buffer, DWORD size)
{
DWORD bytesRead;
@@ -901,7 +901,7 @@ namespace VeraCrypt
dwSize = (DWORD) size64;
}
- void File::Write (byte *buffer, DWORD size)
+ void File::Write (uint8 *buffer, DWORD size)
{
DWORD bytesWritten;
@@ -1423,7 +1423,7 @@ namespace VeraCrypt
return version;
}
- void BootEncryption::GetInstalledBootLoaderFingerprint (byte fingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE])
+ void BootEncryption::GetInstalledBootLoaderFingerprint (uint8 fingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE])
{
BootLoaderFingerprintRequest request;
CallDriver (VC_IOCTL_GET_BOOT_LOADER_FINGERPRINT, NULL, 0, &request, sizeof (request));
@@ -1485,12 +1485,12 @@ namespace VeraCrypt
}
- bool BootEncryption::SystemDriveContainsPartitionType (byte type)
+ bool BootEncryption::SystemDriveContainsPartitionType (uint8 type)
{
Device device (GetSystemDriveConfiguration().DevicePath, true);
device.CheckOpened (SRC_POS);
- byte mbrBuf[TC_SECTOR_SIZE_BIOS];
+ uint8 mbrBuf[TC_SECTOR_SIZE_BIOS];
device.SeekAt (0);
device.Read (mbrBuf, sizeof (mbrBuf));
@@ -1532,7 +1532,7 @@ namespace VeraCrypt
continue;
}
- if (SystemDriveContainsPartitionType ((byte) partitionType))
+ if (SystemDriveContainsPartitionType ((uint8) partitionType))
return true;
}
@@ -1650,7 +1650,7 @@ namespace VeraCrypt
}
- uint32 BootEncryption::GetChecksum (byte *data, size_t size)
+ uint32 BootEncryption::GetChecksum (uint8 *data, size_t size)
{
uint32 sum = 0;
@@ -1664,7 +1664,7 @@ namespace VeraCrypt
}
- void BootEncryption::CreateBootLoaderInMemory (byte *buffer, size_t bufferSize, bool rescueDisk, bool hiddenOSCreation)
+ void BootEncryption::CreateBootLoaderInMemory (uint8 *buffer, size_t bufferSize, bool rescueDisk, bool hiddenOSCreation)
{
if (bufferSize < TC_BOOT_LOADER_AREA_SIZE - TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE)
throw ParameterIncorrect (SRC_POS);
@@ -1809,7 +1809,7 @@ namespace VeraCrypt
// Boot sector
DWORD size;
- byte *bootSecResourceImg = MapResource (L"BIN", bootSectorId, &size);
+ uint8 *bootSecResourceImg = MapResource (L"BIN", bootSectorId, &size);
if (!bootSecResourceImg || size != TC_SECTOR_SIZE_BIOS)
throw ParameterIncorrect (SRC_POS);
@@ -1827,7 +1827,7 @@ namespace VeraCrypt
{
Device device (GetSystemDriveConfiguration().DevicePath);
device.CheckOpened (SRC_POS);
- byte headerSector[TC_SECTOR_SIZE_BIOS];
+ uint8 headerSector[TC_SECTOR_SIZE_BIOS];
device.SeekAt (HiddenOSCandidatePartition.Info.StartingOffset.QuadPart + HiddenOSCandidatePartition.Info.PartitionLength.QuadPart - TC_VOLUME_HEADER_GROUP_SIZE + TC_VOLUME_HEADER_EFFECTIVE_SIZE);
device.Read (headerSector, sizeof (headerSector));
@@ -1836,14 +1836,14 @@ namespace VeraCrypt
}
// Decompressor
- byte *decompressor = MapResource (L"BIN", IDR_BOOT_LOADER_DECOMPRESSOR, &size);
+ uint8 *decompressor = MapResource (L"BIN", IDR_BOOT_LOADER_DECOMPRESSOR, &size);
if (!decompressor || size > TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS)
throw ParameterIncorrect (SRC_POS);
memcpy (buffer + TC_SECTOR_SIZE_BIOS, decompressor, size);
// Compressed boot loader
- byte *bootLoader = MapResource (L"BIN", bootLoaderId, &size);
+ uint8 *bootLoader = MapResource (L"BIN", bootLoaderId, &size);
if (!bootLoader || size > TC_MAX_BOOT_LOADER_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS)
throw ParameterIncorrect (SRC_POS);
@@ -1869,7 +1869,7 @@ namespace VeraCrypt
}
// return false when the user cancel an elevation request
- bool BootEncryption::ReadBootSectorConfig (byte *config, size_t bufLength, byte *userConfig, string *customUserMessage, uint16 *bootLoaderVersion)
+ bool BootEncryption::ReadBootSectorConfig (uint8 *config, size_t bufLength, uint8 *userConfig, string *customUserMessage, uint16 *bootLoaderVersion)
{
bool bCanceled = false, bExceptionOccured = false;
try
@@ -1962,11 +1962,11 @@ namespace VeraCrypt
}
- void BootEncryption::WriteBootSectorConfig (const byte newConfig[])
+ void BootEncryption::WriteBootSectorConfig (const uint8 newConfig[])
{
Device device (GetSystemDriveConfiguration().DevicePath);
device.CheckOpened (SRC_POS);
- byte mbr[TC_SECTOR_SIZE_BIOS];
+ uint8 mbr[TC_SECTOR_SIZE_BIOS];
device.SeekAt (0);
device.Read (mbr, sizeof (mbr));
@@ -1976,7 +1976,7 @@ namespace VeraCrypt
device.SeekAt (0);
device.Write (mbr, sizeof (mbr));
- byte mbrVerificationBuf[TC_SECTOR_SIZE_BIOS];
+ uint8 mbrVerificationBuf[TC_SECTOR_SIZE_BIOS];
device.SeekAt (0);
device.Read (mbrVerificationBuf, sizeof (mbr));
@@ -1984,7 +1984,7 @@ namespace VeraCrypt
throw ErrorException ("ERROR_MBR_PROTECTED", SRC_POS);
}
- void BootEncryption::WriteEfiBootSectorUserConfig (byte userConfig, const string &customUserMessage, int pim, int hashAlg)
+ void BootEncryption::WriteEfiBootSectorUserConfig (uint8 userConfig, const string &customUserMessage, int pim, int hashAlg)
{
if (!IsAdmin() && IsUacSupported())
{
@@ -2003,7 +2003,7 @@ namespace VeraCrypt
}
}
- void BootEncryption::WriteBootSectorUserConfig (byte userConfig, const string &customUserMessage, int pim, int hashAlg)
+ void BootEncryption::WriteBootSectorUserConfig (uint8 userConfig, const string &customUserMessage, int pim, int hashAlg)
{
if (GetSystemDriveConfiguration().SystemPartition.IsGPT)
{
@@ -2013,7 +2013,7 @@ namespace VeraCrypt
{
Device device (GetSystemDriveConfiguration().DevicePath);
device.CheckOpened (SRC_POS);
- byte mbr[TC_SECTOR_SIZE_BIOS];
+ uint8 mbr[TC_SECTOR_SIZE_BIOS];
device.SeekAt (0);
device.Read (mbr, sizeof (mbr));
@@ -2048,7 +2048,7 @@ namespace VeraCrypt
device.SeekAt (0);
device.Write (mbr, sizeof (mbr));
- byte mbrVerificationBuf[TC_SECTOR_SIZE_BIOS];
+ uint8 mbrVerificationBuf[TC_SECTOR_SIZE_BIOS];
device.SeekAt (0);
device.Read (mbrVerificationBuf, sizeof (mbr));
@@ -2060,7 +2060,7 @@ namespace VeraCrypt
unsigned int BootEncryption::GetHiddenOSCreationPhase ()
{
- byte configFlags [TC_BOOT_CFG_FLAG_AREA_SIZE];
+ uint8 configFlags [TC_BOOT_CFG_FLAG_AREA_SIZE];
ReadBootSectorConfig (configFlags, sizeof(configFlags));
@@ -2073,11 +2073,11 @@ namespace VeraCrypt
#if TC_BOOT_CFG_FLAG_AREA_SIZE != 1
# error TC_BOOT_CFG_FLAG_AREA_SIZE != 1; revise GetHiddenOSCreationPhase() and SetHiddenOSCreationPhase()
#endif
- byte configFlags [TC_BOOT_CFG_FLAG_AREA_SIZE];
+ uint8 configFlags [TC_BOOT_CFG_FLAG_AREA_SIZE];
ReadBootSectorConfig (configFlags, sizeof(configFlags));
- configFlags[0] &= (byte) ~TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE;
+ configFlags[0] &= (uint8) ~TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE;
configFlags[0] |= newPhase;
@@ -2154,7 +2154,7 @@ namespace VeraCrypt
Device device (GetSystemDriveConfiguration().DevicePath);
device.CheckOpened(SRC_POS);
- byte mbr[TC_SECTOR_SIZE_BIOS];
+ uint8 mbr[TC_SECTOR_SIZE_BIOS];
device.SeekAt (0);
device.Read (mbr, sizeof (mbr));
@@ -2171,7 +2171,7 @@ namespace VeraCrypt
# error PRAND_DISK_WIPE_PASSES > RNG_POOL_SIZE
#endif
- byte randData[PRAND_DISK_WIPE_PASSES];
+ uint8 randData[PRAND_DISK_WIPE_PASSES];
if (!RandgetBytes (ParentWindow, randData, sizeof (randData), FALSE))
throw ParameterIncorrect (SRC_POS);
@@ -2182,7 +2182,7 @@ namespace VeraCrypt
mbr[TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET + i] = randData[wipePass];
}
- mbr[TC_BOOT_SECTOR_CONFIG_OFFSET] &= (byte) ~TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE;
+ mbr[TC_BOOT_SECTOR_CONFIG_OFFSET] &= (uint8) ~TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE;
mbr[TC_BOOT_SECTOR_CONFIG_OFFSET] |= randData[wipePass] & TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE;
if (wipePass == PRAND_DISK_WIPE_PASSES - 1)
@@ -2384,7 +2384,7 @@ namespace VeraCrypt
if (loaderSize > 32768)
{
- std::vector<byte> bootLoaderBuf ((size_t) loaderSize);
+ std::vector<uint8> bootLoaderBuf ((size_t) loaderSize);
EfiBootInst.ReadFile(L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi", &bootLoaderBuf[0], (DWORD) loaderSize);
@@ -2699,8 +2699,8 @@ namespace VeraCrypt
uint32 varSize = 56;
varSize += ((uint32) description.length()) * 2 + 2;
varSize += ((uint32) execPath.length()) * 2 + 2;
- byte *startVar = new byte[varSize];
- byte *pVar = startVar;
+ uint8 *startVar = new uint8[varSize];
+ uint8 *pVar = startVar;
// Attributes (1b Active, 1000b - Hidden)
*(uint32 *)pVar = attr;
@@ -2721,12 +2721,12 @@ namespace VeraCrypt
/* EFI_DEVICE_PATH_PROTOCOL (HARDDRIVE_DEVICE_PATH \ FILE_PATH \ END) */
// Type
- *(byte *)pVar = 0x04;
- pVar += sizeof(byte);
+ *(uint8 *)pVar = 0x04;
+ pVar += sizeof(uint8);
// SubType
- *(byte *)pVar = 0x01;
- pVar += sizeof(byte);
+ *(uint8 *)pVar = 0x01;
+ pVar += sizeof(uint8);
// HDD dev path length
*(uint16 *)pVar = 0x2A; // 42
@@ -2749,12 +2749,12 @@ namespace VeraCrypt
pVar += 16;
// MbrType
- *(byte *)pVar = 0x02;
- pVar += sizeof(byte);
+ *(uint8 *)pVar = 0x02;
+ pVar += sizeof(uint8);
// SigType
- *(byte *)pVar = 0x02;
- pVar += sizeof(byte);
+ *(uint8 *)pVar = 0x02;
+ pVar += sizeof(uint8);
// Type and sub type 04 04 (file path)
*(uint16 *)pVar = 0x0404;
@@ -2781,7 +2781,7 @@ namespace VeraCrypt
StringCchPrintfW(varName, ARRAYSIZE (varName), L"%s%04X", type == NULL ? L"Boot" : type, statrtOrderNum);
// only set value if it doesn't already exist
- byte* existingVar = new byte[varSize];
+ uint8* existingVar = new uint8[varSize];
DWORD existingVarLen = GetFirmwareEnvironmentVariableW (varName, EfiVarGuid, existingVar, varSize);
if ((existingVarLen != varSize) || (0 != memcmp (existingVar, startVar, varSize)))
SetFirmwareEnvironmentVariable(varName, EfiVarGuid, startVar, varSize);
@@ -2813,7 +2813,7 @@ namespace VeraCrypt
wchar_t varName[256];
StringCchPrintfW(varName, ARRAYSIZE (varName), L"%s%04X", type == NULL ? L"Boot" : type, startOrder[0]);
- byte* existingVar = new byte[512];
+ uint8* existingVar = new uint8[512];
DWORD existingVarLen = GetFirmwareEnvironmentVariableW (varName, EfiVarGuid, existingVar, 512);
if (existingVarLen > 0)
{
@@ -2884,8 +2884,8 @@ namespace VeraCrypt
if (size1 == size2)
{
// same size, so now we compare content
- std::vector<byte> file1Buf (8096);
- std::vector<byte> file2Buf (8096);
+ std::vector<uint8> file1Buf (8096);
+ std::vector<uint8> file2Buf (8096);
DWORD remainingBytes = size1, dataToRead;
while (remainingBytes)
@@ -2920,7 +2920,7 @@ namespace VeraCrypt
return bRet;
}
- bool EfiBoot::CompareFileData (const wchar_t* fileName, const byte* data, DWORD size)
+ bool EfiBoot::CompareFileData (const wchar_t* fileName, const uint8* data, DWORD size)
{
bool bRet = false;
@@ -2937,7 +2937,7 @@ namespace VeraCrypt
if (existingSize == size)
{
- std::vector<byte> fileBuf (8096);
+ std::vector<uint8> fileBuf (8096);
DWORD remainingBytes = size, dataOffset = 0, dataToRead;
while (remainingBytes)
@@ -2971,7 +2971,7 @@ namespace VeraCrypt
return bRet;
}
- void EfiBoot::SaveFile(const wchar_t* name, byte* data, DWORD size) {
+ void EfiBoot::SaveFile(const wchar_t* name, uint8* data, DWORD size) {
wstring path = EfiBootPartPath;
path += name;
@@ -3000,7 +3000,7 @@ namespace VeraCrypt
f.Close();
}
- void EfiBoot::ReadFile(const wchar_t* name, byte* data, DWORD size) {
+ void EfiBoot::ReadFile(const wchar_t* name, uint8* data, DWORD size) {
wstring path = EfiBootPartPath;
path += name;
File f(path, true);
@@ -3297,51 +3297,51 @@ namespace VeraCrypt
}
DWORD sizeDcsBoot;
#ifdef _WIN64
- byte *dcsBootImg = MapResource(L"BIN", IDR_EFI_DCSBOOT, &sizeDcsBoot);
+ uint8 *dcsBootImg = MapResource(L"BIN", IDR_EFI_DCSBOOT, &sizeDcsBoot);
#else
- byte *dcsBootImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSBOOT : IDR_EFI_DCSBOOT32, &sizeDcsBoot);
+ uint8 *dcsBootImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSBOOT : IDR_EFI_DCSBOOT32, &sizeDcsBoot);
#endif
if (!dcsBootImg)
throw ErrorException(L"Out of resource DcsBoot", SRC_POS);
DWORD sizeDcsInt;
#ifdef _WIN64
- byte *dcsIntImg = MapResource(L"BIN", IDR_EFI_DCSINT, &sizeDcsInt);
+ uint8 *dcsIntImg = MapResource(L"BIN", IDR_EFI_DCSINT, &sizeDcsInt);
#else
- byte *dcsIntImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSINT: IDR_EFI_DCSINT32, &sizeDcsInt);
+ uint8 *dcsIntImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSINT: IDR_EFI_DCSINT32, &sizeDcsInt);
#endif
if (!dcsIntImg)
throw ErrorException(L"Out of resource DcsInt", SRC_POS);
DWORD sizeDcsCfg;
#ifdef _WIN64
- byte *dcsCfgImg = MapResource(L"BIN", IDR_EFI_DCSCFG, &sizeDcsCfg);
+ uint8 *dcsCfgImg = MapResource(L"BIN", IDR_EFI_DCSCFG, &sizeDcsCfg);
#else
- byte *dcsCfgImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSCFG: IDR_EFI_DCSCFG32, &sizeDcsCfg);
+ uint8 *dcsCfgImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSCFG: IDR_EFI_DCSCFG32, &sizeDcsCfg);
#endif
if (!dcsCfgImg)
throw ErrorException(L"Out of resource DcsCfg", SRC_POS);
DWORD sizeLegacySpeaker;
#ifdef _WIN64
- byte *LegacySpeakerImg = MapResource(L"BIN", IDR_EFI_LEGACYSPEAKER, &sizeLegacySpeaker);
+ uint8 *LegacySpeakerImg = MapResource(L"BIN", IDR_EFI_LEGACYSPEAKER, &sizeLegacySpeaker);
#else
- byte *LegacySpeakerImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_LEGACYSPEAKER: IDR_EFI_LEGACYSPEAKER32, &sizeLegacySpeaker);
+ uint8 *LegacySpeakerImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_LEGACYSPEAKER: IDR_EFI_LEGACYSPEAKER32, &sizeLegacySpeaker);
#endif
if (!LegacySpeakerImg)
throw ErrorException(L"Out of resource LegacySpeaker", SRC_POS);
#ifdef VC_EFI_CUSTOM_MODE
DWORD sizeBootMenuLocker;
#ifdef _WIN64
- byte *BootMenuLockerImg = MapResource(L"BIN", IDR_EFI_DCSBML, &sizeBootMenuLocker);
+ uint8 *BootMenuLockerImg = MapResource(L"BIN", IDR_EFI_DCSBML, &sizeBootMenuLocker);
#else
- byte *BootMenuLockerImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSBML: IDR_EFI_DCSBML32, &sizeBootMenuLocker);
+ uint8 *BootMenuLockerImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSBML: IDR_EFI_DCSBML32, &sizeBootMenuLocker);
#endif
if (!BootMenuLockerImg)
throw ErrorException(L"Out of resource DcsBml", SRC_POS);
#endif
DWORD sizeDcsInfo;
#ifdef _WIN64
- byte *DcsInfoImg = MapResource(L"BIN", IDR_EFI_DCSINFO, &sizeDcsInfo);
+ uint8 *DcsInfoImg = MapResource(L"BIN", IDR_EFI_DCSINFO, &sizeDcsInfo);
#else
- byte *DcsInfoImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSINFO: IDR_EFI_DCSINFO32, &sizeDcsInfo);
+ uint8 *DcsInfoImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSINFO: IDR_EFI_DCSINFO32, &sizeDcsInfo);
#endif
if (!DcsInfoImg)
throw ErrorException(L"Out of resource DcsInfo", SRC_POS);
@@ -3373,7 +3373,7 @@ namespace VeraCrypt
{
if (loaderSize > 32768)
{
- std::vector<byte> bootLoaderBuf ((size_t) loaderSize);
+ std::vector<uint8> bootLoaderBuf ((size_t) loaderSize);
EfiBootInst.ReadFile(L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi", &bootLoaderBuf[0], (DWORD) loaderSize);
@@ -3391,7 +3391,7 @@ namespace VeraCrypt
// DcsBoot.efi is always smaller than 32KB
if (loaderSize > 32768)
{
- std::vector<byte> bootLoaderBuf ((size_t) loaderSize);
+ std::vector<uint8> bootLoaderBuf ((size_t) loaderSize);
EfiBootInst.ReadFile(L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi", &bootLoaderBuf[0], (DWORD) loaderSize);
@@ -3420,7 +3420,7 @@ namespace VeraCrypt
{
// look for bootmgfw.efi identifiant string
EfiBootInst.GetFileSize(loaderPath.c_str(), loaderSize);
- std::vector<byte> bootLoaderBuf ((size_t) loaderSize);
+ std::vector<uint8> bootLoaderBuf ((size_t) loaderSize);
EfiBootInst.ReadFile(loaderPath.c_str(), &bootLoaderBuf[0], (DWORD) loaderSize);
@@ -3453,7 +3453,7 @@ namespace VeraCrypt
EfiBootInst.GetFileSize(szStdEfiBootloader, loaderSize);
if (loaderSize > 32768)
{
- std::vector<byte> bootLoaderBuf ((size_t) loaderSize);
+ std::vector<uint8> bootLoaderBuf ((size_t) loaderSize);
EfiBootInst.ReadFile(szStdEfiBootloader, &bootLoaderBuf[0], (DWORD) loaderSize);
@@ -3487,7 +3487,7 @@ namespace VeraCrypt
// check if standard bootloader under EFI\Boot is Microsoft one or if it is ours
// if both cases, replace it with our bootloader otherwise do nothing
EfiBootInst.GetFileSize(szStdEfiBootloader, loaderSize);
- std::vector<byte> bootLoaderBuf ((size_t) loaderSize);
+ std::vector<uint8> bootLoaderBuf ((size_t) loaderSize);
EfiBootInst.ReadFile(szStdEfiBootloader, &bootLoaderBuf[0], (DWORD) loaderSize);
// look for bootmgfw.efi or VeraCrypt identifiant strings
@@ -3539,11 +3539,11 @@ namespace VeraCrypt
{
try
{
- byte bootLoaderBuf[TC_BOOT_LOADER_AREA_SIZE - TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE] = {0};
+ uint8 bootLoaderBuf[TC_BOOT_LOADER_AREA_SIZE - TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE] = {0};
CreateBootLoaderInMemory (bootLoaderBuf, sizeof (bootLoaderBuf), false, hiddenOSCreation);
// Write MBR
- byte mbr[TC_SECTOR_SIZE_BIOS];
+ uint8 mbr[TC_SECTOR_SIZE_BIOS];
device.SeekAt (0);
device.Read (mbr, sizeof (mbr));
@@ -3578,7 +3578,7 @@ namespace VeraCrypt
device.SeekAt (0);
device.Write (mbr, sizeof (mbr));
- byte mbrVerificationBuf[TC_SECTOR_SIZE_BIOS];
+ uint8 mbrVerificationBuf[TC_SECTOR_SIZE_BIOS];
device.SeekAt (0);
device.Read (mbrVerificationBuf, sizeof (mbr));
@@ -3620,9 +3620,9 @@ namespace VeraCrypt
if (config.SystemPartition.IsGPT)
return true;
- byte bootLoaderBuf[TC_BOOT_LOADER_AREA_SIZE - TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE] = {0};
- byte fingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE];
- byte expectedFingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE];
+ uint8 bootLoaderBuf[TC_BOOT_LOADER_AREA_SIZE - TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE] = {0};
+ uint8 fingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE];
+ uint8 expectedFingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE];
bool bRet = false;
try
@@ -3694,59 +3694,59 @@ namespace VeraCrypt
// create EFI disk structure
DWORD sizeDcsBoot;
#ifdef _WIN64
- byte *dcsBootImg = MapResource(L"BIN", IDR_EFI_DCSBOOT, &sizeDcsBoot);
+ uint8 *dcsBootImg = MapResource(L"BIN", IDR_EFI_DCSBOOT, &sizeDcsBoot);
#else
- byte *dcsBootImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSBOOT : IDR_EFI_DCSBOOT32, &sizeDcsBoot);
+ uint8 *dcsBootImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSBOOT : IDR_EFI_DCSBOOT32, &sizeDcsBoot);
#endif
if (!dcsBootImg)
throw ParameterIncorrect (SRC_POS);
DWORD sizeDcsInt;
#ifdef _WIN64
- byte *dcsIntImg = MapResource(L"BIN", IDR_EFI_DCSINT, &sizeDcsInt);
+ uint8 *dcsIntImg = MapResource(L"BIN", IDR_EFI_DCSINT, &sizeDcsInt);
#else
- byte *dcsIntImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSINT: IDR_EFI_DCSINT32, &sizeDcsInt);
+ uint8 *dcsIntImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSINT: IDR_EFI_DCSINT32, &sizeDcsInt);
#endif
if (!dcsIntImg)
throw ParameterIncorrect (SRC_POS);
DWORD sizeDcsCfg;
#ifdef _WIN64
- byte *dcsCfgImg = MapResource(L"BIN", IDR_EFI_DCSCFG, &sizeDcsCfg);
+ uint8 *dcsCfgImg = MapResource(L"BIN", IDR_EFI_DCSCFG, &sizeDcsCfg);
#else
- byte *dcsCfgImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSCFG: IDR_EFI_DCSCFG32, &sizeDcsCfg);
+ uint8 *dcsCfgImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSCFG: IDR_EFI_DCSCFG32, &sizeDcsCfg);
#endif
if (!dcsCfgImg)
throw ParameterIncorrect (SRC_POS);
DWORD sizeLegacySpeaker;
#ifdef _WIN64
- byte *LegacySpeakerImg = MapResource(L"BIN", IDR_EFI_LEGACYSPEAKER, &sizeLegacySpeaker);
+ uint8 *LegacySpeakerImg = MapResource(L"BIN", IDR_EFI_LEGACYSPEAKER, &sizeLegacySpeaker);
#else
- byte *LegacySpeakerImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_LEGACYSPEAKER: IDR_EFI_LEGACYSPEAKER32, &sizeLegacySpeaker);
+ uint8 *LegacySpeakerImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_LEGACYSPEAKER: IDR_EFI_LEGACYSPEAKER32, &sizeLegacySpeaker);
#endif
if (!LegacySpeakerImg)
throw ParameterIncorrect (SRC_POS);
#ifdef VC_EFI_CUSTOM_MODE
DWORD sizeBootMenuLocker;
#ifdef _WIN64
- byte *BootMenuLockerImg = MapResource(L"BIN", IDR_EFI_DCSBML, &sizeBootMenuLocker);
+ uint8 *BootMenuLockerImg = MapResource(L"BIN", IDR_EFI_DCSBML, &sizeBootMenuLocker);
#else
- byte *BootMenuLockerImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSBML: IDR_EFI_DCSBML32, &sizeBootMenuLocker);
+ uint8 *BootMenuLockerImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSBML: IDR_EFI_DCSBML32, &sizeBootMenuLocker);
#endif
if (!BootMenuLockerImg)
throw ParameterIncorrect (SRC_POS);
#endif
DWORD sizeDcsRescue;
#ifdef _WIN64
- byte *DcsRescueImg = MapResource(L"BIN", IDR_EFI_DCSRE, &sizeDcsRescue);
+ uint8 *DcsRescueImg = MapResource(L"BIN", IDR_EFI_DCSRE, &sizeDcsRescue);
#else
- byte *DcsRescueImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSRE: IDR_EFI_DCSRE32, &sizeDcsRescue);
+ uint8 *DcsRescueImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSRE: IDR_EFI_DCSRE32, &sizeDcsRescue);
#endif
if (!DcsRescueImg)
throw ParameterIncorrect (SRC_POS);
DWORD sizeDcsInfo;
#ifdef _WIN64
- byte *DcsInfoImg = MapResource(L"BIN", IDR_EFI_DCSINFO, &sizeDcsInfo);
+ uint8 *DcsInfoImg = MapResource(L"BIN", IDR_EFI_DCSINFO, &sizeDcsInfo);
#else
- byte *DcsInfoImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSINFO: IDR_EFI_DCSINFO32, &sizeDcsInfo);
+ uint8 *DcsInfoImg = MapResource(L"BIN", Is64BitOs()? IDR_EFI_DCSINFO: IDR_EFI_DCSINFO32, &sizeDcsInfo);
#endif
if (!DcsInfoImg)
throw ParameterIncorrect (SRC_POS);
@@ -3866,7 +3866,7 @@ namespace VeraCrypt
finally_do_arg (FILE*, ftmpFile, { fclose (finally_arg); });
unsigned long ulZipSize = (unsigned long) _filelength (_fileno (ftmpFile));
- RescueZipData = new byte[ulZipSize];
+ RescueZipData = new uint8[ulZipSize];
if (!RescueZipData)
throw bad_alloc();
@@ -3889,7 +3889,7 @@ namespace VeraCrypt
{
Buffer imageBuf (RescueIsoImageSize);
- byte *image = imageBuf.Ptr();
+ uint8 *image = imageBuf.Ptr();
memset (image, 0, RescueIsoImageSize);
// Primary volume descriptor
@@ -3997,7 +3997,7 @@ namespace VeraCrypt
// Boot loader backup
CreateBootLoaderInMemory (image + TC_CD_BOOTSECTOR_OFFSET + TC_BOOT_LOADER_BACKUP_RESCUE_DISK_SECTOR_OFFSET, TC_BOOT_LOADER_AREA_SIZE, false);
- RescueIsoImage = new byte[RescueIsoImageSize];
+ RescueIsoImage = new uint8[RescueIsoImageSize];
if (!RescueIsoImage)
throw bad_alloc();
memcpy (RescueIsoImage, image, RescueIsoImageSize);
@@ -4370,7 +4370,7 @@ namespace VeraCrypt
if (GetHeaderField32 (RescueVolumeHeader, TC_HEADER_OFFSET_MAGIC) != 0x56455241)
throw ParameterIncorrect (SRC_POS);
- byte *fieldPos = RescueVolumeHeader + TC_HEADER_OFFSET_ENCRYPTED_AREA_LENGTH;
+ uint8 *fieldPos = RescueVolumeHeader + TC_HEADER_OFFSET_ENCRYPTED_AREA_LENGTH;
mputInt64 (fieldPos, volumeSize);
// CRC of the header fields
@@ -4394,7 +4394,7 @@ namespace VeraCrypt
device.CheckOpened (SRC_POS);
device.SeekAt (TC_BOOT_VOLUME_HEADER_SECTOR_OFFSET);
- device.Write ((byte *) VolumeHeader, sizeof (VolumeHeader));
+ device.Write ((uint8 *) VolumeHeader, sizeof (VolumeHeader));
}
@@ -4435,7 +4435,7 @@ namespace VeraCrypt
}
}
unsigned __int64 loaderSize = 0;
- std::vector<byte> bootLoaderBuf;
+ std::vector<uint8> bootLoaderBuf;
const wchar_t * szStdMsBootloader = L"\\EFI\\Microsoft\\Boot\\bootmgfw.efi";
const wchar_t * szBackupMsBootloader = L"\\EFI\\Microsoft\\Boot\\bootmgfw_ms.vc";
const char* g_szMsBootString = "bootmgfw.pdb";
@@ -4495,7 +4495,7 @@ namespace VeraCrypt
{
Device device (GetSystemDriveConfiguration().DevicePath, true);
device.CheckOpened (SRC_POS);
- byte bootLoaderBuf[TC_BOOT_LOADER_AREA_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS];
+ uint8 bootLoaderBuf[TC_BOOT_LOADER_AREA_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS];
device.SeekAt (0);
device.Read (bootLoaderBuf, sizeof (bootLoaderBuf));
@@ -4558,7 +4558,7 @@ namespace VeraCrypt
const char* g_szMsBootString = "bootmgfw.pdb";
unsigned __int64 loaderSize = 0;
EfiBootInst.GetFileSize(loaderPath.c_str(), loaderSize);
- std::vector<byte> bootLoaderBuf ((size_t) loaderSize);
+ std::vector<uint8> bootLoaderBuf ((size_t) loaderSize);
EfiBootInst.ReadFile(loaderPath.c_str(), &bootLoaderBuf[0], (DWORD) loaderSize);
@@ -4592,7 +4592,7 @@ namespace VeraCrypt
}
else
{
- byte bootLoaderBuf[TC_BOOT_LOADER_AREA_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS];
+ uint8 bootLoaderBuf[TC_BOOT_LOADER_AREA_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS];
File backupFile (GetSystemLoaderBackupPath(), true);
backupFile.CheckOpened(SRC_POS);
@@ -4603,7 +4603,7 @@ namespace VeraCrypt
device.CheckOpened (SRC_POS);
// Preserve current partition table
- byte mbr[TC_SECTOR_SIZE_BIOS];
+ uint8 mbr[TC_SECTOR_SIZE_BIOS];
device.SeekAt (0);
device.Read (mbr, sizeof (mbr));
memcpy (bootLoaderBuf + TC_MAX_MBR_BOOT_CODE_SIZE, mbr + TC_MAX_MBR_BOOT_CODE_SIZE, sizeof (mbr) - TC_MAX_MBR_BOOT_CODE_SIZE);
@@ -4743,7 +4743,7 @@ namespace VeraCrypt
// Register class filter below all other filters in the stack
size_t strSize = filter.size() + 1;
- byte regKeyBuf[65536];
+ uint8 regKeyBuf[65536];
DWORD size = (DWORD) (sizeof (regKeyBuf) - strSize);
// SetupInstallFromInfSection() does not support prepending of values so we have to modify the registry directly
@@ -4761,8 +4761,8 @@ namespace VeraCrypt
// read initial value
DWORD strSize = (DWORD) filter.size() + 1, expectedSize;
Buffer expectedRegKeyBuf(65536), outputRegKeyBuf(65536);
- byte* pbExpectedRegKeyBuf = expectedRegKeyBuf.Ptr ();
- byte* pbOutputRegKeyBuf = outputRegKeyBuf.Ptr ();
+ uint8* pbExpectedRegKeyBuf = expectedRegKeyBuf.Ptr ();
+ uint8* pbOutputRegKeyBuf = outputRegKeyBuf.Ptr ();
DWORD initialSize = (DWORD) (expectedRegKeyBuf.Size() - strSize - 2);
if (RegQueryValueExA (regKey, filterReg.c_str(), NULL, NULL, pbExpectedRegKeyBuf, &initialSize) != ERROR_SUCCESS)
@@ -4814,7 +4814,7 @@ namespace VeraCrypt
// remove value in case it was not done properly
Buffer regKeyBuf(65536);
- byte* pbRegKeyBuf = regKeyBuf.Ptr ();
+ uint8* pbRegKeyBuf = regKeyBuf.Ptr ();
DWORD initialSize = (DWORD) regKeyBuf.Size() - 2;
@@ -5302,12 +5302,12 @@ namespace VeraCrypt
// Verify CRC of header salt
Device device(config.DevicePath, true);
device.CheckOpened(SRC_POS);
- byte header[TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE];
+ uint8 header[TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE];
device.SeekAt(TC_BOOT_VOLUME_HEADER_SECTOR_OFFSET);
device.Read(header, sizeof(header));
- if (encStatus.VolumeHeaderSaltCrc32 != GetCrc32((byte *)header, PKCS5_SALT_SIZE))
+ if (encStatus.VolumeHeaderSaltCrc32 != GetCrc32((uint8 *)header, PKCS5_SALT_SIZE))
throw ParameterIncorrect(SRC_POS);
}
}
@@ -5394,7 +5394,7 @@ namespace VeraCrypt
}
device.SeekAt (headerOffset);
- device.Read ((byte *) header, sizeof (header));
+ device.Read ((uint8 *) header, sizeof (header));
PCRYPTO_INFO cryptoInfo = NULL;
@@ -5482,7 +5482,7 @@ namespace VeraCrypt
}
device.SeekAt (headerOffset);
- device.Write ((byte *) header, sizeof (header));
+ device.Write ((uint8 *) header, sizeof (header));
headerUpdated = true;
}
@@ -5513,7 +5513,7 @@ namespace VeraCrypt
try
{
// check if PIM is stored in MBR
- byte userConfig = 0;
+ uint8 userConfig = 0;
if ( ReadBootSectorConfig (nullptr, 0, &userConfig)
&& (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_PIM)
)
@@ -5790,7 +5790,7 @@ namespace VeraCrypt
return configMap;
}
- void BootEncryption::WriteBootDriveSector (uint64 offset, byte *data)
+ void BootEncryption::WriteBootDriveSector (uint64 offset, uint8 *data)
{
WriteBootDriveSectorRequest request;
request.Offset.QuadPart = offset;
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;
diff --git a/src/Common/CommandAPDU.cpp b/src/Common/CommandAPDU.cpp
index b202cb13..46aab465 100644
--- a/src/Common/CommandAPDU.cpp
+++ b/src/Common/CommandAPDU.cpp
@@ -116,7 +116,7 @@ namespace VeraCrypt
clear();
}
- void CommandAPDU::init(byte cla, byte ins, byte p1, byte p2, const byte* data, uint32 dataOffset, uint32 dataLength, uint32 ne)
+ void CommandAPDU::init(uint8 cla, uint8 ins, uint8 p1, uint8 p2, const uint8* data, uint32 dataOffset, uint32 dataLength, uint32 ne)
{
m_nc = 0;
m_ne = 0;
@@ -156,7 +156,7 @@ namespace VeraCrypt
{
// case 2s
// 256 is encoded as 0x00
- byte len = (m_ne != 256) ? (byte)m_ne : 0;
+ uint8 len = (m_ne != 256) ? (uint8)m_ne : 0;
m_apdu.resize(5, 0);
setHeader(cla, ins, p1, p2);
m_apdu[4] = len;
@@ -164,7 +164,7 @@ namespace VeraCrypt
else
{
// case 2e
- byte l1, l2;
+ uint8 l1, l2;
// 65536 is encoded as 0x00 0x00
if (m_ne == 65536)
{
@@ -173,8 +173,8 @@ namespace VeraCrypt
}
else
{
- l1 = (byte)(m_ne >> 8);
- l2 = (byte)m_ne;
+ l1 = (uint8)(m_ne >> 8);
+ l2 = (uint8)m_ne;
}
m_apdu.resize(7, 0);
setHeader(cla, ins, p1, p2);
@@ -194,7 +194,7 @@ namespace VeraCrypt
// case 3s
m_apdu.resize(4 + 1 + dataLength, 0);
setHeader(cla, ins, p1, p2);
- m_apdu[4] = (byte)dataLength;
+ m_apdu[4] = (uint8)dataLength;
m_dataOffset = 5;
memcpy(m_apdu.data() + 5, data + dataOffset, dataLength);
}
@@ -204,8 +204,8 @@ namespace VeraCrypt
m_apdu.resize(4 + 3 + dataLength, 0);
setHeader(cla, ins, p1, p2);
m_apdu[4] = 0;
- m_apdu[5] = (byte)(dataLength >> 8);
- m_apdu[6] = (byte)dataLength;
+ m_apdu[5] = (uint8)(dataLength >> 8);
+ m_apdu[6] = (uint8)dataLength;
m_dataOffset = 7;
memcpy(m_apdu.data() + 7, data + dataOffset, dataLength);
m_isExtendedAPDU = true;
@@ -219,10 +219,10 @@ namespace VeraCrypt
// case 4s
m_apdu.resize(4 + 2 + dataLength, 0);
setHeader(cla, ins, p1, p2);
- m_apdu[4] = (byte)dataLength;
+ m_apdu[4] = (uint8)dataLength;
m_dataOffset = 5;
memcpy(m_apdu.data() + 5, data + dataOffset, dataLength);
- m_apdu[m_apdu.size() - 1] = (m_ne != 256) ? (byte)m_ne : 0;
+ m_apdu[m_apdu.size() - 1] = (m_ne != 256) ? (uint8)m_ne : 0;
}
else
{
@@ -230,15 +230,15 @@ namespace VeraCrypt
m_apdu.resize(4 + 5 + dataLength, 0);
setHeader(cla, ins, p1, p2);
m_apdu[4] = 0;
- m_apdu[5] = (byte)(dataLength >> 8);
- m_apdu[6] = (byte)dataLength;
+ m_apdu[5] = (uint8)(dataLength >> 8);
+ m_apdu[6] = (uint8)dataLength;
m_dataOffset = 7;
memcpy(m_apdu.data() + 7, data + dataOffset, dataLength);
if (ne != 65536)
{
size_t leOfs = m_apdu.size() - 2;
- m_apdu[leOfs] = (byte)(m_ne >> 8);
- m_apdu[leOfs + 1] = (byte)m_ne;
+ m_apdu[leOfs] = (uint8)(m_ne >> 8);
+ m_apdu[leOfs + 1] = (uint8)m_ne;
} // else le == 65536: no need to fill in, encoded as 0
m_isExtendedAPDU = true;
}
@@ -248,12 +248,12 @@ namespace VeraCrypt
m_parsedSuccessfully = true;
}
- void CommandAPDU::setHeader(byte cla, byte ins, byte p1, byte p2)
+ void CommandAPDU::setHeader(uint8 cla, uint8 ins, uint8 p1, uint8 p2)
{
- m_apdu[0] = (byte)cla;
- m_apdu[1] = (byte)ins;
- m_apdu[2] = (byte)p1;
- m_apdu[3] = (byte)p2;
+ m_apdu[0] = (uint8)cla;
+ m_apdu[1] = (uint8)ins;
+ m_apdu[2] = (uint8)p1;
+ m_apdu[3] = (uint8)p2;
}
void CommandAPDU::clear()
@@ -264,58 +264,58 @@ namespace VeraCrypt
m_dataOffset = 0;
}
- CommandAPDU::CommandAPDU(byte cla, byte ins, byte p1, byte p2, const byte* data, uint32 dataOffset, uint32 dataLength, uint32 ne)
+ CommandAPDU::CommandAPDU(uint8 cla, uint8 ins, uint8 p1, uint8 p2, const uint8* data, uint32 dataOffset, uint32 dataLength, uint32 ne)
{
init(cla, ins, p1, p2, data, dataOffset, dataLength, ne);
}
- CommandAPDU::CommandAPDU(byte cla, byte ins, byte p1, byte p2)
+ CommandAPDU::CommandAPDU(uint8 cla, uint8 ins, uint8 p1, uint8 p2)
{
init(cla, ins, p1, p2, NULL, 0, 0, 0);
}
- CommandAPDU::CommandAPDU(byte cla, byte ins, byte p1, byte p2, uint32 ne)
+ CommandAPDU::CommandAPDU(uint8 cla, uint8 ins, uint8 p1, uint8 p2, uint32 ne)
{
init(cla, ins, p1, p2, NULL, 0, 0, ne);
}
- CommandAPDU::CommandAPDU(byte cla, byte ins, byte p1, byte p2, const vector<byte>& data)
+ CommandAPDU::CommandAPDU(uint8 cla, uint8 ins, uint8 p1, uint8 p2, const vector<uint8>& data)
{
init(cla, ins, p1, p2, data.data(), 0, (uint32)data.size(), 0);
}
- CommandAPDU::CommandAPDU(byte cla, byte ins, byte p1, byte p2, const byte* data, uint32 dataOffset, uint32 dataLength)
+ CommandAPDU::CommandAPDU(uint8 cla, uint8 ins, uint8 p1, uint8 p2, const uint8* data, uint32 dataOffset, uint32 dataLength)
{
init(cla, ins, p1, p2, data, dataOffset, dataLength, 0);
}
- CommandAPDU::CommandAPDU(byte cla, byte ins, byte p1, byte p2, const vector<byte>& data, uint32 ne)
+ CommandAPDU::CommandAPDU(uint8 cla, uint8 ins, uint8 p1, uint8 p2, const vector<uint8>& data, uint32 ne)
{
init(cla, ins, p1, p2, data.data(), 0, (uint32)data.size(), ne);
}
- CommandAPDU::CommandAPDU(const vector<byte>& apdu) : m_nc(0), m_ne(0), m_dataOffset(0), m_isExtendedAPDU(false)
+ CommandAPDU::CommandAPDU(const vector<uint8>& apdu) : m_nc(0), m_ne(0), m_dataOffset(0), m_isExtendedAPDU(false)
{
m_apdu = apdu;
parse();
}
- byte CommandAPDU::getCLA()
+ uint8 CommandAPDU::getCLA()
{
return m_apdu[0] & 0xff;
}
- byte CommandAPDU::getINS()
+ uint8 CommandAPDU::getINS()
{
return m_apdu[1] & 0xff;
}
- byte CommandAPDU::getP1()
+ uint8 CommandAPDU::getP1()
{
return m_apdu[2] & 0xff;
}
- byte CommandAPDU::getP2()
+ uint8 CommandAPDU::getP2()
{
return m_apdu[3] & 0xff;
}
@@ -325,9 +325,9 @@ namespace VeraCrypt
return m_nc;
}
- const vector<byte> CommandAPDU::getData()
+ const vector<uint8> CommandAPDU::getData()
{
- vector<byte> data;
+ vector<uint8> data;
if (m_nc > 0)
{
@@ -343,7 +343,7 @@ namespace VeraCrypt
return m_ne;
}
- const vector<byte> CommandAPDU::getAPDU()
+ const vector<uint8> CommandAPDU::getAPDU()
{
return m_apdu;
}
diff --git a/src/Common/CommandAPDU.h b/src/Common/CommandAPDU.h
index 98825faa..f1adf176 100644
--- a/src/Common/CommandAPDU.h
+++ b/src/Common/CommandAPDU.h
@@ -34,7 +34,7 @@ namespace VeraCrypt
{
protected:
- vector<byte> m_apdu;
+ vector<uint8> m_apdu;
uint32 m_nc;
uint32 m_ne;
uint32 m_dataOffset;
@@ -43,8 +43,8 @@ namespace VeraCrypt
bool m_parsedSuccessfully;
void parse();
- void init(byte cla, byte ins, byte p1, byte p2, const byte* data, uint32 dataOffset, uint32 dataLength, uint32 ne);
- void setHeader(byte cla, byte ins, byte p1, byte p2);
+ void init(uint8 cla, uint8 ins, uint8 p1, uint8 p2, const uint8* data, uint32 dataOffset, uint32 dataLength, uint32 ne);
+ void setHeader(uint8 cla, uint8 ins, uint8 p1, uint8 p2);
public:
@@ -52,35 +52,35 @@ namespace VeraCrypt
CommandAPDU();
- CommandAPDU(byte cla, byte ins, byte p1, byte p2, const byte* data, uint32 dataOffset, uint32 dataLength, uint32 ne);
+ CommandAPDU(uint8 cla, uint8 ins, uint8 p1, uint8 p2, const uint8* data, uint32 dataOffset, uint32 dataLength, uint32 ne);
- CommandAPDU(byte cla, byte ins, byte p1, byte p2);
+ CommandAPDU(uint8 cla, uint8 ins, uint8 p1, uint8 p2);
- CommandAPDU(byte cla, byte ins, byte p1, byte p2, uint32 ne);
+ CommandAPDU(uint8 cla, uint8 ins, uint8 p1, uint8 p2, uint32 ne);
- CommandAPDU(byte cla, byte ins, byte p1, byte p2, const vector<byte>& data);
+ CommandAPDU(uint8 cla, uint8 ins, uint8 p1, uint8 p2, const vector<uint8>& data);
- CommandAPDU(byte cla, byte ins, byte p1, byte p2, const byte* data, uint32 dataOffset, uint32 dataLength);
+ CommandAPDU(uint8 cla, uint8 ins, uint8 p1, uint8 p2, const uint8* data, uint32 dataOffset, uint32 dataLength);
- CommandAPDU(byte cla, byte ins, byte p1, byte p2, const vector<byte>& data, uint32 ne);
+ CommandAPDU(uint8 cla, uint8 ins, uint8 p1, uint8 p2, const vector<uint8>& data, uint32 ne);
- CommandAPDU(const vector<byte>& apdu);
+ CommandAPDU(const vector<uint8>& apdu);
- byte getCLA();
+ uint8 getCLA();
- byte getINS();
+ uint8 getINS();
- byte getP1();
+ uint8 getP1();
- byte getP2();
+ uint8 getP2();
uint32 getNc();
- const vector<byte> getData();
+ const vector<uint8> getData();
uint32 getNe();
- const vector<byte> getAPDU();
+ const vector<uint8> getAPDU();
bool isValid();
diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c
index 49948107..9c4ee5a3 100644
--- a/src/Common/Crypto.c
+++ b/src/Common/Crypto.c
@@ -219,7 +219,7 @@ void EncipherBlock(int cipher, void *data, void *ks)
void EncipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
{
- byte *data = dataPtr;
+ uint8 *data = dataPtr;
#if defined (TC_WINDOWS_DRIVER) && !defined (_WIN64)
KFLOATING_SAVE floatingPointState;
#endif
@@ -317,7 +317,7 @@ void DecipherBlock(int cipher, void *data, void *ks)
case AES:
#if defined (_WIN64) || !defined (TC_WINDOWS_DRIVER)
if (IsAesHwCpuSupported())
- aes_hw_cpu_decrypt ((byte *) ks + sizeof (aes_encrypt_ctx), data);
+ aes_hw_cpu_decrypt ((uint8 *) ks + sizeof (aes_encrypt_ctx), data);
else
#endif
aes_decrypt (data, data, (void *) ((char *) ks + sizeof(aes_encrypt_ctx)));
@@ -334,7 +334,7 @@ void DecipherBlock(int cipher, void *data, void *ks)
void DecipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
{
- byte *data = dataPtr;
+ uint8 *data = dataPtr;
#if defined (TC_WINDOWS_DRIVER) && !defined (_WIN64)
KFLOATING_SAVE floatingPointState;
#endif
@@ -349,7 +349,7 @@ void DecipherBlocks (int cipher, void *dataPtr, void *ks, size_t blockCount)
{
while (blockCount > 0)
{
- aes_hw_cpu_decrypt_32_blocks ((byte *) ks + sizeof (aes_encrypt_ctx), data);
+ aes_hw_cpu_decrypt_32_blocks ((uint8 *) ks + sizeof (aes_encrypt_ctx), data);
data += 32 * 16;
blockCount -= 32;
@@ -855,7 +855,7 @@ int GetMaxPkcs5OutSize (void)
#ifdef TC_WINDOWS_BOOT
-static byte CryptoInfoBufferInUse = 0;
+static uint8 CryptoInfoBufferInUse = 0;
CRYPTO_INFO CryptoInfoBuffer;
#endif
@@ -1118,7 +1118,7 @@ void EncipherBlock(int cipher, void *data, void *ks)
{
#ifdef TC_WINDOWS_BOOT_AES
if (IsAesHwCpuSupported())
- aes_hw_cpu_encrypt ((byte *) ks, data);
+ aes_hw_cpu_encrypt ((uint8 *) ks, data);
else
aes_encrypt (data, data, ks);
#elif defined (TC_WINDOWS_BOOT_SERPENT) && !defined (WOLFCRYPT_BACKEND)
@@ -1134,9 +1134,9 @@ void DecipherBlock(int cipher, void *data, void *ks)
{
#ifdef TC_WINDOWS_BOOT_AES
if (IsAesHwCpuSupported())
- aes_hw_cpu_decrypt ((byte *) ks + sizeof (aes_encrypt_ctx) + 14 * 16, data);
+ aes_hw_cpu_decrypt ((uint8 *) ks + sizeof (aes_encrypt_ctx) + 14 * 16, data);
else
- aes_decrypt (data, data, (aes_decrypt_ctx *) ((byte *) ks + sizeof(aes_encrypt_ctx)));
+ aes_decrypt (data, data, (aes_decrypt_ctx *) ((uint8 *) ks + sizeof(aes_encrypt_ctx)));
#elif defined (TC_WINDOWS_BOOT_SERPENT) && !defined (WOLFCRYPT_BACKEND)
serpent_decrypt (data, data, ks);
#elif defined (TC_WINDOWS_BOOT_TWOFISH) && !defined (WOLFCRYPT_BACKEND)
@@ -1278,7 +1278,7 @@ BOOL IsRamEncryptionEnabled ()
}
/* masking for random index to remove bias */
-byte GetRngMask (byte count)
+uint8 GetRngMask (uint8 count)
{
if (count >= 128)
return 0xFF;
@@ -1297,10 +1297,10 @@ byte GetRngMask (byte count)
return 1;
}
-byte GetRandomIndex (ChaCha20RngCtx* pCtx, byte elementsCount)
+uint8 GetRandomIndex (ChaCha20RngCtx* pCtx, uint8 elementsCount)
{
- byte index = 0;
- byte mask = GetRngMask (elementsCount);
+ uint8 index = 0;
+ uint8 mask = GetRngMask (elementsCount);
while (TRUE)
{
@@ -1315,7 +1315,7 @@ byte GetRandomIndex (ChaCha20RngCtx* pCtx, byte elementsCount)
#if defined(_WIN64) && !defined (_UEFI)
/* declaration of variables and functions used for RAM encryption on 64-bit build */
-static byte* pbKeyDerivationArea = NULL;
+static uint8* pbKeyDerivationArea = NULL;
static ULONG cbKeyDerivationArea = 0;
static uint64 HashSeedMask = 0;
@@ -1331,9 +1331,9 @@ ULONG AllocTag = 'MMCV';
BOOL InitializeSecurityParameters(GetRandSeedFn rngCallback)
{
ChaCha20RngCtx ctx;
- byte pbSeed[CHACHA20RNG_KEYSZ + CHACHA20RNG_IVSZ];
+ uint8 pbSeed[CHACHA20RNG_KEYSZ + CHACHA20RNG_IVSZ];
#ifdef TC_WINDOWS_DRIVER
- byte i;
+ uint8 i;
char randomStr[4];
Dump ("InitializeSecurityParameters BEGIN\n");
#endif
@@ -1390,7 +1390,7 @@ BOOL InitializeSecurityParameters(GetRandSeedFn rngCallback)
cbKeyDerivationArea = 1024 * 1024;
do
{
- pbKeyDerivationArea = (byte*) TCalloc(cbKeyDerivationArea);
+ pbKeyDerivationArea = (uint8*) TCalloc(cbKeyDerivationArea);
if (!pbKeyDerivationArea)
cbKeyDerivationArea >>= 1;
} while (!pbKeyDerivationArea && (cbKeyDerivationArea >= (2*PAGE_SIZE)));
@@ -1531,25 +1531,25 @@ void VcUnprotectKeys (PCRYPTO_INFO pCryptoInfo, uint64 encID)
#if defined(_M_ARM64) || defined(__arm__) || defined (__arm64__) || defined (__aarch64__)
/* dummy implementation that should never be called */
-void aes_hw_cpu_decrypt(const byte* ks, byte* data)
+void aes_hw_cpu_decrypt(const uint8* ks, uint8* data)
{
ks = ks;
data = data;
}
-void aes_hw_cpu_decrypt_32_blocks(const byte* ks, byte* data)
+void aes_hw_cpu_decrypt_32_blocks(const uint8* ks, uint8* data)
{
ks = ks;
data = data;
}
-void aes_hw_cpu_encrypt(const byte* ks, byte* data)
+void aes_hw_cpu_encrypt(const uint8* ks, uint8* data)
{
ks = ks;
data = data;
}
-void aes_hw_cpu_encrypt_32_blocks(const byte* ks, byte* data)
+void aes_hw_cpu_encrypt_32_blocks(const uint8* ks, uint8* data)
{
ks = ks;
data = data;
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 4ea10aaa..e7103d0d 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -2884,7 +2884,7 @@ LRESULT CALLBACK CustomDlgProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar
static BOOL IsReturnAddress (DWORD64 address)
{
static size_t codeEnd = 0;
- byte *sp = (byte *) address;
+ uint8 *sp = (uint8 *) address;
if (codeEnd == 0)
{
@@ -3018,7 +3018,7 @@ void ExceptionHandlerThread (void *threadArg)
MEMORY_BASIC_INFORMATION mi;
VirtualQuery (sp, &mi, sizeof (mi));
- PDWORD stackTop = (PDWORD)((byte *) mi.BaseAddress + mi.RegionSize);
+ PDWORD stackTop = (PDWORD)((uint8 *) mi.BaseAddress + mi.RegionSize);
int i = 0;
while (retAddrs.size() < 16 && &sp[i] < stackTop)
@@ -5796,24 +5796,24 @@ wstring ArrayToHexWideString (const unsigned char* pbData, int cbData)
return result;
}
-bool HexToByte (wchar_t c, byte& b)
+bool HexToByte (wchar_t c, uint8& b)
{
bool bRet = true;
if (c >= L'0' && c <= L'9')
- b = (byte) (c - L'0');
+ b = (uint8) (c - L'0');
else if (c >= L'a' && c <= L'z')
- b = (byte) (c - L'a' + 10);
+ b = (uint8) (c - L'a' + 10);
else if (c >= L'A' && c <= L'Z')
- b = (byte) (c - L'A' + 10);
+ b = (uint8) (c - L'A' + 10);
else
bRet = false;
return bRet;
}
-bool HexWideStringToArray (const wchar_t* hexStr, std::vector<byte>& arr)
+bool HexWideStringToArray (const wchar_t* hexStr, std::vector<uint8>& arr)
{
- byte b1, b2;
+ uint8 b1, b2;
size_t i, len = wcslen (hexStr);
arr.clear();
@@ -8716,7 +8716,7 @@ retry:
if ((path.length () >= 3) && (_wcsnicmp (path.c_str(), L"ID:", 3) == 0))
{
- std::vector<byte> arr;
+ std::vector<uint8> arr;
if ( (path.length() == (3 + 2*VOLUME_ID_SIZE))
&& HexWideStringToArray (path.c_str() + 3, arr)
&& (arr.size() == VOLUME_ID_SIZE)
@@ -9168,7 +9168,7 @@ BOOL IsMountedVolume (const wchar_t *volname)
if ((wcslen (volname) == (3 + 2*VOLUME_ID_SIZE)) && _wcsnicmp (volname, L"ID:", 3) == 0)
{
/* Volume ID specified. Use it for matching mounted volumes. */
- std::vector<byte> arr;
+ std::vector<uint8> arr;
if (HexWideStringToArray (&volname[3], arr) && (arr.size() == VOLUME_ID_SIZE))
{
return IsMountedVolumeID (&arr[0]);
@@ -11577,7 +11577,7 @@ int OpenVolume (OpenVolumeContext *context, const wchar_t *volumePath, Password
// Read volume header
DWORD bytesRead;
- if (!ReadEffectiveVolumeHeader (context->IsDevice, context->HostFileHandle, (byte *) buffer, &bytesRead))
+ if (!ReadEffectiveVolumeHeader (context->IsDevice, context->HostFileHandle, (uint8 *) buffer, &bytesRead))
{
status = ERR_OS_ERROR;
goto error;
@@ -12162,7 +12162,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
if (BrowseFiles (hwndDlg, "SELECT_KEYFILE", keyfilePath, bHistory, FALSE))
{
DWORD keyfileSize;
- byte *keyfileData = (byte *) LoadFile (keyfilePath, &keyfileSize);
+ uint8 *keyfileData = (uint8 *) LoadFile (keyfilePath, &keyfileSize);
if (!keyfileData)
{
handleWin32Error (hwndDlg, SRC_POS);
@@ -12180,7 +12180,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
if (DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_NEW_TOKEN_KEYFILE), hwndDlg, (DLGPROC) NewSecurityTokenKeyfileDlgProc, (LPARAM) &newParams) == IDOK)
{
- vector <byte> keyfileDataVector (keyfileSize);
+ vector <uint8> keyfileDataVector (keyfileSize);
memcpy (&keyfileDataVector.front(), keyfileData, keyfileSize);
try
@@ -12229,7 +12229,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
WaitCursor();
finally_do ({ NormalCursor(); });
- vector <byte> keyfileData;
+ vector <uint8> keyfileData;
keyfile->GetKeyfileData (keyfileData);
@@ -12240,7 +12240,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam
return 1;
}
- finally_do_arg (vector <byte> *, &keyfileData, { burn (&finally_arg->front(), finally_arg->size()); });
+ finally_do_arg (vector <uint8> *, &keyfileData, { burn (&finally_arg->front(), finally_arg->size()); });
if (!SaveBufferToFile ((char *) &keyfileData.front(), keyfilePath, (DWORD) keyfileData.size(), FALSE, FALSE))
throw SystemException (SRC_POS);
@@ -13023,7 +13023,7 @@ void CheckFilesystem (HWND hwndDlg, int driveNo, BOOL fixErrors)
ShellExecuteW (NULL, (!IsAdmin() && IsUacSupported()) ? L"runas" : L"open", cmdPath, param, NULL, SW_SHOW);
}
-BOOL BufferContainsPattern (const byte *buffer, size_t bufferSize, const byte *pattern, size_t patternSize)
+BOOL BufferContainsPattern (const uint8 *buffer, size_t bufferSize, const uint8 *pattern, size_t patternSize)
{
if (bufferSize < patternSize)
return FALSE;
@@ -13040,14 +13040,14 @@ BOOL BufferContainsPattern (const byte *buffer, size_t bufferSize, const byte *p
}
-BOOL BufferContainsString (const byte *buffer, size_t bufferSize, const char *str)
+BOOL BufferContainsString (const uint8 *buffer, size_t bufferSize, const char *str)
{
- return BufferContainsPattern (buffer, bufferSize, (const byte*) str, strlen (str));
+ return BufferContainsPattern (buffer, bufferSize, (const uint8*) str, strlen (str));
}
-BOOL BufferContainsWideString (const byte *buffer, size_t bufferSize, const wchar_t *str)
+BOOL BufferContainsWideString (const uint8 *buffer, size_t bufferSize, const wchar_t *str)
{
- return BufferContainsPattern (buffer, bufferSize, (const byte*) str, 2 * wcslen (str));
+ return BufferContainsPattern (buffer, bufferSize, (const uint8*) str, 2 * wcslen (str));
}
@@ -13507,7 +13507,7 @@ void RegisterDriverInf (bool registerFilter, const string& filter, const string&
"[veracrypt_reg]\r\n"
"HKR,,\"" + filterReg + "\",0x0001" + string (registerFilter ? "0008" : "8002") + ",\"" + filter + "\"\r\n";
- infFile.Write ((byte *) infTxt.c_str(), (DWORD) infTxt.size());
+ infFile.Write ((uint8 *) infTxt.c_str(), (DWORD) infTxt.size());
infFile.Close();
HINF hInf = SetupOpenInfFileW (infFileName.c_str(), NULL, INF_STYLE_OLDNT | INF_STYLE_WIN4, NULL);
@@ -13582,7 +13582,7 @@ void AllowMessageInUIPI (UINT msg)
ChangeWindowMessageFilter (msg, MSGFLT_ADD);
}
-BOOL IsRepeatedByteArray (byte value, const byte* buffer, size_t bufferSize)
+BOOL IsRepeatedByteArray (uint8 value, const uint8* buffer, size_t bufferSize)
{
if (buffer && bufferSize)
{
@@ -13606,7 +13606,7 @@ BOOL TranslateVolumeID (HWND hwndDlg, wchar_t* pathValue, size_t cchPathValue)
size_t pathLen = pathValue? wcslen (pathValue) : 0;
if ((pathLen >= 3) && (_wcsnicmp (pathValue, L"ID:", 3) == 0))
{
- std::vector<byte> arr;
+ std::vector<uint8> arr;
if ( (pathLen == (3 + 2*VOLUME_ID_SIZE))
&& HexWideStringToArray (pathValue + 3, arr)
&& (arr.size() == VOLUME_ID_SIZE)
@@ -14758,7 +14758,7 @@ void GetAppRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed)
{
LARGE_INTEGER iSeed;
SYSTEMTIME sysTime;
- byte digest[WHIRLPOOL_DIGESTSIZE];
+ uint8 digest[WHIRLPOOL_DIGESTSIZE];
WHIRLPOOL_CTX tctx;
size_t count;
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index 750b4dc7..288daecd 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -550,9 +550,9 @@ BOOL InitSecurityTokenLibrary (HWND hwndDlg);
BOOL FileHasReadOnlyAttribute (const wchar_t *path);
BOOL IsFileOnReadOnlyFilesystem (const wchar_t *path);
void CheckFilesystem (HWND hwndDlg, int driveNo, BOOL fixErrors);
-BOOL BufferContainsPattern (const byte *buffer, size_t bufferSize, const byte *pattern, size_t patternSize);
-BOOL BufferContainsString (const byte *buffer, size_t bufferSize, const char *str);
-BOOL BufferContainsWideString (const byte *buffer, size_t bufferSize, const wchar_t *str);
+BOOL BufferContainsPattern (const uint8 *buffer, size_t bufferSize, const uint8 *pattern, size_t patternSize);
+BOOL BufferContainsString (const uint8 *buffer, size_t bufferSize, const char *str);
+BOOL BufferContainsWideString (const uint8 *buffer, size_t bufferSize, const wchar_t *str);
int AskNonSysInPlaceEncryptionResume (HWND hwndDlg, BOOL* pbDecrypt);
BOOL RemoveDeviceWriteProtection (HWND hwndDlg, wchar_t *devicePath);
void EnableElevatedCursorChange (HWND parent);
@@ -573,7 +573,7 @@ int AddBitmapToImageList(HIMAGELIST himl, HBITMAP hbmImage, HBITMAP hbmMask);
HRESULT VCStrDupW(LPCWSTR psz, LPWSTR *ppwsz);
void ProcessEntropyEstimate (HWND hProgress, DWORD* pdwInitialValue, DWORD dwCounter, DWORD dwMaxLevel, DWORD* pdwEntropy);
void AllowMessageInUIPI (UINT msg);
-BOOL IsRepeatedByteArray (byte value, const byte* buffer, size_t bufferSize);
+BOOL IsRepeatedByteArray (uint8 value, const uint8* buffer, size_t bufferSize);
BOOL TranslateVolumeID (HWND hwndDlg, wchar_t* pathValue, size_t cchPathValue);
BOOL CopyTextToClipboard (const wchar_t* txtValue);
BOOL LaunchElevatedProcess (HWND hwndDlg, const wchar_t* szModPath, const wchar_t* args);
@@ -714,7 +714,7 @@ std::wstring FindLatestFileOrDirectory (const std::wstring &directory, const wch
std::wstring GetUserFriendlyVersionString (int version);
std::wstring IntToWideString (int val);
std::wstring ArrayToHexWideString (const unsigned char* pbData, int cbData);
-bool HexWideStringToArray (const wchar_t* hexStr, std::vector<byte>& arr);
+bool HexWideStringToArray (const wchar_t* hexStr, std::vector<uint8>& arr);
std::wstring FindDeviceByVolumeID (const BYTE volumeID [VOLUME_ID_SIZE], BOOL bFromService);
void RegisterDriverInf (bool registerFilter, const std::string& filter, const std::string& filterReg, HWND ParentWindow, HKEY regKey);
std::wstring GetTempPathString ();
diff --git a/src/Common/EMVCard.cpp b/src/Common/EMVCard.cpp
index e96422b1..59dc3cf0 100644
--- a/src/Common/EMVCard.cpp
+++ b/src/Common/EMVCard.cpp
@@ -40,19 +40,19 @@ namespace VeraCrypt
}
#endif
- map<EMVCardType, vector<byte>> InitializeSupportedAIDs()
+ map<EMVCardType, vector<uint8>> InitializeSupportedAIDs()
{
- map<EMVCardType, vector<byte>> supportedAIDs;
- supportedAIDs.insert(std::make_pair(EMVCardType::AMEX, vector<byte>(EMVCard::AMEX_AID, EMVCard::AMEX_AID + sizeof(EMVCard::AMEX_AID))));
- supportedAIDs.insert(std::make_pair(EMVCardType::MASTERCARD, vector<byte>(EMVCard::MASTERCARD_AID, EMVCard::MASTERCARD_AID + sizeof(EMVCard::MASTERCARD_AID))));
- supportedAIDs.insert(std::make_pair(EMVCardType::VISA, vector<byte>(EMVCard::VISA_AID, EMVCard::VISA_AID + sizeof(EMVCard::VISA_AID))));
+ map<EMVCardType, vector<uint8>> supportedAIDs;
+ supportedAIDs.insert(std::make_pair(EMVCardType::AMEX, vector<uint8>(EMVCard::AMEX_AID, EMVCard::AMEX_AID + sizeof(EMVCard::AMEX_AID))));
+ supportedAIDs.insert(std::make_pair(EMVCardType::MASTERCARD, vector<uint8>(EMVCard::MASTERCARD_AID, EMVCard::MASTERCARD_AID + sizeof(EMVCard::MASTERCARD_AID))));
+ supportedAIDs.insert(std::make_pair(EMVCardType::VISA, vector<uint8>(EMVCard::VISA_AID, EMVCard::VISA_AID + sizeof(EMVCard::VISA_AID))));
return supportedAIDs;
}
- const byte EMVCard::AMEX_AID[7] = {0xA0, 0x00, 0x00, 0x00, 0x00, 0x25, 0x10};
- const byte EMVCard::MASTERCARD_AID[7] = {0xA0, 0x00, 0x00, 0x00, 0x04, 0x10, 0x10};
- const byte EMVCard::VISA_AID[7] = {0xA0, 0x00, 0x00, 0x00, 0x03, 0x10, 0x10};
- const map<EMVCardType, vector<byte>> EMVCard::SUPPORTED_AIDS = InitializeSupportedAIDs();
+ const uint8 EMVCard::AMEX_AID[7] = {0xA0, 0x00, 0x00, 0x00, 0x00, 0x25, 0x10};
+ const uint8 EMVCard::MASTERCARD_AID[7] = {0xA0, 0x00, 0x00, 0x00, 0x04, 0x10, 0x10};
+ const uint8 EMVCard::VISA_AID[7] = {0xA0, 0x00, 0x00, 0x00, 0x03, 0x10, 0x10};
+ const map<EMVCardType, vector<uint8>> EMVCard::SUPPORTED_AIDS = InitializeSupportedAIDs();
EMVCard::EMVCard() : SCard(), m_lastPANDigits(L"")
{
@@ -130,15 +130,15 @@ namespace VeraCrypt
m_lastPANDigits.clear();
}
- vector<byte> EMVCard::GetCardAID(bool forceContactless)
+ vector<uint8> EMVCard::GetCardAID(bool forceContactless)
{
- vector<vector<byte>> supportedAIDs;
- vector<byte> supportedAIDsPriorities;
- vector<pair<byte, vector<byte>>> supportedAIDsSorted;
+ vector<vector<uint8>> supportedAIDs;
+ vector<uint8> supportedAIDsPriorities;
+ vector<pair<uint8, vector<uint8>>> supportedAIDsSorted;
bool hasBeenReset = false;
CommandAPDU command;
ResponseAPDU response;
- vector<byte> responseData;
+ vector<uint8> responseData;
shared_ptr<TLVNode> rootNode;
shared_ptr<TLVNode> fciNode;
shared_ptr<TLVNode> dfNameNode;
@@ -149,7 +149,7 @@ namespace VeraCrypt
vector<shared_ptr<TLVNode>> pseDirectoryNodes;
unsigned char sfi;
bool usingContactless = false;
- vector<byte> tokenAID;
+ vector<uint8> tokenAID;
if (m_aid.size())
return m_aid;
@@ -241,7 +241,7 @@ namespace VeraCrypt
{
sfi = sfiNode->Value->at(0);
- byte rec = 1;
+ uint8 rec = 1;
do
{
command = CommandAPDU(CLA_ISO7816, INS_READ_RECORD, rec++, (sfi << 3) | 4, SCardReader::shortAPDUMaxTransSize);
@@ -316,20 +316,20 @@ namespace VeraCrypt
return tokenAID;
}
- void EMVCard::GetCardContent(vector<byte>& iccCert, vector<byte>& issuerCert, vector<byte>& cplcData)
+ void EMVCard::GetCardContent(vector<uint8>& iccCert, vector<uint8>& issuerCert, vector<uint8>& cplcData)
{
bool hasBeenReset = false;
bool aidSelected = false;
bool iccFound = false;
bool issuerFound = false;
bool cplcFound = false;
- vector<byte> emvCardAid;
+ vector<uint8> emvCardAid;
shared_ptr<TLVNode> rootNode;
shared_ptr<TLVNode> iccPublicKeyCertNode;
shared_ptr<TLVNode> issuerPublicKeyCertNode;
CommandAPDU command;
ResponseAPDU response;
- vector<byte> responseData;
+ vector<uint8> responseData;
iccCert.clear();
issuerCert.clear();
@@ -374,9 +374,9 @@ namespace VeraCrypt
// TODO: Send GET PROCESSING OPTIONS to get the AIL and AFL,
// which will then be used to get the actual start and end of sfi and rec.
- for (byte sfi = 1; sfi < 32 && (!iccFound || !issuerFound); sfi++)
+ for (uint8 sfi = 1; sfi < 32 && (!iccFound || !issuerFound); sfi++)
{
- for (byte rec = 1; rec < 17 && (!iccFound || !issuerFound); rec++)
+ for (uint8 rec = 1; rec < 17 && (!iccFound || !issuerFound); rec++)
{
command = CommandAPDU(CLA_ISO7816, INS_READ_RECORD, rec, (sfi << 3) | 4, SCardReader::shortAPDUMaxTransSize);
m_reader->ApduProcessData(command, response);
@@ -436,13 +436,13 @@ namespace VeraCrypt
bool hasBeenReset = false;
bool panFound = false;
bool aidSelected = false;
- vector<byte> EMVCardAid;
- vector<byte> panData;
+ vector<uint8> EMVCardAid;
+ vector<uint8> panData;
shared_ptr<TLVNode> rootNode;
shared_ptr<TLVNode> panNode;
CommandAPDU command;
ResponseAPDU response;
- vector<byte> responseData;
+ vector<uint8> responseData;
lastPANDigits = L"";
@@ -474,9 +474,9 @@ namespace VeraCrypt
// TODO: Send GET PROCESSING OPTIONS to get the AIL and AFL,
// which will then be used to get the actual start and end of sfi and rec.
- for (byte sfi = 1; sfi < 32 && !panFound; sfi++)
+ for (uint8 sfi = 1; sfi < 32 && !panFound; sfi++)
{
- for (byte rec = 1; rec < 17 && !panFound; rec++)
+ for (uint8 rec = 1; rec < 17 && !panFound; rec++)
{
command = CommandAPDU(CLA_ISO7816, INS_READ_RECORD, rec, (sfi << 3) | 4, SCardReader::shortAPDUMaxTransSize);
m_reader->ApduProcessData(command, response);
@@ -498,7 +498,7 @@ namespace VeraCrypt
{
panFound = true;
panData = *panNode->Value.get();
- panData = vector<byte>(panData.rbegin(), panData.rbegin() + 2); // only interested in last digits
+ panData = vector<uint8>(panData.rbegin(), panData.rbegin() + 2); // only interested in last digits
std::swap(panData[0], panData[1]);
lastPANDigits = ArrayToHexWideString(panData.data(), (int) panData.size());
}
diff --git a/src/Common/EMVCard.h b/src/Common/EMVCard.h
index 116de705..70ef035f 100644
--- a/src/Common/EMVCard.h
+++ b/src/Common/EMVCard.h
@@ -29,11 +29,11 @@ namespace VeraCrypt
// After the card has been read, and if some or all fields cannot be read, the EMVCard
// object will be considered invalid and will not be included in the list of available cards
// of EMVToken.
- vector<byte> m_aid;
- vector<vector<byte>> m_supportedAids;
- vector<byte> m_iccCert;
- vector<byte> m_issuerCert;
- vector<byte> m_cplcData;
+ vector<uint8> m_aid;
+ vector<vector<uint8>> m_supportedAids;
+ vector<uint8> m_iccCert;
+ vector<uint8> m_issuerCert;
+ vector<uint8> m_cplcData;
wstring m_lastPANDigits;
public:
@@ -41,10 +41,10 @@ namespace VeraCrypt
// Add other AIDS
// https://gist.github.com/pvieito/6224eed92c99b069f6401996c548d0e4
// https://ambimat.com/developer-resources/list-of-application-identifiers-aid/
- const static byte AMEX_AID[7];
- const static byte MASTERCARD_AID[7];
- const static byte VISA_AID[7];
- const static map<EMVCardType, vector<byte>> SUPPORTED_AIDS;
+ const static uint8 AMEX_AID[7];
+ const static uint8 MASTERCARD_AID[7];
+ const static uint8 VISA_AID[7];
+ const static map<EMVCardType, vector<uint8>> SUPPORTED_AIDS;
EMVCard();
EMVCard(size_t slotId);
@@ -59,9 +59,9 @@ namespace VeraCrypt
// Retrieves the card's AID.
// It first checks the card against a list of supported AIDs.
// If that fails, it tries getting the AID from the card using PSE
- vector<byte> GetCardAID(bool forceContactless = false);
+ vector<uint8> GetCardAID(bool forceContactless = false);
- void GetCardContent(vector<byte>& iccCert, vector<byte>& issuerCert, vector<byte>& cplcData);
+ void GetCardContent(vector<uint8>& iccCert, vector<uint8>& issuerCert, vector<uint8>& cplcData);
void GetCardPAN(wstring& lastPANDigits);
};
}
diff --git a/src/Common/EMVToken.cpp b/src/Common/EMVToken.cpp
index 0fe3dc1f..8f89cb7e 100644
--- a/src/Common/EMVToken.cpp
+++ b/src/Common/EMVToken.cpp
@@ -22,7 +22,7 @@ using namespace std;
namespace VeraCrypt
{
- void AppendData(vector<byte>& buffer, const unsigned char* pbData, size_t cbData, size_t from, size_t length, bool bEncodeLength = false)
+ void AppendData(vector<uint8>& buffer, const unsigned char* pbData, size_t cbData, size_t from, size_t length, bool bEncodeLength = false)
{
if (cbData > 0 && from <= cbData - 2 && length > 0 && length <= cbData - from)
{
@@ -74,13 +74,13 @@ namespace VeraCrypt
return path.str();
}
- void EMVTokenKeyfile::GetKeyfileData(vector <byte>& keyfileData) const
+ void EMVTokenKeyfile::GetKeyfileData(vector <uint8>& keyfileData) const
{
map <unsigned long int, shared_ptr<EMVCard>>::iterator emvCardsIt;
shared_ptr<EMVCard> card;
- vector<byte> iccCert;
- vector<byte> issuerCert;
- vector<byte> cplcData;
+ vector<uint8> iccCert;
+ vector<uint8> issuerCert;
+ vector<uint8> cplcData;
bool addNewCard = true;
keyfileData.clear();
diff --git a/src/Common/EMVToken.h b/src/Common/EMVToken.h
index a1c0a2e1..d82ea542 100644
--- a/src/Common/EMVToken.h
+++ b/src/Common/EMVToken.h
@@ -23,7 +23,7 @@ namespace VeraCrypt
virtual ~EMVTokenKeyfile() {};
virtual operator TokenKeyfilePath () const;
- virtual void GetKeyfileData(vector <byte>& keyfileData) const;
+ virtual void GetKeyfileData(vector <uint8>& keyfileData) const;
};
class EMVToken
@@ -33,7 +33,7 @@ namespace VeraCrypt
static vector<EMVTokenKeyfile> GetAvailableKeyfiles(unsigned long int* slotIdFilter = nullptr, const wstring& keyfileIdFilter = wstring());
static EMVTokenInfo GetTokenInfo(unsigned long int slotId);
- friend void EMVTokenKeyfile::GetKeyfileData(vector <byte>& keyfileData) const;
+ friend void EMVTokenKeyfile::GetKeyfileData(vector <uint8>& keyfileData) const;
static map <unsigned long int, shared_ptr<EMVCard>> EMVCards;
};
diff --git a/src/Common/EncryptionThreadPool.c b/src/Common/EncryptionThreadPool.c
index 62b2cae8..79f1c890 100644
--- a/src/Common/EncryptionThreadPool.c
+++ b/src/Common/EncryptionThreadPool.c
@@ -88,7 +88,7 @@ typedef struct EncryptionThreadPoolWorkItemStruct
struct
{
PCRYPTO_INFO CryptoInfo;
- byte *Data;
+ uint8 *Data;
UINT64_STRUCT StartUnitNo;
uint32 UnitCount;
@@ -606,13 +606,13 @@ void EncryptionThreadPoolBeginReadVolumeHeaderFinalization (TC_EVENT *keyDerivat
}
-void EncryptionThreadPoolDoWork (EncryptionThreadPoolWorkType type, byte *data, const UINT64_STRUCT *startUnitNo, uint32 unitCount, PCRYPTO_INFO cryptoInfo)
+void EncryptionThreadPoolDoWork (EncryptionThreadPoolWorkType type, uint8 *data, const UINT64_STRUCT *startUnitNo, uint32 unitCount, PCRYPTO_INFO cryptoInfo)
{
uint32 fragmentCount;
uint32 unitsPerFragment;
uint32 remainder;
- byte *fragmentData;
+ uint8 *fragmentData;
uint64 fragmentStartUnitNo;
EncryptionThreadPoolWorkItem *workItem;
diff --git a/src/Common/EncryptionThreadPool.h b/src/Common/EncryptionThreadPool.h
index 053d4107..71df4e4d 100644
--- a/src/Common/EncryptionThreadPool.h
+++ b/src/Common/EncryptionThreadPool.h
@@ -34,7 +34,7 @@ size_t GetCpuCount (WORD* pGroupCount);
void EncryptionThreadPoolBeginKeyDerivation (TC_EVENT *completionEvent, TC_EVENT *noOutstandingWorkItemEvent, LONG *completionFlag, LONG *outstandingWorkItemCount, int pkcs5Prf, char *password, int passwordLength, char *salt, int iterationCount, char *derivedKey);
void EncryptionThreadPoolBeginReadVolumeHeaderFinalization (TC_EVENT *keyDerivationCompletedEvent, TC_EVENT *noOutstandingWorkItemEvent, LONG* outstandingWorkItemCount, void* keyInfoBuffer, int keyInfoBufferSize, void* keyDerivationWorkItems, int keyDerivationWorkItemsSize);
-void EncryptionThreadPoolDoWork (EncryptionThreadPoolWorkType type, byte *data, const UINT64_STRUCT *startUnitNo, uint32 unitCount, PCRYPTO_INFO cryptoInfo);
+void EncryptionThreadPoolDoWork (EncryptionThreadPoolWorkType type, uint8 *data, const UINT64_STRUCT *startUnitNo, uint32 unitCount, PCRYPTO_INFO cryptoInfo);
BOOL EncryptionThreadPoolStart (size_t encryptionFreeCpuCount);
void EncryptionThreadPoolStop ();
size_t GetEncryptionThreadCount ();
diff --git a/src/Common/Fat.h b/src/Common/Fat.h
index b2457be2..19b5cebb 100644
--- a/src/Common/Fat.h
+++ b/src/Common/Fat.h
@@ -14,7 +14,7 @@
typedef struct fatparams_t
{
char volume_name[11];
- byte volume_id[4];
+ uint8 volume_id[4];
unsigned int num_sectors; /* total number of sectors */
int cluster_count; /* number of clusters */
int size_root_dir; /* size of the root directory in bytes */
diff --git a/src/Common/Format.c b/src/Common/Format.c
index 4d8dfed9..7eff80e6 100644
--- a/src/Common/Format.c
+++ b/src/Common/Format.c
@@ -532,7 +532,7 @@ begin_format:
// To prevent fragmentation, write zeroes to reserved header sectors which are going to be filled with random data
if (!volParams->bDevice && !volParams->hiddenVol)
{
- byte buf[TC_VOLUME_HEADER_GROUP_SIZE - TC_VOLUME_HEADER_EFFECTIVE_SIZE];
+ uint8 buf[TC_VOLUME_HEADER_GROUP_SIZE - TC_VOLUME_HEADER_EFFECTIVE_SIZE];
DWORD bytesWritten;
ZeroMemory (buf, sizeof (buf));
@@ -1392,7 +1392,7 @@ static volatile BOOL WriteThreadRunning;
static volatile BOOL WriteThreadExitRequested;
static HANDLE WriteThreadHandle;
-static byte *WriteThreadBuffer;
+static uint8 *WriteThreadBuffer;
static HANDLE WriteBufferEmptyEvent;
static HANDLE WriteBufferFullEvent;
diff --git a/src/Common/Keyfiles.c b/src/Common/Keyfiles.c
index d10daa06..6d9907cd 100644
--- a/src/Common/Keyfiles.c
+++ b/src/Common/Keyfiles.c
@@ -253,7 +253,7 @@ BOOL KeyFilesApply (HWND hwndDlg, Password *password, KeyFile *firstKeyFile, con
if (Token::IsKeyfilePathValid (kf->FileName, EMVSupportEnabled? true : false))
{
// Apply security token keyfile
- vector <byte> keyfileData;
+ vector <uint8> keyfileData;
TokenKeyfilePath secPath (kf->FileName);
Token::getTokenKeyfile (secPath)->GetKeyfileData (keyfileData);
diff --git a/src/Common/ResponseAPDU.cpp b/src/Common/ResponseAPDU.cpp
index 8a7f069c..3fe3b6de 100644
--- a/src/Common/ResponseAPDU.cpp
+++ b/src/Common/ResponseAPDU.cpp
@@ -5,7 +5,7 @@ using namespace std;
namespace VeraCrypt
{
- uint16 BytesToUInt16(const vector<byte>& buff)
+ uint16 BytesToUInt16(const vector<uint8>& buff)
{
uint16 value = 0;
for (uint16 i = 0; i < buff.size(); i++)
@@ -17,7 +17,7 @@ namespace VeraCrypt
return value;
}
- void AppendData (vector<byte>& buffer, const byte* pbData, size_t cbData)
+ void AppendData (vector<uint8>& buffer, const uint8* pbData, size_t cbData)
{
size_t orgSize = buffer.size ();
buffer.resize (orgSize + cbData);
@@ -36,7 +36,7 @@ namespace VeraCrypt
{
}
- ResponseAPDU::ResponseAPDU(const vector<byte>& data, uint16 SW)
+ ResponseAPDU::ResponseAPDU(const vector<uint8>& data, uint16 SW)
{
m_data = data;
m_SW = SW;
@@ -47,19 +47,19 @@ namespace VeraCrypt
return (uint32)m_data.size();
}
- const vector<byte> ResponseAPDU::getData()
+ const vector<uint8> ResponseAPDU::getData()
{
return m_data;
}
- byte ResponseAPDU::getSW1()
+ uint8 ResponseAPDU::getSW1()
{
- return (byte)((0xFF00 & m_SW) >> 8);
+ return (uint8)((0xFF00 & m_SW) >> 8);
}
- byte ResponseAPDU::getSW2()
+ uint8 ResponseAPDU::getSW2()
{
- return (byte)(0x00FF & m_SW);
+ return (uint8)(0x00FF & m_SW);
}
uint16 ResponseAPDU::getSW()
@@ -67,23 +67,23 @@ namespace VeraCrypt
return m_SW;
}
- const vector<byte> ResponseAPDU::getBytes()
+ const vector<uint8> ResponseAPDU::getBytes()
{
- vector<byte> apdu;
+ vector<uint8> apdu;
AppendData(apdu, m_data.data(), m_data.size());
- apdu.push_back((byte)getSW1());
- apdu.push_back((byte)getSW2());
+ apdu.push_back((uint8)getSW1());
+ apdu.push_back((uint8)getSW2());
return apdu;
}
- void ResponseAPDU::appendData(const vector<byte>& data)
+ void ResponseAPDU::appendData(const vector<uint8>& data)
{
appendData(data.data(), data.size());
}
- void ResponseAPDU::appendData(const byte* data, size_t dataLen)
+ void ResponseAPDU::appendData(const uint8* data, size_t dataLen)
{
AppendData(m_data, data, dataLen);
}
@@ -93,12 +93,12 @@ namespace VeraCrypt
m_SW = SW;
}
- void ResponseAPDU::setBytes(const vector<byte>& bytes)
+ void ResponseAPDU::setBytes(const vector<uint8>& bytes)
{
clear();
if (bytes.size() >= 2)
{
- vector<byte> SWBytes;
+ vector<uint8> SWBytes;
m_data.resize(bytes.size() - 2);
SWBytes.resize(2);
diff --git a/src/Common/ResponseAPDU.h b/src/Common/ResponseAPDU.h
index b9aa4adc..f279afca 100644
--- a/src/Common/ResponseAPDU.h
+++ b/src/Common/ResponseAPDU.h
@@ -9,7 +9,7 @@ namespace VeraCrypt
{
protected:
- vector<byte> m_data;
+ vector<uint8> m_data;
uint16 m_SW;
@@ -19,25 +19,25 @@ namespace VeraCrypt
ResponseAPDU();
- ResponseAPDU(const vector<byte>& data, uint16 SW);
+ ResponseAPDU(const vector<uint8>& data, uint16 SW);
uint32 getNr();
- const vector<byte> getData();
+ const vector<uint8> getData();
- byte getSW1();
+ uint8 getSW1();
- byte getSW2();
+ uint8 getSW2();
uint16 getSW();
- const vector<byte> getBytes();
+ const vector<uint8> getBytes();
void setSW(uint16 SW);
- void setBytes(const vector<byte>& bytes);
+ void setBytes(const vector<uint8>& bytes);
- void appendData(const vector<byte>& data);
- void appendData(const byte* data, size_t dataLen);
+ void appendData(const vector<uint8>& data);
+ void appendData(const uint8* data, size_t dataLen);
};
};
diff --git a/src/Common/SCardLoader.h b/src/Common/SCardLoader.h
index b1ab114b..a7243d82 100644
--- a/src/Common/SCardLoader.h
+++ b/src/Common/SCardLoader.h
@@ -14,7 +14,7 @@
#include <PCSC/wintypes.h>
#include "reader.h"
typedef LPSCARD_READERSTATE_A LPSCARD_READERSTATE;
-using VeraCrypt::byte;
+using VeraCrypt::uint8;
#define BOOL int
#else
#undef BOOL
@@ -22,7 +22,7 @@ using VeraCrypt::byte;
#include <winscard.h>
#include <wintypes.h>
#include <reader.h>
-using VeraCrypt::byte;
+using VeraCrypt::uint8;
#define BOOL int
#endif
#endif
diff --git a/src/Common/SCardReader.cpp b/src/Common/SCardReader.cpp
index 3a762415..de269ce6 100644
--- a/src/Common/SCardReader.cpp
+++ b/src/Common/SCardReader.cpp
@@ -117,7 +117,7 @@ namespace VeraCrypt
return name;
}
- bool SCardReader::IsCardPresent(vector<byte>& cardAtr)
+ bool SCardReader::IsCardPresent(vector<uint8>& cardAtr)
{
LONG lRet = SCARD_S_SUCCESS;
SCARD_READERSTATE state;
@@ -165,7 +165,7 @@ namespace VeraCrypt
bool SCardReader::IsCardPresent()
{
- vector<byte> dummy;
+ vector<uint8> dummy;
return IsCardPresent(dummy);
}
@@ -398,8 +398,8 @@ namespace VeraCrypt
size_t indexOfLe = 0;
size_t indexOfLcData = 0;
- vector<byte> pbSendBuffer;
- vector<byte> pbRecvBuffer;
+ vector<uint8> pbSendBuffer;
+ vector<uint8> pbRecvBuffer;
DWORD cbSendLength = 0;
DWORD cbRecvLength = 0;
@@ -460,7 +460,7 @@ namespace VeraCrypt
// 256 is encoded as 0x00
pbSendBuffer[4] = (BYTE)ne;
indexOfLe = 4;
- cbSendLength = 4 + 1; // header || Le (1 byte)
+ cbSendLength = 4 + 1; // header || Le (1 uint8)
}
else
{
@@ -494,7 +494,7 @@ namespace VeraCrypt
// case 3s
pbSendBuffer[4] = (BYTE)nc;
indexOfLcData = 5;
- cbSendLength = 4 + 1 + nc; // header || Lc (1 byte) || Data
+ cbSendLength = 4 + 1 + nc; // header || Lc (1 uint8) || Data
memcpy(&pbSendBuffer[indexOfLcData], commandAPDU.getData().data(), nc);
}
else
@@ -518,7 +518,7 @@ namespace VeraCrypt
// case 4s
pbSendBuffer[4] = (BYTE)nc;
indexOfLcData = 5;
- cbSendLength = 4 + 1 + nc + 1; // header || Lc (1 byte) || Data || Le (1 byte)
+ cbSendLength = 4 + 1 + nc + 1; // header || Lc (1 uint8) || Data || Le (1 uint8)
memcpy(&pbSendBuffer[indexOfLcData], commandAPDU.getData().data(), nc);
pbSendBuffer[indexOfLcData + nc] = (ne != 256) ? (BYTE)ne : 0;
indexOfLe = indexOfLcData + nc;
@@ -646,9 +646,9 @@ namespace VeraCrypt
throw PCSCException(lRet);
}
- void SCardReader::GetATRFromHandle(vector<byte>& atrValue)
+ void SCardReader::GetATRFromHandle(vector<uint8>& atrValue)
{
- vector<byte> pbATR;
+ vector<uint8> pbATR;
DWORD cByte = 0;
LONG lRet = 0;
diff --git a/src/Common/SCardReader.h b/src/Common/SCardReader.h
index 95586963..8814bce0 100644
--- a/src/Common/SCardReader.h
+++ b/src/Common/SCardReader.h
@@ -51,52 +51,52 @@ namespace VeraCrypt
/* ================================================================================================ */
/* CLA values */
/* ================================================================================================ */
- const byte CLA_ISO7816 = (byte)0x00;
- const byte CLA_COMMAND_CHAINING = (byte)0x10;
+ const uint8 CLA_ISO7816 = (uint8)0x00;
+ const uint8 CLA_COMMAND_CHAINING = (uint8)0x10;
/* ================================================================================================ */
/* INS values */
/* ================================================================================================ */
- const byte INS_ERASE_BINARY = 0x0E;
- const byte INS_VERIFY = 0x20;
- const byte INS_CHANGE_CHV = 0x24;
- const byte INS_UNBLOCK_CHV = 0x2C;
- const byte INS_DECREASE = 0x30;
- const byte INS_INCREASE = 0x32;
- const byte INS_DECREASE_STAMPED = 0x34;
- const byte INS_REHABILITATE_CHV = 0x44;
- const byte INS_MANAGE_CHANNEL = 0x70;
- const byte INS_EXTERNAL_AUTHENTICATE = (byte)0x82;
- const byte INS_MUTUAL_AUTHENTICATE = (byte)0x82;
- const byte INS_GET_CHALLENGE = (byte)0x84;
- const byte INS_ASK_RANDOM = (byte)0x84;
- const byte INS_GIVE_RANDOM = (byte)0x86;
- const byte INS_INTERNAL_AUTHENTICATE = (byte)0x88;
- const byte INS_SEEK = (byte)0xA2;
- const byte INS_SELECT = (byte)0xA4;
- const byte INS_SELECT_FILE = (byte)0xA4;
- const byte INS_CLOSE_APPLICATION = (byte)0xAC;
- const byte INS_READ_BINARY = (byte)0xB0;
- const byte INS_READ_BINARY2 = (byte)0xB1;
- const byte INS_READ_RECORD = (byte)0xB2;
- const byte INS_READ_RECORD2 = (byte)0xB3;
- const byte INS_READ_RECORDS = (byte)0xB2;
- const byte INS_READ_BINARY_STAMPED = (byte)0xB4;
- const byte INS_READ_RECORD_STAMPED = (byte)0xB6;
- const byte INS_GET_RESPONSE = (byte)0xC0;
- const byte INS_ENVELOPE = (byte)0xC2;
- const byte INS_GET_DATA = (byte)0xCA;
- const byte INS_WRITE_BINARY = (byte)0xD0;
- const byte INS_WRITE_RECORD = (byte)0xD2;
- const byte INS_UPDATE_BINARY = (byte)0xD6;
- const byte INS_LOAD_KEY_FILE = (byte)0xD8;
- const byte INS_PUT_DATA = (byte)0xDA;
- const byte INS_UPDATE_RECORD = (byte)0xDC;
- const byte INS_CREATE_FILE = (byte)0xE0;
- const byte INS_APPEND_RECORD = (byte)0xE2;
- const byte INS_DELETE_FILE = (byte)0xE4;
- const byte INS_PSO = (byte)0x2A;
- const byte INS_MSE = (byte)0x22;
+ const uint8 INS_ERASE_BINARY = 0x0E;
+ const uint8 INS_VERIFY = 0x20;
+ const uint8 INS_CHANGE_CHV = 0x24;
+ const uint8 INS_UNBLOCK_CHV = 0x2C;
+ const uint8 INS_DECREASE = 0x30;
+ const uint8 INS_INCREASE = 0x32;
+ const uint8 INS_DECREASE_STAMPED = 0x34;
+ const uint8 INS_REHABILITATE_CHV = 0x44;
+ const uint8 INS_MANAGE_CHANNEL = 0x70;
+ const uint8 INS_EXTERNAL_AUTHENTICATE = (uint8)0x82;
+ const uint8 INS_MUTUAL_AUTHENTICATE = (uint8)0x82;
+ const uint8 INS_GET_CHALLENGE = (uint8)0x84;
+ const uint8 INS_ASK_RANDOM = (uint8)0x84;
+ const uint8 INS_GIVE_RANDOM = (uint8)0x86;
+ const uint8 INS_INTERNAL_AUTHENTICATE = (uint8)0x88;
+ const uint8 INS_SEEK = (uint8)0xA2;
+ const uint8 INS_SELECT = (uint8)0xA4;
+ const uint8 INS_SELECT_FILE = (uint8)0xA4;
+ const uint8 INS_CLOSE_APPLICATION = (uint8)0xAC;
+ const uint8 INS_READ_BINARY = (uint8)0xB0;
+ const uint8 INS_READ_BINARY2 = (uint8)0xB1;
+ const uint8 INS_READ_RECORD = (uint8)0xB2;
+ const uint8 INS_READ_RECORD2 = (uint8)0xB3;
+ const uint8 INS_READ_RECORDS = (uint8)0xB2;
+ const uint8 INS_READ_BINARY_STAMPED = (uint8)0xB4;
+ const uint8 INS_READ_RECORD_STAMPED = (uint8)0xB6;
+ const uint8 INS_GET_RESPONSE = (uint8)0xC0;
+ const uint8 INS_ENVELOPE = (uint8)0xC2;
+ const uint8 INS_GET_DATA = (uint8)0xCA;
+ const uint8 INS_WRITE_BINARY = (uint8)0xD0;
+ const uint8 INS_WRITE_RECORD = (uint8)0xD2;
+ const uint8 INS_UPDATE_BINARY = (uint8)0xD6;
+ const uint8 INS_LOAD_KEY_FILE = (uint8)0xD8;
+ const uint8 INS_PUT_DATA = (uint8)0xDA;
+ const uint8 INS_UPDATE_RECORD = (uint8)0xDC;
+ const uint8 INS_CREATE_FILE = (uint8)0xE0;
+ const uint8 INS_APPEND_RECORD = (uint8)0xE2;
+ const uint8 INS_DELETE_FILE = (uint8)0xE4;
+ const uint8 INS_PSO = (uint8)0x2A;
+ const uint8 INS_MSE = (uint8)0x22;
/* ================================================================================================ */
/* EMV values */
@@ -104,19 +104,19 @@ namespace VeraCrypt
const uint16 EMV_CPLC_TAG = (uint16)0x9F7F;
const uint16 EMV_ICC_PK_CERT_TAG = (uint16)0x9F46;
const uint16 EMV_FCI_ISSUER_DISCRETIONARY_DATA_TAG = (uint16)0xBF0C;
- const byte EMV_ISS_PK_CERT_TAG = (byte)0x90;
- const byte EMV_PAN_TAG = (byte)0x5A;
- const byte EMV_FCI_TAG = (byte)0x6F;
- const byte EMV_DFNAME_TAG = (byte)0x84;
- const byte EMV_FCI_ISSUER_TAG = (byte)0xA5;
- const byte EMV_DIRECTORY_ENTRY_TAG = (byte)0x61;
- const byte EMV_SFI_TAG = (byte)0x88;
- const byte EMV_TEMPLATE_TAG = (byte)0x70;
- const byte EMV_AID_TAG = (byte)0x4F;
- const byte EMV_LABEL_TAG = (byte)0x50;
- const byte EMV_PRIORITY_TAG = (byte)0x87;
- const byte EMV_PSE1[] = { 0x31, 0x50, 0x41, 0x59, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x30, 0x31 }; // "1PAY.SYS.DDF01" (contact)
- const byte EMV_PSE2[] = { 0x32, 0x50, 0x41, 0x59, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x30, 0x31 }; // "2PAY.SYS.DDF01" (contactless)
+ const uint8 EMV_ISS_PK_CERT_TAG = (uint8)0x90;
+ const uint8 EMV_PAN_TAG = (uint8)0x5A;
+ const uint8 EMV_FCI_TAG = (uint8)0x6F;
+ const uint8 EMV_DFNAME_TAG = (uint8)0x84;
+ const uint8 EMV_FCI_ISSUER_TAG = (uint8)0xA5;
+ const uint8 EMV_DIRECTORY_ENTRY_TAG = (uint8)0x61;
+ const uint8 EMV_SFI_TAG = (uint8)0x88;
+ const uint8 EMV_TEMPLATE_TAG = (uint8)0x70;
+ const uint8 EMV_AID_TAG = (uint8)0x4F;
+ const uint8 EMV_LABEL_TAG = (uint8)0x50;
+ const uint8 EMV_PRIORITY_TAG = (uint8)0x87;
+ const uint8 EMV_PSE1[] = { 0x31, 0x50, 0x41, 0x59, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x30, 0x31 }; // "1PAY.SYS.DDF01" (contact)
+ const uint8 EMV_PSE2[] = { 0x32, 0x50, 0x41, 0x59, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x30, 0x31 }; // "2PAY.SYS.DDF01" (contactless)
/* ================================================================================================ */
@@ -173,7 +173,7 @@ namespace VeraCrypt
// Card Connection management methods
// ------------------------------------------------------------------------------------------------------------------------------------- //
- bool IsCardPresent(vector<byte>& cardAtr);
+ bool IsCardPresent(vector<uint8>& cardAtr);
bool IsCardPresent();
LONG CardHandleStatus();
@@ -193,7 +193,7 @@ namespace VeraCrypt
void ApduProcessData(CommandAPDU commandAPDU, ResponseAPDU& responseAPDU) const;
- void GetATRFromHandle(vector<byte>& atrValue);
+ void GetATRFromHandle(vector<uint8>& atrValue);
};
};
diff --git a/src/Common/SecurityToken.cpp b/src/Common/SecurityToken.cpp
index ad8ed33e..2a8222e6 100644
--- a/src/Common/SecurityToken.cpp
+++ b/src/Common/SecurityToken.cpp
@@ -123,7 +123,7 @@ namespace VeraCrypt
Sessions.erase(Sessions.find(slotId));
}
- void SecurityToken::CreateKeyfile(CK_SLOT_ID slotId, vector <byte>& keyfileData, const string& name)
+ void SecurityToken::CreateKeyfile(CK_SLOT_ID slotId, vector <uint8>& keyfileData, const string& name)
{
if (name.empty())
throw ParameterIncorrect(SRC_POS);
@@ -167,10 +167,10 @@ namespace VeraCrypt
throw Pkcs11Exception(status);
// Some tokens report success even if the new object was truncated to fit in the available memory
- vector <byte> objectData;
+ vector <uint8> objectData;
GetObjectAttribute(slotId, keyfileHandle, CKA_VALUE, objectData);
- finally_do_arg(vector <byte> *, &objectData, { if (!finally_arg->empty()) burn(&finally_arg->front(), finally_arg->size()); });
+ finally_do_arg(vector <uint8> *, &objectData, { if (!finally_arg->empty()) burn(&finally_arg->front(), finally_arg->size()); });
if (objectData.size() != keyfileData.size())
{
@@ -227,13 +227,13 @@ namespace VeraCrypt
keyfile.Token->SlotId = slotId;
keyfile.Token = shared_ptr<SecurityTokenInfo>(new SecurityTokenInfo(token));
- vector <byte> privateAttrib;
+ vector <uint8> privateAttrib;
GetObjectAttribute(slotId, dataHandle, CKA_PRIVATE, privateAttrib);
if (privateAttrib.size() == sizeof(CK_BBOOL) && *(CK_BBOOL*)&privateAttrib.front() != CK_TRUE)
continue;
- vector <byte> label;
+ vector <uint8> label;
GetObjectAttribute(slotId, dataHandle, CKA_LABEL, label);
label.push_back(0);
@@ -320,7 +320,7 @@ namespace VeraCrypt
return token;
}
- void SecurityTokenKeyfile::GetKeyfileData(vector <byte>& keyfileData) const
+ void SecurityTokenKeyfile::GetKeyfileData(vector <uint8>& keyfileData) const
{
SecurityToken::LoginUserIfRequired(Token->SlotId);
SecurityToken::GetObjectAttribute(Token->SlotId, Handle, CKA_VALUE, keyfileData);
@@ -361,7 +361,7 @@ namespace VeraCrypt
return objects;
}
- void SecurityToken::GetObjectAttribute(CK_SLOT_ID slotId, CK_OBJECT_HANDLE tokenObject, CK_ATTRIBUTE_TYPE attributeType, vector <byte>& attributeValue)
+ void SecurityToken::GetObjectAttribute(CK_SLOT_ID slotId, CK_OBJECT_HANDLE tokenObject, CK_ATTRIBUTE_TYPE attributeType, vector <uint8>& attributeValue)
{
attributeValue.clear();
@@ -379,7 +379,7 @@ namespace VeraCrypt
if (attribute.ulValueLen == 0)
return;
- attributeValue = vector <byte>(attribute.ulValueLen);
+ attributeValue = vector <uint8>(attribute.ulValueLen);
attribute.pValue = &attributeValue.front();
status = Pkcs11Functions->C_GetAttributeValue(Sessions[slotId].Handle, tokenObject, &attribute, 1);
diff --git a/src/Common/SecurityToken.h b/src/Common/SecurityToken.h
index 4dff42fa..6c454def 100644
--- a/src/Common/SecurityToken.h
+++ b/src/Common/SecurityToken.h
@@ -76,7 +76,7 @@ namespace VeraCrypt
operator TokenKeyfilePath () const;
- void GetKeyfileData(vector<byte>& keyfileData) const;
+ void GetKeyfileData(vector<uint8>& keyfileData) const;
string IdUtf8;
CK_OBJECT_HANDLE Handle;
@@ -181,7 +181,7 @@ namespace VeraCrypt
public:
static void CloseAllSessions() throw ();
static void CloseLibrary();
- static void CreateKeyfile(CK_SLOT_ID slotId, vector <byte>& keyfileData, const string& name);
+ static void CreateKeyfile(CK_SLOT_ID slotId, vector <uint8>& keyfileData, const string& name);
static void DeleteKeyfile(const SecurityTokenKeyfile& keyfile);
static vector <SecurityTokenKeyfile> GetAvailableKeyfiles(CK_SLOT_ID* slotIdFilter = nullptr, const wstring keyfileIdFilter = wstring());
static list <SecurityTokenInfo> GetAvailableTokens();
@@ -199,7 +199,7 @@ namespace VeraCrypt
protected:
static void CloseSession(CK_SLOT_ID slotId);
static vector <CK_OBJECT_HANDLE> GetObjects(CK_SLOT_ID slotId, CK_ATTRIBUTE_TYPE objectClass);
- static void GetObjectAttribute(CK_SLOT_ID slotId, CK_OBJECT_HANDLE tokenObject, CK_ATTRIBUTE_TYPE attributeType, vector <byte>& attributeValue);
+ static void GetObjectAttribute(CK_SLOT_ID slotId, CK_OBJECT_HANDLE tokenObject, CK_ATTRIBUTE_TYPE attributeType, vector <uint8>& attributeValue);
static list <CK_SLOT_ID> GetTokenSlots();
static void Login(CK_SLOT_ID slotId, const char* pin);
static void LoginUserIfRequired(CK_SLOT_ID slotId);
@@ -217,7 +217,7 @@ namespace VeraCrypt
static map <CK_SLOT_ID, Pkcs11Session> Sessions;
static unique_ptr <SendExceptionFunctor> WarningCallback;
- friend void SecurityTokenKeyfile::GetKeyfileData(vector <byte>& keyfileData) const;
+ friend void SecurityTokenKeyfile::GetKeyfileData(vector <uint8>& keyfileData) const;
};
}
diff --git a/src/Common/TLVParser.cpp b/src/Common/TLVParser.cpp
index 9a177007..1e51739c 100644
--- a/src/Common/TLVParser.cpp
+++ b/src/Common/TLVParser.cpp
@@ -13,7 +13,7 @@ namespace VeraCrypt
}
/* Check if the bit is correct */
- uint16 TLVParser::CheckBit(byte value, int bit)
+ uint16 TLVParser::CheckBit(uint8 value, int bit)
{
unsigned char bitvalue[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
@@ -36,13 +36,13 @@ namespace VeraCrypt
}
/* Parsing one TLV node */
- shared_ptr<TLVNode> TLVParser::TLV_Parse_One(byte* buf, size_t size)
+ shared_ptr<TLVNode> TLVParser::TLV_Parse_One(uint8* buf, size_t size)
{
size_t index = 0;
size_t i = 0;
- byte tag1, tag2, tagsize;
- byte len, lensize;
- shared_ptr<vector<byte>> value = make_shared<vector<byte>>();
+ uint8 tag1, tag2, tagsize;
+ uint8 len, lensize;
+ shared_ptr<vector<uint8>> value = make_shared<vector<uint8>>();
shared_ptr<TLVNode> node = TLV_CreateNode();
tag1 = tag2 = 0;
@@ -157,7 +157,7 @@ namespace VeraCrypt
}
/* Parsing TLV from a buffer and constructing TLV structure */
- shared_ptr<TLVNode> TLVParser::TLV_Parse(byte* buf, size_t size)
+ shared_ptr<TLVNode> TLVParser::TLV_Parse(uint8* buf, size_t size)
{
shared_ptr<TLVNode> node = TLV_Parse_One(buf, size);
TLV_Parse_Sub(node);
diff --git a/src/Common/TLVParser.h b/src/Common/TLVParser.h
index b989ca41..2fc4a27c 100644
--- a/src/Common/TLVParser.h
+++ b/src/Common/TLVParser.h
@@ -10,16 +10,16 @@ namespace VeraCrypt
{
uint16 Tag; /* T */
uint16 Length; /* L */
- shared_ptr<vector<byte>> Value; /* V */
- byte TagSize;
- byte LengthSize;
+ shared_ptr<vector<uint8>> Value; /* V */
+ uint8 TagSize;
+ uint8 LengthSize;
uint16 MoreFlag; /* Used In Sub */
uint16 SubFlag; /* Does it have sub-nodes? */
shared_ptr<vector<shared_ptr<TLVNode>>> Subs;
TLVNode() : Tag(0), Length(0), TagSize(0), LengthSize(0), MoreFlag(0), SubFlag(0)
{
- Value = make_shared<vector<byte>>();
+ Value = make_shared<vector<uint8>>();
Subs = make_shared<vector<shared_ptr<TLVNode>>>();
}
@@ -37,10 +37,10 @@ namespace VeraCrypt
static shared_ptr<TLVNode> TLV_CreateNode();
/* Check if the bit is correct */
- static uint16 CheckBit(byte value, int bit);
+ static uint16 CheckBit(uint8 value, int bit);
/* Parsing one TLV node */
- static shared_ptr<TLVNode> TLV_Parse_One(byte* buf, size_t size);
+ static shared_ptr<TLVNode> TLV_Parse_One(uint8* buf, size_t size);
/* Parsing all TLV nodes */
static int TLV_Parse_SubNodes(shared_ptr<TLVNode> parent);
@@ -54,7 +54,7 @@ namespace VeraCrypt
public:
/* Parsing TLV from a buffer and constructing TLV structure */
- static shared_ptr<TLVNode> TLV_Parse(byte* buf, size_t size);
+ static shared_ptr<TLVNode> TLV_Parse(uint8* buf, size_t size);
/* Finding a TLV node with a particular tag */
static shared_ptr<TLVNode> TLV_Find(shared_ptr<TLVNode> node, uint16 tag);
diff --git a/src/Common/Tcdefs.h b/src/Common/Tcdefs.h
index 1118e522..377ac388 100644
--- a/src/Common/Tcdefs.h
+++ b/src/Common/Tcdefs.h
@@ -95,7 +95,6 @@ extern unsigned short _rotl16(unsigned short value, unsigned char shift);
typedef __int8 int8;
typedef __int16 int16;
typedef __int32 int32;
-typedef unsigned __int8 byte;
typedef unsigned __int8 uint8;
typedef unsigned __int16 uint16;
typedef unsigned __int32 uint32;
@@ -122,7 +121,6 @@ typedef int8_t int8;
typedef int16_t int16;
typedef int32_t int32;
typedef int64_t int64;
-typedef uint8_t byte;
typedef uint8_t uint8;
typedef uint16_t uint16;
typedef uint32_t uint32;
diff --git a/src/Common/Tests.c b/src/Common/Tests.c
index 82564a84..530e7577 100644
--- a/src/Common/Tests.c
+++ b/src/Common/Tests.c
@@ -1340,13 +1340,13 @@ static BOOL DoAutoTestAlgorithms (void)
// AES EncipherBlocks()/DecipherBlocks()
{
- byte testData[1024];
+ uint8 testData[1024];
uint32 origCrc;
size_t i;
for (i = 0; i < sizeof (testData); ++i)
{
- testData[i] = (byte) i;
+ testData[i] = (uint8) i;
}
origCrc = GetCrc32 (testData, sizeof (testData));
diff --git a/src/Common/Token.h b/src/Common/Token.h
index 754e2830..959c7e24 100644
--- a/src/Common/Token.h
+++ b/src/Common/Token.h
@@ -41,7 +41,7 @@ namespace VeraCrypt
{
virtual ~TokenKeyfile() {}
virtual operator TokenKeyfilePath () const = 0;
- virtual void GetKeyfileData(vector <byte>& keyfileData) const = 0;
+ virtual void GetKeyfileData(vector <uint8>& keyfileData) const = 0;
shared_ptr<TokenInfo> Token;
wstring Id;
diff --git a/src/Common/Volumes.c b/src/Common/Volumes.c
index 989b2d14..df1cd1e3 100644
--- a/src/Common/Volumes.c
+++ b/src/Common/Volumes.c
@@ -130,19 +130,19 @@
-uint16 GetHeaderField16 (byte *header, int offset)
+uint16 GetHeaderField16 (uint8 *header, int offset)
{
return BE16 (*(uint16 *) (header + offset));
}
-uint32 GetHeaderField32 (byte *header, int offset)
+uint32 GetHeaderField32 (uint8 *header, int offset)
{
return BE32 (*(uint32 *) (header + offset));
}
-UINT64_STRUCT GetHeaderField64 (byte *header, int offset)
+UINT64_STRUCT GetHeaderField64 (uint8 *header, int offset)
{
UINT64_STRUCT uint64Struct;
@@ -640,7 +640,7 @@ ret:
}
#if defined(_WIN32) && !defined(_UEFI)
-void ComputeBootloaderFingerprint (byte *bootLoaderBuf, unsigned int bootLoaderSize, byte* fingerprint)
+void ComputeBootloaderFingerprint (uint8 *bootLoaderBuf, unsigned int bootLoaderSize, uint8* fingerprint)
{
// compute Whirlpool+SHA512 fingerprint of bootloader including MBR
// we skip user configuration fields:
@@ -1214,13 +1214,13 @@ err:
}
#if !defined(_UEFI)
-BOOL ReadEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header, DWORD *bytesRead)
+BOOL ReadEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, uint8 *header, DWORD *bytesRead)
{
#if TC_VOLUME_HEADER_EFFECTIVE_SIZE > TC_MAX_VOLUME_SECTOR_SIZE
#error TC_VOLUME_HEADER_EFFECTIVE_SIZE > TC_MAX_VOLUME_SECTOR_SIZE
#endif
- byte sectorBuffer[TC_MAX_VOLUME_SECTOR_SIZE];
+ uint8 sectorBuffer[TC_MAX_VOLUME_SECTOR_SIZE];
DISK_GEOMETRY geometry;
if (!device)
@@ -1247,13 +1247,13 @@ BOOL ReadEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header, DW
}
-BOOL WriteEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header)
+BOOL WriteEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, uint8 *header)
{
#if TC_VOLUME_HEADER_EFFECTIVE_SIZE > TC_MAX_VOLUME_SECTOR_SIZE
#error TC_VOLUME_HEADER_EFFECTIVE_SIZE > TC_MAX_VOLUME_SECTOR_SIZE
#endif
- byte sectorBuffer[TC_MAX_VOLUME_SECTOR_SIZE];
+ uint8 sectorBuffer[TC_MAX_VOLUME_SECTOR_SIZE];
DWORD bytesDone;
DISK_GEOMETRY geometry;
@@ -1322,7 +1322,7 @@ int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO
char temporaryKey[MASTER_KEYDATA_SIZE];
char originalK2[MASTER_KEYDATA_SIZE];
- byte buf[TC_VOLUME_HEADER_GROUP_SIZE];
+ uint8 buf[TC_VOLUME_HEADER_GROUP_SIZE];
LARGE_INTEGER offset;
int nStatus = ERR_SUCCESS;
diff --git a/src/Common/Volumes.h b/src/Common/Volumes.h
index 1c9981c2..daad25e3 100644
--- a/src/Common/Volumes.h
+++ b/src/Common/Volumes.h
@@ -129,9 +129,9 @@ extern "C" {
extern BOOL ReadVolumeHeaderRecoveryMode;
-uint16 GetHeaderField16 (byte *header, int offset);
-uint32 GetHeaderField32 (byte *header, int offset);
-UINT64_STRUCT GetHeaderField64 (byte *header, int offset);
+uint16 GetHeaderField16 (uint8 *header, int offset);
+uint32 GetHeaderField32 (uint8 *header, int offset);
+UINT64_STRUCT GetHeaderField64 (uint8 *header, int offset);
#if defined(TC_WINDOWS_BOOT)
int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pim, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo);
#elif defined(_UEFI)
@@ -141,14 +141,14 @@ BOOL RandgetBytes(unsigned char *buf, int len, BOOL forceSlowPoll);
#else
int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int pkcs5_prf, int pim, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo);
#if defined(_WIN32) && !defined(_UEFI)
-void ComputeBootloaderFingerprint (byte *bootLoaderBuf, unsigned int bootLoaderSize, byte* fingerprint);
+void ComputeBootloaderFingerprint (uint8 *bootLoaderBuf, unsigned int bootLoaderSize, uint8* fingerprint);
#endif
#endif
#if !defined (DEVICE_DRIVER) && !defined (TC_WINDOWS_BOOT) && !defined(_UEFI)
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);
+BOOL ReadEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, uint8 *header, DWORD *bytesRead);
+BOOL WriteEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, uint8 *header);
int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO *cryptoInfo, uint64 dataAreaSize, BOOL bPrimaryOnly, BOOL bBackupOnly);
#endif
diff --git a/src/Common/Wipe.c b/src/Common/Wipe.c
index 2fe6aa03..d68b517b 100644
--- a/src/Common/Wipe.c
+++ b/src/Common/Wipe.c
@@ -14,7 +14,7 @@
#include "Wipe.h"
-static BOOL Wipe1PseudoRandom (int pass, byte *buffer, size_t size)
+static BOOL Wipe1PseudoRandom (int pass, uint8 *buffer, size_t size)
{
return FALSE;
}
@@ -23,9 +23,9 @@ static BOOL Wipe1PseudoRandom (int pass, byte *buffer, size_t size)
// Fill buffer with wipe patterns defined in "National Industrial Security Program Operating Manual", US DoD 5220.22-M.
// Return: FALSE = buffer must be filled with random data
-static BOOL Wipe3Dod5220 (int pass, byte *buffer, size_t size)
+static BOOL Wipe3Dod5220 (int pass, uint8 *buffer, size_t size)
{
- byte wipeChar;
+ uint8 wipeChar;
switch (pass)
{
@@ -46,9 +46,9 @@ static BOOL Wipe3Dod5220 (int pass, byte *buffer, size_t size)
}
-static BOOL Wipe7Dod5220 (int pass, byte randChars[TC_WIPE_RAND_CHAR_COUNT], byte *buffer, size_t size)
+static BOOL Wipe7Dod5220 (int pass, uint8 randChars[TC_WIPE_RAND_CHAR_COUNT], uint8 *buffer, size_t size)
{
- byte wipeChar;
+ uint8 wipeChar;
switch (pass)
{
@@ -84,9 +84,9 @@ static BOOL Wipe7Dod5220 (int pass, byte randChars[TC_WIPE_RAND_CHAR_COUNT], byt
// Fill the buffer with wipe patterns defined in the paper "Secure Deletion of Data from Magnetic and Solid-State Memory" by Peter Gutmann.
// Return: FALSE = buffer must be filled with random data
-static BOOL Wipe35Gutmann (int pass, byte *buffer, size_t size)
+static BOOL Wipe35Gutmann (int pass, uint8 *buffer, size_t size)
{
- byte wipePat3[] = { 0x92, 0x49, 0x24 };
+ uint8 wipePat3[] = { 0x92, 0x49, 0x24 };
int wipePat3Pos;
size_t i;
@@ -167,7 +167,7 @@ int GetWipePassCount (WipeAlgorithmId algorithm)
}
-BOOL WipeBuffer (WipeAlgorithmId algorithm, byte randChars[TC_WIPE_RAND_CHAR_COUNT], int pass, byte *buffer, size_t size)
+BOOL WipeBuffer (WipeAlgorithmId algorithm, uint8 randChars[TC_WIPE_RAND_CHAR_COUNT], int pass, uint8 *buffer, size_t size)
{
switch (algorithm)
{
diff --git a/src/Common/Wipe.h b/src/Common/Wipe.h
index ef27eb06..09b9d71e 100644
--- a/src/Common/Wipe.h
+++ b/src/Common/Wipe.h
@@ -36,7 +36,7 @@ typedef enum
#define TC_WIPE_RAND_CHAR_COUNT 3
int GetWipePassCount (WipeAlgorithmId algorithm);
-BOOL WipeBuffer (WipeAlgorithmId algorithm, byte randChars[TC_WIPE_RAND_CHAR_COUNT], int pass, byte *buffer, size_t size);
+BOOL WipeBuffer (WipeAlgorithmId algorithm, uint8 randChars[TC_WIPE_RAND_CHAR_COUNT], int pass, uint8 *buffer, size_t size);
#ifdef __cplusplus
}
diff --git a/src/Core/CoreBase.cpp b/src/Core/CoreBase.cpp
index c1016726..356d4348 100644
--- a/src/Core/CoreBase.cpp
+++ b/src/Core/CoreBase.cpp
@@ -144,7 +144,7 @@ namespace VeraCrypt
outerVolume->ReadSectors (bootSectorBuffer, 0);
int fatType;
- byte *bootSector = bootSectorBuffer.Ptr();
+ uint8 *bootSector = bootSectorBuffer.Ptr();
if (memcmp (bootSector + 54, "FAT12", 5) == 0)
fatType = 12;
diff --git a/src/Core/FatFormatter.cpp b/src/Core/FatFormatter.cpp
index fa327837..c8115f9b 100644
--- a/src/Core/FatFormatter.cpp
+++ b/src/Core/FatFormatter.cpp
@@ -149,7 +149,7 @@ namespace VeraCrypt
}
}
- static void PutBoot (fatparams * ft, byte *boot, uint32 volumeId)
+ static void PutBoot (fatparams * ft, uint8 *boot, uint32 volumeId)
{
int cnt = 0;
@@ -244,7 +244,7 @@ namespace VeraCrypt
/* FAT32 FSInfo */
- static void PutFSInfo (byte *sector, fatparams *ft)
+ static void PutFSInfo (uint8 *sector, fatparams *ft)
{
memset (sector, 0, ft->sector_size);
sector[3] = 0x41; /* LeadSig */
@@ -294,16 +294,16 @@ namespace VeraCrypt
sector.Zero();
uint32 volumeId;
- RandomNumberGenerator::GetDataFast (BufferPtr ((byte *) &volumeId, sizeof (volumeId)));
+ RandomNumberGenerator::GetDataFast (BufferPtr ((uint8 *) &volumeId, sizeof (volumeId)));
- PutBoot (ft, (byte *) sector, volumeId);
+ PutBoot (ft, (uint8 *) sector, volumeId);
writeSector (sector); ++sectorNumber;
/* fat32 boot area */
if (ft->size_fat == 32)
{
/* fsinfo */
- PutFSInfo((byte *) sector, ft);
+ PutFSInfo((uint8 *) sector, ft);
writeSector (sector); ++sectorNumber;
/* reserved */
@@ -317,10 +317,10 @@ namespace VeraCrypt
/* bootsector backup */
sector.Zero();
- PutBoot (ft, (byte *) sector, volumeId);
+ PutBoot (ft, (uint8 *) sector, volumeId);
writeSector (sector); ++sectorNumber;
- PutFSInfo((byte *) sector, ft);
+ PutFSInfo((uint8 *) sector, ft);
writeSector (sector); ++sectorNumber;
}
@@ -340,10 +340,10 @@ namespace VeraCrypt
if (n == 0)
{
- byte fat_sig[12];
+ uint8 fat_sig[12];
if (ft->size_fat == 32)
{
- fat_sig[0] = (byte) ft->media;
+ fat_sig[0] = (uint8) ft->media;
fat_sig[1] = fat_sig[2] = 0xff;
fat_sig[3] = 0x0f;
fat_sig[4] = fat_sig[5] = fat_sig[6] = 0xff;
@@ -354,7 +354,7 @@ namespace VeraCrypt
}
else if (ft->size_fat == 16)
{
- fat_sig[0] = (byte) ft->media;
+ fat_sig[0] = (uint8) ft->media;
fat_sig[1] = 0xff;
fat_sig[2] = 0xff;
fat_sig[3] = 0xff;
@@ -362,7 +362,7 @@ namespace VeraCrypt
}
else if (ft->size_fat == 12)
{
- fat_sig[0] = (byte) ft->media;
+ fat_sig[0] = (uint8) ft->media;
fat_sig[1] = 0xff;
fat_sig[2] = 0xff;
fat_sig[3] = 0x00;
diff --git a/src/Core/RandomNumberGenerator.cpp b/src/Core/RandomNumberGenerator.cpp
index 3fb6062a..b60b4eed 100644
--- a/src/Core/RandomNumberGenerator.cpp
+++ b/src/Core/RandomNumberGenerator.cpp
@@ -114,7 +114,7 @@ namespace VeraCrypt
ScopeLock lock (AccessMutex);
size_t bufferLen = buffer.Size(), loopLen;
- byte* pbBuffer = buffer.Get();
+ uint8* pbBuffer = buffer.Get();
// Initialize JitterEntropy RNG for this call
if (0 == jent_entropy_init ())
@@ -267,7 +267,7 @@ namespace VeraCrypt
Buffer buffer (1);
for (size_t i = 0; i < PoolSize * 10; ++i)
{
- buffer[0] = (byte) i;
+ buffer[0] = (uint8) i;
AddToPool (buffer);
}
diff --git a/src/Core/Unix/CoreService.cpp b/src/Core/Unix/CoreService.cpp
index e3fca20e..6d0f05e5 100644
--- a/src/Core/Unix/CoreService.cpp
+++ b/src/Core/Unix/CoreService.cpp
@@ -57,7 +57,7 @@ namespace VeraCrypt
// Wait for sync code
while (true)
{
- byte b;
+ uint8 b;
throw_sys_if (read (STDIN_FILENO, &b, 1) != 1);
if (b != 0x00)
continue;
@@ -543,7 +543,7 @@ namespace VeraCrypt
try
{
- shared_ptr <Stream> stream (new MemoryStream (ConstBufferPtr ((byte *) &errOutput[0], errOutput.size())));
+ shared_ptr <Stream> stream (new MemoryStream (ConstBufferPtr ((uint8 *) &errOutput[0], errOutput.size())));
deserializedObject.reset (Serializable::DeserializeNew (stream));
deserializedException = dynamic_cast <Exception*> (deserializedObject.get());
}
@@ -575,7 +575,7 @@ namespace VeraCrypt
ServiceOutputStream = shared_ptr <Stream> (new FileStream (outPipe->GetReadFD()));
// Send sync code
- byte sync[] = { 0, 0x11, 0x22 };
+ uint8 sync[] = { 0, 0x11, 0x22 };
ServiceInputStream->Write (ConstBufferPtr (sync, array_capacity (sync)));
AdminInputPipe = move_ptr(inPipe);
diff --git a/src/Core/Unix/CoreUnix.cpp b/src/Core/Unix/CoreUnix.cpp
index 258979b9..26076a28 100644
--- a/src/Core/Unix/CoreUnix.cpp
+++ b/src/Core/Unix/CoreUnix.cpp
@@ -241,7 +241,7 @@ namespace VeraCrypt
device.SeekAt (0);
device.ReadCompleteBuffer (bootSector);
- byte *b = bootSector.Ptr();
+ uint8 *b = bootSector.Ptr();
return memcmp (b + 3, "NTFS", 4) != 0
&& memcmp (b + 54, "FAT", 3) != 0
diff --git a/src/Core/Unix/Linux/CoreLinux.cpp b/src/Core/Unix/Linux/CoreLinux.cpp
index 5d5ba38f..cd4be80f 100644
--- a/src/Core/Unix/Linux/CoreLinux.cpp
+++ b/src/Core/Unix/Linux/CoreLinux.cpp
@@ -386,7 +386,7 @@ namespace VeraCrypt
dmCreateArgs << nativeDevPath << " 0";
SecureBuffer dmCreateArgsBuf (dmCreateArgs.str().size());
- dmCreateArgsBuf.CopyFrom (ConstBufferPtr ((byte *) dmCreateArgs.str().c_str(), dmCreateArgs.str().size()));
+ dmCreateArgsBuf.CopyFrom (ConstBufferPtr ((uint8 *) dmCreateArgs.str().c_str(), dmCreateArgs.str().size()));
// Keys
const SecureBuffer &cipherKey = cipher.GetKey();
diff --git a/src/Crypto/Aes_hw_cpu.h b/src/Crypto/Aes_hw_cpu.h
index b294e2ee..58adc78d 100644
--- a/src/Crypto/Aes_hw_cpu.h
+++ b/src/Crypto/Aes_hw_cpu.h
@@ -21,13 +21,13 @@ extern "C"
#endif
#if defined (TC_WINDOWS_BOOT)
-byte is_aes_hw_cpu_supported ();
+uint8 is_aes_hw_cpu_supported ();
#endif
void aes_hw_cpu_enable_sse ();
-void aes_hw_cpu_decrypt (const byte *ks, byte *data);
-void aes_hw_cpu_decrypt_32_blocks (const byte *ks, byte *data);
-void aes_hw_cpu_encrypt (const byte *ks, byte *data);
-void aes_hw_cpu_encrypt_32_blocks (const byte *ks, byte *data);
+void aes_hw_cpu_decrypt (const uint8 *ks, uint8 *data);
+void aes_hw_cpu_decrypt_32_blocks (const uint8 *ks, uint8 *data);
+void aes_hw_cpu_encrypt (const uint8 *ks, uint8 *data);
+void aes_hw_cpu_encrypt_32_blocks (const uint8 *ks, uint8 *data);
#if defined(__cplusplus)
}
diff --git a/src/Crypto/Camellia.c b/src/Crypto/Camellia.c
index f4fde8aa..675fc0bd 100644
--- a/src/Crypto/Camellia.c
+++ b/src/Crypto/Camellia.c
@@ -11,10 +11,10 @@
* NTT (Nippon Telegraph and Telephone Corporation) . All rights reserved.
*
* SuperCop integration:
- * Copyright 2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
+ * Copyright © 2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
*
* VeraCrypt integration:
- * Copyright 2017 Mounir IDRASSI <mounir.idrassi@idrix.fr>
+ * Copyright © 2017 Mounir IDRASSI <mounir.idrassi@idrix.fr>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -51,12 +51,12 @@
extern int IsAesHwCpuSupported ();
#endif
-void camellia_encrypt_asm(const byte *ctx, void *dst, const void *src);
-void camellia_decrypt_asm(const byte *ctx, void *dst, const void *src);
-void camellia_enc_blk2(const byte *ctx, byte *dst, const byte *src);
-void camellia_dec_blk2(const byte *ctx, byte *dst, const byte *src);
-void camellia_ecb_enc_16way(const byte *ctx, byte *dst, const byte *src);
-void camellia_ecb_dec_16way(const byte *ctx, byte *dst, const byte *src);
+void camellia_encrypt_asm(const uint8 *ctx, void *dst, const void *src);
+void camellia_decrypt_asm(const uint8 *ctx, void *dst, const void *src);
+void camellia_enc_blk2(const uint8 *ctx, uint8 *dst, const uint8 *src);
+void camellia_dec_blk2(const uint8 *ctx, uint8 *dst, const uint8 *src);
+void camellia_ecb_enc_16way(const uint8 *ctx, uint8 *dst, const uint8 *src);
+void camellia_ecb_dec_16way(const uint8 *ctx, uint8 *dst, const uint8 *src);
/* key constants */
@@ -1093,7 +1093,7 @@ void camellia_decrypt(const unsigned __int8 *inBlock, unsigned __int8 *outBlock
camellia_decrypt_asm (ks, outBlock, inBlock);
}
-void camellia_encrypt_blocks(unsigned __int8 *instance, const byte* in_blk, byte* out_blk, uint32 blockCount)
+void camellia_encrypt_blocks(unsigned __int8 *instance, const uint8* in_blk, uint8* out_blk, uint32 blockCount)
{
#if !defined (_UEFI)
if ((blockCount >= 16) && IsCpuIntel() && IsAesHwCpuSupported () && HasSAVX()) /* on AMD cpu, AVX is too slow */
@@ -1129,7 +1129,7 @@ void camellia_encrypt_blocks(unsigned __int8 *instance, const byte* in_blk, byte
camellia_encrypt (in_blk, out_blk, instance);
}
-void camellia_decrypt_blocks(unsigned __int8 *instance, const byte* in_blk, byte* out_blk, uint32 blockCount)
+void camellia_decrypt_blocks(unsigned __int8 *instance, const uint8* in_blk, uint8* out_blk, uint32 blockCount)
{
#if !defined (_UEFI)
if ((blockCount >= 16) && IsCpuIntel() && IsAesHwCpuSupported () && HasSAVX()) /* on AMD cpu, AVX is too slow */
diff --git a/src/Crypto/Camellia.h b/src/Crypto/Camellia.h
index a1cb832e..63c97476 100644
--- a/src/Crypto/Camellia.h
+++ b/src/Crypto/Camellia.h
@@ -18,8 +18,8 @@ void camellia_encrypt(const unsigned __int8 *inBlock, unsigned __int8 *outBlock,
void camellia_decrypt(const unsigned __int8 *inBlock, unsigned __int8 *outBlock, unsigned __int8 *ks);
#if CRYPTOPP_BOOL_X64 && !defined(CRYPTOPP_DISABLE_ASM)
-void camellia_encrypt_blocks(unsigned __int8 *ks, const byte* in_blk, byte* out_blk, uint32 blockCount);
-void camellia_decrypt_blocks(unsigned __int8 *ks, const byte* in_blk, byte* out_blk, uint32 blockCount);
+void camellia_encrypt_blocks(unsigned __int8 *ks, const uint8* in_blk, uint8* out_blk, uint32 blockCount);
+void camellia_decrypt_blocks(unsigned __int8 *ks, const uint8* in_blk, uint8* out_blk, uint32 blockCount);
#endif
#ifdef __cplusplus
diff --git a/src/Crypto/Sha2.c b/src/Crypto/Sha2.c
index 31cba7f5..42215c89 100644
--- a/src/Crypto/Sha2.c
+++ b/src/Crypto/Sha2.c
@@ -447,7 +447,7 @@ static void CRYPTOPP_FASTCALL X86_SHA256_HashBlocks(uint_32t *state, const uint_
#if defined(__GNUC__)
#if CRYPTOPP_BOOL_X64
- CRYPTOPP_ALIGN_DATA(16) byte workspace[LOCALS_SIZE] ;
+ CRYPTOPP_ALIGN_DATA(16) uint8 workspace[LOCALS_SIZE] ;
#endif
__asm__ __volatile__
(
diff --git a/src/Crypto/Sha2Small.c b/src/Crypto/Sha2Small.c
index 08318833..572dd612 100644
--- a/src/Crypto/Sha2Small.c
+++ b/src/Crypto/Sha2Small.c
@@ -20,7 +20,7 @@
#pragma optimize ("tl", on)
typedef unsigned __int32 uint32;
-typedef unsigned __int8 byte;
+typedef unsigned __int8 uint8;
#include <stdlib.h>
#pragma intrinsic(_lrotr)
diff --git a/src/Crypto/Streebog.c b/src/Crypto/Streebog.c
index 84991021..d223eef8 100644
--- a/src/Crypto/Streebog.c
+++ b/src/Crypto/Streebog.c
@@ -2253,7 +2253,7 @@ stage3(STREEBOG_CTX *CTX)
memcpy((CTX->hash), (CTX->h), 8 * sizeof(unsigned long long));
}
-void STREEBOG_add(STREEBOG_CTX *CTX, const byte *data, size_t len)
+void STREEBOG_add(STREEBOG_CTX *CTX, const uint8 *data, size_t len)
{
size_t chunksize;
@@ -2286,7 +2286,7 @@ void STREEBOG_add(STREEBOG_CTX *CTX, const byte *data, size_t len)
}
}
-void STREEBOG_finalize(STREEBOG_CTX *CTX, byte *digest)
+void STREEBOG_finalize(STREEBOG_CTX *CTX, uint8 *digest)
{
stage3(CTX);
diff --git a/src/Crypto/Streebog.h b/src/Crypto/Streebog.h
index d5691e70..29571d73 100644
--- a/src/Crypto/Streebog.h
+++ b/src/Crypto/Streebog.h
@@ -31,8 +31,8 @@ typedef STREEBOG_ALIGN(16) struct _STREEBOG_CTX
void STREEBOG_init(STREEBOG_CTX *ctx);
void STREEBOG_init256(STREEBOG_CTX *ctx);
-void STREEBOG_add(STREEBOG_CTX *ctx, const byte *msg, size_t len);
-void STREEBOG_finalize(STREEBOG_CTX *ctx, byte *out);
+void STREEBOG_add(STREEBOG_CTX *ctx, const uint8 *msg, size_t len);
+void STREEBOG_finalize(STREEBOG_CTX *ctx, uint8 *out);
#ifdef __cplusplus
}
diff --git a/src/Crypto/Twofish.c b/src/Crypto/Twofish.c
index ad93b66f..ff46bc99 100644
--- a/src/Crypto/Twofish.c
+++ b/src/Crypto/Twofish.c
@@ -57,25 +57,25 @@
#if CRYPTOPP_BOOL_X64 && !defined(CRYPTOPP_DISABLE_ASM)
/* these are 64-bit assembly implementation taken from https://github.com/jkivilin/supercop-blockciphers
- Copyright 2011-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
+ Copyright © 2011-2013 Jussi Kivilinna <jussi.kivilinna@iki.fi>
*/
#if defined(__cplusplus)
extern "C"
{
#endif
-void twofish_enc_blk(TwofishInstance *ks, byte *dst, const byte *src);
-void twofish_dec_blk(TwofishInstance *ks, byte *dst, const byte *src);
-void twofish_enc_blk2(TwofishInstance *ks, byte *dst, const byte *src);
-void twofish_dec_blk2(TwofishInstance *ks, byte *dst, const byte *src);
-void twofish_enc_blk3(TwofishInstance *ks, byte *dst, const byte *src);
-void twofish_dec_blk3(TwofishInstance *ks, byte *dst, const byte *src);
+void twofish_enc_blk(TwofishInstance *ks, uint8 *dst, const uint8 *src);
+void twofish_dec_blk(TwofishInstance *ks, uint8 *dst, const uint8 *src);
+void twofish_enc_blk2(TwofishInstance *ks, uint8 *dst, const uint8 *src);
+void twofish_dec_blk2(TwofishInstance *ks, uint8 *dst, const uint8 *src);
+void twofish_enc_blk3(TwofishInstance *ks, uint8 *dst, const uint8 *src);
+void twofish_dec_blk3(TwofishInstance *ks, uint8 *dst, const uint8 *src);
#if defined(__cplusplus)
}
#endif
-void twofish_encrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte* out_blk, uint32 blockCount)
+void twofish_encrypt_blocks(TwofishInstance *instance, const uint8* in_blk, uint8* out_blk, uint32 blockCount)
{
while (blockCount >= 3)
{
@@ -96,7 +96,7 @@ void twofish_encrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte*
}
-void twofish_decrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte* out_blk, uint32 blockCount)
+void twofish_decrypt_blocks(TwofishInstance *instance, const uint8* in_blk, uint8* out_blk, uint32 blockCount)
{
while (blockCount >= 3)
{
@@ -120,7 +120,7 @@ void twofish_decrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte*
#endif
-static const byte Q[2][256] = {
+static const uint8 Q[2][256] = {
{
0xa9, 0x67, 0xb3, 0xe8, 0x04, 0xfd, 0xa3, 0x76, 0x9a, 0x92, 0x80, 0x78, 0xe4, 0xdd, 0xd1, 0x38,
0x0d, 0xc6, 0x35, 0x98, 0x18, 0xf7, 0xec, 0x6c, 0x43, 0x75, 0x37, 0x26, 0xfa, 0x13, 0x94, 0x48,
@@ -604,11 +604,11 @@ static const uint32 RS[8][256] = {
void twofish_set_key(TwofishInstance *instance, const u4byte in_key[])
{
union {
- byte S8[16];
+ uint8 S8[16];
uint32 S32[4];
} us;
unsigned int i;
- const byte* key = (const byte*) in_key;
+ const uint8* key = (const uint8*) in_key;
us.S32[0] = RS[0][key[0]] ^ RS[1][key[1]] ^ RS[2][key[2]] ^ RS[3][key[3]] ^ RS[4][key[4]] ^ RS[5][key[5]] ^ RS[6][key[6]] ^ RS[7][key[7]];
us.S32[1] = RS[0][key[8]] ^ RS[1][key[9]] ^ RS[2][key[10]] ^ RS[3][key[11]] ^ RS[4][key[12]] ^ RS[5][key[13]] ^ RS[6][key[14]] ^ RS[7][key[15]];
diff --git a/src/Crypto/Twofish.h b/src/Crypto/Twofish.h
index e74826eb..3b530cbd 100644
--- a/src/Crypto/Twofish.h
+++ b/src/Crypto/Twofish.h
@@ -55,10 +55,10 @@ typedef struct
/* in_key must be 32-bytes long */
void twofish_set_key(TwofishInstance *instance, const u4byte in_key[]);
#if CRYPTOPP_BOOL_X64 && !defined(CRYPTOPP_DISABLE_ASM)
-void twofish_encrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte* out_blk, uint32 blockCount);
-void twofish_decrypt_blocks(TwofishInstance *instance, const byte* in_blk, byte* out_blk, uint32 blockCount);
-#define twofish_encrypt(instance,in_blk,out_blk) twofish_encrypt_blocks(instance, (const byte*) in_blk, (byte*) out_blk, 1)
-#define twofish_decrypt(instance,in_blk,out_blk) twofish_decrypt_blocks(instance, (const byte*) in_blk, (byte*) out_blk, 1)
+void twofish_encrypt_blocks(TwofishInstance *instance, const uint8* in_blk, uint8* out_blk, uint32 blockCount);
+void twofish_decrypt_blocks(TwofishInstance *instance, const uint8* in_blk, uint8* out_blk, uint32 blockCount);
+#define twofish_encrypt(instance,in_blk,out_blk) twofish_encrypt_blocks(instance, (const uint8*) in_blk, (uint8*) out_blk, 1)
+#define twofish_decrypt(instance,in_blk,out_blk) twofish_decrypt_blocks(instance, (const uint8*) in_blk, (uint8*) out_blk, 1)
#else
void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[4]);
void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[4]);
diff --git a/src/Crypto/Whirlpool.c b/src/Crypto/Whirlpool.c
index 9af0cb32..6a1fe8b4 100644
--- a/src/Crypto/Whirlpool.c
+++ b/src/Crypto/Whirlpool.c
@@ -936,7 +936,7 @@ void WHIRLPOOL_add(const unsigned char * input,
else
{
uint64* dataBuf = ctx->data;
- byte* data = (byte *)dataBuf;
+ uint8* data = (uint8 *)dataBuf;
num = oldCountLo & 63;
if (num != 0) // process left over data
@@ -996,7 +996,7 @@ void WHIRLPOOL_finalize(WHIRLPOOL_CTX * const ctx,
unsigned int num = ctx->countLo & 63;
uint64* dataBuf = ctx->data;
uint64* stateBuf = ctx->state;
- byte* data = (byte *)dataBuf;
+ uint8* data = (uint8 *)dataBuf;
data[num++] = 0x80;
if (num <= 32)
diff --git a/src/Crypto/chacha-xmm.c b/src/Crypto/chacha-xmm.c
index 478de594..54c3680c 100644
--- a/src/Crypto/chacha-xmm.c
+++ b/src/Crypto/chacha-xmm.c
@@ -43,7 +43,6 @@ __inline __m128i _mm_set1_epi64x(int64 a)
#endif
#endif
-#define uint8 byte
#define U32V(v) (v)
#define ROTL32(x,n) rotl32(x, n)
diff --git a/src/Crypto/config.h b/src/Crypto/config.h
index 867c13dd..d2a9cfea 100644
--- a/src/Crypto/config.h
+++ b/src/Crypto/config.h
@@ -209,8 +209,8 @@
#define GETBYTE(x, y) (unsigned int)((unsigned char)((x)>>(8*(y))))
// these may be faster on other CPUs/compilers
// #define GETBYTE(x, y) (unsigned int)(((x)>>(8*(y)))&255)
-// #define GETBYTE(x, y) (((byte *)&(x))[y])
+// #define GETBYTE(x, y) (((uint8 *)&(x))[y])
-#define CRYPTOPP_GET_BYTE_AS_BYTE(x, y) ((byte)((x)>>(8*(y))))
+#define CRYPTOPP_GET_BYTE_AS_BYTE(x, y) ((uint8)((x)>>(8*(y))))
#endif
diff --git a/src/Crypto/kuznyechik.c b/src/Crypto/kuznyechik.c
index 65685d09..fb76142b 100644
--- a/src/Crypto/kuznyechik.c
+++ b/src/Crypto/kuznyechik.c
@@ -12,16 +12,16 @@ and released into public domain.
#endif
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
-void kuznyechik_set_key_simd(const byte* key, kuznyechik_kds *kds);
-void kuznyechik_encrypt_block_simd(byte* out, const byte* in, kuznyechik_kds* kds);
-void kuznyechik_encrypt_blocks_simd(byte* out, const byte* in, size_t blocks, kuznyechik_kds* kds);
-void kuznyechik_decrypt_block_simd(byte* out, const byte* in, kuznyechik_kds* kds);
-void kuznyechik_decrypt_blocks_simd(byte* out, const byte* in, size_t blocks, kuznyechik_kds* kds);
+void kuznyechik_set_key_simd(const uint8* key, kuznyechik_kds *kds);
+void kuznyechik_encrypt_block_simd(uint8* out, const uint8* in, kuznyechik_kds* kds);
+void kuznyechik_encrypt_blocks_simd(uint8* out, const uint8* in, size_t blocks, kuznyechik_kds* kds);
+void kuznyechik_decrypt_block_simd(uint8* out, const uint8* in, kuznyechik_kds* kds);
+void kuznyechik_decrypt_blocks_simd(uint8* out, const uint8* in, size_t blocks, kuznyechik_kds* kds);
#endif
//#define CPPCRYPTO_DEBUG
- static const byte S[256] = {
+ static const uint8 S[256] = {
252, 238, 221, 17, 207, 110, 49, 22, 251, 196, 250, 218, 35, 197, 4, 77, 233, 119, 240, 219, 147, 46, 153, 186, 23, 54, 241, 187, 20, 205, 95, 193,
249, 24, 101, 90, 226, 92, 239, 33, 129, 28, 60, 66, 139, 1, 142, 79, 5, 132, 2, 174, 227, 106, 143, 160, 6, 11, 237, 152, 127, 212, 211, 31,
235, 52, 44, 81, 234, 200, 72, 171, 242, 42, 104, 162, 253, 58, 206, 204, 181, 112, 14, 86, 8, 12, 118, 18, 191, 114, 19, 71, 156, 183, 93, 135,
@@ -32,7 +32,7 @@ void kuznyechik_decrypt_blocks_simd(byte* out, const byte* in, size_t blocks, ku
32, 113, 103, 164, 45, 43, 9, 91, 203, 155, 37, 208, 190, 229, 108, 82, 89, 166, 116, 210, 230, 244, 180, 192, 209, 102, 175, 194, 57, 75, 99, 182
};
- static const byte IS[256] = {
+ static const uint8 IS[256] = {
165, 45, 50, 143, 14, 48, 56, 192, 84, 230, 158, 57, 85, 126, 82, 145, 100, 3, 87, 90, 28, 96, 7, 24, 33, 114, 168, 209, 41, 198, 164, 63,
224, 39, 141, 12, 130, 234, 174, 180, 154, 99, 73, 229, 66, 228, 21, 183, 200, 6, 112, 157, 65, 117, 25, 201, 170, 252, 77, 191, 42, 115, 132, 213,
195, 175, 43, 134, 167, 177, 178, 91, 70, 211, 159, 253, 212, 15, 156, 47, 155, 67, 239, 217, 121, 182, 83, 127, 193, 240, 35, 231, 37, 94, 181, 30,
@@ -2144,30 +2144,30 @@ void kuznyechik_decrypt_blocks_simd(byte* out, const byte* in, size_t blocks, ku
};
#define LS(x1,x2,t1,t2) { \
- t1 = T[0][(byte)(x1)][0] ^ T[1][(byte)(x1 >> 8)][0] ^ T[2][(byte)(x1 >> 16)][0] ^ T[3][(byte)(x1 >> 24)][0] ^ T[4][(byte)(x1 >> 32)][0] ^ T[5][(byte)(x1 >> 40)][0] ^ \
- T[6][(byte)(x1 >> 48)][0] ^ T[7][(byte)(x1 >> 56)][0] ^ T[8][(byte)(x2)][0] ^ T[9][(byte)(x2 >> 8)][0] ^ T[10][(byte)(x2 >> 16)][0] ^ T[11][(byte)(x2 >> 24)][0] ^ \
- T[12][(byte)(x2 >> 32)][0] ^ T[13][(byte)(x2 >> 40)][0] ^ T[14][(byte)(x2 >> 48)][0] ^ T[15][(byte)(x2 >> 56)][0]; \
- t2 = T[0][(byte)(x1)][1] ^ T[1][(byte)(x1 >> 8)][1] ^ T[2][(byte)(x1 >> 16)][1] ^ T[3][(byte)(x1 >> 24)][1] ^ T[4][(byte)(x1 >> 32)][1] ^ T[5][(byte)(x1 >> 40)][1] ^ \
- T[6][(byte)(x1 >> 48)][1] ^ T[7][(byte)(x1 >> 56)][1] ^ T[8][(byte)(x2)][1] ^ T[9][(byte)(x2 >> 8)][1] ^ T[10][(byte)(x2 >> 16)][1] ^ T[11][(byte)(x2 >> 24)][1] ^ \
- T[12][(byte)(x2 >> 32)][1] ^ T[13][(byte)(x2 >> 40)][1] ^ T[14][(byte)(x2 >> 48)][1] ^ T[15][(byte)(x2 >> 56)][1]; \
+ t1 = T[0][(uint8)(x1)][0] ^ T[1][(uint8)(x1 >> 8)][0] ^ T[2][(uint8)(x1 >> 16)][0] ^ T[3][(uint8)(x1 >> 24)][0] ^ T[4][(uint8)(x1 >> 32)][0] ^ T[5][(uint8)(x1 >> 40)][0] ^ \
+ T[6][(uint8)(x1 >> 48)][0] ^ T[7][(uint8)(x1 >> 56)][0] ^ T[8][(uint8)(x2)][0] ^ T[9][(uint8)(x2 >> 8)][0] ^ T[10][(uint8)(x2 >> 16)][0] ^ T[11][(uint8)(x2 >> 24)][0] ^ \
+ T[12][(uint8)(x2 >> 32)][0] ^ T[13][(uint8)(x2 >> 40)][0] ^ T[14][(uint8)(x2 >> 48)][0] ^ T[15][(uint8)(x2 >> 56)][0]; \
+ t2 = T[0][(uint8)(x1)][1] ^ T[1][(uint8)(x1 >> 8)][1] ^ T[2][(uint8)(x1 >> 16)][1] ^ T[3][(uint8)(x1 >> 24)][1] ^ T[4][(uint8)(x1 >> 32)][1] ^ T[5][(uint8)(x1 >> 40)][1] ^ \
+ T[6][(uint8)(x1 >> 48)][1] ^ T[7][(uint8)(x1 >> 56)][1] ^ T[8][(uint8)(x2)][1] ^ T[9][(uint8)(x2 >> 8)][1] ^ T[10][(uint8)(x2 >> 16)][1] ^ T[11][(uint8)(x2 >> 24)][1] ^ \
+ T[12][(uint8)(x2 >> 32)][1] ^ T[13][(uint8)(x2 >> 40)][1] ^ T[14][(uint8)(x2 >> 48)][1] ^ T[15][(uint8)(x2 >> 56)][1]; \
}
#define ILS(x1,x2,t1,t2) { \
- t1 = IT[0][(byte)(x1)][0] ^ IT[1][(byte)(x1 >> 8)][0] ^ IT[2][(byte)(x1 >> 16)][0] ^ IT[3][(byte)(x1 >> 24)][0] ^ IT[4][(byte)(x1 >> 32)][0] ^ IT[5][(byte)(x1 >> 40)][0] ^ \
- IT[6][(byte)(x1 >> 48)][0] ^ IT[7][(byte)(x1 >> 56)][0] ^ IT[8][(byte)(x2)][0] ^ IT[9][(byte)(x2 >> 8)][0] ^ IT[10][(byte)(x2 >> 16)][0] ^ IT[11][(byte)(x2 >> 24)][0] ^ \
- IT[12][(byte)(x2 >> 32)][0] ^ IT[13][(byte)(x2 >> 40)][0] ^ IT[14][(byte)(x2 >> 48)][0] ^ IT[15][(byte)(x2 >> 56)][0]; \
- t2 = IT[0][(byte)(x1)][1] ^ IT[1][(byte)(x1 >> 8)][1] ^ IT[2][(byte)(x1 >> 16)][1] ^ IT[3][(byte)(x1 >> 24)][1] ^ IT[4][(byte)(x1 >> 32)][1] ^ IT[5][(byte)(x1 >> 40)][1] ^ \
- IT[6][(byte)(x1 >> 48)][1] ^ IT[7][(byte)(x1 >> 56)][1] ^ IT[8][(byte)(x2)][1] ^ IT[9][(byte)(x2 >> 8)][1] ^ IT[10][(byte)(x2 >> 16)][1] ^ IT[11][(byte)(x2 >> 24)][1] ^ \
- IT[12][(byte)(x2 >> 32)][1] ^ IT[13][(byte)(x2 >> 40)][1] ^ IT[14][(byte)(x2 >> 48)][1] ^ IT[15][(byte)(x2 >> 56)][1]; \
+ t1 = IT[0][(uint8)(x1)][0] ^ IT[1][(uint8)(x1 >> 8)][0] ^ IT[2][(uint8)(x1 >> 16)][0] ^ IT[3][(uint8)(x1 >> 24)][0] ^ IT[4][(uint8)(x1 >> 32)][0] ^ IT[5][(uint8)(x1 >> 40)][0] ^ \
+ IT[6][(uint8)(x1 >> 48)][0] ^ IT[7][(uint8)(x1 >> 56)][0] ^ IT[8][(uint8)(x2)][0] ^ IT[9][(uint8)(x2 >> 8)][0] ^ IT[10][(uint8)(x2 >> 16)][0] ^ IT[11][(uint8)(x2 >> 24)][0] ^ \
+ IT[12][(uint8)(x2 >> 32)][0] ^ IT[13][(uint8)(x2 >> 40)][0] ^ IT[14][(uint8)(x2 >> 48)][0] ^ IT[15][(uint8)(x2 >> 56)][0]; \
+ t2 = IT[0][(uint8)(x1)][1] ^ IT[1][(uint8)(x1 >> 8)][1] ^ IT[2][(uint8)(x1 >> 16)][1] ^ IT[3][(uint8)(x1 >> 24)][1] ^ IT[4][(uint8)(x1 >> 32)][1] ^ IT[5][(uint8)(x1 >> 40)][1] ^ \
+ IT[6][(uint8)(x1 >> 48)][1] ^ IT[7][(uint8)(x1 >> 56)][1] ^ IT[8][(uint8)(x2)][1] ^ IT[9][(uint8)(x2 >> 8)][1] ^ IT[10][(uint8)(x2 >> 16)][1] ^ IT[11][(uint8)(x2 >> 24)][1] ^ \
+ IT[12][(uint8)(x2 >> 32)][1] ^ IT[13][(uint8)(x2 >> 40)][1] ^ IT[14][(uint8)(x2 >> 48)][1] ^ IT[15][(uint8)(x2 >> 56)][1]; \
}
#define ILSS(x1,x2,t1,t2) { \
- t1 = IT[0][S[(byte)(x1)]][0] ^ IT[1][S[(byte)(x1 >> 8)]][0] ^ IT[2][S[(byte)(x1 >> 16)]][0] ^ IT[3][S[(byte)(x1 >> 24)]][0] ^ IT[4][S[(byte)(x1 >> 32)]][0] ^ IT[5][S[(byte)(x1 >> 40)]][0] ^ \
- IT[6][S[(byte)(x1 >> 48)]][0] ^ IT[7][S[(byte)(x1 >> 56)]][0] ^ IT[8][S[(byte)(x2)]][0] ^ IT[9][S[(byte)(x2 >> 8)]][0] ^ IT[10][S[(byte)(x2 >> 16)]][0] ^ IT[11][S[(byte)(x2 >> 24)]][0] ^ \
- IT[12][S[(byte)(x2 >> 32)]][0] ^ IT[13][S[(byte)(x2 >> 40)]][0] ^ IT[14][S[(byte)(x2 >> 48)]][0] ^ IT[15][S[(byte)(x2 >> 56)]][0]; \
- t2 = IT[0][S[(byte)(x1)]][1] ^ IT[1][S[(byte)(x1 >> 8)]][1] ^ IT[2][S[(byte)(x1 >> 16)]][1] ^ IT[3][S[(byte)(x1 >> 24)]][1] ^ IT[4][S[(byte)(x1 >> 32)]][1] ^ IT[5][S[(byte)(x1 >> 40)]][1] ^ \
- IT[6][S[(byte)(x1 >> 48)]][1] ^ IT[7][S[(byte)(x1 >> 56)]][1] ^ IT[8][S[(byte)(x2)]][1] ^ IT[9][S[(byte)(x2 >> 8)]][1] ^ IT[10][S[(byte)(x2 >> 16)]][1] ^ IT[11][S[(byte)(x2 >> 24)]][1] ^ \
- IT[12][S[(byte)(x2 >> 32)]][1] ^ IT[13][S[(byte)(x2 >> 40)]][1] ^ IT[14][S[(byte)(x2 >> 48)]][1] ^ IT[15][S[(byte)(x2 >> 56)]][1]; \
+ t1 = IT[0][S[(uint8)(x1)]][0] ^ IT[1][S[(uint8)(x1 >> 8)]][0] ^ IT[2][S[(uint8)(x1 >> 16)]][0] ^ IT[3][S[(uint8)(x1 >> 24)]][0] ^ IT[4][S[(uint8)(x1 >> 32)]][0] ^ IT[5][S[(uint8)(x1 >> 40)]][0] ^ \
+ IT[6][S[(uint8)(x1 >> 48)]][0] ^ IT[7][S[(uint8)(x1 >> 56)]][0] ^ IT[8][S[(uint8)(x2)]][0] ^ IT[9][S[(uint8)(x2 >> 8)]][0] ^ IT[10][S[(uint8)(x2 >> 16)]][0] ^ IT[11][S[(uint8)(x2 >> 24)]][0] ^ \
+ IT[12][S[(uint8)(x2 >> 32)]][0] ^ IT[13][S[(uint8)(x2 >> 40)]][0] ^ IT[14][S[(uint8)(x2 >> 48)]][0] ^ IT[15][S[(uint8)(x2 >> 56)]][0]; \
+ t2 = IT[0][S[(uint8)(x1)]][1] ^ IT[1][S[(uint8)(x1 >> 8)]][1] ^ IT[2][S[(uint8)(x1 >> 16)]][1] ^ IT[3][S[(uint8)(x1 >> 24)]][1] ^ IT[4][S[(uint8)(x1 >> 32)]][1] ^ IT[5][S[(uint8)(x1 >> 40)]][1] ^ \
+ IT[6][S[(uint8)(x1 >> 48)]][1] ^ IT[7][S[(uint8)(x1 >> 56)]][1] ^ IT[8][S[(uint8)(x2)]][1] ^ IT[9][S[(uint8)(x2 >> 8)]][1] ^ IT[10][S[(uint8)(x2 >> 16)]][1] ^ IT[11][S[(uint8)(x2 >> 24)]][1] ^ \
+ IT[12][S[(uint8)(x2 >> 32)]][1] ^ IT[13][S[(uint8)(x2 >> 40)]][1] ^ IT[14][S[(uint8)(x2 >> 48)]][1] ^ IT[15][S[(uint8)(x2 >> 56)]][1]; \
}
#define ISI(val) { \
@@ -2199,7 +2199,7 @@ void kuznyechik_decrypt_blocks_simd(byte* out, const byte* in, size_t blocks, ku
} \
}
- void kuznyechik_set_key(const byte* key, kuznyechik_kds* kds)
+ void kuznyechik_set_key(const uint8* key, kuznyechik_kds* kds)
{
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined(_UEFI) && (!defined (TC_WINDOWS_DRIVER) || (!defined (DEBUG) && defined (_WIN64)))
if(HasSSE2())
@@ -2258,7 +2258,7 @@ void kuznyechik_decrypt_blocks_simd(byte* out, const byte* in, size_t blocks, ku
}
- void kuznyechik_encrypt_block(byte* out, const byte* in, kuznyechik_kds* kds)
+ void kuznyechik_encrypt_block(uint8* out, const uint8* in, kuznyechik_kds* kds)
{
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined(_UEFI) && (!defined (TC_WINDOWS_DRIVER) || (!defined (DEBUG) && defined (_WIN64)))
if(HasSSE2())
@@ -2305,7 +2305,7 @@ void kuznyechik_decrypt_blocks_simd(byte* out, const byte* in, size_t blocks, ku
}
}
- void kuznyechik_encrypt_blocks(byte* out, const byte* in, size_t blocks, kuznyechik_kds* kds)
+ void kuznyechik_encrypt_blocks(uint8* out, const uint8* in, size_t blocks, kuznyechik_kds* kds)
{
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined(_UEFI) && (!defined (DEBUG) || !defined (TC_WINDOWS_DRIVER))
if(HasSSE2())
@@ -2325,7 +2325,7 @@ void kuznyechik_decrypt_blocks_simd(byte* out, const byte* in, size_t blocks, ku
}
}
- void kuznyechik_decrypt_block(byte* out, const byte* in, kuznyechik_kds* kds)
+ void kuznyechik_decrypt_block(uint8* out, const uint8* in, kuznyechik_kds* kds)
{
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined(_UEFI) && (!defined (TC_WINDOWS_DRIVER) || (!defined (DEBUG) && defined (_WIN64)))
if(HasSSE2())
@@ -2366,8 +2366,8 @@ void kuznyechik_decrypt_blocks_simd(byte* out, const byte* in, size_t blocks, ku
ILS(x1, x2, t1, t2);
t1 ^= kds->rkd[2];
t2 ^= kds->rkd[3];
- ISI((byte*)&t1);
- ISI((byte*)&t2);
+ ISI((uint8*)&t1);
+ ISI((uint8*)&t2);
t1 ^= kds->rkd[0];
t2 ^= kds->rkd[1];
*(uint64*)out = t1;
@@ -2375,7 +2375,7 @@ void kuznyechik_decrypt_blocks_simd(byte* out, const byte* in, size_t blocks, ku
}
}
- void kuznyechik_decrypt_blocks(byte* out, const byte* in, size_t blocks, kuznyechik_kds* kds)
+ void kuznyechik_decrypt_blocks(uint8* out, const uint8* in, size_t blocks, kuznyechik_kds* kds)
{
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && !defined(_UEFI) && (!defined (DEBUG) || !defined (TC_WINDOWS_DRIVER))
if(HasSSE2())
diff --git a/src/Crypto/kuznyechik.h b/src/Crypto/kuznyechik.h
index f0b45b64..05dc6e0e 100644
--- a/src/Crypto/kuznyechik.h
+++ b/src/Crypto/kuznyechik.h
@@ -22,11 +22,11 @@ typedef struct _kuznyechik_kds
#define KUZNYECHIK_KS (sizeof(kuznyechik_kds))
-void kuznyechik_encrypt_block(byte* out, const byte* in, kuznyechik_kds* kds);
-void kuznyechik_encrypt_blocks(byte* out, const byte* in, size_t blocks, kuznyechik_kds* kds);
-void kuznyechik_decrypt_block(byte* out, const byte* in, kuznyechik_kds* kds);
-void kuznyechik_decrypt_blocks(byte* out, const byte* in, size_t blocks, kuznyechik_kds* kds);
-void kuznyechik_set_key(const byte* key, kuznyechik_kds *kds);
+void kuznyechik_encrypt_block(uint8* out, const uint8* in, kuznyechik_kds* kds);
+void kuznyechik_encrypt_blocks(uint8* out, const uint8* in, size_t blocks, kuznyechik_kds* kds);
+void kuznyechik_decrypt_block(uint8* out, const uint8* in, kuznyechik_kds* kds);
+void kuznyechik_decrypt_blocks(uint8* out, const uint8* in, size_t blocks, kuznyechik_kds* kds);
+void kuznyechik_set_key(const uint8* key, kuznyechik_kds *kds);
#ifdef __cplusplus
}
diff --git a/src/Crypto/kuznyechik_simd.c b/src/Crypto/kuznyechik_simd.c
index 1c505db1..a7391908 100644
--- a/src/Crypto/kuznyechik_simd.c
+++ b/src/Crypto/kuznyechik_simd.c
@@ -9169,7 +9169,7 @@ VC_INLINE void scheduleDecryptionRoundKeysForGost15(
applyLSTransformation_4(data1_, data2_, data3_,data4_); \
}
-void kuznyechik_encrypt_block_simd(byte* out, const byte* in, kuznyechik_kds* kds)
+void kuznyechik_encrypt_block_simd(uint8* out, const uint8* in, kuznyechik_kds* kds)
{
const uint_64t *roundKeys_ = (const uint_64t *) kds->rke;
__m128i data_;
@@ -9200,7 +9200,7 @@ void kuznyechik_encrypt_block_simd(byte* out, const byte* in, kuznyechik_kds* kd
_mm_storeu_si128((__m128i*) out, data_);
}
-void kuznyechik_encrypt_blocks_simd(byte* out, const byte* in, size_t blocks, kuznyechik_kds* kds)
+void kuznyechik_encrypt_blocks_simd(uint8* out, const uint8* in, size_t blocks, kuznyechik_kds* kds)
{
const uint_64t *roundKeys_ = (const uint_64t *) kds->rke;
__m128i data1_, data2_, data3_, data4_;
@@ -9347,7 +9347,7 @@ void kuznyechik_encrypt_blocks_simd(byte* out, const byte* in, size_t blocks, ku
data4_ = _mm_xor_si128(data4_, cache11_); \
}
-void kuznyechik_decrypt_block_simd(byte* out, const byte* in, kuznyechik_kds* kds)
+void kuznyechik_decrypt_block_simd(uint8* out, const uint8* in, kuznyechik_kds* kds)
{
const uint_64t *roundKeys_ = kds->rkd;
__m128i data_;
@@ -9383,7 +9383,7 @@ void kuznyechik_decrypt_block_simd(byte* out, const byte* in, kuznyechik_kds* kd
_mm_storeu_si128((__m128i*) out, data_);
}
-void kuznyechik_decrypt_blocks_simd(byte* out, const byte* in, size_t blocks, kuznyechik_kds* kds)
+void kuznyechik_decrypt_blocks_simd(uint8* out, const uint8* in, size_t blocks, kuznyechik_kds* kds)
{
const uint_64t *roundKeys_ = kds->rkd;
__m128i data1_, data2_,data3_,data4_;
@@ -9508,7 +9508,7 @@ void kuznyechik_decrypt_blocks_simd(byte* out, const byte* in, size_t blocks, ku
kuznyechik_decrypt_block_simd (out, in, kds);
}
-void kuznyechik_set_key_simd(const byte* key, kuznyechik_kds *kds)
+void kuznyechik_set_key_simd(const uint8* key, kuznyechik_kds *kds)
{
scheduleEncryptionRoundKeysForGost15 (kds->rke, key);
scheduleDecryptionRoundKeysForGost15 (kds->rkd, key);
diff --git a/src/Crypto/rdrand.c b/src/Crypto/rdrand.c
index afed7cd1..52f7f98e 100644
--- a/src/Crypto/rdrand.c
+++ b/src/Crypto/rdrand.c
@@ -6,8 +6,8 @@
#include "cpu.h"
#include "misc.h"
-void CRYPTOPP_FASTCALL MASM_RDRAND_GenerateBlock(byte*, size_t);
-void CRYPTOPP_FASTCALL MASM_RDSEED_GenerateBlock(byte*, size_t);
+void CRYPTOPP_FASTCALL MASM_RDRAND_GenerateBlock(uint8*, size_t);
+void CRYPTOPP_FASTCALL MASM_RDSEED_GenerateBlock(uint8*, size_t);
int RDRAND_getBytes(unsigned char* buf, size_t bufLen)
{
diff --git a/src/Crypto/t1ha.h b/src/Crypto/t1ha.h
index 97615b51..c32d07b5 100644
--- a/src/Crypto/t1ha.h
+++ b/src/Crypto/t1ha.h
@@ -183,7 +183,7 @@ extern "C" {
#define T1HA_ALIGN_SUFFIX
#ifdef _MSC_VER
-#define uint8_t byte
+#define uint8_t uint8
#define uint16_t uint16
#define uint32_t uint32
#define uint64_t uint64
diff --git a/src/Crypto/wolfCrypt.c b/src/Crypto/wolfCrypt.c
index 39ab93a7..4a4946a6 100644
--- a/src/Crypto/wolfCrypt.c
+++ b/src/Crypto/wolfCrypt.c
@@ -234,10 +234,10 @@ void sha512(unsigned char * result, const unsigned char* source, uint_64t source
void derive_key_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen) {
(void) iterations;
- wc_HKDF(WC_SHA512, (byte*)pwd, (word32)pwd_len, (byte*)salt, (word32)salt_len, NULL, 0, (byte*)dk, (word32)dklen);
+ wc_HKDF(WC_SHA512, (uint8*)pwd, (word32)pwd_len, (uint8*)salt, (word32)salt_len, NULL, 0, (uint8*)dk, (word32)dklen);
}
void derive_key_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen) {
(void) iterations;
- wc_HKDF(WC_SHA256, (byte*)pwd, (word32)pwd_len, (byte*)salt, (word32)salt_len, NULL, 0, (byte*)dk, (word32)dklen);
+ wc_HKDF(WC_SHA256, (uint8*)pwd, (word32)pwd_len, (uint8*)salt, (word32)salt_len, NULL, 0, (uint8*)dk, (word32)dklen);
}
diff --git a/src/Driver/DriveFilter.c b/src/Driver/DriveFilter.c
index 49d62126..a615797a 100644
--- a/src/Driver/DriveFilter.c
+++ b/src/Driver/DriveFilter.c
@@ -35,7 +35,7 @@ static BOOL DeviceFilterActive = FALSE;
BOOL BootArgsValid = FALSE;
BootArguments BootArgs;
-byte* BootSecRegionData = NULL;
+uint8* BootSecRegionData = NULL;
uint32 BootSecRegionSize = 0;
uint32 BootPkcs5 = 0;
@@ -47,13 +47,13 @@ static KMUTEX MountMutex;
static volatile BOOL BootDriveFound = FALSE;
static DriveFilterExtension *BootDriveFilterExtension = NULL;
static LARGE_INTEGER BootDriveLength;
-static byte BootLoaderFingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE];
+static uint8 BootLoaderFingerprint[WHIRLPOOL_DIGESTSIZE + SHA512_DIGESTSIZE];
static BOOL CrashDumpEnabled = FALSE;
static BOOL HibernationEnabled = FALSE;
static BOOL LegacyHibernationDriverFilterActive = FALSE;
-static byte *HibernationWriteBuffer = NULL;
+static uint8 *HibernationWriteBuffer = NULL;
static MDL *HibernationWriteBufferMdl = NULL;
static uint32 HibernationPreventionCount = 0;
@@ -82,8 +82,8 @@ NTSTATUS LoadBootArguments (BOOL bIsEfi)
{
NTSTATUS status = STATUS_UNSUCCESSFUL;
PHYSICAL_ADDRESS bootArgsAddr;
- byte *mappedBootArgs;
- byte *mappedCryptoInfo = NULL;
+ uint8 *mappedBootArgs;
+ uint8 *mappedCryptoInfo = NULL;
uint16 bootLoaderArgsIndex;
uint64* BootArgsRegionsPtr = bIsEfi? BootArgsRegionsEFI : BootArgsRegionsDefault;
size_t BootArgsRegionsCount = bIsEfi? sizeof(BootArgsRegionsEFI)/ sizeof(BootArgsRegionsEFI[0]) : sizeof(BootArgsRegionsDefault)/ sizeof(BootArgsRegionsDefault[0]);
@@ -109,7 +109,7 @@ NTSTATUS LoadBootArguments (BOOL bIsEfi)
DumpMem (mappedBootArgs, sizeof (BootArguments));
if (bootArguments->BootLoaderVersion == VERSION_NUM
- && bootArguments->BootArgumentsCrc32 != GetCrc32 ((byte *) bootArguments, (int) ((byte *) &bootArguments->BootArgumentsCrc32 - (byte *) bootArguments)))
+ && bootArguments->BootArgumentsCrc32 != GetCrc32 ((uint8 *) bootArguments, (int) ((uint8 *) &bootArguments->BootArgumentsCrc32 - (uint8 *) bootArguments)))
{
Dump ("BootArguments CRC incorrect\n");
burn (mappedBootArgs, sizeof (BootArguments));
@@ -166,13 +166,13 @@ NTSTATUS LoadBootArguments (BOOL bIsEfi)
uint32 crc;
PHYSICAL_ADDRESS SecRegionAddress;
SECREGION_BOOT_PARAMS* SecRegionParams = (SECREGION_BOOT_PARAMS*) (mappedCryptoInfo + sizeof(BOOT_CRYPTO_HEADER) + 2);
- byte *secRegionData = NULL;
+ uint8 *secRegionData = NULL;
SecRegionAddress.QuadPart = SecRegionParams->Ptr;
Dump ("SecRegion memory 0x%x %d\n", SecRegionAddress.LowPart, SecRegionParams->Size);
// SecRegion correct?
if( (SecRegionParams->Ptr != 0) && (SecRegionParams->Size > 0)) {
- crc = GetCrc32((byte*)SecRegionParams, 12);
+ crc = GetCrc32((uint8*)SecRegionParams, 12);
if(crc == SecRegionParams->Crc) {
Dump ("SecRegion crc ok\n");
secRegionData = MmMapIoSpace (SecRegionAddress, SecRegionParams->Size, MmCached);
@@ -329,7 +329,7 @@ static void InvalidateDriveFilterKeys (DriveFilterExtension *Extension)
Dump ("Drive filter encryption keys invalidated!\n");
}
-static void ComputeBootLoaderFingerprint(PDEVICE_OBJECT LowerDeviceObject, byte* ioBuffer /* ioBuffer must be at least 512 bytes long */)
+static void ComputeBootLoaderFingerprint(PDEVICE_OBJECT LowerDeviceObject, uint8* ioBuffer /* ioBuffer must be at least 512 bytes long */)
{
NTSTATUS status;
LARGE_INTEGER offset;
@@ -433,7 +433,7 @@ static NTSTATUS MountDrive (DriveFilterExtension *Extension, Password *password,
// Check disk MBR id and GPT ID if BootSecRegion is available to detect boot drive
if (BootSecRegionData != NULL && BootSecRegionSize >= 1024) {
- byte mbr[TC_SECTOR_SIZE_BIOS];
+ uint8 mbr[TC_SECTOR_SIZE_BIOS];
DCS_DISK_ENTRY_LIST* DeList = (DCS_DISK_ENTRY_LIST*)(BootSecRegionData + 512);
offset.QuadPart = 0;
status = TCReadDevice (Extension->LowerDeviceObject, mbr, offset, TC_SECTOR_SIZE_BIOS);
@@ -459,7 +459,7 @@ static NTSTATUS MountDrive (DriveFilterExtension *Extension, Password *password,
// Check boot drive signature first (header CRC search could fail if a user restored the header to a non-boot drive)
if (BootDriveSignatureValid)
{
- byte mbr[TC_SECTOR_SIZE_BIOS];
+ uint8 mbr[TC_SECTOR_SIZE_BIOS];
offset.QuadPart = 0;
status = TCReadDevice (Extension->LowerDeviceObject, mbr, offset, TC_SECTOR_SIZE_BIOS);
@@ -585,7 +585,7 @@ static NTSTATUS MountDrive (DriveFilterExtension *Extension, Password *password,
uint32 crcSaved;
crcSaved = DeList->CRC32;
DeList->CRC32 = 0;
- crc = GetCrc32((byte*)DeList, 512);
+ crc = GetCrc32((uint8*)DeList, 512);
if(crc == crcSaved){
if(DeList->DE[DE_IDX_PWDCACHE].Type == DE_PwdCache) {
uint64 sector = 0;
@@ -696,7 +696,7 @@ static NTSTATUS SaveDriveVolumeHeader (DriveFilterExtension *Extension)
{
NTSTATUS status = STATUS_SUCCESS;
LARGE_INTEGER offset;
- byte *header;
+ uint8 *header;
header = TCalloc (TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE);
if (!header)
@@ -727,7 +727,7 @@ static NTSTATUS SaveDriveVolumeHeader (DriveFilterExtension *Extension)
{
uint32 headerCrc32;
uint64 encryptedAreaLength = Extension->Queue.EncryptedAreaEnd + 1 - Extension->Queue.EncryptedAreaStart;
- byte *fieldPos = header + TC_HEADER_OFFSET_ENCRYPTED_AREA_LENGTH;
+ uint8 *fieldPos = header + TC_HEADER_OFFSET_ENCRYPTED_AREA_LENGTH;
PCRYPTO_INFO pCryptoInfo = Extension->HeaderCryptoInfo;
#ifdef _WIN64
CRYPTO_INFO tmpCI;
@@ -1234,16 +1234,16 @@ typedef NTSTATUS (*HiberDriverWriteFunctionB) (PLARGE_INTEGER writeOffset, PMDL
typedef struct
{
#ifdef _WIN64
- byte FieldPad1[64];
+ uint8 FieldPad1[64];
HiberDriverWriteFunctionB WriteFunctionB;
- byte FieldPad2[56];
+ uint8 FieldPad2[56];
#else
- byte FieldPad1[48];
+ uint8 FieldPad1[48];
HiberDriverWriteFunctionB WriteFunctionB;
- byte FieldPad2[32];
+ uint8 FieldPad2[32];
#endif
HiberDriverWriteFunctionA WriteFunctionA;
- byte FieldPad3[24];
+ uint8 FieldPad3[24];
LARGE_INTEGER PartitionStartOffset;
} HiberDriverContext;
@@ -1253,16 +1253,16 @@ typedef struct
{
LIST_ENTRY ModuleList;
#ifdef _WIN64
- byte FieldPad1[32];
+ uint8 FieldPad1[32];
#else
- byte FieldPad1[16];
+ uint8 FieldPad1[16];
#endif
PVOID ModuleBaseAddress;
HiberDriverEntry ModuleEntryAddress;
#ifdef _WIN64
- byte FieldPad2[24];
+ uint8 FieldPad2[24];
#else
- byte FieldPad2[12];
+ uint8 FieldPad2[12];
#endif
UNICODE_STRING ModuleName;
} ModuleTableItem;
@@ -1572,10 +1572,10 @@ static VOID SetupThreadProc (PVOID threadArg)
BOOL headerUpdateRequired = FALSE;
int64 bytesWrittenSinceHeaderUpdate = 0;
- byte *buffer = NULL;
- byte *wipeBuffer = NULL;
- byte wipeRandChars[TC_WIPE_RAND_CHAR_COUNT];
- byte wipeRandCharsUpdate[TC_WIPE_RAND_CHAR_COUNT];
+ uint8 *buffer = NULL;
+ uint8 *wipeBuffer = NULL;
+ uint8 wipeRandChars[TC_WIPE_RAND_CHAR_COUNT];
+ uint8 wipeRandCharsUpdate[TC_WIPE_RAND_CHAR_COUNT];
KIRQL irql;
NTSTATUS status;
@@ -1583,7 +1583,7 @@ static VOID SetupThreadProc (PVOID threadArg)
// generate real random values for wipeRandChars and
// wipeRandCharsUpdate instead of relying on uninitialized stack memory
ChaCha20RngCtx rngCtx;
- byte pbSeed[CHACHA20RNG_KEYSZ + CHACHA20RNG_IVSZ];
+ uint8 pbSeed[CHACHA20RNG_KEYSZ + CHACHA20RNG_IVSZ];
GetDriverRandomSeed (pbSeed, sizeof (pbSeed));
ChaCha20RngInit (&rngCtx, pbSeed, GetDriverRandomSeed, 0);
@@ -1757,7 +1757,7 @@ static VOID SetupThreadProc (PVOID threadArg)
if (SetupRequest.WipeAlgorithm != TC_WIPE_NONE)
{
- byte wipePass;
+ uint8 wipePass;
int wipePassCount = GetWipePassCount (SetupRequest.WipeAlgorithm);
if (wipePassCount <= 0)
{
@@ -2193,9 +2193,9 @@ static VOID DecoySystemWipeThreadProc (PVOID threadArg)
ULONG wipeBlockSize = TC_ENCRYPTION_SETUP_IO_BLOCK_SIZE;
CRYPTO_INFO *wipeCryptoInfo = NULL;
- byte *wipeBuffer = NULL;
- byte *wipeRandBuffer = NULL;
- byte wipeRandChars[TC_WIPE_RAND_CHAR_COUNT];
+ uint8 *wipeBuffer = NULL;
+ uint8 *wipeRandBuffer = NULL;
+ uint8 wipeRandChars[TC_WIPE_RAND_CHAR_COUNT];
int wipePass, wipePassCount;
int ea = Extension->Queue.CryptoInfo->ea;
diff --git a/src/Driver/DumpFilter.c b/src/Driver/DumpFilter.c
index 725a4fe0..aa059d9d 100644
--- a/src/Driver/DumpFilter.c
+++ b/src/Driver/DumpFilter.c
@@ -18,7 +18,7 @@
static DriveFilterExtension *BootDriveFilterExtension = NULL;
static LARGE_INTEGER DumpPartitionOffset;
-static byte *WriteFilterBuffer = NULL;
+static uint8 *WriteFilterBuffer = NULL;
static SIZE_T WriteFilterBufferSize;
diff --git a/src/Driver/EncryptedIoQueue.c b/src/Driver/EncryptedIoQueue.c
index bdf139a1..8c2e8a41 100644
--- a/src/Driver/EncryptedIoQueue.c
+++ b/src/Driver/EncryptedIoQueue.c
@@ -191,7 +191,7 @@ static NTSTATUS CompleteOriginalIrp (EncryptedIoQueueItem *item, NTSTATUS status
}
-static void AcquireFragmentBuffer (EncryptedIoQueue *queue, byte *buffer)
+static void AcquireFragmentBuffer (EncryptedIoQueue *queue, uint8 *buffer)
{
NTSTATUS status = STATUS_INVALID_PARAMETER;
@@ -209,7 +209,7 @@ static void AcquireFragmentBuffer (EncryptedIoQueue *queue, byte *buffer)
}
-static void ReleaseFragmentBuffer (EncryptedIoQueue *queue, byte *buffer)
+static void ReleaseFragmentBuffer (EncryptedIoQueue *queue, uint8 *buffer)
{
if (buffer == queue->FragmentBufferA)
{
@@ -227,8 +227,8 @@ static void ReleaseFragmentBuffer (EncryptedIoQueue *queue, byte *buffer)
BOOL
UpdateBuffer(
- byte* buffer,
- byte* secRegion,
+ uint8* buffer,
+ uint8* secRegion,
uint64 bufferDiskOffset,
uint32 bufferLength,
BOOL doUpadte
@@ -393,7 +393,7 @@ static VOID IoThreadProc (PVOID threadArg)
{
// Up to three subfragments may be required to handle a partially remapped fragment
int subFragment;
- byte *subFragmentData = request->Data;
+ uint8 *subFragmentData = request->Data;
for (subFragment = 0 ; subFragment < 3; ++subFragment)
{
@@ -615,7 +615,7 @@ static VOID MainThreadProc (PVOID threadArg)
&& (item->OriginalLength & (ENCRYPTION_DATA_UNIT_SIZE - 1)) == 0
&& (item->OriginalOffset.QuadPart & (ENCRYPTION_DATA_UNIT_SIZE - 1)) != 0)
{
- byte *buffer;
+ uint8 *buffer;
ULONG alignedLength;
LARGE_INTEGER alignedOffset;
hResult = ULongAdd(item->OriginalLength, ENCRYPTION_DATA_UNIT_SIZE, &alignedLength);
diff --git a/src/Driver/EncryptedIoQueue.h b/src/Driver/EncryptedIoQueue.h
index 2ab9dc5b..d4d580c9 100644
--- a/src/Driver/EncryptedIoQueue.h
+++ b/src/Driver/EncryptedIoQueue.h
@@ -83,8 +83,8 @@ typedef struct
KEVENT CompletionThreadQueueNotEmptyEvent;
// Fragment buffers
- byte *FragmentBufferA;
- byte *FragmentBufferB;
+ uint8 *FragmentBufferA;
+ uint8 *FragmentBufferB;
KEVENT FragmentBufferAFreeEvent;
KEVENT FragmentBufferBFreeEvent;
@@ -94,7 +94,7 @@ typedef struct
ULONG LastReadLength;
LARGE_INTEGER ReadAheadOffset;
ULONG ReadAheadLength;
- byte *ReadAheadBuffer;
+ uint8 *ReadAheadBuffer;
LARGE_INTEGER MaxReadAheadOffset;
LONG OutstandingIoCount;
@@ -119,7 +119,7 @@ typedef struct
LARGE_INTEGER LastPerformanceCounter;
#endif
- byte* SecRegionData;
+ uint8* SecRegionData;
SIZE_T SecRegionSize;
volatile BOOL ThreadBlockReadWrite;
@@ -153,8 +153,8 @@ typedef struct
ULONG Length;
int64 EncryptedOffset;
ULONG EncryptedLength;
- byte *Data;
- byte *OrigDataBufferFragment;
+ uint8 *Data;
+ uint8 *OrigDataBufferFragment;
LIST_ENTRY ListEntry;
LIST_ENTRY CompletionListEntry;
diff --git a/src/Driver/Fuse/FuseService.cpp b/src/Driver/Fuse/FuseService.cpp
index bc3d1023..5b12ba4d 100644
--- a/src/Driver/Fuse/FuseService.cpp
+++ b/src/Driver/Fuse/FuseService.cpp
@@ -223,11 +223,11 @@ namespace VeraCrypt
SecureBuffer alignedBuffer (alignedSize);
FuseService::ReadVolumeSectors (alignedBuffer, alignedOffset);
- BufferPtr ((byte *) buf, size).CopyFrom (alignedBuffer.GetRange (offset % sectorSize, size));
+ BufferPtr ((uint8 *) buf, size).CopyFrom (alignedBuffer.GetRange (offset % sectorSize, size));
}
else
{
- FuseService::ReadVolumeSectors (BufferPtr ((byte *) buf, size), offset);
+ FuseService::ReadVolumeSectors (BufferPtr ((uint8 *) buf, size), offset);
}
}
catch (MissingVolumeData&)
@@ -241,7 +241,7 @@ namespace VeraCrypt
if (strcmp (path, FuseService::GetControlPath()) == 0)
{
shared_ptr <Buffer> infoBuf = FuseService::GetVolumeInfo();
- BufferPtr outBuf ((byte *)buf, size);
+ BufferPtr outBuf ((uint8 *)buf, size);
if (offset >= (off_t) infoBuf->Size())
return 0;
@@ -293,7 +293,7 @@ namespace VeraCrypt
if (strcmp (path, FuseService::GetVolumeImagePath()) == 0)
{
- FuseService::WriteVolumeSectors (BufferPtr ((byte *) buf, size), offset);
+ FuseService::WriteVolumeSectors (BufferPtr ((uint8 *) buf, size), offset);
return size;
}
@@ -302,7 +302,7 @@ namespace VeraCrypt
if (FuseService::AuxDeviceInfoReceived())
return -EACCES;
- FuseService::ReceiveAuxDeviceInfo (ConstBufferPtr ((const byte *)buf, size));
+ FuseService::ReceiveAuxDeviceInfo (ConstBufferPtr ((const uint8 *)buf, size));
return size;
}
}
@@ -584,7 +584,7 @@ namespace VeraCrypt
sigaction (SIGTERM, &action, nullptr);
// Wait for the exit of the main service
- byte buf[1];
+ uint8 buf[1];
if (read (SignalHandlerPipe->GetReadFD(), buf, sizeof (buf))) { } // Errors ignored
_exit (0);
diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c
index b337ad86..96f60cdd 100644
--- a/src/Driver/Ntdriver.c
+++ b/src/Driver/Ntdriver.c
@@ -216,7 +216,7 @@ BOOL IsUefiBoot ()
void GetDriverRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed)
{
LARGE_INTEGER iSeed, iSeed2;
- byte digest[WHIRLPOOL_DIGESTSIZE];
+ uint8 digest[WHIRLPOOL_DIGESTSIZE];
WHIRLPOOL_CTX tctx;
size_t count;
@@ -2070,7 +2070,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
if (opentest->bDetectTCBootLoader || opentest->DetectFilesystem || opentest->bComputeVolumeIDs)
{
- byte *readBuffer = TCalloc (TC_MAX_VOLUME_SECTOR_SIZE);
+ uint8 *readBuffer = TCalloc (TC_MAX_VOLUME_SECTOR_SIZE);
if (!readBuffer)
{
ntStatus = STATUS_INSUFFICIENT_RESOURCES;
@@ -2233,7 +2233,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex
if (NT_SUCCESS (ntStatus))
{
- byte *readBuffer = TCalloc (TC_MAX_VOLUME_SECTOR_SIZE);
+ uint8 *readBuffer = TCalloc (TC_MAX_VOLUME_SECTOR_SIZE);
if (!readBuffer)
{
Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
@@ -3717,7 +3717,7 @@ NTSTATUS ProbeRealDriveSize (PDEVICE_OBJECT driveDeviceObject, LARGE_INTEGER *dr
NTSTATUS status;
LARGE_INTEGER sysLength;
LARGE_INTEGER offset;
- byte *sectorBuffer;
+ uint8 *sectorBuffer;
ULONGLONG startTime;
ULONG sectorSize;
@@ -4919,7 +4919,7 @@ NTSTATUS ZeroUnreadableSectors (PDEVICE_OBJECT deviceObject, LARGE_INTEGER start
NTSTATUS status;
ULONG sectorSize;
ULONG sectorCount;
- byte *sectorBuffer = NULL;
+ uint8 *sectorBuffer = NULL;
*zeroedSectorCount = 0;
@@ -4957,7 +4957,7 @@ err:
}
-NTSTATUS ReadDeviceSkipUnreadableSectors (PDEVICE_OBJECT deviceObject, byte *buffer, LARGE_INTEGER startOffset, ULONG size, uint64 *badSectorCount)
+NTSTATUS ReadDeviceSkipUnreadableSectors (PDEVICE_OBJECT deviceObject, uint8 *buffer, LARGE_INTEGER startOffset, ULONG size, uint64 *badSectorCount)
{
NTSTATUS status;
ULONG sectorSize;
diff --git a/src/Driver/Ntdriver.h b/src/Driver/Ntdriver.h
index 3bbeb457..3995ffdf 100644
--- a/src/Driver/Ntdriver.h
+++ b/src/Driver/Ntdriver.h
@@ -191,7 +191,7 @@ NTSTATUS WriteRegistryConfigFlags (uint32 flags);
BOOL ValidateIOBufferSize (PIRP irp, size_t requiredBufferSize, ValidateIOBufferSizeType type);
NTSTATUS GetDeviceSectorSize (PDEVICE_OBJECT deviceObject, ULONG *bytesPerSector);
NTSTATUS ZeroUnreadableSectors (PDEVICE_OBJECT deviceObject, LARGE_INTEGER startOffset, ULONG size, uint64 *zeroedSectorCount);
-NTSTATUS ReadDeviceSkipUnreadableSectors (PDEVICE_OBJECT deviceObject, byte *buffer, LARGE_INTEGER startOffset, ULONG size, uint64 *badSectorCount);
+NTSTATUS ReadDeviceSkipUnreadableSectors (PDEVICE_OBJECT deviceObject, uint8 *buffer, LARGE_INTEGER startOffset, ULONG size, uint64 *badSectorCount);
BOOL IsVolumeAccessibleByCurrentUser (PEXTENSION volumeDeviceExtension);
void GetElapsedTimeInit (LARGE_INTEGER *lastPerfCounter);
int64 GetElapsedTime (LARGE_INTEGER *lastPerfCounter);
diff --git a/src/Driver/Ntvol.c b/src/Driver/Ntvol.c
index 444468c5..c26fcebf 100644
--- a/src/Driver/Ntvol.c
+++ b/src/Driver/Ntvol.c
@@ -98,7 +98,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject,
LARGE_INTEGER diskLengthInfo;
DISK_GEOMETRY_EX dg;
STORAGE_PROPERTY_QUERY storagePropertyQuery = {0};
- byte* dgBuffer;
+ uint8* dgBuffer;
STORAGE_DEVICE_NUMBER storageDeviceNumber;
ntStatus = IoGetDeviceObjectPointer (&FullFileName,
diff --git a/src/ExpandVolume/ExpandVolume.c b/src/ExpandVolume/ExpandVolume.c
index 712d23a3..d9019ada 100644
--- a/src/ExpandVolume/ExpandVolume.c
+++ b/src/ExpandVolume/ExpandVolume.c
@@ -518,7 +518,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
BOOL bTimeStampValid = FALSE;
LARGE_INTEGER headerOffset;
BOOL backupHeader;
- byte *wipeBuffer = NULL;
+ uint8 *wipeBuffer = NULL;
uint32 workChunkSize = TC_VOLUME_HEADER_GROUP_SIZE;
#ifdef _WIN64
CRYPTO_INFO tmpCI;
@@ -1023,9 +1023,9 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
/* wipe old backup header */
if ( !cryptoInfo->LegacyVolume )
{
- byte wipeRandChars [TC_WIPE_RAND_CHAR_COUNT];
- byte wipeRandCharsUpdate [TC_WIPE_RAND_CHAR_COUNT];
- byte wipePass;
+ uint8 wipeRandChars [TC_WIPE_RAND_CHAR_COUNT];
+ uint8 wipeRandCharsUpdate [TC_WIPE_RAND_CHAR_COUNT];
+ uint8 wipePass;
UINT64_STRUCT unitNo;
LARGE_INTEGER offset;
WipeAlgorithmId wipeAlgorithm = TC_WIPE_35_GUTMANN;
@@ -1040,7 +1040,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas
DebugAddProgressDlgStatus(hwndDlg, GetString("EXPANDER_WIPING_OLD_HEADER"));
- wipeBuffer = (byte *) TCalloc (workChunkSize);
+ wipeBuffer = (uint8 *) TCalloc (workChunkSize);
if (!wipeBuffer)
{
nStatus = ERR_OUTOFMEMORY;
diff --git a/src/ExpandVolume/InitDataArea.c b/src/ExpandVolume/InitDataArea.c
index 709f44b9..7237754a 100644
--- a/src/ExpandVolume/InitDataArea.c
+++ b/src/ExpandVolume/InitDataArea.c
@@ -216,7 +216,7 @@ static volatile BOOL WriteThreadRunning;
static volatile BOOL WriteThreadExitRequested;
static HANDLE WriteThreadHandle;
-static byte *WriteThreadBuffer;
+static uint8 *WriteThreadBuffer;
static HANDLE WriteBufferEmptyEvent;
static HANDLE WriteBufferFullEvent;
diff --git a/src/Format/InPlace.c b/src/Format/InPlace.c
index b1483631..361b8aeb 100644
--- a/src/Format/InPlace.c
+++ b/src/Format/InPlace.c
@@ -600,7 +600,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
}
// Write the backup header to the partition
- if (!WriteEffectiveVolumeHeader (TRUE, dev, (byte *) header))
+ if (!WriteEffectiveVolumeHeader (TRUE, dev, (uint8 *) header))
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -646,7 +646,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol
}
// Write the fake hidden backup header to the partition
- if (!WriteEffectiveVolumeHeader (TRUE, dev, (byte *) header))
+ if (!WriteEffectiveVolumeHeader (TRUE, dev, (uint8 *) header))
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -754,9 +754,9 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
PCRYPTO_INFO masterCryptoInfo = NULL, headerCryptoInfo = NULL, tmpCryptoInfo = NULL;
UINT64_STRUCT unitNo;
char *buf = NULL, *header = NULL;
- byte *wipeBuffer = NULL;
- byte wipeRandChars [TC_WIPE_RAND_CHAR_COUNT];
- byte wipeRandCharsUpdate [TC_WIPE_RAND_CHAR_COUNT];
+ uint8 *wipeBuffer = NULL;
+ uint8 wipeRandChars [TC_WIPE_RAND_CHAR_COUNT];
+ uint8 wipeRandCharsUpdate [TC_WIPE_RAND_CHAR_COUNT];
WCHAR dosDev[TC_MAX_PATH] = {0};
WCHAR devName[MAX_PATH] = {0};
WCHAR deviceName[MAX_PATH];
@@ -801,7 +801,7 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
if (wipeAlgorithm != TC_WIPE_NONE)
{
- wipeBuffer = (byte *) TCalloc (TC_MAX_NONSYS_INPLACE_ENC_WORK_CHUNK_SIZE);
+ wipeBuffer = (uint8 *) TCalloc (TC_MAX_NONSYS_INPLACE_ENC_WORK_CHUNK_SIZE);
if (!wipeBuffer)
{
nStatus = ERR_OUTOFMEMORY;
@@ -974,14 +974,14 @@ inplace_enc_read:
// Encrypt the plaintext in RAM
- EncryptDataUnits ((byte *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo);
+ EncryptDataUnits ((uint8 *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo);
// If enabled, wipe the area to which we will write the ciphertext
if (wipeAlgorithm != TC_WIPE_NONE)
{
- byte wipePass;
+ uint8 wipePass;
int wipePassCount = GetWipePassCount (wipeAlgorithm);
if (wipePassCount <= 0)
@@ -1016,7 +1016,7 @@ inplace_enc_read:
// Undo failed write operation
if (workChunkSize > TC_VOLUME_DATA_OFFSET && MoveFilePointer (dev, offset))
{
- DecryptDataUnits ((byte *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo);
+ DecryptDataUnits ((uint8 *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo);
WriteFile (dev, buf + TC_VOLUME_DATA_OFFSET, workChunkSize - TC_VOLUME_DATA_OFFSET, &n, NULL);
}
@@ -1048,7 +1048,7 @@ inplace_enc_read:
// Undo failed write operation
if (workChunkSize > TC_VOLUME_DATA_OFFSET && MoveFilePointer (dev, offset))
{
- DecryptDataUnits ((byte *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo);
+ DecryptDataUnits ((uint8 *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo);
WriteFile (dev, buf + TC_VOLUME_DATA_OFFSET, workChunkSize - TC_VOLUME_DATA_OFFSET, &n, NULL);
}
@@ -1149,7 +1149,7 @@ inplace_enc_read:
offset.QuadPart = TC_VOLUME_HEADER_OFFSET;
if (MoveFilePointer (dev, offset) == 0
- || !WriteEffectiveVolumeHeader (TRUE, dev, (byte *) header))
+ || !WriteEffectiveVolumeHeader (TRUE, dev, (uint8 *) header))
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -1208,7 +1208,7 @@ inplace_enc_read:
offset.QuadPart += TC_HIDDEN_VOLUME_HEADER_OFFSET;
if (MoveFilePointer (dev, offset) == 0
- || !WriteEffectiveVolumeHeader (TRUE, dev, (byte *) header))
+ || !WriteEffectiveVolumeHeader (TRUE, dev, (uint8 *) header))
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -1316,7 +1316,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
PCRYPTO_INFO masterCryptoInfo = NULL, headerCryptoInfo = NULL;
UINT64_STRUCT unitNo;
char *buf = NULL;
- byte *tmpSectorBuf = NULL;
+ uint8 *tmpSectorBuf = NULL;
WCHAR dosDev[TC_MAX_PATH] = {0};
WCHAR devName[MAX_PATH] = {0};
WCHAR deviceName[MAX_PATH];
@@ -1432,7 +1432,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
sectorSize = driveGeometry.BytesPerSector;
- tmpSectorBuf = (byte *) TCalloc (sectorSize);
+ tmpSectorBuf = (uint8 *) TCalloc (sectorSize);
if (!tmpSectorBuf)
{
nStatus = ERR_OUTOFMEMORY;
@@ -1620,7 +1620,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile
// Decrypt the ciphertext in RAM
- DecryptDataUnits ((byte *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo);
+ DecryptDataUnits ((uint8 *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo);
@@ -1843,16 +1843,16 @@ int FastVolumeHeaderUpdate (HANDLE dev, CRYPTO_INFO *headerCryptoInfo, CRYPTO_IN
LARGE_INTEGER offset;
DWORD n;
int nStatus = ERR_SUCCESS;
- byte *header;
+ uint8 *header;
DWORD dwError;
uint32 headerCrc32;
- byte *fieldPos;
+ uint8 *fieldPos;
PCRYPTO_INFO pCryptoInfo = headerCryptoInfo;
#ifdef _WIN64
BOOL bIsRamEncryptionEnabled = IsRamEncryptionEnabled();
#endif
- header = (byte *) TCalloc (TC_VOLUME_HEADER_EFFECTIVE_SIZE);
+ header = (uint8 *) TCalloc (TC_VOLUME_HEADER_EFFECTIVE_SIZE);
if (!header)
return ERR_OUTOFMEMORY;
@@ -1860,7 +1860,7 @@ int FastVolumeHeaderUpdate (HANDLE dev, CRYPTO_INFO *headerCryptoInfo, CRYPTO_IN
VirtualLock (header, TC_VOLUME_HEADER_EFFECTIVE_SIZE);
- fieldPos = (byte *) header + TC_HEADER_OFFSET_ENCRYPTED_AREA_START;
+ fieldPos = (uint8 *) header + TC_HEADER_OFFSET_ENCRYPTED_AREA_START;
offset.QuadPart = deviceSize - TC_VOLUME_HEADER_GROUP_SIZE;
@@ -1902,12 +1902,12 @@ int FastVolumeHeaderUpdate (HANDLE dev, CRYPTO_INFO *headerCryptoInfo, CRYPTO_IN
// were decrypted in place, it would be possible to mount them partially encrypted and it wouldn't be possible
// to resume interrupted decryption after the wizard exits.
masterCryptoInfo->HeaderFlags |= TC_HEADER_FLAG_NONSYS_INPLACE_ENC;
- fieldPos = (byte *) header + TC_HEADER_OFFSET_FLAGS;
+ fieldPos = (uint8 *) header + TC_HEADER_OFFSET_FLAGS;
mputLong (fieldPos, (masterCryptoInfo->HeaderFlags));
headerCrc32 = GetCrc32 (header + TC_HEADER_OFFSET_MAGIC, TC_HEADER_OFFSET_HEADER_CRC - TC_HEADER_OFFSET_MAGIC);
- fieldPos = (byte *) header + TC_HEADER_OFFSET_HEADER_CRC;
+ fieldPos = (uint8 *) header + TC_HEADER_OFFSET_HEADER_CRC;
mputLong (fieldPos, headerCrc32);
EncryptBuffer (header + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, pCryptoInfo);
@@ -2239,12 +2239,12 @@ int ZeroUnreadableSectors (HANDLE dev, LARGE_INTEGER startOffset, int64 size, in
DWORD n;
int64 sectorCount;
LARGE_INTEGER workOffset;
- byte *sectorBuffer = NULL;
+ uint8 *sectorBuffer = NULL;
DWORD dwError;
workOffset.QuadPart = startOffset.QuadPart;
- sectorBuffer = (byte *) TCalloc (sectorSize);
+ sectorBuffer = (uint8 *) TCalloc (sectorSize);
if (!sectorBuffer)
return ERR_OUTOFMEMORY;
@@ -2315,7 +2315,7 @@ static int OpenBackupHeader (HANDLE dev, const wchar_t *devicePath, Password *pa
offset.QuadPart = deviceSize - TC_VOLUME_HEADER_GROUP_SIZE;
if (MoveFilePointer (dev, offset) == 0
- || !ReadEffectiveVolumeHeader (TRUE, dev, (byte *) header, &n) || n < TC_VOLUME_HEADER_EFFECTIVE_SIZE)
+ || !ReadEffectiveVolumeHeader (TRUE, dev, (uint8 *) header, &n) || n < TC_VOLUME_HEADER_EFFECTIVE_SIZE)
{
nStatus = ERR_OS_ERROR;
goto closing_seq;
@@ -2347,7 +2347,7 @@ closing_seq:
static BOOL GetFreeClusterBeforeThreshold (HANDLE volumeHandle, int64 *freeCluster, int64 clusterThreshold)
{
const int bitmapSize = 65536;
- byte bitmapBuffer[bitmapSize + sizeof (VOLUME_BITMAP_BUFFER)];
+ uint8 bitmapBuffer[bitmapSize + sizeof (VOLUME_BITMAP_BUFFER)];
VOLUME_BITMAP_BUFFER *bitmap = (VOLUME_BITMAP_BUFFER *) bitmapBuffer;
STARTING_LCN_INPUT_BUFFER startLcn;
startLcn.StartingLcn.QuadPart = 0;
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp
index 17d7c147..1b4a0c1b 100644
--- a/src/Main/CommandLineInterface.cpp
+++ b/src/Main/CommandLineInterface.cpp
@@ -834,7 +834,7 @@ namespace VeraCrypt
if (wxCONV_FAILED == ulen)
throw PasswordUTF8Invalid (SRC_POS);
SecureBuffer passwordBuf(ulen);
- ulen = utf8.FromWChar ((char*) (byte*) passwordBuf, ulen, str, charCount);
+ ulen = utf8.FromWChar ((char*) (uint8*) passwordBuf, ulen, str, charCount);
if (wxCONV_FAILED == ulen)
throw PasswordUTF8Invalid (SRC_POS);
if (ulen > maxUtf8Len)
@@ -845,7 +845,7 @@ namespace VeraCrypt
throw PasswordUTF8TooLong (SRC_POS);
}
- ConstBufferPtr utf8Buffer ((byte*) passwordBuf, ulen);
+ ConstBufferPtr utf8Buffer ((uint8*) passwordBuf, ulen);
return shared_ptr<SecureBuffer>(new SecureBuffer (utf8Buffer));
}
else
diff --git a/src/Main/Forms/BenchmarkDialog.cpp b/src/Main/Forms/BenchmarkDialog.cpp
index 47f00610..6e2cff64 100644
--- a/src/Main/Forms/BenchmarkDialog.cpp
+++ b/src/Main/Forms/BenchmarkDialog.cpp
@@ -281,7 +281,7 @@ namespace VeraCrypt
const char *tmp_salt = {"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF"};
unsigned long pim;
Pkcs5KdfList prfList = Pkcs5Kdf::GetAvailableAlgorithms ();
- VolumePassword password ((const byte*) "passphrase-1234567890", 21);
+ VolumePassword password ((const uint8*) "passphrase-1234567890", 21);
memcpy (&pim, buffer.Ptr (), sizeof (unsigned long));
memcpy (salt.Ptr(), tmp_salt, 64);
diff --git a/src/Main/Forms/EncryptionTestDialog.cpp b/src/Main/Forms/EncryptionTestDialog.cpp
index a85bbc94..af3f9833 100644
--- a/src/Main/Forms/EncryptionTestDialog.cpp
+++ b/src/Main/Forms/EncryptionTestDialog.cpp
@@ -141,7 +141,7 @@ namespace VeraCrypt
void EncryptionTestDialog::GetTextCtrlData (wxTextCtrl *textCtrl, Buffer &buffer) const
{
- vector <byte> data;
+ vector <uint8> data;
string dataStr = StringConverter::ToSingle (wstring (textCtrl->GetValue()));
for (size_t i = 0; i < dataStr.size() / 2; ++i)
@@ -153,7 +153,7 @@ namespace VeraCrypt
throw StringConversionFailed (SRC_POS);
}
- data.push_back ((byte) dataByte);
+ data.push_back ((uint8) dataByte);
}
if (data.empty())
diff --git a/src/Main/Forms/KeyfileGeneratorDialog.cpp b/src/Main/Forms/KeyfileGeneratorDialog.cpp
index 2d729ccf..85443f45 100644
--- a/src/Main/Forms/KeyfileGeneratorDialog.cpp
+++ b/src/Main/Forms/KeyfileGeneratorDialog.cpp
@@ -164,12 +164,12 @@ namespace VeraCrypt
{
event.Skip();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&event), sizeof (event)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&event), sizeof (event)));
long coord = event.GetX();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
coord = event.GetY();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
if (ShowRandomPoolCheckBox->IsChecked())
ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24));
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index 07b876ac..6355f139 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -1437,7 +1437,7 @@ namespace VeraCrypt
#if defined(TC_UNIX) && !defined(TC_MACOSX)
try
{
- byte buf[128];
+ uint8 buf[128];
if (read (ShowRequestFifo, buf, sizeof (buf)) > 0 && Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
}
diff --git a/src/Main/Forms/RandomPoolEnrichmentDialog.cpp b/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
index e5ef160b..b48d5af6 100644
--- a/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
+++ b/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
@@ -63,12 +63,12 @@ namespace VeraCrypt
{
event.Skip();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&event), sizeof (event)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&event), sizeof (event)));
long coord = event.GetX();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
coord = event.GetY();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
if (ShowRandomPoolCheckBox->IsChecked())
ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24));
diff --git a/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp b/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
index 8f51cfa8..bbbeff74 100644
--- a/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
+++ b/src/Main/Forms/SecurityTokenKeyfilesDialog.cpp
@@ -103,7 +103,7 @@ namespace VeraCrypt
{
wxBusyCursor busy;
- vector <byte> keyfileData;
+ vector <uint8> keyfileData;
keyfile->GetKeyfileData (keyfileData);
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
@@ -141,7 +141,7 @@ namespace VeraCrypt
if (keyfile.Length() > 0)
{
- vector <byte> keyfileData (keyfile.Length());
+ vector <uint8> keyfileData (keyfile.Length());
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
keyfile.ReadCompleteBuffer (keyfileDataBuf);
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index 0eae11d6..3f09e39f 100644
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -390,12 +390,12 @@ namespace VeraCrypt
event.Skip();
if (!IsWorkInProgress() && RandomNumberGenerator::IsRunning())
{
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&event), sizeof (event)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&event), sizeof (event)));
long coord = event.GetX();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
coord = event.GetY();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&coord), sizeof (coord)));
VolumeCreationProgressWizardPage *page = dynamic_cast <VolumeCreationProgressWizardPage *> (GetCurrentPage());
if (page)
@@ -442,7 +442,7 @@ namespace VeraCrypt
if (!IsWorkInProgress())
{
wxLongLong time = wxGetLocalTimeMillis();
- RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&time), sizeof (time)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <uint8 *> (&time), sizeof (time)));
}
}
diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp
index 56804a49..0555f339 100644
--- a/src/Main/Forms/VolumePasswordPanel.cpp
+++ b/src/Main/Forms/VolumePasswordPanel.cpp
@@ -214,7 +214,7 @@ namespace VeraCrypt
shared_ptr <VolumePassword> password;
wchar_t passwordBuf[VolumePassword::MaxSize + 1];
size_t maxPasswordLength = (bLegacyPassword || CmdLine->ArgUseLegacyPassword)? VolumePassword::MaxLegacySize: VolumePassword::MaxSize;
- finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <byte *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
+ finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <uint8 *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
#ifdef TC_WINDOWS
int len = GetWindowText (static_cast <HWND> (textCtrl->GetHandle()), passwordBuf, VolumePassword::MaxSize + 1);
diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
index 16db8f83..af2db217 100644
--- a/src/Main/GraphicUserInterface.cpp
+++ b/src/Main/GraphicUserInterface.cpp
@@ -992,7 +992,7 @@ namespace VeraCrypt
int showFifo = open (string (MainFrame::GetShowRequestFifoPath()).c_str(), O_WRONLY | O_NONBLOCK);
throw_sys_if (showFifo == -1);
- byte buf[1] = { 1 };
+ uint8 buf[1] = { 1 };
if (write (showFifo, buf, 1) == 1)
{
close (showFifo);
diff --git a/src/Main/LanguageStrings.cpp b/src/Main/LanguageStrings.cpp
index 0e13ebc7..9a983712 100644
--- a/src/Main/LanguageStrings.cpp
+++ b/src/Main/LanguageStrings.cpp
@@ -43,7 +43,7 @@ namespace VeraCrypt
void LanguageStrings::Init ()
{
- static byte LanguageXml[] =
+ static uint8 LanguageXml[] =
{
# include "Common/Language.xml.h"
, 0
diff --git a/src/Main/Resources.cpp b/src/Main/Resources.cpp
index 18a58181..f00c14f7 100644
--- a/src/Main/Resources.cpp
+++ b/src/Main/Resources.cpp
@@ -40,7 +40,7 @@ namespace VeraCrypt
hResL = LoadResource (NULL, hRes);
throw_sys_if (!hResL);
- const byte *resPtr = (const byte *) LockResource (hResL);
+ const uint8 *resPtr = (const uint8 *) LockResource (hResL);
throw_sys_if (!resPtr);
return ConstBufferPtr (resPtr, SizeofResource (NULL, hRes));
@@ -132,14 +132,14 @@ namespace VeraCrypt
if ( xml.IsFile() ){
File file;
file.Open (xml, File::OpenRead, File::ShareRead);
- vector <byte> keyfileData (file.Length());
+ vector <uint8> keyfileData (file.Length());
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
file.ReadCompleteBuffer (keyfileDataBuf);
file.Close();
string langxml(keyfileData.begin(), keyfileData.end());
return langxml;
}
- static byte LanguageXml[] =
+ static uint8 LanguageXml[] =
{
# include "Common/Language.xml.h"
, 0
@@ -158,7 +158,7 @@ namespace VeraCrypt
strBuf.CopyFrom (res);
return string (reinterpret_cast <char *> (strBuf.Ptr()));
#else
- static byte License[] =
+ static uint8 License[] =
{
# include "License.txt.h"
, 0
@@ -176,7 +176,7 @@ namespace VeraCrypt
#ifdef TC_WINDOWS
return wxBitmap (L"IDB_DRIVE_ICON", wxBITMAP_TYPE_BMP_RESOURCE).ConvertToImage().Resize (wxSize (16, 12), wxPoint (0, 0));
#else
- static const byte DriveIcon[] =
+ static const uint8 DriveIcon[] =
{
# include "Mount/Drive_icon_96dpi.bmp.h"
};
@@ -192,7 +192,7 @@ namespace VeraCrypt
wxImage image = wxBitmap (L"IDB_DRIVE_ICON_MASK", wxBITMAP_TYPE_BMP_RESOURCE).ConvertToImage().Resize (wxSize (16, 12), wxPoint (0, 0));
return wxBitmap (image.ConvertToMono (0, 0, 0), 1);
#else
- static const byte DriveIconMask[] =
+ static const uint8 DriveIconMask[] =
{
# include "Mount/Drive_icon_mask_96dpi.bmp.h"
};
@@ -215,7 +215,7 @@ namespace VeraCrypt
#ifdef TC_WINDOWS
return wxBitmap (L"IDB_LOGO", wxBITMAP_TYPE_BMP_RESOURCE);
#else
- static const byte Logo[] =
+ static const uint8 Logo[] =
{
# include "Mount/Logo_96dpi.bmp.h"
};
@@ -230,7 +230,7 @@ namespace VeraCrypt
#ifdef TC_WINDOWS
return wxBitmap (L"IDB_TEXTUAL_LOGO", wxBITMAP_TYPE_BMP_RESOURCE);
#else
- static const byte Logo[] =
+ static const uint8 Logo[] =
{
# include "Common/Textual_logo_96dpi.bmp.h"
};
@@ -255,7 +255,7 @@ namespace VeraCrypt
#ifdef TC_WINDOWS
return wxBitmap (L"IDB_VOLUME_WIZARD_BITMAP", wxBITMAP_TYPE_BMP_RESOURCE);
#else
- static const byte VolumeWizardIcon[] =
+ static const uint8 VolumeWizardIcon[] =
{
# include "Format/VeraCrypt_Wizard.bmp.h"
};
diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
index 94919296..3346ee3e 100644
--- a/src/Main/TextUserInterface.cpp
+++ b/src/Main/TextUserInterface.cpp
@@ -100,7 +100,7 @@ namespace VeraCrypt
finally_do ({ TextUserInterface::SetTerminalEcho (true); });
wchar_t passwordBuf[4096];
- finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <byte *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
+ finally_do_arg (BufferPtr, BufferPtr (reinterpret_cast <uint8 *> (passwordBuf), sizeof (passwordBuf)), { finally_arg.Erase(); });
shared_ptr<VolumePassword> password;
@@ -1077,7 +1077,7 @@ namespace VeraCrypt
shared_ptr<TokenKeyfile> tokenKeyfile = Token::getTokenKeyfile(keyfilePath);
- vector <byte> keyfileData;
+ vector <uint8> keyfileData;
tokenKeyfile->GetKeyfileData (keyfileData);
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
@@ -1164,7 +1164,7 @@ namespace VeraCrypt
if (keyfile.Length() > 0)
{
- vector <byte> keyfileData (keyfile.Length());
+ vector <uint8> keyfileData (keyfile.Length());
BufferPtr keyfileDataBuf (&keyfileData.front(), keyfileData.size());
keyfile.ReadCompleteBuffer (keyfileDataBuf);
@@ -1784,7 +1784,7 @@ namespace VeraCrypt
while (randCharsRequired > 0)
{
wstring randStr = AskString();
- RandomNumberGenerator::AddToPool (ConstBufferPtr ((byte *) randStr.c_str(), randStr.size() * sizeof (wchar_t)));
+ RandomNumberGenerator::AddToPool (ConstBufferPtr ((uint8 *) randStr.c_str(), randStr.size() * sizeof (wchar_t)));
randCharsRequired -= randStr.size();
diff --git a/src/Main/Xml.cpp b/src/Main/Xml.cpp
index 6d0faa18..bf286a55 100644
--- a/src/Main/Xml.cpp
+++ b/src/Main/Xml.cpp
@@ -108,7 +108,7 @@ namespace VeraCrypt
*TextOutStream << L"</VeraCrypt>" << endl;
wxStreamBuffer *buf = MemOutStream->GetOutputStreamBuffer();
- OutFile.Write (ConstBufferPtr (reinterpret_cast <byte *> (buf->GetBufferStart()), buf->GetBufferSize()));
+ OutFile.Write (ConstBufferPtr (reinterpret_cast <uint8 *> (buf->GetBufferStart()), buf->GetBufferSize()));
OutFile.Close();
TextOutStream.reset();
diff --git a/src/Mount/Favorites.cpp b/src/Mount/Favorites.cpp
index 93b7a5a6..de4d5a08 100644
--- a/src/Mount/Favorites.cpp
+++ b/src/Mount/Favorites.cpp
@@ -617,7 +617,7 @@ namespace VeraCrypt
XmlGetAttributeText (xml, "ID", label, sizeof (label));
if (strlen (label) == (2*VOLUME_ID_SIZE))
{
- std::vector<byte> arr;
+ std::vector<uint8> arr;
if (HexWideStringToArray (Utf8StringToWide (label).c_str(), arr) && arr.size() == VOLUME_ID_SIZE)
{
memcpy (favorite.VolumeID, &arr[0], VOLUME_ID_SIZE);
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 76de34b6..c3898b72 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -10822,8 +10822,8 @@ int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, const wchar_t *
OpenVolumeContext hiddenVolume;
Password hiddenVolPassword;
int hiddenVolPkcs5 = 0, hiddenVolPim = 0;
- CRYPTOPP_ALIGN_DATA(16) byte temporaryKey[MASTER_KEYDATA_SIZE];
- CRYPTOPP_ALIGN_DATA(16) byte originalK2[MASTER_KEYDATA_SIZE];
+ CRYPTOPP_ALIGN_DATA(16) uint8 temporaryKey[MASTER_KEYDATA_SIZE];
+ CRYPTOPP_ALIGN_DATA(16) uint8 originalK2[MASTER_KEYDATA_SIZE];
int EffectiveVolumePkcs5 = CmdVolumePkcs5;
int EffectiveVolumePim = CmdVolumePim;
@@ -10969,7 +10969,7 @@ noHidden:
// Backup headers
- byte backup[TC_VOLUME_HEADER_GROUP_SIZE];
+ uint8 backup[TC_VOLUME_HEADER_GROUP_SIZE];
bool legacyVolume = volume.CryptoInfo->LegacyVolume ? true : false;
int backupFileSize = legacyVolume ? TC_VOLUME_HEADER_SIZE_LEGACY * 2 : TC_VOLUME_HEADER_GROUP_SIZE;
@@ -11221,7 +11221,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
goto error;
}
- if (!WriteEffectiveVolumeHeader (volume.IsDevice, volume.HostFileHandle, (byte *) buffer))
+ if (!WriteEffectiveVolumeHeader (volume.IsDevice, volume.HostFileHandle, (uint8 *) buffer))
{
nStatus = ERR_OS_ERROR;
goto error;
@@ -11472,7 +11472,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
goto error;
}
- if (!WriteEffectiveVolumeHeader (bDevice, dev, (byte *) buffer))
+ if (!WriteEffectiveVolumeHeader (bDevice, dev, (uint8 *) buffer))
{
nStatus = ERR_OS_ERROR;
goto error;
@@ -11491,7 +11491,7 @@ int RestoreVolumeHeader (HWND hwndDlg, const wchar_t *lpszVolume)
goto error;
}
- if (!WriteEffectiveVolumeHeader (bDevice, dev, (byte *) buffer))
+ if (!WriteEffectiveVolumeHeader (bDevice, dev, (uint8 *) buffer))
{
nStatus = ERR_OS_ERROR;
goto error;
@@ -11714,7 +11714,7 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
if (BootEncStatus.DriveMounted && !bSystemIsGPT)
{
- byte userConfig;
+ uint8 userConfig;
string customUserMessage;
uint16 bootLoaderVersion;
@@ -12117,7 +12117,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
{
WORD lw = LOWORD (wParam);
static std::string platforminfo;
- static byte currentUserConfig;
+ static uint8 currentUserConfig;
static string currentCustomUserMessage;
switch (msg)
@@ -12137,7 +12137,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
LocalizeDialog (hwndDlg, "IDD_SYSENC_SETTINGS");
uint32 driverConfig = ReadDriverConfigurationFlags();
uint32 serviceConfig = ReadServiceConfigurationFlags();
- byte userConfig;
+ uint8 userConfig;
string customUserMessage;
uint16 bootLoaderVersion = 0;
BOOL bPasswordCacheEnabled = (driverConfig & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD)? TRUE : FALSE;
@@ -12314,7 +12314,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
if (!bSystemIsGPT)
GetDlgItemTextA (hwndDlg, IDC_CUSTOM_BOOT_LOADER_MESSAGE, customUserMessage, sizeof (customUserMessage));
- byte userConfig = currentUserConfig;
+ uint8 userConfig = currentUserConfig;
if (IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_PIM_PROMPT))
userConfig |= TC_BOOT_USER_CFG_FLAG_DISABLE_PIM;
diff --git a/src/Platform/Buffer.cpp b/src/Platform/Buffer.cpp
index 82c2a3f1..5829b1d9 100644
--- a/src/Platform/Buffer.cpp
+++ b/src/Platform/Buffer.cpp
@@ -44,7 +44,7 @@ namespace VeraCrypt
try
{
- DataPtr = static_cast<byte *> ((alignment > 0)? Memory::AllocateAligned (size, alignment) : Memory::Allocate (size));
+ DataPtr = static_cast<uint8 *> ((alignment > 0)? Memory::AllocateAligned (size, alignment) : Memory::Allocate (size));
DataSize = size;
DataAlignment = alignment;
}
diff --git a/src/Platform/Buffer.h b/src/Platform/Buffer.h
index 1150fcf5..a1eb0918 100644
--- a/src/Platform/Buffer.h
+++ b/src/Platform/Buffer.h
@@ -24,20 +24,20 @@ namespace VeraCrypt
public:
ConstBufferPtr ()
: DataPtr (nullptr), DataSize (0) { }
- ConstBufferPtr (const byte *data, size_t size)
+ ConstBufferPtr (const uint8 *data, size_t size)
: DataPtr (data), DataSize (size) { }
virtual ~ConstBufferPtr () { }
- operator const byte * () const { return DataPtr; }
+ operator const uint8 * () const { return DataPtr; }
bool IsDataEqual (const ConstBufferPtr &other) const { return Memory::Compare (DataPtr, DataSize, other.DataPtr, other.DataSize) == 0; }
- const byte *Get () const { return DataPtr; }
+ const uint8 *Get () const { return DataPtr; }
ConstBufferPtr GetRange (size_t offset, size_t size) const;
- void Set (const byte *data, size_t size) { DataPtr = data; DataSize = size; }
+ void Set (const uint8 *data, size_t size) { DataPtr = data; DataSize = size; }
size_t Size () const { return DataSize; }
protected:
- const byte *DataPtr;
+ const uint8 *DataPtr;
size_t DataSize;
};
@@ -47,23 +47,23 @@ namespace VeraCrypt
public:
BufferPtr ()
: DataPtr (nullptr), DataSize (0) { }
- BufferPtr (byte *data, size_t size)
+ BufferPtr (uint8 *data, size_t size)
: DataPtr (data), DataSize (size) { }
virtual ~BufferPtr () { }
- operator byte * () const { return DataPtr; }
+ operator uint8 * () const { return DataPtr; }
void CopyFrom (const ConstBufferPtr &bufferPtr) const;
void Erase () const { Zero(); }
- byte *Get () const { return DataPtr; }
+ uint8 *Get () const { return DataPtr; }
BufferPtr GetRange (size_t offset, size_t size) const;
- void Set (byte *data, size_t size) { DataPtr = data; DataSize = size; }
+ void Set (uint8 *data, size_t size) { DataPtr = data; DataSize = size; }
size_t Size () const { return DataSize; }
void Zero () const { Memory::Zero (DataPtr, DataSize); }
operator ConstBufferPtr () const { return ConstBufferPtr (DataPtr, DataSize); }
protected:
- byte *DataPtr;
+ uint8 *DataPtr;
size_t DataSize;
};
@@ -77,7 +77,7 @@ namespace VeraCrypt
virtual void Allocate (size_t size, size_t alignment = 0);
virtual void CopyFrom (const ConstBufferPtr &bufferPtr, size_t alignment = 0);
- virtual byte *Ptr () const { return DataPtr; }
+ virtual uint8 *Ptr () const { return DataPtr; }
virtual void Erase ();
virtual void Free ();
virtual BufferPtr GetRange (size_t offset, size_t size) const;
@@ -86,12 +86,12 @@ namespace VeraCrypt
virtual bool IsAllocated () const { return DataSize != 0; }
virtual void Zero ();
- virtual operator byte * () const { return DataPtr; }
+ virtual operator uint8 * () const { return DataPtr; }
virtual operator BufferPtr () const { return BufferPtr (DataPtr, DataSize); }
virtual operator ConstBufferPtr () const { return ConstBufferPtr (DataPtr, DataSize); }
protected:
- byte *DataPtr;
+ uint8 *DataPtr;
size_t DataSize;
size_t DataAlignment;
diff --git a/src/Platform/FileStream.h b/src/Platform/FileStream.h
index 0ef40862..66df1999 100644
--- a/src/Platform/FileStream.h
+++ b/src/Platform/FileStream.h
@@ -43,7 +43,7 @@ namespace VeraCrypt
vector <char> buffer (4096);
uint64 len;
- while ((len = DataFile->Read (BufferPtr (reinterpret_cast <byte *> (&buffer[0]), buffer.size()))) > 0)
+ while ((len = DataFile->Read (BufferPtr (reinterpret_cast <uint8 *> (&buffer[0]), buffer.size()))) > 0)
str.insert (str.end(), buffer.begin(), buffer.begin() + static_cast <int> (len));
return str;
diff --git a/src/Platform/Memory.h b/src/Platform/Memory.h
index e0d4bfe3..b124022f 100644
--- a/src/Platform/Memory.h
+++ b/src/Platform/Memory.h
@@ -85,7 +85,7 @@ namespace VeraCrypt
class Endian
{
public:
- static byte Big (const byte &x)
+ static uint8 Big (const uint8 &x)
{
return x;
}
@@ -117,7 +117,7 @@ namespace VeraCrypt
#endif
}
- static byte Little (const byte &x)
+ static uint8 Little (const uint8 &x)
{
return x;
}
@@ -157,22 +157,22 @@ namespace VeraCrypt
static uint32 MirrorBytes (const uint32 &x)
{
- uint32 n = (byte) x;
- n <<= 8; n |= (byte) (x >> 8);
- n <<= 8; n |= (byte) (x >> 16);
- return (n << 8) | (byte) (x >> 24);
+ uint32 n = (uint8) x;
+ n <<= 8; n |= (uint8) (x >> 8);
+ n <<= 8; n |= (uint8) (x >> 16);
+ return (n << 8) | (uint8) (x >> 24);
}
static uint64 MirrorBytes (const uint64 &x)
{
- uint64 n = (byte) x;
- n <<= 8; n |= (byte) (x >> 8);
- n <<= 8; n |= (byte) (x >> 16);
- n <<= 8; n |= (byte) (x >> 24);
- n <<= 8; n |= (byte) (x >> 32);
- n <<= 8; n |= (byte) (x >> 40);
- n <<= 8; n |= (byte) (x >> 48);
- return (n << 8) | (byte) (x >> 56);
+ uint64 n = (uint8) x;
+ n <<= 8; n |= (uint8) (x >> 8);
+ n <<= 8; n |= (uint8) (x >> 16);
+ n <<= 8; n |= (uint8) (x >> 24);
+ n <<= 8; n |= (uint8) (x >> 32);
+ n <<= 8; n |= (uint8) (x >> 40);
+ n <<= 8; n |= (uint8) (x >> 48);
+ return (n << 8) | (uint8) (x >> 56);
}
};
}
diff --git a/src/Platform/MemoryStream.cpp b/src/Platform/MemoryStream.cpp
index 8bf229fe..1bd090b9 100644
--- a/src/Platform/MemoryStream.cpp
+++ b/src/Platform/MemoryStream.cpp
@@ -18,7 +18,7 @@ namespace VeraCrypt
MemoryStream::MemoryStream (const ConstBufferPtr &data) :
ReadPosition (0)
{
- Data = vector <byte> (data.Size());
+ Data = vector <uint8> (data.Size());
BufferPtr (&Data[0], Data.size()).CopyFrom (data);
}
diff --git a/src/Platform/MemoryStream.h b/src/Platform/MemoryStream.h
index 3df0bd13..068e6d6e 100644
--- a/src/Platform/MemoryStream.h
+++ b/src/Platform/MemoryStream.h
@@ -32,7 +32,7 @@ namespace VeraCrypt
virtual void Write (const ConstBufferPtr &data);
protected:
- vector <byte> Data;
+ vector <uint8> Data;
size_t ReadPosition;
};
}
diff --git a/src/Platform/PlatformBase.h b/src/Platform/PlatformBase.h
index 22022dc7..e378704c 100644
--- a/src/Platform/PlatformBase.h
+++ b/src/Platform/PlatformBase.h
@@ -43,7 +43,7 @@ namespace VeraCrypt
typedef __int16 int16;
typedef __int32 int32;
typedef __int64 int64;
- typedef unsigned __int8 byte;
+ typedef unsigned __int8 uint8;
typedef unsigned __int16 uint16;
typedef unsigned __int32 uint32;
typedef unsigned __int64 uint64;
@@ -53,7 +53,7 @@ namespace VeraCrypt
typedef int16_t int16;
typedef int32_t int32;
typedef int64_t int64;
- typedef uint8_t byte;
+ typedef uint8_t uint8;
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef uint64_t uint64;
diff --git a/src/Platform/PlatformTest.cpp b/src/Platform/PlatformTest.cpp
index 7362d6bf..9a3faae2 100644
--- a/src/Platform/PlatformTest.cpp
+++ b/src/Platform/PlatformTest.cpp
@@ -76,7 +76,7 @@ namespace VeraCrypt
Buffer buffer (10);
for (size_t i = 0; i < buffer.Size(); i++)
- buffer[i] = (byte) i;
+ buffer[i] = (uint8) i;
ser.Serialize ("int32", i32);
ser.Serialize ("int64", i64);
@@ -141,7 +141,7 @@ namespace VeraCrypt
Buffer dbuffer (10);
ser.Deserialize ("buffer", buffer);
for (size_t i = 0; i < buffer.Size(); i++)
- if (buffer[i] != (byte) i)
+ if (buffer[i] != (uint8) i)
throw TestFailed (SRC_POS);
shared_ptr <ExecutedProcessFailed> dex = Serializable::DeserializeNew <ExecutedProcessFailed> (stream);
@@ -238,7 +238,7 @@ namespace VeraCrypt
bool PlatformTest::TestAll ()
{
// Integer types
- if (sizeof (byte) != 1 || sizeof (int8) != 1 || sizeof (__int8) != 1) throw TestFailed (SRC_POS);
+ if (sizeof (uint8) != 1 || sizeof (int8) != 1 || sizeof (__int8) != 1) throw TestFailed (SRC_POS);
if (sizeof (uint16) != 2 || sizeof (int16) != 2 || sizeof (__int16) != 2) throw TestFailed (SRC_POS);
if (sizeof (uint32) != 4 || sizeof (int32) != 4 || sizeof (__int32) != 4) throw TestFailed (SRC_POS);
if (sizeof (uint64) != 8 || sizeof (int64) != 8) throw TestFailed (SRC_POS);
diff --git a/src/Platform/Serializer.cpp b/src/Platform/Serializer.cpp
index b69fe891..6f428b15 100644
--- a/src/Platform/Serializer.cpp
+++ b/src/Platform/Serializer.cpp
@@ -21,13 +21,13 @@ namespace VeraCrypt
T Serializer::Deserialize ()
{
uint64 size;
- DataStream->ReadCompleteBuffer (BufferPtr ((byte *) &size, sizeof (size)));
+ DataStream->ReadCompleteBuffer (BufferPtr ((uint8 *) &size, sizeof (size)));
if (Endian::Big (size) != sizeof (T))
throw ParameterIncorrect (SRC_POS);
T data;
- DataStream->ReadCompleteBuffer (BufferPtr ((byte *) &data, sizeof (data)));
+ DataStream->ReadCompleteBuffer (BufferPtr ((uint8 *) &data, sizeof (data)));
return Endian::Big (data);
}
@@ -35,13 +35,13 @@ namespace VeraCrypt
void Serializer::Deserialize (const string &name, bool &data)
{
ValidateName (name);
- data = Deserialize <byte> () == 1;
+ data = Deserialize <uint8> () == 1;
}
- void Serializer::Deserialize (const string &name, byte &data)
+ void Serializer::Deserialize (const string &name, uint8 &data)
{
ValidateName (name);
- data = Deserialize <byte> ();
+ data = Deserialize <uint8> ();
}
void Serializer::Deserialize (const string &name, int32 &data)
@@ -127,7 +127,7 @@ namespace VeraCrypt
uint64 size = Deserialize <uint64> ();
vector <char> data ((size_t) size);
- DataStream->ReadCompleteBuffer (BufferPtr ((byte *) &data[0], (size_t) size));
+ DataStream->ReadCompleteBuffer (BufferPtr ((uint8 *) &data[0], (size_t) size));
return string (&data[0]);
}
@@ -155,7 +155,7 @@ namespace VeraCrypt
uint64 size = Deserialize <uint64> ();
vector <wchar_t> data ((size_t) size / sizeof (wchar_t));
- DataStream->ReadCompleteBuffer (BufferPtr ((byte *) &data[0], (size_t) size));
+ DataStream->ReadCompleteBuffer (BufferPtr ((uint8 *) &data[0], (size_t) size));
return wstring (&data[0]);
}
@@ -182,20 +182,20 @@ namespace VeraCrypt
void Serializer::Serialize (T data)
{
uint64 size = Endian::Big (uint64 (sizeof (data)));
- DataStream->Write (ConstBufferPtr ((byte *) &size, sizeof (size)));
+ DataStream->Write (ConstBufferPtr ((uint8 *) &size, sizeof (size)));
data = Endian::Big (data);
- DataStream->Write (ConstBufferPtr ((byte *) &data, sizeof (data)));
+ DataStream->Write (ConstBufferPtr ((uint8 *) &data, sizeof (data)));
}
void Serializer::Serialize (const string &name, bool data)
{
SerializeString (name);
- byte d = data ? 1 : 0;
+ uint8 d = data ? 1 : 0;
Serialize (d);
}
- void Serializer::Serialize (const string &name, byte data)
+ void Serializer::Serialize (const string &name, uint8 data)
{
SerializeString (name);
Serialize (data);
@@ -282,14 +282,14 @@ namespace VeraCrypt
void Serializer::SerializeString (const string &data)
{
Serialize ((uint64) data.size() + 1);
- DataStream->Write (ConstBufferPtr ((byte *) (data.data() ? data.data() : data.c_str()), data.size() + 1));
+ DataStream->Write (ConstBufferPtr ((uint8 *) (data.data() ? data.data() : data.c_str()), data.size() + 1));
}
void Serializer::SerializeWString (const wstring &data)
{
uint64 size = (data.size() + 1) * sizeof (wchar_t);
Serialize (size);
- DataStream->Write (ConstBufferPtr ((byte *) (data.data() ? data.data() : data.c_str()), (size_t) size));
+ DataStream->Write (ConstBufferPtr ((uint8 *) (data.data() ? data.data() : data.c_str()), (size_t) size));
}
void Serializer::ValidateName (const string &name)
diff --git a/src/Platform/Serializer.h b/src/Platform/Serializer.h
index c2dac324..3617a83b 100644
--- a/src/Platform/Serializer.h
+++ b/src/Platform/Serializer.h
@@ -27,7 +27,7 @@ namespace VeraCrypt
virtual ~Serializer () { }
void Deserialize (const string &name, bool &data);
- void Deserialize (const string &name, byte &data);
+ void Deserialize (const string &name, uint8 &data);
void Deserialize (const string &name, int32 &data);
void Deserialize (const string &name, int64 &data);
void Deserialize (const string &name, uint32 &data);
@@ -45,7 +45,7 @@ namespace VeraCrypt
wstring DeserializeWString (const string &name);
list <wstring> DeserializeWStringList (const string &name);
void Serialize (const string &name, bool data);
- void Serialize (const string &name, byte data);
+ void Serialize (const string &name, uint8 data);
void Serialize (const string &name, const char *data);
void Serialize (const string &name, int32 data);
void Serialize (const string &name, int64 data);
diff --git a/src/Platform/StringConverter.cpp b/src/Platform/StringConverter.cpp
index e1a6df98..7b3134ee 100644
--- a/src/Platform/StringConverter.cpp
+++ b/src/Platform/StringConverter.cpp
@@ -385,9 +385,9 @@ namespace VeraCrypt
}
BufferPtr (
- (byte *) buffer,
+ (uint8 *) buffer,
bufferSize).CopyFrom (
- ConstBufferPtr ((byte *) (wstring (str).c_str()),
+ ConstBufferPtr ((uint8 *) (wstring (str).c_str()),
(str.length() + 1) * sizeof (wchar_t)
)
);
diff --git a/src/Platform/TextReader.cpp b/src/Platform/TextReader.cpp
index 7d6a0c64..bdaf19c2 100644
--- a/src/Platform/TextReader.cpp
+++ b/src/Platform/TextReader.cpp
@@ -26,7 +26,7 @@ namespace VeraCrypt
outputString.erase();
char c;
- while (InputStream->Read (BufferPtr ((byte *) &c, sizeof (c))) == sizeof (c))
+ while (InputStream->Read (BufferPtr ((uint8 *) &c, sizeof (c))) == sizeof (c))
{
if (c == '\r')
continue;
diff --git a/src/Platform/Unix/Process.cpp b/src/Platform/Unix/Process.cpp
index 36b01e6b..46b14a1e 100644
--- a/src/Platform/Unix/Process.cpp
+++ b/src/Platform/Unix/Process.cpp
@@ -174,7 +174,7 @@ namespace VeraCrypt
try
{
- shared_ptr <Stream> stream (new MemoryStream (ConstBufferPtr ((byte *) &exOutput[0], exOutput.size())));
+ shared_ptr <Stream> stream (new MemoryStream (ConstBufferPtr ((uint8 *) &exOutput[0], exOutput.size())));
deserializedObject.reset (Serializable::DeserializeNew (stream));
deserializedException = dynamic_cast <Exception*> (deserializedObject.get());
}
diff --git a/src/Volume/Cipher.cpp b/src/Volume/Cipher.cpp
index d0fb7bd5..de240544 100644
--- a/src/Volume/Cipher.cpp
+++ b/src/Volume/Cipher.cpp
@@ -49,7 +49,7 @@ namespace VeraCrypt
{
}
- void Cipher::DecryptBlock (byte *data) const
+ void Cipher::DecryptBlock (uint8 *data) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -57,7 +57,7 @@ namespace VeraCrypt
Decrypt (data);
}
- void Cipher::DecryptBlocks (byte *data, size_t blockCount) const
+ void Cipher::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -69,7 +69,7 @@ namespace VeraCrypt
}
}
- void Cipher::EncryptBlock (byte *data) const
+ void Cipher::EncryptBlock (uint8 *data) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -77,7 +77,7 @@ namespace VeraCrypt
Encrypt (data);
}
- void Cipher::EncryptBlocks (byte *data, size_t blockCount) const
+ void Cipher::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -130,7 +130,7 @@ namespace VeraCrypt
Initialized = true;
}
- void Cipher::EncryptBlockXTS (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void Cipher::EncryptBlockXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -138,7 +138,7 @@ namespace VeraCrypt
EncryptXTS (data, length, startDataUnitNo);
}
- void Cipher::DecryptBlockXTS (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void Cipher::DecryptBlockXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -155,7 +155,7 @@ namespace VeraCrypt
// AES
- void CipherAES::Decrypt (byte *data) const
+ void CipherAES::Decrypt (uint8 *data) const
{
#ifdef TC_AES_HW_CPU
if (IsHwSupportAvailable())
@@ -165,7 +165,7 @@ namespace VeraCrypt
aes_decrypt (data, data, (aes_decrypt_ctx *) (ScheduledKey.Ptr() + sizeof (aes_encrypt_ctx)));
}
- void CipherAES::DecryptBlocks (byte *data, size_t blockCount) const
+ void CipherAES::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -187,7 +187,7 @@ namespace VeraCrypt
Cipher::DecryptBlocks (data, blockCount);
}
- void CipherAES::Encrypt (byte *data) const
+ void CipherAES::Encrypt (uint8 *data) const
{
#ifdef TC_AES_HW_CPU
if (IsHwSupportAvailable())
@@ -197,7 +197,7 @@ namespace VeraCrypt
aes_encrypt (data, data, (aes_encrypt_ctx *) ScheduledKey.Ptr());
}
- void CipherAES::EncryptBlocks (byte *data, size_t blockCount) const
+ void CipherAES::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -219,17 +219,17 @@ namespace VeraCrypt
Cipher::EncryptBlocks (data, blockCount);
}
#ifdef WOLFCRYPT_BACKEND
- void CipherAES::EncryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void CipherAES::EncryptXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
xts_encrypt (data, data, length, startDataUnitNo, (aes_encrypt_ctx *) ScheduledKey.Ptr());
}
- void CipherAES::DecryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void CipherAES::DecryptXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
xts_decrypt (data, data, length, startDataUnitNo, (aes_decrypt_ctx *) (ScheduledKey.Ptr() + sizeof (aes_encrypt_ctx)));
}
- void CipherAES::SetCipherKeyXTS (const byte *key)
+ void CipherAES::SetCipherKeyXTS (const uint8 *key)
{
if (xts_encrypt_key256 (key, (aes_encrypt_ctx *) ScheduledKey.Ptr()) != EXIT_SUCCESS)
throw CipherInitError (SRC_POS);
@@ -261,7 +261,7 @@ namespace VeraCrypt
#endif
}
- void CipherAES::SetCipherKey (const byte *key)
+ void CipherAES::SetCipherKey (const uint8 *key)
{
if (aes_encrypt_key256 (key, (aes_encrypt_ctx *) ScheduledKey.Ptr()) != EXIT_SUCCESS)
throw CipherInitError (SRC_POS);
@@ -272,12 +272,12 @@ namespace VeraCrypt
#ifndef WOLFCRYPT_BACKEND
// Serpent
- void CipherSerpent::Decrypt (byte *data) const
+ void CipherSerpent::Decrypt (uint8 *data) const
{
serpent_decrypt (data, data, ScheduledKey);
}
- void CipherSerpent::Encrypt (byte *data) const
+ void CipherSerpent::Encrypt (uint8 *data) const
{
serpent_encrypt (data, data, ScheduledKey);
}
@@ -287,12 +287,12 @@ namespace VeraCrypt
return 140*4;
}
- void CipherSerpent::SetCipherKey (const byte *key)
+ void CipherSerpent::SetCipherKey (const uint8 *key)
{
serpent_set_key (key, ScheduledKey);
}
- void CipherSerpent::EncryptBlocks (byte *data, size_t blockCount) const
+ void CipherSerpent::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -308,7 +308,7 @@ namespace VeraCrypt
Cipher::EncryptBlocks (data, blockCount);
}
- void CipherSerpent::DecryptBlocks (byte *data, size_t blockCount) const
+ void CipherSerpent::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -343,12 +343,12 @@ namespace VeraCrypt
// Twofish
- void CipherTwofish::Decrypt (byte *data) const
+ void CipherTwofish::Decrypt (uint8 *data) const
{
twofish_decrypt ((TwofishInstance *) ScheduledKey.Ptr(), (unsigned int *)data, (unsigned int *)data);
}
- void CipherTwofish::Encrypt (byte *data) const
+ void CipherTwofish::Encrypt (uint8 *data) const
{
twofish_encrypt ((TwofishInstance *) ScheduledKey.Ptr(), (unsigned int *)data, (unsigned int *)data);
}
@@ -358,12 +358,12 @@ namespace VeraCrypt
return TWOFISH_KS;
}
- void CipherTwofish::SetCipherKey (const byte *key)
+ void CipherTwofish::SetCipherKey (const uint8 *key)
{
twofish_set_key ((TwofishInstance *) ScheduledKey.Ptr(), (unsigned int *) key);
}
- void CipherTwofish::EncryptBlocks (byte *data, size_t blockCount) const
+ void CipherTwofish::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -375,7 +375,7 @@ namespace VeraCrypt
#endif
}
- void CipherTwofish::DecryptBlocks (byte *data, size_t blockCount) const
+ void CipherTwofish::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -397,12 +397,12 @@ namespace VeraCrypt
}
// Camellia
- void CipherCamellia::Decrypt (byte *data) const
+ void CipherCamellia::Decrypt (uint8 *data) const
{
camellia_decrypt (data, data, ScheduledKey.Ptr());
}
- void CipherCamellia::Encrypt (byte *data) const
+ void CipherCamellia::Encrypt (uint8 *data) const
{
camellia_encrypt (data, data, ScheduledKey.Ptr());
}
@@ -412,12 +412,12 @@ namespace VeraCrypt
return CAMELLIA_KS;
}
- void CipherCamellia::SetCipherKey (const byte *key)
+ void CipherCamellia::SetCipherKey (const uint8 *key)
{
camellia_set_key (key, ScheduledKey.Ptr());
}
- void CipherCamellia::EncryptBlocks (byte *data, size_t blockCount) const
+ void CipherCamellia::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -429,7 +429,7 @@ namespace VeraCrypt
#endif
}
- void CipherCamellia::DecryptBlocks (byte *data, size_t blockCount) const
+ void CipherCamellia::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -451,12 +451,12 @@ namespace VeraCrypt
}
// Kuznyechik
- void CipherKuznyechik::Decrypt (byte *data) const
+ void CipherKuznyechik::Decrypt (uint8 *data) const
{
kuznyechik_decrypt_block (data, data, (kuznyechik_kds *) ScheduledKey.Ptr());
}
- void CipherKuznyechik::Encrypt (byte *data) const
+ void CipherKuznyechik::Encrypt (uint8 *data) const
{
kuznyechik_encrypt_block (data, data, (kuznyechik_kds *) ScheduledKey.Ptr());
}
@@ -466,11 +466,11 @@ namespace VeraCrypt
return KUZNYECHIK_KS;
}
- void CipherKuznyechik::SetCipherKey (const byte *key)
+ void CipherKuznyechik::SetCipherKey (const uint8 *key)
{
kuznyechik_set_key (key, (kuznyechik_kds *) ScheduledKey.Ptr());
}
- void CipherKuznyechik::EncryptBlocks (byte *data, size_t blockCount) const
+ void CipherKuznyechik::EncryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
@@ -486,7 +486,7 @@ namespace VeraCrypt
Cipher::EncryptBlocks (data, blockCount);
}
- void CipherKuznyechik::DecryptBlocks (byte *data, size_t blockCount) const
+ void CipherKuznyechik::DecryptBlocks (uint8 *data, size_t blockCount) const
{
if (!Initialized)
throw NotInitialized (SRC_POS);
diff --git a/src/Volume/Cipher.h b/src/Volume/Cipher.h
index 1b7fd233..c53cfbd9 100644
--- a/src/Volume/Cipher.h
+++ b/src/Volume/Cipher.h
@@ -26,18 +26,18 @@ namespace VeraCrypt
public:
virtual ~Cipher ();
- virtual void DecryptBlock (byte *data) const;
- virtual void DecryptBlocks (byte *data, size_t blockCount) const;
+ virtual void DecryptBlock (uint8 *data) const;
+ virtual void DecryptBlocks (uint8 *data, size_t blockCount) const;
#ifndef WOLFCRYPT_BACKEND
static void EnableHwSupport (bool enable) { HwSupportEnabled = enable; }
#else
static void EnableHwSupport (bool enable) { HwSupportEnabled = false; }
- virtual void EncryptBlockXTS (byte *data, uint64 length, uint64 startDataUnitNo) const;
- virtual void DecryptBlockXTS (byte *data, uint64 length, uint64 startDataUnitNo) const;
+ virtual void EncryptBlockXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const;
+ virtual void DecryptBlockXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const;
virtual void SetKeyXTS (const ConstBufferPtr &key);
#endif
- virtual void EncryptBlock (byte *data) const;
- virtual void EncryptBlocks (byte *data, size_t blockCount) const;
+ virtual void EncryptBlock (uint8 *data) const;
+ virtual void EncryptBlocks (uint8 *data, size_t blockCount) const;
static CipherList GetAvailableCiphers ();
virtual size_t GetBlockSize () const = 0;
virtual const SecureBuffer &GetKey () const { return Key; }
@@ -53,14 +53,14 @@ namespace VeraCrypt
protected:
Cipher ();
- virtual void Decrypt (byte *data) const = 0;
- virtual void Encrypt (byte *data) const = 0;
+ virtual void Decrypt (uint8 *data) const = 0;
+ virtual void Encrypt (uint8 *data) const = 0;
virtual size_t GetScheduledKeySize () const = 0;
- virtual void SetCipherKey (const byte *key) = 0;
+ virtual void SetCipherKey (const uint8 *key) = 0;
#ifdef WOLFCRYPT_BACKEND
- virtual void DecryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const = 0;
- virtual void EncryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const = 0;
- virtual void SetCipherKeyXTS (const byte *key) = 0;
+ virtual void DecryptXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const = 0;
+ virtual void EncryptXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const = 0;
+ virtual void SetCipherKeyXTS (const uint8 *key) = 0;
#endif
static bool HwSupportEnabled;
@@ -97,13 +97,13 @@ namespace VeraCrypt
TC_CIPHER_ADD_METHODS \
\
protected: \
- virtual void Decrypt (byte *data) const; \
- virtual void Encrypt (byte *data) const; \
+ virtual void Decrypt (uint8 *data) const; \
+ virtual void Encrypt (uint8 *data) const; \
virtual size_t GetScheduledKeySize () const; \
- virtual void SetCipherKey (const byte *key); \
- virtual void DecryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const; \
- virtual void SetCipherKeyXTS (const byte *key); \
- virtual void EncryptXTS (byte *data, uint64 length, uint64 startDataUnitNo) const; \
+ virtual void SetCipherKey (const uint8 *key); \
+ virtual void DecryptXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const; \
+ virtual void SetCipherKeyXTS (const uint8 *key); \
+ virtual void EncryptXTS (uint8 *data, uint64 length, uint64 startDataUnitNo) const; \
\
private: \
TC_JOIN (Cipher,NAME) (const TC_JOIN (Cipher,NAME) &); \
@@ -126,10 +126,10 @@ namespace VeraCrypt
TC_CIPHER_ADD_METHODS \
\
protected: \
- virtual void Decrypt (byte *data) const; \
- virtual void Encrypt (byte *data) const; \
+ virtual void Decrypt (uint8 *data) const; \
+ virtual void Encrypt (uint8 *data) const; \
virtual size_t GetScheduledKeySize () const; \
- virtual void SetCipherKey (const byte *key); \
+ virtual void SetCipherKey (const uint8 *key); \
\
private: \
TC_JOIN (Cipher,NAME) (const TC_JOIN (Cipher,NAME) &); \
@@ -139,8 +139,8 @@ namespace VeraCrypt
#endif
#define TC_CIPHER_ADD_METHODS \
- virtual void DecryptBlocks (byte *data, size_t blockCount) const; \
- virtual void EncryptBlocks (byte *data, size_t blockCount) const; \
+ virtual void DecryptBlocks (uint8 *data, size_t blockCount) const; \
+ virtual void EncryptBlocks (uint8 *data, size_t blockCount) const; \
virtual bool IsHwSupportAvailable () const;
TC_CIPHER (AES, 16, 32);
diff --git a/src/Volume/Crc32.h b/src/Volume/Crc32.h
index ced20457..ebe7aa83 100644
--- a/src/Volume/Crc32.h
+++ b/src/Volume/Crc32.h
@@ -26,14 +26,14 @@ namespace VeraCrypt
uint32 Get () const { return CrcValue ^ 0xffffFFFF; }
- uint32 Process (byte data)
+ uint32 Process (uint8 data)
{
- return CrcValue = crc_32_tab[(byte) (CrcValue ^ data)] ^ (CrcValue >> 8);
+ return CrcValue = crc_32_tab[(uint8) (CrcValue ^ data)] ^ (CrcValue >> 8);
}
static uint32 ProcessBuffer (const ConstBufferPtr &buffer)
{
- return ::GetCrc32 (const_cast<byte *> (buffer.Get()), static_cast<int> (buffer.Size()));
+ return ::GetCrc32 (const_cast<uint8 *> (buffer.Get()), static_cast<int> (buffer.Size()));
}
protected:
diff --git a/src/Volume/EncryptionAlgorithm.cpp b/src/Volume/EncryptionAlgorithm.cpp
index 0178da00..4a325fe3 100644
--- a/src/Volume/EncryptionAlgorithm.cpp
+++ b/src/Volume/EncryptionAlgorithm.cpp
@@ -26,7 +26,7 @@ namespace VeraCrypt
{
}
- void EncryptionAlgorithm::Decrypt (byte *data, uint64 length) const
+ void EncryptionAlgorithm::Decrypt (uint8 *data, uint64 length) const
{
if_debug (ValidateState ());
Mode->Decrypt (data, length);
@@ -37,13 +37,13 @@ namespace VeraCrypt
Decrypt (data, data.Size());
}
- void EncryptionAlgorithm::DecryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionAlgorithm::DecryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
if_debug (ValidateState());
Mode->DecryptSectors (data, sectorIndex, sectorCount, sectorSize);
}
- void EncryptionAlgorithm::Encrypt (byte *data, uint64 length) const
+ void EncryptionAlgorithm::Encrypt (uint8 *data, uint64 length) const
{
if_debug (ValidateState());
Mode->Encrypt (data, length);
@@ -54,7 +54,7 @@ namespace VeraCrypt
Encrypt (data, data.Size());
}
- void EncryptionAlgorithm::EncryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionAlgorithm::EncryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
if_debug (ValidateState ());
Mode->EncryptSectors (data, sectorIndex, sectorCount, sectorSize);
diff --git a/src/Volume/EncryptionAlgorithm.h b/src/Volume/EncryptionAlgorithm.h
index d60082fa..e9f9b9ef 100644
--- a/src/Volume/EncryptionAlgorithm.h
+++ b/src/Volume/EncryptionAlgorithm.h
@@ -27,12 +27,12 @@ namespace VeraCrypt
public:
virtual ~EncryptionAlgorithm ();
- virtual void Decrypt (byte *data, uint64 length) const;
+ virtual void Decrypt (uint8 *data, uint64 length) const;
virtual void Decrypt (const BufferPtr &data) const;
- virtual void DecryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
- virtual void Encrypt (byte *data, uint64 length) const;
+ virtual void DecryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void Encrypt (uint8 *data, uint64 length) const;
virtual void Encrypt (const BufferPtr &data) const;
- virtual void EncryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void EncryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
static EncryptionAlgorithmList GetAvailableAlgorithms ();
virtual const CipherList &GetCiphers () const { return Ciphers; }
virtual shared_ptr <EncryptionAlgorithm> GetNew () const = 0;
diff --git a/src/Volume/EncryptionMode.cpp b/src/Volume/EncryptionMode.cpp
index 81d275b6..6a63efe5 100644
--- a/src/Volume/EncryptionMode.cpp
+++ b/src/Volume/EncryptionMode.cpp
@@ -27,12 +27,12 @@ namespace VeraCrypt
{
}
- void EncryptionMode::DecryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionMode::DecryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
EncryptionThreadPool::DoWork (EncryptionThreadPool::WorkType::DecryptDataUnits, this, data, sectorIndex, sectorCount, sectorSize);
}
- void EncryptionMode::EncryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionMode::EncryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
EncryptionThreadPool::DoWork (EncryptionThreadPool::WorkType::EncryptDataUnits, this, data, sectorIndex, sectorCount, sectorSize);
}
@@ -56,13 +56,13 @@ namespace VeraCrypt
throw NotInitialized (SRC_POS);
}
- void EncryptionMode::ValidateParameters (byte *data, uint64 length) const
+ void EncryptionMode::ValidateParameters (uint8 *data, uint64 length) const
{
if ((Ciphers.size() > 0 && (length % Ciphers.front()->GetBlockSize()) != 0))
throw ParameterIncorrect (SRC_POS);
}
- void EncryptionMode::ValidateParameters (byte *data, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionMode::ValidateParameters (uint8 *data, uint64 sectorCount, size_t sectorSize) const
{
if (sectorCount == 0 || sectorSize == 0 || (sectorSize % EncryptionDataUnitSize) != 0)
throw ParameterIncorrect (SRC_POS);
diff --git a/src/Volume/EncryptionMode.h b/src/Volume/EncryptionMode.h
index a629d6b7..0da28fa7 100644
--- a/src/Volume/EncryptionMode.h
+++ b/src/Volume/EncryptionMode.h
@@ -27,12 +27,12 @@ namespace VeraCrypt
public:
virtual ~EncryptionMode ();
- virtual void Decrypt (byte *data, uint64 length) const = 0;
- virtual void DecryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
- virtual void DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const = 0;
- virtual void Encrypt (byte *data, uint64 length) const = 0;
- virtual void EncryptSectors (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
- virtual void EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const = 0;
+ virtual void Decrypt (uint8 *data, uint64 length) const = 0;
+ virtual void DecryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void DecryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const = 0;
+ virtual void Encrypt (uint8 *data, uint64 length) const = 0;
+ virtual void EncryptSectors (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void EncryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const = 0;
static EncryptionModeList GetAvailableModes ();
virtual const SecureBuffer &GetKey () const { throw NotApplicable (SRC_POS); }
virtual size_t GetKeySize () const = 0;
@@ -48,8 +48,8 @@ namespace VeraCrypt
EncryptionMode ();
virtual void ValidateState () const;
- void ValidateParameters (byte *data, uint64 length) const;
- virtual void ValidateParameters (byte *data, uint64 sectorCount, size_t sectorSize) const;
+ void ValidateParameters (uint8 *data, uint64 length) const;
+ virtual void ValidateParameters (uint8 *data, uint64 sectorCount, size_t sectorSize) const;
static const size_t EncryptionDataUnitSize = ENCRYPTION_DATA_UNIT_SIZE;
diff --git a/src/Volume/EncryptionModeWolfCryptXTS.cpp b/src/Volume/EncryptionModeWolfCryptXTS.cpp
index 891f6007..878ad042 100644
--- a/src/Volume/EncryptionModeWolfCryptXTS.cpp
+++ b/src/Volume/EncryptionModeWolfCryptXTS.cpp
@@ -6,12 +6,12 @@
namespace VeraCrypt
{
- void EncryptionModeWolfCryptXTS::Encrypt (byte *data, uint64 length) const
+ void EncryptionModeWolfCryptXTS::Encrypt (uint8 *data, uint64 length) const
{
EncryptBuffer (data, length, 0);
}
- void EncryptionModeWolfCryptXTS::EncryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void EncryptionModeWolfCryptXTS::EncryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
if_debug (ValidateState());
@@ -26,12 +26,12 @@ namespace VeraCrypt
assert (iSecondaryCipher == SecondaryCiphers.end());
}
- void EncryptionModeWolfCryptXTS::EncryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
+ void EncryptionModeWolfCryptXTS::EncryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
{
cipher.EncryptBlockXTS(buffer, length, startDataUnitNo);
}
- void EncryptionModeWolfCryptXTS::EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionModeWolfCryptXTS::EncryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
EncryptBuffer (data, sectorCount * sectorSize, sectorIndex * sectorSize / ENCRYPTION_DATA_UNIT_SIZE);
}
@@ -50,12 +50,12 @@ namespace VeraCrypt
return keySize;
}
- void EncryptionModeWolfCryptXTS::Decrypt (byte *data, uint64 length) const
+ void EncryptionModeWolfCryptXTS::Decrypt (uint8 *data, uint64 length) const
{
DecryptBuffer (data, length, 0);
}
- void EncryptionModeWolfCryptXTS::DecryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void EncryptionModeWolfCryptXTS::DecryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
if_debug (ValidateState());
@@ -70,12 +70,12 @@ namespace VeraCrypt
assert (iSecondaryCipher == SecondaryCiphers.begin());
}
- void EncryptionModeWolfCryptXTS::DecryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
+ void EncryptionModeWolfCryptXTS::DecryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
{
cipher.DecryptBlockXTS(buffer, length, startDataUnitNo);
}
- void EncryptionModeWolfCryptXTS::DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionModeWolfCryptXTS::DecryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
DecryptBuffer (data, sectorCount * sectorSize, sectorIndex * sectorSize / ENCRYPTION_DATA_UNIT_SIZE);
}
diff --git a/src/Volume/EncryptionModeWolfCryptXTS.h b/src/Volume/EncryptionModeWolfCryptXTS.h
index e432f768..c9f2d59f 100644
--- a/src/Volume/EncryptionModeWolfCryptXTS.h
+++ b/src/Volume/EncryptionModeWolfCryptXTS.h
@@ -24,10 +24,10 @@ namespace VeraCrypt
EncryptionModeWolfCryptXTS () { }
virtual ~EncryptionModeWolfCryptXTS () { }
- virtual void Decrypt (byte *data, uint64 length) const;
- virtual void DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
- virtual void Encrypt (byte *data, uint64 length) const;
- virtual void EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void Decrypt (uint8 *data, uint64 length) const;
+ virtual void DecryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void Encrypt (uint8 *data, uint64 length) const;
+ virtual void EncryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
virtual const SecureBuffer &GetKey () const { return SecondaryKey; }
virtual size_t GetKeySize () const;
virtual wstring GetName () const { return L"XTS"; };
@@ -36,10 +36,10 @@ namespace VeraCrypt
virtual void SetKey (const ConstBufferPtr &key);
protected:
- void DecryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
- void DecryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
- void EncryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
- void EncryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
+ void DecryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const;
+ void DecryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
+ void EncryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const;
+ void EncryptBufferXTS (Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
void SetSecondaryCipherKeys ();
SecureBuffer SecondaryKey;
diff --git a/src/Volume/EncryptionModeXTS.cpp b/src/Volume/EncryptionModeXTS.cpp
index 56ee895c..001bfcf8 100644
--- a/src/Volume/EncryptionModeXTS.cpp
+++ b/src/Volume/EncryptionModeXTS.cpp
@@ -47,12 +47,12 @@
namespace VeraCrypt
{
- void EncryptionModeXTS::Encrypt (byte *data, uint64 length) const
+ void EncryptionModeXTS::Encrypt (uint8 *data, uint64 length) const
{
EncryptBuffer (data, length, 0);
}
- void EncryptionModeXTS::EncryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void EncryptionModeXTS::EncryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
if_debug (ValidateState());
@@ -67,12 +67,12 @@ namespace VeraCrypt
assert (iSecondaryCipher == SecondaryCiphers.end());
}
- void EncryptionModeXTS::EncryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
+ void EncryptionModeXTS::EncryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
{
- byte finalCarry;
- byte whiteningValues [ENCRYPTION_DATA_UNIT_SIZE];
- byte whiteningValue [BYTES_PER_XTS_BLOCK];
- byte byteBufUnitNo [BYTES_PER_XTS_BLOCK];
+ uint8 finalCarry;
+ uint8 whiteningValues [ENCRYPTION_DATA_UNIT_SIZE];
+ uint8 whiteningValue [BYTES_PER_XTS_BLOCK];
+ uint8 byteBufUnitNo [BYTES_PER_XTS_BLOCK];
uint64 *whiteningValuesPtr64 = (uint64 *) whiteningValues;
uint64 *whiteningValuePtr64 = (uint64 *) whiteningValue;
uint64 *bufPtr = (uint64 *) buffer;
@@ -182,7 +182,7 @@ namespace VeraCrypt
}
#endif
// Actual encryption
- cipher.EncryptBlocks ((byte *) dataUnitBufPtr, countBlock);
+ cipher.EncryptBlocks ((uint8 *) dataUnitBufPtr, countBlock);
bufPtr = dataUnitBufPtr;
whiteningValuesPtr64 = (uint64 *) whiteningValues;
@@ -207,7 +207,7 @@ namespace VeraCrypt
FAST_ERASE64 (whiteningValues, sizeof (whiteningValues));
}
- void EncryptionModeXTS::EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionModeXTS::EncryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
EncryptBuffer (data, sectorCount * sectorSize, sectorIndex * sectorSize / ENCRYPTION_DATA_UNIT_SIZE);
}
@@ -226,12 +226,12 @@ namespace VeraCrypt
return keySize;
}
- void EncryptionModeXTS::Decrypt (byte *data, uint64 length) const
+ void EncryptionModeXTS::Decrypt (uint8 *data, uint64 length) const
{
DecryptBuffer (data, length, 0);
}
- void EncryptionModeXTS::DecryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const
+ void EncryptionModeXTS::DecryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const
{
if_debug (ValidateState());
@@ -246,12 +246,12 @@ namespace VeraCrypt
assert (iSecondaryCipher == SecondaryCiphers.begin());
}
- void EncryptionModeXTS::DecryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
+ void EncryptionModeXTS::DecryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const
{
- byte finalCarry;
- byte whiteningValues [ENCRYPTION_DATA_UNIT_SIZE];
- byte whiteningValue [BYTES_PER_XTS_BLOCK];
- byte byteBufUnitNo [BYTES_PER_XTS_BLOCK];
+ uint8 finalCarry;
+ uint8 whiteningValues [ENCRYPTION_DATA_UNIT_SIZE];
+ uint8 whiteningValue [BYTES_PER_XTS_BLOCK];
+ uint8 byteBufUnitNo [BYTES_PER_XTS_BLOCK];
uint64 *whiteningValuesPtr64 = (uint64 *) whiteningValues;
uint64 *whiteningValuePtr64 = (uint64 *) whiteningValue;
uint64 *bufPtr = (uint64 *) buffer;
@@ -352,7 +352,7 @@ namespace VeraCrypt
*bufPtr++ ^= *whiteningValuesPtr64++;
}
#endif
- cipher.DecryptBlocks ((byte *) dataUnitBufPtr, countBlock);
+ cipher.DecryptBlocks ((uint8 *) dataUnitBufPtr, countBlock);
bufPtr = dataUnitBufPtr;
whiteningValuesPtr64 = (uint64 *) whiteningValues;
@@ -376,7 +376,7 @@ namespace VeraCrypt
FAST_ERASE64 (whiteningValues, sizeof (whiteningValues));
}
- void EncryptionModeXTS::DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
+ void EncryptionModeXTS::DecryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const
{
DecryptBuffer (data, sectorCount * sectorSize, sectorIndex * sectorSize / ENCRYPTION_DATA_UNIT_SIZE);
}
diff --git a/src/Volume/EncryptionModeXTS.h b/src/Volume/EncryptionModeXTS.h
index 6f674073..cbed0d33 100644
--- a/src/Volume/EncryptionModeXTS.h
+++ b/src/Volume/EncryptionModeXTS.h
@@ -24,10 +24,10 @@ namespace VeraCrypt
EncryptionModeXTS () { }
virtual ~EncryptionModeXTS () { }
- virtual void Decrypt (byte *data, uint64 length) const;
- virtual void DecryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
- virtual void Encrypt (byte *data, uint64 length) const;
- virtual void EncryptSectorsCurrentThread (byte *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void Decrypt (uint8 *data, uint64 length) const;
+ virtual void DecryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
+ virtual void Encrypt (uint8 *data, uint64 length) const;
+ virtual void EncryptSectorsCurrentThread (uint8 *data, uint64 sectorIndex, uint64 sectorCount, size_t sectorSize) const;
virtual const SecureBuffer &GetKey () const { return SecondaryKey; }
virtual size_t GetKeySize () const;
virtual wstring GetName () const { return L"XTS"; };
@@ -36,10 +36,10 @@ namespace VeraCrypt
virtual void SetKey (const ConstBufferPtr &key);
protected:
- void DecryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
- void DecryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
- void EncryptBuffer (byte *data, uint64 length, uint64 startDataUnitNo) const;
- void EncryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, byte *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
+ void DecryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const;
+ void DecryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
+ void EncryptBuffer (uint8 *data, uint64 length, uint64 startDataUnitNo) const;
+ void EncryptBufferXTS (const Cipher &cipher, const Cipher &secondaryCipher, uint8 *buffer, uint64 length, uint64 startDataUnitNo, unsigned int startCipherBlockNo) const;
void SetSecondaryCipherKeys ();
SecureBuffer SecondaryKey;
diff --git a/src/Volume/EncryptionTest.cpp b/src/Volume/EncryptionTest.cpp
index c900885e..9009be66 100644
--- a/src/Volume/EncryptionTest.cpp
+++ b/src/Volume/EncryptionTest.cpp
@@ -46,9 +46,9 @@ namespace VeraCrypt
struct CipherTestVector
{
- byte Key[32];
- byte Plaintext[16];
- byte Ciphertext[16];
+ uint8 Key[32];
+ uint8 Plaintext[16];
+ uint8 Ciphertext[16];
};
static const CipherTestVector AESTestVectors[] =
@@ -179,7 +179,7 @@ namespace VeraCrypt
Buffer testData (1024);
for (size_t i = 0; i < testData.Size(); ++i)
{
- testData[i] = (byte) i;
+ testData[i] = (uint8) i;
}
uint32 origCrc = Crc32::ProcessBuffer (testData);
@@ -485,7 +485,7 @@ namespace VeraCrypt
int testCase = 0;
int nTestsPerformed = 0;
- static const byte testKey[] =
+ static const uint8 testKey[] =
{
0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27,
0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92,
@@ -521,7 +521,7 @@ namespace VeraCrypt
Buffer modeKey (ea.GetKeySize());
for (size_t mi = 0; mi < modeKey.Size(); mi++)
- modeKey[mi] = (byte) mi;
+ modeKey[mi] = (uint8) mi;
modeKey.CopyFrom (ConstBufferPtr (XtsTestVectors[array_capacity (XtsTestVectors)-1].key2, sizeof (XtsTestVectors[array_capacity (XtsTestVectors)-1].key2)));
mode->SetKey (modeKey);
@@ -976,7 +976,7 @@ namespace VeraCrypt
Buffer modeKey (ea.GetKeySize());
for (size_t mi = 0; mi < modeKey.Size(); mi++)
- modeKey[mi] = (byte) mi;
+ modeKey[mi] = (uint8) mi;
modeKey.CopyFrom (ConstBufferPtr (XtsTestVectors[array_capacity (XtsTestVectors)-1].key2, sizeof (XtsTestVectors[array_capacity (XtsTestVectors)-1].key2)));
mode->SetKey (modeKey);
@@ -1110,8 +1110,8 @@ namespace VeraCrypt
void EncryptionTest::TestPkcs5 ()
{
- VolumePassword password ((byte*) "password", 8);
- static const byte saltData[] = { 0x12, 0x34, 0x56, 0x78 };
+ VolumePassword password ((uint8*) "password", 8);
+ static const uint8 saltData[] = { 0x12, 0x34, 0x56, 0x78 };
ConstBufferPtr salt (saltData, sizeof (saltData));
Buffer derivedKey (4);
diff --git a/src/Volume/EncryptionTest.h b/src/Volume/EncryptionTest.h
index 17e14fd7..fae07cb2 100644
--- a/src/Volume/EncryptionTest.h
+++ b/src/Volume/EncryptionTest.h
@@ -33,12 +33,12 @@ namespace VeraCrypt
struct XtsTestVector
{
- byte key1[32];
- byte key2[32];
- byte dataUnitNo[8];
+ uint8 key1[32];
+ uint8 key2[32];
+ uint8 dataUnitNo[8];
unsigned int blockNo;
- byte plaintext[ENCRYPTION_DATA_UNIT_SIZE];
- byte ciphertext[ENCRYPTION_DATA_UNIT_SIZE];
+ uint8 plaintext[ENCRYPTION_DATA_UNIT_SIZE];
+ uint8 ciphertext[ENCRYPTION_DATA_UNIT_SIZE];
};
static const XtsTestVector XtsTestVectors[];
diff --git a/src/Volume/EncryptionThreadPool.cpp b/src/Volume/EncryptionThreadPool.cpp
index 7c86bf49..36f8a622 100644
--- a/src/Volume/EncryptionThreadPool.cpp
+++ b/src/Volume/EncryptionThreadPool.cpp
@@ -26,13 +26,13 @@
namespace VeraCrypt
{
- void EncryptionThreadPool::DoWork (WorkType::Enum type, const EncryptionMode *encryptionMode, byte *data, uint64 startUnitNo, uint64 unitCount, size_t sectorSize)
+ void EncryptionThreadPool::DoWork (WorkType::Enum type, const EncryptionMode *encryptionMode, uint8 *data, uint64 startUnitNo, uint64 unitCount, size_t sectorSize)
{
size_t fragmentCount;
size_t unitsPerFragment;
size_t remainder;
- byte *fragmentData;
+ uint8 *fragmentData;
uint64 fragmentStartUnitNo;
WorkItem *workItem;
diff --git a/src/Volume/EncryptionThreadPool.h b/src/Volume/EncryptionThreadPool.h
index baf31e23..a78aee75 100644
--- a/src/Volume/EncryptionThreadPool.h
+++ b/src/Volume/EncryptionThreadPool.h
@@ -55,7 +55,7 @@ namespace VeraCrypt
struct
{
const EncryptionMode *Mode;
- byte *Data;
+ uint8 *Data;
uint64 StartUnitNo;
uint64 UnitCount;
size_t SectorSize;
@@ -63,7 +63,7 @@ namespace VeraCrypt
};
};
- static void DoWork (WorkType::Enum type, const EncryptionMode *mode, byte *data, uint64 startUnitNo, uint64 unitCount, size_t sectorSize);
+ static void DoWork (WorkType::Enum type, const EncryptionMode *mode, uint8 *data, uint64 startUnitNo, uint64 unitCount, size_t sectorSize);
static bool IsRunning () { return ThreadPoolRunning; }
static void Start ();
static void Stop ();
diff --git a/src/Volume/Keyfile.cpp b/src/Volume/Keyfile.cpp
index 24b40709..e756cdf1 100644
--- a/src/Volume/Keyfile.cpp
+++ b/src/Volume/Keyfile.cpp
@@ -35,7 +35,7 @@ namespace VeraCrypt
if (Token::IsKeyfilePathValid (Path, emvSupportEnabled))
{
// Apply keyfile generated by a security token
- vector <byte> keyfileData;
+ vector <uint8> keyfileData;
Token::getTokenKeyfile(wstring(Path))->GetKeyfileData(keyfileData);
if (keyfileData.size() < MinProcessedLength)
@@ -45,10 +45,10 @@ namespace VeraCrypt
{
uint32 crc = crc32.Process(keyfileData[i]);
- pool[poolPos++] += (byte)(crc >> 24);
- pool[poolPos++] += (byte)(crc >> 16);
- pool[poolPos++] += (byte)(crc >> 8);
- pool[poolPos++] += (byte) crc;
+ pool[poolPos++] += (uint8)(crc >> 24);
+ pool[poolPos++] += (uint8)(crc >> 16);
+ pool[poolPos++] += (uint8)(crc >> 8);
+ pool[poolPos++] += (uint8) crc;
if (poolPos >= pool.Size())
poolPos = 0;
@@ -69,10 +69,10 @@ namespace VeraCrypt
for (size_t i = 0; i < readLength; i++)
{
uint32 crc = crc32.Process(keyfileBuf[i]);
- pool[poolPos++] += (byte)(crc >> 24);
- pool[poolPos++] += (byte)(crc >> 16);
- pool[poolPos++] += (byte)(crc >> 8);
- pool[poolPos++] += (byte) crc;
+ pool[poolPos++] += (uint8)(crc >> 24);
+ pool[poolPos++] += (uint8)(crc >> 16);
+ pool[poolPos++] += (uint8)(crc >> 8);
+ pool[poolPos++] += (uint8) crc;
if (poolPos >= pool.Size())
poolPos = 0;
if (++totalLength >= MaxProcessedLength)
diff --git a/src/Volume/VolumePassword.cpp b/src/Volume/VolumePassword.cpp
index a22c9388..9ba3ebce 100644
--- a/src/Volume/VolumePassword.cpp
+++ b/src/Volume/VolumePassword.cpp
@@ -60,7 +60,7 @@ namespace VeraCrypt
sr.Serialize ("WipeData", ConstBufferPtr (wipeBuffer));
}
- void VolumePassword::Set (const byte *password, size_t size)
+ void VolumePassword::Set (const uint8 *password, size_t size)
{
AllocateBuffer ();
diff --git a/src/Volume/VolumePassword.h b/src/Volume/VolumePassword.h
index f4a3ccbe..c1e6b9b6 100644
--- a/src/Volume/VolumePassword.h
+++ b/src/Volume/VolumePassword.h
@@ -22,7 +22,7 @@ namespace VeraCrypt
{
public:
VolumePassword ();
- VolumePassword (const byte *password, size_t size) { Set (password, size); }
+ VolumePassword (const uint8 *password, size_t size) { Set (password, size); }
VolumePassword (const SecureBuffer &password) { Set (password.Ptr (), password.Size ()); }
VolumePassword (const VolumePassword &password) { Set (password); }
virtual ~VolumePassword ();
@@ -33,10 +33,10 @@ namespace VeraCrypt
operator BufferPtr () const { return BufferPtr (PasswordBuffer); }
- byte *DataPtr () const { return PasswordBuffer; }
+ uint8 *DataPtr () const { return PasswordBuffer; }
bool IsEmpty () const { return PasswordSize == 0; }
size_t Size () const { return PasswordSize; }
- void Set (const byte *password, size_t size);
+ void Set (const uint8 *password, size_t size);
void Set (const VolumePassword &password);
TC_SERIALIZABLE (VolumePassword);