VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Boot
diff options
context:
space:
mode:
authorAlex <kavsrf@gmail.com>2016-08-09 20:08:47 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-08-14 23:09:12 (GMT)
commit246233c40262c5be2edfa916cf841dd4bce6598e (patch)
tree75f17aeeb2aca66ac1cda709311ae710ae3d10d3 /src/Boot
parent58cff70724e9d90902a33b0718ccbe8ee4c7b329 (diff)
downloadVeraCrypt-246233c40262c5be2edfa916cf841dd4bce6598e.zip
VeraCrypt-246233c40262c5be2edfa916cf841dd4bce6598e.tar.gz
Windows EFI Bootloader: modifications to prepare EFI system encryption support (common files with DcsBoot)
Diffstat (limited to 'src/Boot')
-rw-r--r--src/Boot/Windows/BootCommon.h101
-rw-r--r--src/Boot/Windows/BootDefs.h9
2 files changed, 109 insertions, 1 deletions
diff --git a/src/Boot/Windows/BootCommon.h b/src/Boot/Windows/BootCommon.h
index 0d4f710..bc1300b 100644
--- a/src/Boot/Windows/BootCommon.h
+++ b/src/Boot/Windows/BootCommon.h
@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0.
- Modifications and additions to the original source code (contained in this file)
+ Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -78,5 +78,104 @@ typedef struct
#define TC_SET_BOOT_ARGUMENTS_SIGNATURE(SG) do { SG[0] = 'T'; SG[1] = 'R'; SG[2] = 'U'; SG[3] = 'E'; SG[4] = 0x11; SG[5] = 0x23; SG[6] = 0x45; SG[7] = 0x66; } while (FALSE)
#define TC_IS_BOOT_ARGUMENTS_SIGNATURE(SG) (SG[0] == 'T' && SG[1] == 'R' && SG[2] == 'U' && SG[3] == 'E' && SG[4] == 0x11 && SG[5] == 0x23 && SG[6] == 0x45 && SG[7] == 0x66)
+#if !defined(TC_WINDOWS_BOOT)
+
+#define DCS_DISK_ENTRY_LIST_HEADER_ID SIGNATURE_64 ('D','C','S','D','E','L','S','T')
+
+#define DE_IDX_CRYPTOHEADER 0
+#define DE_IDX_LIST 1
+#define DE_IDX_DISKID 2
+#define DE_IDX_MAINGPTHDR 3
+#define DE_IDX_MAINGPTENTRYS 4
+#define DE_IDX_ALTGPTHDR 5
+#define DE_IDX_ALTGPTENTRYS 6
+#define DE_IDX_EXECPARAMS 7
+#define DE_IDX_PWDCACHE 8
+#define DE_IDX_TOTAL 9
+
+enum DcsDiskEntryTypes {
+ DE_Unused = 0,
+ DE_Sectors,
+ DE_List,
+ DE_DISKID,
+ DE_ExecParams,
+ DE_PwdCache
+};
+
+#pragma pack(1)
+typedef struct _SECREGION_BOOT_PARAMS {
+ uint64 Ptr;
+ uint32 Size;
+ uint32 Crc;
+} 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 {
+ uint32 Data1;
+ uint16 Data2;
+ uint16 Data3;
+ byte Data4[8];
+} DCS_GUID;
+
+typedef struct _DCS_DISK_ENTRY_DISKID {
+ uint32 Type;
+ uint32 MbrID;
+ uint64 ReservedDiskId;
+ DCS_GUID GptID;
+} 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)
+typedef struct _DCS_DISK_ENTRY {
+ union {
+ struct {
+ uint32 Type;
+ byte Data[28];
+ };
+ DCS_DISK_ENTRY_SECTORS Sectors;
+ DCS_DISK_ENTRY_DISKID DiskId;
+ };
+} DCS_DISK_ENTRY;
+#pragma warning(default:4201)
+
+typedef struct _DCS_DISK_ENTRY_LIST {
+ // EFI_TABLE_HEADER
+ uint64 Signature;
+ uint32 Revision;
+ uint32 HeaderSize; //< The size, in bytes, of the entire table including the EFI_TABLE_HEADER.
+ uint32 CRC32; //< The 32-bit CRC for the entire table. This value is computed by setting this field to 0, and computing the 32-bit CRC for HeaderSize bytes.
+ uint32 Reserved; //< Reserved field that must be set to 0.
+ //
+ uint32 Count;
+ uint32 DataSize;
+ //
+ DCS_DISK_ENTRY DE[31];
+} DCS_DISK_ENTRY_LIST;
+#pragma pack()
+
+#endif
#endif // TC_HEADER_Boot_BootCommon
diff --git a/src/Boot/Windows/BootDefs.h b/src/Boot/Windows/BootDefs.h
index fe245a8..3db227f 100644
--- a/src/Boot/Windows/BootDefs.h
+++ b/src/Boot/Windows/BootDefs.h
@@ -102,6 +102,7 @@
#define TC__BOOT_USER_CFG_FLAG_DISABLE_ESC TC_HEX (02)
#define TC__BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION TC_HEX (04)
#define TC__BOOT_USER_CFG_FLAG_DISABLE_PIM TC_HEX (08)
+#define TC__BOOT_USER_CFG_FLAG_STORE_HASH TC_HEX (10)
// The following items are treated as a 2-bit value (apply TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE to obtain the value)
#define TC__HIDDEN_OS_CREATION_PHASE_NONE 0
@@ -191,6 +192,7 @@ TC_HIDDEN_OS_CREATION_PHASE_WIPED = TC__HIDDEN_OS_CREATION_PHASE_WIPED
#define TC_BOOT_USER_CFG_FLAG_DISABLE_ESC TC__BOOT_USER_CFG_FLAG_DISABLE_ESC
#define TC_BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION TC__BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION
#define TC_BOOT_USER_CFG_FLAG_DISABLE_PIM TC__BOOT_USER_CFG_FLAG_DISABLE_PIM
+#define TC_BOOT_USER_CFG_FLAG_STORE_HASH TC__BOOT_USER_CFG_FLAG_STORE_HASH
#define TC_HIDDEN_OS_CREATION_PHASE_NONE TC__HIDDEN_OS_CREATION_PHASE_NONE
#define TC_HIDDEN_OS_CREATION_PHASE_CLONING TC__HIDDEN_OS_CREATION_PHASE_CLONING
#define TC_HIDDEN_OS_CREATION_PHASE_WIPING TC__HIDDEN_OS_CREATION_PHASE_WIPING
@@ -198,4 +200,11 @@ TC_HIDDEN_OS_CREATION_PHASE_WIPED = TC__HIDDEN_OS_CREATION_PHASE_WIPED
#endif // TC_ASM_PREPROCESS
+#define EFI_BOOTARGS_REGIONS_LOW 0x90000, 0x88000, 0x80000
+#define EFI_BOOTARGS_REGIONS_HIGH \
+0x100000, 0x200000, 0x300000, 0x400000, 0x500000, 0x600000, 0x700000, 0x800000, \
+0x900000, 0xA00000, 0xB00000, 0xC00000, 0xD00000, 0xE00000, 0xF00000, 0x1000000
+
+#define EFI_BOOTARGS_REGIONS EFI_BOOTARGS_REGIONS_LOW, EFI_BOOTARGS_REGIONS_HIGH
+
#endif // TC_HEADER_Boot_BootDefs