1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 02:58:02 -06:00

Remove trailing whitespace

This commit is contained in:
David Foerster
2016-05-10 22:16:32 +02:00
parent 1910751558
commit 11716ed2da
408 changed files with 4420 additions and 4420 deletions

View File

@@ -17,16 +17,16 @@ called 'TrueCrypt' or 'VeraCrypt'
Contents Contents
======== ========
I. Windows I. Windows
Requirements for Building VeraCrypt for Windows Requirements for Building VeraCrypt for Windows
Instructions for Building VeraCrypt for Windows Instructions for Building VeraCrypt for Windows
Instructions for Signing and Packaging VeraCrypt for Windows Instructions for Signing and Packaging VeraCrypt for Windows
II. Linux and Mac OS X II. Linux and Mac OS X
Requirements for Building VeraCrypt for Linux and Mac OS X Requirements for Building VeraCrypt for Linux and Mac OS X
Instructions for Building VeraCrypt for Linux and Mac OS X Instructions for Building VeraCrypt for Linux and Mac OS X
Mac OS X specifics Mac OS X specifics
III. FreeBSD and OpenSolaris III. FreeBSD and OpenSolaris
IV. Third-Party Developers (Contributors) IV. Third-Party Developers (Contributors)
@@ -65,7 +65,7 @@ issued by Thawte certification authority. At the end of each official .exe and
.sys file, there are embedded digital signatures and all related certificates .sys file, there are embedded digital signatures and all related certificates
(i.e. all certificates in the relevant certification chain, such as the (i.e. all certificates in the relevant certification chain, such as the
certification authority certificates, CA-MS cross-certificate, and the certification authority certificates, CA-MS cross-certificate, and the
IDRIX certificate). IDRIX certificate).
Keep this in mind if you compile VeraCrypt Keep this in mind if you compile VeraCrypt
and compare your binaries with the official binaries. If your binaries are and compare your binaries with the official binaries. If your binaries are
unsigned, the sizes of the official binaries will usually be approximately unsigned, the sizes of the official binaries will usually be approximately
@@ -108,12 +108,12 @@ Instructions for Signing and Packaging VeraCrypt for Windows:
First, create an environment variable 'WSDK81' pointing to the Windows SDK First, create an environment variable 'WSDK81' pointing to the Windows SDK
for Windows 8.1 installation directory. for Windows 8.1 installation directory.
The folder "Signing" contains a batch file (sign.bat) that will sign all The folder "Signing" contains a batch file (sign.bat) that will sign all
VeraCrypt components using a code signing certificate present on the VeraCrypt components using a code signing certificate present on the
certificate store and also build the final installation setup. certificate store and also build the final installation setup.
The batch file suppose that the code signing certificate is issued by Thawt. The batch file suppose that the code signing certificate is issued by Thawt.
This is the case for IDRIX's certificate. If yours is issued by another CA, This is the case for IDRIX's certificate. If yours is issued by another CA,
then you should put the Root and Intermediate certificates in the "Signing" then you should put the Root and Intermediate certificates in the "Signing"
folder and then modify sign.bat accordingly. folder and then modify sign.bat accordingly.
@@ -135,8 +135,8 @@ Requirements for Building VeraCrypt for Linux and Mac OS X:
and https://osxfuse.github.io/) and https://osxfuse.github.io/)
- RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki) 2.20 - RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki) 2.20
header files (available at ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20). header files (available at ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20).
They are already included in the source tree under the directory PKCS11 but They are already included in the source tree under the directory PKCS11 but
it is possible to override it using the environment variable 'PKCS11_INC'. it is possible to override it using the environment variable 'PKCS11_INC'.
Instructions for Building VeraCrypt for Linux and Mac OS X: Instructions for Building VeraCrypt for Linux and Mac OS X:
@@ -146,7 +146,7 @@ Instructions for Building VeraCrypt for Linux and Mac OS X:
2) If you have no wxWidgets shared library installed, run the following 2) If you have no wxWidgets shared library installed, run the following
command to configure the wxWidgets static library for VeraCrypt and to command to configure the wxWidgets static library for VeraCrypt and to
build it: build it:
$ make WXSTATIC=1 WX_ROOT=/usr/src/wxWidgets wxbuild $ make WXSTATIC=1 WX_ROOT=/usr/src/wxWidgets wxbuild
@@ -159,7 +159,7 @@ Instructions for Building VeraCrypt for Linux and Mac OS X:
$ make $ make
or if you have no wxWidgets shared library installed: or if you have no wxWidgets shared library installed:
$ make WXSTATIC=1 $ make WXSTATIC=1
4) If successful, the VeraCrypt executable should be located in the directory 4) If successful, the VeraCrypt executable should be located in the directory
@@ -172,21 +172,21 @@ built using the 'NOGUI' parameter:
$ make NOGUI=1 WXSTATIC=1 WX_ROOT=/usr/src/wxWidgets wxbuild $ make NOGUI=1 WXSTATIC=1 WX_ROOT=/usr/src/wxWidgets wxbuild
$ make NOGUI=1 WXSTATIC=1 $ make NOGUI=1 WXSTATIC=1
On MacOSX, building a console-only executable is not supported. On MacOSX, building a console-only executable is not supported.
Mac OS X specifics: Mac OS X specifics:
----------------------------------------------------------- -----------------------------------------------------------
Under MacOSX, the SDK for OSX 10.7 is used by default. To use another version Under MacOSX, the SDK for OSX 10.7 is used by default. To use another version
of the SDK (i.e. 10.6), you can export the environment variable VC_OSX_TARGET: of the SDK (i.e. 10.6), you can export the environment variable VC_OSX_TARGET:
$ export VC_OSX_TARGET=10.6 $ export VC_OSX_TARGET=10.6
Before building under MacOSX, pkg-config must be installed if not yet available. Before building under MacOSX, pkg-config must be installed if not yet available.
Get it from http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz and Get it from http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz and
compile using the following commands : compile using the following commands :
$ ./configure --with-internal-glib $ ./configure --with-internal-glib
$ make $ make
@@ -195,9 +195,9 @@ compile using the following commands :
After making sure pkg-config is available, download and install OSXFuse from After making sure pkg-config is available, download and install OSXFuse from
https://osxfuse.github.io/ (MacFUSE compatibility layer must selected) https://osxfuse.github.io/ (MacFUSE compatibility layer must selected)
The script build_veracrypt_macosx.sh available under "src/Build" performs the The script build_veracrypt_macosx.sh available under "src/Build" performs the
full build of VeraCrypt including the creation of the installer pkg. It expects full build of VeraCrypt including the creation of the installer pkg. It expects
to find the wxWidgets 3.0.2 sources at the same level as where you put to find the wxWidgets 3.0.2 sources at the same level as where you put
VeraCrypt sources (i.e. if "src" path is "/Users/joe/Projects/VeraCrypt/src" VeraCrypt sources (i.e. if "src" path is "/Users/joe/Projects/VeraCrypt/src"
then wxWidgets should be at "/Users/joe/Projects/wxWidgets-wxWidgets-3.0.2") then wxWidgets should be at "/Users/joe/Projects/wxWidgets-wxWidgets-3.0.2")
@@ -224,8 +224,8 @@ IV. Third-Party Developers (Contributors)
If you intend to implement a feature, please contact us first to make sure: If you intend to implement a feature, please contact us first to make sure:
1) That the feature has not been implemented (we may have already implemented 1) That the feature has not been implemented (we may have already implemented
it, but haven't released the code yet). it, but haven't released the code yet).
2) That the feature is acceptable. 2) That the feature is acceptable.
3) Whether we need help of third-party developers with implementing the feature. 3) Whether we need help of third-party developers with implementing the feature.
Information on how to contact us can be found at: Information on how to contact us can be found at:
@@ -253,7 +253,7 @@ source code.
Trademark Information Trademark Information
--------------------- ---------------------
Any trademarks contained in the source code, binaries, and/or in the Any trademarks contained in the source code, binaries, and/or in the
documentation, are the sole property of their respective owners. documentation, are the sole property of their respective owners.

View File

