Skip to content

Commit

Permalink
TrueCrypt Source Version 2.1
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 f3e7058 commit f9b325a
Show file tree
Hide file tree
Showing 80 changed files with 2,071 additions and 1,608 deletions.
8 changes: 6 additions & 2 deletions Common/APIDRVR.H
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

/* DeviceIoControl values.
Expand Down
8 changes: 6 additions & 2 deletions Common/CACHE.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

#include "tcdefs.h"

Expand Down
8 changes: 6 additions & 2 deletions Common/CACHE.H
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

extern char szDriverPassword[4][MAX_PASSWORD + 1];
extern int nDriverPasswordLen[4];
Expand Down
8 changes: 6 additions & 2 deletions Common/CMDLINE.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

#include "TCdefs.h"

Expand Down
8 changes: 6 additions & 2 deletions Common/CMDLINE.H
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

#define HAS_ARGUMENT 1
#define HAS_NO_ARGUMENT !HAS_ARGUMENT
Expand Down
8 changes: 6 additions & 2 deletions Common/COMBO.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

#include "TCdefs.h"
#include "combo.h"
Expand Down
8 changes: 6 additions & 2 deletions Common/COMBO.H
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */


/* Everything below this line is automatically updated by the -mkproto-tool- */
Expand Down
8 changes: 6 additions & 2 deletions Common/CRC.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

#include "TCdefs.h"
#include "crc.h"
Expand Down
8 changes: 6 additions & 2 deletions Common/CRC.H
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

extern unsigned long crc_32_tab[];

Expand Down
8 changes: 6 additions & 2 deletions Common/CRYPTO.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

#include "TCdefs.h"
#include "crypto.h"
Expand Down
13 changes: 9 additions & 4 deletions Common/CRYPTO.H
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */


// User text input limits
Expand Down Expand Up @@ -30,6 +34,7 @@
// PKCS5 PRF hash algorithm ID
#define SHA1 1
#define RIPEMD160 2
#define LAST_PRF_ID 2 // Last PRF used for volume encryption

/* The encryption algorithm ID */
#define NONE 0
Expand Down Expand Up @@ -59,9 +64,9 @@
#include "blowfish.h"
#include "aes.h"
#include "idea.h"
#include "sha.h"
#include "sha1.h"
#include "cast.h"
#include "sha1.h"
#include "rmd160.h"

/* _cdecl is needed here because the device driver defaults to stdcall */
typedef void (_cdecl * sector_func) (unsigned long *, unsigned __int64, unsigned long,
Expand Down
33 changes: 22 additions & 11 deletions Common/DISMOUNT.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

/* WARNING: The code for unmounting volumes is ugly for all Windows versions;
becarefull what you change here as there might be unintended side effects
Expand Down Expand Up @@ -31,8 +35,8 @@ UnmountAllVolumes (HWND hwndDlg, DWORD * os_error, int *err)
{
MOUNT_LIST_STRUCT driver;
DWORD dwResult;
BOOL bResult, bOK = TRUE;
int i;
BOOL bResult;
int i, nMounted = 0;

*os_error = 0;
*err = 0;
Expand All @@ -48,20 +52,27 @@ UnmountAllVolumes (HWND hwndDlg, DWORD * os_error, int *err)
}

for (i = 0; i < 26; i++)
if (driver.ulMountedDrives & 1 << i) nMounted++;

// Dismount is tried in multiple rounds to ensure dismount of nested containers
while (driver.ulMountedDrives != 0 && nMounted--)
{
if ((driver.ulMountedDrives & 1 << i))
for (i = 0; i < 26; i++)
{
UnmountVolume (i, os_error, err);
if (driver.ulMountedDrives & 1 << i)
{
UnmountVolume (i, os_error, err);

if (*err != 0)
bOK = FALSE;
if (*err == 0)
driver.ulMountedDrives &= ~(1 << i);

if (*err != 0 && *err == ERR_OS_ERROR)
handleWin32Error (hwndDlg);
if (*err != 0 && *err == ERR_OS_ERROR)
handleWin32Error (hwndDlg);
}
}
}

return bOK;
return driver.ulMountedDrives == 0;
}

BOOL
Expand Down
8 changes: 6 additions & 2 deletions Common/DISMOUNT.H
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

/* Everything below this line is automatically updated by the -mkproto-tool- */

Expand Down
8 changes: 6 additions & 2 deletions Common/DLGCODE.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

#include "TCdefs.h"

Expand Down
8 changes: 6 additions & 2 deletions Common/DLGCODE.H
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

#define IDC_ABOUT 0x7fff /* ID for AboutBox on system menu in wm_user
range */
Expand Down
8 changes: 6 additions & 2 deletions Common/ENDIAN.C
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

#include "TCdefs.h"
#include "endian.h"
Expand Down
8 changes: 6 additions & 2 deletions Common/ENDIAN.H
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

#define mputLong(memPtr,data) \
*memPtr++ = ( unsigned char ) ( ( ( data ) >> 24 ) & 0xFF ), \
Expand Down
52 changes: 13 additions & 39 deletions Common/FAT.C
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

#include "TCdefs.h"

#include "crypto.h"
#include "random.h"
#include "format.h"
#include "fat.h"
#include "progress.h"


#include <time.h>

#define WRITE_BUF_SIZE 65536

void
GetFatParams (fatparams * ft)
Expand Down Expand Up @@ -236,47 +239,17 @@ PutFSInfo (unsigned char *sector)
sector[508+0]=0x00;
}

