Skip to content
This repository was archived by the owner on Mar 15, 2020. It is now read-only.

Commit 4033160

Browse files
author
Richard Harman
committed
initial commit
0 parents  commit 4033160

File tree

252 files changed

+96916
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

252 files changed

+96916
-0
lines changed

Boot/Windows/Bios.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved.
3+
4+
Governed by the TrueCrypt License 3.0 the full text of which is contained in
5+
the file License.txt included in TrueCrypt binary and source code distribution
6+
packages.
7+
*/
8+
9+
#ifndef TC_HEADER_Boot_Bios
10+
#define TC_HEADER_Boot_Bios
11+
12+
#include "Platform.h"
13+
14+
#define TC_LB_SIZE_BIT_SHIFT_DIVISOR 9
15+
16+
#define TC_FIRST_BIOS_DRIVE 0x80
17+
#define TC_LAST_BIOS_DRIVE 0x8f
18+
#define TC_INVALID_BIOS_DRIVE (TC_FIRST_BIOS_DRIVE - 1)
19+
20+
enum
21+
{
22+
BiosResultSuccess = 0x00,
23+
BiosResultInvalidFunction = 0x01
24+
};
25+
26+
typedef byte BiosResult;
27+
28+
#endif // TC_HEADER_Boot_Bios

