Skip to content

Commit

Permalink
TrueCrypt Source Version 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Truecrypt Foundation authored and FreeApophis committed May 29, 2014
1 parent 0296212 commit e1850f7
Show file tree
Hide file tree
Showing 395 changed files with 72,243 additions and 10,993 deletions.
29 changes: 29 additions & 0 deletions Boot/Windows/Bios.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
Governed by the TrueCrypt License 2.4 the full text of which is contained
in the file License.txt included in TrueCrypt binary and source code
distribution packages.
*/

#ifndef TC_HEADER_Boot_Bios
#define TC_HEADER_Boot_Bios

#include "Platform.h"

#define TC_LB_SIZE 512
#define TC_LB_SIZE_BIT_SHIFT_DIVISOR 9

#define TC_FIRST_BIOS_DRIVE 0x80
#define TC_LAST_BIOS_DRIVE 0x8f

enum
{
BiosResultSuccess = 0x00,
BiosResultInvalidFunction = 0x01,
BiosResultEccCorrected = 0x11
};

typedef byte BiosResult;

#endif // TC_HEADER_Boot_Bios
217 changes: 217 additions & 0 deletions Boot/Windows/Boot.vcproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="Boot"
ProjectGUID="{8B7F059F-E4C7-4E11-88F5-EE8B8433072E}"
RootNamespace="Boot"
Keyword="MakeFileProj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="md Debug 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo DEBUG=1"
ReBuildCommandLine="md Debug 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo DEBUG=1 clean&#x0D;&#x0A;nmake.exe /nologo DEBUG=1"
CleanCommandLine="nmake.exe /nologo DEBUG=1 clean"
Output="Debug\Boot.exe"
PreprocessorDefinitions="WIN32;_DEBUG"
IncludeSearchPath="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)\Common&quot;;&quot;$(SolutionDir)\Crypto&quot;;&quot;$(MSVC16_ROOT)\Include&quot;"
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1"
ReBuildCommandLine="md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 clean&#x0D;&#x0A;nmake.exe /nologo RELEASE=1"
CleanCommandLine="nmake.exe /nologo RELEASE=1 clean"
Output="Release\Boot.com"
PreprocessorDefinitions="WIN32;NDEBUG"
IncludeSearchPath="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)\Common&quot;;&quot;$(SolutionDir)\Crypto&quot;;&quot;$(MSVC16_ROOT)\Include&quot;"
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\BootConfig.cpp"
>
</File>
<File
RelativePath=".\BootConsoleIo.cpp"
>
</File>
<File
RelativePath=".\BootCrt.asm"
>
</File>
<File
RelativePath=".\BootDebug.cpp"
>
</File>
<File
RelativePath=".\BootDiskIo.cpp"
>
</File>
<File
RelativePath=".\BootEncryptedIo.cpp"
>
</File>
<File
RelativePath=".\BootMain.cpp"
>
</File>
<File
RelativePath=".\BootSector.asm"
>
</File>
<File
RelativePath=".\IntFilter.cpp"
>
</File>
<File
RelativePath=".\Platform.cpp"
>
</File>
<Filter
Name="Common"
>
<File
RelativePath="..\..\Common\Crc.c"
>
</File>
<File
RelativePath="..\..\Common\Crypto.c"
>
</File>
<File
RelativePath="..\..\Common\Endian.c"
>
</File>
<File
RelativePath="..\..\Common\Pkcs5.c"
>
</File>
<File
RelativePath="..\..\Common\Volumes.c"
>
</File>
<File
RelativePath="..\..\Common\Xts.c"
>
</File>
</Filter>
<Filter
Name="Crypto"
>
<File
RelativePath="..\..\Crypto\AesSmall.c"
>
</File>
<File
RelativePath="..\..\Crypto\Rmd160.c"
>
</File>
<File
RelativePath="..\..\Crypto\Serpent.c"
>
</File>
<File
RelativePath="..\..\Crypto\Twofish.c"
>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\Bios.h"
>
</File>
<File
RelativePath=".\BootCommon.h"
>
</File>
<File
RelativePath=".\BootConfig.h"
>
</File>
<File
RelativePath=".\BootConsoleIo.h"
>
</File>
<File
RelativePath=".\BootDebug.h"
>
</File>
<File
RelativePath=".\BootDefs.h"
>
</File>
<File
RelativePath=".\BootDiskIo.h"
>
</File>
<File
RelativePath=".\BootEncryptedIo.h"
>
</File>
<File
RelativePath=".\BootMain.h"
>
</File>
<File
RelativePath=".\IntFilter.h"
>
</File>
<File
RelativePath=".\Platform.h"
>
</File>
</Filter>
<Filter
Name="Build Files"
>
<File
RelativePath=".\Makefile"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
63 changes: 63 additions & 0 deletions Boot/Windows/BootCommon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
Governed by the TrueCrypt License 2.4 the full text of which is contained
in the file License.txt included in TrueCrypt binary and source code
distribution packages.
*/

