mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-30 23:13:31 +01:00
Windows: Synchronize file with changes done in EFI Bootloader DCS.
This commit is contained in:
parent
2d72e42c6c
commit
83885c1ebb
@ -80,7 +80,7 @@ typedef struct
|
|||||||
|
|
||||||
#if !defined(TC_WINDOWS_BOOT)
|
#if !defined(TC_WINDOWS_BOOT)
|
||||||
|
|
||||||
#define DCS_DISK_ENTRY_LIST_HEADER_ID SIGNATURE_64 ('D','C','S','D','E','L','S','T')
|
#define DCS_DISK_ENTRY_LIST_HEADER_SIGN SIGNATURE_64 ('D','C','S','D','E','L','S','T')
|
||||||
|
|
||||||
#define DE_IDX_CRYPTOHEADER 0
|
#define DE_IDX_CRYPTOHEADER 0
|
||||||
#define DE_IDX_LIST 1
|
#define DE_IDX_LIST 1
|
||||||
@ -89,9 +89,11 @@ typedef struct
|
|||||||
#define DE_IDX_MAINGPTENTRYS 4
|
#define DE_IDX_MAINGPTENTRYS 4
|
||||||
#define DE_IDX_ALTGPTHDR 5
|
#define DE_IDX_ALTGPTHDR 5
|
||||||
#define DE_IDX_ALTGPTENTRYS 6
|
#define DE_IDX_ALTGPTENTRYS 6
|
||||||
#define DE_IDX_EXECPARAMS 7
|
#define DE_IDX_EXEC 7
|
||||||
#define DE_IDX_PWDCACHE 8
|
#define DE_IDX_PWDCACHE 8
|
||||||
#define DE_IDX_TOTAL 9
|
#define DE_IDX_RND 9
|
||||||
|
#define DE_IDX_TOTAL 10
|
||||||
|
static_assert(DE_IDX_TOTAL <= 15, "DE_IDX_TOTAL too big");
|
||||||
|
|
||||||
enum DcsDiskEntryTypes {
|
enum DcsDiskEntryTypes {
|
||||||
DE_Unused = 0,
|
DE_Unused = 0,
|
||||||
@ -99,7 +101,8 @@ enum DcsDiskEntryTypes {
|
|||||||
DE_List,
|
DE_List,
|
||||||
DE_DISKID,
|
DE_DISKID,
|
||||||
DE_ExecParams,
|
DE_ExecParams,
|
||||||
DE_PwdCache
|
DE_PwdCache,
|
||||||
|
DE_Rnd
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
@ -109,14 +112,6 @@ typedef struct _SECREGION_BOOT_PARAMS {
|
|||||||
uint32 Crc;
|
uint32 Crc;
|
||||||
} SECREGION_BOOT_PARAMS;
|
} SECREGION_BOOT_PARAMS;
|
||||||
|
|
||||||
typedef struct _DCS_DISK_ENTRY_SECTORS {
|
|
||||||
uint32 Type;
|
|
||||||
uint32 Offset;
|
|
||||||
uint64 Reserved;
|
|
||||||
uint64 Start;
|
|
||||||
uint64 Length;
|
|
||||||
} DCS_DISK_ENTRY_SECTORS;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32 Data1;
|
uint32 Data1;
|
||||||
uint16 Data2;
|
uint16 Data2;
|
||||||
@ -124,43 +119,63 @@ typedef struct {
|
|||||||
byte Data4[8];
|
byte Data4[8];
|
||||||
} DCS_GUID;
|
} DCS_GUID;
|
||||||
|
|
||||||
|
// DE types
|
||||||
|
typedef struct _DCS_DISK_ENTRY_SECTORS {
|
||||||
|
uint32 Type;
|
||||||
|
uint32 Offset; // Offset in memory
|
||||||
|
uint64 Reserved;
|
||||||
|
uint64 Start; // Start on disk (byte)
|
||||||
|
uint64 Length; // length on disk (byte)
|
||||||
|
} DCS_DISK_ENTRY_SECTORS;
|
||||||
|
static_assert(sizeof(DCS_DISK_ENTRY_SECTORS) == 32, "Wrong size DCS_DISK_ENTRY_SECTORS");
|
||||||
|
|
||||||
|
typedef struct _DCS_DISK_ENTRY_PARAMS {
|
||||||
|
uint32 Type;
|
||||||
|
uint32 Offset;
|
||||||
|
uint64 Reserved[2];
|
||||||
|
uint64 Length; // size of data
|
||||||
|
} DCS_DISK_ENTRY_PARAMS;
|
||||||
|
static_assert(sizeof(DCS_DISK_ENTRY_PARAMS) == 32, "Wrong size DCS_DISK_ENTRY_PARAMS");
|
||||||
|
|
||||||
typedef struct _DCS_DISK_ENTRY_DISKID {
|
typedef struct _DCS_DISK_ENTRY_DISKID {
|
||||||
uint32 Type;
|
uint32 Type;
|
||||||
uint32 MbrID;
|
uint32 MbrID;
|
||||||
uint64 ReservedDiskId;
|
uint64 ReservedDiskId;
|
||||||
DCS_GUID GptID;
|
DCS_GUID GptID;
|
||||||
} DCS_DISK_ENTRY_DISKID;
|
} DCS_DISK_ENTRY_DISKID;
|
||||||
|
static_assert(sizeof(DCS_DISK_ENTRY_DISKID) == 32, "Wrong size DCS_DISK_ENTRY_DISKID");
|
||||||
typedef struct _DCS_DISK_ENTRY_EXEC_PARAMS {
|
|
||||||
DCS_GUID ExecPartGuid;
|
|
||||||
uint16 ExecCmd[248];
|
|
||||||
} DCS_DISK_ENTRY_EXEC_PARAMS;
|
|
||||||
static_assert(sizeof(DCS_DISK_ENTRY_EXEC_PARAMS) == 512, "Wrong size DCS_DISK_ENTRY_EXEC_PARAMS");
|
|
||||||
|
|
||||||
#define DCS_DISK_ENTRY_PWD_CACHE_ID SIGNATURE_64 ('P','W','D','C','A','C','H','E')
|
|
||||||
typedef struct _DCS_DISK_ENTRY_PWD_CACHE {
|
|
||||||
uint64 Sign;
|
|
||||||
uint32 CRC;
|
|
||||||
uint32 Count;
|
|
||||||
Password Pwd[4];
|
|
||||||
int32 Pim[4];
|
|
||||||
byte pad[512 -8 - 4 - 4 - (sizeof(Password) + 4) * 4];
|
|
||||||
} DCS_DISK_ENTRY_PWD_CACHE;
|
|
||||||
static_assert(sizeof(DCS_DISK_ENTRY_PWD_CACHE) == 512, "Wrong size DCS_DISK_ENTRY_PWD_CACHE");
|
|
||||||
|
|
||||||
#pragma warning(disable:4201)
|
#pragma warning(disable:4201)
|
||||||
typedef struct _DCS_DISK_ENTRY {
|
typedef struct _DCS_DISK_ENTRY {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
uint32 Type;
|
uint32 Type;
|
||||||
byte Data[28];
|
uint32 Offset;
|
||||||
|
byte reserved[16];
|
||||||
|
uint64 Length; // size of structure at Offset
|
||||||
};
|
};
|
||||||
DCS_DISK_ENTRY_SECTORS Sectors;
|
DCS_DISK_ENTRY_SECTORS Sectors;
|
||||||
DCS_DISK_ENTRY_DISKID DiskId;
|
DCS_DISK_ENTRY_DISKID DiskId;
|
||||||
|
DCS_DISK_ENTRY_PARAMS Prm;
|
||||||
};
|
};
|
||||||
} DCS_DISK_ENTRY;
|
} DCS_DISK_ENTRY;
|
||||||
#pragma warning(default:4201)
|
#pragma warning(default:4201)
|
||||||
|
static_assert(sizeof(DCS_DISK_ENTRY) == 32, "Wrong size DCS_DISK_ENTRY");
|
||||||
|
|
||||||
|
// Static compile time checks field offsets
|
||||||
|
#ifndef FIELD_OFFSET
|
||||||
|
#define FIELD_OFFSET(t, f) ((UINTN)(&((t*)0)->f))
|
||||||
|
#endif
|
||||||
|
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Type) == FIELD_OFFSET(DCS_DISK_ENTRY_SECTORS, Type), "Wrong Type offset");
|
||||||
|
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Type) == FIELD_OFFSET(DCS_DISK_ENTRY_DISKID, Type), "Wrong Type offset");
|
||||||
|
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Type) == FIELD_OFFSET(DCS_DISK_ENTRY_PARAMS, Type), "Wrong Type offset");
|
||||||
|
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Length) == FIELD_OFFSET(DCS_DISK_ENTRY_SECTORS, Length), "Wrong Length offset");
|
||||||
|
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Length) == FIELD_OFFSET(DCS_DISK_ENTRY_PARAMS, Length), "Wrong Length offset");
|
||||||
|
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Offset) == FIELD_OFFSET(DCS_DISK_ENTRY_SECTORS, Offset), "Wrong Offset offset");
|
||||||
|
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Offset) == FIELD_OFFSET(DCS_DISK_ENTRY_PARAMS, Offset), "Wrong Offset offset");
|
||||||
|
|
||||||
|
// DE type specific data
|
||||||
|
// DE List
|
||||||
typedef struct _DCS_DISK_ENTRY_LIST {
|
typedef struct _DCS_DISK_ENTRY_LIST {
|
||||||
// EFI_TABLE_HEADER
|
// EFI_TABLE_HEADER
|
||||||
uint64 Signature;
|
uint64 Signature;
|
||||||
@ -172,10 +187,28 @@ typedef struct _DCS_DISK_ENTRY_LIST {
|
|||||||
uint32 Count;
|
uint32 Count;
|
||||||
uint32 DataSize;
|
uint32 DataSize;
|
||||||
//
|
//
|
||||||
DCS_DISK_ENTRY DE[31];
|
DCS_DISK_ENTRY DE[15];
|
||||||
} DCS_DISK_ENTRY_LIST;
|
} DCS_DISK_ENTRY_LIST;
|
||||||
|
static_assert(sizeof(DCS_DISK_ENTRY_LIST) == 512, "Wrong size DCS_DISK_ENTRY_LIST");
|
||||||
|
|
||||||
|
typedef struct _DCS_DEP_EXEC {
|
||||||
|
DCS_GUID ExecPartGuid;
|
||||||
|
uint16 ExecCmd[248];
|
||||||
|
} DCS_DEP_EXEC;
|
||||||
|
static_assert(sizeof(DCS_DEP_EXEC) == 512, "Wrong size DCS_DEP_EXEC");
|
||||||
|
|
||||||
|
#define DCS_DEP_PWD_CACHE_SIGN SIGNATURE_64 ('P','W','D','C','A','C','H','E')
|
||||||
|
typedef struct _DCS_DEP_PWD_CACHE {
|
||||||
|
uint64 Sign;
|
||||||
|
uint32 CRC;
|
||||||
|
uint32 Count;
|
||||||
|
Password Pwd[4];
|
||||||
|
int32 Pim[4];
|
||||||
|
byte pad[512 - 8 - 4 - 4 - (sizeof(Password) + 4) * 4];
|
||||||
|
} DCS_DEP_PWD_CACHE;
|
||||||
|
static_assert(sizeof(DCS_DEP_PWD_CACHE) == 512, "Wrong size DCS_DEP_PWD_CACHE");
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
#endif
|
#endif // #if !defined(TC_WINDOWS_BOOT)
|
||||||
|
|
||||||
#endif // TC_HEADER_Boot_BootCommon
|
#endif // TC_HEADER_Boot_BootCommon
|
||||||
|
Loading…
Reference in New Issue
Block a user