Boot/Windows/Boot.vcproj

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
<?xml version="1.0" encoding="Windows-1252"?>
2+
<VisualStudioProject
3+
ProjectType="Visual C++"
4+
Version="9.00"
5+
Name="Boot"
6+
ProjectGUID="{8B7F059F-E4C7-4E11-88F5-EE8B8433072E}"
7+
RootNamespace="Boot"
8+
Keyword="MakeFileProj"
9+
TargetFrameworkVersion="131072"
10+
>
11+
<Platforms>
12+
<Platform
13+
Name="Win32"
14+
/>
15+
</Platforms>
16+
<ToolFiles>
17+
</ToolFiles>
18+
<Configurations>
19+
<Configuration
20+
Name="Release|Win32"
21+
OutputDirectory="$(ConfigurationName)"
22+
IntermediateDirectory="$(ConfigurationName)"
23+
ConfigurationType="0"
24+
>
25+
<Tool
26+
Name="VCNMakeTool"
27+
BuildCommandLine="md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1&#x0D;&#x0A;&#x0D;&#x0A;md Release_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES&#x0D;&#x0A;&#x0D;&#x0A;md Release_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT&#x0D;&#x0A;&#x0D;&#x0A;md Release_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH&#x0D;&#x0A;&#x0D;&#x0A;md Rescue 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1"
28+
ReBuildCommandLine="del /q /s Release &gt;NUL:&#x0D;&#x0A;md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_AES &gt;NUL:&#x0D;&#x0A;md Release_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Serpent &gt;NUL:&#x0D;&#x0A;md Release_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Twofish &gt;NUL:&#x0D;&#x0A;md Release_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue &gt;NUL:&#x0D;&#x0A;md Rescue 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_AES &gt;NUL:&#x0D;&#x0A;md Rescue_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_Serpent &gt;NUL:&#x0D;&#x0A;md Rescue_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_Twofish &gt;NUL:&#x0D;&#x0A;md Rescue_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1"
29+
CleanCommandLine="del /q /s Release Release_AES Release_Serpent Release_Twofish Rescue Rescue_AES Rescue_Serpent Rescue_Twofish &gt;NUL:"
30+
Output="Release\BootLoader.com"
31+
PreprocessorDefinitions="WIN32;NDEBUG"
32+
IncludeSearchPath="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)\Common&quot;;&quot;$(SolutionDir)\Crypto&quot;;&quot;$(MSVC16_ROOT)\Include&quot;"
33+
ForcedIncludes=""
34+
AssemblySearchPath=""
35+
ForcedUsingAssemblies=""
36+
CompileAsManaged=""
37+
/>
38+
</Configuration>
39+
<Configuration
40+
Name="Release Loader|Win32"
41+
OutputDirectory="$(ConfigurationName)"
42+
IntermediateDirectory="$(ConfigurationName)"
43+
ConfigurationType="0"
44+
>
45+
<Tool
46+
Name="VCNMakeTool"
47+
BuildCommandLine="md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1&#x0D;&#x0A;&#x0D;&#x0A;md Release_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES&#x0D;&#x0A;&#x0D;&#x0A;md Release_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT&#x0D;&#x0A;&#x0D;&#x0A;md Release_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH"
48+
ReBuildCommandLine="del /q /s Release &gt;NUL:&#x0D;&#x0A;md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_AES &gt;NUL:&#x0D;&#x0A;md Release_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Serpent &gt;NUL:&#x0D;&#x0A;md Release_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Twofish &gt;NUL:&#x0D;&#x0A;md Release_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH"
49+
CleanCommandLine="del /q /s Release Release_AES Release_Serpent Release_Twofish &gt;NUL:"
50+
Output="Release\BootLoader.com"
51+
PreprocessorDefinitions="WIN32;NDEBUG"
52+
IncludeSearchPath="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)\Common&quot;;&quot;$(SolutionDir)\Crypto&quot;;&quot;$(MSVC16_ROOT)\Include&quot;"
53+
ForcedIncludes=""
54+
AssemblySearchPath=""
55+
ForcedUsingAssemblies=""
56+
CompileAsManaged=""
57+
/>
58+
</Configuration>
59+
</Configurations>
60+
<References>
61+
</References>
62+
<Files>
63+
<Filter
64+
Name="Source Files"
65+
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
66+
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
67+
>
68+
<File
69+
RelativePath=".\BootConfig.cpp"
70+
>
71+
</File>
72+
<File
73+
RelativePath=".\BootConsoleIo.cpp"
74+
>
75+
</File>
76+
<File
77+
RelativePath=".\BootCrt.asm"
78+
>
79+
</File>
80+
<File
81+
RelativePath=".\BootDebug.cpp"
82+
>
83+
</File>
84+
<File
85+
RelativePath=".\BootDiskIo.cpp"
86+
>
87+
</File>
88+
<File
89+
RelativePath=".\BootEncryptedIo.cpp"
90+
>
91+
</File>
92+
<File
93+
RelativePath=".\BootMain.cpp"
94+
>
95+
</File>
96+
<File
97+
RelativePath=".\BootMemory.cpp"
98+
>
99+
</File>
100+
<File
101+
RelativePath=".\BootSector.asm"
102+
>
103+
</File>
104+
<File
105+
RelativePath=".\Decompressor.c"
106+
>
107+
</File>
108+
<File
109+
RelativePath=".\IntFilter.cpp"
110+
>
111+
</File>
112+
<File
113+
RelativePath=".\Platform.cpp"
114+
>
115+
</File>
116+
<Filter
117+
Name="Common"
118+
>
119+
<File
120+
RelativePath="..\..\Common\Crc.c"
121+
>
122+
</File>
123+
<File
124+
RelativePath="..\..\Common\Crypto.c"
125+
>
126+
</File>
127+
<File
128+
RelativePath="..\..\Common\Endian.c"
129+
>
130+
</File>
131+
<File
132+
RelativePath="..\..\Common\Pkcs5.c"
133+
>
134+
</File>
135+
<File
136+
RelativePath="..\..\Common\Volumes.c"
137+
>
138+
</File>
139+
<File
140+
RelativePath="..\..\Common\Xts.c"
141+
>
142+
</File>
143+
</Filter>
144+
<Filter
145+
Name="Crypto"
146+
>
147+
<File
148+
RelativePath="..\..\Crypto\Aes_hw_cpu.asm"
149+
>
150+
</File>
151+
<File
152+
RelativePath="..\..\Crypto\AesSmall.c"
153+
>
154+
</File>
155+
<File
156+
RelativePath="..\..\Crypto\AesSmall_x86.asm"
157+
>
158+
</File>
159+
<File
160+
RelativePath="..\..\Crypto\Rmd160.c"
161+
>
162+
</File>
163+
<File
164+
RelativePath="..\..\Crypto\Serpent.c"
165+
>
166+
</File>
167+
<File
168+
RelativePath="..\..\Crypto\Twofish.c"
169+
>
170+
</File>
171+
</Filter>
172+
</Filter>
173+
<Filter
174+
Name="Header Files"
175+
Filter="h;hpp;hxx;hm;inl;inc;xsd"
176+
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
177+
>
178+
<File
179+
RelativePath=".\Bios.h"
180+
>
181+
</File>
182+
<File
183+
RelativePath=".\BootCommon.h"
184+
>
185+
</File>
186+
<File
187+
RelativePath=".\BootConfig.h"
188+
>
189+
</File>
190+
<File
191+
RelativePath=".\BootConsoleIo.h"
192+
>
193+
</File>
194+
<File
195+
RelativePath=".\BootDebug.h"
196+
>
197+
</File>
198+
<File
199+
RelativePath=".\BootDefs.h"
200+
>
201+
</File>
202+
<File
203+
RelativePath=".\BootDiskIo.h"
204+
>
205+
</File>
206+
<File
207+
RelativePath=".\BootEncryptedIo.h"
208+
>
209+
</File>
210+
<File
211+
RelativePath=".\BootMain.h"
212+
>
213+
</File>
214+
<File
215+
RelativePath=".\BootMemory.h"
216+
>
217+
</File>
218+
<File
219+
RelativePath=".\BootStrings.h"
220+
>
221+
</File>
222+
<File
223+
RelativePath=".\IntFilter.h"
224+
>
225+
</File>
226+
<File
227+
RelativePath=".\Platform.h"
228+
>
229+
</File>
230+
</Filter>
231+
<Filter
232+
Name="Build Files"
233+
>
234+
<File
235+
RelativePath=".\Makefile"
236+
>
237+
</File>
238+
</Filter>
239+
</Files>
240+
<Globals>
241+
</Globals>
242+
</VisualStudioProject>

