mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-10 05:03:33 +01:00
Avoid conflict with C++17 features std::byte by using uint8 type instead of byte
This commit is contained in:
parent
bf9f3ec4f0
commit
455a4f2176
@ -28,6 +28,6 @@ enum
|
||||
BiosResultTimeout = 0x80
|
||||
};
|
||||
|
||||
typedef byte BiosResult;
|
||||
typedef uint8 BiosResult;
|
||||
|
||||
#endif // TC_HEADER_Boot_Bios
|
||||
|
@ -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()
|
||||
|
@ -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 @@ void ReadBootSectorUserConfiguration ()
|
||||
}
|
||||
|
||||
|
||||
BiosResult UpdateBootSectorConfiguration (byte drive)
|
||||
BiosResult UpdateBootSectorConfiguration (uint8 drive)
|
||||
{
|
||||
uint64 mbrSector;
|
||||
mbrSector.HighPart = 0;
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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 @@ bool IsLbaSupported (byte drive)
|
||||
}
|
||||
|
||||
|
||||
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 §orCount)
|
||||
}
|
||||
|
||||
|
||||
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 §or, uint16 sectorCount, bool silent)
|
||||
static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, uint8 drive, const uint64 §or, 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 §or, uint16 sectorCount, bool silent)
|
||||
BiosResult ReadWriteSectors (bool write, uint8 *buffer, uint8 drive, const uint64 §or, 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 §or, uint16 sectorCount, bool silent)
|
||||
BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const uint64 §or, 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 §or, uint16 sectorCount, bool silent)
|
||||
BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const uint64 §or, uint16 sectorCount, bool silent)
|
||||
{
|
||||
return ReadWriteSectors (false, bufferSegment, bufferOffset, drive, sector, sectorCount, silent);
|
||||
}
|
||||
|
||||
|
||||
BiosResult ReadSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
||||
BiosResult ReadSectors (uint8 *buffer, uint8 drive, const uint64 §or, uint16 sectorCount, bool silent)
|
||||
{
|
||||
BiosResult result;
|
||||
uint16 codeSeg;
|
||||
@ -274,17 +274,17 @@ BiosResult ReadSectors (byte *buffer, byte drive, const uint64 §or, uint16 s
|
||||
}
|
||||
|
||||
|
||||
BiosResult WriteSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
||||
BiosResult WriteSectors (uint8 *buffer, uint8 drive, const uint64 §or, 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;
|
||||
|
||||
|
@ -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 §orCount);
|
||||
BiosResult ReadWriteMBR (bool write, byte drive, bool silent = false);
|
||||
BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 §or, uint16 sectorCount, bool silent = false);
|
||||
BiosResult ReadSectors (byte *buffer, byte drive, const uint64 §or, 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 §or, uint16 sectorCount, bool silent);
|
||||
BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent);
|
||||
BiosResult WriteSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent = false);
|
||||
BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
|
||||
BiosResult ReadWriteMBR (bool write, uint8 drive, bool silent = false);
|
||||
BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, uint8 drive, const uint64 §or, uint16 sectorCount, bool silent = false);
|
||||
BiosResult ReadSectors (uint8 *buffer, uint8 drive, const uint64 §or, 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 §or, uint16 sectorCount, bool silent);
|
||||
BiosResult ReadWriteSectors (bool write, uint8 *buffer, uint8 drive, const uint64 §or, uint16 sectorCount, bool silent);
|
||||
BiosResult WriteSectors (uint8 *buffer, uint8 drive, const uint64 §or, uint16 sectorCount, bool silent = false);
|
||||
BiosResult WriteSectors (uint8 *buffer, uint8 drive, const ChsAddress &chs, uint8 sectorCount, bool silent = false);
|
||||
|
||||
extern byte SectorBuffer[TC_LB_SIZE];
|
||||
extern uint8 SectorBuffer[TC_LB_SIZE];
|
||||
|
||||
#endif // TC_HEADER_Boot_BootDiskIo
|
||||
|
@ -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();
|
||||
|
@ -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 §or, uint16 sectorCount);
|
||||
|
||||
#endif // TC_HEADER_Boot_BootEncryptionIo
|
||||
|
@ -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 @@ static byte BootEncryptedDrive ()
|
||||
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 @@ static bool CopySystemPartitionToHiddenVolume (byte drive, byte &exitKey)
|
||||
#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 @@ static void DecryptDrive (byte drive)
|
||||
|
||||
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 @@ static void DecryptDrive (byte drive)
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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 ();
|
||||
|
||||
|
@ -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 (' ');
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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 &)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 @@ int MountVolume (HWND hwndDlg,
|
||||
|
||||
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;
|
||||
|
||||
|
@ -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 ();
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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);
|
||||
};
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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 ();
|
||||
|
@ -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 */
|
||||
|
@ -532,7 +532,7 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams)
|
||||
// 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;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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 @@ KeyReady: ;
|
||||
}
|
||||
|
||||
#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 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
|
||||
}
|
||||
|
||||
#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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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__
|
||||
(
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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]];
|
||||
|
@ -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]);
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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())
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
static DriveFilterExtension *BootDriveFilterExtension = NULL;
|
||||
static LARGE_INTEGER DumpPartitionOffset;
|
||||
static byte *WriteFilterBuffer = NULL;
|
||||
static uint8 *WriteFilterBuffer = NULL;
|
||||
static SIZE_T WriteFilterBufferSize;
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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 @@ NTSTATUS ZeroUnreadableSectors (PDEVICE_OBJECT deviceObject, LARGE_INTEGER start
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
|
||||
|
||||
// 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 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
|
||||
// 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 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
|
||||
// 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 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
|
||||
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 @@ int EncryptPartitionInPlaceResume (HANDLE dev,
|
||||
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 @@ static int OpenBackupHeader (HANDLE dev, const wchar_t *devicePath, Password *pa
|
||||
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;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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())
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
|
@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -43,7 +43,7 @@ namespace VeraCrypt
|
||||
|
||||
void LanguageStrings::Init ()
|
||||
{
|
||||
static byte LanguageXml[] =
|
||||
static uint8 LanguageXml[] =
|
||||
{
|
||||
# include "Common/Language.xml.h"
|
||||
, 0
|
||||
|
@ -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"
|
||||
};
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user