@@ -1202,7 +1202,7 @@
<string lang="pl" key="HIDDEN_OS_CREATION_NOT_FINISHED_CHOICE_TERMINATE">Permanentne przerwanie procesu tworzenia ukrytego systemu operacyjnego</string> <string lang="pl" key="HIDDEN_OS_CREATION_NOT_FINISHED_CHOICE_TERMINATE">Permanentne przerwanie procesu tworzenia ukrytego systemu operacyjnego</string>
<string lang="pl" key="HIDDEN_OS_CREATION_NOT_FINISHED_CHOICE_ASK_LATER">Nie rób teraz nic później zostaniesz zapytany ponownie</string> <string lang="pl" key="HIDDEN_OS_CREATION_NOT_FINISHED_CHOICE_ASK_LATER">Nie rób teraz nic później zostaniesz zapytany ponownie</string>
<string lang="pl" key="RESCUE_DISK_HELP_PORTION_1">\nJEŻELI MOŻLIWE, WYDRUKUJ TEN TEKST (kliknij 'Drukuj').\n\n\nJak i kiedy używać Plyty ratunkowej VeraCrypt (po zaszyfrowaniu) -----------------------------------------------------------------------------------\n\n</string> <string lang="pl" key="RESCUE_DISK_HELP_PORTION_1">\nJEŻELI MOŻLIWE, WYDRUKUJ TEN TEKST (kliknij 'Drukuj').\n\n\nJak i kiedy używać Plyty ratunkowej VeraCrypt (po zaszyfrowaniu) -----------------------------------------------------------------------------------\n\n</string>
<string lang="pl" key="RESCUE_DISK_HELP_PORTION_2">I. Jak Zainicjować komputer z płyty ratunkowej VeraCrypt\n\nAby uruchomić komputer z <string lang="pl" key="RESCUE_DISK_HELP_PORTION_2">I. Jak Zainicjować komputer z płyty ratunkowej VeraCrypt\n\nAby uruchomić komputer z
płyty ratunkowej VeraCrypt, włóż ją do napędu CD/DVD i uruchom ponownie komputer. Jeśli ekran płyty ratunkowej VeraCrypt nie pojawia się (lub nie widać elementu 'Repair Options' w sekcji 'Keyboard Controls' na ekranie), prawdopodobnie BIOS został ustawiony tak, by próbować uruchamiać system z dysków twardych przed dyskami CD/DVD. Jeśli tak jest, uruchom ponownie komputer, wciśnij klawisz F2 lub Delete (natychmiast po pojawieniu ekranu uruchomieniowego BIOS) i poczekaj na wyświetlenie ekranu konfiguracji BIOS. Jeśli ekran konfiguracji BIOS nie pojawi się, zrestartuj (zresetuj) komputer raz jeszcze i powtarzaj wciśnięcia klawiszy F2 lub Delete od momentu restartu (resetu) komputera. Gdy pojawi się ekran konfiguracji BIOS, ustaw w BIOS-ie kolejność uruchamiania tak, by napęd CD/DVD był na pierwszym miejscu (Aby dowiedzieć się jak to zrobić, sprawdź w dokumentacji BIOS-u/płyty głównej lub skontaktuj się ze sprzedawcą lub wsparciem technicznym, by uzyskać pomoc). Następnie zrestartuj komputer. Ekran płyty ratunkowej VeraCrypt powinien się teraz pokazać. Uwaga: Na ekranie płyty ratunkowej VeraCrypt wybierz 'Repair Options' wciskając klawisz F8.\n\n\n</string> płyty ratunkowej VeraCrypt, włóż ją do napędu CD/DVD i uruchom ponownie komputer. Jeśli ekran płyty ratunkowej VeraCrypt nie pojawia się (lub nie widać elementu 'Repair Options' w sekcji 'Keyboard Controls' na ekranie), prawdopodobnie BIOS został ustawiony tak, by próbować uruchamiać system z dysków twardych przed dyskami CD/DVD. Jeśli tak jest, uruchom ponownie komputer, wciśnij klawisz F2 lub Delete (natychmiast po pojawieniu ekranu uruchomieniowego BIOS) i poczekaj na wyświetlenie ekranu konfiguracji BIOS. Jeśli ekran konfiguracji BIOS nie pojawi się, zrestartuj (zresetuj) komputer raz jeszcze i powtarzaj wciśnięcia klawiszy F2 lub Delete od momentu restartu (resetu) komputera. Gdy pojawi się ekran konfiguracji BIOS, ustaw w BIOS-ie kolejność uruchamiania tak, by napęd CD/DVD był na pierwszym miejscu (Aby dowiedzieć się jak to zrobić, sprawdź w dokumentacji BIOS-u/płyty głównej lub skontaktuj się ze sprzedawcą lub wsparciem technicznym, by uzyskać pomoc). Następnie zrestartuj komputer. Ekran płyty ratunkowej VeraCrypt powinien się teraz pokazać. Uwaga: Na ekranie płyty ratunkowej VeraCrypt wybierz 'Repair Options' wciskając klawisz F8.\n\n\n</string>
<string lang="pl" key="RESCUE_DISK_HELP_PORTION_3">II. Kiedy i jak użyć płyty ratunkowej VeraCrypt (po Zaszyfrowaniu)\n\n</string> <string lang="pl" key="RESCUE_DISK_HELP_PORTION_3">II. Kiedy i jak użyć płyty ratunkowej VeraCrypt (po Zaszyfrowaniu)\n\n</string>
<string lang="pl" key="RESCUE_DISK_HELP_PORTION_4">1) Jeśli ekran programu startowego VeraCrypt nie pojawia się po uruchomieniu komputera (lub jeśli nie startuje Windows), program startowy VeraCrypt może być uszkodzony. Płyta ratunowa VeraCrypt pozwala odtworzyć go a przez to odzyskać dostęp do zaszyfrowanego systemu i danych (jednak pamiętaj, że wciąż należy podać poprawne hasło). Na ekranie płyty ratunkowej wybierz 'Repair Options' &gt; 'Restore VeraCrypt Boot Loader'. Następnie wciśnij 'Y', by potwierdzić akcję, usuń płytę ratunkową z napędu CD/DVD i uruchom ponownie komputer.\n\n</string> <string lang="pl" key="RESCUE_DISK_HELP_PORTION_4">1) Jeśli ekran programu startowego VeraCrypt nie pojawia się po uruchomieniu komputera (lub jeśli nie startuje Windows), program startowy VeraCrypt może być uszkodzony. Płyta ratunowa VeraCrypt pozwala odtworzyć go a przez to odzyskać dostęp do zaszyfrowanego systemu i danych (jednak pamiętaj, że wciąż należy podać poprawne hasło). Na ekranie płyty ratunkowej wybierz 'Repair Options' &gt; 'Restore VeraCrypt Boot Loader'. Następnie wciśnij 'Y', by potwierdzić akcję, usuń płytę ratunkową z napędu CD/DVD i uruchom ponownie komputer.\n\n</string>

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -84,7 +84,7 @@ void Print (uint32 number)
number /= 10; number /= 10;
} }
str[pos] = (char) (number % 10) + '0'; str[pos] = (char) (number % 10) + '0';
while (pos >= 0) while (pos >= 0)
PrintChar (str[pos--]); PrintChar (str[pos--]);
} }
@@ -251,7 +251,7 @@ byte GetKeyboardChar (byte *scanCode)
mov asciiCode, al mov asciiCode, al
mov scan, ah mov scan, ah
} }
if (scanCode) if (scanCode)
*scanCode = scan; *scanCode = scan;
@@ -327,7 +327,7 @@ int GetString (char *buffer, size_t bufferSize)
if (scanCode == TC_BIOS_KEY_ENTER) if (scanCode == TC_BIOS_KEY_ENTER)
break; break;
if (scanCode == TC_BIOS_KEY_ESC) if (scanCode == TC_BIOS_KEY_ESC)
return 0; return 0;

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
; Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed ; Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
; by the TrueCrypt License 3.0. ; by the TrueCrypt License 3.0.
; ;
; Modifications and additions to the original source code (contained in this file) ; Modifications and additions to the original source code (contained in this file)
; and all other portions of this file are Copyright (c) 2013-2016 IDRIX ; and all other portions of this file are Copyright (c) 2013-2016 IDRIX
; and are governed by the Apache License 2.0 the full text of which is ; and are governed by the Apache License 2.0 the full text of which is
; contained in the file License.txt included in VeraCrypt binary and source ; contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -61,12 +61,12 @@ void PrintVal (const char *message, const uint32 value, bool newLine, bool hex)
{ {
Print (message); Print (message);
Print (": "); Print (": ");
if (hex) if (hex)
PrintHex (value); PrintHex (value);
else else
Print (value); Print (value);
if (newLine) if (newLine)
PrintEndl(); PrintEndl();
} }

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -42,9 +42,9 @@
#define TC__BOOT_LOADER_SEGMENT TC_HEX (9000) // Some buggy BIOS routines fail if CS bits 0-10 are not zero #define TC__BOOT_LOADER_SEGMENT TC_HEX (9000) // Some buggy BIOS routines fail if CS bits 0-10 are not zero
#if TC__BOOT_MEMORY_REQUIRED <= 32 #if TC__BOOT_MEMORY_REQUIRED <= 32
# define TC__BOOT_LOADER_SEGMENT_LOW (TC__BOOT_LOADER_SEGMENT - 32 * 1024 / 16) # define TC__BOOT_LOADER_SEGMENT_LOW (TC__BOOT_LOADER_SEGMENT - 32 * 1024 / 16)
#else #else
# define TC__BOOT_LOADER_SEGMENT_LOW (TC__BOOT_LOADER_SEGMENT - 64 * 1024 / 16) # define TC__BOOT_LOADER_SEGMENT_LOW (TC__BOOT_LOADER_SEGMENT - 64 * 1024 / 16)
#endif #endif
#define TC__COM_EXECUTABLE_OFFSET TC_HEX (100) #define TC__COM_EXECUTABLE_OFFSET TC_HEX (100)

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -201,7 +201,7 @@ static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, byte d
dapPacket.Sector = sector; dapPacket.Sector = sector;
byte function = write ? 0x43 : 0x42; byte function = write ? 0x43 : 0x42;
BiosResult result; BiosResult result;
byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES; byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
@@ -261,7 +261,7 @@ BiosResult ReadSectors (byte *buffer, byte drive, const uint64 &sector, uint16 s
BiosResult result; BiosResult result;
uint16 codeSeg; uint16 codeSeg;
__asm mov codeSeg, cs __asm mov codeSeg, cs
result = ReadSectors (BootStarted ? codeSeg : TC_BOOT_LOADER_ALT_SEGMENT, (uint16) buffer, drive, sector, sectorCount, silent); result = ReadSectors (BootStarted ? codeSeg : TC_BOOT_LOADER_ALT_SEGMENT, (uint16) buffer, drive, sector, sectorCount, silent);
// Alternative segment is used to prevent memory corruption caused by buggy BIOSes // Alternative segment is used to prevent memory corruption caused by buggy BIOSes
@@ -389,13 +389,13 @@ BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t par
PartitionEntryMBR mbrPartitions[4]; PartitionEntryMBR mbrPartitions[4];
memcpy (mbrPartitions, mbr->Partitions, sizeof (mbrPartitions)); memcpy (mbrPartitions, mbr->Partitions, sizeof (mbrPartitions));
size_t partitionArrayPos = 0, partitionNumber; size_t partitionArrayPos = 0, partitionNumber;
for (partitionNumber = 0; for (partitionNumber = 0;
partitionNumber < array_capacity (mbrPartitions) && partitionArrayPos < partitionArrayCapacity; partitionNumber < array_capacity (mbrPartitions) && partitionArrayPos < partitionArrayCapacity;
++partitionNumber) ++partitionNumber)
{ {
const PartitionEntryMBR &partEntry = mbrPartitions[partitionNumber]; const PartitionEntryMBR &partEntry = mbrPartitions[partitionNumber];
if (partEntry.SectorCountLBA > 0) if (partEntry.SectorCountLBA > 0)
{ {
Partition &partition = partitionArray[partitionArrayPos]; Partition &partition = partitionArray[partitionArrayPos];
@@ -486,6 +486,6 @@ bool GetActivePartition (byte drive)
PrintError (TC_BOOT_STR_NO_BOOT_PARTITION); PrintError (TC_BOOT_STR_NO_BOOT_PARTITION);
return false; return false;
} }
return true; return true;
} }

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -72,7 +72,7 @@ static void PrintMainMenu ()
Print ((BootSectorFlags & TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE) != TC_HIDDEN_OS_CREATION_PHASE_NONE Print ((BootSectorFlags & TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE) != TC_HIDDEN_OS_CREATION_PHASE_NONE
? "Boot Non-Hidden System (Boot Manager)" ? "Boot Non-Hidden System (Boot Manager)"
: "Skip Authentication (Boot Manager)"); : "Skip Authentication (Boot Manager)");
#else // TC_WINDOWS_BOOT_RESCUE_DISK_MODE #else // TC_WINDOWS_BOOT_RESCUE_DISK_MODE
Print ("Skip Authentication (Boot Manager)"); Print ("Skip Authentication (Boot Manager)");
@@ -184,7 +184,7 @@ static byte AskPassword (Password &password, int& pim)
ClearBiosKeystrokeBuffer(); ClearBiosKeystrokeBuffer();
PrintEndl(); PrintEndl();
break; break;
case TC_BIOS_KEY_BACKSPACE: case TC_BIOS_KEY_BACKSPACE:
@@ -262,7 +262,7 @@ static byte AskPassword (Password &password, int& pim)
ClearBiosKeystrokeBuffer(); ClearBiosKeystrokeBuffer();
PrintEndl(); PrintEndl();
return TC_BIOS_KEY_ENTER; return TC_BIOS_KEY_ENTER;
case TC_BIOS_KEY_BACKSPACE: case TC_BIOS_KEY_BACKSPACE:
@@ -301,7 +301,7 @@ static byte AskPassword (Password &password, int& pim)
pim = 10*pim + (asciiCode - '0'); pim = 10*pim + (asciiCode - '0');
pos++; pos++;
if (hidePassword) asciiCode = '*'; if (hidePassword) asciiCode = '*';
if (pos < MAX_PIM) if (pos < MAX_PIM)
PrintChar (asciiCode); PrintChar (asciiCode);
@@ -343,7 +343,7 @@ static bool OpenVolume (byte drive, Password &password, int pim, CRYPTO_INFO **c
int volumeType; int volumeType;
bool hiddenVolume; bool hiddenVolume;
uint64 headerSec; uint64 headerSec;
AcquireSectorBuffer(); AcquireSectorBuffer();
for (volumeType = 1; volumeType <= 2; ++volumeType) for (volumeType = 1; volumeType <= 2; ++volumeType)
@@ -479,7 +479,7 @@ static bool MountVolume (byte drive, byte &exitKey, bool skipNormal, bool skipHi
EncryptedVirtualPartition.Drive = BootDrive; EncryptedVirtualPartition.Drive = BootDrive;
EncryptedVirtualPartition.StartSector = BootCryptoInfo->EncryptedAreaStart >> TC_LB_SIZE_BIT_SHIFT_DIVISOR; EncryptedVirtualPartition.StartSector = BootCryptoInfo->EncryptedAreaStart >> TC_LB_SIZE_BIT_SHIFT_DIVISOR;
PimValueOrHiddenVolumeStartUnitNo = EncryptedVirtualPartition.StartSector; PimValueOrHiddenVolumeStartUnitNo = EncryptedVirtualPartition.StartSector;
HiddenVolumeStartSector = PartitionFollowingActive.StartSector; HiddenVolumeStartSector = PartitionFollowingActive.StartSector;
HiddenVolumeStartSector += EncryptedVirtualPartition.StartSector; HiddenVolumeStartSector += EncryptedVirtualPartition.StartSector;
@@ -535,7 +535,7 @@ static byte BootEncryptedDrive ()
if (!MountVolume (BootDrive, exitKey, PreventNormalSystemBoot, false)) if (!MountVolume (BootDrive, exitKey, PreventNormalSystemBoot, false))
return exitKey; return exitKey;
if (!CheckMemoryRequirements ()) if (!CheckMemoryRequirements ())
goto err; goto err;
@@ -765,7 +765,7 @@ static bool CopySystemPartitionToHiddenVolume (byte drive, byte &exitKey)
EncryptDataUnits (SectorBuffer, &s, 1, BootCryptoInfo); EncryptDataUnits (SectorBuffer, &s, 1, BootCryptoInfo);
CopyMemory (SectorBuffer, TC_BOOT_LOADER_BUFFER_SEGMENT, i * TC_LB_SIZE, TC_LB_SIZE); CopyMemory (SectorBuffer, TC_BOOT_LOADER_BUFFER_SEGMENT, i * TC_LB_SIZE, TC_LB_SIZE);
} }
ReleaseSectorBuffer(); ReleaseSectorBuffer();
@@ -875,7 +875,7 @@ static void DecryptDrive (byte drive)
DecryptDataUnits (SectorBuffer, &s, 1, BootCryptoInfo); DecryptDataUnits (SectorBuffer, &s, 1, BootCryptoInfo);
CopyMemory (SectorBuffer, TC_BOOT_LOADER_BUFFER_SEGMENT, i * TC_LB_SIZE, TC_LB_SIZE); CopyMemory (SectorBuffer, TC_BOOT_LOADER_BUFFER_SEGMENT, i * TC_LB_SIZE, TC_LB_SIZE);
} }
ReleaseSectorBuffer(); ReleaseSectorBuffer();
@@ -1250,7 +1250,7 @@ void main ()
exitKey = BootEncryptedDrive(); exitKey = BootEncryptedDrive();
#else // TC_WINDOWS_BOOT_RESCUE_DISK_MODE #else // TC_WINDOWS_BOOT_RESCUE_DISK_MODE
PrintMainMenu(); PrintMainMenu();
exitKey = BootEncryptedDrive(); exitKey = BootEncryptedDrive();

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -44,7 +44,7 @@ static bool GetMemoryMapEntry (BiosMemoryMapEntry &entry)
push TC_BOOT_LOADER_ALT_SEGMENT push TC_BOOT_LOADER_ALT_SEGMENT
pop es pop es
mov di, 0 mov di, 0
int 0x15 int 0x15
jnc no_carry jnc no_carry
mov carry, true mov carry, true

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
; Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed ; Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
; by the TrueCrypt License 3.0. ; by the TrueCrypt License 3.0.
; ;
; Modifications and additions to the original source code (contained in this file) ; Modifications and additions to the original source code (contained in this file)
; and all other portions of this file are Copyright (c) 2013-2016 IDRIX ; and all other portions of this file are Copyright (c) 2013-2016 IDRIX
; and are governed by the Apache License 2.0 the full text of which is ; and are governed by the Apache License 2.0 the full text of which is
; contained in the file License.txt included in VeraCrypt binary and source ; contained in the file License.txt included in VeraCrypt binary and source
@@ -26,9 +26,9 @@ start:
loader_name_msg: loader_name_msg:
db ' VeraCrypt Boot Loader', 13, 10, 0 db ' VeraCrypt Boot Loader', 13, 10, 0
main: main:
cli cli
xor ax, ax xor ax, ax
mov ds, ax mov ds, ax
mov ss, ax mov ss, ax
@@ -49,12 +49,12 @@ skip_loader_name_msg:
; Check available memory ; Check available memory
cmp word ptr [ds:413h], TC_BOOT_LOADER_SEGMENT / 1024 * 16 + TC_BOOT_MEMORY_REQUIRED cmp word ptr [ds:413h], TC_BOOT_LOADER_SEGMENT / 1024 * 16 + TC_BOOT_MEMORY_REQUIRED
jge memory_ok jge memory_ok
mov ax, TC_BOOT_LOADER_SEGMENT_LOW mov ax, TC_BOOT_LOADER_SEGMENT_LOW
cmp word ptr [ds:413h], TC_BOOT_LOADER_SEGMENT_LOW / 1024 * 16 + TC_BOOT_MEMORY_REQUIRED cmp word ptr [ds:413h], TC_BOOT_LOADER_SEGMENT_LOW / 1024 * 16 + TC_BOOT_MEMORY_REQUIRED
jge memory_ok jge memory_ok
; Insufficient memory ; Insufficient memory
mov ax, TC_BOOT_LOADER_LOWMEM_SEGMENT mov ax, TC_BOOT_LOADER_LOWMEM_SEGMENT
@@ -67,11 +67,11 @@ memory_ok:
mov cx, TC_BOOT_MEMORY_REQUIRED * 1024 - TC_COM_EXECUTABLE_OFFSET - 1 mov cx, TC_BOOT_MEMORY_REQUIRED * 1024 - TC_COM_EXECUTABLE_OFFSET - 1
cld cld
rep stosb rep stosb
mov ax, es mov ax, es
sub ax, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE / 16 ; Decompressor segment sub ax, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE / 16 ; Decompressor segment
mov es, ax mov es, ax
; Load decompressor ; Load decompressor
mov cl, TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR mov cl, TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR
retry_backup: retry_backup:
@@ -85,17 +85,17 @@ retry_backup:
mov cx, TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT * TC_LB_SIZE mov cx, TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT * TC_LB_SIZE
call checksum call checksum
push ebx push ebx
; Load compressed boot loader ; Load compressed boot loader
mov bx, TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET mov bx, TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET
mov cl, TC_BOOT_LOADER_START_SECTOR mov cl, TC_BOOT_LOADER_START_SECTOR
mov al, TC_MAX_BOOT_LOADER_SECTOR_COUNT mov al, TC_MAX_BOOT_LOADER_SECTOR_COUNT
test backup_loader_used, 1 test backup_loader_used, 1
jz non_backup jz non_backup
mov al, TC_BOOT_LOADER_BACKUP_SECTOR_COUNT - TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT mov al, TC_BOOT_LOADER_BACKUP_SECTOR_COUNT - TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
mov cl, TC_BOOT_LOADER_START_SECTOR + TC_BOOT_LOADER_BACKUP_SECTOR_COUNT mov cl, TC_BOOT_LOADER_START_SECTOR + TC_BOOT_LOADER_BACKUP_SECTOR_COUNT
non_backup: non_backup:
call read_sectors call read_sectors
@@ -104,21 +104,21 @@ non_backup:
mov si, TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET mov si, TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET
mov cx, word ptr [start + TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET] mov cx, word ptr [start + TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET]
call checksum call checksum
; Verify checksum ; Verify checksum
cmp ebx, dword ptr [start + TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET] cmp ebx, dword ptr [start + TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET]
je checksum_ok je checksum_ok
; Checksum incorrect - try using backup if available ; Checksum incorrect - try using backup if available
test backup_loader_used, 1 test backup_loader_used, 1
jnz loader_damaged jnz loader_damaged
mov backup_loader_used, 1 mov backup_loader_used, 1
mov cl, TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR + TC_BOOT_LOADER_BACKUP_SECTOR_COUNT mov cl, TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR + TC_BOOT_LOADER_BACKUP_SECTOR_COUNT
test TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE, byte ptr [start + TC_BOOT_SECTOR_CONFIG_OFFSET] test TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE, byte ptr [start + TC_BOOT_SECTOR_CONFIG_OFFSET]
jnz retry_backup jnz retry_backup
loader_damaged: loader_damaged:
lea si, loader_damaged_msg lea si, loader_damaged_msg
call print call print
@@ -134,9 +134,9 @@ checksum_ok:
mov ss, ax mov ss, ax
mov sp, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE mov sp, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE
sti sti
push dx push dx
; Decompress boot loader ; Decompress boot loader
mov cx, word ptr [start + TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET] mov cx, word ptr [start + TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET]
sub cx, TC_GZIP_HEADER_SIZE sub cx, TC_GZIP_HEADER_SIZE
@@ -154,7 +154,7 @@ decompressor_ret:
add sp, 8 add sp, 8
pop dx pop dx
; Restore boot sector segment ; Restore boot sector segment
push cs push cs
pop ds pop ds
@@ -170,7 +170,7 @@ decompression_ok:
; DH = boot sector flags ; DH = boot sector flags
mov dh, byte ptr [start + TC_BOOT_SECTOR_CONFIG_OFFSET] mov dh, byte ptr [start + TC_BOOT_SECTOR_CONFIG_OFFSET]
; Set up boot loader segment ; Set up boot loader segment
mov ax, es mov ax, es
add ax, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE / 16 add ax, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE / 16
@@ -185,17 +185,17 @@ decompression_ok:
push es push es
push TC_COM_EXECUTABLE_OFFSET push TC_COM_EXECUTABLE_OFFSET
retf retf
; Print string ; Print string
print: print:
xor bx, bx xor bx, bx
mov ah, 0eh mov ah, 0eh
cld cld
@@: lodsb @@: lodsb
test al, al test al, al
jz print_end jz print_end
int 10h int 10h
jmp @B jmp @B
@@ -210,12 +210,12 @@ read_sectors:
mov ah, 2 mov ah, 2
int 13h int 13h
jnc read_ok jnc read_ok
lea si, disk_error_msg lea si, disk_error_msg
call print call print
read_ok: read_ok:
ret ret
; Calculate checksum ; Calculate checksum
checksum: checksum:
push ds push ds
@@ -223,17 +223,17 @@ checksum:
pop ds pop ds
xor eax, eax xor eax, eax
cld cld
@@: lodsb @@: lodsb
add ebx, eax add ebx, eax
rol ebx, 1 rol ebx, 1
loop @B loop @B
pop ds pop ds
ret ret
backup_loader_used db 0 backup_loader_used db 0
disk_error_msg db 'Disk error', 13, 10, 7, 0 disk_error_msg db 'Disk error', 13, 10, 7, 0
loader_damaged_msg db 7, 'Loader damaged! Repair with Rescue Disk', 0 loader_damaged_msg db 7, 'Loader damaged! Repair with Rescue Disk', 0

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -98,7 +98,7 @@ bool Int13Filter ()
if (ReEntryCount == 0 && drive == EncryptedVirtualPartition.Drive) if (ReEntryCount == 0 && drive == EncryptedVirtualPartition.Drive)
{ {
BiosResult result; BiosResult result;
if (function == 0x3) if (function == 0x3)
result = WriteEncryptedSectors (regs.ES, regs.BX, drive, sector, sectorCount); result = WriteEncryptedSectors (regs.ES, regs.BX, drive, sector, sectorCount);
else else
@@ -126,7 +126,7 @@ bool Int13Filter ()
case 0x43: // Write sectors LBA case 0x43: // Write sectors LBA
{ {
byte drive = (byte) regs.DX; byte drive = (byte) regs.DX;
BiosLbaPacket lba; BiosLbaPacket lba;
CopyMemory (regs.DS, regs.SI, (byte *) &lba, sizeof (lba)); CopyMemory (regs.DS, regs.SI, (byte *) &lba, sizeof (lba));
@@ -141,7 +141,7 @@ bool Int13Filter ()
if (ReEntryCount == 0 && drive == EncryptedVirtualPartition.Drive) if (ReEntryCount == 0 && drive == EncryptedVirtualPartition.Drive)
{ {
BiosResult result; BiosResult result;
uint16 segment = (uint16) (lba.Buffer >> 16); uint16 segment = (uint16) (lba.Buffer >> 16);
uint16 offset = (uint16) lba.Buffer; uint16 offset = (uint16) lba.Buffer;
@@ -524,7 +524,7 @@ void IntFilterEntry ()
popf popf
leave leave
add sp, 2 add sp, 2
jmp cs:OriginalInt13Handler jmp cs:OriginalInt13Handler
pass15: pass15:
popad popad
@@ -554,7 +554,7 @@ static void Int15FilterEntry ()
pushf pushf
cmp ax, 0xe820 // Get system memory map cmp ax, 0xe820 // Get system memory map
je filter je filter
popf popf
leave leave
jmp cs:OriginalInt15Handler jmp cs:OriginalInt15Handler
@@ -600,7 +600,7 @@ bool InstallInterruptFilters ()
// Save original INT 13 handler // Save original INT 13 handler
xor ax, ax xor ax, ax
mov es, ax mov es, ax
mov si, 0x13 * 4 mov si, 0x13 * 4
lea di, OriginalInt13Handler lea di, OriginalInt13Handler
@@ -608,14 +608,14 @@ bool InstallInterruptFilters ()
mov [di], ax mov [di], ax
mov ax, es:[si + 2] mov ax, es:[si + 2]
mov [di + 2], ax mov [di + 2], ax
// Install INT 13 filter // Install INT 13 filter
lea ax, Int13FilterEntry lea ax, Int13FilterEntry
mov es:[si], ax mov es:[si], ax
mov es:[si + 2], cs mov es:[si + 2], cs
// Save original INT 15 handler // Save original INT 15 handler
mov si, 0x15 * 4 mov si, 0x15 * 4
lea di, OriginalInt15Handler lea di, OriginalInt15Handler
mov ax, es:[si] mov ax, es:[si]

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
# Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed # Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
# by the TrueCrypt License 3.0. # by the TrueCrypt License 3.0.
# #
# Modifications and additions to the original source code (contained in this file) # Modifications and additions to the original source code (contained in this file)
# and all other portions of this file are Copyright (c) 2013-2016 IDRIX # and all other portions of this file are Copyright (c) 2013-2016 IDRIX
# and are governed by the Apache License 2.0 the full text of which is # and are governed by the Apache License 2.0 the full text of which is
# contained in the file License.txt included in VeraCrypt binary and source # contained in the file License.txt included in VeraCrypt binary and source
@@ -111,7 +111,7 @@ env:
set INCLUDE=. set INCLUDE=.
set LIB=. set LIB=.
set LIBPATH=. set LIBPATH=.
clean: clean:
-del /q /s $(OBJDIR) >NUL: -del /q /s $(OBJDIR) >NUL:
@@ -133,7 +133,7 @@ clean:
$(CC) $(CFLAGS) /c "$(SRCDIR)\$<" $(CC) $(CFLAGS) /c "$(SRCDIR)\$<"
set PATH=$(ENVPATH) set PATH=$(ENVPATH)
cd .. cd ..
{..\..\Common}.c{$(OUTDIR)}.obj: {..\..\Common}.c{$(OUTDIR)}.obj:
cd $(OBJDIR) cd $(OBJDIR)
set PATH=. set PATH=.
@@ -147,7 +147,7 @@ clean:
$(CC) $(CFLAGS) /c "$(SRCDIR)\$<" $(CC) $(CFLAGS) /c "$(SRCDIR)\$<"
set PATH=$(ENVPATH) set PATH=$(ENVPATH)
cd .. cd ..
.cpp{$(OUTDIR)}.obj: .cpp{$(OUTDIR)}.obj:
cd $(OBJDIR) cd $(OBJDIR)
set PATH=. set PATH=.
@@ -161,7 +161,7 @@ $(OUTDIR)\BootDefs.i: BootDefs.h
$(CC) $(CFLAGS) /D TC_ASM_PREPROCESS /P /EP "$(SRCDIR)\BootDefs.h" $(CC) $(CFLAGS) /D TC_ASM_PREPROCESS /P /EP "$(SRCDIR)\BootDefs.h"
set PATH=$(ENVPATH) set PATH=$(ENVPATH)
cd .. cd ..
$(OUTDIR)\BootSector.bin: $(OUTDIR)\BootSector.obj $(OUTDIR)\BootSector.bin: $(OUTDIR)\BootSector.obj
cd $(OBJDIR) cd $(OBJDIR)
$(LD) $(LFLAGS) BootSector.obj,BootSector.bin,,,, >NUL: $(LD) $(LFLAGS) BootSector.obj,BootSector.bin,,,, >NUL:
@@ -177,7 +177,7 @@ $(OUTDIR)\Decompressor.com: $(OUTDIR)\BootCrt.obj $(OUTDIR)\Decompressor.obj
$(OUTDIR)\$(PROJ).$(TARGETEXT): $(OBJS) $(OUTDIR)\$(PROJ).$(TARGETEXT): $(OBJS)
@echo Linking... @echo Linking...
cd $(OBJDIR) cd $(OBJDIR)
echo >NUL: @<<$(PROJ).crf2 echo >NUL: @<<$(PROJ).crf2
$(PROJ).$(TARGETEXT) $(PROJ).$(TARGETEXT)
@@ -189,7 +189,7 @@ $(LIBS)
del $(PROJ).crf >NUL: 2>NUL: del $(PROJ).crf >NUL: 2>NUL:
for %F in ($(**F)) do @echo %F + >>$(PROJ).crf for %F in ($(**F)) do @echo %F + >>$(PROJ).crf
type $(PROJ).crf2 >>$(PROJ).crf type $(PROJ).crf2 >>$(PROJ).crf
$(LD) $(LFLAGS) @$(PROJ).crf $(LD) $(LFLAGS) @$(PROJ).crf
del $(PROJ).crf $(PROJ).crf2 del $(PROJ).crf $(PROJ).crf2

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -83,7 +83,7 @@ uint64 operator>> (const uint64 &a, int shiftCount)
while (shiftCount--) while (shiftCount--)
{ {
r.LowPart >>= 1; r.LowPart >>= 1;
if ((byte) r.HighPart & 1) if ((byte) r.HighPart & 1)
r.LowPart |= 0x80000000UL; r.LowPart |= 0x80000000UL;
@@ -96,7 +96,7 @@ uint64 operator>> (const uint64 &a, int shiftCount)
uint64 operator<< (const uint64 &a, int shiftCount) uint64 operator<< (const uint64 &a, int shiftCount)
{ {
uint64 r = a; uint64 r = a;
while (shiftCount--) while (shiftCount--)
r += r; r += r;
@@ -148,9 +148,9 @@ bool TestInt64 ()
a += b; a += b;
a -= b; a -= b;
++a; ++a;
b = b + (uint32) 1UL; b = b + (uint32) 1UL;
c = (a - ((a + b) >> 32) - (uint32) 1UL); c = (a - ((a + b) >> 32) - (uint32) 1UL);
@@ -214,11 +214,11 @@ bool RegionsIntersect (const uint64 &start1, uint32 length1, const uint64 &start
{ {
uint64 end1 = start1 + length1 - 1UL; uint64 end1 = start1 + length1 - 1UL;
uint64 intersectEnd = (end1 <= end2) ? end1 : end2; uint64 intersectEnd = (end1 <= end2) ? end1 : end2;
uint64 intersectStart = (start1 >= start2) ? start1 : start2; uint64 intersectStart = (start1 >= start2) ? start1 : start2;
if (intersectStart > intersectEnd) if (intersectStart > intersectEnd)
return false; return false;
return (intersectEnd + 1UL - intersectStart).LowPart != 0; return (intersectEnd + 1UL - intersectStart).LowPart != 0;
} }

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -37,7 +37,7 @@ typedef UINT64_STRUCT uint64;
#define TC_ASM_EMIT(A,B) __asm _emit 0x##A __asm _emit 0x##B #define TC_ASM_EMIT(A,B) __asm _emit 0x##A __asm _emit 0x##B
#define TC_ASM_EMIT3(A,B,C) __asm _emit 0x##A __asm _emit 0x##B __asm _emit 0x##C #define TC_ASM_EMIT3(A,B,C) __asm _emit 0x##A __asm _emit 0x##B __asm _emit 0x##C
#define TC_ASM_EMIT4(A,B,C,D) __asm _emit 0x##A __asm _emit 0x##B __asm _emit 0x##C __asm _emit 0x##D #define TC_ASM_EMIT4(A,B,C,D) __asm _emit 0x##A __asm _emit 0x##B __asm _emit 0x##C __asm _emit 0x##D
#define TC_ASM_MOV_EAX_DI TC_ASM_EMIT3 (66, 8B, 05) #define TC_ASM_MOV_EAX_DI TC_ASM_EMIT3 (66, 8B, 05)
#define TC_ASM_MOV_EBX_DI TC_ASM_EMIT3 (66, 8B, 1D) #define TC_ASM_MOV_EBX_DI TC_ASM_EMIT3 (66, 8B, 1D)

View File

@@ -3,7 +3,7 @@
# Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed # Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
# by the TrueCrypt License 3.0. # by the TrueCrypt License 3.0.
# #
# Modifications and additions to the original source code (contained in this file) # Modifications and additions to the original source code (contained in this file)
# and all other portions of this file are Copyright (c) 2013-2016 IDRIX # and all other portions of this file are Copyright (c) 2013-2016 IDRIX
# and are governed by the Apache License 2.0 the full text of which is # and are governed by the Apache License 2.0 the full text of which is
# contained in the file License.txt included in VeraCrypt binary and source # contained in the file License.txt included in VeraCrypt binary and source
@@ -53,7 +53,7 @@ TR_SED_BIN := tr '\n' ' ' | tr -s ' ' ',' | sed -e 's/^,//g' -e 's/,$$/n/' | tr
%.txt.h: %.txt %.txt.h: %.txt
@echo Converting $(<F) @echo Converting $(<F)
$(OD_BIN) $< | $(TR_SED_BIN) >$@ $(OD_BIN) $< | $(TR_SED_BIN) >$@
%.bmp.h: %.bmp %.bmp.h: %.bmp
@echo Converting $(<F) @echo Converting $(<F)
$(OD_BIN) $< | $(TR_SED_BIN) >$@ $(OD_BIN) $< | $(TR_SED_BIN) >$@

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -20,11 +20,11 @@ class TrueCryptFactory : public IClassFactory
{ {
public: public:
TrueCryptFactory (DWORD messageThreadId) : TrueCryptFactory (DWORD messageThreadId) :
RefCount (1), ServerLockCount (0), MessageThreadId (messageThreadId) { } RefCount (1), ServerLockCount (0), MessageThreadId (messageThreadId) { }
~TrueCryptFactory () { } ~TrueCryptFactory () { }
virtual ULONG STDMETHODCALLTYPE AddRef () virtual ULONG STDMETHODCALLTYPE AddRef ()
{ {
return InterlockedIncrement (&RefCount) - 1; return InterlockedIncrement (&RefCount) - 1;
@@ -53,7 +53,7 @@ public:
AddRef (); AddRef ();
return S_OK; return S_OK;
} }
virtual HRESULT STDMETHODCALLTYPE CreateInstance (IUnknown *pUnkOuter, REFIID riid, void **ppvObject) virtual HRESULT STDMETHODCALLTYPE CreateInstance (IUnknown *pUnkOuter, REFIID riid, void **ppvObject)
{ {
if (pUnkOuter != NULL) if (pUnkOuter != NULL)

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -44,7 +44,7 @@ namespace VeraCrypt
class Elevator class Elevator
{ {
public: public:
static void AddReference () static void AddReference ()
{ {
++ReferenceCount; ++ReferenceCount;
@@ -193,7 +193,7 @@ namespace VeraCrypt
{ {
result = ERROR_OUTOFMEMORY; result = ERROR_OUTOFMEMORY;
} }
if (result != ERROR_SUCCESS) if (result != ERROR_SUCCESS)
{ {
SetLastError (result); SetLastError (result);
@@ -263,7 +263,7 @@ namespace VeraCrypt
ElevatedComInstanceThreadId = GetCurrentThreadId(); ElevatedComInstanceThreadId = GetCurrentThreadId();
} }
} }
#if defined (TCMOUNT) #if defined (TCMOUNT)
static ITrueCryptMainCom *ElevatedComInstance; static ITrueCryptMainCom *ElevatedComInstance;
#elif defined (VOLFORMAT) #elif defined (VOLFORMAT)
@@ -282,7 +282,7 @@ namespace VeraCrypt
int Elevator::ReferenceCount = 0; int Elevator::ReferenceCount = 0;
#else // SETUP #else // SETUP
class Elevator class Elevator
{ {
public: public:
@@ -308,7 +308,7 @@ namespace VeraCrypt
{ {
FileOpen = true; FileOpen = true;
} }
else else
{ {
LastError = GetLastError(); LastError = GetLastError();
if (LastError == ERROR_ACCESS_DENIED && IsUacSupported()) if (LastError == ERROR_ACCESS_DENIED && IsUacSupported())
@@ -436,7 +436,7 @@ namespace VeraCrypt
{ {
FileOpen = true; FileOpen = true;
} }
else else
{ {
LastError = GetLastError (); LastError = GetLastError ();
if (LastError == ERROR_ACCESS_DENIED && IsUacSupported()) if (LastError == ERROR_ACCESS_DENIED && IsUacSupported())
@@ -477,7 +477,7 @@ namespace VeraCrypt
{ {
if (RescueIsoImage) if (RescueIsoImage)
delete[] RescueIsoImage; delete[] RescueIsoImage;
Elevator::Release(); Elevator::Release();
} }
@@ -516,7 +516,7 @@ namespace VeraCrypt
if (config.SystemPartition.IsGPT) if (config.SystemPartition.IsGPT)
throw ParameterIncorrect (SRC_POS); // It is assumed that CheckRequirements() had been called throw ParameterIncorrect (SRC_POS); // It is assumed that CheckRequirements() had been called
// Find the first active partition on the system drive // Find the first active partition on the system drive
foreach (const Partition &partition, config.Partitions) foreach (const Partition &partition, config.Partitions)
{ {
if (partition.Info.BootIndicator) if (partition.Info.BootIndicator)
@@ -558,11 +558,11 @@ namespace VeraCrypt
} }
/* WARNING: Note that the partition number at the end of a device path (\Device\HarddiskY\PartitionX) must /* WARNING: Note that the partition number at the end of a device path (\Device\HarddiskY\PartitionX) must
NOT be used to find the first partition physically located behind the active one. The reason is that the NOT be used to find the first partition physically located behind the active one. The reason is that the
user may have deleted and created partitions during this session and e.g. the second partition could have user may have deleted and created partitions during this session and e.g. the second partition could have
a higer number than the third one. */ a higer number than the third one. */
// Find the first partition physically located behind the active partition // Find the first partition physically located behind the active partition
if (activePartitionFound) if (activePartitionFound)
{ {
@@ -692,7 +692,7 @@ namespace VeraCrypt
ProbeRealDriveSizeRequest request; ProbeRealDriveSizeRequest request;
StringCchCopyW (request.DeviceName, ARRAYSIZE (request.DeviceName), DriveConfig.DrivePartition.DevicePath.c_str()); StringCchCopyW (request.DeviceName, ARRAYSIZE (request.DeviceName), DriveConfig.DrivePartition.DevicePath.c_str());
CallDriver (TC_IOCTL_PROBE_REAL_DRIVE_SIZE, &request, sizeof (request), &request, sizeof (request)); CallDriver (TC_IOCTL_PROBE_REAL_DRIVE_SIZE, &request, sizeof (request), &request, sizeof (request));
DriveConfig.DrivePartition.Info.PartitionLength = request.RealDriveSize; DriveConfig.DrivePartition.Info.PartitionLength = request.RealDriveSize;
@@ -787,7 +787,7 @@ namespace VeraCrypt
return partList; return partList;
} }
DISK_GEOMETRY BootEncryption::GetDriveGeometry (int driveNumber) DISK_GEOMETRY BootEncryption::GetDriveGeometry (int driveNumber)
{ {
@@ -799,12 +799,12 @@ namespace VeraCrypt
return geometry; return geometry;
} }
wstring BootEncryption::GetWindowsDirectory () wstring BootEncryption::GetWindowsDirectory ()
{ {
wchar_t buf[MAX_PATH]; wchar_t buf[MAX_PATH];
throw_sys_if (GetSystemDirectory (buf, ARRAYSIZE (buf)) == 0); throw_sys_if (GetSystemDirectory (buf, ARRAYSIZE (buf)) == 0);
return wstring (buf); return wstring (buf);
} }
@@ -827,7 +827,7 @@ namespace VeraCrypt
// Note that this does not require admin rights (it just requires the driver to be running) // Note that this does not require admin rights (it just requires the driver to be running)
bool BootEncryption::IsBootLoaderOnDrive (wchar_t *devicePath) bool BootEncryption::IsBootLoaderOnDrive (wchar_t *devicePath)
{ {
try try
{ {
OPEN_TEST_STRUCT openTestStruct; OPEN_TEST_STRUCT openTestStruct;
memset (&openTestStruct, 0, sizeof (openTestStruct)); memset (&openTestStruct, 0, sizeof (openTestStruct));
@@ -871,7 +871,7 @@ namespace VeraCrypt
bool BootEncryption::IsHiddenSystemRunning () bool BootEncryption::IsHiddenSystemRunning ()
{ {
int hiddenSystemStatus; int hiddenSystemStatus;
CallDriver (TC_IOCTL_IS_HIDDEN_SYSTEM_RUNNING, nullptr, 0, &hiddenSystemStatus, sizeof (hiddenSystemStatus)); CallDriver (TC_IOCTL_IS_HIDDEN_SYSTEM_RUNNING, nullptr, 0, &hiddenSystemStatus, sizeof (hiddenSystemStatus));
return hiddenSystemStatus != 0; return hiddenSystemStatus != 0;
} }
@@ -1250,7 +1250,7 @@ namespace VeraCrypt
if (userConfig) if (userConfig)
*userConfig = request.UserConfiguration; *userConfig = request.UserConfiguration;
if (customUserMessage) if (customUserMessage)
{ {
request.CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH] = 0; request.CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH] = 0;
@@ -1267,7 +1267,7 @@ namespace VeraCrypt
if (userConfig) if (userConfig)
*userConfig = 0; *userConfig = 0;
if (customUserMessage) if (customUserMessage)
customUserMessage->clear(); customUserMessage->clear();
@@ -1326,7 +1326,7 @@ namespace VeraCrypt
memcpy (mbr + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET, customUserMessage.c_str(), customUserMessage.size()); memcpy (mbr + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET, customUserMessage.c_str(), customUserMessage.size());
} }
if (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_PIM) if (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_PIM)
{ {
// PIM for pre-boot authentication can be encoded on two bytes since its maximum // PIM for pre-boot authentication can be encoded on two bytes since its maximum
@@ -1386,7 +1386,7 @@ namespace VeraCrypt
ZeroMemory (&request, sizeof (request)); ZeroMemory (&request, sizeof (request));
request.WipeAlgorithm = wipeAlgorithm; request.WipeAlgorithm = wipeAlgorithm;
if (Randinit() != ERR_SUCCESS) if (Randinit() != ERR_SUCCESS)
{ {
if (CryptoAPILastError == ERROR_SUCCESS) if (CryptoAPILastError == ERROR_SUCCESS)
@@ -1414,7 +1414,7 @@ namespace VeraCrypt
CallDriver (TC_IOCTL_ABORT_DECOY_SYSTEM_WIPE); CallDriver (TC_IOCTL_ABORT_DECOY_SYSTEM_WIPE);
} }
DecoySystemWipeStatus BootEncryption::GetDecoyOSWipeStatus () DecoySystemWipeStatus BootEncryption::GetDecoyOSWipeStatus ()
{ {
DecoySystemWipeStatus status; DecoySystemWipeStatus status;
@@ -1448,7 +1448,7 @@ namespace VeraCrypt
device.SeekAt (0); device.SeekAt (0);
device.Read (mbr, sizeof (mbr)); device.Read (mbr, sizeof (mbr));
finally_do_arg (BootEncryption *, this, finally_do_arg (BootEncryption *, this,
{ {
try try
@@ -1594,7 +1594,7 @@ namespace VeraCrypt
WCHAR pathBuf[MAX_PATH]; WCHAR pathBuf[MAX_PATH];
throw_sys_if (!SUCCEEDED (SHGetFolderPath (NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, pathBuf))); throw_sys_if (!SUCCEEDED (SHGetFolderPath (NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, pathBuf)));
wstring path = wstring (pathBuf) + L"\\" _T(TC_APP_NAME); wstring path = wstring (pathBuf) + L"\\" _T(TC_APP_NAME);
CreateDirectory (path.c_str(), NULL); CreateDirectory (path.c_str(), NULL);
@@ -1624,7 +1624,7 @@ namespace VeraCrypt
throw ParameterIncorrect (SRC_POS); throw ParameterIncorrect (SRC_POS);
Buffer imageBuf (RescueIsoImageSize); Buffer imageBuf (RescueIsoImageSize);
byte *image = imageBuf.Ptr(); byte *image = imageBuf.Ptr();
memset (image, 0, RescueIsoImageSize); memset (image, 0, RescueIsoImageSize);
@@ -1721,7 +1721,7 @@ namespace VeraCrypt
File sysBakFile (GetSystemLoaderBackupPath(), true); File sysBakFile (GetSystemLoaderBackupPath(), true);
sysBakFile.CheckOpened (SRC_POS); sysBakFile.CheckOpened (SRC_POS);
sysBakFile.Read (image + TC_CD_BOOTSECTOR_OFFSET + TC_ORIG_BOOT_LOADER_BACKUP_SECTOR_OFFSET, TC_BOOT_LOADER_AREA_SIZE); sysBakFile.Read (image + TC_CD_BOOTSECTOR_OFFSET + TC_ORIG_BOOT_LOADER_BACKUP_SECTOR_OFFSET, TC_BOOT_LOADER_AREA_SIZE);
image[TC_CD_BOOTSECTOR_OFFSET + TC_BOOT_SECTOR_CONFIG_OFFSET] |= TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER; image[TC_CD_BOOTSECTOR_OFFSET + TC_BOOT_SECTOR_CONFIG_OFFSET] |= TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER;
} }
catch (Exception &e) catch (Exception &e)
@@ -1729,7 +1729,7 @@ namespace VeraCrypt
e.Show (ParentWindow); e.Show (ParentWindow);
Warning ("SYS_LOADER_UNAVAILABLE_FOR_RESCUE_DISK", ParentWindow); Warning ("SYS_LOADER_UNAVAILABLE_FOR_RESCUE_DISK", ParentWindow);
} }
// Boot loader backup // Boot loader backup
CreateBootLoaderInMemory (image + TC_CD_BOOTSECTOR_OFFSET + TC_BOOT_LOADER_BACKUP_RESCUE_DISK_SECTOR_OFFSET, TC_BOOT_LOADER_AREA_SIZE, false); CreateBootLoaderInMemory (image + TC_CD_BOOTSECTOR_OFFSET + TC_BOOT_LOADER_BACKUP_RESCUE_DISK_SECTOR_OFFSET, TC_BOOT_LOADER_AREA_SIZE, false);
@@ -1777,7 +1777,7 @@ namespace VeraCrypt
UINT driveType = GetDriveType (rootPath); UINT driveType = GetDriveType (rootPath);
// check that it is a CD/DVD drive or a removable media in case a bootable // check that it is a CD/DVD drive or a removable media in case a bootable
// USB key was created from the rescue disk ISO file // USB key was created from the rescue disk ISO file
if ((DRIVE_CDROM == driveType) || (DRIVE_REMOVABLE == driveType)) if ((DRIVE_CDROM == driveType) || (DRIVE_REMOVABLE == driveType))
{ {
rootPath[2] = 0; // remove trailing backslash rootPath[2] = 0; // remove trailing backslash
@@ -1813,7 +1813,7 @@ namespace VeraCrypt
Buffer buffer ((verifiedSectorCount + 1) * 2048); Buffer buffer ((verifiedSectorCount + 1) * 2048);
DWORD bytesRead = isoFile.Read (buffer.Ptr(), (DWORD) buffer.Size()); DWORD bytesRead = isoFile.Read (buffer.Ptr(), (DWORD) buffer.Size());
if ( (bytesRead == buffer.Size()) if ( (bytesRead == buffer.Size())
&& (memcmp (buffer.Ptr(), RescueIsoImage, buffer.Size()) == 0) && (memcmp (buffer.Ptr(), RescueIsoImage, buffer.Size()) == 0)
) )
{ {
@@ -2187,7 +2187,7 @@ namespace VeraCrypt
{ {
if (nCurrentOS == WIN_2000) if (nCurrentOS == WIN_2000)
throw ErrorException ("SYS_ENCRYPTION_UNSUPPORTED_ON_CURRENT_OS", SRC_POS); throw ErrorException ("SYS_ENCRYPTION_UNSUPPORTED_ON_CURRENT_OS", SRC_POS);
if (CurrentOSMajor == 6 && CurrentOSMinor == 0 && CurrentOSServicePack < 1) if (CurrentOSMajor == 6 && CurrentOSMinor == 0 && CurrentOSServicePack < 1)
throw ErrorException ("SYS_ENCRYPTION_UNSUPPORTED_ON_VISTA_SP0", SRC_POS); throw ErrorException ("SYS_ENCRYPTION_UNSUPPORTED_ON_VISTA_SP0", SRC_POS);
@@ -2272,7 +2272,7 @@ namespace VeraCrypt
if (!pagingFilesOk) if (!pagingFilesOk)
{ {
if (AskWarnYesNoString ((wchar_t *) (wstring (GetString ("PAGING_FILE_NOT_ON_SYS_PARTITION")) if (AskWarnYesNoString ((wchar_t *) (wstring (GetString ("PAGING_FILE_NOT_ON_SYS_PARTITION"))
+ GetString ("LEAKS_OUTSIDE_SYSPART_UNIVERSAL_EXPLANATION") + GetString ("LEAKS_OUTSIDE_SYSPART_UNIVERSAL_EXPLANATION")
+ L"\n\n\n" + L"\n\n\n"
+ GetString ("RESTRICT_PAGING_FILES_TO_SYS_PARTITION") + GetString ("RESTRICT_PAGING_FILES_TO_SYS_PARTITION")
@@ -2283,7 +2283,7 @@ namespace VeraCrypt
AbortProcessSilent(); AbortProcessSilent();
} }
throw ErrorException (wstring (GetString ("PAGING_FILE_NOT_ON_SYS_PARTITION")) throw ErrorException (wstring (GetString ("PAGING_FILE_NOT_ON_SYS_PARTITION"))
+ GetString ("LEAKS_OUTSIDE_SYSPART_UNIVERSAL_EXPLANATION"), SRC_POS); + GetString ("LEAKS_OUTSIDE_SYSPART_UNIVERSAL_EXPLANATION"), SRC_POS);
} }
@@ -2291,14 +2291,14 @@ namespace VeraCrypt
wchar_t *configPath = GetConfigPath (L"dummy"); wchar_t *configPath = GetConfigPath (L"dummy");
if (configPath && towupper (configPath[0]) != windowsDrive) if (configPath && towupper (configPath[0]) != windowsDrive)
{ {
throw ErrorException (wstring (GetString ("USER_PROFILE_NOT_ON_SYS_PARTITION")) throw ErrorException (wstring (GetString ("USER_PROFILE_NOT_ON_SYS_PARTITION"))
+ GetString ("LEAKS_OUTSIDE_SYSPART_UNIVERSAL_EXPLANATION"), SRC_POS); + GetString ("LEAKS_OUTSIDE_SYSPART_UNIVERSAL_EXPLANATION"), SRC_POS);
} }
// Temporary files // Temporary files
if (towupper (GetTempPathString()[0]) != windowsDrive) if (towupper (GetTempPathString()[0]) != windowsDrive)
{ {
throw ErrorException (wstring (GetString ("TEMP_NOT_ON_SYS_PARTITION")) throw ErrorException (wstring (GetString ("TEMP_NOT_ON_SYS_PARTITION"))
+ GetString ("LEAKS_OUTSIDE_SYSPART_UNIVERSAL_EXPLANATION"), SRC_POS); + GetString ("LEAKS_OUTSIDE_SYSPART_UNIVERSAL_EXPLANATION"), SRC_POS);
} }
} }
@@ -2414,7 +2414,7 @@ namespace VeraCrypt
device.Read ((byte *) header, sizeof (header)); device.Read ((byte *) header, sizeof (header));
PCRYPTO_INFO cryptoInfo = NULL; PCRYPTO_INFO cryptoInfo = NULL;
int status = ReadVolumeHeader (!encStatus.HiddenSystem, header, oldPassword, old_pkcs5, old_pim, FALSE, &cryptoInfo, NULL); int status = ReadVolumeHeader (!encStatus.HiddenSystem, header, oldPassword, old_pkcs5, old_pim, FALSE, &cryptoInfo, NULL);
finally_do_arg (PCRYPTO_INFO, cryptoInfo, { if (finally_arg) crypto_close (finally_arg); }); finally_do_arg (PCRYPTO_INFO, cryptoInfo, { if (finally_arg) crypto_close (finally_arg); });
@@ -2447,7 +2447,7 @@ namespace VeraCrypt
UserEnrichRandomPool (hwndDlg); UserEnrichRandomPool (hwndDlg);
WaitCursor(); WaitCursor();
/* The header will be re-encrypted wipePassCount times to prevent adversaries from using /* The header will be re-encrypted wipePassCount times to prevent adversaries from using
techniques such as magnetic force microscopy or magnetic force scanning tunnelling microscopy techniques such as magnetic force microscopy or magnetic force scanning tunnelling microscopy
to recover the overwritten header. According to Peter Gutmann, data should be overwritten 22 to recover the overwritten header. According to Peter Gutmann, data should be overwritten 22
times (ideally, 35 times) using non-random patterns and pseudorandom data. However, as users might times (ideally, 35 times) using non-random patterns and pseudorandom data. However, as users might
@@ -2663,7 +2663,7 @@ namespace VeraCrypt
SelectedEncryptionAlgorithmId = ea; SelectedEncryptionAlgorithmId = ea;
SelectedPrfAlgorithmId = pkcs5; SelectedPrfAlgorithmId = pkcs5;
CreateVolumeHeader (volumeSize, encryptedAreaStart, &password, ea, mode, pkcs5, pim); CreateVolumeHeader (volumeSize, encryptedAreaStart, &password, ea, mode, pkcs5, pim);
if (!rescueIsoImagePath.empty()) if (!rescueIsoImagePath.empty())
CreateRescueIsoImage (true, rescueIsoImagePath); CreateRescueIsoImage (true, rescueIsoImagePath);
} }
@@ -2705,7 +2705,7 @@ namespace VeraCrypt
BootEncryptionSetupRequest request; BootEncryptionSetupRequest request;
ZeroMemory (&request, sizeof (request)); ZeroMemory (&request, sizeof (request));
request.SetupMode = SetupDecryption; request.SetupMode = SetupDecryption;
request.DiscardUnreadableEncryptedSectors = discardUnreadableEncryptedSectors; request.DiscardUnreadableEncryptedSectors = discardUnreadableEncryptedSectors;
@@ -2721,7 +2721,7 @@ namespace VeraCrypt
BootEncryptionSetupRequest request; BootEncryptionSetupRequest request;
ZeroMemory (&request, sizeof (request)); ZeroMemory (&request, sizeof (request));
request.SetupMode = SetupEncryption; request.SetupMode = SetupEncryption;
request.WipeAlgorithm = wipeAlgorithm; request.WipeAlgorithm = wipeAlgorithm;
request.ZeroUnreadableSectors = zeroUnreadableSectors; request.ZeroUnreadableSectors = zeroUnreadableSectors;

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -15,7 +15,7 @@
#ifndef CACHE_SIZE #ifndef CACHE_SIZE
/* WARNING: Changing this value might not be safe (some items may be hard coded for 4)! Inspection necessary. */ /* WARNING: Changing this value might not be safe (some items may be hard coded for 4)! Inspection necessary. */
#define CACHE_SIZE 4 #define CACHE_SIZE 4
#endif #endif
extern int cacheEmpty; extern int cacheEmpty;

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -74,7 +74,7 @@ BOOL CALLBACK CommandHelpDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
StringCchCatW (tmp, 8192, L"\nExamples:\n\nMount a volume as X:\tveracrypt.exe /q /v volume.hc /l X\nDismount a volume X:\tveracrypt.exe /q /d X"); StringCchCatW (tmp, 8192, L"\nExamples:\n\nMount a volume as X:\tveracrypt.exe /q /v volume.hc /l X\nDismount a volume X:\tveracrypt.exe /q /d X");
SetWindowTextW (GetDlgItem (hwndDlg, IDC_COMMANDHELP_TEXT), tmp); SetWindowTextW (GetDlgItem (hwndDlg, IDC_COMMANDHELP_TEXT), tmp);
TCfree(tmp); TCfree(tmp);
return 1; return 1;
} }

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -171,7 +171,7 @@ void LoadCombo (HWND hComboBox, BOOL bEnabled, BOOL bOnlyCheckModified, BOOL *pb
{ {
wchar_t szTmp[MAX_PATH] = { 0 }; wchar_t szTmp[MAX_PATH] = { 0 };
wchar_t wszVolume[MAX_PATH] = {0}; wchar_t wszVolume[MAX_PATH] = {0};
if (i < count) if (i < count)
{ {
if (SendMessage (hComboBox, CB_GETLBTEXTLEN, nComboIdx[i], 0) < ARRAYSIZE (szTmp)) if (SendMessage (hComboBox, CB_GETLBTEXTLEN, nComboIdx[i], 0) < ARRAYSIZE (szTmp))
@@ -225,7 +225,7 @@ void DumpCombo (HWND hComboBox, int bClear)
for (i = 0; i < SIZEOF_MRU_LIST; i++) for (i = 0; i < SIZEOF_MRU_LIST; i++)
{ {
wchar_t szTmp[MAX_PATH] = { 0 }; wchar_t szTmp[MAX_PATH] = { 0 };
if (SendMessage (hComboBox, CB_GETLBTEXTLEN, nComboIdx[i], 0) < ARRAYSIZE (szTmp)) if (SendMessage (hComboBox, CB_GETLBTEXTLEN, nComboIdx[i], 0) < ARRAYSIZE (szTmp))
SendMessage (hComboBox, CB_GETLBTEXT, nComboIdx[i], (LPARAM) & szTmp[0]); SendMessage (hComboBox, CB_GETLBTEXT, nComboIdx[i], (LPARAM) & szTmp[0]);

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -337,7 +337,7 @@ END
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO GUIDELINES DESIGNINFO
BEGIN BEGIN
IDD_ABOUT_DLG, DIALOG IDD_ABOUT_DLG, DIALOG
BEGIN BEGIN
@@ -547,18 +547,18 @@ IDR_LICENSE TEXT "..\\Resources\\Texts\\License.r
// TEXTINCLUDE // TEXTINCLUDE
// //
1 TEXTINCLUDE 1 TEXTINCLUDE
BEGIN BEGIN
"resource.h\0" "resource.h\0"
END END
2 TEXTINCLUDE 2 TEXTINCLUDE
BEGIN BEGIN
"#include ""afxres.h""\r\n" "#include ""afxres.h""\r\n"
"\0" "\0"
END END
3 TEXTINCLUDE 3 TEXTINCLUDE
BEGIN BEGIN
"\r\n" "\r\n"
"\0" "\0"

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -19,7 +19,7 @@
/* CRC polynomial 0x04c11db7 */ /* CRC polynomial 0x04c11db7 */
unsigned __int32 crc_32_tab[]= unsigned __int32 crc_32_tab[]=
{ {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -129,7 +129,7 @@ int CipherInit (int cipher, unsigned char *key, unsigned __int8 *ks)
case SERPENT: case SERPENT:
serpent_set_key (key, ks); serpent_set_key (key, ks);
break; break;
case TWOFISH: case TWOFISH:
twofish_set_key ((TwofishInstance *)ks, (const u4byte *)key); twofish_set_key ((TwofishInstance *)ks, (const u4byte *)key);
break; break;
@@ -146,7 +146,7 @@ void EncipherBlock(int cipher, void *data, void *ks)
{ {
switch (cipher) switch (cipher)
{ {
case AES: case AES:
// In 32-bit kernel mode, due to KeSaveFloatingPointState() overhead, AES instructions can be used only when processing the whole data unit. // In 32-bit kernel mode, due to KeSaveFloatingPointState() overhead, AES instructions can be used only when processing the whole data unit.
#if (defined (_WIN64) || !defined (TC_WINDOWS_DRIVER)) && !defined (TC_WINDOWS_BOOT) #if (defined (_WIN64) || !defined (TC_WINDOWS_DRIVER)) && !defined (TC_WINDOWS_BOOT)
if (IsAesHwCpuSupported()) if (IsAesHwCpuSupported())
@@ -399,11 +399,11 @@ BOOL EAInitMode (PCRYPTO_INFO ci)
/* Note: XTS mode could potentially be initialized with a weak key causing all blocks in one data unit /* Note: XTS mode could potentially be initialized with a weak key causing all blocks in one data unit
on the volume to be tweaked with zero tweaks (i.e. 512 bytes of the volume would be encrypted in ECB on the volume to be tweaked with zero tweaks (i.e. 512 bytes of the volume would be encrypted in ECB
mode). However, to create a TrueCrypt volume with such a weak key, each human being on Earth would have mode). However, to create a TrueCrypt volume with such a weak key, each human being on Earth would have
to create approximately 11,378,125,361,078,862 (about eleven quadrillion) TrueCrypt volumes (provided to create approximately 11,378,125,361,078,862 (about eleven quadrillion) TrueCrypt volumes (provided
that the size of each of the volumes is 1024 terabytes). */ that the size of each of the volumes is 1024 terabytes). */
break; break;
default: default:
// Unknown/wrong ID // Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
} }
@@ -488,7 +488,7 @@ int EAGetNextMode (int ea, int previousModeId)
int c, i = 0; int c, i = 0;
while (c = EncryptionAlgorithms[ea].Modes[i++]) while (c = EncryptionAlgorithms[ea].Modes[i++])
{ {
if (c == previousModeId) if (c == previousModeId)
return EncryptionAlgorithms[ea].Modes[i]; return EncryptionAlgorithms[ea].Modes[i];
} }
@@ -591,7 +591,7 @@ int EAGetNextCipher (int ea, int previousCipherId)
int c, i = 0; int c, i = 0;
while (c = EncryptionAlgorithms[ea].Ciphers[i++]) while (c = EncryptionAlgorithms[ea].Ciphers[i++])
{ {
if (c == previousCipherId) if (c == previousCipherId)
return EncryptionAlgorithms[ea].Ciphers[i]; return EncryptionAlgorithms[ea].Ciphers[i];
} }
@@ -608,7 +608,7 @@ int EAGetPreviousCipher (int ea, int previousCipherId)
while (c = EncryptionAlgorithms[ea].Ciphers[i++]) while (c = EncryptionAlgorithms[ea].Ciphers[i++])
{ {
if (c == previousCipherId) if (c == previousCipherId)
return EncryptionAlgorithms[ea].Ciphers[i - 2]; return EncryptionAlgorithms[ea].Ciphers[i - 2];
} }
@@ -777,7 +777,7 @@ void crypto_close (PCRYPTO_INFO cryptoInfo)
// EncryptBuffer // EncryptBuffer
// //
// buf: data to be encrypted; the start of the buffer is assumed to be aligned with the start of a data unit. // buf: data to be encrypted; the start of the buffer is assumed to be aligned with the start of a data unit.
// len: number of bytes to encrypt; must be divisible by the block size (for cascaded ciphers, divisible // len: number of bytes to encrypt; must be divisible by the block size (for cascaded ciphers, divisible
// by the largest block size used within the cascade) // by the largest block size used within the cascade)
void EncryptBuffer (unsigned __int8 *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_INFO cryptoInfo) void EncryptBuffer (unsigned __int8 *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_INFO cryptoInfo)
{ {
@@ -808,7 +808,7 @@ void EncryptBuffer (unsigned __int8 *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_
} }
break; break;
default: default:
// Unknown/wrong ID // Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
} }
@@ -850,7 +850,7 @@ void EncryptDataUnitsCurrentThread (unsigned __int8 *buf, const UINT64_STRUCT *s
} }
break; break;
default: default:
// Unknown/wrong ID // Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
} }
@@ -859,7 +859,7 @@ void EncryptDataUnitsCurrentThread (unsigned __int8 *buf, const UINT64_STRUCT *s
// DecryptBuffer // DecryptBuffer
// //
// buf: data to be decrypted; the start of the buffer is assumed to be aligned with the start of a data unit. // buf: data to be decrypted; the start of the buffer is assumed to be aligned with the start of a data unit.
// len: number of bytes to decrypt; must be divisible by the block size (for cascaded ciphers, divisible // len: number of bytes to decrypt; must be divisible by the block size (for cascaded ciphers, divisible
// by the largest block size used within the cascade) // by the largest block size used within the cascade)
void DecryptBuffer (unsigned __int8 *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_INFO cryptoInfo) void DecryptBuffer (unsigned __int8 *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_INFO cryptoInfo)
{ {
@@ -890,7 +890,7 @@ void DecryptBuffer (unsigned __int8 *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_
} }
break; break;
default: default:
// Unknown/wrong ID // Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
} }
@@ -935,7 +935,7 @@ void DecryptDataUnitsCurrentThread (unsigned __int8 *buf, const UINT64_STRUCT *s
} }
break; break;
default: default:
// Unknown/wrong ID // Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
} }
@@ -955,7 +955,7 @@ void EncipherBlock(int cipher, void *data, void *ks)
if (IsAesHwCpuSupported()) if (IsAesHwCpuSupported())
aes_hw_cpu_encrypt ((byte *) ks, data); aes_hw_cpu_encrypt ((byte *) ks, data);
else else
aes_encrypt (data, data, ks); aes_encrypt (data, data, ks);
#elif defined (TC_WINDOWS_BOOT_SERPENT) #elif defined (TC_WINDOWS_BOOT_SERPENT)
serpent_encrypt (data, data, ks); serpent_encrypt (data, data, ks);
#elif defined (TC_WINDOWS_BOOT_TWOFISH) #elif defined (TC_WINDOWS_BOOT_TWOFISH)
@@ -969,7 +969,7 @@ void DecipherBlock(int cipher, void *data, void *ks)
if (IsAesHwCpuSupported()) if (IsAesHwCpuSupported())
aes_hw_cpu_decrypt ((byte *) ks + sizeof (aes_encrypt_ctx) + 14 * 16, data); aes_hw_cpu_decrypt ((byte *) ks + sizeof (aes_encrypt_ctx) + 14 * 16, data);
else else
aes_decrypt (data, data, (aes_decrypt_ctx *) ((byte *) ks + sizeof(aes_encrypt_ctx))); aes_decrypt (data, data, (aes_decrypt_ctx *) ((byte *) ks + sizeof(aes_encrypt_ctx)));
#elif defined (TC_WINDOWS_BOOT_SERPENT) #elif defined (TC_WINDOWS_BOOT_SERPENT)
serpent_decrypt (data, data, ks); serpent_decrypt (data, data, ks);
#elif defined (TC_WINDOWS_BOOT_TWOFISH) #elif defined (TC_WINDOWS_BOOT_TWOFISH)

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -45,9 +45,9 @@ extern "C" {
#define MASTER_KEYDATA_SIZE 256 #define MASTER_KEYDATA_SIZE 256
// The first PRF to try when mounting // The first PRF to try when mounting
#define FIRST_PRF_ID 1 #define FIRST_PRF_ID 1
// Hash algorithms (pseudorandom functions). // Hash algorithms (pseudorandom functions).
enum enum
{ {
SHA512 = FIRST_PRF_ID, SHA512 = FIRST_PRF_ID,
@@ -58,7 +58,7 @@ enum
}; };
// The last PRF to try when mounting and also the number of implemented PRFs // The last PRF to try when mounting and also the number of implemented PRFs
#define LAST_PRF_ID (HASH_ENUM_END_ID - 1) #define LAST_PRF_ID (HASH_ENUM_END_ID - 1)
#define RIPEMD160_BLOCKSIZE 64 #define RIPEMD160_BLOCKSIZE 64
#define RIPEMD160_DIGESTSIZE 20 #define RIPEMD160_DIGESTSIZE 20
@@ -105,7 +105,7 @@ enum
{ {
NONE = 0, NONE = 0,
AES, AES,
SERPENT, SERPENT,
TWOFISH TWOFISH
}; };
@@ -221,12 +221,12 @@ typedef struct CRYPTO_INFO_t
#ifndef TC_WINDOWS_BOOT #ifndef TC_WINDOWS_BOOT
uint16 HeaderVersion; uint16 HeaderVersion;
GfCtx gf_ctx; GfCtx gf_ctx;
unsigned __int8 master_keydata[MASTER_KEYDATA_SIZE]; /* This holds the volume header area containing concatenated master key(s) and secondary key(s) (XTS mode). For LRW (deprecated/legacy), it contains the tweak key before the master key(s). For CBC (deprecated/legacy), it contains the IV seed before the master key(s). */ unsigned __int8 master_keydata[MASTER_KEYDATA_SIZE]; /* This holds the volume header area containing concatenated master key(s) and secondary key(s) (XTS mode). For LRW (deprecated/legacy), it contains the tweak key before the master key(s). For CBC (deprecated/legacy), it contains the IV seed before the master key(s). */
unsigned __int8 k2[MASTER_KEYDATA_SIZE]; /* For XTS, this contains the secondary key (if cascade, multiple concatenated). For LRW (deprecated/legacy), it contains the tweak key. For CBC (deprecated/legacy), it contains the IV seed. */ unsigned __int8 k2[MASTER_KEYDATA_SIZE]; /* For XTS, this contains the secondary key (if cascade, multiple concatenated). For LRW (deprecated/legacy), it contains the tweak key. For CBC (deprecated/legacy), it contains the IV seed. */
unsigned __int8 salt[PKCS5_SALT_SIZE]; unsigned __int8 salt[PKCS5_SALT_SIZE];
int noIterations; int noIterations;
BOOL bTrueCryptMode; BOOL bTrueCryptMode;
int volumePim; int volumePim;
@@ -235,7 +235,7 @@ typedef struct CRYPTO_INFO_t
BOOL bProtectHiddenVolume; // Indicates whether the volume contains a hidden volume to be protected against overwriting BOOL bProtectHiddenVolume; // Indicates whether the volume contains a hidden volume to be protected against overwriting
BOOL bHiddenVolProtectionAction; // TRUE if a write operation has been denied by the driver in order to prevent the hidden volume from being overwritten (set to FALSE upon volume mount). BOOL bHiddenVolProtectionAction; // TRUE if a write operation has been denied by the driver in order to prevent the hidden volume from being overwritten (set to FALSE upon volume mount).
uint64 volDataAreaOffset; // Absolute position, in bytes, of the first data sector of the volume. uint64 volDataAreaOffset; // Absolute position, in bytes, of the first data sector of the volume.
uint64 hiddenVolumeSize; // Size of the hidden volume excluding the header (in bytes). Set to 0 for standard volumes. uint64 hiddenVolumeSize; // Size of the hidden volume excluding the header (in bytes). Set to 0 for standard volumes.

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -41,7 +41,7 @@ void AddDictionaryEntry (char *key, int intKey, void *value)
void *GetDictionaryValue (const char *key) void *GetDictionaryValue (const char *key)
{ {
map <string, void *>::const_iterator i = StringKeyMap.find (key); map <string, void *>::const_iterator i = StringKeyMap.find (key);
if (i == StringKeyMap.end()) if (i == StringKeyMap.end())
return NULL; return NULL;

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -132,7 +132,7 @@ extern int CurrentOSServicePack;
extern BOOL RemoteSession; extern BOOL RemoteSession;
extern HANDLE hDriver; extern HANDLE hDriver;
extern HINSTANCE hInst; extern HINSTANCE hInst;
extern int SystemEncryptionStatus; extern int SystemEncryptionStatus;
extern WipeAlgorithmId nWipeMode; extern WipeAlgorithmId nWipeMode;
extern BOOL bSysPartitionSelected; extern BOOL bSysPartitionSelected;
extern BOOL bSysDriveSelected; extern BOOL bSysDriveSelected;
@@ -170,11 +170,11 @@ enum tc_app_msg_ids
TC_APPMSG_SYSENC_CONFIG_UPDATE = WM_APP + 101, TC_APPMSG_SYSENC_CONFIG_UPDATE = WM_APP + 101,
TC_APPMSG_TASKBAR_ICON = WM_APP + 102, TC_APPMSG_TASKBAR_ICON = WM_APP + 102,
TC_APPMSG_LOAD_TEXT_BOX_CONTENT = WM_APP + 103, TC_APPMSG_LOAD_TEXT_BOX_CONTENT = WM_APP + 103,
// Mount // Mount
TC_APPMSG_MOUNT_ENABLE_DISABLE_CONTROLS = WM_APP + 201, TC_APPMSG_MOUNT_ENABLE_DISABLE_CONTROLS = WM_APP + 201,
TC_APPMSG_MOUNT_SHOW_WINDOW = WM_APP + 202, TC_APPMSG_MOUNT_SHOW_WINDOW = WM_APP + 202,
TC_APPMSG_PREBOOT_PASSWORD_MODE = WM_APP + 203, TC_APPMSG_PREBOOT_PASSWORD_MODE = WM_APP + 203,
// Format // Format
TC_APPMSG_VOL_TRANSFORM_THREAD_ENDED = WM_APP + 301, TC_APPMSG_VOL_TRANSFORM_THREAD_ENDED = WM_APP + 301,
TC_APPMSG_FORMAT_FINISHED = WM_APP + 302, TC_APPMSG_FORMAT_FINISHED = WM_APP + 302,
TC_APPMSG_FORMAT_USER_QUIT = WM_APP + 303, TC_APPMSG_FORMAT_USER_QUIT = WM_APP + 303,

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -182,13 +182,13 @@ static TC_THREAD_PROC EncryptionThreadProc (void *threadArg)
workItem->KeyDerivation.IterationCount, workItem->KeyDerivation.DerivedKey, GetMaxPkcs5OutSize()); workItem->KeyDerivation.IterationCount, workItem->KeyDerivation.DerivedKey, GetMaxPkcs5OutSize());
break; break;
default: default:
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
} }
InterlockedExchange (workItem->KeyDerivation.CompletionFlag, TRUE); InterlockedExchange (workItem->KeyDerivation.CompletionFlag, TRUE);
TC_SET_EVENT (*workItem->KeyDerivation.CompletionEvent); TC_SET_EVENT (*workItem->KeyDerivation.CompletionEvent);
if (InterlockedDecrement (workItem->KeyDerivation.OutstandingWorkItemCount) == 0) if (InterlockedDecrement (workItem->KeyDerivation.OutstandingWorkItemCount) == 0)
TC_SET_EVENT (*workItem->KeyDerivation.NoOutstandingWorkItemEvent); TC_SET_EVENT (*workItem->KeyDerivation.NoOutstandingWorkItemEvent);
@@ -256,12 +256,12 @@ BOOL EncryptionThreadPoolStart (size_t encryptionFreeCpuCount)
WorkItemReadyEvent = CreateEvent (NULL, FALSE, FALSE, NULL); WorkItemReadyEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
if (!WorkItemReadyEvent) if (!WorkItemReadyEvent)
return FALSE; return FALSE;
WorkItemCompletedEvent = CreateEvent (NULL, FALSE, FALSE, NULL); WorkItemCompletedEvent = CreateEvent (NULL, FALSE, FALSE, NULL);
if (!WorkItemCompletedEvent) if (!WorkItemCompletedEvent)
return FALSE; return FALSE;
#endif #endif
#ifdef DEVICE_DRIVER #ifdef DEVICE_DRIVER
ExInitializeFastMutex (&DequeueMutex); ExInitializeFastMutex (&DequeueMutex);
ExInitializeFastMutex (&EnqueueMutex); ExInitializeFastMutex (&EnqueueMutex);
@@ -400,10 +400,10 @@ void EncryptionThreadPoolDoWork (EncryptionThreadPoolWorkType type, byte *data,
EncryptionThreadPoolWorkItem *workItem; EncryptionThreadPoolWorkItem *workItem;
EncryptionThreadPoolWorkItem *firstFragmentWorkItem; EncryptionThreadPoolWorkItem *firstFragmentWorkItem;
if (unitCount == 0) if (unitCount == 0)
return; return;
if (!ThreadPoolRunning || unitCount == 1) if (!ThreadPoolRunning || unitCount == 1)
{ {
switch (type) switch (type)
@@ -432,7 +432,7 @@ void EncryptionThreadPoolDoWork (EncryptionThreadPoolWorkType type, byte *data,
else else
{ {
/* Note that it is not efficient to divide the data into fragments smaller than a few hundred bytes. /* Note that it is not efficient to divide the data into fragments smaller than a few hundred bytes.
The reason is that the overhead associated with thread handling would in most cases make a multi-threaded The reason is that the overhead associated with thread handling would in most cases make a multi-threaded
process actually slower than a single-threaded process. */ process actually slower than a single-threaded process. */
fragmentCount = ThreadCount; fragmentCount = ThreadCount;
@@ -442,7 +442,7 @@ void EncryptionThreadPoolDoWork (EncryptionThreadPoolWorkType type, byte *data,
if (remainder > 0) if (remainder > 0)
++unitsPerFragment; ++unitsPerFragment;
} }
fragmentData = data; fragmentData = data;
fragmentStartUnitNo = startUnitNo->Value; fragmentStartUnitNo = startUnitNo->Value;

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -110,7 +110,7 @@ extern "C"
( ( unsigned __int32 ) memPtr[ -2 ] << 8 ) | ( unsigned __int32 ) memPtr[ -1 ] ) ( ( unsigned __int32 ) memPtr[ -2 ] << 8 ) | ( unsigned __int32 ) memPtr[ -1 ] )
#define mgetWord(memPtr) \ #define mgetWord(memPtr) \
( memPtr += 2, ((( unsigned short ) memPtr[ -2 ] << 8 ) | ( ( unsigned short ) memPtr[ -1 ] )) ) ( memPtr += 2, ((( unsigned short ) memPtr[ -2 ] << 8 ) | ( ( unsigned short ) memPtr[ -1 ] )) )
#define mgetByte(memPtr) \ #define mgetByte(memPtr) \
( ( unsigned char ) *memPtr++ ) ( ( unsigned char ) *memPtr++ )
@@ -139,7 +139,7 @@ unsigned __int16 MirrorBytes16 (unsigned __int16 x);
unsigned __int32 MirrorBytes32 (unsigned __int32 x); unsigned __int32 MirrorBytes32 (unsigned __int32 x);
#ifndef TC_NO_COMPILER_INT64 #ifndef TC_NO_COMPILER_INT64
uint64 MirrorBytes64 (uint64 x); uint64 MirrorBytes64 (uint64 x);
#endif #endif
void LongReverse ( unsigned __int32 *buffer , unsigned byteCount ); void LongReverse ( unsigned __int32 *buffer , unsigned byteCount );
#if defined(__cplusplus) #if defined(__cplusplus)

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -58,7 +58,7 @@ GetFatParams (fatparams * ft)
clusterSize = 512; clusterSize = 512;
ft->cluster_size = clusterSize / ft->sector_size; ft->cluster_size = clusterSize / ft->sector_size;
if (ft->cluster_size == 0) if (ft->cluster_size == 0)
ft->cluster_size = 1; ft->cluster_size = 1;
@@ -73,8 +73,8 @@ GetFatParams (fatparams * ft)
ft->cluster_size = 1; ft->cluster_size = 1;
// Geometry always set to SECTORS/1/1 // Geometry always set to SECTORS/1/1
ft->secs_track = 1; ft->secs_track = 1;
ft->heads = 1; ft->heads = 1;
ft->dir_entries = 512; ft->dir_entries = 512;
ft->fats = 2; ft->fats = 2;
@@ -98,7 +98,7 @@ GetFatParams (fatparams * ft)
ft->cluster_count = (int) (((__int64) fatsecs * ft->sector_size) / (ft->cluster_size * ft->sector_size)); ft->cluster_count = (int) (((__int64) fatsecs * ft->sector_size) / (ft->cluster_size * ft->sector_size));
ft->fat_length = (ft->cluster_count * 2 + ft->sector_size - 1) / ft->sector_size; ft->fat_length = (ft->cluster_count * 2 + ft->sector_size - 1) / ft->sector_size;
} }
if(ft->cluster_count >= 65525) // FAT32 if(ft->cluster_count >= 65525) // FAT32
{ {
ft->size_fat = 32; ft->size_fat = 32;
@@ -165,13 +165,13 @@ PutBoot (fatparams * ft, unsigned char *boot)
cnt += 2; cnt += 2;
boot[cnt++] = (__int8) ft->media; /* media byte */ boot[cnt++] = (__int8) ft->media; /* media byte */
if(ft->size_fat == 32) if(ft->size_fat == 32)
{ {
boot[cnt++] = 0x00; boot[cnt++] = 0x00;
boot[cnt++] = 0x00; boot[cnt++] = 0x00;
} }
else else
{ {
*(__int16 *)(boot + cnt) = LE16((uint16) ft->fat_length); /* fat size */ *(__int16 *)(boot + cnt) = LE16((uint16) ft->fat_length); /* fat size */
cnt += 2; cnt += 2;
} }
@@ -233,13 +233,13 @@ static void PutFSInfo (unsigned char *sector, fatparams *ft)
{ {
memset (sector, 0, ft->sector_size); memset (sector, 0, ft->sector_size);
sector[3]=0x41; /* LeadSig */ sector[3]=0x41; /* LeadSig */
sector[2]=0x61; sector[2]=0x61;
sector[1]=0x52; sector[1]=0x52;
sector[0]=0x52; sector[0]=0x52;
sector[484+3]=0x61; /* StrucSig */ sector[484+3]=0x61; /* StrucSig */
sector[484+2]=0x41; sector[484+2]=0x41;
sector[484+1]=0x72; sector[484+1]=0x72;
sector[484+0]=0x72; sector[484+0]=0x72;
// Free cluster count // Free cluster count
*(uint32 *)(sector + 488) = LE32 (ft->cluster_count - ft->size_root_dir / ft->sector_size / ft->cluster_size); *(uint32 *)(sector + 488) = LE32 (ft->cluster_count - ft->size_root_dir / ft->sector_size / ft->cluster_size);
@@ -293,7 +293,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
goto fail; goto fail;
/* fat32 boot area */ /* fat32 boot area */
if (ft->size_fat == 32) if (ft->size_fat == 32)
{ {
/* fsinfo */ /* fsinfo */
PutFSInfo((unsigned char *) sector, ft); PutFSInfo((unsigned char *) sector, ft);
@@ -311,7 +311,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
cryptoInfo) == FALSE) cryptoInfo) == FALSE)
goto fail; goto fail;
} }
/* bootsector backup */ /* bootsector backup */
memset (sector, 0, ft->sector_size); memset (sector, 0, ft->sector_size);
PutBoot (ft, (unsigned char *) sector); PutBoot (ft, (unsigned char *) sector);
@@ -354,7 +354,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
fat_sig[8] = fat_sig[9] = fat_sig[10] = 0xff; fat_sig[8] = fat_sig[9] = fat_sig[10] = 0xff;
fat_sig[11] = 0x0f; fat_sig[11] = 0x0f;
memcpy (sector, fat_sig, 12); memcpy (sector, fat_sig, 12);
} }
else if (ft->size_fat == 16) else if (ft->size_fat == 16)
{ {
fat_sig[0] = (unsigned char) ft->media; fat_sig[0] = (unsigned char) ft->media;
@@ -407,7 +407,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void
goto fail; goto fail;
// Temporary secondary key (XTS mode) // Temporary secondary key (XTS mode)
if (!RandgetBytes (hwndDlg, cryptoInfo->k2, sizeof cryptoInfo->k2, FALSE)) if (!RandgetBytes (hwndDlg, cryptoInfo->k2, sizeof cryptoInfo->k2, FALSE))
goto fail; goto fail;
retVal = EAInit (cryptoInfo->ea, temporaryKey, cryptoInfo->ks); retVal = EAInit (cryptoInfo->ea, temporaryKey, cryptoInfo->ks);

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -60,7 +60,7 @@ uint64 GetVolumeDataAreaSize (BOOL hiddenVolume, uint64 volumeSize)
#if TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE_HIGH < TC_MAX_VOLUME_SECTOR_SIZE #if TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE_HIGH < TC_MAX_VOLUME_SECTOR_SIZE
# error TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE_HIGH too small. # error TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE_HIGH too small.
#endif #endif
if (volumeSize < TC_VOLUME_SMALL_SIZE_THRESHOLD) if (volumeSize < TC_VOLUME_SMALL_SIZE_THRESHOLD)
reservedSize = TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE; reservedSize = TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE;
else else
@@ -108,16 +108,16 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams)
|| FormatSectorSize % ENCRYPTION_DATA_UNIT_SIZE != 0) || FormatSectorSize % ENCRYPTION_DATA_UNIT_SIZE != 0)
{ {
Error ("SECTOR_SIZE_UNSUPPORTED", hwndDlg); Error ("SECTOR_SIZE_UNSUPPORTED", hwndDlg);
return ERR_DONT_REPORT; return ERR_DONT_REPORT;
} }
/* WARNING: Note that if Windows fails to format the volume as NTFS and the volume size is /* WARNING: Note that if Windows fails to format the volume as NTFS and the volume size is
less than the maximum FAT size, the user is asked within this function whether he wants to instantly less than the maximum FAT size, the user is asked within this function whether he wants to instantly
retry FAT format instead (to avoid having to re-create the whole container again). If the user retry FAT format instead (to avoid having to re-create the whole container again). If the user
answers yes, some of the input parameters are modified, the code below 'begin_format' is re-executed answers yes, some of the input parameters are modified, the code below 'begin_format' is re-executed
and some destructive operations that were performed during the first attempt must be (and are) skipped. and some destructive operations that were performed during the first attempt must be (and are) skipped.
Therefore, whenever adding or modifying any potentially destructive operations below 'begin_format', Therefore, whenever adding or modifying any potentially destructive operations below 'begin_format',
determine whether they (or their portions) need to be skipped during such a second attempt; if so, determine whether they (or their portions) need to be skipped during such a second attempt; if so,
use the 'bInstantRetryOtherFilesys' flag to skip them. */ use the 'bInstantRetryOtherFilesys' flag to skip them. */
if (volParams->hiddenVol) if (volParams->hiddenVol)
@@ -187,17 +187,17 @@ begin_format:
if ((dev = DismountDrive (devName, volParams->volumePath)) == INVALID_HANDLE_VALUE) if ((dev = DismountDrive (devName, volParams->volumePath)) == INVALID_HANDLE_VALUE)
{ {
Error ("FORMAT_CANT_DISMOUNT_FILESYS", hwndDlg); Error ("FORMAT_CANT_DISMOUNT_FILESYS", hwndDlg);
nStatus = ERR_DONT_REPORT; nStatus = ERR_DONT_REPORT;
goto error; goto error;
} }
/* Gain "raw" access to the partition (it contains a live filesystem and the filesystem driver /* Gain "raw" access to the partition (it contains a live filesystem and the filesystem driver
would otherwise prevent us from writing to hidden sectors). */ would otherwise prevent us from writing to hidden sectors). */
if (!DeviceIoControl (dev, if (!DeviceIoControl (dev,
FSCTL_ALLOW_EXTENDED_DASD_IO, FSCTL_ALLOW_EXTENDED_DASD_IO,
NULL, NULL,
0, 0,
NULL, NULL,
0, 0,
&dwResult, &dwResult,
@@ -208,7 +208,7 @@ begin_format:
} }
else if (IsOSAtLeast (WIN_VISTA) && driveLetter == -1) else if (IsOSAtLeast (WIN_VISTA) && driveLetter == -1)
{ {
// Windows Vista doesn't allow overwriting sectors belonging to an unformatted partition // Windows Vista doesn't allow overwriting sectors belonging to an unformatted partition
// to which no drive letter has been assigned under the system. This problem can be worked // to which no drive letter has been assigned under the system. This problem can be worked
// around by assigning a drive letter to the partition temporarily. // around by assigning a drive letter to the partition temporarily.
@@ -219,7 +219,7 @@ begin_format:
BOOL bResult = FALSE; BOOL bResult = FALSE;
tmpDriveLetter = GetFirstAvailableDrive (); tmpDriveLetter = GetFirstAvailableDrive ();
if (tmpDriveLetter != -1) if (tmpDriveLetter != -1)
{ {
rootPath[0] += (wchar_t) tmpDriveLetter; rootPath[0] += (wchar_t) tmpDriveLetter;
@@ -233,7 +233,7 @@ begin_format:
szDriveLetter, szDriveLetter,
volParams->volumePath); volParams->volumePath);
if (bResult if (bResult
&& SetVolumeMountPoint (rootPath, uniqVolName)) && SetVolumeMountPoint (rootPath, uniqVolName))
{ {
// The drive letter can be removed now // The drive letter can be removed now
@@ -245,21 +245,21 @@ begin_format:
// For extra safety, we will try to gain "raw" access to the partition. Note that this should actually be // For extra safety, we will try to gain "raw" access to the partition. Note that this should actually be
// redundant because if the filesystem was mounted, we already tried to obtain DASD above. If we failed, // redundant because if the filesystem was mounted, we already tried to obtain DASD above. If we failed,
// bFailedRequiredDASD was set to TRUE and therefore we will perform pseudo "quick format" below. However, // bFailedRequiredDASD was set to TRUE and therefore we will perform pseudo "quick format" below. However,
// for extra safety, in case IsDeviceMounted() failed to detect a live filesystem, we will blindly // for extra safety, in case IsDeviceMounted() failed to detect a live filesystem, we will blindly
// send FSCTL_ALLOW_EXTENDED_DASD_IO (possibly for a second time) without checking the result. // send FSCTL_ALLOW_EXTENDED_DASD_IO (possibly for a second time) without checking the result.
DeviceIoControl (dev, DeviceIoControl (dev,
FSCTL_ALLOW_EXTENDED_DASD_IO, FSCTL_ALLOW_EXTENDED_DASD_IO,
NULL, NULL,
0, 0,
NULL, NULL,
0, 0,
&dwResult, &dwResult,
NULL); NULL);
// If DASD is needed but we failed to obtain it, perform open - 'quick format' - close - open // If DASD is needed but we failed to obtain it, perform open - 'quick format' - close - open
// so that the filesystem driver does not prevent us from formatting hidden sectors. // so that the filesystem driver does not prevent us from formatting hidden sectors.
for (nPass = (bFailedRequiredDASD ? 0 : 1); nPass < 2; nPass++) for (nPass = (bFailedRequiredDASD ? 0 : 1); nPass < 2; nPass++)
{ {
@@ -285,7 +285,7 @@ begin_format:
{ {
if (!volParams->bForceOperation && (Silent || (IDNO == MessageBoxW (volParams->hwndDlg, GetString ("DEVICE_IN_USE_FORMAT"), lpszTitle, MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2)))) if (!volParams->bForceOperation && (Silent || (IDNO == MessageBoxW (volParams->hwndDlg, GetString ("DEVICE_IN_USE_FORMAT"), lpszTitle, MB_YESNO|MB_ICONWARNING|MB_DEFBUTTON2))))
{ {
nStatus = ERR_DONT_REPORT; nStatus = ERR_DONT_REPORT;
goto error; goto error;
} }
} }
@@ -293,7 +293,7 @@ begin_format:
{ {
handleWin32Error (volParams->hwndDlg, SRC_POS); handleWin32Error (volParams->hwndDlg, SRC_POS);
Error ("CANT_ACCESS_VOL", hwndDlg); Error ("CANT_ACCESS_VOL", hwndDlg);
nStatus = ERR_DONT_REPORT; nStatus = ERR_DONT_REPORT;
goto error; goto error;
} }
} }
@@ -306,13 +306,13 @@ begin_format:
char buf [2 * TC_MAX_VOLUME_SECTOR_SIZE]; char buf [2 * TC_MAX_VOLUME_SECTOR_SIZE];
DWORD bw; DWORD bw;
// Perform pseudo "quick format" so that the filesystem driver does not prevent us from // Perform pseudo "quick format" so that the filesystem driver does not prevent us from
// formatting hidden sectors // formatting hidden sectors
memset (buf, 0, sizeof (buf)); memset (buf, 0, sizeof (buf));
if (!WriteFile (dev, buf, sizeof (buf), &bw, NULL)) if (!WriteFile (dev, buf, sizeof (buf), &bw, NULL))
{ {
nStatus = ERR_OS_ERROR; nStatus = ERR_OS_ERROR;
goto error; goto error;
} }
@@ -325,7 +325,7 @@ begin_format:
if (DeviceIoControl (dev, FSCTL_IS_VOLUME_MOUNTED, NULL, 0, NULL, 0, &dwResult, NULL)) if (DeviceIoControl (dev, FSCTL_IS_VOLUME_MOUNTED, NULL, 0, NULL, 0, &dwResult, NULL))
{ {
Error ("FORMAT_CANT_DISMOUNT_FILESYS", hwndDlg); Error ("FORMAT_CANT_DISMOUNT_FILESYS", hwndDlg);
nStatus = ERR_DONT_REPORT; nStatus = ERR_DONT_REPORT;
goto error; goto error;
} }
} }
@@ -339,7 +339,7 @@ begin_format:
if (dev == INVALID_HANDLE_VALUE) if (dev == INVALID_HANDLE_VALUE)
{ {
nStatus = ERR_OS_ERROR; nStatus = ERR_OS_ERROR;
goto error; goto error;
} }
@@ -356,7 +356,7 @@ begin_format:
DWORD tmp; DWORD tmp;
if (!DeviceIoControl (dev, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &tmp, NULL)) if (!DeviceIoControl (dev, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &tmp, NULL))
{ {
nStatus = ERR_OS_ERROR; nStatus = ERR_OS_ERROR;
goto error; goto error;
} }
} }
@@ -391,13 +391,13 @@ begin_format:
// Check hidden volume size // Check hidden volume size
if (volParams->hiddenVolHostSize < TC_MIN_HIDDEN_VOLUME_HOST_SIZE || volParams->hiddenVolHostSize > TC_MAX_HIDDEN_VOLUME_HOST_SIZE) if (volParams->hiddenVolHostSize < TC_MIN_HIDDEN_VOLUME_HOST_SIZE || volParams->hiddenVolHostSize > TC_MAX_HIDDEN_VOLUME_HOST_SIZE)
{ {
nStatus = ERR_VOL_SIZE_WRONG; nStatus = ERR_VOL_SIZE_WRONG;
goto error; goto error;
} }
// Seek to hidden volume header location // Seek to hidden volume header location
headerOffset.QuadPart = TC_HIDDEN_VOLUME_HEADER_OFFSET; headerOffset.QuadPart = TC_HIDDEN_VOLUME_HEADER_OFFSET;
if (!SetFilePointerEx ((HANDLE) dev, headerOffset, NULL, FILE_BEGIN)) if (!SetFilePointerEx ((HANDLE) dev, headerOffset, NULL, FILE_BEGIN))
@@ -458,7 +458,7 @@ begin_format:
// Validate the offset // Validate the offset
if (dataOffset % FormatSectorSize != 0) if (dataOffset % FormatSectorSize != 0)
{ {
nStatus = ERR_VOL_SIZE_WRONG; nStatus = ERR_VOL_SIZE_WRONG;
goto error; goto error;
} }
@@ -478,7 +478,7 @@ begin_format:
if (volParams->bDevice && !StartFormatWriteThread()) if (volParams->bDevice && !StartFormatWriteThread())
{ {
nStatus = ERR_OS_ERROR; nStatus = ERR_OS_ERROR;
goto error; goto error;
} }
@@ -488,11 +488,11 @@ begin_format:
StopFormatWriteThread(); StopFormatWriteThread();
break; break;
case FILESYS_FAT: case FILESYS_FAT:
if (num_sectors > 0xFFFFffff) if (num_sectors > 0xFFFFffff)
{ {
nStatus = ERR_VOL_SIZE_WRONG; nStatus = ERR_VOL_SIZE_WRONG;
goto error; goto error;
} }
@@ -506,12 +506,12 @@ begin_format:
ft.sector_size = (uint16) FormatSectorSize; ft.sector_size = (uint16) FormatSectorSize;
ft.cluster_size = volParams->clusterSize; ft.cluster_size = volParams->clusterSize;
memcpy (ft.volume_name, "NO NAME ", 11); memcpy (ft.volume_name, "NO NAME ", 11);
GetFatParams (&ft); GetFatParams (&ft);
*(volParams->realClusterSize) = ft.cluster_size * FormatSectorSize; *(volParams->realClusterSize) = ft.cluster_size * FormatSectorSize;
if (volParams->bDevice && !StartFormatWriteThread()) if (volParams->bDevice && !StartFormatWriteThread())
{ {
nStatus = ERR_OS_ERROR; nStatus = ERR_OS_ERROR;
goto error; goto error;
} }
@@ -523,7 +523,7 @@ begin_format:
break; break;
default: default:
nStatus = ERR_PARAMETER_INCORRECT; nStatus = ERR_PARAMETER_INCORRECT;
goto error; goto error;
} }
@@ -883,14 +883,14 @@ BOOL FormatFs (int driveNo, int clusterSize, int fsType)
return FALSE; return FALSE;
} }
if (GetSystemDirectory (dllPath, MAX_PATH)) if (GetSystemDirectory (dllPath, MAX_PATH))
{ {
StringCchCatW(dllPath, ARRAYSIZE(dllPath), L"\\fmifs.dll"); StringCchCatW(dllPath, ARRAYSIZE(dllPath), L"\\fmifs.dll");
} }
else else
StringCchCopyW(dllPath, ARRAYSIZE(dllPath), L"C:\\Windows\\System32\\fmifs.dll"); StringCchCopyW(dllPath, ARRAYSIZE(dllPath), L"C:\\Windows\\System32\\fmifs.dll");
hModule = LoadLibrary (dllPath); hModule = LoadLibrary (dllPath);
if (hModule == NULL) if (hModule == NULL)
@@ -905,7 +905,7 @@ BOOL FormatFs (int driveNo, int clusterSize, int fsType)
StringCchCatW (dir, ARRAYSIZE(dir), L":\\"); StringCchCatW (dir, ARRAYSIZE(dir), L":\\");
FormatExError = TRUE; FormatExError = TRUE;
// Windows sometimes fails to format a volume (hosted on a removable medium) as NTFS. // Windows sometimes fails to format a volume (hosted on a removable medium) as NTFS.
// It often helps to retry several times. // It often helps to retry several times.
for (i = 0; i < 50 && FormatExError; i++) for (i = 0; i < 50 && FormatExError; i++)
@@ -939,7 +939,7 @@ BOOL WriteSector (void *dev, char *sector,
if (*write_buf_cnt == FormatWriteBufferSize && !FlushFormatWriteBuffer (dev, write_buf, write_buf_cnt, nSecNo, cryptoInfo)) if (*write_buf_cnt == FormatWriteBufferSize && !FlushFormatWriteBuffer (dev, write_buf, write_buf_cnt, nSecNo, cryptoInfo))
return FALSE; return FALSE;
if (GetTickCount () - updateTime > 25) if (GetTickCount () - updateTime > 25)
{ {
if (UpdateProgressBar (*nSecNo * FormatSectorSize)) if (UpdateProgressBar (*nSecNo * FormatSectorSize))
@@ -962,7 +962,7 @@ static HANDLE WriteBufferEmptyEvent;
static HANDLE WriteBufferFullEvent; static HANDLE WriteBufferFullEvent;
static volatile HANDLE WriteRequestHandle; static volatile HANDLE WriteRequestHandle;
static volatile int WriteRequestSize; static volatile int WriteRequestSize;
static volatile DWORD WriteRequestResult; static volatile DWORD WriteRequestResult;
@@ -985,7 +985,7 @@ static void __cdecl FormatWriteThreadProc (void *arg)
if (!WriteFile (WriteRequestHandle, WriteThreadBuffer, WriteRequestSize, &bytesWritten, NULL)) if (!WriteFile (WriteRequestHandle, WriteThreadBuffer, WriteRequestSize, &bytesWritten, NULL))
WriteRequestResult = GetLastError(); WriteRequestResult = GetLastError();
else else
WriteRequestResult = ERROR_SUCCESS; WriteRequestResult = ERROR_SUCCESS;
if (!SetEvent (WriteBufferEmptyEvent)) if (!SetEvent (WriteBufferEmptyEvent))
@@ -1082,7 +1082,7 @@ BOOL FlushFormatWriteBuffer (void *dev, char *write_buf, int *write_buf_cnt, __i
{ {
if (WaitForSingleObject (WriteBufferEmptyEvent, INFINITE) == WAIT_FAILED) if (WaitForSingleObject (WriteBufferEmptyEvent, INFINITE) == WAIT_FAILED)
return FALSE; return FALSE;
if (WriteRequestResult != ERROR_SUCCESS) if (WriteRequestResult != ERROR_SUCCESS)
{ {
SetEvent (WriteBufferEmptyEvent); SetEvent (WriteBufferEmptyEvent);

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -21,7 +21,7 @@ extern "C" {
#endif #endif
// FMIFS // FMIFS
typedef BOOLEAN (__stdcall *PFMIFSCALLBACK)( int command, DWORD subCommand, PVOID parameter ); 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 ); typedef VOID (__stdcall *PFORMATEX)( PWCHAR DriveRoot, DWORD MediaFlag, PWCHAR Format, PWCHAR Label, BOOL QuickFormat, DWORD ClusterSize, PFMIFSCALLBACK Callback );
typedef struct typedef struct

View File

@@ -24,11 +24,11 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Issue Date: 31/01/2004 Issue Date: 31/01/2004
My thanks to John Viega and David McGrew for their support in developing My thanks to John Viega and David McGrew for their support in developing
this code and to David for testing it on a big-endain system. this code and to David for testing it on a big-endain system.
*/ */
/* /*
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Portions Copyright (c) 2005 TrueCrypt Developers Association Portions Copyright (c) 2005 TrueCrypt Developers Association
@@ -630,9 +630,9 @@ int Gf128Tab64Init (unsigned __int8 *a, GfCtx *ctx)
compile_8k_table (am, ctx8k); compile_8k_table (am, ctx8k);
/* Convert 8k LSB-first table to 4k MSB-first */ /* Convert 8k LSB-first table to 4k MSB-first */
for (i = 16; i < 32; i++) for (i = 16; i < 32; i++)
{ {
for (j = 0; j < 16; j++) for (j = 0; j < 16; j++)
{ {
int jm = 0; int jm = 0;
jm |= (j & 0x1) << 3; jm |= (j & 0x1) << 3;
@@ -658,7 +658,7 @@ int Gf128Tab64Init (unsigned __int8 *a, GfCtx *ctx)
/* Multiply a 128-bit number by a 64-bit number in the finite field GF(2^128) */ /* Multiply a 128-bit number by a 64-bit number in the finite field GF(2^128) */
void Gf128MulBy64Tab (unsigned __int8 a[8], unsigned __int8 p[16], GfCtx *ctx) void Gf128MulBy64Tab (unsigned __int8 a[8], unsigned __int8 p[16], GfCtx *ctx)
{ {
unsigned __int32 r[CBLK_LEN >> 2]; unsigned __int32 r[CBLK_LEN >> 2];
move_block_aligned(r, ctx->gf_t128[7*2][a[7] & 15]); move_block_aligned(r, ctx->gf_t128[7*2][a[7] & 15]);
@@ -751,7 +751,7 @@ BOOL GfMulSelfTest ()
} }
GfMul128Basic (a, b, p1); GfMul128Basic (a, b, p1);
Gf128Tab64Init (a, gfCtx); Gf128Tab64Init (a, gfCtx);
Gf128MulBy64Tab (b + 8, p2, gfCtx); Gf128MulBy64Tab (b + 8, p2, gfCtx);

View File

@@ -1311,7 +1311,7 @@ int DecompressDeflatedData (char *out, char *in, int inLength)
G.incnt = inLength; G.incnt = inLength;
G.outCounter = 0; G.outCounter = 0;
if (inflate(__G) != 0) if (inflate(__G) != 0)
{ {
// Error decompressing // Error decompressing
return 0; return 0;

View File

@@ -10,17 +10,17 @@ typedef unsigned char uch;
typedef unsigned short ush; typedef unsigned short ush;
typedef void zvoid; typedef void zvoid;
typedef struct huft typedef struct huft
{ {
uch b, e; uch b, e;
union union
{ {
ush n; ush n;
struct huft *t; struct huft *t;
}v; }v;
}; };
typedef struct typedef struct
{ {
uch *inptr, *outbufptr; uch *inptr, *outbufptr;
int incnt; int incnt;

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -218,7 +218,7 @@ static BOOL KeyFileProcess (unsigned __int8 *keyPool, KeyFile *keyFile)
else if (totalRead == 0) else if (totalRead == 0)
{ {
status = FALSE; status = FALSE;
SetLastError (ERROR_HANDLE_EOF); SetLastError (ERROR_HANDLE_EOF);
} }
close: close:
@@ -275,7 +275,7 @@ BOOL KeyFilesApplyWithPin (HWND hwndDlg, Password *password, char* pin, KeyFile
if (keyfileData.empty()) if (keyfileData.empty())
{ {
SetLastError (ERROR_HANDLE_EOF); SetLastError (ERROR_HANDLE_EOF);
handleWin32Error (hwndDlg, SRC_POS); handleWin32Error (hwndDlg, SRC_POS);
Error ("ERR_PROCESS_KEYFILE", hwndDlg); Error ("ERR_PROCESS_KEYFILE", hwndDlg);
status = FALSE; status = FALSE;
@@ -342,7 +342,7 @@ BOOL KeyFilesApplyWithPin (HWND hwndDlg, Password *password, char* pin, KeyFile
StringCbPrintfW (kfSub->FileName, sizeof(kfSub->FileName), L"%s%c%s", kf->FileName, StringCbPrintfW (kfSub->FileName, sizeof(kfSub->FileName), L"%s%c%s", kf->FileName,
L'\\', L'\\',
fBuf.name fBuf.name
); );
// Determine whether it's a path or a file // Determine whether it's a path or a file
if (_wstat (kfSub->FileName, &statStruct) != 0) if (_wstat (kfSub->FileName, &statStruct) != 0)
@@ -355,7 +355,7 @@ BOOL KeyFilesApplyWithPin (HWND hwndDlg, Password *password, char* pin, KeyFile
else if (statStruct.st_mode & S_IFDIR) // If it's a directory else if (statStruct.st_mode & S_IFDIR) // If it's a directory
{ {
// Prevent recursive folder scanning // Prevent recursive folder scanning
continue; continue;
} }
// Skip hidden files // Skip hidden files
@@ -363,7 +363,7 @@ BOOL KeyFilesApplyWithPin (HWND hwndDlg, Password *password, char* pin, KeyFile
&& (fileAttributes.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0) && (fileAttributes.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0)
{ {
HiddenFilesPresentInKeyfilePath = TRUE; HiddenFilesPresentInKeyfilePath = TRUE;
continue; continue;
} }
CorrectFileName (kfSub->FileName); CorrectFileName (kfSub->FileName);
@@ -474,18 +474,18 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
SendMessageW (hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0, SendMessageW (hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0,
LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP
); );
memset (&LvCol,0,sizeof(LvCol)); memset (&LvCol,0,sizeof(LvCol));
LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT; LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT;
LvCol.pszText = GetString ("KEYFILE"); LvCol.pszText = GetString ("KEYFILE");
LvCol.cx = CompensateXDPI (374); LvCol.cx = CompensateXDPI (374);
LvCol.fmt = LVCFMT_LEFT; LvCol.fmt = LVCFMT_LEFT;
SendMessageW (hList, LVM_INSERTCOLUMNW, 0, (LPARAM)&LvCol); SendMessageW (hList, LVM_INSERTCOLUMNW, 0, (LPARAM)&LvCol);
LoadKeyList (hwndDlg, param->FirstKeyFile); LoadKeyList (hwndDlg, param->FirstKeyFile);
SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, param->EnableKeyFiles); SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, param->EnableKeyFiles);
#ifdef TCMOUNT #ifdef TCMOUNT
if ( (origParam.EnableKeyFiles == defaultKeyFilesParam.EnableKeyFiles) if ( (origParam.EnableKeyFiles == defaultKeyFilesParam.EnableKeyFiles)
&& (origParam.FirstKeyFile == defaultKeyFilesParam.FirstKeyFile) && (origParam.FirstKeyFile == defaultKeyFilesParam.FirstKeyFile)
@@ -580,15 +580,15 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
HWND list = GetDlgItem (hwndDlg, IDC_KEYLIST); HWND list = GetDlgItem (hwndDlg, IDC_KEYLIST);
LVITEM LvItem; LVITEM LvItem;
memset (&LvItem, 0, sizeof(LvItem)); memset (&LvItem, 0, sizeof(LvItem));
LvItem.mask = LVIF_PARAM; LvItem.mask = LVIF_PARAM;
LvItem.iItem = -1; LvItem.iItem = -1;
while (-1 != (LvItem.iItem = ListView_GetNextItem (list, LvItem.iItem, LVIS_SELECTED))) while (-1 != (LvItem.iItem = ListView_GetNextItem (list, LvItem.iItem, LVIS_SELECTED)))
{ {
ListView_GetItem (list, &LvItem); ListView_GetItem (list, &LvItem);
param->FirstKeyFile = KeyFileRemove (param->FirstKeyFile, (KeyFile *) LvItem.lParam); param->FirstKeyFile = KeyFileRemove (param->FirstKeyFile, (KeyFile *) LvItem.lParam);
} }
LoadKeyList (hwndDlg, param->FirstKeyFile); LoadKeyList (hwndDlg, param->FirstKeyFile);
return 1; return 1;
} }
@@ -602,7 +602,7 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (lw == IDC_GENERATE_KEYFILE) if (lw == IDC_GENERATE_KEYFILE)
{ {
DialogBoxParamW (hInst, DialogBoxParamW (hInst,
MAKEINTRESOURCEW (IDD_KEYFILE_GENERATOR), hwndDlg, MAKEINTRESOURCEW (IDD_KEYFILE_GENERATOR), hwndDlg,
(DLGPROC) KeyfileGeneratorDlgProc, (LPARAM) 0); (DLGPROC) KeyfileGeneratorDlgProc, (LPARAM) 0);
return 1; return 1;

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -51,4 +51,4 @@ extern BOOL HiddenFilesPresentInKeyfilePath;
} }
#endif #endif
#endif /* #ifndef KEYFILES_H */ #endif /* #ifndef KEYFILES_H */

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -101,7 +101,7 @@ static char *MapNextLanguageFile ()
GetModuleFileNameW (NULL, f, sizeof (f) / sizeof (f[0])); GetModuleFileNameW (NULL, f, sizeof (f) / sizeof (f[0]));
t = wcsrchr (f, L'\\'); t = wcsrchr (f, L'\\');
if (t == NULL) return NULL; if (t == NULL) return NULL;
*t = 0; *t = 0;
StringCbCatW (f, sizeof(f), L"\\Language*.xml"); StringCbCatW (f, sizeof(f), L"\\Language*.xml");
@@ -236,10 +236,10 @@ BOOL LoadLanguageFile ()
memset (&font, 0, sizeof (font)); memset (&font, 0, sizeof (font));
XmlGetAttributeText (xml, "face", attr, sizeof (attr)); XmlGetAttributeText (xml, "face", attr, sizeof (attr));
len = MultiByteToWideChar (CP_UTF8, 0, attr, -1, wattr, sizeof (wattr) / sizeof(wattr[0])); len = MultiByteToWideChar (CP_UTF8, 0, attr, -1, wattr, sizeof (wattr) / sizeof(wattr[0]));
font.FaceName = AddPoolData ((void *) wattr, len * 2); font.FaceName = AddPoolData ((void *) wattr, len * 2);
XmlGetAttributeText (xml, "size", attr, sizeof (attr)); XmlGetAttributeText (xml, "size", attr, sizeof (attr));
sscanf (attr, "%d", &font.Size); sscanf (attr, "%d", &font.Size);
@@ -332,7 +332,7 @@ BOOL LoadLanguageFile ()
LocalizationSerialNo++; LocalizationSerialNo++;
// Create control ID dictionary // Create control ID dictionary
// Default controls // Default controls
AddDictionaryEntry (NULL, 1, GetString ("IDOK")); AddDictionaryEntry (NULL, 1, GetString ("IDOK"));
AddDictionaryEntry (NULL, 2, GetString ("IDCANCEL")); AddDictionaryEntry (NULL, 2, GetString ("IDCANCEL"));
@@ -440,7 +440,7 @@ BOOL CALLBACK LanguageDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
SendDlgItemMessage (hwndDlg, IDC_LANGLIST, LB_SETCURSEL, i, 0); SendDlgItemMessage (hwndDlg, IDC_LANGLIST, LB_SETCURSEL, i, 0);
// Language pack version // Language pack version
if (!ActiveLangPackVersion[0] || memcmp (ActiveLangPackVersion, "0.0.0", 5) == 0) if (!ActiveLangPackVersion[0] || memcmp (ActiveLangPackVersion, "0.0.0", 5) == 0)
{ {
StringCbPrintfW (szVers, sizeof(szVers), GetString("LANG_PACK_VERSION"), L"--"); StringCbPrintfW (szVers, sizeof(szVers), GetString("LANG_PACK_VERSION"), L"--");
@@ -474,12 +474,12 @@ BOOL CALLBACK LanguageDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (lParam == 1) if (lParam == 1)
{ {
// Auto mode // Auto mode
if (langCount < 2) if (langCount < 2)
EndDialog (hwndDlg, IDCANCEL); EndDialog (hwndDlg, IDCANCEL);
if (langCount == 2) if (langCount == 2)
StringCbCopyA (PreferredLangId, sizeof(PreferredLangId), lastLangId); StringCbCopyA (PreferredLangId, sizeof(PreferredLangId), lastLangId);
EndDialog (hwndDlg, IDOK); EndDialog (hwndDlg, IDOK);
} }
@@ -511,8 +511,8 @@ BOOL CALLBACK LanguageDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
l[3] = (char) (id >> 16); l[3] = (char) (id >> 16);
l[4] = id >> 24; l[4] = id >> 24;
l[5] = 0; l[5] = 0;
} }
if (SendDlgItemMessage (hwndDlg, IDC_LANGLIST, LB_GETCOUNT, 0, 0) > 1) if (SendDlgItemMessage (hwndDlg, IDC_LANGLIST, LB_GETCOUNT, 0, 0) > 1)
StringCbCopyA (PreferredLangId, sizeof(PreferredLangId), l); StringCbCopyA (PreferredLangId, sizeof(PreferredLangId), l);
} }

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -89,7 +89,7 @@ void VerifyPasswordAndUpdate (HWND hwndDlg, HWND hButton, HWND hPassword,
BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw) BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw)
{ {
int i, len; int i, len;
if (hPassword == NULL) if (hPassword == NULL)
{ {
if (ptrPw) if (ptrPw)
@@ -113,7 +113,7 @@ BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw)
len = GetWindowTextLength (hPassword); len = GetWindowTextLength (hPassword);
if (len > MAX_PASSWORD) if (len > MAX_PASSWORD)
return FALSE; return FALSE;
GetWindowTextW (hPassword, s, sizeof (s) / sizeof (wchar_t)); GetWindowTextW (hPassword, s, sizeof (s) / sizeof (wchar_t));
@@ -126,7 +126,7 @@ BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw)
burn (s, sizeof(s)); burn (s, sizeof(s));
if (i < len) if (i < len)
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
@@ -141,7 +141,7 @@ BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim
if (bCustomPimSmall) if (bCustomPimSmall)
{ {
Error (bForBoot? "BOOT_PIM_REQUIRE_LONG_PASSWORD": "PIM_REQUIRE_LONG_PASSWORD", hwndDlg); Error (bForBoot? "BOOT_PIM_REQUIRE_LONG_PASSWORD": "PIM_REQUIRE_LONG_PASSWORD", hwndDlg);
return FALSE; return FALSE;
} }
#ifndef _DEBUG #ifndef _DEBUG
@@ -215,14 +215,14 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
else else
{ {
nDosLinkCreated = FakeDosNameForDevice (szDiskFile, szDosDevice, sizeof(szDosDevice), szCFDevice, sizeof(szCFDevice),FALSE); nDosLinkCreated = FakeDosNameForDevice (szDiskFile, szDosDevice, sizeof(szDosDevice), szCFDevice, sizeof(szCFDevice),FALSE);
if (nDosLinkCreated != 0) if (nDosLinkCreated != 0)
goto error; goto error;
} }
dev = CreateFile (szCFDevice, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); dev = CreateFile (szCFDevice, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (dev == INVALID_HANDLE_VALUE) if (dev == INVALID_HANDLE_VALUE)
goto error; goto error;
if (bDevice) if (bDevice)
@@ -328,7 +328,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
if (bytesRead != sizeof (buffer)) if (bytesRead != sizeof (buffer))
{ {
// Windows may report EOF when reading sectors from the last cluster of a device formatted as NTFS // Windows may report EOF when reading sectors from the last cluster of a device formatted as NTFS
memset (buffer, 0, sizeof (buffer)); memset (buffer, 0, sizeof (buffer));
} }
@@ -347,7 +347,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
cryptoInfo = NULL; cryptoInfo = NULL;
goto error; goto error;
} }
else else
break; break;
} }
@@ -374,12 +374,12 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
EnableElevatedCursorChange (hwndDlg); EnableElevatedCursorChange (hwndDlg);
WaitCursor(); WaitCursor();
/* Re-encrypt the volume header */ /* Re-encrypt the volume header */
backupHeader = FALSE; backupHeader = FALSE;
while (TRUE) while (TRUE)
{ {
/* The header will be re-encrypted wipePassCount times to prevent adversaries from using /* The header will be re-encrypted wipePassCount times to prevent adversaries from using
techniques such as magnetic force microscopy or magnetic force scanning tunnelling microscopy techniques such as magnetic force microscopy or magnetic force scanning tunnelling microscopy
to recover the overwritten header. According to Peter Gutmann, data should be overwritten 22 to recover the overwritten header. According to Peter Gutmann, data should be overwritten 22
times (ideally, 35 times) using non-random patterns and pseudorandom data. However, as users might times (ideally, 35 times) using non-random patterns and pseudorandom data. However, as users might
@@ -447,7 +447,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5,
if (backupHeader || cryptoInfo->LegacyVolume) if (backupHeader || cryptoInfo->LegacyVolume)
break; break;
backupHeader = TRUE; backupHeader = TRUE;
headerOffset.QuadPart += hostSize - TC_VOLUME_HEADER_GROUP_SIZE; headerOffset.QuadPart += hostSize - TC_VOLUME_HEADER_GROUP_SIZE;
} }

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -39,8 +39,8 @@ typedef struct
#if defined(_WIN32) && !defined(TC_WINDOWS_DRIVER) #if defined(_WIN32) && !defined(TC_WINDOWS_DRIVER)
void VerifyPasswordAndUpdate ( HWND hwndDlg , HWND hButton , HWND hPassword , HWND hVerify , unsigned char *szPassword , char *szVerify, BOOL keyFilesEnabled ); void VerifyPasswordAndUpdate ( HWND hwndDlg , HWND hButton , HWND hPassword , HWND hVerify , unsigned char *szPassword , char *szVerify, BOOL keyFilesEnabled );
BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, BOOL bSkipPasswordWarning, BOOL bSkipPimWarning); BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, BOOL bSkipPasswordWarning, BOOL bSkipPimWarning);
BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw); BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw);
int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg); int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, int old_pim, BOOL truecryptMode, Password *newPassword, int pkcs5, int pim, int wipePassCount, HWND hwndDlg);
#endif // defined(_WIN32) && !defined(TC_WINDOWS_DRIVER) #endif // defined(_WIN32) && !defined(TC_WINDOWS_DRIVER)

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -150,7 +150,7 @@ static void derive_u_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, u
char* k = hmac->k; char* k = hmac->k;
char* u = hmac->u; char* u = hmac->u;
uint32 c; uint32 c;
int i; int i;
#ifdef TC_WINDOWS_BOOT #ifdef TC_WINDOWS_BOOT
/* In bootloader mode, least significant bit of iterations is a boolean (TRUE for boot derivation mode, FALSE otherwise) /* In bootloader mode, least significant bit of iterations is a boolean (TRUE for boot derivation mode, FALSE otherwise)
@@ -169,7 +169,7 @@ static void derive_u_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, u
/* iteration 1 */ /* iteration 1 */
memcpy (k, salt, salt_len); /* salt */ memcpy (k, salt, salt_len); /* salt */
/* big-endian block number */ /* big-endian block number */
memset (&k[salt_len], 0, 3); memset (&k[salt_len], 0, 3);
k[salt_len + 3] = (char) b; k[salt_len + 3] = (char) b;
@@ -191,7 +191,7 @@ static void derive_u_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, u
void derive_key_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen) void derive_key_sha256 (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen)
{ {
hmac_sha256_ctx hmac; hmac_sha256_ctx hmac;
sha256_ctx* ctx; sha256_ctx* ctx;
char* buf = hmac.k; char* buf = hmac.k;
@@ -315,7 +315,7 @@ void hmac_sha512
char *k, /* secret key */ char *k, /* secret key */
int lk, /* length of the key in bytes */ int lk, /* length of the key in bytes */
char *d, /* data and also output buffer of at least 64 bytes */ char *d, /* data and also output buffer of at least 64 bytes */
int ld /* length of data in bytes */ int ld /* length of data in bytes */
) )
{ {
hmac_sha512_ctx hmac; hmac_sha512_ctx hmac;
@@ -521,7 +521,7 @@ void hmac_ripemd160 (char *key, int keylen, char *input_digest, int len)
/* If the key is longer than the hash algorithm block size, /* If the key is longer than the hash algorithm block size,
let key = ripemd160(key), as per HMAC specifications. */ let key = ripemd160(key), as per HMAC specifications. */
if (keylen > RIPEMD160_BLOCKSIZE) if (keylen > RIPEMD160_BLOCKSIZE)
{ {
RMD160_CTX tctx; RMD160_CTX tctx;
@@ -533,14 +533,14 @@ void hmac_ripemd160 (char *key, int keylen, char *input_digest, int len)
keylen = RIPEMD160_DIGESTSIZE; keylen = RIPEMD160_DIGESTSIZE;
burn (&tctx, sizeof(tctx)); // Prevent leaks burn (&tctx, sizeof(tctx)); // Prevent leaks
} }
/* perform inner RIPEMD-160 */ /* perform inner RIPEMD-160 */
ctx = &(hmac.inner_digest_ctx); ctx = &(hmac.inner_digest_ctx);
/* start out by storing key in pads */ /* start out by storing key in pads */
memset(k_pad, 0x36, 64); memset(k_pad, 0x36, 64);
/* XOR key with ipad and opad values */ /* XOR key with ipad and opad values */
for (i=0; i<keylen; i++) for (i=0; i<keylen; i++)
{ {
k_pad[i] ^= key[i]; k_pad[i] ^= key[i];
} }
@@ -551,7 +551,7 @@ void hmac_ripemd160 (char *key, int keylen, char *input_digest, int len)
/* perform outer RIPEMD-160 */ /* perform outer RIPEMD-160 */
ctx = &(hmac.outer_digest_ctx); ctx = &(hmac.outer_digest_ctx);
memset(k_pad, 0x5c, 64); memset(k_pad, 0x5c, 64);
for (i=0; i<keylen; i++) for (i=0; i<keylen; i++)
{ {
k_pad[i] ^= key[i]; k_pad[i] ^= key[i];
} }
@@ -591,7 +591,7 @@ static void derive_u_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len
/* iteration 1 */ /* iteration 1 */
memcpy (k, salt, salt_len); /* salt */ memcpy (k, salt, salt_len); /* salt */
/* big-endian block number */ /* big-endian block number */
memset (&k[salt_len], 0, 3); memset (&k[salt_len], 0, 3);
k[salt_len + 3] = (char) b; k[salt_len + 3] = (char) b;
@@ -612,7 +612,7 @@ static void derive_u_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len
} }
void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen) void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, uint32 iterations, char *dk, int dklen)
{ {
int b, l, r; int b, l, r;
hmac_ripemd160_ctx hmac; hmac_ripemd160_ctx hmac;
RMD160_CTX* ctx; RMD160_CTX* ctx;
@@ -621,7 +621,7 @@ void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, uin
unsigned char tk[RIPEMD160_DIGESTSIZE]; unsigned char tk[RIPEMD160_DIGESTSIZE];
/* If the password is longer than the hash algorithm block size, /* If the password is longer than the hash algorithm block size,
let password = ripemd160(password), as per HMAC specifications. */ let password = ripemd160(password), as per HMAC specifications. */
if (pwd_len > RIPEMD160_BLOCKSIZE) if (pwd_len > RIPEMD160_BLOCKSIZE)
{ {
RMD160_CTX tctx; RMD160_CTX tctx;
@@ -652,7 +652,7 @@ void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, uin
/* start out by storing key in pads */ /* start out by storing key in pads */
memset(k_pad, 0x36, 64); memset(k_pad, 0x36, 64);
/* XOR key with ipad and opad values */ /* XOR key with ipad and opad values */
for (b=0; b<pwd_len; b++) for (b=0; b<pwd_len; b++)
{ {
k_pad[b] ^= pwd[b]; k_pad[b] ^= pwd[b];
} }
@@ -663,7 +663,7 @@ void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, uin
/* perform outer RIPEMD-160 */ /* perform outer RIPEMD-160 */
ctx = &(hmac.outer_digest_ctx); ctx = &(hmac.outer_digest_ctx);
memset(k_pad, 0x5c, 64); memset(k_pad, 0x5c, 64);
for (b=0; b<pwd_len; b++) for (b=0; b<pwd_len; b++)
{ {
k_pad[b] ^= pwd[b]; k_pad[b] ^= pwd[b];
} }
@@ -797,7 +797,7 @@ static void derive_u_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len
/* iteration 1 */ /* iteration 1 */
memcpy (k, salt, salt_len); /* salt */ memcpy (k, salt, salt_len); /* salt */
/* big-endian block number */ /* big-endian block number */
memset (&k[salt_len], 0, 3); memset (&k[salt_len], 0, 3);
k[salt_len + 3] = (char) b; k[salt_len + 3] = (char) b;
hmac_whirlpool_internal (pwd, pwd_len, k, salt_len + 4, hmac); hmac_whirlpool_internal (pwd, pwd_len, k, salt_len + 4, hmac);
@@ -894,19 +894,19 @@ wchar_t *get_pkcs5_prf_name (int pkcs5_prf_id)
{ {
switch (pkcs5_prf_id) switch (pkcs5_prf_id)
{ {
case SHA512: case SHA512:
return L"HMAC-SHA-512"; return L"HMAC-SHA-512";
case SHA256: case SHA256:
return L"HMAC-SHA-256"; return L"HMAC-SHA-256";
case RIPEMD160: case RIPEMD160:
return L"HMAC-RIPEMD-160"; return L"HMAC-RIPEMD-160";
case WHIRLPOOL: case WHIRLPOOL:
return L"HMAC-Whirlpool"; return L"HMAC-Whirlpool";
default: default:
return L"(Unknown)"; return L"(Unknown)";
} }
} }
@@ -925,7 +925,7 @@ int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BO
switch (pkcs5_prf_id) switch (pkcs5_prf_id)
{ {
case RIPEMD160: case RIPEMD160:
if (truecryptMode) if (truecryptMode)
return bBoot ? 1000 : 2000; return bBoot ? 1000 : 2000;
else if (pim == 0) else if (pim == 0)
@@ -935,10 +935,10 @@ int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BO
return bBoot? pim * 2048 : 15000 + pim * 1000; return bBoot? pim * 2048 : 15000 + pim * 1000;
} }
case SHA512: case SHA512:
return truecryptMode? 1000 : ((pim == 0)? 500000 : 15000 + pim * 1000); return truecryptMode? 1000 : ((pim == 0)? 500000 : 15000 + pim * 1000);
case WHIRLPOOL: case WHIRLPOOL:
return truecryptMode? 1000 : ((pim == 0)? 500000 : 15000 + pim * 1000); return truecryptMode? 1000 : ((pim == 0)? 500000 : 15000 + pim * 1000);
case SHA256: case SHA256:
@@ -951,7 +951,7 @@ int get_pkcs5_iteration_count (int pkcs5_prf_id, int pim, BOOL truecryptMode, BO
return bBoot? pim * 2048 : 15000 + pim * 1000; return bBoot? pim * 2048 : 15000 + pim * 1000;
} }
default: default:
TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID
} }
return 0; return 0;

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -126,7 +126,7 @@ BOOL UpdateProgressBarProc (__int64 byteOffset)
prevTime = time; prevTime = time;
SendMessage (hProgressBar, PBM_SETPOS, SendMessage (hProgressBar, PBM_SETPOS,
(int) (10000.0 * (bProgressBarReverse ? (TotalSize - byteOffset) : byteOffset) / (TotalSize == 0 ? 1 : TotalSize)), (int) (10000.0 * (bProgressBarReverse ? (TotalSize - byteOffset) : byteOffset) / (TotalSize == 0 ? 1 : TotalSize)),
0); 0);

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -46,16 +46,16 @@ static HANDLE PeriodicFastPollThreadHandle = NULL;
void RandAddInt (unsigned __int32 x) void RandAddInt (unsigned __int32 x)
{ {
RandaddByte(x); RandaddByte(x);
RandaddByte((x >> 8)); RandaddByte((x >> 8));
RandaddByte((x >> 16)); RandaddByte((x >> 16));
RandaddByte((x >> 24)); RandaddByte((x >> 24));
} }
void RandAddInt64 (unsigned __int64 x) void RandAddInt64 (unsigned __int64 x)
{ {
RandaddByte(x); RandaddByte(x);
RandaddByte((x >> 8)); RandaddByte((x >> 8));
RandaddByte((x >> 16)); RandaddByte((x >> 16));
RandaddByte((x >> 24)); RandaddByte((x >> 24));
@@ -97,7 +97,7 @@ int Randinit ()
if (GetMaxPkcs5OutSize() > RNG_POOL_SIZE) if (GetMaxPkcs5OutSize() > RNG_POOL_SIZE)
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
if(bRandDidInit) if(bRandDidInit)
return 0; return 0;
InitializeCriticalSection (&critRandProt); InitializeCriticalSection (&critRandProt);
@@ -128,9 +128,9 @@ int Randinit ()
handleWin32Error (0, SRC_POS); handleWin32Error (0, SRC_POS);
goto error; goto error;
} }
if (!CryptAcquireContext (&hCryptProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) if (!CryptAcquireContext (&hCryptProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT))
{ {
CryptoAPIAvailable = FALSE; CryptoAPIAvailable = FALSE;
CryptoAPILastError = GetLastError (); CryptoAPILastError = GetLastError ();
goto error; goto error;
@@ -274,7 +274,7 @@ BOOL Randmix ()
if (RNG_POOL_SIZE % digestSize) if (RNG_POOL_SIZE % digestSize)
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
for (poolIndex = 0; poolIndex < RNG_POOL_SIZE; poolIndex += digestSize) for (poolIndex = 0; poolIndex < RNG_POOL_SIZE; poolIndex += digestSize)
{ {
/* Compute the message digest of the entire pool using the selected hash function. */ /* Compute the message digest of the entire pool using the selected hash function. */
switch (HashFunction) switch (HashFunction)
@@ -303,7 +303,7 @@ BOOL Randmix ()
WHIRLPOOL_finalize (&wctx, hashOutputBuffer); WHIRLPOOL_finalize (&wctx, hashOutputBuffer);
break; break;
default: default:
// Unknown/wrong ID // Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
} }
@@ -316,26 +316,26 @@ BOOL Randmix ()
} }
/* Prevent leaks */ /* Prevent leaks */
burn (hashOutputBuffer, MAX_DIGESTSIZE); burn (hashOutputBuffer, MAX_DIGESTSIZE);
switch (HashFunction) switch (HashFunction)
{ {
case RIPEMD160: case RIPEMD160:
burn (&rctx, sizeof(rctx)); burn (&rctx, sizeof(rctx));
break; break;
case SHA512: case SHA512:
burn (&sctx, sizeof(sctx)); burn (&sctx, sizeof(sctx));
break; break;
case SHA256: case SHA256:
burn (&s256ctx, sizeof(s256ctx)); burn (&s256ctx, sizeof(s256ctx));
break; break;
case WHIRLPOOL: case WHIRLPOOL:
burn (&wctx, sizeof(wctx)); burn (&wctx, sizeof(wctx));
break; break;
default: default:
// Unknown/wrong ID // Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
} }
@@ -360,7 +360,7 @@ BOOL RandpeekBytes (void* hwndDlg, unsigned char *buf, int len, DWORD* mouseCoun
if (len > RNG_POOL_SIZE) if (len > RNG_POOL_SIZE)
{ {
Error ("ERR_NOT_ENOUGH_RANDOM_DATA", (HWND) hwndDlg); Error ("ERR_NOT_ENOUGH_RANDOM_DATA", (HWND) hwndDlg);
len = RNG_POOL_SIZE; len = RNG_POOL_SIZE;
} }
@@ -413,7 +413,7 @@ BOOL RandgetBytesFull ( void* hwndDlg, unsigned char *buf , int len, BOOL forceS
/* There's never more than RNG_POOL_SIZE worth of randomess */ /* There's never more than RNG_POOL_SIZE worth of randomess */
if ( (!allowAnyLength) && (len > RNG_POOL_SIZE)) if ( (!allowAnyLength) && (len > RNG_POOL_SIZE))
{ {
Error ("ERR_NOT_ENOUGH_RANDOM_DATA", (HWND) hwndDlg); Error ("ERR_NOT_ENOUGH_RANDOM_DATA", (HWND) hwndDlg);
len = RNG_POOL_SIZE; len = RNG_POOL_SIZE;
LeaveCriticalSection (&critRandProt); LeaveCriticalSection (&critRandProt);
return FALSE; return FALSE;
@@ -515,7 +515,7 @@ LRESULT CALLBACK MouseProc (int nCode, WPARAM wParam, LPARAM lParam)
EnterCriticalSection (&critRandProt); EnterCriticalSection (&critRandProt);
/* only count real mouse messages in entropy estimation */ /* only count real mouse messages in entropy estimation */
if ( (nCode == HC_ACTION) && (wParam == WM_MOUSEMOVE) if ( (nCode == HC_ACTION) && (wParam == WM_MOUSEMOVE)
&& ((pt.x != lastPoint.x) || (pt.y != lastPoint.y))) && ((pt.x != lastPoint.x) || (pt.y != lastPoint.y)))
{ {
ProcessedMouseEventsCounter++; ProcessedMouseEventsCounter++;
@@ -748,7 +748,7 @@ BOOL SlowPoll (void)
// we keep the check for clarity purpose // we keep the check for clarity purpose
if ( !CryptoAPIAvailable ) if ( !CryptoAPIAvailable )
return FALSE; return FALSE;
if (CryptGenRandom (hCryptProv, sizeof (buffer), buffer)) if (CryptGenRandom (hCryptProv, sizeof (buffer), buffer))
{ {
RandaddBuf (buffer, sizeof (buffer)); RandaddBuf (buffer, sizeof (buffer));
@@ -759,7 +759,7 @@ BOOL SlowPoll (void)
else else
{ {
/* return error in case CryptGenRandom fails */ /* return error in case CryptGenRandom fails */
CryptoAPILastError = GetLastError (); CryptoAPILastError = GetLastError ();
return FALSE; return FALSE;
} }
} }
@@ -870,7 +870,7 @@ BOOL FastPoll (void)
// we keep the check for clarity purpose // we keep the check for clarity purpose
if ( !CryptoAPIAvailable ) if ( !CryptoAPIAvailable )
return FALSE; return FALSE;
if (CryptGenRandom (hCryptProv, sizeof (buffer), buffer)) if (CryptGenRandom (hCryptProv, sizeof (buffer), buffer))
{ {
RandaddBuf (buffer, sizeof (buffer)); RandaddBuf (buffer, sizeof (buffer));
burn (buffer, sizeof(buffer)); burn (buffer, sizeof(buffer));

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -287,14 +287,14 @@ void DeleteRegistryValue (wchar_t *subKey, wchar_t *name)
void GetStartupRegKeyName (wchar_t *regk, size_t cbRegk) void GetStartupRegKeyName (wchar_t *regk, size_t cbRegk)
{ {
// The string is split in order to prevent some antivirus packages from falsely reporting // The string is split in order to prevent some antivirus packages from falsely reporting
// VeraCrypt.exe to contain a possible Trojan horse because of this string (heuristic scan). // VeraCrypt.exe to contain a possible Trojan horse because of this string (heuristic scan).
StringCbPrintfW (regk, cbRegk,L"%s%s", L"Software\\Microsoft\\Windows\\Curren", L"tVersion\\Run"); StringCbPrintfW (regk, cbRegk,L"%s%s", L"Software\\Microsoft\\Windows\\Curren", L"tVersion\\Run");
} }
void GetRestorePointRegKeyName (wchar_t *regk, size_t cbRegk) void GetRestorePointRegKeyName (wchar_t *regk, size_t cbRegk)
{ {
// The string is split in order to prevent some antivirus packages from falsely reporting // The string is split in order to prevent some antivirus packages from falsely reporting
// VeraCrypt.exe to contain a possible Trojan horse because of this string (heuristic scan). // VeraCrypt.exe to contain a possible Trojan horse because of this string (heuristic scan).
StringCbPrintfW (regk, cbRegk,L"%s%s%s%s", L"Software\\Microsoft\\Windows", L" NT\\Curren", L"tVersion\\Sy", L"stemRestore"); StringCbPrintfW (regk, cbRegk,L"%s%s%s%s", L"Software\\Microsoft\\Windows", L" NT\\Curren", L"tVersion\\Sy", L"stemRestore");
} }

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -199,7 +199,7 @@
#define IDT_ENTROPY_BAR 5137 #define IDT_ENTROPY_BAR 5137
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1 #define _APS_NO_MFC 1

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -174,7 +174,7 @@ namespace VeraCrypt
void SecurityToken::DeleteKeyfile (const SecurityTokenKeyfile &keyfile) void SecurityToken::DeleteKeyfile (const SecurityTokenKeyfile &keyfile)
{ {
LoginUserIfRequired (keyfile.SlotId); LoginUserIfRequired (keyfile.SlotId);
CK_RV status = Pkcs11Functions->C_DestroyObject (Sessions[keyfile.SlotId].Handle, keyfile.Handle); CK_RV status = Pkcs11Functions->C_DestroyObject (Sessions[keyfile.SlotId].Handle, keyfile.Handle);
if (status != CKR_OK) if (status != CKR_OK)
throw Pkcs11Exception (status); throw Pkcs11Exception (status);
@@ -339,7 +339,7 @@ namespace VeraCrypt
finally_do_arg (CK_SLOT_ID, slotId, { Pkcs11Functions->C_FindObjectsFinal (Sessions[finally_arg].Handle); }); finally_do_arg (CK_SLOT_ID, slotId, { Pkcs11Functions->C_FindObjectsFinal (Sessions[finally_arg].Handle); });
CK_ULONG objectCount; CK_ULONG objectCount;
vector <CK_OBJECT_HANDLE> objects; vector <CK_OBJECT_HANDLE> objects;
while (true) while (true)
@@ -451,7 +451,7 @@ namespace VeraCrypt
{ {
CK_SESSION_INFO sessionInfo; CK_SESSION_INFO sessionInfo;
status = Pkcs11Functions->C_GetSessionInfo (Sessions[slotId].Handle, &sessionInfo); status = Pkcs11Functions->C_GetSessionInfo (Sessions[slotId].Handle, &sessionInfo);
if (status == CKR_OK) if (status == CKR_OK)
{ {
Sessions[slotId].UserLoggedIn = (sessionInfo.state == CKS_RO_USER_FUNCTIONS || sessionInfo.state == CKS_RW_USER_FUNCTIONS); Sessions[slotId].UserLoggedIn = (sessionInfo.state == CKS_RO_USER_FUNCTIONS || sessionInfo.state == CKS_RW_USER_FUNCTIONS);
@@ -542,7 +542,7 @@ namespace VeraCrypt
Pkcs11LibraryHandle = dlopen (pkcs11LibraryPath.c_str(), RTLD_NOW | RTLD_LOCAL); Pkcs11LibraryHandle = dlopen (pkcs11LibraryPath.c_str(), RTLD_NOW | RTLD_LOCAL);
throw_sys_sub_if (!Pkcs11LibraryHandle, dlerror()); throw_sys_sub_if (!Pkcs11LibraryHandle, dlerror());
#endif #endif
typedef CK_RV (*C_GetFunctionList_t) (CK_FUNCTION_LIST_PTR_PTR ppFunctionList); typedef CK_RV (*C_GetFunctionList_t) (CK_FUNCTION_LIST_PTR_PTR ppFunctionList);
#ifdef TC_WINDOWS #ifdef TC_WINDOWS

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -139,7 +139,7 @@ namespace VeraCrypt
{ {
void Show (HWND parent) const { Error (SecurityTokenLibraryPath[0] == 0 ? "NO_PKCS11_MODULE_SPECIFIED" : "PKCS11_MODULE_INIT_FAILED", parent); } void Show (HWND parent) const { Error (SecurityTokenLibraryPath[0] == 0 ? "NO_PKCS11_MODULE_SPECIFIED" : "PKCS11_MODULE_INIT_FAILED", parent); }
}; };
struct InvalidSecurityTokenKeyfilePath : public Exception struct InvalidSecurityTokenKeyfilePath : public Exception
{ {
void Show (HWND parent) const { Error ("INVALID_TOKEN_KEYFILE_PATH", parent); } void Show (HWND parent) const { Error ("INVALID_TOKEN_KEYFILE_PATH", parent); }
@@ -197,7 +197,7 @@ namespace VeraCrypt
#endif #endif
static bool IsInitialized () { return Initialized; } static bool IsInitialized () { return Initialized; }
static bool IsKeyfilePathValid (const wstring &securityTokenKeyfilePath); static bool IsKeyfilePathValid (const wstring &securityTokenKeyfilePath);
static const size_t MaxPasswordLength = 128; static const size_t MaxPasswordLength = 128;
protected: protected:

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -16,7 +16,7 @@
#define TC_APP_NAME "VeraCrypt" #define TC_APP_NAME "VeraCrypt"
// Version displayed to user // Version displayed to user
#define VERSION_STRING "1.17" #define VERSION_STRING "1.17"
// Version number to compare against driver // Version number to compare against driver
@@ -106,9 +106,9 @@ typedef unsigned __int32 uint_32t;
typedef uint64 uint_64t; typedef uint64 uint_64t;
#endif #endif
typedef union typedef union
{ {
struct struct
{ {
unsigned __int32 LowPart; unsigned __int32 LowPart;
unsigned __int32 HighPart; unsigned __int32 HighPart;
@@ -276,9 +276,9 @@ void EraseMemory (void *memory, int size);
enum enum
{ {
/* WARNING: ADD ANY NEW CODES AT THE END (DO NOT INSERT THEM BETWEEN EXISTING). DO *NOT* DELETE ANY /* WARNING: ADD ANY NEW CODES AT THE END (DO NOT INSERT THEM BETWEEN EXISTING). DO *NOT* DELETE ANY
EXISTING CODES! Changing these values or their meanings may cause incompatibility with other versions EXISTING CODES! Changing these values or their meanings may cause incompatibility with other versions
(for example, if a new version of the TrueCrypt installer receives an error code from an installed (for example, if a new version of the TrueCrypt installer receives an error code from an installed
driver whose version is lower, it will report and interpret the error incorrectly). */ driver whose version is lower, it will report and interpret the error incorrectly). */
ERR_SUCCESS = 0, ERR_SUCCESS = 0,

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -40,7 +40,7 @@ XTS_TEST XTS_vectors[XTS_TEST_COUNT] = {
{ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 }, { 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff },
0, 0,
{ {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x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S_TEST XTS_vectors[XTS_TEST_COUNT] = {
{ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 }, { 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 },
{ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 }, { 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff },
0, 0,
{ {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
@@ -100,9 +100,9 @@ XTS_TEST XTS_vectors[XTS_TEST_COUNT] = {
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x80, 0x81, 0x82, 0x83,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 0x4f, 0x75, 0xca, 0x68,
0x6e, 0x0d, 0x73, 0x45, 0xc6, 0x9e, 0xd5, 0x0c, 0xdc, 0x2a, 0x8b, 0x33, 0x2b, 0x1f, 0x88, 0x24, 0x10, 0x8a, 0xc9, 0x37, 0xeb, 0x05, 0x05, 0x85, 0x60, 0x8e, 0xe7, 0x34, 0x09, 0x7f, 0xc0, 0x90, 0x6e, 0x0d, 0x73, 0x45, 0xc6, 0x9e, 0xd5, 0x0c, 0xdc, 0x2a, 0x8b, 0x33, 0x2b, 0x1f, 0x88, 0x24, 0x10, 0x8a, 0xc9, 0x37, 0xeb, 0x05, 0x05, 0x85, 0x60, 0x8e, 0xe7, 0x34, 0x09, 0x7f, 0xc0, 0x90,
0x54, 0xfb, 0xff, 0x89, 0xee, 0xae, 0xea, 0x79, 0x1f, 0x4a, 0x7a, 0xb1, 0xf9, 0x86, 0x82, 0x94, 0xa4, 0xf9, 0xe2, 0x7b, 0x42, 0xaf, 0x81, 0x00, 0xcb, 0x9d, 0x59, 0xce, 0xf9, 0x64, 0x58, 0x03 0x54, 0xfb, 0xff, 0x89, 0xee, 0xae, 0xea, 0x79, 0x1f, 0x4a, 0x7a, 0xb1, 0xf9, 0x86, 0x82, 0x94, 0xa4, 0xf9, 0xe2, 0x7b, 0x42, 0xaf, 0x81, 0x00, 0xcb, 0x9d, 0x59, 0xce, 0xf9, 0x64, 0x58, 0x03
} }
}, },
{ {
@@ -127,8 +127,8 @@ XTS_TEST XTS_vectors[XTS_TEST_COUNT] = {
{ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 }, { 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 },
{ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 }, { 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff },
0, 0,
{ {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
@@ -144,9 +144,9 @@ XTS_TEST XTS_vectors[XTS_TEST_COUNT] = {
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0x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0x21, 0x06, 0x3f, 0xdd, 0xc8, 0x3a, 0x6b, 0x86, 0x79, 0xc0, 0x0d, 0x35, 0xe0, 0x95, 0x76, 0xa8, 0x75, 0x30, 0x5b, 0xed, 0x5f, 0x36,
0xed, 0x24, 0x2c, 0x89, 0x00, 0xdd, 0x1f, 0xa9, 0x65, 0xbc, 0x95, 0x0d, 0xfc, 0xe0, 0x9b, 0x13, 0x22, 0x63, 0xa1, 0xee, 0xf5, 0x2d, 0xd6, 0x88, 0x8c, 0x30, 0x9f, 0x5a, 0x7d, 0x71, 0x28, 0x26 0xed, 0x24, 0x2c, 0x89, 0x00, 0xdd, 0x1f, 0xa9, 0x65, 0xbc, 0x95, 0x0d, 0xfc, 0xe0, 0x9b, 0x13, 0x22, 0x63, 0xa1, 0xee, 0xf5, 0x2d, 0xd6, 0x88, 0x8c, 0x30, 0x9f, 0x5a, 0x7d, 0x71, 0x28, 0x26
} }
}, },
{ {
@@ -171,8 +171,8 @@ XTS_TEST XTS_vectors[XTS_TEST_COUNT] = {
{ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 }, { 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 },
{ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 }, { 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 },
{ 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff }, { 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff },
0, 0,
{ {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 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xa9, 0x34, 0x11, 0x37, 0x3a, 0xaa, 0x82, 0x20 0xf6, 0x51, 0x61, 0x39, 0x42, 0x0f, 0xcf, 0xf3, 0xb7, 0x36, 0x1d, 0x86, 0x32, 0x2c, 0x4b, 0xd8, 0x4c, 0x82, 0xf3, 0x35, 0xab, 0xb1, 0x52, 0xc4, 0xa9, 0x34, 0x11, 0x37, 0x3a, 0xaa, 0x82, 0x20
} }
}, },
{ {
@@ -217,42 +217,42 @@ XTS_TEST XTS_vectors[XTS_TEST_COUNT] = {
{ 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 }, { 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27 },
{ 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 }, { 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92 },
{ 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff }, { 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff },
0, 0,
{ {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e,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b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0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0xd2, 0x73, 0xad, 0x5b, 0x0d, 0x59, 0x63, 0x1c, 0x53, 0x1f, 0x6a, 0x0a, 0x57, 0xb9
} }
} }; // XTS_TEST XTS_vectors[] } }; // XTS_TEST XTS_vectors[]
@@ -446,9 +446,9 @@ char *hmac_whirlpool_test_vectors =
"\x6a\xbf\xa4\x02" "\x6a\xbf\xa4\x02"
}; };
unsigned char ks_tmp[MAX_EXPANDED_KEY]; unsigned char ks_tmp[MAX_EXPANDED_KEY];
void CipherInit2(int cipher, void* key, void* ks, int key_len) void CipherInit2(int cipher, void* key, void* ks, int key_len)
{ {
switch (cipher) switch (cipher)
{ {
@@ -465,7 +465,7 @@ void CipherInit2(int cipher, void* key, void* ks, int key_len)
CipherInit(cipher,key,ks); CipherInit(cipher,key,ks);
break; break;
default: default:
/* Unknown/wrong ID */ /* Unknown/wrong ID */
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
} }
@@ -485,7 +485,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
int nTestsPerformed = 0; int nTestsPerformed = 0;
static unsigned char key1[] = static unsigned char key1[] =
{ {
0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27, 0x27, 0x18, 0x28, 0x18, 0x28, 0x45, 0x90, 0x45, 0x23, 0x53, 0x60, 0x28, 0x74, 0x71, 0x35, 0x26, 0x62, 0x49, 0x77, 0x57, 0x24, 0x70, 0x93, 0x69, 0x99, 0x59, 0x57, 0x49, 0x66, 0x96, 0x76, 0x27,
0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92, 0x31, 0x41, 0x59, 0x26, 0x53, 0x58, 0x97, 0x93, 0x23, 0x84, 0x62, 0x64, 0x33, 0x83, 0x27, 0x95, 0x02, 0x88, 0x41, 0x97, 0x16, 0x93, 0x99, 0x37, 0x51, 0x05, 0x82, 0x09, 0x74, 0x94, 0x45, 0x92,
0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13
@@ -501,8 +501,8 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
/* The buffer can accommodate 4 data units and we'll test 4 cases by "scrolling". The data unit 0xFFFFFFFFFF /* The buffer can accommodate 4 data units and we'll test 4 cases by "scrolling". The data unit 0xFFFFFFFFFF
will "move" from the start of the buffer to its end. For a 512-byte data unit, the byte offset 562949953420800 will "move" from the start of the buffer to its end. For a 512-byte data unit, the byte offset 562949953420800
corresponds to the data unit 0xFFFFFFFFFF. */ corresponds to the data unit 0xFFFFFFFFFF. */
for (writeOffset = 562949953420800ULL; for (writeOffset = 562949953420800ULL;
writeOffset > 562949953420800ULL - nbrUnits * ENCRYPTION_DATA_UNIT_SIZE; writeOffset > 562949953420800ULL - nbrUnits * ENCRYPTION_DATA_UNIT_SIZE;
writeOffset -= ENCRYPTION_DATA_UNIT_SIZE) writeOffset -= ENCRYPTION_DATA_UNIT_SIZE)
{ {
unitNo.Value = writeOffset / ENCRYPTION_DATA_UNIT_SIZE; unitNo.Value = writeOffset / ENCRYPTION_DATA_UNIT_SIZE;
@@ -529,8 +529,8 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
// Each data unit will contain the same plaintext // Each data unit will contain the same plaintext
for (i = 0; i < nbrUnits; i++) for (i = 0; i < nbrUnits; i++)
{ {
memcpy ((unsigned char *) buf + i * ENCRYPTION_DATA_UNIT_SIZE, memcpy ((unsigned char *) buf + i * ENCRYPTION_DATA_UNIT_SIZE,
XTS_vectors[XTS_TEST_COUNT-1].plaintext, XTS_vectors[XTS_TEST_COUNT-1].plaintext,
ENCRYPTION_DATA_UNIT_SIZE); ENCRYPTION_DATA_UNIT_SIZE);
} }
@@ -551,7 +551,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
// CRC of all data units in the buffer for each test case // CRC of all data units in the buffer for each test case
switch (testCase) switch (testCase)
{ {
case 0: case 0:
if (crc != 0x888f2990) if (crc != 0x888f2990)
return FALSE; return FALSE;
nTestsPerformed++; nTestsPerformed++;
@@ -792,8 +792,8 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci)
// Each data unit will contain the same plaintext // Each data unit will contain the same plaintext
for (i = 0; i < nbrUnits; i++) for (i = 0; i < nbrUnits; i++)
{ {
memcpy ((unsigned char *) buf + i * ENCRYPTION_DATA_UNIT_SIZE, memcpy ((unsigned char *) buf + i * ENCRYPTION_DATA_UNIT_SIZE,
XTS_vectors[XTS_TEST_COUNT-1].plaintext, XTS_vectors[XTS_TEST_COUNT-1].plaintext,
ENCRYPTION_DATA_UNIT_SIZE); ENCRYPTION_DATA_UNIT_SIZE);
} }
@@ -881,7 +881,7 @@ static BOOL DoAutoTestAlgorithms (void)
/* AES */ /* AES */
for (i = 0; i < AES_TEST_COUNT; i++) for (i = 0; i < AES_TEST_COUNT; i++)
{ {
int cipher = AES; int cipher = AES;
memcpy(key, aes_ecb_vectors[i].key, 32); memcpy(key, aes_ecb_vectors[i].key, 32);
memcpy(tmp, aes_ecb_vectors[i].plaintext, 16); memcpy(tmp, aes_ecb_vectors[i].plaintext, 16);
@@ -926,7 +926,7 @@ static BOOL DoAutoTestAlgorithms (void)
/* Serpent */ /* Serpent */
for (i = 0; i < SERPENT_TEST_COUNT; i++) for (i = 0; i < SERPENT_TEST_COUNT; i++)
{ {
int cipher = SERPENT; int cipher = SERPENT;
memcpy(key, serpent_vectors[i].key, 32); memcpy(key, serpent_vectors[i].key, 32);
memcpy(tmp, serpent_vectors[i].plaintext, 16); memcpy(tmp, serpent_vectors[i].plaintext, 16);
@@ -947,7 +947,7 @@ static BOOL DoAutoTestAlgorithms (void)
/* Twofish */ /* Twofish */
for (i = 0; i < TWOFISH_TEST_COUNT; i++) for (i = 0; i < TWOFISH_TEST_COUNT; i++)
{ {
int cipher = TWOFISH; int cipher = TWOFISH;
memcpy(key, twofish_vectors[i].key, 32); memcpy(key, twofish_vectors[i].key, 32);
memcpy(tmp, twofish_vectors[i].plaintext, 16); memcpy(tmp, twofish_vectors[i].plaintext, 16);
@@ -964,7 +964,7 @@ static BOOL DoAutoTestAlgorithms (void)
if (i != TWOFISH_TEST_COUNT) if (i != TWOFISH_TEST_COUNT)
bFailed = TRUE; bFailed = TRUE;
/* PKCS #5 and HMACs */ /* PKCS #5 and HMACs */
if (!test_pkcs5 ()) if (!test_pkcs5 ())
bFailed = TRUE; bFailed = TRUE;
@@ -986,7 +986,7 @@ static BOOL DoAutoTestAlgorithms (void)
/* Sector and buffer related algorithms */ /* Sector and buffer related algorithms */
if (!TestSectorBufEncryption (ci)) if (!TestSectorBufEncryption (ci))
bFailed = TRUE; bFailed = TRUE;
crypto_close (ci); crypto_close (ci);
return !bFailed; return !bFailed;
} }

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -15,7 +15,7 @@
extern "C" { extern "C" {
#endif #endif
extern unsigned char ks_tmp[MAX_EXPANDED_KEY]; extern unsigned char ks_tmp[MAX_EXPANDED_KEY];
void CipherInit2(int cipher, void* key, void* ks, int key_len); void CipherInit2(int cipher, void* key, void* ks, int key_len);
BOOL test_hmac_sha512 (void); BOOL test_hmac_sha512 (void);

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -243,7 +243,7 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int
} }
#endif #endif
} }
#ifndef DEVICE_DRIVER #ifndef DEVICE_DRIVER
VirtualLock (&keyInfo, sizeof (keyInfo)); VirtualLock (&keyInfo, sizeof (keyInfo));
VirtualLock (&dk, sizeof (dk)); VirtualLock (&dk, sizeof (dk));
@@ -256,7 +256,7 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int
// Test all available PKCS5 PRFs // Test all available PKCS5 PRFs
for (enqPkcs5Prf = FIRST_PRF_ID; enqPkcs5Prf <= LAST_PRF_ID || queuedWorkItems > 0; ++enqPkcs5Prf) for (enqPkcs5Prf = FIRST_PRF_ID; enqPkcs5Prf <= LAST_PRF_ID || queuedWorkItems > 0; ++enqPkcs5Prf)
{ {
// if a PRF is specified, we skip all other PRFs // if a PRF is specified, we skip all other PRFs
if (selected_pkcs5_prf != 0 && enqPkcs5Prf != selected_pkcs5_prf) if (selected_pkcs5_prf != 0 && enqPkcs5Prf != selected_pkcs5_prf)
continue; continue;
@@ -282,7 +282,7 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int
EncryptionThreadPoolBeginKeyDerivation (&keyDerivationCompletedEvent, &noOutstandingWorkItemEvent, EncryptionThreadPoolBeginKeyDerivation (&keyDerivationCompletedEvent, &noOutstandingWorkItemEvent,
&item->KeyReady, &outstandingWorkItemCount, enqPkcs5Prf, keyInfo.userKey, &item->KeyReady, &outstandingWorkItemCount, enqPkcs5Prf, keyInfo.userKey,
keyInfo.keyLength, keyInfo.salt, get_pkcs5_iteration_count (enqPkcs5Prf, pim, truecryptMode, bBoot), item->DerivedKey); keyInfo.keyLength, keyInfo.salt, get_pkcs5_iteration_count (enqPkcs5Prf, pim, truecryptMode, bBoot), item->DerivedKey);
++queuedWorkItems; ++queuedWorkItems;
break; break;
} }
@@ -345,10 +345,10 @@ KeyReady: ;
PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize()); PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize());
break; break;
default: default:
// Unknown/wrong ID // Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
} }
} }
// Test all available modes of operation // Test all available modes of operation
@@ -401,7 +401,7 @@ KeyReady: ;
// Copy the header for decryption // Copy the header for decryption
memcpy (header, encryptedHeader, sizeof (header)); memcpy (header, encryptedHeader, sizeof (header));
// Try to decrypt header // Try to decrypt header
DecryptBuffer (header + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, cryptoInfo); DecryptBuffer (header + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, cryptoInfo);
@@ -413,7 +413,7 @@ KeyReady: ;
// Header version // Header version
headerVersion = GetHeaderField16 (header, TC_HEADER_OFFSET_VERSION); headerVersion = GetHeaderField16 (header, TC_HEADER_OFFSET_VERSION);
if (headerVersion > VOLUME_HEADER_VERSION) if (headerVersion > VOLUME_HEADER_VERSION)
{ {
status = ERR_NEW_VERSION_REQUIRED; status = ERR_NEW_VERSION_REQUIRED;
@@ -471,7 +471,7 @@ KeyReady: ;
// Volume size // Volume size
cryptoInfo->VolumeSize = GetHeaderField64 (header, TC_HEADER_OFFSET_VOLUME_SIZE); cryptoInfo->VolumeSize = GetHeaderField64 (header, TC_HEADER_OFFSET_VOLUME_SIZE);
// Encrypted area size and length // Encrypted area size and length
cryptoInfo->EncryptedAreaStart = GetHeaderField64 (header, TC_HEADER_OFFSET_ENCRYPTED_AREA_START); cryptoInfo->EncryptedAreaStart = GetHeaderField64 (header, TC_HEADER_OFFSET_ENCRYPTED_AREA_START);
cryptoInfo->EncryptedAreaLength = GetHeaderField64 (header, TC_HEADER_OFFSET_ENCRYPTED_AREA_LENGTH); cryptoInfo->EncryptedAreaLength = GetHeaderField64 (header, TC_HEADER_OFFSET_ENCRYPTED_AREA_LENGTH);
@@ -493,7 +493,7 @@ KeyReady: ;
goto err; goto err;
} }
// Preserve scheduled header keys if requested // Preserve scheduled header keys if requested
if (retHeaderCryptoInfo) if (retHeaderCryptoInfo)
{ {
if (retInfo == NULL) if (retInfo == NULL)
@@ -557,7 +557,7 @@ err:
if (cryptoInfo != retHeaderCryptoInfo) if (cryptoInfo != retHeaderCryptoInfo)
{ {
crypto_close(cryptoInfo); crypto_close(cryptoInfo);
*retInfo = NULL; *retInfo = NULL;
} }
ret: ret:
@@ -601,7 +601,7 @@ void ComputeBootloaderFingerprint (byte *bootLoaderBuf, unsigned int bootLoaderS
WHIRLPOOL_CTX whirlpool; WHIRLPOOL_CTX whirlpool;
sha512_ctx sha2; sha512_ctx sha2;
WHIRLPOOL_init (&whirlpool); WHIRLPOOL_init (&whirlpool);
sha512_begin (&sha2); sha512_begin (&sha2);
@@ -690,9 +690,9 @@ int ReadVolumeHeader (BOOL bBoot, char *header, Password *password, int pim, PCR
EAInit (cryptoInfo->ea, dk + EAGetKeySize (cryptoInfo->ea), cryptoInfo->ks2); EAInit (cryptoInfo->ea, dk + EAGetKeySize (cryptoInfo->ea), cryptoInfo->ks2);
#endif #endif
// Try to decrypt header // Try to decrypt header
DecryptBuffer (header + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, cryptoInfo); DecryptBuffer (header + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, cryptoInfo);
// Check magic 'VERA' and CRC-32 of header fields and master keydata // Check magic 'VERA' and CRC-32 of header fields and master keydata
if (GetHeaderField32 (header, TC_HEADER_OFFSET_MAGIC) != 0x56455241 if (GetHeaderField32 (header, TC_HEADER_OFFSET_MAGIC) != 0x56455241
|| (GetHeaderField16 (header, TC_HEADER_OFFSET_VERSION) >= 4 && GetHeaderField32 (header, TC_HEADER_OFFSET_HEADER_CRC) != GetCrc32 (header + TC_HEADER_OFFSET_MAGIC, TC_HEADER_OFFSET_HEADER_CRC - TC_HEADER_OFFSET_MAGIC)) || (GetHeaderField16 (header, TC_HEADER_OFFSET_VERSION) >= 4 && GetHeaderField32 (header, TC_HEADER_OFFSET_HEADER_CRC) != GetCrc32 (header + TC_HEADER_OFFSET_MAGIC, TC_HEADER_OFFSET_HEADER_CRC - TC_HEADER_OFFSET_MAGIC))
@@ -774,7 +774,7 @@ err:
if (cryptoInfo != retHeaderCryptoInfo) if (cryptoInfo != retHeaderCryptoInfo)
{ {
crypto_close(cryptoInfo); crypto_close(cryptoInfo);
*retInfo = NULL; *retInfo = NULL;
} }
ret: ret:
@@ -844,7 +844,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
memcpy (keyInfo.master_keydata, masterKeydata, MASTER_KEYDATA_SIZE); memcpy (keyInfo.master_keydata, masterKeydata, MASTER_KEYDATA_SIZE);
} }
// User key // User key
memcpy (keyInfo.userKey, password->Text, nUserKeyLen); memcpy (keyInfo.userKey, password->Text, nUserKeyLen);
keyInfo.keyLength = nUserKeyLen; keyInfo.keyLength = nUserKeyLen;
keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, pim, FALSE, bBoot); keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, pim, FALSE, bBoot);
@@ -863,7 +863,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
// Salt for header key derivation // Salt for header key derivation
if (!RandgetBytes (hwndDlg, keyInfo.salt, PKCS5_SALT_SIZE, !bWipeMode)) if (!RandgetBytes (hwndDlg, keyInfo.salt, PKCS5_SALT_SIZE, !bWipeMode))
return ERR_CIPHER_INIT_WEAK_KEY; return ERR_CIPHER_INIT_WEAK_KEY;
// PBKDF2 (PKCS5) is used to derive primary header key(s) and secondary header key(s) (XTS) from the password/keyfiles // PBKDF2 (PKCS5) is used to derive primary header key(s) and secondary header key(s) (XTS) from the password/keyfiles
switch (pkcs5_prf) switch (pkcs5_prf)
@@ -888,15 +888,15 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize()); PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize());
break; break;
default: default:
// Unknown/wrong ID // Unknown/wrong ID
TC_THROW_FATAL_EXCEPTION; TC_THROW_FATAL_EXCEPTION;
} }
/* Header setup */ /* Header setup */
// Salt // Salt
mputBytes (p, keyInfo.salt, PKCS5_SALT_SIZE); mputBytes (p, keyInfo.salt, PKCS5_SALT_SIZE);
// Magic // Magic
mputLong (p, 0x56455241); mputLong (p, 0x56455241);
@@ -985,7 +985,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea,
/* cryptoInfo setup for further use (disk format) */ /* cryptoInfo setup for further use (disk format) */
// Init with the master key(s) // Init with the master key(s)
retVal = EAInit (cryptoInfo->ea, keyInfo.master_keydata + primaryKeyOffset, cryptoInfo->ks); retVal = EAInit (cryptoInfo->ea, keyInfo.master_keydata + primaryKeyOffset, cryptoInfo->ks);
if (retVal != ERR_SUCCESS) if (retVal != ERR_SUCCESS)
return retVal; return retVal;
@@ -1080,7 +1080,7 @@ BOOL ReadEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header, DW
return FALSE; return FALSE;
memcpy (header, sectorBuffer, min (*bytesRead, TC_VOLUME_HEADER_EFFECTIVE_SIZE)); memcpy (header, sectorBuffer, min (*bytesRead, TC_VOLUME_HEADER_EFFECTIVE_SIZE));
if (*bytesRead > TC_VOLUME_HEADER_EFFECTIVE_SIZE) if (*bytesRead > TC_VOLUME_HEADER_EFFECTIVE_SIZE)
*bytesRead = TC_VOLUME_HEADER_EFFECTIVE_SIZE; *bytesRead = TC_VOLUME_HEADER_EFFECTIVE_SIZE;
@@ -1181,7 +1181,7 @@ int WriteRandomDataToReservedHeaderAreas (HWND hwndDlg, HANDLE dev, CRYPTO_INFO
if (!RandgetBytes (hwndDlg, temporaryKey, EAGetKeySize (cryptoInfo->ea), FALSE) if (!RandgetBytes (hwndDlg, temporaryKey, EAGetKeySize (cryptoInfo->ea), FALSE)
|| !RandgetBytes (hwndDlg, cryptoInfo->k2, sizeof (cryptoInfo->k2), FALSE)) || !RandgetBytes (hwndDlg, cryptoInfo->k2, sizeof (cryptoInfo->k2), FALSE))
{ {
nStatus = ERR_PARAMETER_INCORRECT; nStatus = ERR_PARAMETER_INCORRECT;
goto final_seq; goto final_seq;
} }

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -19,7 +19,7 @@ extern "C" {
#endif #endif
// Volume header version // Volume header version
#define VOLUME_HEADER_VERSION 0x0005 #define VOLUME_HEADER_VERSION 0x0005
// Version number written to volume header during format; // Version number written to volume header during format;
// specifies the minimum program version required to mount the volume // specifies the minimum program version required to mount the volume
@@ -101,7 +101,7 @@ extern "C" {
#define HEADER_SALT_OFFSET 0 #define HEADER_SALT_OFFSET 0
#define HEADER_ENCRYPTED_DATA_OFFSET PKCS5_SALT_SIZE #define HEADER_ENCRYPTED_DATA_OFFSET PKCS5_SALT_SIZE
#define HEADER_MASTER_KEYDATA_OFFSET 256 #define HEADER_MASTER_KEYDATA_OFFSET 256
#define TC_HEADER_OFFSET_MAGIC 64 #define TC_HEADER_OFFSET_MAGIC 64
#define TC_HEADER_OFFSET_VERSION 68 #define TC_HEADER_OFFSET_VERSION 68
#define TC_HEADER_OFFSET_REQUIRED_VERSION 70 #define TC_HEADER_OFFSET_REQUIRED_VERSION 70

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -172,7 +172,7 @@ char *XmlQuoteText (const char *textSrc, char *textDst, int textDstMaxSize)
if (textDstMaxSize == 0) if (textDstMaxSize == 0)
return NULL; return NULL;
while (*textSrc != 0 && textDst <= textDstLast) while (*textSrc != 0 && textDst <= textDstLast)
{ {
char c = *textSrc++; char c = *textSrc++;
switch (c) switch (c)
@@ -217,7 +217,7 @@ wchar_t *XmlQuoteTextW (const wchar_t *textSrc, wchar_t *textDst, int textDstMax
if (textDstMaxSize == 0) if (textDstMaxSize == 0)
return NULL; return NULL;
while (*textSrc != 0 && textDst <= textDstLast) while (*textSrc != 0 && textDst <= textDstLast)
{ {
wchar_t c = *textSrc++; wchar_t c = *textSrc++;
switch (c) switch (c)

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,14 +3,14 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
code distribution packages. code distribution packages.
*/ */
/* If native 64-bit data types are not available, define TC_NO_COMPILER_INT64. /* If native 64-bit data types are not available, define TC_NO_COMPILER_INT64.
For big-endian platforms define BYTE_ORDER as BIG_ENDIAN. */ For big-endian platforms define BYTE_ORDER as BIG_ENDIAN. */
@@ -37,7 +37,7 @@ For big-endian platforms define BYTE_ORDER as BIG_ENDIAN. */
// ks2: the secondary key schedule // ks2: the secondary key schedule
// startDataUnitNo: The sequential number of the data unit with which the buffer starts. // startDataUnitNo: The sequential number of the data unit with which the buffer starts.
// startCipherBlockNo: The sequential number of the first plaintext block to encrypt inside the data unit startDataUnitNo. // startCipherBlockNo: The sequential number of the first plaintext block to encrypt inside the data unit startDataUnitNo.
// When encrypting the data unit from its first block, startCipherBlockNo is 0. // When encrypting the data unit from its first block, startCipherBlockNo is 0.
// The startCipherBlockNo value applies only to the first data unit in the buffer; each successive // The startCipherBlockNo value applies only to the first data unit in the buffer; each successive
// data unit is encrypted from its first block. The start of the buffer does not have to be // data unit is encrypted from its first block. The start of the buffer does not have to be
// aligned with the start of a data unit. If it is aligned, startCipherBlockNo must be 0; if it // aligned with the start of a data unit. If it is aligned, startCipherBlockNo must be 0; if it
@@ -85,7 +85,7 @@ static void EncryptBufferXTSParallel (unsigned __int8 *buffer,
the shift of the highest byte results in a carry, 135 is XORed into the lowest byte. The value 135 is the shift of the highest byte results in a carry, 135 is XORed into the lowest byte. The value 135 is
derived from the modulus of the Galois Field (x^128+x^7+x^2+x+1). */ derived from the modulus of the Galois Field (x^128+x^7+x^2+x+1). */
// Convert the 64-bit data unit number into a little-endian 16-byte array. // Convert the 64-bit data unit number into a little-endian 16-byte array.
// Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes. // Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes.
dataUnitNo = startDataUnitNo->Value; dataUnitNo = startDataUnitNo->Value;
*((unsigned __int64 *) byteBufUnitNo) = LE64 (dataUnitNo); *((unsigned __int64 *) byteBufUnitNo) = LE64 (dataUnitNo);
@@ -107,7 +107,7 @@ static void EncryptBufferXTSParallel (unsigned __int8 *buffer,
whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; whiteningValuesPtr64 = finalInt64WhiteningValuesPtr;
whiteningValuePtr64 = (unsigned __int64 *) whiteningValue; whiteningValuePtr64 = (unsigned __int64 *) whiteningValue;
// Encrypt the data unit number using the secondary key (in order to generate the first // Encrypt the data unit number using the secondary key (in order to generate the first
// whitening value for this data unit) // whitening value for this data unit)
*whiteningValuePtr64 = *((unsigned __int64 *) byteBufUnitNo); *whiteningValuePtr64 = *((unsigned __int64 *) byteBufUnitNo);
*(whiteningValuePtr64 + 1) = 0; *(whiteningValuePtr64 + 1) = 0;
@@ -131,21 +131,21 @@ static void EncryptBufferXTSParallel (unsigned __int8 *buffer,
// Little-endian platforms // Little-endian platforms
finalCarry = finalCarry =
(*whiteningValuePtr64 & 0x8000000000000000) ? (*whiteningValuePtr64 & 0x8000000000000000) ?
135 : 0; 135 : 0;
*whiteningValuePtr64-- <<= 1; *whiteningValuePtr64-- <<= 1;
if (*whiteningValuePtr64 & 0x8000000000000000) if (*whiteningValuePtr64 & 0x8000000000000000)
*(whiteningValuePtr64 + 1) |= 1; *(whiteningValuePtr64 + 1) |= 1;
*whiteningValuePtr64 <<= 1; *whiteningValuePtr64 <<= 1;
#else #else
// Big-endian platforms // Big-endian platforms
finalCarry = finalCarry =
(*whiteningValuePtr64 & 0x80) ? (*whiteningValuePtr64 & 0x80) ?
135 : 0; 135 : 0;
@@ -154,7 +154,7 @@ static void EncryptBufferXTSParallel (unsigned __int8 *buffer,
whiteningValuePtr64--; whiteningValuePtr64--;
if (*whiteningValuePtr64 & 0x80) if (*whiteningValuePtr64 & 0x80)
*(whiteningValuePtr64 + 1) |= 0x0100000000000000; *(whiteningValuePtr64 + 1) |= 0x0100000000000000;
*whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1);
#endif #endif
@@ -176,7 +176,7 @@ static void EncryptBufferXTSParallel (unsigned __int8 *buffer,
// Actual encryption // Actual encryption
EncipherBlocks (cipher, dataUnitBufPtr, ks, endBlock - startBlock); EncipherBlocks (cipher, dataUnitBufPtr, ks, endBlock - startBlock);
bufPtr = dataUnitBufPtr; bufPtr = dataUnitBufPtr;
whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; whiteningValuesPtr64 = finalInt64WhiteningValuesPtr;
@@ -222,7 +222,7 @@ static void EncryptBufferXTSNonParallel (unsigned __int8 *buffer,
the shift of the highest byte results in a carry, 135 is XORed into the lowest byte. The value 135 is the shift of the highest byte results in a carry, 135 is XORed into the lowest byte. The value 135 is
derived from the modulus of the Galois Field (x^128+x^7+x^2+x+1). */ derived from the modulus of the Galois Field (x^128+x^7+x^2+x+1). */
// Convert the 64-bit data unit number into a little-endian 16-byte array. // Convert the 64-bit data unit number into a little-endian 16-byte array.
// Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes. // Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes.
dataUnitNo = startDataUnitNo->Value; dataUnitNo = startDataUnitNo->Value;
*((unsigned __int64 *) byteBufUnitNo) = LE64 (dataUnitNo); *((unsigned __int64 *) byteBufUnitNo) = LE64 (dataUnitNo);
@@ -243,7 +243,7 @@ static void EncryptBufferXTSNonParallel (unsigned __int8 *buffer,
whiteningValuePtr64 = (unsigned __int64 *) whiteningValue; whiteningValuePtr64 = (unsigned __int64 *) whiteningValue;
// Encrypt the data unit number using the secondary key (in order to generate the first // Encrypt the data unit number using the secondary key (in order to generate the first
// whitening value for this data unit) // whitening value for this data unit)
*whiteningValuePtr64 = *((unsigned __int64 *) byteBufUnitNo); *whiteningValuePtr64 = *((unsigned __int64 *) byteBufUnitNo);
*(whiteningValuePtr64 + 1) = 0; *(whiteningValuePtr64 + 1) = 0;
@@ -275,21 +275,21 @@ static void EncryptBufferXTSNonParallel (unsigned __int8 *buffer,
// Little-endian platforms // Little-endian platforms
finalCarry = finalCarry =
(*whiteningValuePtr64 & 0x8000000000000000) ? (*whiteningValuePtr64 & 0x8000000000000000) ?
135 : 0; 135 : 0;
*whiteningValuePtr64-- <<= 1; *whiteningValuePtr64-- <<= 1;
if (*whiteningValuePtr64 & 0x8000000000000000) if (*whiteningValuePtr64 & 0x8000000000000000)
*(whiteningValuePtr64 + 1) |= 1; *(whiteningValuePtr64 + 1) |= 1;
*whiteningValuePtr64 <<= 1; *whiteningValuePtr64 <<= 1;
#else #else
// Big-endian platforms // Big-endian platforms
finalCarry = finalCarry =
(*whiteningValuePtr64 & 0x80) ? (*whiteningValuePtr64 & 0x80) ?
135 : 0; 135 : 0;
@@ -298,7 +298,7 @@ static void EncryptBufferXTSNonParallel (unsigned __int8 *buffer,
whiteningValuePtr64--; whiteningValuePtr64--;
if (*whiteningValuePtr64 & 0x80) if (*whiteningValuePtr64 & 0x80)
*(whiteningValuePtr64 + 1) |= 0x0100000000000000; *(whiteningValuePtr64 + 1) |= 0x0100000000000000;
*whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1);
#endif #endif
@@ -353,7 +353,7 @@ static void DecryptBufferXTSParallel (unsigned __int8 *buffer,
unsigned __int64 *const finalInt64WhiteningValuesPtr = whiteningValuesPtr64 + sizeof (whiteningValues) / sizeof (*whiteningValuesPtr64) - 1; unsigned __int64 *const finalInt64WhiteningValuesPtr = whiteningValuesPtr64 + sizeof (whiteningValues) / sizeof (*whiteningValuesPtr64) - 1;
TC_LARGEST_COMPILER_UINT blockCount, dataUnitNo; TC_LARGEST_COMPILER_UINT blockCount, dataUnitNo;
// Convert the 64-bit data unit number into a little-endian 16-byte array. // Convert the 64-bit data unit number into a little-endian 16-byte array.
// Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes. // Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes.
dataUnitNo = startDataUnitNo->Value; dataUnitNo = startDataUnitNo->Value;
*((unsigned __int64 *) byteBufUnitNo) = LE64 (dataUnitNo); *((unsigned __int64 *) byteBufUnitNo) = LE64 (dataUnitNo);
@@ -375,7 +375,7 @@ static void DecryptBufferXTSParallel (unsigned __int8 *buffer,
whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; whiteningValuesPtr64 = finalInt64WhiteningValuesPtr;
whiteningValuePtr64 = (unsigned __int64 *) whiteningValue; whiteningValuePtr64 = (unsigned __int64 *) whiteningValue;
// Encrypt the data unit number using the secondary key (in order to generate the first // Encrypt the data unit number using the secondary key (in order to generate the first
// whitening value for this data unit) // whitening value for this data unit)
*whiteningValuePtr64 = *((unsigned __int64 *) byteBufUnitNo); *whiteningValuePtr64 = *((unsigned __int64 *) byteBufUnitNo);
*(whiteningValuePtr64 + 1) = 0; *(whiteningValuePtr64 + 1) = 0;
@@ -399,21 +399,21 @@ static void DecryptBufferXTSParallel (unsigned __int8 *buffer,
// Little-endian platforms // Little-endian platforms
finalCarry = finalCarry =
(*whiteningValuePtr64 & 0x8000000000000000) ? (*whiteningValuePtr64 & 0x8000000000000000) ?
135 : 0; 135 : 0;
*whiteningValuePtr64-- <<= 1; *whiteningValuePtr64-- <<= 1;
if (*whiteningValuePtr64 & 0x8000000000000000) if (*whiteningValuePtr64 & 0x8000000000000000)
*(whiteningValuePtr64 + 1) |= 1; *(whiteningValuePtr64 + 1) |= 1;
*whiteningValuePtr64 <<= 1; *whiteningValuePtr64 <<= 1;
#else #else
// Big-endian platforms // Big-endian platforms
finalCarry = finalCarry =
(*whiteningValuePtr64 & 0x80) ? (*whiteningValuePtr64 & 0x80) ?
135 : 0; 135 : 0;
@@ -422,7 +422,7 @@ static void DecryptBufferXTSParallel (unsigned __int8 *buffer,
whiteningValuePtr64--; whiteningValuePtr64--;
if (*whiteningValuePtr64 & 0x80) if (*whiteningValuePtr64 & 0x80)
*(whiteningValuePtr64 + 1) |= 0x0100000000000000; *(whiteningValuePtr64 + 1) |= 0x0100000000000000;
*whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1);
#endif #endif
@@ -481,7 +481,7 @@ static void DecryptBufferXTSNonParallel (unsigned __int8 *buffer,
unsigned int startBlock = startCipherBlockNo, endBlock, block; unsigned int startBlock = startCipherBlockNo, endBlock, block;
TC_LARGEST_COMPILER_UINT blockCount, dataUnitNo; TC_LARGEST_COMPILER_UINT blockCount, dataUnitNo;
// Convert the 64-bit data unit number into a little-endian 16-byte array. // Convert the 64-bit data unit number into a little-endian 16-byte array.
// Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes. // Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes.
dataUnitNo = startDataUnitNo->Value; dataUnitNo = startDataUnitNo->Value;
*((unsigned __int64 *) byteBufUnitNo) = LE64 (dataUnitNo); *((unsigned __int64 *) byteBufUnitNo) = LE64 (dataUnitNo);
@@ -502,7 +502,7 @@ static void DecryptBufferXTSNonParallel (unsigned __int8 *buffer,
whiteningValuePtr64 = (unsigned __int64 *) whiteningValue; whiteningValuePtr64 = (unsigned __int64 *) whiteningValue;
// Encrypt the data unit number using the secondary key (in order to generate the first // Encrypt the data unit number using the secondary key (in order to generate the first
// whitening value for this data unit) // whitening value for this data unit)
*whiteningValuePtr64 = *((unsigned __int64 *) byteBufUnitNo); *whiteningValuePtr64 = *((unsigned __int64 *) byteBufUnitNo);
*(whiteningValuePtr64 + 1) = 0; *(whiteningValuePtr64 + 1) = 0;
@@ -534,21 +534,21 @@ static void DecryptBufferXTSNonParallel (unsigned __int8 *buffer,
// Little-endian platforms // Little-endian platforms
finalCarry = finalCarry =
(*whiteningValuePtr64 & 0x8000000000000000) ? (*whiteningValuePtr64 & 0x8000000000000000) ?
135 : 0; 135 : 0;
*whiteningValuePtr64-- <<= 1; *whiteningValuePtr64-- <<= 1;
if (*whiteningValuePtr64 & 0x8000000000000000) if (*whiteningValuePtr64 & 0x8000000000000000)
*(whiteningValuePtr64 + 1) |= 1; *(whiteningValuePtr64 + 1) |= 1;
*whiteningValuePtr64 <<= 1; *whiteningValuePtr64 <<= 1;
#else #else
// Big-endian platforms // Big-endian platforms
finalCarry = finalCarry =
(*whiteningValuePtr64 & 0x80) ? (*whiteningValuePtr64 & 0x80) ?
135 : 0; 135 : 0;
@@ -557,7 +557,7 @@ static void DecryptBufferXTSNonParallel (unsigned __int8 *buffer,
whiteningValuePtr64--; whiteningValuePtr64--;
if (*whiteningValuePtr64 & 0x80) if (*whiteningValuePtr64 & 0x80)
*(whiteningValuePtr64 + 1) |= 0x0100000000000000; *(whiteningValuePtr64 + 1) |= 0x0100000000000000;
*whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1);
#endif #endif
@@ -581,7 +581,7 @@ static void DecryptBufferXTSNonParallel (unsigned __int8 *buffer,
#if BYTE_ORDER == BIG_ENDIAN #if BYTE_ORDER == BIG_ENDIAN
#error The TC_NO_COMPILER_INT64 version of the XTS code is not compatible with big-endian platforms #error The TC_NO_COMPILER_INT64 version of the XTS code is not compatible with big-endian platforms
#endif #endif
// Converts a 64-bit unsigned integer (passed as two 32-bit integers for compatibility with non-64-bit // Converts a 64-bit unsigned integer (passed as two 32-bit integers for compatibility with non-64-bit
@@ -627,7 +627,7 @@ static void EncryptDecryptBufferXTS32 (const unsigned __int8 *buffer,
blockCount = length / BYTES_PER_XTS_BLOCK; blockCount = length / BYTES_PER_XTS_BLOCK;
// Convert the 64-bit data unit number into a little-endian 16-byte array. // Convert the 64-bit data unit number into a little-endian 16-byte array.
// (Passed as two 32-bit integers for compatibility with non-64-bit environments/platforms.) // (Passed as two 32-bit integers for compatibility with non-64-bit environments/platforms.)
Uint64ToLE16ByteArray (byteBufUnitNo, dataUnitNo.HighPart, dataUnitNo.LowPart); Uint64ToLE16ByteArray (byteBufUnitNo, dataUnitNo.HighPart, dataUnitNo.LowPart);
@@ -639,7 +639,7 @@ static void EncryptDecryptBufferXTS32 (const unsigned __int8 *buffer,
else else
endBlock = BLOCKS_PER_XTS_DATA_UNIT; endBlock = BLOCKS_PER_XTS_DATA_UNIT;
// Encrypt the data unit number using the secondary key (in order to generate the first // Encrypt the data unit number using the secondary key (in order to generate the first
// whitening value for this data unit) // whitening value for this data unit)
memcpy (whiteningValue, byteBufUnitNo, BYTES_PER_XTS_BLOCK); memcpy (whiteningValue, byteBufUnitNo, BYTES_PER_XTS_BLOCK);
EncipherBlock (cipher, whiteningValue, ks2); EncipherBlock (cipher, whiteningValue, ks2);
@@ -690,7 +690,7 @@ static void EncryptDecryptBufferXTS32 (const unsigned __int8 *buffer,
// A regular carry // A regular carry
*(whiteningValuePtr32 + 1) |= 1; *(whiteningValuePtr32 + 1) |= 1;
} }
else else
{ {
// The highest byte shift will result in a carry // The highest byte shift will result in a carry
finalCarry = 135; finalCarry = 135;
@@ -712,7 +712,7 @@ static void EncryptDecryptBufferXTS32 (const unsigned __int8 *buffer,
dataUnitNo.HighPart++; dataUnitNo.HighPart++;
} }
// Convert the 64-bit data unit number into a little-endian 16-byte array. // Convert the 64-bit data unit number into a little-endian 16-byte array.
Uint64ToLE16ByteArray (byteBufUnitNo, dataUnitNo.HighPart, dataUnitNo.LowPart); Uint64ToLE16ByteArray (byteBufUnitNo, dataUnitNo.HighPart, dataUnitNo.LowPart);
} }

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -54,9 +54,9 @@ extern "C" {
#endif #endif
#ifndef TCDEFS_H #ifndef TCDEFS_H
typedef union typedef union
{ {
struct struct
{ {
unsigned __int32 LowPart; unsigned __int32 LowPart;
unsigned __int32 HighPart; unsigned __int32 HighPart;

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -157,7 +157,7 @@ namespace VeraCrypt
public: public:
WaitThreadUI(WaitThreadRoutine* pRoutine): m_pRoutine(pRoutine) {} WaitThreadUI(WaitThreadRoutine* pRoutine): m_pRoutine(pRoutine) {}
virtual ~WaitThreadUI() {} virtual ~WaitThreadUI() {}
virtual void Run(void) { m_pRoutine->ExecutionCode();} virtual void Run(void) { m_pRoutine->ExecutionCode();}
WaitThreadRoutine* m_pRoutine; WaitThreadRoutine* m_pRoutine;
}; };
} }

View File

@@ -3,7 +3,7 @@
# Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed # Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
# by the TrueCrypt License 3.0. # by the TrueCrypt License 3.0.
# #
# Modifications and additions to the original source code (contained in this file) # Modifications and additions to the original source code (contained in this file)
# and all other portions of this file are Copyright (c) 2013-2016 IDRIX # and all other portions of this file are Copyright (c) 2013-2016 IDRIX
# and are governed by the Apache License 2.0 the full text of which is # and are governed by the Apache License 2.0 the full text of which is
# contained in the file License.txt included in VeraCrypt binary and source # contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -79,7 +79,7 @@ namespace VeraCrypt
backupHeader = true; backupHeader = true;
} }
} }
void CoreBase::ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount) const void CoreBase::ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf, int wipeCount) const
{ {
shared_ptr <Volume> volume = OpenVolume (volumePath, preserveTimestamps, password, pim, kdf, truecryptMode, keyfiles); shared_ptr <Volume> volume = OpenVolume (volumePath, preserveTimestamps, password, pim, kdf, truecryptMode, keyfiles);
@@ -147,7 +147,7 @@ namespace VeraCrypt
outerVolume->ReadSectors (bootSectorBuffer, 0); outerVolume->ReadSectors (bootSectorBuffer, 0);
int fatType; int fatType;
byte *bootSector = bootSectorBuffer.Ptr(); byte *bootSector = bootSectorBuffer.Ptr();
if (memcmp (bootSector + 54, "FAT12", 5) == 0) if (memcmp (bootSector + 54, "FAT12", 5) == 0)
fatType = 12; fatType = 12;
@@ -260,7 +260,7 @@ namespace VeraCrypt
volume->Open (*volumePath, preserveTimestamps, password, pim, kdf, truecryptMode, keyfiles, protection, protectionPassword, protectionPim, protectionKdf, protectionKeyfiles, sharedAccessAllowed, volumeType, useBackupHeaders, partitionInSystemEncryptionScope); volume->Open (*volumePath, preserveTimestamps, password, pim, kdf, truecryptMode, keyfiles, protection, protectionPassword, protectionPim, protectionKdf, protectionKeyfiles, sharedAccessAllowed, volumeType, useBackupHeaders, partitionInSystemEncryptionScope);
return volume; return volume;
} }
void CoreBase::RandomizeEncryptionAlgorithmKey (shared_ptr <EncryptionAlgorithm> encryptionAlgorithm) const void CoreBase::RandomizeEncryptionAlgorithmKey (shared_ptr <EncryptionAlgorithm> encryptionAlgorithm) const
{ {
SecureBuffer eaKey (encryptionAlgorithm->GetKeySize()); SecureBuffer eaKey (encryptionAlgorithm->GetKeySize());

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -35,7 +35,7 @@ namespace VeraCrypt
virtual void ChangePassword (shared_ptr <Volume> openVolume, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const; virtual void ChangePassword (shared_ptr <Volume> openVolume, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const;
virtual void ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const; virtual void ChangePassword (shared_ptr <VolumePath> volumePath, bool preserveTimestamps, shared_ptr <VolumePassword> password, int pim, shared_ptr <Pkcs5Kdf> kdf, bool truecryptMode, shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> newPassword, int newPim, shared_ptr <KeyfileList> newKeyfiles, shared_ptr <Pkcs5Kdf> newPkcs5Kdf = shared_ptr <Pkcs5Kdf> (), int wipeCount = PRAND_HEADER_WIPE_PASSES) const;
virtual void CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair = false) const = 0; virtual void CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair = false) const = 0;
virtual void CoalesceSlotNumberAndMountPoint (MountOptions &options) const; virtual void CoalesceSlotNumberAndMountPoint (MountOptions &options) const;
virtual void CreateKeyfile (const FilePath &keyfilePath) const; virtual void CreateKeyfile (const FilePath &keyfilePath) const;
virtual void DismountFilesystem (const DirectoryPath &mountPoint, bool force) const = 0; virtual void DismountFilesystem (const DirectoryPath &mountPoint, bool force) const = 0;

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -1,11 +1,11 @@
/* /*
Legal Notice: Some portions of the source code contained in this file were Legal Notice: Some portions of the source code contained in this file were
derived from the source code of TrueCrypt 7.1a, which is derived from the source code of TrueCrypt 7.1a, which is
Copyright (c) 2003-2012 TrueCrypt Developers Association and which is Copyright (c) 2003-2012 TrueCrypt Developers Association and which is
governed by the TrueCrypt License 3.0, also from the source code of governed by the TrueCrypt License 3.0, also from the source code of
Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux Encryption for the Masses 2.02a, which is Copyright (c) 1998-2000 Paul Le Roux
and which is governed by the 'License Agreement for Encryption for the Masses' and which is governed by the 'License Agreement for Encryption for the Masses'
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -89,8 +89,8 @@ namespace VeraCrypt
ft->cluster_size = 1; ft->cluster_size = 1;
// Geometry always set to SECTORS/1/1 // Geometry always set to SECTORS/1/1
ft->secs_track = 1; ft->secs_track = 1;
ft->heads = 1; ft->heads = 1;
ft->dir_entries = 512; ft->dir_entries = 512;
ft->fats = 2; ft->fats = 2;
@@ -180,13 +180,13 @@ namespace VeraCrypt
cnt += 2; cnt += 2;
boot[cnt++] = (int8) ft->media; /* media byte */ boot[cnt++] = (int8) ft->media; /* media byte */
if(ft->size_fat == 32) if(ft->size_fat == 32)
{ {
boot[cnt++] = 0x00; boot[cnt++] = 0x00;
boot[cnt++] = 0x00; boot[cnt++] = 0x00;
} }
else else
{ {
*(uint16 *)(boot + cnt) = Endian::Little ((uint16) ft->fat_length); /* fat size */ *(uint16 *)(boot + cnt) = Endian::Little ((uint16) ft->fat_length); /* fat size */
cnt += 2; cnt += 2;
} }
@@ -248,13 +248,13 @@ namespace VeraCrypt
{ {
memset (sector, 0, ft->sector_size); memset (sector, 0, ft->sector_size);
sector[3] = 0x41; /* LeadSig */ sector[3] = 0x41; /* LeadSig */
sector[2] = 0x61; sector[2] = 0x61;
sector[1] = 0x52; sector[1] = 0x52;
sector[0] = 0x52; sector[0] = 0x52;
sector[484+3] = 0x61; /* StrucSig */ sector[484+3] = 0x61; /* StrucSig */
sector[484+2] = 0x41; sector[484+2] = 0x41;
sector[484+1] = 0x72; sector[484+1] = 0x72;
sector[484+0] = 0x72; sector[484+0] = 0x72;
// Free cluster count // Free cluster count
*(uint32 *)(sector + 488) = Endian::Little (ft->cluster_count - ft->size_root_dir / ft->sector_size / ft->cluster_size); *(uint32 *)(sector + 488) = Endian::Little (ft->cluster_count - ft->size_root_dir / ft->sector_size / ft->cluster_size);
@@ -283,7 +283,7 @@ namespace VeraCrypt
fatParams.num_sectors = (uint32) (deviceSize / fatParams.sector_size); fatParams.num_sectors = (uint32) (deviceSize / fatParams.sector_size);
fatParams.cluster_size = clusterSize / fatParams.sector_size; fatParams.cluster_size = clusterSize / fatParams.sector_size;
memcpy (fatParams.volume_name, "NO NAME ", 11); memcpy (fatParams.volume_name, "NO NAME ", 11);
GetFatParams (&fatParams); GetFatParams (&fatParams);
fatparams *ft = &fatParams; fatparams *ft = &fatParams;
SecureBuffer sector (ft->sector_size); SecureBuffer sector (ft->sector_size);
@@ -300,7 +300,7 @@ namespace VeraCrypt
writeSector (sector); ++sectorNumber; writeSector (sector); ++sectorNumber;
/* fat32 boot area */ /* fat32 boot area */
if (ft->size_fat == 32) if (ft->size_fat == 32)
{ {
/* fsinfo */ /* fsinfo */
PutFSInfo((byte *) sector, ft); PutFSInfo((byte *) sector, ft);
@@ -351,7 +351,7 @@ namespace VeraCrypt
fat_sig[8] = fat_sig[9] = fat_sig[10] = 0xff; fat_sig[8] = fat_sig[9] = fat_sig[10] = 0xff;
fat_sig[11] = 0x0f; fat_sig[11] = 0x0f;
memcpy (sector, fat_sig, 12); memcpy (sector, fat_sig, 12);
} }
else if (ft->size_fat == 16) else if (ft->size_fat == 16)
{ {
fat_sig[0] = (byte) ft->media; fat_sig[0] = (byte) ft->media;

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -41,7 +41,7 @@ namespace VeraCrypt
sr.Serialize ("Removable", Removable); sr.Serialize ("Removable", Removable);
sr.Serialize ("Size", Size); sr.Serialize ("Size", Size);
sr.Serialize ("SystemNumber", SystemNumber); sr.Serialize ("SystemNumber", SystemNumber);
sr.Serialize ("Partitions", (uint32) Partitions.size()); sr.Serialize ("Partitions", (uint32) Partitions.size());
foreach_ref (const HostDevice &partition, Partitions) foreach_ref (const HostDevice &partition, Partitions)
partition.Serialize (stream); partition.Serialize (stream);

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source

View File

@@ -3,7 +3,7 @@
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
by the TrueCrypt License 3.0. by the TrueCrypt License 3.0.
Modifications and additions to the original source code (contained in this file) Modifications and additions to the original source code (contained in this file)
and all other portions of this file are Copyright (c) 2013-2016 IDRIX and all other portions of this file are Copyright (c) 2013-2016 IDRIX
and are governed by the Apache License 2.0 the full text of which is and are governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source contained in the file License.txt included in VeraCrypt binary and source
@@ -102,14 +102,14 @@ namespace VeraCrypt
sr.Deserialize ("UseBackupHeaders", UseBackupHeaders); sr.Deserialize ("UseBackupHeaders", UseBackupHeaders);
sr.Deserialize ("TrueCryptMode", TrueCryptMode); sr.Deserialize ("TrueCryptMode", TrueCryptMode);
try try
{ {
if (!sr.DeserializeBool ("KdfNull")) if (!sr.DeserializeBool ("KdfNull"))
{ {
sr.Deserialize ("Kdf", nameValue); sr.Deserialize ("Kdf", nameValue);
Kdf = Pkcs5Kdf::GetAlgorithm (nameValue, TrueCryptMode); Kdf = Pkcs5Kdf::GetAlgorithm (nameValue, TrueCryptMode);
} }
} }
catch(...) {} catch(...) {}
@@ -122,7 +122,7 @@ namespace VeraCrypt
} }
} }
catch(...) {} catch(...) {}
sr.Deserialize ("Pim", Pim); sr.Deserialize ("Pim", Pim);
sr.Deserialize ("ProtectionPim", ProtectionPim); sr.Deserialize ("ProtectionPim", ProtectionPim);
} }
@@ -144,7 +144,7 @@ namespace VeraCrypt
sr.Serialize ("NoFilesystem", NoFilesystem); sr.Serialize ("NoFilesystem", NoFilesystem);
sr.Serialize ("NoHardwareCrypto", NoHardwareCrypto); sr.Serialize ("NoHardwareCrypto", NoHardwareCrypto);
sr.Serialize ("NoKernelCrypto", NoKernelCrypto); sr.Serialize ("NoKernelCrypto", NoKernelCrypto);
sr.Serialize ("PasswordNull", Password == nullptr); sr.Serialize ("PasswordNull", Password == nullptr);
if (Password) if (Password)
Password->Serialize (stream); Password->Serialize (stream);
@@ -176,7 +176,7 @@ namespace VeraCrypt
sr.Serialize ("ProtectionKdfNull", ProtectionKdf == nullptr); sr.Serialize ("ProtectionKdfNull", ProtectionKdf == nullptr);
if (ProtectionKdf) if (ProtectionKdf)
sr.Serialize ("ProtectionKdf", ProtectionKdf->GetName()); sr.Serialize ("ProtectionKdf", ProtectionKdf->GetName());
sr.Serialize ("Pim", Pim); sr.Serialize ("Pim", Pim);
sr.Serialize ("ProtectionPim", ProtectionPim); sr.Serialize ("ProtectionPim", ProtectionPim);
} }

Some files were not shown because too many files have changed in this diff Show More