#ifndef TC_HEADER_Boot_BootCommon
#define TC_HEADER_Boot_BootCommon

#include "Password.h"
#include "BootDefs.h"


#define TC_BOOT_LOADER_AREA_SIZE (TC_BOOT_LOADER_AREA_SECTOR_COUNT * SECTOR_SIZE)

#define TC_BOOT_VOLUME_HEADER_SECTOR (TC_BOOT_LOADER_AREA_SECTOR_COUNT - 1)
#define TC_BOOT_VOLUME_HEADER_SECTOR_OFFSET (TC_BOOT_VOLUME_HEADER_SECTOR * SECTOR_SIZE)

#define TC_CD_BOOTSECTOR_OFFSET 0xd000
#define TC_CD_BOOT_LOADER_SECTOR 26

#define TC_ORIG_BOOT_LOADER_BACKUP_SECTOR TC_BOOT_LOADER_AREA_SECTOR_COUNT
#define TC_ORIG_BOOT_LOADER_BACKUP_SECTOR_OFFSET (TC_ORIG_BOOT_LOADER_BACKUP_SECTOR * SECTOR_SIZE)

#define TC_MBR_SECTOR 0
#define TC_MAX_MBR_BOOT_CODE_SIZE 440

#define TC_BOOT_CFG_FLAG_RESCUE_DISK 0x10
#define TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER 0x20

#pragma pack (1)

typedef struct
{
byte Flags;
} BootSectorConfiguration;


// Modifying this value can introduce incompatibility with previous versions
#define TC_BOOT_LOADER_ARGS_OFFSET 0x10

typedef struct
{
// Modifying this structure can introduce incompatibility with previous versions
char Signature[8];
uint16 BootLoaderVersion;
uint16 CryptoInfoOffset;
uint16 CryptoInfoLength;
uint32 HeaderSaltCrc32;
Password BootPassword;
} BootArguments;

#pragma pack ()

// Boot arguments signature should not be defined as a static string
// Modifying these values can introduce incompatibility with previous versions
#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)


#endif // TC_HEADER_Boot_BootCommon
19 changes: 19 additions & 0 deletions Boot/Windows/BootConfig.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
Governed by the TrueCrypt License 2.4 the full text of which is contained
in the file License.txt included in TrueCrypt binary and source code
distribution packages.
*/

#include "BootConfig.h"

byte BootSectorFlags;

byte BootLoaderDrive;
byte BootDrive;
bool BootDriveGeometryValid = false;
DriveGeometry BootDriveGeometry;

CRYPTO_INFO *BootCryptoInfo;
Partition EncryptedVirtualPartition;
26 changes: 26 additions & 0 deletions Boot/Windows/BootConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
Governed by the TrueCrypt License 2.4 the full text of which is contained
in the file License.txt included in TrueCrypt binary and source code
distribution packages.
*/

#ifndef TC_HEADER_Boot_BootConfig
#define TC_HEADER_Boot_BootConfig

#include "Crypto.h"
#include "Platform.h"
#include "BootDiskIo.h"

extern byte BootSectorFlags;

extern byte BootLoaderDrive;
extern byte BootDrive;
extern bool BootDriveGeometryValid;
extern DriveGeometry BootDriveGeometry;

extern CRYPTO_INFO *BootCryptoInfo;
extern Partition EncryptedVirtualPartition;

#endif // TC_HEADER_Boot_BootConfig
Loading

0 comments on commit e1850f7

Please sign in to comment.