diff --git a/Common/APIDRVR.H b/Common/APIDRVR.H index ee49848..3612be4 100644 --- a/Common/APIDRVR.H +++ b/Common/APIDRVR.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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. diff --git a/Common/CACHE.C b/Common/CACHE.C index 50dec40..38cae53 100644 --- a/Common/CACHE.C +++ b/Common/CACHE.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" diff --git a/Common/CACHE.H b/Common/CACHE.H index 7cfcc22..09121b0 100644 --- a/Common/CACHE.H +++ b/Common/CACHE.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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]; diff --git a/Common/CMDLINE.C b/Common/CMDLINE.C index 0b170f4..af97343 100644 --- a/Common/CMDLINE.C +++ b/Common/CMDLINE.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" diff --git a/Common/CMDLINE.H b/Common/CMDLINE.H index 1ee6f89..65ac28b 100644 --- a/Common/CMDLINE.H +++ b/Common/CMDLINE.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 diff --git a/Common/COMBO.C b/Common/COMBO.C index 943cafa..cd47874 100644 --- a/Common/COMBO.C +++ b/Common/COMBO.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" diff --git a/Common/COMBO.H b/Common/COMBO.H index fc99bf3..5a1de45 100644 --- a/Common/COMBO.H +++ b/Common/COMBO.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ diff --git a/Common/CRC.C b/Common/CRC.C index 1f585dd..a4b9c4f 100644 --- a/Common/CRC.C +++ b/Common/CRC.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" diff --git a/Common/CRC.H b/Common/CRC.H index f64b6e6..e4793e5 100644 --- a/Common/CRC.H +++ b/Common/CRC.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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[]; diff --git a/Common/CRYPTO.C b/Common/CRYPTO.C index d06819c..667678e 100644 --- a/Common/CRYPTO.C +++ b/Common/CRYPTO.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" diff --git a/Common/CRYPTO.H b/Common/CRYPTO.H index 3b5a0af..77c59e6 100644 --- a/Common/CRYPTO.H +++ b/Common/CRYPTO.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 @@ -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 @@ -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, diff --git a/Common/DISMOUNT.C b/Common/DISMOUNT.C index 7dda973..c30d593 100644 --- a/Common/DISMOUNT.C +++ b/Common/DISMOUNT.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 @@ -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; @@ -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 diff --git a/Common/DISMOUNT.H b/Common/DISMOUNT.H index 5928131..13cd9ca 100644 --- a/Common/DISMOUNT.H +++ b/Common/DISMOUNT.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ diff --git a/Common/DLGCODE.C b/Common/DLGCODE.C index c0f91f1..18830a5 100644 --- a/Common/DLGCODE.C +++ b/Common/DLGCODE.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" diff --git a/Common/DLGCODE.H b/Common/DLGCODE.H index 547f0e2..33a3a7a 100644 --- a/Common/DLGCODE.H +++ b/Common/DLGCODE.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 */ diff --git a/Common/ENDIAN.C b/Common/ENDIAN.C index 0c7a3e5..5a20f38 100644 --- a/Common/ENDIAN.C +++ b/Common/ENDIAN.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" diff --git a/Common/ENDIAN.H b/Common/ENDIAN.H index da360b0..418ba92 100644 --- a/Common/ENDIAN.H +++ b/Common/ENDIAN.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 ), \ diff --git a/Common/FAT.C b/Common/FAT.C index b4dad13..ec55a92 100644 --- a/Common/FAT.C +++ b/Common/FAT.C @@ -1,17 +1,20 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 -#define WRITE_BUF_SIZE 65536 void GetFatParams (fatparams * ft) @@ -236,39 +239,9 @@ 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; @@ -276,7 +249,7 @@ Format (fatparams * ft, HFILE dev, PCRYPTO_INFO cryptoInfo, int nFrequency, disk 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); @@ -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; diff --git a/Common/FAT.H b/Common/FAT.H index c400c2a..4367fc5 100644 --- a/Common/FAT.H +++ b/Common/FAT.H @@ -1,10 +1,14 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 */ @@ -22,7 +26,6 @@ typedef struct fatparams_t int heads; int secs_track; - char header[SECTOR_SIZE]; } fatparams; @@ -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); diff --git a/Common/FORMAT.C b/Common/FORMAT.C index 2cfd7ed..1c8fd9f 100644 --- a/Common/FORMAT.C +++ b/Common/FORMAT.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" @@ -11,15 +15,121 @@ #include "apidrvr.h" #include "dlgcode.h" + +static int GetAvailableDrive () +{ + DWORD dwUsedDrives = GetLogicalDrives(); + int i; + + for (i = 25; i > 2; i--) + { + if (!(dwUsedDrives & 1 << i)) + return i; + } + + return -1; +} + +static BOOL MountVolume (HWND hwndDlg, int driveNo, char *volumePath, char *szPassword) +{ + extern HANDLE hDriver; + + MOUNT_STRUCT driver; + DWORD dwResult; + BOOL bResult, bDevice; + + VirtualLock (&driver, sizeof (driver)); + + driver.nDosDriveNo = driveNo; + driver.bCache = 0; + driver.time = 0; + driver.nPasswordLen = strlen (szPassword); + strcpy (driver.szPassword, szPassword); + + CreateFullVolumePath ((char *) driver.wszVolume, volumePath, &bDevice); + ToUNICODE ((char *) driver.wszVolume); + + bResult = DeviceIoControl (hDriver, MOUNT, &driver, + sizeof (driver), &driver, sizeof (driver), &dwResult, NULL); + + burn (&driver.szPassword, sizeof (driver.szPassword)); + + VirtualUnlock (&driver, sizeof (driver)); + + if (bResult == FALSE) + { + handleWin32Error (hwndDlg); + return FALSE; + } + else + { + if (driver.nReturnCode == 0) + { + if (nCurrentOS == WIN_NT) + { + char *lpszPipeName = "\\\\.\\pipe\\truecryptservice"; + DWORD bytesRead; + char inbuf[80]; + char outbuf[80]; + + sprintf (outbuf, "mount %d", driver.nDosDriveNo); + + bResult = CallNamedPipe (lpszPipeName, + outbuf, sizeof (outbuf), + inbuf, sizeof (inbuf), + &bytesRead, NMPWAIT_WAIT_FOREVER); + + if (bResult == FALSE) + { + handleWin32Error (hwndDlg); + } + else + { + DWORD os_err = 0; + int err = 0; + + sscanf (inbuf, "%s %d %lu", outbuf, &err, &os_err); + + if (*inbuf == '-') + { + if (err == ERR_OS_ERROR) + { + SetLastError (os_err); + handleWin32Error (hwndDlg); + } + else + { + handleError (hwndDlg, err); + } + + bResult = FALSE; + } + } + return bResult; + } + } + else + { + handleError (hwndDlg, driver.nReturnCode); + return FALSE; + } + } + + return TRUE; +} + int FormatVolume (char *lpszFilename, BOOL bDevice, + char *volumePath, unsigned __int64 size, char *lpszPassword, int cipher, int pkcs5, - fatparams * ft, BOOL quickFormat, + int fileSystem, + int clusterSize, + char * summaryMsg, HWND hwndDlg) { int nStatus; @@ -27,58 +137,32 @@ FormatVolume (char *lpszFilename, void *dev = INVALID_HANDLE_VALUE; OPEN_TEST_STRUCT driver; DISKIO_STRUCT win9x_r0; - DWORD dwError; + DWORD dwError, dwThen, dwNow; diskio_f write; + char header[SECTOR_SIZE]; + __int64 num_sectors; + fatparams ft; + + size -= SECTOR_SIZE; // less the first TC sector + num_sectors = size / SECTOR_SIZE; - if (nCurrentOS == WIN_NT || bDevice == FALSE) + if (fileSystem == FILESYS_FAT) { - write = (diskio_f) _lwrite; + if (num_sectors > 0xFFFFffff) + return ERR_VOL_SIZE_WRONG; - if (bDevice == TRUE) - { - dev = CreateFile (lpszFilename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); - } - else - { - /* We could support FILE_ATTRIBUTE_HIDDEN as an - option! */ - dev = CreateFile (lpszFilename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); - } - - if (dev == INVALID_HANDLE_VALUE) - { - return ERR_OS_ERROR; - } + ft.num_sectors = (unsigned int) (num_sectors); + ft.cluster_size = clusterSize; + memcpy (ft.volume_name, " ", 11); + /* Calculate the fats, root dir etc, and update ft */ + GetFatParams (&ft); } - else - { - write = (diskio_f) win9x_io; - if (OpenDevice (lpszFilename, &driver) == FALSE) - { - return ERR_OS_ERROR; - } + VirtualLock (header, sizeof (header)); - win9x_r0.devicenum = driver.device; - win9x_r0.sectorstart = driver.secstart; - win9x_r0.mode = 1; - - dev = &win9x_r0; - } - - size -= SECTOR_SIZE; // less the first TC sector - - ft->num_sectors = (int) (size / SECTOR_SIZE); - memcpy (ft->volume_name, " ", 11); - - /* Calculate the fats, root dir etc, and update ft */ - GetFatParams (ft); - - /* Copies any header structures into ft->header, but does not do any + /* Copies any header structures into header, but does not do any disk io */ - VirtualLock (&ft->header, sizeof (ft->header)); - - nStatus = VolumeWriteHeader (ft->header, + nStatus = VolumeWriteHeader (header, cipher, lpszPassword, pkcs5, @@ -86,29 +170,235 @@ FormatVolume (char *lpszFilename, 0, &cryptoInfo); - VirtualUnlock (&ft->header, sizeof (ft->header)); - if (nStatus != 0) + { + burn (header, sizeof (header)); + VirtualUnlock (header, sizeof (header)); return nStatus; + } + + write = (diskio_f) _lwrite; + + if (bDevice == TRUE) + { + dev = CreateFile (lpszFilename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); + } + else + { + /* We could support FILE_ATTRIBUTE_HIDDEN as an + option! */ + dev = CreateFile (lpszFilename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); + } + + if (dev == INVALID_HANDLE_VALUE) + { + return ERR_OS_ERROR; + } KillTimer (hwndDlg, 0xff); - InitProgressBar (ft->num_sectors); + InitProgressBar (num_sectors); + dwThen = GetTickCount (); - /* This does the disk io, both copying out the header, init the - sectors, and writing the FAT tables etc */ - nStatus = Format (ft, (HFILE) dev, cryptoInfo, 1000, write, bDevice==TRUE ? quickFormat:FALSE); + switch (fileSystem) + { + case FILESYS_NONE: + case FILESYS_NTFS: + nStatus = FormatNoFs (num_sectors, header, (HFILE) dev, cryptoInfo, 1000, write, bDevice==TRUE ? quickFormat:FALSE); + break; - dwError = GetLastError(); + case FILESYS_FAT: + /* This does the disk io, both copying out the header, init the + sectors, and writing the FAT tables etc */ + nStatus = FormatFat (&ft, header, (HFILE) dev, cryptoInfo, 1000, write, bDevice==TRUE ? quickFormat:FALSE); + break; + } + + dwNow = GetTickCount (); + + burn (header, sizeof (header)); + VirtualUnlock (header, sizeof (header)); crypto_close (cryptoInfo); + CloseHandle (dev); - if (dev != &win9x_r0) - CloseHandle (dev); + dwError = GetLastError(); if (nStatus!=0) SetLastError(dwError); - + else + { + switch (fileSystem) + { + case FILESYS_NONE: + sprintf (summaryMsg, "Volume size:\t\t%I64d sectors (%I64d MB)\nFile system:\t\tNone" + "\n\nFormatting took %lu seconds." + , num_sectors, num_sectors*512/1024/1024 + , (dwNow - dwThen)/1000); + break; + + case FILESYS_FAT: + sprintf (summaryMsg, + "Volume size:\t\t%d sectors (%I64d MB)\nFile system:\t\tFAT%d\n" + "FAT size:\t\t%d bytes\nCluster size:\t\t%d bytes\nClusters available:\t%d" + "\n\nFormatting took %lu seconds." + , ft.num_sectors, ((__int64) ft.num_sectors*512)/1024/1024, ft.size_fat + , (int) (512*ft.fats*ft.fat_length), + (int) (512*ft.cluster_size), ft.cluster_count, + (dwNow - dwThen)/1000); + break; + + case FILESYS_NTFS: + { + int driveNo = GetAvailableDrive (); + DWORD os_error; + int err; + + if (driveNo == -1) + { + MessageBox (hwndDlg, "No free drives available. NTFS formatting cannot continue.", lpszTitle, ICON_HAND); + return ERR_NO_FREE_DRIVES; + } + + if (!MountVolume (hwndDlg, driveNo, volumePath, lpszPassword)) + { + MessageBox (hwndDlg, "Cannot mount volume. NTFS formatting cannot continue.", lpszTitle, ICON_HAND); + return ERR_VOL_MOUNT_FAILED; + } + + if (!FormatNtfs (driveNo, clusterSize)) + { + MessageBox (hwndDlg, "NTFS formatting failed. Try using FAT filesystem.", lpszTitle, MB_ICONERROR); + UnmountVolume (driveNo, &os_error, &err); + return ERR_VOL_FORMAT_BAD; + } + + UnmountVolume (driveNo, &os_error, &err); + + dwNow = GetTickCount (); + + sprintf (summaryMsg, "Volume size:\t\t%I64d sectors (%I64d MB)\nFile system:\t\tNTFS" + "\n\nFormatting took %lu seconds." + , num_sectors, num_sectors*512/1024/1024 + , (dwNow - dwThen)/1000); + + break; + } + } + } + + NormalCursor (); + return nStatus; +} + + +int FormatNoFs (__int64 num_sectors, 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; + + if ((*write) (dev, header, SECTOR_SIZE) == HFILE_ERROR) + return ERR_OS_ERROR; + + write_buf = TCalloc (WRITE_BUF_SIZE); + + memset (sector, 0, sizeof (sector)); + + /* write data area */ + if(!quickFormat) + { + while (num_sectors--) + { + if (WriteSector (dev, sector, write_buf, &write_buf_cnt, &nSecNo, &progress, + cryptoInfo, nFrequency, write) == FALSE) + goto fail; + } + if (write_buf_cnt != 0 && (*write) (dev, write_buf, write_buf_cnt) == HFILE_ERROR) + goto fail; + } + else + nSecNo = num_sectors; + UpdateProgressBar (nSecNo); + + TCfree (write_buf); + return 0; + +fail: + + TCfree (write_buf); + return ERR_OS_ERROR; } + + +volatile BOOLEAN FormatExResult; + +BOOLEAN __stdcall FormatExCallback (int command, DWORD subCommand, PVOID parameter) +{ + if (command == FMIFS_DONE) + FormatExResult = *(BOOLEAN *) parameter; + return TRUE; +} + +BOOL FormatNtfs (int driveNo, int clusterSize) +{ + WCHAR dir[8] = { driveNo + 'A', 0 }; + PFORMATEX FormatEx; + HMODULE hModule = LoadLibrary ("fmifs.dll"); + + if (hModule == NULL) + return FALSE; + + if (!(FormatEx = (void *) GetProcAddress (GetModuleHandle("fmifs.dll"), "FormatEx"))) + { + FreeLibrary (hModule); + return FALSE; + } + + wcscat (dir, L":\\"); + + FormatExResult = FALSE; + + if (*(char *)dir > 'C' && *(char *)dir <= 'Z') + FormatEx (dir, FMIFS_HARDDISK, L"NTFS", L"", TRUE, clusterSize * 512, FormatExCallback); + + FreeLibrary (hModule); + return FormatExResult; +} + +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; + +} + + + diff --git a/Common/FORMAT.H b/Common/FORMAT.H index 9ea0867..faeaa4a 100644 --- a/Common/FORMAT.H +++ b/Common/FORMAT.H @@ -1,6 +1,26 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ -int FormatVolume ( char *lpszFilename , BOOL bDevice , unsigned __int64 size , char *lpszPassword , int cipher , int pkcs5 , fatparams *ft, BOOL quickFormat, HWND hwndDlg ); +int FormatVolume ( char *lpszFilename , BOOL bDevice , char *volumePath, unsigned __int64 size , char *lpszPassword , int cipher , int pkcs5 , BOOL quickFormat, int fileSystem, int clusterSize, char * summaryMsg, HWND hwndDlg ); +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 ); + + +#define WRITE_BUF_SIZE 65536 + +#define FILESYS_NONE 0 +#define FILESYS_FAT 1 +#define FILESYS_NTFS 2 + +// FMIFS + +typedef BOOLEAN (__stdcall *PFMIFSCALLBACK)( int command, DWORD subCommand, PVOID parameter ); +typedef VOID (__stdcall *PFORMATEX)( PWCHAR DriveRoot, DWORD MediaFlag, PWCHAR Format, PWCHAR Label, BOOL QuickFormat, DWORD ClusterSize, PFMIFSCALLBACK Callback ); + +#define FMIFS_DONE 0xB +#define FMIFS_HARDDISK 0xC diff --git a/Common/PASSWORD.C b/Common/PASSWORD.C index 8d4dd2e..bcda0a8 100644 --- a/Common/PASSWORD.C +++ b/Common/PASSWORD.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" @@ -53,7 +57,7 @@ VerifyPasswordAndUpdate (HWND hwndDlg, HWND hButton, HWND hPassword, } int -ChangePwd (char *lpszVolume, char *lpszOldPassword, char *lpszPassword) +ChangePwd (char *lpszVolume, char *lpszOldPassword, char *lpszPassword, int pkcs5) { int nDosLinkCreated = 0, nStatus; char szDiskFile[TC_MAX_PATH], szCFDevice[TC_MAX_PATH]; @@ -155,6 +159,9 @@ ChangePwd (char *lpszVolume, char *lpszOldPassword, char *lpszPassword) win9x_r0.mode = 1; win9x_r0.sectorstart -= 1; + if (pkcs5 != 0) + cryptoInfo->pkcs5 = pkcs5; + VolumeWriteHeader (boot, cryptoInfo->cipher, lpszPassword, diff --git a/Common/PASSWORD.H b/Common/PASSWORD.H index 92d43cf..60d9c5e 100644 --- a/Common/PASSWORD.H +++ b/Common/PASSWORD.H @@ -1,8 +1,12 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ void VerifyPasswordAndUpdate ( HWND hwndDlg , HWND hButton , HWND hPassword , HWND hVerify , char *szPassword , char *szVerify ); -int ChangePwd ( char *lpszVolume , char *lpszOldPassword , char *lpszPassword ); +int ChangePwd ( char *lpszVolume , char *lpszOldPassword , char *lpszPassword , int pkcs5 ); diff --git a/Common/PKCS5.C b/Common/PKCS5.C index 3b95dea..3349250 100644 --- a/Common/PKCS5.C +++ b/Common/PKCS5.C @@ -1,11 +1,15 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 #include "sha1.h" -#include "md5.h" +#include "rmd160.h" #include "pkcs5.h" void truncate @@ -145,72 +149,70 @@ derive_sha_key (char *pwd, int pwd_len, char *salt, int salt_len, int iterations memcpy (dk, u, r); } -#define MD5_DIGESTSIZE 16 -void -hmac_md5 (char *text, /* pointer to data stream */ - int text_len, /* length of data stream */ - char *key, /* pointer to authentication key */ - int key_len, /* length of authentication key */ - char *digest) /* caller digest to be filled in */ -{ - MD5_CTX context; - char k_ipad[65]; /* inner padding - key XORd with ipad */ - char k_opad[65]; /* outer padding - key XORd with opad */ - char tk[MD5_DIGESTSIZE]; - int i; - /* if key is longer than 64 bytes reset it to key=MD5(key) */ - if (key_len > 64) - { - - MD5_CTX tctx; - - MD5Init (&tctx); - MD5Update (&tctx, (unsigned char *) key, key_len); - MD5Final ((unsigned char *) tk, &tctx); +#define RMD160_DIGESTSIZE 20 - key = tk; - key_len = MD5_DIGESTSIZE; - } - - /* the HMAC_MD5 transform looks like: - - MD5(K XOR opad, MD5(K XOR ipad, text)) - - where K is an n byte key ipad is the byte 0x36 repeated 64 times opad - is the byte 0x5c repeated 64 times and text is the data being - protected */ - - /* start out by storing key in pads */ - memset (k_ipad, 0, sizeof k_ipad); - memset (k_opad, 0, sizeof k_opad); - memcpy (k_ipad, key, key_len); - memcpy (k_opad, key, key_len); - - /* XOR key with ipad and opad values */ - for (i = 0; i < 64; i++) - { - k_ipad[i] ^= 0x36; - k_opad[i] ^= 0x5c; - } - - /* perform inner MD5 */ - MD5Init (&context); /* init context for 1st pass */ - MD5Update (&context, (unsigned char *) k_ipad, 64); /* start with inner pad */ - MD5Update (&context, (unsigned char *) text, text_len); /* then text of datagram */ - MD5Final ((unsigned char *) digest, &context); /* finish up 1st pass */ - /* perform outer MD5 */ - MD5Init (&context); /* init context for 2nd pass */ - MD5Update (&context, (unsigned char *) k_opad, 64); /* start with outer pad */ - MD5Update (&context, (unsigned char *) digest, MD5_DIGESTSIZE); /* then results of 1st - hash */ - MD5Final ((unsigned char *) digest, &context); /* finish up 2nd pass */ +void hmac_rmd160 (unsigned char *key, int keylen, unsigned char *input, int len, unsigned char *digest) +{ + RMD160_CTX context; + unsigned char k_ipad[65]; /* inner padding - key XORd with ipad */ + unsigned char k_opad[65]; /* outer padding - key XORd with opad */ + unsigned char tk[RMD160_DIGESTSIZE]; + int i; + + /* if key is longer than 64 bytes reset it to key=SHA1(key) */ + if (keylen > 64) { + RMD160_CTX tctx; + + RMD160Init(&tctx); + RMD160Update(&tctx, key, keylen); + RMD160Final(tk, &tctx); + + key = tk; + keylen = RMD160_DIGESTSIZE; + } + + /* The HMAC_SHA1 transform looks like: + + RMD160(K XOR opad, RMD160(K XOR ipad, text)) + + where K is an n byte key + ipad is the byte 0x36 repeated 64 times + opad is the byte 0x5c repeated 64 times + and text is the data being protected */ + + /* start out by storing key in pads */ + memset(k_ipad, 0x36, sizeof(k_ipad)); + memset(k_opad, 0x5c, sizeof(k_opad)); + + /* XOR key with ipad and opad values */ + for (i=0; i MD5_DIGESTSIZE ? MD5_DIGESTSIZE : x, digest); - if (memcmp (digest, hmac_md5_test_vectors[i], MD5_DIGESTSIZE) != 0) + char digest[RMD160_DIGESTSIZE]; + hmac_rmd160 (hmac_rmd160_test_keys[i], 20, hmac_rmd160_test_data[i], strlen (hmac_rmd160_test_data[i]), digest); + if (memcmp (digest, hmac_rmd160_test_vectors[i], RMD160_DIGESTSIZE) != 0) return FALSE; } @@ -341,7 +354,7 @@ test_pkcs5 () /* First make sure the hmacs are ok */ if (test_hmac_sha1 ()== FALSE) return FALSE; - if (test_hmac_md5 ()== FALSE) + if (test_hmac_rmd160 ()== FALSE) return FALSE; /* Next check the sha1 with pkcs5 */ @@ -349,9 +362,9 @@ test_pkcs5 () if (memcmp (dk, "\x5c\x75\xce\xf0", 4) != 0) return FALSE; - /* Next check md5 with pkcs5 */ - derive_md5_key ("password", 8, "\x12\x34\x56\x78", 4, 5, dk, 4); - if (memcmp (dk, "\x91\xa9\xd7\x92", 4) != 0) + /* Next check ripemd160 with pkcs5 */ + derive_rmd160_key ("password", 8, "\x12\x34\x56\x78", 4, 2000, dk, 4); + if (memcmp (dk, "\xc5\x6b\x27\xdf", 4) != 0) return FALSE; return TRUE; diff --git a/Common/PKCS5.H b/Common/PKCS5.H index c11b4f6..4d288ee 100644 --- a/Common/PKCS5.H +++ b/Common/PKCS5.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ @@ -8,10 +12,10 @@ void truncate (char *d1, char *d2, int len); void hmac_sha (char *k, int lk, char *d, int ld, char *out, int t); void derive_u_sha (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b); void derive_sha_key (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen); -void hmac_md5 (char *text, int text_len, char *key, int key_len, char *digest); -void derive_u_md5 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b); -void derive_md5_key (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen); +void hmac_rmd160 (unsigned char *key, int keylen, unsigned char *input, int len, unsigned char *digest); +void derive_u_rmd160 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b); +void derive_rmd160_key (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen); BOOL test_hmac_sha1 (void); -BOOL test_hmac_md5 (void); +BOOL test_hmac_rmd160 (void); BOOL test_pkcs5 (void); int pkcs5main (void); diff --git a/Common/PROGRESS.C b/Common/PROGRESS.C index c7f8823..e78a296 100644 --- a/Common/PROGRESS.C +++ b/Common/PROGRESS.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 "progress.h" @@ -10,10 +14,11 @@ extern HWND hProgressBar; extern BOOL bThreadCancel; extern int nPbar; -ULONG prevTime, startTime, totalSectors; +ULONG prevTime, startTime; +__int64 totalSectors; void -InitProgressBar (ULONG totalSecs) +InitProgressBar (__int64 totalSecs) { HWND hProgressBar = GetDlgItem (hCurPage, nPbar); SendMessage (hProgressBar, PBM_SETRANGE32, 0, 10000); @@ -24,7 +29,7 @@ InitProgressBar (ULONG totalSecs) } BOOL -UpdateProgressBar (int nSecNo) +UpdateProgressBar (__int64 nSecNo) { char text[100]; HWND hProgressBar = GetDlgItem (hCurPage, nPbar); @@ -32,15 +37,29 @@ UpdateProgressBar (int nSecNo) int elapsed = (time - startTime) / 1000; - wsprintf(text,"%d MB ", (nSecNo+1) / 2 / 1024); + if ((nSecNo+1) / 2 / 1024 < 1000000) + wsprintf(text,"%d MB ", (nSecNo+1) / 2 / 1024); + else + wsprintf(text,"%d GB ", (nSecNo+1) / 2 / 1024 / 1024); + SetWindowText (GetDlgItem (hCurPage, IDC_BYTESWRITTEN), text); - wsprintf(text,"%d MB/s ", (nSecNo+1) / 2 / 1024 / (1+elapsed)); + if ((nSecNo+1) / 2 / 1024 / (1+elapsed) < 1024) + wsprintf(text,"%d MB/s ", (nSecNo+1) / 2 / 1024 / (1+elapsed)); + else + wsprintf(text,"%d GB/s ", (nSecNo+1) / 2 / 1024 / 1024 / (1+elapsed)); + SetWindowText (GetDlgItem (hCurPage, IDC_WRITESPEED), text); if (nSecNo < totalSectors) { - wsprintf(text,"%d min ", (totalSectors - nSecNo) / ((nSecNo+1)/(elapsed+1)+1) / 60); + int min = (int)((totalSectors - nSecNo) / ((nSecNo+1)/(elapsed+1)+1) / 60); + + if (min < 60 * 24) + wsprintf(text,"%d min ", min); + else + wsprintf(text,"%d days ", min / (60 * 24)); + SetWindowText (GetDlgItem (hCurPage, IDC_TIMEREMAIN), text); } diff --git a/Common/PROGRESS.H b/Common/PROGRESS.H index 68ea74a..77f544f 100644 --- a/Common/PROGRESS.H +++ b/Common/PROGRESS.H @@ -1,7 +1,11 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ -void InitProgressBar ( ULONG totalSecs ); -BOOL UpdateProgressBar ( int nSecNo ); +void InitProgressBar ( __int64 totalSecs ); +BOOL UpdateProgressBar ( __int64 nSecNo ); diff --git a/Common/RANDOM.C b/Common/RANDOM.C index 22afdf9..aa9d01b 100644 --- a/Common/RANDOM.C +++ b/Common/RANDOM.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" @@ -20,6 +24,8 @@ unsigned char *pRandPool = NULL; int nRandIndex = 0, randPoolReadIndex = 0; +int hashFunction = SHA1; + /* Macro to add a single byte to the pool */ #define RandaddByte(x) {\ if (nRandIndex==POOLSIZE) nRandIndex = 0;\ @@ -145,6 +151,11 @@ Randfree () bRandDidInit = FALSE; } +void RandSetHashFunction (int hash) +{ + hashFunction = hash; +} + /* Mix random pool with the hash function */ void Randmix () @@ -161,7 +172,12 @@ Randmix () into the random pool */ for (j = 0; j < SHA_BLOCKSIZE; j++) inputBuffer[j] = pRandPool[(i + j) % POOLSIZE]; - SHA1TRANSFORM ((unsigned long *) (pRandPool + i), inputBuffer); + + if (hashFunction == SHA1) + SHA1TRANSFORM ((unsigned long *) (pRandPool + i), inputBuffer); + else + RMD160Transform ((unsigned long *) (pRandPool + i), inputBuffer); + memset (inputBuffer, 0, SHA_BLOCKSIZE); } } diff --git a/Common/RANDOM.H b/Common/RANDOM.H index 1f2efa0..fb9c8fb 100644 --- a/Common/RANDOM.H +++ b/Common/RANDOM.H @@ -1,11 +1,16 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ _inline void _RandaddLong ( unsigned long x ); int Randinit ( void ); void Randfree ( void ); +void RandSetHashFunction ( int hash ); void Randmix ( void ); void RandaddBuf ( void *buf , int len ); void RandpeekBytes ( char *buf , int len ); diff --git a/Common/Registry.c b/Common/Registry.c index f9d9124..777c84e 100644 --- a/Common/Registry.c +++ b/Common/Registry.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 TrueCrypt Foundation */ +/* Copyright (C) 2004 TrueCrypt Team */ #include "TCdefs.h" diff --git a/Common/TCDEFS.H b/Common/TCDEFS.H index ee1c8eb..d3b1f44 100644 --- a/Common/TCDEFS.H +++ b/Common/TCDEFS.H @@ -1,11 +1,15 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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. */ // Version displayed to user -#define VERSION_STRING "2.0" +#define VERSION_STRING "2.1" // Version number to compare against driver -#define VERSION_NUM 0x0200 +#define VERSION_NUM 0x0210 // Version number written to volume header during format, // specifies the minimum program version required to mount the volume diff --git a/Common/VOLUMES.C b/Common/VOLUMES.C index 00765f0..a05bbe7 100644 --- a/Common/VOLUMES.C +++ b/Common/VOLUMES.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" @@ -462,90 +466,98 @@ VolumeReadHeader (char *encryptedHeader, char *lpszPassword, PCRYPTO_INFO * retI // PKCS5 is used to derive header key and IV from user password memcpy (keyInfo.key_salt, encryptedHeader + HEADER_USERKEY_SALT, USERKEY_SALT_SIZE); keyInfo.noIterations = USERKEY_ITERATIONS; - pkcs5 = SHA1; - if (pkcs5 == SHA1) + // Test all available PKCS5 PRFs + for (pkcs5 = 1; pkcs5 <= LAST_PRF_ID; pkcs5++) { - derive_sha_key (keyInfo.userKey, keyInfo.keyLength, keyInfo.key_salt, - USERKEY_SALT_SIZE, keyInfo.noIterations, dk, DISK_IV_SIZE + MAX_CIPHER_KEY); - } - // IV for header decryption - memcpy (cryptoInfo->iv, dk, DISK_IV_SIZE); + if (pkcs5 == SHA1) + { + derive_sha_key (keyInfo.userKey, keyInfo.keyLength, keyInfo.key_salt, + USERKEY_SALT_SIZE, keyInfo.noIterations, dk, DISK_IV_SIZE + MAX_CIPHER_KEY); + } else if (pkcs5 == RIPEMD160) + { + derive_rmd160_key (keyInfo.userKey, keyInfo.keyLength, keyInfo.key_salt, + USERKEY_SALT_SIZE, keyInfo.noIterations, dk, DISK_IV_SIZE + MAX_CIPHER_KEY); + } - // Test all available ciphers - for (cryptoInfo->cipher = 1; cryptoInfo->cipher <= LAST_CIPHER_ID; cryptoInfo->cipher++) - { - // Copy header for decryption - memcpy (header, encryptedHeader, SECTOR_SIZE); - input = header; + // IV for header decryption + memcpy (cryptoInfo->iv, dk, DISK_IV_SIZE); - // Try to decrypt header - init_cipher (cryptoInfo->cipher, dk + DISK_IV_SIZE, cryptoInfo->ks); + // Test all available ciphers + for (cryptoInfo->cipher = 1; cryptoInfo->cipher <= LAST_CIPHER_ID; cryptoInfo->cipher++) + { + // Copy header for decryption + memcpy (header, encryptedHeader, SECTOR_SIZE); + input = header; - DecryptBuffer (header + HEADER_ENCRYPTEDDATA, HEADER_ENCRYPTEDDATASIZE, - cryptoInfo->ks, cryptoInfo->iv, cryptoInfo->cipher); + // Try to decrypt header + init_cipher (cryptoInfo->cipher, dk + DISK_IV_SIZE, cryptoInfo->ks); - input += HEADER_ENCRYPTEDDATA; + DecryptBuffer (header + HEADER_ENCRYPTEDDATA, HEADER_ENCRYPTEDDATASIZE, + cryptoInfo->ks, cryptoInfo->iv, cryptoInfo->cipher); - // Magic - if (mgetLong (input) != 'TRUE') - continue; + input += HEADER_ENCRYPTEDDATA; - // Header version - headerVersion = mgetWord (input); + // Magic + if (mgetLong (input) != 'TRUE') + continue; - // Required program version - requiredVersion = mgetWord (input); + // Header version + headerVersion = mgetWord (input); - // Check CRC of disk IV and key - if (mgetLong (input) != crc32 (header + HEADER_DISKKEY, DISKKEY_SIZE)) - continue; + // Required program version + requiredVersion = mgetWord (input); - // Volume creation time - ((unsigned long *)(&cryptoInfo->volume_creation_time))[1] = mgetLong (input); - ((unsigned long *)(&cryptoInfo->volume_creation_time))[0] = mgetLong (input); + // Check CRC of disk IV and key + if (mgetLong (input) != crc32 (header + HEADER_DISKKEY, DISKKEY_SIZE)) + continue; - // Header creation time - ((unsigned long *)(&cryptoInfo->header_creation_time))[1] = mgetLong (input); - ((unsigned long *)(&cryptoInfo->header_creation_time))[0] = mgetLong (input); + // Volume creation time + ((unsigned long *)(&cryptoInfo->volume_creation_time))[1] = mgetLong (input); + ((unsigned long *)(&cryptoInfo->volume_creation_time))[0] = mgetLong (input); - // Password and cipher OK + // Header creation time + ((unsigned long *)(&cryptoInfo->header_creation_time))[1] = mgetLong (input); + ((unsigned long *)(&cryptoInfo->header_creation_time))[0] = mgetLong (input); - // Check the version required to handle this volume - if (requiredVersion > VERSION_NUM) - return ERR_NEW_VERSION_REQUIRED; + // Password and cipher OK - // Disk key - nKeyLen = DISKKEY_SIZE; - memcpy (keyInfo.key, header + HEADER_DISKKEY, nKeyLen); + // Check the version required to handle this volume + if (requiredVersion > VERSION_NUM) + return ERR_NEW_VERSION_REQUIRED; - memcpy (cryptoInfo->master_decrypted_key, keyInfo.key, nKeyLen); - memcpy (cryptoInfo->key_salt, keyInfo.key_salt, USERKEY_SALT_SIZE); - cryptoInfo->pkcs5 = pkcs5; - cryptoInfo->noIterations = keyInfo.noIterations; + // Disk key + nKeyLen = DISKKEY_SIZE; + memcpy (keyInfo.key, header + HEADER_DISKKEY, nKeyLen); - // Init with decrypted master disk key for sector decryption - init_cipher (cryptoInfo->cipher, keyInfo.key + DISK_IV_SIZE, cryptoInfo->ks); + memcpy (cryptoInfo->master_decrypted_key, keyInfo.key, nKeyLen); + memcpy (cryptoInfo->key_salt, keyInfo.key_salt, USERKEY_SALT_SIZE); + cryptoInfo->pkcs5 = pkcs5; + cryptoInfo->noIterations = keyInfo.noIterations; - // Disk IV - memcpy (cryptoInfo->iv, keyInfo.key, DISK_IV_SIZE); + // Init with decrypted master disk key for sector decryption + init_cipher (cryptoInfo->cipher, keyInfo.key + DISK_IV_SIZE, cryptoInfo->ks); - /* Clear out the temp. key buffer */ - burn (dk, sizeof(dk)); + // Disk IV + memcpy (cryptoInfo->iv, keyInfo.key, DISK_IV_SIZE); - switch (get_block_size (cryptoInfo->cipher)) - { - case 8: - cryptoInfo->encrypt_sector = &EncryptSector8; - cryptoInfo->decrypt_sector = &DecryptSector8; - break; - case 16: - cryptoInfo->encrypt_sector = &EncryptSector16; - cryptoInfo->decrypt_sector = &DecryptSector16; - break; + /* Clear out the temp. key buffer */ + burn (dk, sizeof(dk)); + + switch (get_block_size (cryptoInfo->cipher)) + { + case 8: + cryptoInfo->encrypt_sector = &EncryptSector8; + cryptoInfo->decrypt_sector = &DecryptSector8; + break; + case 16: + cryptoInfo->encrypt_sector = &EncryptSector16; + cryptoInfo->decrypt_sector = &DecryptSector16; + break; + } + + return 0; } - - return 0; } crypto_close(cryptoInfo); @@ -556,8 +568,9 @@ VolumeReadHeader (char *encryptedHeader, char *lpszPassword, PCRYPTO_INFO * retI #ifndef DEVICE_DRIVER #ifdef VOLFORMAT +extern BOOL showKeys; extern HWND hDiskKey; -extern HWND hKeySalt; +extern HWND hHeaderKey; #endif // VolumeWriteHeader: @@ -605,6 +618,11 @@ VolumeWriteHeader (char *header, int cipher, char *lpszPassword, derive_sha_key (keyInfo.userKey, keyInfo.keyLength, keyInfo.key_salt, USERKEY_SALT_SIZE, keyInfo.noIterations, dk, DISK_IV_SIZE + MAX_CIPHER_KEY ); } + else if (pkcs5 == RIPEMD160) + { + derive_rmd160_key (keyInfo.userKey, keyInfo.keyLength, keyInfo.key_salt, + USERKEY_SALT_SIZE, keyInfo.noIterations, dk, DISK_IV_SIZE + MAX_CIPHER_KEY ); + } //// Header setup @@ -672,9 +690,6 @@ VolumeWriteHeader (char *header, int cipher, char *lpszPassword, // Disk IV memcpy (cryptoInfo->iv, keyInfo.key, DISK_IV_SIZE); - // Clear out the temp. key buffer - burn (dk, sizeof(dk)); - switch (get_block_size (cryptoInfo->cipher)) { case 8: @@ -689,6 +704,7 @@ VolumeWriteHeader (char *header, int cipher, char *lpszPassword, #ifdef VOLFORMAT + if (showKeys) { char tmp[64]; BOOL dots3 = FALSE; @@ -696,10 +712,10 @@ VolumeWriteHeader (char *header, int cipher, char *lpszPassword, j = get_key_size (cipher); - if (j > 21) + if (j > 14) { dots3 = TRUE; - j = 21; + j = 14; } tmp[0] = 0; @@ -720,17 +736,23 @@ VolumeWriteHeader (char *header, int cipher, char *lpszPassword, SetWindowText (hDiskKey, tmp); tmp[0] = 0; - for (i = 0; i < 20; i++) + for (i = 0; i < 14; i++) { char tmp2[8]; - sprintf (tmp2, "%02X", (int) (unsigned char) keyInfo.key_salt[i]); + sprintf (tmp2, "%02X", (int) (unsigned char) dk[DISK_IV_SIZE + i]); strcat (tmp, tmp2); } - SetWindowText (hKeySalt, tmp); + if (dots3 == TRUE) + { + strcat (tmp, "..."); + } + + SetWindowText (hHeaderKey, tmp); } #endif + burn (dk, sizeof(dk)); burn (&keyInfo, sizeof (keyInfo)); VirtualUnlock (&keyInfo, sizeof (keyInfo)); diff --git a/Common/VOLUMES.H b/Common/VOLUMES.H index ed8082e..fa99be6 100644 --- a/Common/VOLUMES.H +++ b/Common/VOLUMES.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ diff --git a/Crypto/Crypto.vcproj b/Crypto/Crypto.vcproj index 21fea32..cc86db8 100644 --- a/Crypto/Crypto.vcproj +++ b/Crypto/Crypto.vcproj @@ -61,13 +61,6 @@ CharacterSet="2"> + RelativePath=".\Rmd160.c"> - - @@ -205,9 +195,6 @@ - - @@ -215,10 +202,10 @@ RelativePath=".\resource.h"> + RelativePath=".\Rmd160.h"> + RelativePath=".\Set_key.h"> diff --git a/Crypto/MD5.C b/Crypto/MD5.C deleted file mode 100644 index 0e88a97..0000000 --- a/Crypto/MD5.C +++ /dev/null @@ -1,288 +0,0 @@ -/* - *********************************************************************** - ** md5.c -- the source code for MD5 routines ** - ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** - ** Created: 2/17/90 RLR ** - ** Revised: 1/91 SRD,AJ,BSK,JT Reference C Version ** - *********************************************************************** - */ - -/* - * Edited 7 May 93 by CP to change the interface to match that - * of the MD5 routines in RSAREF. Due to this alteration, this - * code is "derived from the RSA Data Security, Inc. MD5 Message- - * Digest Algorithm". (See below.) - */ - -/* - *********************************************************************** - ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** - ** ** - ** License to copy and use this software is granted provided that ** - ** it is identified as the "RSA Data Security, Inc. MD5 Message- ** - ** Digest Algorithm" in all material mentioning or referencing this ** - ** software or this function. ** - ** ** - ** License is also granted to make and use derivative works ** - ** provided that such works are identified as "derived from the RSA ** - ** Data Security, Inc. MD5 Message-Digest Algorithm" in all ** - ** material mentioning or referencing the derived work. ** - ** ** - ** RSA Data Security, Inc. makes no representations concerning ** - ** either the merchantability of this software or the suitability ** - ** of this software for any particular purpose. It is provided "as ** - ** is" without express or implied warranty of any kind. ** - ** ** - ** These notices must be retained in any copies of any part of this ** - ** documentation and/or software. ** - *********************************************************************** - */ - -#include "md5.h" - -/* - *********************************************************************** - ** Message-digest routines: ** - ** To form the message digest for a message M ** - ** (1) Initialize a context buffer mdContext using MD5Init ** - ** (2) Call MD5Update on mdContext and M ** - ** (3) Call MD5Final on mdContext ** - ** The message digest is now in the bugffer passed to MD5Final ** - *********************************************************************** - */ - -static unsigned char PADDING[64] = { - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -/* F, G, H and I are basic MD5 functions */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) - -/* ROTATE_LEFT rotates x left n bits */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) - -/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */ -/* Rotation is separate from addition to prevent recomputation */ -#define FF(a, b, c, d, x, s, ac) \ - {(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define GG(a, b, c, d, x, s, ac) \ - {(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define HH(a, b, c, d, x, s, ac) \ - {(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define II(a, b, c, d, x, s, ac) \ - {(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } - -/* The routine MD5Init initializes the message-digest context - mdContext. All fields are set to zero. - */ -void _cdecl MD5Init ( MD5_CTX *mdContext) -{ - mdContext->i[0] = mdContext->i[1] = (UINT4)0; - - /* Load magic initialization constants. - */ - mdContext->buf[0] = (UINT4)0x67452301L; - mdContext->buf[1] = (UINT4)0xefcdab89L; - mdContext->buf[2] = (UINT4)0x98badcfeL; - mdContext->buf[3] = (UINT4)0x10325476L; -} - -/* The routine MD5Update updates the message-digest context to - account for the presence of each of the characters inBuf[0..inLen-1] - in the message whose digest is being computed. - */ -void _cdecl MD5Update (register MD5_CTX *mdContext, unsigned char *inBuf, - unsigned int inLen) -{ - register int i, ii; - int mdi; - UINT4 in[16]; - - /* compute number of bytes mod 64 */ - mdi = (int)((mdContext->i[0] >> 3) & 0x3F); - - /* update number of bits */ - if ((mdContext->i[0] + ((UINT4)inLen << 3)) < mdContext->i[0]) - mdContext->i[1]++; - mdContext->i[0] += ((UINT4)inLen << 3); - mdContext->i[1] += ((UINT4)inLen >> 29); - - while (inLen--) { - /* add new character to buffer, increment mdi */ - mdContext->in[mdi++] = *inBuf++; - - /* transform if necessary */ - if (mdi == 0x40) { - for (i = 0, ii = 0; i < 16; i++, ii += 4) - in[i] = (((UINT4)mdContext->in[ii+3]) << 24) | - (((UINT4)mdContext->in[ii+2]) << 16) | - (((UINT4)mdContext->in[ii+1]) << 8) | - ((UINT4)mdContext->in[ii]); - Transform (mdContext->buf, in); - mdi = 0; - } - } -} - -/* The routine MD5Final terminates the message-digest computation and - ends with the desired message digest in mdContext->digest[0...15]. - */ -void _cdecl MD5Final (unsigned char digest[16], MD5_CTX *mdContext) -{ - UINT4 in[16]; - int mdi; - unsigned int i, ii; - unsigned int padLen; - - /* save number of bits */ - in[14] = mdContext->i[0]; - in[15] = mdContext->i[1]; - - /* compute number of bytes mod 64 */ - mdi = (int)((mdContext->i[0] >> 3) & 0x3F); - - /* pad out to 56 mod 64 */ - padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi); - MD5Update (mdContext, PADDING, padLen); - - /* append length in bits and transform */ - for (i = 0, ii = 0; i < 14; i++, ii += 4) - in[i] = (((UINT4)mdContext->in[ii+3]) << 24) | - (((UINT4)mdContext->in[ii+2]) << 16) | - (((UINT4)mdContext->in[ii+1]) << 8) | - ((UINT4)mdContext->in[ii]); - Transform (mdContext->buf, in); - - /* store buffer in digest */ - for (i = 0, ii = 0; i < 4; i++, ii += 4) { - digest[ii] = (unsigned char) (mdContext->buf[i] & 0xFF); - digest[ii+1] = (unsigned char)((mdContext->buf[i] >> 8) & 0xFF); - digest[ii+2] = (unsigned char)((mdContext->buf[i] >> 16) & 0xFF); - digest[ii+3] = (unsigned char)((mdContext->buf[i] >> 24) & 0xFF); - } -} - -/* Basic MD5 step. Transforms buf based on in. Note that if the Mysterious - Constants are arranged backwards in little-endian order and decrypted with - the DES they produce OCCULT MESSAGES! - */ -void Transform(register UINT4 *buf,register UINT4 *in) -{ - register UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3]; - - /* Round 1 */ -#define S11 7 -#define S12 12 -#define S13 17 -#define S14 22 - FF ( a, b, c, d, in[ 0], S11, 0xD76AA478L); /* 1 */ - FF ( d, a, b, c, in[ 1], S12, 0xE8C7B756L); /* 2 */ - FF ( c, d, a, b, in[ 2], S13, 0x242070DBL); /* 3 */ - FF ( b, c, d, a, in[ 3], S14, 0xC1BDCEEEL); /* 4 */ - FF ( a, b, c, d, in[ 4], S11, 0xF57C0FAFL); /* 5 */ - FF ( d, a, b, c, in[ 5], S12, 0x4787C62AL); /* 6 */ - FF ( c, d, a, b, in[ 6], S13, 0xA8304613L); /* 7 */ - FF ( b, c, d, a, in[ 7], S14, 0xFD469501L); /* 8 */ - FF ( a, b, c, d, in[ 8], S11, 0x698098D8L); /* 9 */ - FF ( d, a, b, c, in[ 9], S12, 0x8B44F7AFL); /* 10 */ - FF ( c, d, a, b, in[10], S13, 0xFFFF5BB1L); /* 11 */ - FF ( b, c, d, a, in[11], S14, 0x895CD7BEL); /* 12 */ - FF ( a, b, c, d, in[12], S11, 0x6B901122L); /* 13 */ - FF ( d, a, b, c, in[13], S12, 0xFD987193L); /* 14 */ - FF ( c, d, a, b, in[14], S13, 0xA679438EL); /* 15 */ - FF ( b, c, d, a, in[15], S14, 0x49B40821L); /* 16 */ - - /* Round 2 */ -#define S21 5 -#define S22 9 -#define S23 14 -#define S24 20 - GG ( a, b, c, d, in[ 1], S21, 0xF61E2562L); /* 17 */ - GG ( d, a, b, c, in[ 6], S22, 0xC040B340L); /* 18 */ - GG ( c, d, a, b, in[11], S23, 0x265E5A51L); /* 19 */ - GG ( b, c, d, a, in[ 0], S24, 0xE9B6C7AAL); /* 20 */ - GG ( a, b, c, d, in[ 5], S21, 0xD62F105DL); /* 21 */ - GG ( d, a, b, c, in[10], S22, 0x02441453L); /* 22 */ - GG ( c, d, a, b, in[15], S23, 0xD8A1E681L); /* 23 */ - GG ( b, c, d, a, in[ 4], S24, 0xE7D3FBC8L); /* 24 */ - GG ( a, b, c, d, in[ 9], S21, 0x21E1CDE6L); /* 25 */ - GG ( d, a, b, c, in[14], S22, 0xC33707D6L); /* 26 */ - GG ( c, d, a, b, in[ 3], S23, 0xF4D50D87L); /* 27 */ - GG ( b, c, d, a, in[ 8], S24, 0x455A14EDL); /* 28 */ - GG ( a, b, c, d, in[13], S21, 0xA9E3E905L); /* 29 */ - GG ( d, a, b, c, in[ 2], S22, 0xFCEFA3F8L); /* 30 */ - GG ( c, d, a, b, in[ 7], S23, 0x676F02D9L); /* 31 */ - GG ( b, c, d, a, in[12], S24, 0x8D2A4C8AL); /* 32 */ - - /* Round 3 */ -#define S31 4 -#define S32 11 -#define S33 16 -#define S34 23 - HH ( a, b, c, d, in[ 5], S31, 0xFFFA3942L); /* 33 */ - HH ( d, a, b, c, in[ 8], S32, 0x8771F681L); /* 34 */ - HH ( c, d, a, b, in[11], S33, 0x6D9D6122L); /* 35 */ - HH ( b, c, d, a, in[14], S34, 0xFDE5380CL); /* 36 */ - HH ( a, b, c, d, in[ 1], S31, 0xA4BEEA44L); /* 37 */ - HH ( d, a, b, c, in[ 4], S32, 0x4BDECFA9L); /* 38 */ - HH ( c, d, a, b, in[ 7], S33, 0xF6BB4B60L); /* 39 */ - HH ( b, c, d, a, in[10], S34, 0xBEBFBC70L); /* 40 */ - HH ( a, b, c, d, in[13], S31, 0x289B7EC6L); /* 41 */ - HH ( d, a, b, c, in[ 0], S32, 0xEAA127FAL); /* 42 */ - HH ( c, d, a, b, in[ 3], S33, 0xD4EF3085L); /* 43 */ - HH ( b, c, d, a, in[ 6], S34, 0x04881D05L); /* 44 */ - HH ( a, b, c, d, in[ 9], S31, 0xD9D4D039L); /* 45 */ - HH ( d, a, b, c, in[12], S32, 0xE6DB99E5L); /* 46 */ - HH ( c, d, a, b, in[15], S33, 0x1FA27CF8L); /* 47 */ - HH ( b, c, d, a, in[ 2], S34, 0xC4AC5665L); /* 48 */ - - /* Round 4 */ -#define S41 6 -#define S42 10 -#define S43 15 -#define S44 21 - II ( a, b, c, d, in[ 0], S41, 0xF4292244L); /* 49 */ - II ( d, a, b, c, in[ 7], S42, 0x432AFF97L); /* 50 */ - II ( c, d, a, b, in[14], S43, 0xAB9423A7L); /* 51 */ - II ( b, c, d, a, in[ 5], S44, 0xFC93A039L); /* 52 */ - II ( a, b, c, d, in[12], S41, 0x655B59C3L); /* 53 */ - II ( d, a, b, c, in[ 3], S42, 0x8F0CCC92L); /* 54 */ - II ( c, d, a, b, in[10], S43, 0xFFEFF47DL); /* 55 */ - II ( b, c, d, a, in[ 1], S44, 0x85845DD1L); /* 56 */ - II ( a, b, c, d, in[ 8], S41, 0x6FA87E4FL); /* 57 */ - II ( d, a, b, c, in[15], S42, 0xFE2CE6E0L); /* 58 */ - II ( c, d, a, b, in[ 6], S43, 0xA3014314L); /* 59 */ - II ( b, c, d, a, in[13], S44, 0x4E0811A1L); /* 60 */ - II ( a, b, c, d, in[ 4], S41, 0xF7537E82L); /* 61 */ - II ( d, a, b, c, in[11], S42, 0xBD3AF235L); /* 62 */ - II ( c, d, a, b, in[ 2], S43, 0x2AD7D2BBL); /* 63 */ - II ( b, c, d, a, in[ 9], S44, 0xEB86D391L); /* 64 */ - - buf[0] += a; - buf[1] += b; - buf[2] += c; - buf[3] += d; -} - diff --git a/Crypto/MD5.H b/Crypto/MD5.H deleted file mode 100644 index 8559cb6..0000000 --- a/Crypto/MD5.H +++ /dev/null @@ -1,66 +0,0 @@ -/* - *********************************************************************** - ** md5.h -- header file for implementation of MD5 ** - ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** - ** Created: 2/17/90 RLR ** - ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** - ** Revised (for MD5): RLR 4/27/91 ** - ** -- G modified to have y&~z instead of y&z ** - ** -- FF, GG, HH modified to add in last register done ** - ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** - ** -- distinct additive constant for each step ** - ** -- round 4 added, working mod 7 ** - *********************************************************************** - */ - -/* - * Edited 7 May 93 by CP to change the interface to match that - * of the MD5 routines in RSAREF. Due to this alteration, this - * code is "derived from the RSA Data Security, Inc. MD5 Message- - * Digest Algorithm". (See below.) Also added argument names - * to the prototypes. - */ - -/* - *********************************************************************** - ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** - ** ** - ** License to copy and use this software is granted provided that ** - ** it is identified as the "RSA Data Security, Inc. MD5 Message- ** - ** Digest Algorithm" in all material mentioning or referencing this ** - ** software or this function. ** - ** ** - ** License is also granted to make and use derivative works ** - ** provided that such works are identified as "derived from the RSA ** - ** Data Security, Inc. MD5 Message-Digest Algorithm" in all ** - ** material mentioning or referencing the derived work. ** - ** ** - ** RSA Data Security, Inc. makes no representations concerning ** - ** either the merchantability of this software or the suitability ** - ** of this software for any particular purpose. It is provided "as ** - ** is" without express or implied warranty of any kind. ** - ** ** - ** These notices must be retained in any copies of any part of this ** - ** documentation and/or software. ** - *********************************************************************** - */ - -/* typedef a 32-bit type */ -#ifdef __alpha -typedef unsigned int UINT4; -#else -typedef unsigned long int UINT4; -#endif - -/* Data structure for MD5 (Message-Digest) computation */ -typedef struct { - UINT4 buf[4]; /* scratch buffer */ - UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ - unsigned char in[64]; /* input buffer */ -} MD5_CTX; - -void _cdecl MD5Init(MD5_CTX *mdContext); -void _cdecl MD5Update(MD5_CTX *mdContext, unsigned char *bug, unsigned int len); -void _cdecl MD5Final(unsigned char digest[16], MD5_CTX *mdContext); -void Transform(UINT4 *buf, UINT4 *in); - diff --git a/Crypto/Rmd160.c b/Crypto/Rmd160.c new file mode 100644 index 0000000..cd3b68a --- /dev/null +++ b/Crypto/Rmd160.c @@ -0,0 +1,364 @@ +/* + * Copyright (c) 2001 Markus Friedl. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160", + * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997, + * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf + */ + +#include "rmd160.h" +#include + +#define PUT_64BIT_LE(cp, value) do { \ + (cp)[7] = (unsigned char)((value) >> 56); \ + (cp)[6] = (unsigned char)((value) >> 48); \ + (cp)[5] = (unsigned char)((value) >> 40); \ + (cp)[4] = (unsigned char)((value) >> 32); \ + (cp)[3] = (unsigned char)((value) >> 24); \ + (cp)[2] = (unsigned char)((value) >> 16); \ + (cp)[1] = (unsigned char)((value) >> 8); \ + (cp)[0] = (unsigned char)(value); } while (0) + +#define PUT_32BIT_LE(cp, value) do { \ + (cp)[3] = (unsigned char)((value) >> 24); \ + (cp)[2] = (unsigned char)((value) >> 16); \ + (cp)[1] = (unsigned char)((value) >> 8); \ + (cp)[0] = (unsigned char)(value); } while (0) + +#define H0 0x67452301U +#define H1 0xEFCDAB89U +#define H2 0x98BADCFEU +#define H3 0x10325476U +#define H4 0xC3D2E1F0U + +#define K0 0x00000000U +#define K1 0x5A827999U +#define K2 0x6ED9EBA1U +#define K3 0x8F1BBCDCU +#define K4 0xA953FD4EU + +#define KK0 0x50A28BE6U +#define KK1 0x5C4DD124U +#define KK2 0x6D703EF3U +#define KK3 0x7A6D76E9U +#define KK4 0x00000000U + +/* rotate x left n bits. */ +#define ROL(n, x) (((x) << (n)) | ((x) >> (32-(n)))) + +#define F0(x, y, z) ((x) ^ (y) ^ (z)) +#define F1(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define F2(x, y, z) (((x) | (~y)) ^ (z)) +#define F3(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define F4(x, y, z) ((x) ^ ((y) | (~z))) + +#define R(a, b, c, d, e, Fj, Kj, sj, rj) \ + do { \ + a = ROL(sj, a + Fj(b,c,d) + X(rj) + Kj) + e; \ + c = ROL(10, c); \ + } while(0) + +#define X(i) x[i] + +static u_char PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +void +RMD160Init(RMD160_CTX *ctx) +{ + ctx->count = 0; + ctx->state[0] = H0; + ctx->state[1] = H1; + ctx->state[2] = H2; + ctx->state[3] = H3; + ctx->state[4] = H4; +} + +void +RMD160Update(RMD160_CTX *ctx, const u_char *input, u_int32_t len) +{ + u_int32_t have, off, need; + + have = (unsigned long)((ctx->count/8) % 64); + need = 64 - have; + ctx->count += 8 * len; + off = 0; + + if (len >= need) { + if (have) { + memcpy(ctx->buffer + have, input, need); + RMD160Transform(ctx->state, ctx->buffer); + off = need; + have = 0; + } + /* now the buffer is empty */ + while (off + 64 <= len) { + RMD160Transform(ctx->state, input+off); + off += 64; + } + } + if (off < len) + memcpy(ctx->buffer + have, input+off, len-off); +} + +void +RMD160Final(u_char digest[20], RMD160_CTX *ctx) +{ + int i; + u_char size[8]; + u_int32_t padlen; + + PUT_64BIT_LE(size, ctx->count); + + /* + * pad to 64 byte blocks, at least one byte from PADDING plus 8 bytes + * for the size + */ + padlen = (unsigned long)(64 - ((ctx->count/8) % 64)); + if (padlen < 1 + 8) + padlen += 64; + RMD160Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */ + RMD160Update(ctx, size, 8); + + if (digest != 0) + for (i = 0; i < 5; i++) + PUT_32BIT_LE(digest + i*4, ctx->state[i]); + + memset(ctx, 0, sizeof (*ctx)); +} + +void +RMD160Transform(u_int32_t state[5], const u_char block[64]) +{ + u_int32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16]; + +#if BYTE_ORDER == LITTLE_ENDIAN + memcpy(x, block, 64); +#else + int i; + + for (i = 0; i < 16; i++) + x[i] = (u_int32_t)( + (u_int32_t)(block[i*4 + 0]) | + (u_int32_t)(block[i*4 + 1]) << 8 | + (u_int32_t)(block[i*4 + 2]) << 16 | + (u_int32_t)(block[i*4 + 3]) << 24); +#endif + + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + + /* Round 1 */ + R(a, b, c, d, e, F0, K0, 11, 0); + R(e, a, b, c, d, F0, K0, 14, 1); + R(d, e, a, b, c, F0, K0, 15, 2); + R(c, d, e, a, b, F0, K0, 12, 3); + R(b, c, d, e, a, F0, K0, 5, 4); + R(a, b, c, d, e, F0, K0, 8, 5); + R(e, a, b, c, d, F0, K0, 7, 6); + R(d, e, a, b, c, F0, K0, 9, 7); + R(c, d, e, a, b, F0, K0, 11, 8); + R(b, c, d, e, a, F0, K0, 13, 9); + R(a, b, c, d, e, F0, K0, 14, 10); + R(e, a, b, c, d, F0, K0, 15, 11); + R(d, e, a, b, c, F0, K0, 6, 12); + R(c, d, e, a, b, F0, K0, 7, 13); + R(b, c, d, e, a, F0, K0, 9, 14); + R(a, b, c, d, e, F0, K0, 8, 15); /* #15 */ + /* Round 2 */ + R(e, a, b, c, d, F1, K1, 7, 7); + R(d, e, a, b, c, F1, K1, 6, 4); + R(c, d, e, a, b, F1, K1, 8, 13); + R(b, c, d, e, a, F1, K1, 13, 1); + R(a, b, c, d, e, F1, K1, 11, 10); + R(e, a, b, c, d, F1, K1, 9, 6); + R(d, e, a, b, c, F1, K1, 7, 15); + R(c, d, e, a, b, F1, K1, 15, 3); + R(b, c, d, e, a, F1, K1, 7, 12); + R(a, b, c, d, e, F1, K1, 12, 0); + R(e, a, b, c, d, F1, K1, 15, 9); + R(d, e, a, b, c, F1, K1, 9, 5); + R(c, d, e, a, b, F1, K1, 11, 2); + R(b, c, d, e, a, F1, K1, 7, 14); + R(a, b, c, d, e, F1, K1, 13, 11); + R(e, a, b, c, d, F1, K1, 12, 8); /* #31 */ + /* Round 3 */ + R(d, e, a, b, c, F2, K2, 11, 3); + R(c, d, e, a, b, F2, K2, 13, 10); + R(b, c, d, e, a, F2, K2, 6, 14); + R(a, b, c, d, e, F2, K2, 7, 4); + R(e, a, b, c, d, F2, K2, 14, 9); + R(d, e, a, b, c, F2, K2, 9, 15); + R(c, d, e, a, b, F2, K2, 13, 8); + R(b, c, d, e, a, F2, K2, 15, 1); + R(a, b, c, d, e, F2, K2, 14, 2); + R(e, a, b, c, d, F2, K2, 8, 7); + R(d, e, a, b, c, F2, K2, 13, 0); + R(c, d, e, a, b, F2, K2, 6, 6); + R(b, c, d, e, a, F2, K2, 5, 13); + R(a, b, c, d, e, F2, K2, 12, 11); + R(e, a, b, c, d, F2, K2, 7, 5); + R(d, e, a, b, c, F2, K2, 5, 12); /* #47 */ + /* Round 4 */ + R(c, d, e, a, b, F3, K3, 11, 1); + R(b, c, d, e, a, F3, K3, 12, 9); + R(a, b, c, d, e, F3, K3, 14, 11); + R(e, a, b, c, d, F3, K3, 15, 10); + R(d, e, a, b, c, F3, K3, 14, 0); + R(c, d, e, a, b, F3, K3, 15, 8); + R(b, c, d, e, a, F3, K3, 9, 12); + R(a, b, c, d, e, F3, K3, 8, 4); + R(e, a, b, c, d, F3, K3, 9, 13); + R(d, e, a, b, c, F3, K3, 14, 3); + R(c, d, e, a, b, F3, K3, 5, 7); + R(b, c, d, e, a, F3, K3, 6, 15); + R(a, b, c, d, e, F3, K3, 8, 14); + R(e, a, b, c, d, F3, K3, 6, 5); + R(d, e, a, b, c, F3, K3, 5, 6); + R(c, d, e, a, b, F3, K3, 12, 2); /* #63 */ + /* Round 5 */ + R(b, c, d, e, a, F4, K4, 9, 4); + R(a, b, c, d, e, F4, K4, 15, 0); + R(e, a, b, c, d, F4, K4, 5, 5); + R(d, e, a, b, c, F4, K4, 11, 9); + R(c, d, e, a, b, F4, K4, 6, 7); + R(b, c, d, e, a, F4, K4, 8, 12); + R(a, b, c, d, e, F4, K4, 13, 2); + R(e, a, b, c, d, F4, K4, 12, 10); + R(d, e, a, b, c, F4, K4, 5, 14); + R(c, d, e, a, b, F4, K4, 12, 1); + R(b, c, d, e, a, F4, K4, 13, 3); + R(a, b, c, d, e, F4, K4, 14, 8); + R(e, a, b, c, d, F4, K4, 11, 11); + R(d, e, a, b, c, F4, K4, 8, 6); + R(c, d, e, a, b, F4, K4, 5, 15); + R(b, c, d, e, a, F4, K4, 6, 13); /* #79 */ + + aa = a ; bb = b; cc = c; dd = d; ee = e; + + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + + /* Parallel round 1 */ + R(a, b, c, d, e, F4, KK0, 8, 5); + R(e, a, b, c, d, F4, KK0, 9, 14); + R(d, e, a, b, c, F4, KK0, 9, 7); + R(c, d, e, a, b, F4, KK0, 11, 0); + R(b, c, d, e, a, F4, KK0, 13, 9); + R(a, b, c, d, e, F4, KK0, 15, 2); + R(e, a, b, c, d, F4, KK0, 15, 11); + R(d, e, a, b, c, F4, KK0, 5, 4); + R(c, d, e, a, b, F4, KK0, 7, 13); + R(b, c, d, e, a, F4, KK0, 7, 6); + R(a, b, c, d, e, F4, KK0, 8, 15); + R(e, a, b, c, d, F4, KK0, 11, 8); + R(d, e, a, b, c, F4, KK0, 14, 1); + R(c, d, e, a, b, F4, KK0, 14, 10); + R(b, c, d, e, a, F4, KK0, 12, 3); + R(a, b, c, d, e, F4, KK0, 6, 12); /* #15 */ + /* Parallel round 2 */ + R(e, a, b, c, d, F3, KK1, 9, 6); + R(d, e, a, b, c, F3, KK1, 13, 11); + R(c, d, e, a, b, F3, KK1, 15, 3); + R(b, c, d, e, a, F3, KK1, 7, 7); + R(a, b, c, d, e, F3, KK1, 12, 0); + R(e, a, b, c, d, F3, KK1, 8, 13); + R(d, e, a, b, c, F3, KK1, 9, 5); + R(c, d, e, a, b, F3, KK1, 11, 10); + R(b, c, d, e, a, F3, KK1, 7, 14); + R(a, b, c, d, e, F3, KK1, 7, 15); + R(e, a, b, c, d, F3, KK1, 12, 8); + R(d, e, a, b, c, F3, KK1, 7, 12); + R(c, d, e, a, b, F3, KK1, 6, 4); + R(b, c, d, e, a, F3, KK1, 15, 9); + R(a, b, c, d, e, F3, KK1, 13, 1); + R(e, a, b, c, d, F3, KK1, 11, 2); /* #31 */ + /* Parallel round 3 */ + R(d, e, a, b, c, F2, KK2, 9, 15); + R(c, d, e, a, b, F2, KK2, 7, 5); + R(b, c, d, e, a, F2, KK2, 15, 1); + R(a, b, c, d, e, F2, KK2, 11, 3); + R(e, a, b, c, d, F2, KK2, 8, 7); + R(d, e, a, b, c, F2, KK2, 6, 14); + R(c, d, e, a, b, F2, KK2, 6, 6); + R(b, c, d, e, a, F2, KK2, 14, 9); + R(a, b, c, d, e, F2, KK2, 12, 11); + R(e, a, b, c, d, F2, KK2, 13, 8); + R(d, e, a, b, c, F2, KK2, 5, 12); + R(c, d, e, a, b, F2, KK2, 14, 2); + R(b, c, d, e, a, F2, KK2, 13, 10); + R(a, b, c, d, e, F2, KK2, 13, 0); + R(e, a, b, c, d, F2, KK2, 7, 4); + R(d, e, a, b, c, F2, KK2, 5, 13); /* #47 */ + /* Parallel round 4 */ + R(c, d, e, a, b, F1, KK3, 15, 8); + R(b, c, d, e, a, F1, KK3, 5, 6); + R(a, b, c, d, e, F1, KK3, 8, 4); + R(e, a, b, c, d, F1, KK3, 11, 1); + R(d, e, a, b, c, F1, KK3, 14, 3); + R(c, d, e, a, b, F1, KK3, 14, 11); + R(b, c, d, e, a, F1, KK3, 6, 15); + R(a, b, c, d, e, F1, KK3, 14, 0); + R(e, a, b, c, d, F1, KK3, 6, 5); + R(d, e, a, b, c, F1, KK3, 9, 12); + R(c, d, e, a, b, F1, KK3, 12, 2); + R(b, c, d, e, a, F1, KK3, 9, 13); + R(a, b, c, d, e, F1, KK3, 12, 9); + R(e, a, b, c, d, F1, KK3, 5, 7); + R(d, e, a, b, c, F1, KK3, 15, 10); + R(c, d, e, a, b, F1, KK3, 8, 14); /* #63 */ + /* Parallel round 5 */ + R(b, c, d, e, a, F0, KK4, 8, 12); + R(a, b, c, d, e, F0, KK4, 5, 15); + R(e, a, b, c, d, F0, KK4, 12, 10); + R(d, e, a, b, c, F0, KK4, 9, 4); + R(c, d, e, a, b, F0, KK4, 12, 1); + R(b, c, d, e, a, F0, KK4, 5, 5); + R(a, b, c, d, e, F0, KK4, 14, 8); + R(e, a, b, c, d, F0, KK4, 6, 7); + R(d, e, a, b, c, F0, KK4, 8, 6); + R(c, d, e, a, b, F0, KK4, 13, 2); + R(b, c, d, e, a, F0, KK4, 6, 13); + R(a, b, c, d, e, F0, KK4, 5, 14); + R(e, a, b, c, d, F0, KK4, 15, 0); + R(d, e, a, b, c, F0, KK4, 13, 3); + R(c, d, e, a, b, F0, KK4, 11, 9); + R(b, c, d, e, a, F0, KK4, 11, 11); /* #79 */ + + t = state[1] + cc + d; + state[1] = state[2] + dd + e; + state[2] = state[3] + ee + a; + state[3] = state[4] + aa + b; + state[4] = state[0] + bb + c; + state[0] = t; +} diff --git a/Crypto/Rmd160.h b/Crypto/Rmd160.h new file mode 100644 index 0000000..b896f8c --- /dev/null +++ b/Crypto/Rmd160.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2001 Markus Friedl. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _RMD160_H +#define _RMD160_H + +#ifndef u_int32_t +#define u_int32_t unsigned long +#define u_int64_t unsigned __int64 +#define u_char unsigned char +#endif + +/* RMD160 context. */ +typedef struct RMD160Context { + u_int32_t state[5]; /* state */ + u_int64_t count; /* number of bits, modulo 2^64 */ + u_char buffer[64]; /* input buffer */ +} RMD160_CTX; + +void _cdecl RMD160Init(RMD160_CTX *); +void _cdecl RMD160Transform(u_int32_t [5], const u_char [64]); +void _cdecl RMD160Update(RMD160_CTX *, const u_char *, u_int32_t); +void _cdecl RMD160Final(u_char [20], RMD160_CTX *); + +#endif /* _RMD160_H */ diff --git a/Crypto/SHA.C b/Crypto/SHA.C deleted file mode 100644 index 7040c6a..0000000 --- a/Crypto/SHA.C +++ /dev/null @@ -1,168 +0,0 @@ -/* Implementation of NIST's Secure Hash Algorithm (FIPS 180) Lightly bummed - for execution efficiency. - -Jim Gillogly 3 May 1993 - -Copyright 1993, Dr. James J. Gillogly This code may be freely used in any - application. */ - - -#include -#include "sha.h" - -#pragma intrinsic(memcpy) - -#define f0(x,y,z) (z ^ (x & (y ^ z))) /* Magic functions */ -#define f1(x,y,z) (x ^ y ^ z) -#define f2(x,y,z) ((x & y) | (z & (x | y))) -#define f3(x,y,z) (x ^ y ^ z) - -#define K0 0x5a827999 /* Magic constants */ -#define K1 0x6ed9eba1 -#define K2 0x8f1bbcdc -#define K3 0xca62c1d6 - -#define S(n, X) ((X << n) | (X >> (32 - n))) /* Barrel roll */ - -#define r0(f, K) \ - temp = S(5, A) + f(B, C, D) + E + *p0++ + K; \ - E = D; \ - D = C; \ - C = S(30, B); \ - B = A; \ - A = temp - -#define r1_0(f, K) \ - temp = S(5, A) + f(B, C, D) + E + \ - (*p0++ = *p1++ ^ *p2++ ^ *p3++ ^ *p4++) + K; \ - E = D; \ - D = C; \ - C = S(30, B); \ - B = A; \ - A = temp - -void -_cdecl ShaTransform0 (unsigned long *hash, unsigned long *data) /* NIST original */ -{ - unsigned long W[80]; - - unsigned long *p0, *p1, *p2, *p3, *p4; - unsigned long A, B, C, D, E, temp; - - unsigned long h0, h1, h2, h3, h4; - - h0 = hash[0]; - h1 = hash[1]; - h2 = hash[2]; - h3 = hash[3]; - h4 = hash[4]; - - memcpy (W, data, 64); - - p0 = W; - A = h0; - B = h1; - C = h2; - D = h3; - E = h4; - - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - r0 (f0, K0); - - p1 = &W[13]; - p2 = &W[8]; - p3 = &W[2]; - p4 = &W[0]; - - r1_0 (f0, K0); - r1_0 (f0, K0); - r1_0 (f0, K0); - r1_0 (f0, K0); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f1, K1); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f2, K2); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - r1_0 (f3, K3); - - h0 += A; - h1 += B; - h2 += C; - h3 += D; - h4 += E; - - hash[0] = h0; - hash[1] = h1; - hash[2] = h2; - hash[3] = h3; - hash[4] = h4; -} - diff --git a/Crypto/SHA.H b/Crypto/SHA.H deleted file mode 100644 index 1378d0a..0000000 --- a/Crypto/SHA.H +++ /dev/null @@ -1 +0,0 @@ -void _cdecl ShaTransform0 (unsigned long *hash, unsigned long *data); diff --git a/Docs/Changelog.txt b/Docs/Changelog.txt index d8917d5..bbf6c26 100644 --- a/Docs/Changelog.txt +++ b/Docs/Changelog.txt @@ -1,3 +1,101 @@ +-- Version 2.1 - Released 2004/06/21 -- + + * D:/Projects/Cvs/TrueCrypt/Setup/SETUP.C 1.8: + Restore point is not created if volumes are mounted + + * D:/Projects/Cvs/TrueCrypt/Mount/Mount.c 1.10: + Command line fixes + + * D:/Projects/Cvs/TrueCrypt/Setup/SETUP.C 1.7: + Uninstall does not display upgrade info + + * D:/Projects/Cvs/TrueCrypt/Common/FAT.C 1.5: + Progress info improved for quick format + + * D:/Projects/Cvs/TrueCrypt/Common/DISMOUNT.C 1.3: + UnmountAllVolumes() can handle nested containers + + * D:/Projects/Cvs/TrueCrypt/Mount/Mount.c 1.11: + * D:/Projects/Cvs/TrueCrypt/Mount/Mount.rc 1.6: + * D:/Projects/Cvs/TrueCrypt/Mount/resource.h 1.3: + License can be displayed via help menu + + * D:/Projects/Cvs/TrueCrypt/Common/FORMAT.C 1.6: + * D:/Projects/Cvs/TrueCrypt/Common/FORMAT.H 1.4: + * D:/Projects/Cvs/TrueCrypt/Format/Format.rc 1.9: + * D:/Projects/Cvs/TrueCrypt/Format/Format.vcproj 1.4: + * D:/Projects/Cvs/TrueCrypt/Format/TCFORMAT.C 1.8: + Volumes can be formatted as NTFS + + * D:/Projects/Cvs/TrueCrypt/Common/PROGRESS.C 1.4: + Progress display of large values improved + + * D:/Projects/Cvs/TrueCrypt/Common/VOLUMES.C 1.9: + * D:/Projects/Cvs/TrueCrypt/Format/Format.rc 1.10: + * D:/Projects/Cvs/TrueCrypt/Format/TCFORMAT.C 1.9: + * D:/Projects/Cvs/TrueCrypt/Format/resource.h 1.5: + Header key is displayed instead of salt on format page + Key and random pool display on format page can be disabled by user + + * D:/Projects/Cvs/TrueCrypt/Format/TCFORMAT.C 1.10: + Help strings fixed + + * D:/Projects/Cvs/TrueCrypt/Driver/NTDRIVER.C 1.3: + Root device is not created as FILE_DEVICE_DISK + + * D:/Projects/Cvs/TrueCrypt/Common/FAT.C 1.4: + * D:/Projects/Cvs/TrueCrypt/Common/FAT.H 1.3: + * D:/Projects/Cvs/TrueCrypt/Common/FORMAT.C 1.5: + * D:/Projects/Cvs/TrueCrypt/Common/FORMAT.H 1.3: + * D:/Projects/Cvs/TrueCrypt/Common/PROGRESS.C 1.3: + * D:/Projects/Cvs/TrueCrypt/Common/PROGRESS.H 1.3: + * D:/Projects/Cvs/TrueCrypt/Format/Format.rc 1.8: + * D:/Projects/Cvs/TrueCrypt/Format/TCFORMAT.C 1.7: + * D:/Projects/Cvs/TrueCrypt/Format/resource.h 1.4: + Volumes larger than 2048 GB can be created + Better support for more filesystem formats + Volumes can be created unformatted (no filesystem) + + * D:/Projects/Cvs/TrueCrypt/Driver/NTVOL.C 1.3: + Encrypted boot sector is ignored by driver, fixes OS error when + mounting corrupted or unformatted volumes + + * D:/Projects/Cvs/TrueCrypt/Common/CRYPTO.H 1.6: + * D:/Projects/Cvs/TrueCrypt/Common/RANDOM.C 1.6: + * D:/Projects/Cvs/TrueCrypt/Common/RANDOM.H 1.4: + * D:/Projects/Cvs/TrueCrypt/Format/Format.rc 1.7: + * D:/Projects/Cvs/TrueCrypt/Format/TCFORMAT.C 1.6: + PRNG uses hash function selected by user + + * D:/Projects/Cvs/TrueCrypt/Common/PASSWORD.C 1.3: + * D:/Projects/Cvs/TrueCrypt/Common/PASSWORD.H 1.3: + * D:/Projects/Cvs/TrueCrypt/Mount/Mount.c 1.9: + * D:/Projects/Cvs/TrueCrypt/Mount/Mount.rc 1.5: + * D:/Projects/Cvs/TrueCrypt/Mount/resource.h 1.2: + User can change PKCS5 PRF algorithm when changing password + + * D:/Projects/Cvs/TrueCrypt/Common/CRYPTO.H 1.5: + * D:/Projects/Cvs/TrueCrypt/Crypto/Crypto.vcproj 1.5: + * D:/Projects/Cvs/TrueCrypt/Crypto/SHA.C 1.2: + * D:/Projects/Cvs/TrueCrypt/Crypto/SHA.H 1.2: + SHA stale code removed + + * D:/Projects/Cvs/TrueCrypt/Common/CRYPTO.H 1.4: + * D:/Projects/Cvs/TrueCrypt/Common/PKCS5.C 1.3: + * D:/Projects/Cvs/TrueCrypt/Common/PKCS5.H 1.3: + * D:/Projects/Cvs/TrueCrypt/Common/VOLUMES.C 1.8: + * D:/Projects/Cvs/TrueCrypt/Crypto/Crypto.vcproj 1.4: + * D:/Projects/Cvs/TrueCrypt/Crypto/MD5.C 1.2: + * D:/Projects/Cvs/TrueCrypt/Crypto/MD5.H 1.2: + * D:/Projects/Cvs/TrueCrypt/Crypto/Rmd160.c 1.1: + * D:/Projects/Cvs/TrueCrypt/Crypto/Rmd160.h 1.1: + * D:/Projects/Cvs/TrueCrypt/Format/Format.rc 1.6: + * D:/Projects/Cvs/TrueCrypt/Format/TCFORMAT.C 1.5: + * D:/Projects/Cvs/TrueCrypt/Format/resource.h 1.3: + MD5 removed + PKCS5 PRF HMAC-RIPEMD-160 added + + -- Version 2.0 - Released 2004/06/07 -- * TrueCrypt/Service/NTSERVICE.C 1.2: diff --git a/Docs/License.txt b/Docs/License.txt index 5bdb53c..a7a956f 100644 --- a/Docs/License.txt +++ b/Docs/License.txt @@ -1,224 +1,194 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +TRUECRYPT LICENSE + +This product can be copied and distributed free of charge, including +source code. + +You may modify this product and source code, and distribute such modifications, +and you may derive new works based on this product, provided that: + +1. Any product which is simply derived from this product cannot be +called E4M, or Encryption for the Masses. + +2. If you use any of the source code in your product, and your product +is distributed with source code, you must include this notice with +those portions of this source code that you use. + +Or, + +If your product is distributed in binary form only, you must display +on any packaging, and marketing materials which reference +your product, a notice which states: + +"This product uses components written by Paul Le Roux " + +3. If you use any of the source code originally by Eric Young, you must +in addition follow his terms and conditions. + +4. Nothing requires that you accept this License, as you have not +signed it. However, nothing else grants you permission to modify or +distribute the product or its derivative works. + +These actions are prohibited by law if you do not accept this License. + +5. If any of these license terms is found to be to broad in scope, and +declared invalid by any court or legal process, you agree that all other +terms shall not be so affected, and shall remain valid and enforceable. + +6. THIS PROGRAM IS DISTRIBUTED FREE OF CHARGE, THEREFORE THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. UNLESS OTHERWISE +STATED THE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +7. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +OUT OF THE USE OR INABILITY TO USE THE PROGRAM, INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS +PROGRAMS, EVEN IF SUCH HOLDER OR OTHER PARTY HAD PREVIOUSLY BEEN ADVISED +OF THE POSSIBILITY OF SUCH DAMAGES. + +8. Where applicable, the specific licenses attached to parts of the source +code might take precedence over this general license. + +9. The IDEA cipher described in U.S. patent number 5,214,703 requires a +separate license from Ascom Tech AG for commercial use. IDEA is a trademark +of Ascom Tech AG. + +10. If you use any part of the source code by Dr. Brian Gladman in your +project, you must follow his terms and conditions. + +11. If you use any part of the source code by Markus Friedl in your project, +you must follow his terms and conditions. + +12. This product contains no mechanism or facility that would allow partial +or complete recovery of your data without knowing the correct password or +the key used to encrypt the data. + +Portions of this software are: +Copyright (c) 1998-2000 Paul Le Roux. All Rights Reserved. +Copyright (c) 2004 TrueCrypt Team. All Rights Reserved. +Copyright (c) 2004 TrueCrypt Foundation. All Rights Reserved. +Copyright (c) 1995-1997 Eric Young. All Rights Reserved. +Copyright (c) 1992-1999 Masayasu Kumagai, Paulo Barreto, Peter Gutmann. +Copyright (c) 2003 Dr. Brian Gladman, Worcester, UK. All Rights Reserved. +Copyright (c) 2001 Markus Friedl. All Rights Reserved. +For more information, see the legal notices attached to parts of the source code. +This is a TrueCrypt Foundation release. + +END OF GENERAL LICENSE + + +Component Legal Notices: +____________________________________________________________ + +Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +All rights reserved. + +This package is an SSL implementation written +by Eric Young (eay@cryptsoft.com). +The implementation was written so as to conform with Netscapes SSL. + +This library is free for commercial and non-commercial use as long as +the following conditions are aheared to. The following conditions +apply to all code found in this distribution, be it the RC4, RSA, +lhash, DES, etc., code; not just the SSL code. The SSL documentation +included with this distribution is covered by the same copyright terms +except that the holder is Tim Hudson (tjh@cryptsoft.com). + +Copyright remains Eric Young's, and as such any Copyright notices in +the code are not to be removed. +If this package is used in a product, Eric Young should be given attribution +as the author of the parts of the library used. +This can be in the form of a textual message at program startup or +in documentation (online or textual) provided with the package. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + "This product includes cryptographic software written by + Eric Young (eay@cryptsoft.com)" + The word 'cryptographic' can be left out if the rouines from the library + being used are not cryptographic related :-). +4. If you include any Windows specific code (or a derivative thereof) from + the apps directory (application code) you must include an acknowledgement: + "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + +THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +The licence and distribution terms for any publically available version or +derivative of this code cannot be changed. i.e. this code cannot simply be +copied and put under another distribution licence +[including the GNU Public Licence.] +____________________________________________________________ + +Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. + +LICENSE TERMS + +The free distribution and use of this software in both source and binary +form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + +ALTERNATIVELY, provided that this notice is retained in full, this product +may be distributed under the terms of the GNU General Public License (GPL), +in which case the provisions of the GPL apply INSTEAD OF those given above. + +DISCLAIMER + +This software is provided 'as is' with no explicit or implied warranties +in respect of its properties, including, but not limited to, correctness +and/or fitness for purpose. +____________________________________________________________ + +Copyright (c) 2001 Markus Friedl. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Driver/Driver.rc b/Driver/Driver.rc index 50caa87..c23f423 100644 --- a/Driver/Driver.rc +++ b/Driver/Driver.rc @@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,0 - PRODUCTVERSION 2,0,0,0 + FILEVERSION 2,1,0,0 + PRODUCTVERSION 2,1,0,0 FILEFLAGSMASK 0x37L #ifdef _DEBUG FILEFLAGS 0x21L @@ -45,11 +45,11 @@ BEGIN BEGIN VALUE "CompanyName", "TrueCrypt Foundation" VALUE "FileDescription", "TrueCrypt Driver" - VALUE "FileVersion", "2.0" + VALUE "FileVersion", "2.1" VALUE "LegalCopyright", "TrueCrypt Foundation" VALUE "OriginalFilename", "truecrypt.sys" VALUE "ProductName", "TrueCrypt" - VALUE "ProductVersion", "2.0" + VALUE "ProductVersion", "2.1" VALUE "SpecialBuild", "June 2004" END END diff --git a/Driver/MAKEFILE b/Driver/MAKEFILE index 7a5f45c..570b51a 100644 --- a/Driver/MAKEFILE +++ b/Driver/MAKEFILE @@ -69,7 +69,7 @@ LINK_D = link $(LFLAGS_D) -nologo -out:$(BASENAME).sys -machine:IX86 \ $(DDK)\lib\$(OS)\i386\ntoskrnl.lib \ $(DDK)\lib\$(OS)\i386\hal.lib -CFLAGS = $(CFLAGS_D) -nologo -DNT4_DRIVER -I"C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include" -I$(DDK)\inc\$(OS) -I$(DDK)\inc\ddk\$(OS) -I$(DDK)\inc\ddk\wdm\$(OS) -YXTCdefs.h +CFLAGS = $(CFLAGS_D) -nologo -DNT4_DRIVER -I$(DDK)\inc\$(OS) -I$(DDK)\inc\ddk\$(OS) -I$(DDK)\inc\ddk\wdm\$(OS) -YXTCdefs.h {..}.c{}.obj : diff --git a/Driver/NTDRIVER.C b/Driver/NTDRIVER.C index 42180d0..301eb9e 100644 --- a/Driver/NTDRIVER.C +++ b/Driver/NTDRIVER.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" @@ -317,12 +321,12 @@ TCCreateRootDeviceObject (PDRIVER_OBJECT DriverObject) RtlInitUnicodeString (&Win32NameString, dosname); Dump ("Creating root device nt=%ls dos=%ls\n", ntname, dosname); - + ntStatus = IoCreateDevice ( DriverObject, /* Our Driver Object */ sizeof (BOOL), /* Size of state information */ &ntUnicodeString, /* Device name "\Device\Name" */ - FILE_DEVICE_DISK, /* Device type */ + FILE_DEVICE_UNKNOWN, /* Device type */ 0, /* Device characteristics */ FALSE, /* Exclusive device */ &DeviceObject); /* Returned ptr to Device Object */ diff --git a/Driver/NTDRIVER.H b/Driver/NTDRIVER.H index 7093c40..430dc21 100644 --- a/Driver/NTDRIVER.H +++ b/Driver/NTDRIVER.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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. */ /* This structure is used to start new threads */ typedef struct _THREAD_BLOCK_ diff --git a/Driver/NTFILEDV.C b/Driver/NTFILEDV.C index f88e630..4245a56 100644 --- a/Driver/NTFILEDV.C +++ b/Driver/NTFILEDV.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" diff --git a/Driver/NTFILEDV.H b/Driver/NTFILEDV.H index 5a4d34c..7c4b835 100644 --- a/Driver/NTFILEDV.H +++ b/Driver/NTFILEDV.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ diff --git a/Driver/NTRAWDV.C b/Driver/NTRAWDV.C index ab5dfde..f5e124b 100644 --- a/Driver/NTRAWDV.C +++ b/Driver/NTRAWDV.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" diff --git a/Driver/NTRAWDV.H b/Driver/NTRAWDV.H index 28ad328..b2aaabc 100644 --- a/Driver/NTRAWDV.H +++ b/Driver/NTRAWDV.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ diff --git a/Driver/NTVOL.C b/Driver/NTVOL.C index 0c7c40d..ecb229a 100644 --- a/Driver/NTVOL.C +++ b/Driver/NTVOL.C @@ -1,9 +1,12 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 "fat.h" #include "volumes.h" #include "apidrvr.h" @@ -279,34 +282,14 @@ TCOpenVolume (PDEVICE_OBJECT DeviceObject, if (mount->nReturnCode == 0) { - /* Handle the volume setup for TC */ - - boot_sector = (struct msdos_boot_sector *) (readBuffer + SECTOR_SIZE); - - /* It's in the volume file so we must decrypt it */ - Extension->cryptoInfo->decrypt_sector ((ULONG *) boot_sector, 1, 1, - &Extension->cryptoInfo->ks[0], - Extension->cryptoInfo->iv, - Extension->cryptoInfo->cipher); - /* There's one extra sector than there should be */ Extension->DiskLength -= SECTOR_SIZE; - /* Volume setup end */ - - //Extension->TracksPerCylinder = boot_sector->heads; - //Extension->SectorsPerTrack = boot_sector->secs_track; - //Extension->NumberOfCylinders = (ULONG) (Extension->DiskLength / Extension->BytesPerSector / - // Extension->SectorsPerTrack / Extension->TracksPerCylinder); Extension->TracksPerCylinder = 1; Extension->SectorsPerTrack = 1; - Extension->BytesPerSector = *((unsigned short *) boot_sector->sector_size); - Extension->NumberOfCylinders = Extension->DiskLength / Extension->BytesPerSector; - - Extension->PartitionType = (UCHAR) ((boot_sector->fs_type[4] == '6') ? - PARTITION_FAT_16 : PARTITION_FAT_12); - if(boot_sector->fs_type[3] == '3') Extension->PartitionType = (UCHAR) PARTITION_FAT32; - + Extension->BytesPerSector = 512; + Extension->NumberOfCylinders = Extension->DiskLength / 512; + Extension->PartitionType = 0; Extension->bRawDevice = bRawDevice; if (wcslen (pwszMountVolume) < 64) diff --git a/Driver/NTVOL.H b/Driver/NTVOL.H index 1f256ec..29ce9fa 100644 --- a/Driver/NTVOL.H +++ b/Driver/NTVOL.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ diff --git a/Format/Format.rc b/Format/Format.rc index 2a6e7fa..a67f21f 100644 --- a/Format/Format.rc +++ b/Format/Format.rc @@ -28,8 +28,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,0 - PRODUCTVERSION 2,0,0,0 + FILEVERSION 2,1,0,0 + PRODUCTVERSION 2,1,0,0 FILEFLAGSMASK 0x37L #ifdef _DEBUG FILEFLAGS 0x21L @@ -46,11 +46,11 @@ BEGIN BEGIN VALUE "CompanyName", "TrueCrypt Foundation" VALUE "FileDescription", "TrueCrypt Format" - VALUE "FileVersion", "2.0" + VALUE "FileVersion", "2.1" VALUE "LegalCopyright", "TrueCrypt Foundation" VALUE "OriginalFilename", "TrueCrypt Format.exe" VALUE "ProductName", "TrueCrypt" - VALUE "ProductVersion", "2.0" + VALUE "ProductVersion", "2.1" VALUE "SpecialBuild", "June 2004" END END @@ -90,16 +90,14 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN COMBOBOX IDC_COMBO_BOX,7,26,137,89,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - CONTROL "HMAC-SHA-1",IDC_SHA1,"Button",BS_AUTORADIOBUTTON | NOT - WS_VISIBLE | WS_GROUP,5,101,204,10 - CONTROL "HMAC-RIPEMD-160",IDC_RIPEMD160,"Button", - BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_DISABLED,5,113, - 203,10 + CONTROL "SHA-1",IDC_SHA1,"Button",BS_AUTORADIOBUTTON | WS_GROUP, + 5,104,204,10 + CONTROL "RIPEMD-160",IDC_RIPEMD160,"Button",BS_AUTORADIOBUTTON,5, + 116,203,10 LTEXT "BOX HELP",IDC_BOX_HELP,7,43,205,42 PUSHBUTTON "&Test",IDC_CIPHER_TEST,149,25,59,14 GROUPBOX "Cipher",IDC_STATIC,0,13,217,75 - GROUPBOX "PRF (PKCS-5 v2.0 and random number generator)", - IDC_STATIC,0,89,217,51,NOT WS_VISIBLE + GROUPBOX "Hash Algorithm",IDC_STATIC,0,92,217,40 END IDD_PASSWORD_PAGE_DLG DIALOGEX 0, 0, 217, 154 @@ -143,17 +141,14 @@ IDD_FORMAT_PAGE_DLG DIALOGEX 0, 0, 217, 156 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - RTEXT "Key Salt:",IDC_STATIC,5,44,43,8 - LTEXT "",IDC_KEY_SALT,53,44,160,8 - RTEXT "Master Key:",IDC_STATIC,7,52,41,8 - LTEXT "",IDC_DISK_KEY,53,52,160,8 - RTEXT "Random Pool:",IDC_STATIC,3,36,45,8 - LTEXT "",IDC_RANDOM_BYTES,53,36,160,8 - COMBOBOX IDC_CLUSTERSIZE,99,10,44,90,CBS_DROPDOWNLIST | - WS_TABSTOP - LTEXT "Cluster",IDC_STATIC,75,13,24,9 + RTEXT "Header Key:",IDC_STATIC,5,45,43,8 + LTEXT "",IDC_HEADER_KEY,52,45,160,8 + RTEXT "Master Key:",IDC_STATIC,7,53,41,8 + LTEXT "",IDC_DISK_KEY,52,53,160,8 + LTEXT "",IDC_RANDOM_BYTES,52,37,150,8 + RTEXT "Cluster",IDC_STATIC,81,15,23,8 LTEXT "",IDC_BOX_HELP,1,110,212,42 - GROUPBOX "Format Options",IDC_STATIC,0,2,217,25 + GROUPBOX "Options",IDC_STATIC,0,3,217,27 PUSHBUTTON "Abort",IDC_CANCEL_BAR,162,73,50,14 CONTROL "",IDC_PROGRESS_BAR,"msctls_progress32",WS_BORDER | 0x1, 6,74,151,12 @@ -167,9 +162,16 @@ BEGIN RTEXT "Speed",IDC_STATIC,73,92,23,8 RTEXT "Left",IDC_STATIC,151,92,13,8 GROUPBOX "",IDC_STATIC,0,65,217,41 - GROUPBOX "",IDC_STATIC,0,29,217,35 CONTROL "Quick Format",IDC_QUICKFORMAT,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,9,12,58,10 + WS_TABSTOP,155,14,56,10 + RTEXT "Filesystem",IDC_STATIC,3,15,36,8,0,WS_EX_RIGHT + COMBOBOX IDC_FILESYS,41,12,36,90,CBS_DROPDOWNLIST | WS_TABSTOP + COMBOBOX IDC_CLUSTERSIZE,106,12,42,90,CBS_DROPDOWNLIST | + WS_TABSTOP + RTEXT "Random Pool:",IDC_STATIC,3,37,45,8 + GROUPBOX "",IDC_STATIC,0,30,217,35 + CONTROL "Check2",IDC_SHOW_KEYS,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,205,37,9,8 END IDD_VOLSTATS_DLG DIALOGEX 0, 0, 229, 146 @@ -180,7 +182,7 @@ CLASS "CustomDlg" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "",-1,2,0,225,144 - LTEXT "The volume has been successfully created and is ready for use.\n\nFile system details:", + LTEXT "The volume has been successfully created and is ready for use.\n\nFormat details:", -1,14,15,208,35 LTEXT "STATS BOX",IDC_STATS_BOX,14,50,201,61 DEFPUSHBUTTON "OK",IDOK,89,120,50,14 @@ -268,7 +270,7 @@ BEGIN IDD_CIPHER_PAGE_DLG, DIALOG BEGIN RIGHTMARGIN, 214 - BOTTOMMARGIN, 117 + BOTTOMMARGIN, 141 END IDD_PASSWORD_PAGE_DLG, DIALOG @@ -362,19 +364,14 @@ BEGIN IDS_FORMAT_TITLE "Last Step: Volume Format" IDS_PASSWORD_TITLE "Step 4: Volume Password" IDS_PREV "< &Prev" - IDS_SIZE_HELP0 "Please specify the size of the volume to create. The minimum size of a TrueCrypt volume is 19 KB. The maximum size of a file-hosted volume is limited by " - IDS_SIZE_HELP1 "the file system. A container stored on FAT32 cannot be larger than 4 GB." + IDS_SIZE_HELP0 "Please specify the size of the volume to create. The minimum size of a FAT volume is 19 KB. The minimum size of an NTFS volume is 2526 KB." + IDS_SIZE_HELP1 " The maximum size of a file-hosted volume is limited by the hosting file system. A container stored on FAT32 file system cannot be larger than 4 GB." IDS_FORMAT_HELP0 "Here you can set additional options that will affect the format of the new volume. Please refer to the documentation for more information. " END STRINGTABLE BEGIN IDS_TITLE "TrueCrypt Volume Creation Wizard" - IDS_VOL_STATUS0 "Volume size:\t\t%d sectors (%I64d MB)\nFile system:\t\tFAT%d\n" - IDS_VOL_STATUS1 "FAT size:\t\t%d bytes\nCluster size:\t\t%d bytes\nClusters available:\t%d" - IDS_VOL_STATUS2 "\n\nFormatting took %lu seconds." - IDS_VOL_NO_LABEL "no volume label." - IDS_VOL_LABEL "volume label %s\n" IDS_FORMAT_HELP1 "When done, click 'Format' to create your new volume. " IDS_FORMAT_HELP2 "There will be a short pause while your system is being polled for extra random data." IDS_READONLYPROMPT "The volume '%s' exists, and is read-only. Are you sure you want to replace it?" @@ -411,7 +408,6 @@ BEGIN IDS_TRIPLEDES_HELP1 "iteration). Note that this cipher is very slow." IDS_CAST_HELP0 "Designed by Carlisle Adams and Stafford Tavares, published in 1997. Uses a 128-bit key. " IDS_CAST_HELP1 "CAST is royalty-free both for commercial and non-commercial uses." - IDS_DRIVE_TOO_BIG "TrueCrypt volume cannot be larger than 2000 GB." IDS_EXT_PARTITION "Please create a logical drive for this extended partition, and then try again." IDS_CIPHER_TEST "%s Cipher Test" IDS_TESTS_PASSED "Self-tests of all algorithms passed" diff --git a/Format/Format.vcproj b/Format/Format.vcproj index 47848ae..330d89f 100644 --- a/Format/Format.vcproj +++ b/Format/Format.vcproj @@ -71,7 +71,6 @@ CharacterSet="2"> + + diff --git a/Format/REDTICK.C b/Format/REDTICK.C index ef8756d..acdfc13 100644 --- a/Format/REDTICK.C +++ b/Format/REDTICK.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 "redtick.h" diff --git a/Format/REDTICK.H b/Format/REDTICK.H index d691789..277fb1f 100644 --- a/Format/REDTICK.H +++ b/Format/REDTICK.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ diff --git a/Format/TCFORMAT.C b/Format/TCFORMAT.C index 88d3381..ce4b7cd 100644 --- a/Format/TCFORMAT.C +++ b/Format/TCFORMAT.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" @@ -59,8 +63,9 @@ BOOL bThreadRunning = FALSE; /* Is the thread running */ BOOL bDevice = FALSE; /* Is this a partition volume ? */ +BOOL showKeys = TRUE; HWND hDiskKey = NULL; /* Text box showing hex dump of disk key */ -HWND hKeySalt = NULL; /* Text box showing hex dump of key salt */ +HWND hHeaderKey = NULL; /* Text box showing hex dump of header key */ char szPassword[MAX_PASSWORD + 1]; /* Users password */ char szVerify[MAX_PASSWORD + 1];/* Tmp password buffer */ @@ -73,6 +78,8 @@ int nPbar = 0; /* Control ID of progress bar:- for format code */ volatile BOOL quickFormat = FALSE; +volatile int fileSystem = 0; +volatile int clusterSize = 0; void localcleanup (void) @@ -255,18 +262,15 @@ VerifySizeAndUpdate (HWND hwndDlg, BOOL bUpdate) void formatThreadFunction (void *hwndDlg) { - fatparams ft; int nStatus; char szDosDevice[TC_MAX_PATH]; char szCFDevice[TC_MAX_PATH]; - DWORD dwWin32FormatError, dwThen, dwNow; + char summaryMsg[512]; + DWORD dwWin32FormatError; int nDosLinkCreated = -1; ArrowWaitCursor (); - ft.cluster_size = SendMessage (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), CB_GETITEMDATA - ,SendMessage (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), CB_GETCURSEL, 0, 0) , 0); - if (bDevice == FALSE) { int x = _access (szDiskFile, 06); @@ -325,21 +329,20 @@ formatThreadFunction (void *hwndDlg) } } - dwThen = GetTickCount (); - nStatus = FormatVolume (szCFDevice, bDevice, + szDiskFile, nFileSize * nMultiplier, szPassword, nVolCipher, pkcs5, - &ft, quickFormat, + fileSystem, + clusterSize, + summaryMsg, hwndDlg ); - dwNow = GetTickCount (); - if (nStatus == ERR_OUTOFMEMORY) { AbortProcess (IDS_OUTOFMEMORY); @@ -369,8 +372,6 @@ formatThreadFunction (void *hwndDlg) { char szMsg[512]; - handleWin32Error (hwndDlg); - sprintf (szMsg, getstr (IDS_CREATE_FAILED), szDiskFile); MessageBox (hwndDlg, szMsg, lpszTitle, ICON_HAND); @@ -382,32 +383,11 @@ formatThreadFunction (void *hwndDlg) } else { - char szMsg[512]; - char szLabel[64]; - UINT nID[4] = - {IDS_VOL_STATUS0, - IDS_VOL_STATUS1, IDS_VOL_STATUS2, 0}; - - if (!strcmp ((char *) ft.volume_name, " ")) - { - strcat (szLabel, getstr (IDS_VOL_NO_LABEL)); - } - else - { - sprintf (szLabel, getstr (IDS_VOL_LABEL), ft.volume_name); - - } - - sprintf (szMsg, getmultilinestr (nID), ft.num_sectors, ((__int64) ft.num_sectors*512)/1024/1024, ft.size_fat - , (int) (512*ft.fats*ft.fat_length), - (int) (512*ft.cluster_size), ft.cluster_count, - (dwNow - dwThen)/1000); - NormalCursor (); /* Create the volstats dialog box */ DialogBoxParam (hInst, MAKEINTRESOURCE (IDD_VOLSTATS_DLG), hwndDlg, - (DLGPROC) VolstatsDlgProc, (LPARAM) & szMsg[0]); + (DLGPROC) VolstatsDlgProc, (LPARAM) & summaryMsg[0]); SetTimer (hwndDlg, 0xff, RANDOM_SHOW_TIMER, NULL); PostMessage (hwndDlg, WM_FORMAT_FINISHED, 0, 0); @@ -796,7 +776,7 @@ PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { case FILE_PAGE: { - UINT nID[4]; + UINT nID[4] = { 0,0,0,0 }; nID[0] = IDS_FILE_HELP0; nID[1] = IDS_FILE_HELP1; @@ -849,7 +829,7 @@ PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) } EnableWindow (GetDlgItem (hwndDlg, IDC_SHA1), TRUE); - EnableWindow (GetDlgItem (hwndDlg, IDC_RIPEMD160), FALSE); + EnableWindow (GetDlgItem (hwndDlg, IDC_RIPEMD160), TRUE); SetWindowText (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), getstr (IDS_NEXT)); SetWindowText (GetDlgItem (GetParent (hwndDlg), IDC_PREV), getstr (IDS_PREV)); @@ -861,12 +841,10 @@ PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) case SIZE_PAGE: { char szTmp[32]; - UINT nID[4]; + UINT nID[4] = { 0,0,0,0 }; nID[0] = IDS_SIZE_HELP0; nID[1] = IDS_SIZE_HELP1; - nID[2] = 0; - nID[3] = 0; if (bDevice == TRUE) { @@ -969,18 +947,22 @@ PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) SetTimer (GetParent (hwndDlg), 0xff, RANDOM_SHOW_TIMER, NULL); hDiskKey = GetDlgItem (hwndDlg, IDC_DISK_KEY); - hKeySalt = GetDlgItem (hwndDlg, IDC_KEY_SALT); - + hHeaderKey = GetDlgItem (hwndDlg, IDC_HEADER_KEY); SendMessage (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), WM_SETFONT, (WPARAM) hSmallFont, (LPARAM) TRUE); SendMessage (GetDlgItem (hwndDlg, IDC_DISK_KEY), WM_SETFONT, (WPARAM) hSmallFont, (LPARAM) TRUE); - SendMessage (GetDlgItem (hwndDlg, IDC_KEY_SALT), WM_SETFONT, (WPARAM) hSmallFont, (LPARAM) TRUE); + SendMessage (GetDlgItem (hwndDlg, IDC_HEADER_KEY), WM_SETFONT, (WPARAM) hSmallFont, (LPARAM) TRUE); SetWindowText (GetDlgItem (hwndDlg, IDC_BOX_HELP), getmultilinestr (nID)); SetWindowText (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), getstr (IDS_FORMAT_TITLE)); EnableWindow (GetDlgItem (hwndDlg, IDC_QUICKFORMAT), bDevice); + SendMessage (GetDlgItem (hwndDlg, IDC_SHOW_KEYS), BM_SETCHECK, showKeys ? BST_CHECKED : BST_UNCHECKED, 0); + SetWindowText (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), showKeys ? "" : "****************************"); + SetWindowText (GetDlgItem (hwndDlg, IDC_HEADER_KEY), showKeys ? "" : "****************************"); + SetWindowText (GetDlgItem (hwndDlg, IDC_DISK_KEY), showKeys ? "" : "****************************"); + SendMessage (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), CB_RESETCONTENT, 0, 0); AddComboPair (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), "Default", 0); AddComboPair (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), "0.5 KB", 1); @@ -993,6 +975,18 @@ PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) AddComboPair (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), "64 KB", 128); SendMessage (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), CB_SETCURSEL, 0, 0); + SendMessage (GetDlgItem (hwndDlg, IDC_FILESYS), CB_RESETCONTENT, 0, 0); + AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), "None", FILESYS_NONE); + + if (nFileSize * nMultiplier / 512 < 0x7FFFffff) + AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), "FAT", FILESYS_FAT); + + if (nFileSize * nMultiplier / 512 > 5050) + AddComboPair (GetDlgItem (hwndDlg, IDC_FILESYS), "NTFS", FILESYS_NTFS); + + SendMessage (GetDlgItem (hwndDlg, IDC_FILESYS), CB_SETCURSEL, 1, 0); + + EnableWindow (GetDlgItem (hwndDlg, IDC_FILESYS), TRUE); EnableWindow (GetDlgItem (hwndDlg, IDC_CLUSTERSIZE), TRUE); EnableWindow (GetDlgItem (hwndDlg, IDC_CANCEL_BAR), FALSE); @@ -1120,6 +1114,15 @@ PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) } + if (lw == IDC_SHOW_KEYS) + { + showKeys = IsButtonChecked (GetDlgItem (hCurPage, IDC_SHOW_KEYS)); + + SetWindowText (GetDlgItem (hCurPage, IDC_RANDOM_BYTES), showKeys ? "" : "****************************"); + SetWindowText (GetDlgItem (hCurPage, IDC_HEADER_KEY), showKeys ? "" : "****************************"); + SetWindowText (GetDlgItem (hCurPage, IDC_DISK_KEY), showKeys ? "" : "****************************"); + return 1; + } return 0; } @@ -1167,6 +1170,10 @@ MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) char tmp2[43]; int i; + if (!showKeys) return 1; + + SendMessage (GetDlgItem (hwndDlg, IDC_RANDOM_BYTES), WM_SETFONT, (WPARAM) hSmallFont, (LPARAM) TRUE); + RandpeekBytes (tmp, sizeof (tmp)); tmp2[0] = 0; @@ -1180,7 +1187,7 @@ MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) tmp2[42] = 0; - SetWindowText (GetDlgItem (hCurPage, IDC_RANDOM_BYTES), tmp2); + SetWindowText (GetDlgItem (hCurPage, IDC_RANDOM_BYTES), tmp2); return 1; } @@ -1190,6 +1197,7 @@ MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) EnableWindow (GetDlgItem (hwndDlg, IDHELP), TRUE); EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), TRUE); EnableWindow (GetDlgItem (hCurPage, IDC_QUICKFORMAT), bDevice); + EnableWindow (GetDlgItem (hCurPage, IDC_FILESYS), TRUE); EnableWindow (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), TRUE); EnableWindow (GetDlgItem (hCurPage, IDC_CANCEL_BAR), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_NEXT), TRUE); @@ -1206,6 +1214,7 @@ MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) EnableWindow (GetDlgItem (hwndDlg, IDHELP), TRUE); EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), TRUE); EnableWindow (GetDlgItem (hCurPage, IDC_QUICKFORMAT), bDevice); + EnableWindow (GetDlgItem (hCurPage, IDC_FILESYS), TRUE); EnableWindow (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), TRUE); EnableWindow (GetDlgItem (hCurPage, IDC_CANCEL_BAR), FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_NEXT), TRUE); @@ -1249,6 +1258,8 @@ MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) if (IsButtonChecked (GetDlgItem (hCurPage, IDC_SHA1))) pkcs5 = SHA1; if (IsButtonChecked (GetDlgItem (hCurPage, IDC_RIPEMD160))) pkcs5 = RIPEMD160; + + RandSetHashFunction (pkcs5); } if (nCurPageNo == SIZE_PAGE) @@ -1276,10 +1287,18 @@ MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) EnableWindow (GetDlgItem (hwndDlg, IDCANCEL), FALSE); EnableWindow (GetDlgItem (hCurPage, IDC_QUICKFORMAT), FALSE); EnableWindow (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), FALSE); + EnableWindow (GetDlgItem (hCurPage, IDC_FILESYS), FALSE); EnableWindow (GetDlgItem (hCurPage, IDC_CANCEL_BAR), TRUE); SetFocus (GetDlgItem (hCurPage, IDC_CANCEL_BAR)); quickFormat = IsButtonChecked (GetDlgItem (hCurPage, IDC_QUICKFORMAT)); + + fileSystem = SendMessage (GetDlgItem (hCurPage, IDC_FILESYS), CB_GETITEMDATA + ,SendMessage (GetDlgItem (hCurPage, IDC_FILESYS), CB_GETCURSEL, 0, 0) , 0); + + clusterSize = SendMessage (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), CB_GETITEMDATA + ,SendMessage (GetDlgItem (hCurPage, IDC_CLUSTERSIZE), CB_GETCURSEL, 0, 0) , 0); + _beginthread (formatThreadFunction, 4096, hwndDlg); return 1; } @@ -1309,6 +1328,8 @@ MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) if (IsButtonChecked (GetDlgItem (hCurPage, IDC_SHA1))) pkcs5 = SHA1; if (IsButtonChecked (GetDlgItem (hCurPage, IDC_RIPEMD160))) pkcs5 = RIPEMD160; + + RandSetHashFunction (pkcs5); } if (nCurPageNo == SIZE_PAGE) diff --git a/Format/TCFORMAT.H b/Format/TCFORMAT.H index 62867b7..79f04f2 100644 --- a/Format/TCFORMAT.H +++ b/Format/TCFORMAT.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ diff --git a/Format/TESTCRYPT.C b/Format/TESTCRYPT.C index 1fbadac..72d66c1 100644 --- a/Format/TESTCRYPT.C +++ b/Format/TESTCRYPT.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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. */ #pragma warning(disable : 4295) diff --git a/Format/TESTCRYPT.H b/Format/TESTCRYPT.H index 25dabcd..f1be476 100644 --- a/Format/TESTCRYPT.H +++ b/Format/TESTCRYPT.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ diff --git a/Format/UNCROOT.C b/Format/UNCROOT.C index cd318fc..f84a3f0 100644 --- a/Format/UNCROOT.C +++ b/Format/UNCROOT.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" diff --git a/Format/UNCROOT.H b/Format/UNCROOT.H index e8836d4..f3b3054 100644 --- a/Format/UNCROOT.H +++ b/Format/UNCROOT.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ diff --git a/Format/resource.h b/Format/resource.h index 9c6843b..0f45921 100644 --- a/Format/resource.h +++ b/Format/resource.h @@ -24,11 +24,6 @@ #define IDS_SIZE_HELP1 44 #define IDS_FORMAT_HELP0 46 #define IDS_TITLE 50 -#define IDS_VOL_STATUS0 51 -#define IDS_VOL_STATUS1 52 -#define IDS_VOL_STATUS2 53 -#define IDS_VOL_NO_LABEL 54 -#define IDS_VOL_LABEL 55 #define IDS_FORMAT_HELP1 56 #define IDS_FORMAT_HELP2 57 #define IDS_READONLYPROMPT 58 @@ -52,7 +47,6 @@ #define IDS_TRIPLEDES_HELP1 83 #define IDS_CAST_HELP0 84 #define IDS_CAST_HELP1 85 -#define IDS_DRIVE_TOO_BIG 86 #define IDS_EXT_PARTITION 87 #define IDS_CIPHER_TEST 88 #define IDS_TESTS_PASSED 89 @@ -86,10 +80,8 @@ #define IDC_STATS_BOX 1021 #define IDC_CANCEL_BAR 1022 #define IDC_SHA1 1024 -#define IDC_MD5 1025 #define IDC_RIPEMD160 1025 -#define IDC_KEY_SALT 1026 -#define IDC_MD6 1026 +#define IDC_HEADER_KEY 1026 #define IDC_DISK_KEY 1027 #define IDC_RANDOM_BYTES 1028 #define IDC_CIPHER_TEST 1029 @@ -99,13 +91,12 @@ #define IDC_TESTS_MESSAGE 1036 #define IDC_QUICKFORMAT 1037 #define IDC_BYTESWRITTEN 1038 -#define IDC_STATIC9 1039 #define IDC_WRITESPEED 1039 -#define IDC_BYTESWRITTEN3 1041 #define IDC_TIMEREMAIN 1041 -#define IDC_COMBO1 1042 #define IDC_CLUSTERSIZE 1042 #define IDC_SPIN1 1043 +#define IDC_FILESYS 1043 +#define IDC_SHOW_KEYS 1049 #define IDC_RESET 1104 #define IDC_AUTO 1105 #define IDC_DECRYPT 1112 @@ -122,7 +113,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 123 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1045 +#define _APS_NEXT_CONTROL_VALUE 1050 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/Mount/Mount.c b/Mount/Mount.c index 7e73306..db2b1a0 100644 --- a/Mount/Mount.c +++ b/Mount/Mount.c @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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" @@ -33,6 +37,7 @@ BOOL bWipe = FALSE; /* Wipe driver passwords */ BOOL bAuto = FALSE; /* Do everything without user input */ BOOL bQuiet = FALSE; /* No dialogs/messages */ + char commandLinePassword[MAX_PASSWORD + 1] = {0}; /* Password passed from command line */ #define VMOUNTED 1 @@ -387,6 +392,9 @@ PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG: { UINT nID[4]; + LPARAM nIndex; + HWND hComboBox = GetDlgItem (hwndDlg, IDC_HASH_CHANGE); + int i; nID[0] = IDS_PASSWORD_HELP0; nID[1] = IDS_PASSWORD_HELP1; @@ -401,6 +409,19 @@ PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) SetWindowText (GetDlgItem (hwndDlg, IDC_BOX_HELP), getmultilinestr (nID)); EnableWindow (GetDlgItem (hwndDlg, IDOK), FALSE); + SendMessage (hComboBox, CB_RESETCONTENT, 0, 0); + + nIndex = SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) "Unchanged"); + SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) 0); + + for (i = 1; i <= LAST_PRF_ID; i++) + { + nIndex = SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) get_hash_name(i)); + SendMessage (hComboBox, CB_SETITEMDATA, nIndex, (LPARAM) i); + } + + SendMessage (hComboBox, CB_SETCURSEL, 0, 0); + return 1; } @@ -431,6 +452,8 @@ PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) char szOldPassword[MAX_PASSWORD + 1]; char szPassword[MAX_PASSWORD + 1]; int nStatus; + int pkcs5 = SendMessage (GetDlgItem (hwndDlg, IDC_HASH_CHANGE), CB_GETITEMDATA, + SendMessage (GetDlgItem (hwndDlg, IDC_HASH_CHANGE), CB_GETCURSEL, 0, 0), 0); GetWindowText (GetDlgItem (hParent, IDC_VOLUME), szFileName, sizeof (szFileName)); @@ -438,7 +461,7 @@ PasswordChangeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) GetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), szPassword, sizeof (szPassword)); - nStatus = ChangePwd (szFileName, szOldPassword, szPassword); + nStatus = ChangePwd (szFileName, szOldPassword, szPassword, pkcs5); burn (szOldPassword, sizeof (szOldPassword)); burn (szPassword, sizeof (szPassword)); @@ -1452,7 +1475,6 @@ MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) if (bWipe == TRUE) { WipeCache (hwndDlg); - if (bQuiet) ExitProcess (0); } // Automount @@ -1496,9 +1518,10 @@ MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) RefreshMainDlg(hwndDlg); } - else if (bQuiet) ExitProcess (0); } + if (bQuiet) ExitProcess (0); + SetFocus (GetDlgItem (hwndDlg, IDC_DRIVELIST)); } return 0; @@ -1648,12 +1671,27 @@ MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) return 1; } + if (lw == ID_LICENSE) + { + char t[TC_MAX_PATH]; + char *tmp; + + GetModuleFileName (NULL, t, sizeof (t)); + tmp = strrchr (t, '\\'); + if (tmp) + { + strcpy (++tmp, "license.txt"); + ShellExecute (NULL, "open", t, NULL, NULL, SW_SHOWNORMAL); + } + return 1; + } + if (lw == ID_WEBSITE) { ShellExecute (NULL, "open", "http://www.google.com/search?q=truecrypt", NULL, NULL, SW_SHOWNORMAL); return 1; } - + if (lw == ID_PREFERENCES) { DialogBoxParam (hInst, @@ -1748,7 +1786,6 @@ ExtractCommandLine (HWND hwndDlg, char *lpszCommandLine) else DismountAll (hwndDlg); - ExitProcess (0); break; case 'v': diff --git a/Mount/Mount.h b/Mount/Mount.h index 3e8bc1a..03eb05d 100644 --- a/Mount/Mount.h +++ b/Mount/Mount.h @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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- */ diff --git a/Mount/Mount.rc b/Mount/Mount.rc index c89d0d5..50b07fb 100644 --- a/Mount/Mount.rc +++ b/Mount/Mount.rc @@ -64,7 +64,7 @@ BEGIN WS_TABSTOP,9,6,216,105 END -IDD_PASSWORDCHANGE_DLG DIALOGEX 0, 0, 304, 143 +IDD_PASSWORDCHANGE_DLG DIALOGEX 0, 0, 304, 157 STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Volume Password Change" @@ -80,7 +80,11 @@ BEGIN EDITTEXT IDC_VERIFY,101,44,124,12,ES_PASSWORD | ES_AUTOHSCROLL DEFPUSHBUTTON "&Change",IDOK,236,8,59,14 PUSHBUTTON "Cancel",IDCANCEL,236,28,59,14 - LTEXT "BOX HELP",IDC_BOX_HELP,18,72,270,72 + LTEXT "BOX HELP",IDC_BOX_HELP,18,86,270,64 + RTEXT "PKCS-5 PRF Algorithm",IDC_STATIC,7,67,88,10, + SS_CENTERIMAGE + COMBOBOX IDC_HASH_CHANGE,101,65,83,90,CBS_DROPDOWNLIST | + WS_TABSTOP END IDD_MOUNT_DLG DIALOGEX 0, 0, 376, 271 @@ -164,7 +168,7 @@ BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 297 TOPMARGIN, 7 - BOTTOMMARGIN, 136 + BOTTOMMARGIN, 150 END IDD_MOUNT_DLG, DIALOG @@ -189,8 +193,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,0 - PRODUCTVERSION 2,0,0,0 + FILEVERSION 2,1,0,0 + PRODUCTVERSION 2,1,0,0 FILEFLAGSMASK 0x37L #ifdef _DEBUG FILEFLAGS 0x21L @@ -207,11 +211,11 @@ BEGIN BEGIN VALUE "CompanyName", "TrueCrypt Foundation" VALUE "FileDescription", "TrueCrypt" - VALUE "FileVersion", "2.0" + VALUE "FileVersion", "2.1" VALUE "LegalCopyright", "TrueCrypt Foundation" VALUE "OriginalFilename", "TrueCrypt.exe" VALUE "ProductName", "TrueCrypt" - VALUE "ProductVersion", "2.0" + VALUE "ProductVersion", "2.1" VALUE "SpecialBuild", "June 2004" END END @@ -295,7 +299,8 @@ BEGIN POPUP "Help" BEGIN MENUITEM "User's Guide", IDM_HELP - MENUITEM "TrueCrypt on the Web", 25202 + MENUITEM "License", ID_LICENSE + MENUITEM "TrueCrypt on the Web", ID_WEBSITE MENUITEM SEPARATOR MENUITEM "About...", IDM_ABOUT END diff --git a/Mount/Mount.vcproj b/Mount/Mount.vcproj index 0a24f94..abf1836 100644 --- a/Mount/Mount.vcproj +++ b/Mount/Mount.vcproj @@ -76,7 +76,6 @@ CharacterSet="2"> + RelativePath=".\resource.h"> + RelativePath="..\Common\resource.h"> diff --git a/Mount/resource.h b/Mount/resource.h index 0fa97f7..f4bdb7a 100644 --- a/Mount/resource.h +++ b/Mount/resource.h @@ -20,6 +20,7 @@ #define IDR_MENU 127 #define IDD_PREFERENCES_DLG 128 #define IDD_VOLUME_PROPERTIES 129 +#define IDC_CIPHERTEXT 1003 #define IDC_VERIFY 1008 #define IDC_OLD_PASSWORD 1009 #define IDC_BOX_HELP 1011 @@ -33,9 +34,8 @@ #define IDC_PREF_OPEN_EXPLORER 1029 #define IDC_VOLUME_PROPERTIES_LIST 1030 #define IDC_PREF_CLOSE_DISMOUNTED_WINDOWS 1030 -#define IDC_PREF_CLOSE_DISMOUNTED_WINDOWS2 1031 #define IDC_PREF_WIPE_CACHE_ON_EXIT 1031 -#define IDC_PREF_WIPE_CACHE_ON_EXIT3 1033 +#define IDC_HASH_CHANGE 1032 #define IDC_PREF_CACHE_PASSWORDS 1033 #define IDC_VOLUME 2006 #define IDC_PASSWORD 2007 @@ -62,6 +62,7 @@ #define ID_UNMOUNT_VOLUME 40034 #define IDC_VOLUME_PROPERTIES 40036 #define IDC_CLEAR_HISTORY 40038 +#define ID_LICENSE 40040 // Next default values for new objects // @@ -69,8 +70,8 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 130 -#define _APS_NEXT_COMMAND_VALUE 40039 -#define _APS_NEXT_CONTROL_VALUE 1031 +#define _APS_NEXT_COMMAND_VALUE 40042 +#define _APS_NEXT_CONTROL_VALUE 1034 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/Readme.txt b/Readme.txt index 9937a98..2d7690a 100644 --- a/Readme.txt +++ b/Readme.txt @@ -1,6 +1,6 @@ -TrueCrypt 2.0 Source Code Distribution -Copyright (C) 2004 TrueCrypt Foundation +TrueCrypt 2.1 Source Code Distribution +Released by TrueCrypt Foundation, 2004/06/21 See 'Docs\License.txt' file for license covering this distribution. See 'Release\Setup files\TrueCrypt User Guide.pdf' file for more information. @@ -9,7 +9,7 @@ See 'Release\Setup files\TrueCrypt User Guide.pdf' file for more information. Requirements for building TrueCrypt: - Microsoft Visual Studio .NET 2003 -- Windows XP (build 2600 or higher) Driver Development Kit +- Windows XP Driver Development Kit (build 2600 or higher) Before building TrueCrypt: diff --git a/Release/Readme.txt b/Release/Readme.txt index 94b330a..a4f47a3 100644 --- a/Release/Readme.txt +++ b/Release/Readme.txt @@ -1,62 +1,55 @@ -This archive contains TrueCrypt 2.0 setup and documentation. +This archive contains TrueCrypt 2.1 setup and documentation. -Copyright (c) 2004 TrueCrypt Foundation -(not associated with TrueCrypt Team, the authors of TrueCrypt 1.0) +WHAT IS NEW IN TRUECRYPT 2.1 +New features: -WHAT IS NEW IN TRUECRYPT 2.0 - -Bug fixes: - -- Data corruption will no longer occur when a TrueCrypt partition is - subjected to heavy parallel usage (usually when copying files to or - from a TrueCrypt partition). This also fixes the problem with - temporarily inaccessible files stored in TrueCrypt partitions. - - Note: File-hosted volumes were not affected by this bug. - -- After dismounting and remounting a volume, its file system will be - correctly recognized by the operating system and it will be - possible to reuse the same drive letter (Windows 2000 issue). +- RIPEMD-160 hash algorithm added. The user can now select which hash + algorithm TrueCrypt will use (SHA-1 or RIPEMD-160). -- The main program window will not be displayed when run in quiet - mode (command line usage). + Note: RIPEMD-160, which was designed by an open academic community, + represents a valuable alternative to SHA-1 designed by the NSA and NIST. + In the previous versions there was a risk that the whole program would + be practically useless, should a major weakness be found in SHA-1. The + user-selected hash algorithm is used by the random number generator when + creating new volumes, and by the header key derivation function (HMAC + based on a hash function, as specified in PKCS #5 v2.0). The random + number generator generates the master encryption key, salt, and the + values used to create IV and 'whitening' values. -- Two password entry attempts are no longer necessary to be able to - mount a volume (command line usage). +- When changing a volume password, the user can now select the HMAC hash + algorithm that will be used in deriving the new volume header key. -- All partitions will be visible to TrueCrypt even if one of them is - inaccessible to the operating system (an inaccessible partition - made all successive partitions on the hard disk unavailable to - TrueCrypt). +- It is now possible to create NTFS TrueCrypt volumes and unformatted + TrueCrypt volumes. This enhancement also removes the 2,048 GB volume + size limit. (Only FAT volumes can be created using the previous versions + of TrueCrypt. Any FAT volume, encrypted or not, cannot be over 2,048 GB.) -- Relative path can be specified when mounting a file-hosted volume - (command line usage). +- Header key content is now displayed in the Volume Creation Wizard window + (instead of salt). -- Incorrect passwords are reported when auto-mounting (command line - usage). +- Random pool, master key, and header key contents can be prevented from + being displayed in the Volume Creation Wizard window. -New features: +Bug fixes: -- AES-256 (Rijndael) encryption algorithm. +- When there is a mounted TrueCrypt container that is stored in another + TrueCrypt container, it will be possible to dismount both of them using + the 'Dismount All' function, and 'blue screen' errors will not occur + upon system shutdown. -- The command line option /dismountall was renamed to /dismount which - can now be also used to dismount a single volume by specifying its - drive letter. +- Minor bug fixes to command line handling. Improvements: -- Memory pages containing sensitive data are now locked to prevent - them from being swapped to the Windows page file. - -- The state of the random pool will never be exported directly so the - pool contents will not be leaked. +- Several minor improvements to the driver. Miscellaneous: -- Released under GNU General Public License (GPL) - +- Released under the original E4M license to avoid potential problems + relating to the GPL license (added the IDEA patent information and + specific legal notices). FUTURE @@ -64,24 +57,22 @@ FUTURE - 'Hidden' container - Linux version - Anti-Key-Logger Facilities -- HMAC-RIPEMD-160 - Keyfiles and more. - INSTALLATION Before installing TrueCrypt, you may want to read the TrueCrypt -User's Guide. It is located in the folder called "Setup Files". To +User's Guide. It is located in the folder called 'Setup Files'. To view or print it, you will need Adobe Acrobat Reader (freely available at www.adobe.com). Note that the program documentation will also be automatically installed into the program folder, and will later be accessible via the Start menu and the program user interface. -To install TrueCrypt, run "TrueCrypt Setup.exe". +To install TrueCrypt, run the file 'TrueCrypt Setup.exe'. REQUIREMENTS @@ -94,25 +85,8 @@ REQUIREMENTS - Administrator privileges -DISCLAIMER - -Before installing this product (TrueCrypt), you must agree to the -following terms and conditions: - -- YOU UNDERSTAND THAT THIS PRODUCT UTILIZES STRONG CRYPTOGRAPHY, AND - THAT SHOULD THIS TECHNOLOGY BE REGULATED OR ILLEGAL IN YOUR - COUNTRY, THE AUTHORS OF THE PRODUCT WILL NOT BE RESPONSIBLE FOR - ANY CONSEQUENCES THAT YOUR IMPORTING AND/OR USING IT IN SUCH A - COUNTRY MIGHT HAVE. -- YOU UNDERSTAND THAT THE AUTHORS OF THE PRODUCT CANNOT BE HELD - RESPONSIBLE FOR LOSS OF YOUR DATA OR ANY OTHER DAMAGE, DIRECT OR - INDIRECT, CAUSED BY USING OR INSTALLING THE PRODUCT. -- YOU UNDERSTAND THAT THIS PRODUCT CONTAINS NO "BACKDOOR", THAT - WOULD ALLOW PARTIAL OR COMPLETE RECOVERY OF YOUR DATA WITHOUT - KNOWING THE CORRECT PASSWORD. -- YOU UNDERSTAND THAT THE AUTHORS OF THE PROGRAM CANNOT HELP YOU TO - RECOVER YOUR DATA SHOULD YOU FORGET YOUR PASSWORD. - - You must also agree to the license displayed in the TrueCrypt - Setup window. - \ No newline at end of file +LICENSING INFORMATION + +Before installing this product (TrueCrypt), you must agree to the +license displayed in the TrueCrypt Setup window (the text of the +license is also contained in the file 'License.txt'). diff --git a/Release/Setup Files/License.txt b/Release/Setup Files/License.txt index 5bdb53c..a7a956f 100644 --- a/Release/Setup Files/License.txt +++ b/Release/Setup Files/License.txt @@ -1,224 +1,194 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +TRUECRYPT LICENSE + +This product can be copied and distributed free of charge, including +source code. + +You may modify this product and source code, and distribute such modifications, +and you may derive new works based on this product, provided that: + +1. Any product which is simply derived from this product cannot be +called E4M, or Encryption for the Masses. + +2. If you use any of the source code in your product, and your product +is distributed with source code, you must include this notice with +those portions of this source code that you use. + +Or, + +If your product is distributed in binary form only, you must display +on any packaging, and marketing materials which reference +your product, a notice which states: + +"This product uses components written by Paul Le Roux " + +3. If you use any of the source code originally by Eric Young, you must +in addition follow his terms and conditions. + +4. Nothing requires that you accept this License, as you have not +signed it. However, nothing else grants you permission to modify or +distribute the product or its derivative works. + +These actions are prohibited by law if you do not accept this License. + +5. If any of these license terms is found to be to broad in scope, and +declared invalid by any court or legal process, you agree that all other +terms shall not be so affected, and shall remain valid and enforceable. + +6. THIS PROGRAM IS DISTRIBUTED FREE OF CHARGE, THEREFORE THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. UNLESS OTHERWISE +STATED THE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +7. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +OUT OF THE USE OR INABILITY TO USE THE PROGRAM, INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS +PROGRAMS, EVEN IF SUCH HOLDER OR OTHER PARTY HAD PREVIOUSLY BEEN ADVISED +OF THE POSSIBILITY OF SUCH DAMAGES. + +8. Where applicable, the specific licenses attached to parts of the source +code might take precedence over this general license. + +9. The IDEA cipher described in U.S. patent number 5,214,703 requires a +separate license from Ascom Tech AG for commercial use. IDEA is a trademark +of Ascom Tech AG. + +10. If you use any part of the source code by Dr. Brian Gladman in your +project, you must follow his terms and conditions. + +11. If you use any part of the source code by Markus Friedl in your project, +you must follow his terms and conditions. + +12. This product contains no mechanism or facility that would allow partial +or complete recovery of your data without knowing the correct password or +the key used to encrypt the data. + +Portions of this software are: +Copyright (c) 1998-2000 Paul Le Roux. All Rights Reserved. +Copyright (c) 2004 TrueCrypt Team. All Rights Reserved. +Copyright (c) 2004 TrueCrypt Foundation. All Rights Reserved. +Copyright (c) 1995-1997 Eric Young. All Rights Reserved. +Copyright (c) 1992-1999 Masayasu Kumagai, Paulo Barreto, Peter Gutmann. +Copyright (c) 2003 Dr. Brian Gladman, Worcester, UK. All Rights Reserved. +Copyright (c) 2001 Markus Friedl. All Rights Reserved. +For more information, see the legal notices attached to parts of the source code. +This is a TrueCrypt Foundation release. + +END OF GENERAL LICENSE + + +Component Legal Notices: +____________________________________________________________ + +Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +All rights reserved. + +This package is an SSL implementation written +by Eric Young (eay@cryptsoft.com). +The implementation was written so as to conform with Netscapes SSL. + +This library is free for commercial and non-commercial use as long as +the following conditions are aheared to. The following conditions +apply to all code found in this distribution, be it the RC4, RSA, +lhash, DES, etc., code; not just the SSL code. The SSL documentation +included with this distribution is covered by the same copyright terms +except that the holder is Tim Hudson (tjh@cryptsoft.com). + +Copyright remains Eric Young's, and as such any Copyright notices in +the code are not to be removed. +If this package is used in a product, Eric Young should be given attribution +as the author of the parts of the library used. +This can be in the form of a textual message at program startup or +in documentation (online or textual) provided with the package. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + "This product includes cryptographic software written by + Eric Young (eay@cryptsoft.com)" + The word 'cryptographic' can be left out if the rouines from the library + being used are not cryptographic related :-). +4. If you include any Windows specific code (or a derivative thereof) from + the apps directory (application code) you must include an acknowledgement: + "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + +THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +The licence and distribution terms for any publically available version or +derivative of this code cannot be changed. i.e. this code cannot simply be +copied and put under another distribution licence +[including the GNU Public Licence.] +____________________________________________________________ + +Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. + +LICENSE TERMS + +The free distribution and use of this software in both source and binary +form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + +ALTERNATIVELY, provided that this notice is retained in full, this product +may be distributed under the terms of the GNU General Public License (GPL), +in which case the provisions of the GPL apply INSTEAD OF those given above. + +DISCLAIMER + +This software is provided 'as is' with no explicit or implied warranties +in respect of its properties, including, but not limited to, correctness +and/or fitness for purpose. +____________________________________________________________ + +Copyright (c) 2001 Markus Friedl. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Release/Setup Files/TrueCrypt User Guide.pdf b/Release/Setup Files/TrueCrypt User Guide.pdf index 7ba3857..a4687d8 100644 Binary files a/Release/Setup Files/TrueCrypt User Guide.pdf and b/Release/Setup Files/TrueCrypt User Guide.pdf differ diff --git a/Service/NTSERVICE.C b/Service/NTSERVICE.C index 8d27f7e..a9e464e 100644 --- a/Service/NTSERVICE.C +++ b/Service/NTSERVICE.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 diff --git a/Service/NTSERVICE.H b/Service/NTSERVICE.H index 5ead85b..8aabe76 100644 --- a/Service/NTSERVICE.H +++ b/Service/NTSERVICE.H @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 SZSERVICENAME "TrueCryptService" #define SZSERVICEDISPLAYNAME "TrueCrypt Service" diff --git a/Service/Service.rc b/Service/Service.rc index b6fd51f..b52637d 100644 --- a/Service/Service.rc +++ b/Service/Service.rc @@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,0 - PRODUCTVERSION 2,0,0,0 + FILEVERSION 2,1,0,0 + PRODUCTVERSION 2,1,0,0 FILEFLAGSMASK 0x37L #ifdef _DEBUG FILEFLAGS 0x21L @@ -36,7 +36,7 @@ VS_VERSION_INFO VERSIONINFO FILEFLAGS 0x20L #endif FILEOS 0x4L - FILETYPE 0x1L + FILETYPE 0x0L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" @@ -45,11 +45,11 @@ BEGIN BEGIN VALUE "CompanyName", "TrueCrypt Foundation" VALUE "FileDescription", "TrueCrypt Service" - VALUE "FileVersion", "2.0" + VALUE "FileVersion", "2.1" VALUE "LegalCopyright", "TrueCrypt Foundation" VALUE "OriginalFilename", "TrueCryptService.exe" VALUE "ProductName", "TrueCrypt" - VALUE "ProductVersion", "2.0" + VALUE "ProductVersion", "2.1" VALUE "SpecialBuild", "June 2004" END END diff --git a/Service/Service.vcproj b/Service/Service.vcproj index fc63076..a28a849 100644 --- a/Service/Service.vcproj +++ b/Service/Service.vcproj @@ -21,7 +21,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="c:/sdk/winddk/3790/inc/ddk/wxp;../Common;../Crypto" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + PreprocessorDefinitions="NTSERVICE;WIN32;_DEBUG;_CONSOLE" MinimalRebuild="TRUE" BasicRuntimeChecks="3" RuntimeLibrary="5" @@ -70,9 +70,8 @@ CharacterSet="2"> */ +/* 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" diff --git a/Setup/SETUP.C b/Setup/SETUP.C index f916d13..928c7d0 100644 --- a/Setup/SETUP.C +++ b/Setup/SETUP.C @@ -1,5 +1,9 @@ -/* Copyright (C) 2004 TrueCrypt Foundation - This product uses components written by Paul Le Roux */ +/* 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 @@ -1246,14 +1250,19 @@ DoInstall (void *hwndDlg) SendMessage (GetDlgItem ((HWND) hwndDlg, IDC_FILES), LB_RESETCONTENT, 0, 0); - if (IsButtonChecked (GetDlgItem ((HWND) hwndDlg, IDC_SYSTEM_RESTORE))) - SetSystemRestorePoint (hwndDlg, FALSE); - if (DoDriverUnload (hwndDlg) == FALSE) { - bOK = FALSE; + NormalCursor (); + EnableWindow (GetDlgItem ((HWND) hwndDlg, IDOK), TRUE); + return; } - else if (DoServiceUninstall (hwndDlg, "TrueCryptService") == FALSE) + + if (IsButtonChecked (GetDlgItem ((HWND) hwndDlg, IDC_SYSTEM_RESTORE))) + { + SetSystemRestorePoint (hwndDlg, FALSE); + } + + if (DoServiceUninstall (hwndDlg, "TrueCryptService") == FALSE) { bOK = FALSE; } @@ -1515,9 +1524,6 @@ WINMAIN (HINSTANCE hInstance, HINSTANCE hPrevInstance, char *lpszCommandLine, return 0; } - if (CurrentOSMajor == 5 && CurrentOSMinor == 0) - MessageBox (NULL, "If you are upgrading from a previous version of TrueCrypt\nyou should first uninstall TrueCrypt and reboot OS.", lpszTitle, MB_ICONINFORMATION); - if (nCurrentOS == WIN_NT && IsAdmin ()!= TRUE) if (MessageBox (NULL, "To successfully install/uninstall TrueCrypt under Windows NT you must be running as an Administrator, " "do you still want to continue?", lpszTitle, MB_YESNO | MB_ICONQUESTION) != IDYES) @@ -1530,6 +1536,9 @@ WINMAIN (HINSTANCE hInstance, HINSTANCE hPrevInstance, char *lpszCommandLine, if (bUninstall == FALSE) { + if (CurrentOSMajor == 5 && CurrentOSMinor == 0) + MessageBox (NULL, "If you are upgrading from a previous version of TrueCrypt\nyou should first uninstall TrueCrypt and reboot system.", lpszTitle, MB_ICONINFORMATION); + /* Create the main dialog box */ DialogBox (hInstance, MAKEINTRESOURCE (IDD_INSTALL), NULL, (DLGPROC) InstallDlgProc); } diff --git a/Setup/Setup.rc b/Setup/Setup.rc index 79e3b29..0dd8053 100644 --- a/Setup/Setup.rc +++ b/Setup/Setup.rc @@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,0 - PRODUCTVERSION 2,0,0,0 + FILEVERSION 2,1,0,0 + PRODUCTVERSION 2,1,0,0 FILEFLAGSMASK 0x37L #ifdef _DEBUG FILEFLAGS 0x21L @@ -36,7 +36,7 @@ VS_VERSION_INFO VERSIONINFO FILEFLAGS 0x20L #endif FILEOS 0x4L - FILETYPE 0x0L + FILETYPE 0x1L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" @@ -45,11 +45,11 @@ BEGIN BEGIN VALUE "CompanyName", "TrueCrypt Foundation" VALUE "FileDescription", "TrueCrypt Setup" - VALUE "FileVersion", "2.0" + VALUE "FileVersion", "2.1" VALUE "LegalCopyright", "TrueCrypt Foundation" VALUE "OriginalFilename", "TrueCrypt Setup.exe" VALUE "ProductName", "TrueCrypt" - VALUE "ProductVersion", "2.0" + VALUE "ProductVersion", "2.1" VALUE "SpecialBuild", "June 2004" END END diff --git a/Setup/Setup.vcproj b/Setup/Setup.vcproj index b5c697b..ad34cc2 100644 --- a/Setup/Setup.vcproj +++ b/Setup/Setup.vcproj @@ -71,7 +71,6 @@ CharacterSet="2">