BOOL
WriteSector (HFILE dev, char *sector,
char *write_buf, int *write_buf_cnt,
__int64 *nSecNo, int *progress, PCRYPTO_INFO cryptoInfo,
int nFrequency, diskio_f write)
{
(*cryptoInfo->encrypt_sector) ((unsigned long *) sector,
(*nSecNo)++, 1, cryptoInfo->ks, cryptoInfo->iv, cryptoInfo->cipher);
memcpy (write_buf + *write_buf_cnt, sector, SECTOR_SIZE);
(*write_buf_cnt) += SECTOR_SIZE;


if (*write_buf_cnt == WRITE_BUF_SIZE)
{
if ((*write) (dev, write_buf, WRITE_BUF_SIZE) == HFILE_ERROR)
return FALSE;
else
*write_buf_cnt = 0;
}

if (++(*progress) == nFrequency)
{
if (UpdateProgressBar (*nSecNo) == TRUE)
return FALSE;
*progress = 0;
}

return TRUE;

}

int
Format (fatparams * ft, HFILE dev, PCRYPTO_INFO cryptoInfo, int nFrequency, diskio_f write, BOOL quickFormat)
FormatFat (fatparams * ft, char *header, HFILE dev, PCRYPTO_INFO cryptoInfo, int nFrequency, diskio_f write, BOOL quickFormat)
{
int write_buf_cnt = 0;
char sector[SECTOR_SIZE], *write_buf;
int progress = 0;
unsigned __int64 nSecNo = 1;
int x, n;

if ((*write) (dev, (char *) &ft->header, SECTOR_SIZE) == HFILE_ERROR)
if ((*write) (dev, header, SECTOR_SIZE) == HFILE_ERROR)
return ERR_OS_ERROR;

write_buf = TCalloc (WRITE_BUF_SIZE);
Expand Down Expand Up @@ -406,13 +379,14 @@ Format (fatparams * ft, HFILE dev, PCRYPTO_INFO cryptoInfo, int nFrequency, disk
cryptoInfo, nFrequency, write) == FALSE)
goto fail;
}
UpdateProgressBar (nSecNo);
}

else
UpdateProgressBar (ft->num_sectors);

if (write_buf_cnt != 0 && (*write) (dev, write_buf, write_buf_cnt) == HFILE_ERROR)
goto fail;

UpdateProgressBar (nSecNo);

TCfree (write_buf);
return 0;

Expand Down
14 changes: 8 additions & 6 deletions Common/FAT.H
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
/* Copyright (C) 2004 TrueCrypt Foundation
This product uses components written by Paul Le Roux <[email protected]> */
/* The source code contained in this file has been derived from the source code
of Encryption for the Masses 2.02a by Paul Le Roux. Modifications and
additions to that source code contained in this file are Copyright (c) 2004
TrueCrypt Team and Copyright (c) 2004 TrueCrypt Foundation. Unmodified
parts are Copyright (c) 1998-99 Paul Le Roux. This is a TrueCrypt Foundation
release. Please see the file license.txt for full license details. */

typedef struct fatparams_t
{
char volume_name[11];
int num_sectors; /* total number of sectors */
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 */
int size_fat; /* size of FAT */
Expand All @@ -22,7 +26,6 @@ typedef struct fatparams_t
int heads;
int secs_track;

char header[SECTOR_SIZE];
} fatparams;


Expand Down Expand Up @@ -60,5 +63,4 @@ struct msdos_boot_sector

void GetFatParams ( fatparams *ft );
void PutBoot ( fatparams *ft , unsigned char *boot );
BOOL WriteSector ( HFILE dev , char *sector , char *write_buf , int *write_buf_cnt , __int64 *nSecNo , int *progress , PCRYPTO_INFO cryptoInfo , int nFrequency , diskio_f write );
int Format (fatparams * ft, HFILE dev, PCRYPTO_INFO cryptoInfo, int nFrequency, diskio_f write, BOOL quickFormat);
int FormatFat (fatparams * ft, char * header, HFILE dev, PCRYPTO_INFO cryptoInfo, int nFrequency, diskio_f write, BOOL quickFormat);
Loading

0 comments on commit f9b325a

Please sign in to comment.