Boot/Windows/BootCommon.h

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
Copyright (c) 2008 TrueCrypt Developers Association. All rights reserved.
3+
4+
Governed by the TrueCrypt License 3.0 the full text of which is contained in
5+
the file License.txt included in TrueCrypt binary and source code distribution
6+
packages.
7+
*/
8+
9+
#ifndef TC_HEADER_Boot_BootCommon
10+
#define TC_HEADER_Boot_BootCommon
11+
12+
#include "Common/Password.h"
13+
#include "BootDefs.h"
14+
15+
// The user will be advised to upgrade the rescue disk if upgrading from the following or any previous version
16+
#define TC_RESCUE_DISK_UPGRADE_NOTICE_MAX_VERSION 0x060a
17+
18+
#define TC_BOOT_LOADER_AREA_SIZE (TC_BOOT_LOADER_AREA_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS)
19+
20+
#define TC_BOOT_VOLUME_HEADER_SECTOR (TC_BOOT_LOADER_AREA_SECTOR_COUNT - 1)
21+
#define TC_BOOT_VOLUME_HEADER_SECTOR_OFFSET (TC_BOOT_VOLUME_HEADER_SECTOR * TC_SECTOR_SIZE_BIOS)
22+
23+
#define TC_CD_BOOTSECTOR_OFFSET 0xd000
24+
#define TC_CD_BOOT_LOADER_SECTOR 26
25+
26+
#define TC_ORIG_BOOT_LOADER_BACKUP_SECTOR TC_BOOT_LOADER_AREA_SECTOR_COUNT
27+
#define TC_ORIG_BOOT_LOADER_BACKUP_SECTOR_OFFSET (TC_ORIG_BOOT_LOADER_BACKUP_SECTOR * TC_SECTOR_SIZE_BIOS)
28+
29+
#define TC_BOOT_LOADER_BACKUP_RESCUE_DISK_SECTOR (TC_ORIG_BOOT_LOADER_BACKUP_SECTOR + TC_BOOT_LOADER_AREA_SECTOR_COUNT)
30+
#define TC_BOOT_LOADER_BACKUP_RESCUE_DISK_SECTOR_OFFSET (TC_BOOT_LOADER_BACKUP_RESCUE_DISK_SECTOR * TC_SECTOR_SIZE_BIOS)
31+
32+
#define TC_MBR_SECTOR 0
33+
#define TC_MAX_MBR_BOOT_CODE_SIZE 440
34+
35+
#define TC_MAX_EXTRA_BOOT_PARTITION_SIZE (512UL * 1024UL * 1024UL)
36+
37+
38+
#pragma pack (1)
39+
40+
typedef struct
41+
{
42+
byte Flags;
43+
} BootSectorConfiguration;
44+
45+
46+
// Modifying this value can introduce incompatibility with previous versions
47+
#define TC_BOOT_LOADER_ARGS_OFFSET 0x10
48+
49+
typedef struct
50+
{
51+
// Modifying this structure can introduce incompatibility with previous versions
52+
char Signature[8];
53+
uint16 BootLoaderVersion;
54+
uint16 CryptoInfoOffset;
55+
uint16 CryptoInfoLength;
56+
uint32 HeaderSaltCrc32;
57+
Password BootPassword;
58+
uint64 HiddenSystemPartitionStart;
59+
uint64 DecoySystemPartitionStart;
60+
uint32 Flags;
61+
uint32 BootDriveSignature;
62+
63+
uint32 BootArgumentsCrc32;
64+
65+
} BootArguments;
66+
67+
// Modifying these values can introduce incompatibility with previous versions
68+
#define TC_BOOT_ARGS_FLAG_EXTRA_BOOT_PARTITION 0x1
69+
70+
#pragma pack ()
71+
72+
// Boot arguments signature should not be defined as a static string
73+
// Modifying these values can introduce incompatibility with previous versions
74+
#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)
75+
#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)
76+
77+
78+
#endif // TC_HEADER_Boot_BootCommon

0 commit comments

Comments
 (0)