diff options
author | David Foerster <david.foerster@informatik.hu-berlin.de> | 2016-05-10 22:16:32 +0200 |
---|---|---|
committer | David Foerster <david.foerster@informatik.hu-berlin.de> | 2016-05-10 22:18:34 +0200 |
commit | 11716ed2dacbb104f8f59867fe66f2c0a6984291 (patch) | |
tree | 28aa448de2e790d0f40dc57799a55a9df12ee6fb | |
parent | 191075155835172e5596e191cf0679ff9022f0fd (diff) | |
download | VeraCrypt-11716ed2dacbb104f8f59867fe66f2c0a6984291.tar.gz VeraCrypt-11716ed2dacbb104f8f59867fe66f2c0a6984291.zip |
Remove trailing whitespace
408 files changed, 4420 insertions, 4420 deletions
@@ -17,16 +17,16 @@ called 'TrueCrypt' or 'VeraCrypt' Contents ======== -I. Windows - Requirements for Building VeraCrypt for Windows - Instructions for Building VeraCrypt for Windows +I. Windows + Requirements for Building VeraCrypt for Windows + Instructions for Building VeraCrypt for Windows Instructions for Signing and Packaging VeraCrypt for Windows -II. 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 +II. 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 Mac OS X specifics - + III. FreeBSD and OpenSolaris 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 (i.e. all certificates in the relevant certification chain, such as the certification authority certificates, CA-MS cross-certificate, and the -IDRIX certificate). +IDRIX certificate). Keep this in mind if you compile VeraCrypt and compare your binaries with the official binaries. If your binaries are 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 for Windows 8.1 installation directory. -The folder "Signing" contains a batch file (sign.bat) that will sign all -VeraCrypt components using a code signing certificate present on the +The folder "Signing" contains a batch file (sign.bat) that will sign all +VeraCrypt components using a code signing certificate present on the certificate store and also build the final installation setup. 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, -then you should put the Root and Intermediate certificates in the "Signing" +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" 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/) - 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). - 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'. + 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'. 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 command to configure the wxWidgets static library for VeraCrypt and to - build it: + build it: $ make WXSTATIC=1 WX_ROOT=/usr/src/wxWidgets wxbuild @@ -159,7 +159,7 @@ Instructions for Building VeraCrypt for Linux and Mac OS X: $ make or if you have no wxWidgets shared library installed: - + $ make WXSTATIC=1 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 - + On MacOSX, building a console-only executable is not supported. Mac OS X specifics: ----------------------------------------------------------- - + 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: - + $ export VC_OSX_TARGET=10.6 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 -compile using the following commands : +compile using the following commands : $ ./configure --with-internal-glib $ make @@ -195,9 +195,9 @@ compile using the following commands : After making sure pkg-config is available, download and install OSXFuse from 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 -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" 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: 1) That the feature has not been implemented (we may have already implemented - it, but haven't released the code yet). -2) That the feature is acceptable. + it, but haven't released the code yet). +2) That the feature is acceptable. 3) Whether we need help of third-party developers with implementing the feature. Information on how to contact us can be found at: @@ -253,7 +253,7 @@ source code. 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. diff --git a/Translations/Language.pl.xml b/Translations/Language.pl.xml index 670b9737..f8869f15 100644 --- a/Translations/Language.pl.xml +++ b/Translations/Language.pl.xml @@ -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_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_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> <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' > '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> diff --git a/src/Boot/Windows/Bios.h b/src/Boot/Windows/Bios.h index dd2da6be..e6f9ec89 100644 --- a/src/Boot/Windows/Bios.h +++ b/src/Boot/Windows/Bios.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/BootCommon.h b/src/Boot/Windows/BootCommon.h index 1dc86560..0d4f710d 100644 --- a/src/Boot/Windows/BootCommon.h +++ b/src/Boot/Windows/BootCommon.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/BootConfig.cpp b/src/Boot/Windows/BootConfig.cpp index 75baf19e..3e41d610 100644 --- a/src/Boot/Windows/BootConfig.cpp +++ b/src/Boot/Windows/BootConfig.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/BootConfig.h b/src/Boot/Windows/BootConfig.h index 0a06a987..428d713c 100644 --- a/src/Boot/Windows/BootConfig.h +++ b/src/Boot/Windows/BootConfig.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/BootConsoleIo.cpp b/src/Boot/Windows/BootConsoleIo.cpp index 8b5a1905..2fee84fc 100644 --- a/src/Boot/Windows/BootConsoleIo.cpp +++ b/src/Boot/Windows/BootConsoleIo.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -84,7 +84,7 @@ void Print (uint32 number) number /= 10; } str[pos] = (char) (number % 10) + '0'; - + while (pos >= 0) PrintChar (str[pos--]); } @@ -251,7 +251,7 @@ byte GetKeyboardChar (byte *scanCode) mov asciiCode, al mov scan, ah } - + if (scanCode) *scanCode = scan; @@ -327,7 +327,7 @@ int GetString (char *buffer, size_t bufferSize) if (scanCode == TC_BIOS_KEY_ENTER) break; - + if (scanCode == TC_BIOS_KEY_ESC) return 0; diff --git a/src/Boot/Windows/BootConsoleIo.h b/src/Boot/Windows/BootConsoleIo.h index b95036d5..52a054fe 100644 --- a/src/Boot/Windows/BootConsoleIo.h +++ b/src/Boot/Windows/BootConsoleIo.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/BootCrt.asm b/src/Boot/Windows/BootCrt.asm index fd2c2ef0..92ac1563 100644 --- a/src/Boot/Windows/BootCrt.asm +++ b/src/Boot/Windows/BootCrt.asm @@ -3,7 +3,7 @@ ; Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed ; 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 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 diff --git a/src/Boot/Windows/BootDebug.cpp b/src/Boot/Windows/BootDebug.cpp index 2c796437..dd0863a0 100644 --- a/src/Boot/Windows/BootDebug.cpp +++ b/src/Boot/Windows/BootDebug.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -61,12 +61,12 @@ void PrintVal (const char *message, const uint32 value, bool newLine, bool hex) { Print (message); Print (": "); - + if (hex) PrintHex (value); else Print (value); - + if (newLine) PrintEndl(); } diff --git a/src/Boot/Windows/BootDebug.h b/src/Boot/Windows/BootDebug.h index a10c7fec..e7ae4134 100644 --- a/src/Boot/Windows/BootDebug.h +++ b/src/Boot/Windows/BootDebug.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/BootDefs.h b/src/Boot/Windows/BootDefs.h index 2e69d5a3..1fc923ae 100644 --- a/src/Boot/Windows/BootDefs.h +++ b/src/Boot/Windows/BootDefs.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -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 #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 -# 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 #define TC__COM_EXECUTABLE_OFFSET TC_HEX (100) diff --git a/src/Boot/Windows/BootDiskIo.cpp b/src/Boot/Windows/BootDiskIo.cpp index bf3fe9fc..15d6f711 100644 --- a/src/Boot/Windows/BootDiskIo.cpp +++ b/src/Boot/Windows/BootDiskIo.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -201,7 +201,7 @@ static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, byte d dapPacket.Sector = sector; byte function = write ? 0x43 : 0x42; - + BiosResult result; byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES; @@ -261,7 +261,7 @@ BiosResult ReadSectors (byte *buffer, byte drive, const uint64 §or, uint16 s BiosResult result; uint16 codeSeg; __asm mov codeSeg, cs - + 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 @@ -389,13 +389,13 @@ BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t par PartitionEntryMBR mbrPartitions[4]; memcpy (mbrPartitions, mbr->Partitions, sizeof (mbrPartitions)); size_t partitionArrayPos = 0, partitionNumber; - + for (partitionNumber = 0; partitionNumber < array_capacity (mbrPartitions) && partitionArrayPos < partitionArrayCapacity; ++partitionNumber) { const PartitionEntryMBR &partEntry = mbrPartitions[partitionNumber]; - + if (partEntry.SectorCountLBA > 0) { Partition &partition = partitionArray[partitionArrayPos]; @@ -486,6 +486,6 @@ bool GetActivePartition (byte drive) PrintError (TC_BOOT_STR_NO_BOOT_PARTITION); return false; } - + return true; } diff --git a/src/Boot/Windows/BootDiskIo.h b/src/Boot/Windows/BootDiskIo.h index b09220a8..ad9d1437 100644 --- a/src/Boot/Windows/BootDiskIo.h +++ b/src/Boot/Windows/BootDiskIo.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/BootEncryptedIo.cpp b/src/Boot/Windows/BootEncryptedIo.cpp index 84a4bf14..63fd0f47 100644 --- a/src/Boot/Windows/BootEncryptedIo.cpp +++ b/src/Boot/Windows/BootEncryptedIo.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/BootEncryptedIo.h b/src/Boot/Windows/BootEncryptedIo.h index 6402e705..d27ec9ea 100644 --- a/src/Boot/Windows/BootEncryptedIo.h +++ b/src/Boot/Windows/BootEncryptedIo.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/BootMain.cpp b/src/Boot/Windows/BootMain.cpp index 24acd23f..57697a4f 100644 --- a/src/Boot/Windows/BootMain.cpp +++ b/src/Boot/Windows/BootMain.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -72,7 +72,7 @@ static void PrintMainMenu () Print ((BootSectorFlags & TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE) != TC_HIDDEN_OS_CREATION_PHASE_NONE ? "Boot Non-Hidden System (Boot Manager)" : "Skip Authentication (Boot Manager)"); - + #else // TC_WINDOWS_BOOT_RESCUE_DISK_MODE Print ("Skip Authentication (Boot Manager)"); @@ -184,7 +184,7 @@ static byte AskPassword (Password &password, int& pim) ClearBiosKeystrokeBuffer(); PrintEndl(); - + break; case TC_BIOS_KEY_BACKSPACE: @@ -262,7 +262,7 @@ static byte AskPassword (Password &password, int& pim) ClearBiosKeystrokeBuffer(); PrintEndl(); - + return TC_BIOS_KEY_ENTER; case TC_BIOS_KEY_BACKSPACE: @@ -301,7 +301,7 @@ static byte AskPassword (Password &password, int& pim) pim = 10*pim + (asciiCode - '0'); pos++; - + if (hidePassword) asciiCode = '*'; if (pos < MAX_PIM) PrintChar (asciiCode); @@ -343,7 +343,7 @@ static bool OpenVolume (byte drive, Password &password, int pim, CRYPTO_INFO **c int volumeType; bool hiddenVolume; uint64 headerSec; - + AcquireSectorBuffer(); 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.StartSector = BootCryptoInfo->EncryptedAreaStart >> TC_LB_SIZE_BIT_SHIFT_DIVISOR; - + PimValueOrHiddenVolumeStartUnitNo = EncryptedVirtualPartition.StartSector; HiddenVolumeStartSector = PartitionFollowingActive.StartSector; HiddenVolumeStartSector += EncryptedVirtualPartition.StartSector; @@ -535,7 +535,7 @@ static byte BootEncryptedDrive () if (!MountVolume (BootDrive, exitKey, PreventNormalSystemBoot, false)) return exitKey; - + if (!CheckMemoryRequirements ()) goto err; @@ -765,7 +765,7 @@ static bool CopySystemPartitionToHiddenVolume (byte drive, byte &exitKey) EncryptDataUnits (SectorBuffer, &s, 1, BootCryptoInfo); CopyMemory (SectorBuffer, TC_BOOT_LOADER_BUFFER_SEGMENT, i * TC_LB_SIZE, TC_LB_SIZE); - } + } ReleaseSectorBuffer(); @@ -875,7 +875,7 @@ static void DecryptDrive (byte drive) DecryptDataUnits (SectorBuffer, &s, 1, BootCryptoInfo); CopyMemory (SectorBuffer, TC_BOOT_LOADER_BUFFER_SEGMENT, i * TC_LB_SIZE, TC_LB_SIZE); - } + } ReleaseSectorBuffer(); @@ -1250,7 +1250,7 @@ void main () exitKey = BootEncryptedDrive(); #else // TC_WINDOWS_BOOT_RESCUE_DISK_MODE - + PrintMainMenu(); exitKey = BootEncryptedDrive(); diff --git a/src/Boot/Windows/BootMain.h b/src/Boot/Windows/BootMain.h index 2f212a18..0f89179a 100644 --- a/src/Boot/Windows/BootMain.h +++ b/src/Boot/Windows/BootMain.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/BootMemory.cpp b/src/Boot/Windows/BootMemory.cpp index 505b731a..5729142f 100644 --- a/src/Boot/Windows/BootMemory.cpp +++ b/src/Boot/Windows/BootMemory.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -44,7 +44,7 @@ static bool GetMemoryMapEntry (BiosMemoryMapEntry &entry) push TC_BOOT_LOADER_ALT_SEGMENT pop es mov di, 0 - + int 0x15 jnc no_carry mov carry, true diff --git a/src/Boot/Windows/BootMemory.h b/src/Boot/Windows/BootMemory.h index d4ad1561..d08e88ac 100644 --- a/src/Boot/Windows/BootMemory.h +++ b/src/Boot/Windows/BootMemory.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/BootSector.asm b/src/Boot/Windows/BootSector.asm index 0518414f..833ff616 100644 --- a/src/Boot/Windows/BootSector.asm +++ b/src/Boot/Windows/BootSector.asm @@ -3,7 +3,7 @@ ; Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed ; 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 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 @@ -26,9 +26,9 @@ start: loader_name_msg: db ' VeraCrypt Boot Loader', 13, 10, 0 - + main: - cli + cli xor ax, ax mov ds, ax mov ss, ax @@ -49,12 +49,12 @@ skip_loader_name_msg: ; Check available memory cmp word ptr [ds:413h], TC_BOOT_LOADER_SEGMENT / 1024 * 16 + TC_BOOT_MEMORY_REQUIRED jge memory_ok - + mov ax, TC_BOOT_LOADER_SEGMENT_LOW - + cmp word ptr [ds:413h], TC_BOOT_LOADER_SEGMENT_LOW / 1024 * 16 + TC_BOOT_MEMORY_REQUIRED jge memory_ok - + ; Insufficient memory 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 cld rep stosb - + mov ax, es sub ax, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE / 16 ; Decompressor segment mov es, ax - + ; Load decompressor mov cl, TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR retry_backup: @@ -85,17 +85,17 @@ retry_backup: mov cx, TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT * TC_LB_SIZE call checksum push ebx - + ; Load compressed boot loader mov bx, TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET mov cl, TC_BOOT_LOADER_START_SECTOR mov al, TC_MAX_BOOT_LOADER_SECTOR_COUNT - + test backup_loader_used, 1 jz non_backup 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 - + non_backup: call read_sectors @@ -104,21 +104,21 @@ non_backup: mov si, TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET mov cx, word ptr [start + TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET] call 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 ; Checksum incorrect - try using backup if available test backup_loader_used, 1 jnz loader_damaged - + mov backup_loader_used, 1 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] jnz retry_backup - + loader_damaged: lea si, loader_damaged_msg call print @@ -134,9 +134,9 @@ checksum_ok: mov ss, ax mov sp, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE sti - + push dx - + ; Decompress boot loader mov cx, word ptr [start + TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET] sub cx, TC_GZIP_HEADER_SIZE @@ -154,7 +154,7 @@ decompressor_ret: add sp, 8 pop dx - + ; Restore boot sector segment push cs pop ds @@ -170,7 +170,7 @@ decompression_ok: ; DH = boot sector flags mov dh, byte ptr [start + TC_BOOT_SECTOR_CONFIG_OFFSET] - + ; Set up boot loader segment mov ax, es add ax, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE / 16 @@ -185,17 +185,17 @@ decompression_ok: push es push TC_COM_EXECUTABLE_OFFSET retf - + ; Print string print: xor bx, bx mov ah, 0eh cld - + @@: lodsb test al, al jz print_end - + int 10h jmp @B @@ -210,12 +210,12 @@ read_sectors: mov ah, 2 int 13h jnc read_ok - + lea si, disk_error_msg call print read_ok: ret - + ; Calculate checksum checksum: push ds @@ -223,17 +223,17 @@ checksum: pop ds xor eax, eax cld - + @@: lodsb add ebx, eax rol ebx, 1 loop @B - + pop ds ret backup_loader_used db 0 - + disk_error_msg db 'Disk error', 13, 10, 7, 0 loader_damaged_msg db 7, 'Loader damaged! Repair with Rescue Disk', 0 diff --git a/src/Boot/Windows/BootStrings.h b/src/Boot/Windows/BootStrings.h index 99c4dc4f..6c5d7847 100644 --- a/src/Boot/Windows/BootStrings.h +++ b/src/Boot/Windows/BootStrings.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/IntFilter.cpp b/src/Boot/Windows/IntFilter.cpp index d9cd92df..4a39fd14 100644 --- a/src/Boot/Windows/IntFilter.cpp +++ b/src/Boot/Windows/IntFilter.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -98,7 +98,7 @@ bool Int13Filter () if (ReEntryCount == 0 && drive == EncryptedVirtualPartition.Drive) { BiosResult result; - + if (function == 0x3) result = WriteEncryptedSectors (regs.ES, regs.BX, drive, sector, sectorCount); else @@ -126,7 +126,7 @@ bool Int13Filter () case 0x43: // Write sectors LBA { byte drive = (byte) regs.DX; - + BiosLbaPacket lba; CopyMemory (regs.DS, regs.SI, (byte *) &lba, sizeof (lba)); @@ -141,7 +141,7 @@ bool Int13Filter () if (ReEntryCount == 0 && drive == EncryptedVirtualPartition.Drive) { BiosResult result; - + uint16 segment = (uint16) (lba.Buffer >> 16); uint16 offset = (uint16) lba.Buffer; @@ -524,7 +524,7 @@ void IntFilterEntry () popf leave add sp, 2 - jmp cs:OriginalInt13Handler + jmp cs:OriginalInt13Handler pass15: popad @@ -554,7 +554,7 @@ static void Int15FilterEntry () pushf cmp ax, 0xe820 // Get system memory map je filter - + popf leave jmp cs:OriginalInt15Handler @@ -600,7 +600,7 @@ bool InstallInterruptFilters () // Save original INT 13 handler xor ax, ax mov es, ax - + mov si, 0x13 * 4 lea di, OriginalInt13Handler @@ -608,14 +608,14 @@ bool InstallInterruptFilters () mov [di], ax mov ax, es:[si + 2] mov [di + 2], ax - + // Install INT 13 filter lea ax, Int13FilterEntry mov es:[si], ax mov es:[si + 2], cs // Save original INT 15 handler - mov si, 0x15 * 4 + mov si, 0x15 * 4 lea di, OriginalInt15Handler mov ax, es:[si] diff --git a/src/Boot/Windows/IntFilter.h b/src/Boot/Windows/IntFilter.h index 1ef42512..3f3a486a 100644 --- a/src/Boot/Windows/IntFilter.h +++ b/src/Boot/Windows/IntFilter.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Boot/Windows/Makefile b/src/Boot/Windows/Makefile index 65e668cb..8377520b 100644 --- a/src/Boot/Windows/Makefile +++ b/src/Boot/Windows/Makefile @@ -3,7 +3,7 @@ # Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed # 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 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 @@ -111,7 +111,7 @@ env: set INCLUDE=. set LIB=. set LIBPATH=. - + clean: -del /q /s $(OBJDIR) >NUL: @@ -133,7 +133,7 @@ clean: $(CC) $(CFLAGS) /c "$(SRCDIR)\$<" set PATH=$(ENVPATH) cd .. - + {..\..\Common}.c{$(OUTDIR)}.obj: cd $(OBJDIR) set PATH=. @@ -147,7 +147,7 @@ clean: $(CC) $(CFLAGS) /c "$(SRCDIR)\$<" set PATH=$(ENVPATH) cd .. - + .cpp{$(OUTDIR)}.obj: cd $(OBJDIR) set PATH=. @@ -161,7 +161,7 @@ $(OUTDIR)\BootDefs.i: BootDefs.h $(CC) $(CFLAGS) /D TC_ASM_PREPROCESS /P /EP "$(SRCDIR)\BootDefs.h" set PATH=$(ENVPATH) cd .. - + $(OUTDIR)\BootSector.bin: $(OUTDIR)\BootSector.obj cd $(OBJDIR) $(LD) $(LFLAGS) BootSector.obj,BootSector.bin,,,, >NUL: @@ -177,7 +177,7 @@ $(OUTDIR)\Decompressor.com: $(OUTDIR)\BootCrt.obj $(OUTDIR)\Decompressor.obj $(OUTDIR)\$(PROJ).$(TARGETEXT): $(OBJS) @echo Linking... cd $(OBJDIR) - + echo >NUL: @<<$(PROJ).crf2 $(PROJ).$(TARGETEXT) @@ -189,7 +189,7 @@ $(LIBS) del $(PROJ).crf >NUL: 2>NUL: for %F in ($(**F)) do @echo %F + >>$(PROJ).crf type $(PROJ).crf2 >>$(PROJ).crf - + $(LD) $(LFLAGS) @$(PROJ).crf del $(PROJ).crf $(PROJ).crf2 diff --git a/src/Boot/Windows/Platform.cpp b/src/Boot/Windows/Platform.cpp index 316e71b3..0a45bba6 100644 --- a/src/Boot/Windows/Platform.cpp +++ b/src/Boot/Windows/Platform.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -83,7 +83,7 @@ uint64 operator>> (const uint64 &a, int shiftCount) while (shiftCount--) { r.LowPart >>= 1; - + if ((byte) r.HighPart & 1) r.LowPart |= 0x80000000UL; @@ -96,7 +96,7 @@ uint64 operator>> (const uint64 &a, int shiftCount) uint64 operator<< (const uint64 &a, int shiftCount) { uint64 r = a; - + while (shiftCount--) r += r; @@ -148,9 +148,9 @@ bool TestInt64 () a += b; a -= b; - + ++a; - + b = b + (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 intersectEnd = (end1 <= end2) ? end1 : end2; - + uint64 intersectStart = (start1 >= start2) ? start1 : start2; if (intersectStart > intersectEnd) return false; - + return (intersectEnd + 1UL - intersectStart).LowPart != 0; } diff --git a/src/Boot/Windows/Platform.h b/src/Boot/Windows/Platform.h index 879b1c39..a8e83bec 100644 --- a/src/Boot/Windows/Platform.h +++ b/src/Boot/Windows/Platform.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -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_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_EBX_DI TC_ASM_EMIT3 (66, 8B, 1D) diff --git a/src/Build/Include/Makefile.inc b/src/Build/Include/Makefile.inc index 95d8ba60..35d1f29c 100644 --- a/src/Build/Include/Makefile.inc +++ b/src/Build/Include/Makefile.inc @@ -3,7 +3,7 @@ # Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed # 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 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 @@ -53,7 +53,7 @@ TR_SED_BIN := tr '\n' ' ' | tr -s ' ' ',' | sed -e 's/^,//g' -e 's/,$$/n/' | tr %.txt.h: %.txt @echo Converting $(<F) $(OD_BIN) $< | $(TR_SED_BIN) >$@ - + %.bmp.h: %.bmp @echo Converting $(<F) $(OD_BIN) $< | $(TR_SED_BIN) >$@ diff --git a/src/Common/Apidrvr.h b/src/Common/Apidrvr.h index 5ea89770..9c16b378 100644 --- a/src/Common/Apidrvr.h +++ b/src/Common/Apidrvr.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source diff --git a/src/Common/BaseCom.cpp b/src/Common/BaseCom.cpp index f6c55974..5905b6a8 100644 --- a/src/Common/BaseCom.cpp +++ b/src/Common/BaseCom.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Common/BaseCom.h b/src/Common/BaseCom.h index 97009410..a5b27473 100644 --- a/src/Common/BaseCom.h +++ b/src/Common/BaseCom.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -20,11 +20,11 @@ class TrueCryptFactory : public IClassFactory { public: - TrueCryptFactory (DWORD messageThreadId) : + TrueCryptFactory (DWORD messageThreadId) : RefCount (1), ServerLockCount (0), MessageThreadId (messageThreadId) { } ~TrueCryptFactory () { } - + virtual ULONG STDMETHODCALLTYPE AddRef () { return InterlockedIncrement (&RefCount) - 1; @@ -53,7 +53,7 @@ public: AddRef (); return S_OK; } - + virtual HRESULT STDMETHODCALLTYPE CreateInstance (IUnknown *pUnkOuter, REFIID riid, void **ppvObject) { if (pUnkOuter != NULL) diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp index 73b64458..7148ca24 100644 --- a/src/Common/BootEncryption.cpp +++ b/src/Common/BootEncryption.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -44,7 +44,7 @@ namespace VeraCrypt class Elevator { public: - + static void AddReference () { ++ReferenceCount; @@ -193,7 +193,7 @@ namespace VeraCrypt { result = ERROR_OUTOFMEMORY; } - + if (result != ERROR_SUCCESS) { SetLastError (result); @@ -263,7 +263,7 @@ namespace VeraCrypt ElevatedComInstanceThreadId = GetCurrentThreadId(); } } - + #if defined (TCMOUNT) static ITrueCryptMainCom *ElevatedComInstance; #elif defined (VOLFORMAT) @@ -282,7 +282,7 @@ namespace VeraCrypt int Elevator::ReferenceCount = 0; #else // SETUP - + class Elevator { public: @@ -308,7 +308,7 @@ namespace VeraCrypt { FileOpen = true; } - else + else { LastError = GetLastError(); if (LastError == ERROR_ACCESS_DENIED && IsUacSupported()) @@ -436,7 +436,7 @@ namespace VeraCrypt { FileOpen = true; } - else + else { LastError = GetLastError (); if (LastError == ERROR_ACCESS_DENIED && IsUacSupported()) @@ -477,7 +477,7 @@ namespace VeraCrypt { if (RescueIsoImage) delete[] RescueIsoImage; - + Elevator::Release(); } @@ -516,7 +516,7 @@ namespace VeraCrypt if (config.SystemPartition.IsGPT) 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) { 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 - 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 + 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 a higer number than the third one. */ - + // Find the first partition physically located behind the active partition if (activePartitionFound) { @@ -692,7 +692,7 @@ namespace VeraCrypt ProbeRealDriveSizeRequest request; StringCchCopyW (request.DeviceName, ARRAYSIZE (request.DeviceName), DriveConfig.DrivePartition.DevicePath.c_str()); - + CallDriver (TC_IOCTL_PROBE_REAL_DRIVE_SIZE, &request, sizeof (request), &request, sizeof (request)); DriveConfig.DrivePartition.Info.PartitionLength = request.RealDriveSize; @@ -787,7 +787,7 @@ namespace VeraCrypt return partList; } - + DISK_GEOMETRY BootEncryption::GetDriveGeometry (int driveNumber) { @@ -799,12 +799,12 @@ namespace VeraCrypt return geometry; } - + wstring BootEncryption::GetWindowsDirectory () { wchar_t buf[MAX_PATH]; throw_sys_if (GetSystemDirectory (buf, ARRAYSIZE (buf)) == 0); - + 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) bool BootEncryption::IsBootLoaderOnDrive (wchar_t *devicePath) { - try + try { OPEN_TEST_STRUCT openTestStruct; memset (&openTestStruct, 0, sizeof (openTestStruct)); @@ -871,7 +871,7 @@ namespace VeraCrypt bool BootEncryption::IsHiddenSystemRunning () { int hiddenSystemStatus; - + CallDriver (TC_IOCTL_IS_HIDDEN_SYSTEM_RUNNING, nullptr, 0, &hiddenSystemStatus, sizeof (hiddenSystemStatus)); return hiddenSystemStatus != 0; } @@ -1250,7 +1250,7 @@ namespace VeraCrypt if (userConfig) *userConfig = request.UserConfiguration; - + if (customUserMessage) { request.CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH] = 0; @@ -1267,7 +1267,7 @@ namespace VeraCrypt if (userConfig) *userConfig = 0; - + if (customUserMessage) customUserMessage->clear(); @@ -1326,7 +1326,7 @@ namespace VeraCrypt memcpy (mbr + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET, customUserMessage.c_str(), customUserMessage.size()); } - + if (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_PIM) { // PIM for pre-boot authentication can be encoded on two bytes since its maximum @@ -1386,7 +1386,7 @@ namespace VeraCrypt ZeroMemory (&request, sizeof (request)); request.WipeAlgorithm = wipeAlgorithm; - + if (Randinit() != ERR_SUCCESS) { if (CryptoAPILastError == ERROR_SUCCESS) @@ -1414,7 +1414,7 @@ namespace VeraCrypt CallDriver (TC_IOCTL_ABORT_DECOY_SYSTEM_WIPE); } - + DecoySystemWipeStatus BootEncryption::GetDecoyOSWipeStatus () { DecoySystemWipeStatus status; @@ -1448,7 +1448,7 @@ namespace VeraCrypt device.SeekAt (0); device.Read (mbr, sizeof (mbr)); - + finally_do_arg (BootEncryption *, this, { try @@ -1594,7 +1594,7 @@ namespace VeraCrypt WCHAR pathBuf[MAX_PATH]; throw_sys_if (!SUCCEEDED (SHGetFolderPath (NULL, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, pathBuf))); - + wstring path = wstring (pathBuf) + L"\\" _T(TC_APP_NAME); CreateDirectory (path.c_str(), NULL); @@ -1624,7 +1624,7 @@ namespace VeraCrypt throw ParameterIncorrect (SRC_POS); Buffer imageBuf (RescueIsoImageSize); - + byte *image = imageBuf.Ptr(); memset (image, 0, RescueIsoImageSize); @@ -1721,7 +1721,7 @@ namespace VeraCrypt File sysBakFile (GetSystemLoaderBackupPath(), true); sysBakFile.CheckOpened (SRC_POS); 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; } catch (Exception &e) @@ -1729,7 +1729,7 @@ namespace VeraCrypt e.Show (ParentWindow); Warning ("SYS_LOADER_UNAVAILABLE_FOR_RESCUE_DISK", ParentWindow); } - + // Boot loader backup 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); // 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 - if ((DRIVE_CDROM == driveType) || (DRIVE_REMOVABLE == driveType)) + if ((DRIVE_CDROM == driveType) || (DRIVE_REMOVABLE == driveType)) { rootPath[2] = 0; // remove trailing backslash @@ -1813,7 +1813,7 @@ namespace VeraCrypt Buffer buffer ((verifiedSectorCount + 1) * 2048); DWORD bytesRead = isoFile.Read (buffer.Ptr(), (DWORD) buffer.Size()); - if ( (bytesRead == buffer.Size()) + if ( (bytesRead == buffer.Size()) && (memcmp (buffer.Ptr(), RescueIsoImage, buffer.Size()) == 0) ) { @@ -2187,7 +2187,7 @@ namespace VeraCrypt { if (nCurrentOS == WIN_2000) throw ErrorException ("SYS_ENCRYPTION_UNSUPPORTED_ON_CURRENT_OS", SRC_POS); - + if (CurrentOSMajor == 6 && CurrentOSMinor == 0 && CurrentOSServicePack < 1) throw ErrorException ("SYS_ENCRYPTION_UNSUPPORTED_ON_VISTA_SP0", SRC_POS); @@ -2272,7 +2272,7 @@ namespace VeraCrypt 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") + L"\n\n\n" + GetString ("RESTRICT_PAGING_FILES_TO_SYS_PARTITION") @@ -2283,7 +2283,7 @@ namespace VeraCrypt 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); } @@ -2291,14 +2291,14 @@ namespace VeraCrypt wchar_t *configPath = GetConfigPath (L"dummy"); 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); } // Temporary files 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); } } @@ -2414,7 +2414,7 @@ namespace VeraCrypt device.Read ((byte *) header, sizeof (header)); PCRYPTO_INFO 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); }); @@ -2447,7 +2447,7 @@ namespace VeraCrypt UserEnrichRandomPool (hwndDlg); 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 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 @@ -2663,7 +2663,7 @@ namespace VeraCrypt SelectedEncryptionAlgorithmId = ea; SelectedPrfAlgorithmId = pkcs5; CreateVolumeHeader (volumeSize, encryptedAreaStart, &password, ea, mode, pkcs5, pim); - + if (!rescueIsoImagePath.empty()) CreateRescueIsoImage (true, rescueIsoImagePath); } @@ -2705,7 +2705,7 @@ namespace VeraCrypt BootEncryptionSetupRequest request; ZeroMemory (&request, sizeof (request)); - + request.SetupMode = SetupDecryption; request.DiscardUnreadableEncryptedSectors = discardUnreadableEncryptedSectors; @@ -2721,7 +2721,7 @@ namespace VeraCrypt BootEncryptionSetupRequest request; ZeroMemory (&request, sizeof (request)); - + request.SetupMode = SetupEncryption; request.WipeAlgorithm = wipeAlgorithm; request.ZeroUnreadableSectors = zeroUnreadableSectors; diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h index a89b2ec6..d75b650c 100644 --- a/src/Common/BootEncryption.h +++ b/src/Common/BootEncryption.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Common/Cache.c b/src/Common/Cache.c index ba6c6df8..e5b36590 100644 --- a/src/Common/Cache.c +++ b/src/Common/Cache.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source diff --git a/src/Common/Cache.h b/src/Common/Cache.h index c4587d03..1cadf79d 100644 --- a/src/Common/Cache.h +++ b/src/Common/Cache.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -15,7 +15,7 @@ #ifndef CACHE_SIZE /* 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 extern int cacheEmpty; diff --git a/src/Common/Cmdline.c b/src/Common/Cmdline.c index 4a055c16..e5fe5969 100644 --- a/src/Common/Cmdline.c +++ b/src/Common/Cmdline.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 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"); SetWindowTextW (GetDlgItem (hwndDlg, IDC_COMMANDHELP_TEXT), tmp); - + TCfree(tmp); return 1; } diff --git a/src/Common/Cmdline.h b/src/Common/Cmdline.h index 51c173c6..09e59924 100644 --- a/src/Common/Cmdline.h +++ b/src/Common/Cmdline.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source diff --git a/src/Common/Combo.c b/src/Common/Combo.c index fe456853..50e9761c 100644 --- a/src/Common/Combo.c +++ b/src/Common/Combo.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 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 wszVolume[MAX_PATH] = {0}; - + if (i < count) { 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++) { wchar_t szTmp[MAX_PATH] = { 0 }; - + if (SendMessage (hComboBox, CB_GETLBTEXTLEN, nComboIdx[i], 0) < ARRAYSIZE (szTmp)) SendMessage (hComboBox, CB_GETLBTEXT, nComboIdx[i], (LPARAM) & szTmp[0]); diff --git a/src/Common/Combo.h b/src/Common/Combo.h index cacbc413..4f85c6bd 100644 --- a/src/Common/Combo.h +++ b/src/Common/Combo.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source diff --git a/src/Common/Common.h b/src/Common/Common.h index 05e2e12f..cd88882f 100644 --- a/src/Common/Common.h +++ b/src/Common/Common.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Common/Common.rc b/src/Common/Common.rc index 1e529c63..b84fba8e 100644 --- a/src/Common/Common.rc +++ b/src/Common/Common.rc @@ -337,7 +337,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_ABOUT_DLG, DIALOG BEGIN @@ -547,18 +547,18 @@ IDR_LICENSE TEXT "..\\Resources\\Texts\\License.r // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\r\n" "\0" diff --git a/src/Common/Crc.c b/src/Common/Crc.c index ba8777e6..5a73fc86 100644 --- a/src/Common/Crc.c +++ b/src/Common/Crc.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -19,7 +19,7 @@ /* CRC polynomial 0x04c11db7 */ unsigned __int32 crc_32_tab[]= -{ +{ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, diff --git a/src/Common/Crc.h b/src/Common/Crc.h index c89a6191..c5be1778 100644 --- a/src/Common/Crc.h +++ b/src/Common/Crc.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source diff --git a/src/Common/Crypto.c b/src/Common/Crypto.c index a524fd97..e5a3218e 100644 --- a/src/Common/Crypto.c +++ b/src/Common/Crypto.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 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: serpent_set_key (key, ks); break; - + case TWOFISH: twofish_set_key ((TwofishInstance *)ks, (const u4byte *)key); break; @@ -146,7 +146,7 @@ void EncipherBlock(int cipher, void *data, void *ks) { 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. #if (defined (_WIN64) || !defined (TC_WINDOWS_DRIVER)) && !defined (TC_WINDOWS_BOOT) 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 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 - 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). */ break; - default: + default: // Unknown/wrong ID TC_THROW_FATAL_EXCEPTION; } @@ -488,7 +488,7 @@ int EAGetNextMode (int ea, int previousModeId) int c, i = 0; while (c = EncryptionAlgorithms[ea].Modes[i++]) { - if (c == previousModeId) + if (c == previousModeId) return EncryptionAlgorithms[ea].Modes[i]; } @@ -591,7 +591,7 @@ int EAGetNextCipher (int ea, int previousCipherId) int c, i = 0; while (c = EncryptionAlgorithms[ea].Ciphers[i++]) { - if (c == previousCipherId) + if (c == previousCipherId) return EncryptionAlgorithms[ea].Ciphers[i]; } @@ -608,7 +608,7 @@ int EAGetPreviousCipher (int ea, int previousCipherId) while (c = EncryptionAlgorithms[ea].Ciphers[i++]) { - if (c == previousCipherId) + if (c == previousCipherId) return EncryptionAlgorithms[ea].Ciphers[i - 2]; } @@ -777,7 +777,7 @@ void crypto_close (PCRYPTO_INFO cryptoInfo) // EncryptBuffer // // 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) 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; - default: + default: // Unknown/wrong ID TC_THROW_FATAL_EXCEPTION; } @@ -850,7 +850,7 @@ void EncryptDataUnitsCurrentThread (unsigned __int8 *buf, const UINT64_STRUCT *s } break; - default: + default: // Unknown/wrong ID TC_THROW_FATAL_EXCEPTION; } @@ -859,7 +859,7 @@ void EncryptDataUnitsCurrentThread (unsigned __int8 *buf, const UINT64_STRUCT *s // DecryptBuffer // // 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) 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; - default: + default: // Unknown/wrong ID TC_THROW_FATAL_EXCEPTION; } @@ -935,7 +935,7 @@ void DecryptDataUnitsCurrentThread (unsigned __int8 *buf, const UINT64_STRUCT *s } break; - default: + default: // Unknown/wrong ID TC_THROW_FATAL_EXCEPTION; } @@ -955,7 +955,7 @@ void EncipherBlock(int cipher, void *data, void *ks) if (IsAesHwCpuSupported()) aes_hw_cpu_encrypt ((byte *) ks, data); else - aes_encrypt (data, data, ks); + aes_encrypt (data, data, ks); #elif defined (TC_WINDOWS_BOOT_SERPENT) serpent_encrypt (data, data, ks); #elif defined (TC_WINDOWS_BOOT_TWOFISH) @@ -969,7 +969,7 @@ void DecipherBlock(int cipher, void *data, void *ks) if (IsAesHwCpuSupported()) aes_hw_cpu_decrypt ((byte *) ks + sizeof (aes_encrypt_ctx) + 14 * 16, data); 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) serpent_decrypt (data, data, ks); #elif defined (TC_WINDOWS_BOOT_TWOFISH) diff --git a/src/Common/Crypto.h b/src/Common/Crypto.h index 96f0a9a6..5d9fff97 100644 --- a/src/Common/Crypto.h +++ b/src/Common/Crypto.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -45,9 +45,9 @@ extern "C" { #define MASTER_KEYDATA_SIZE 256 // 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 { SHA512 = FIRST_PRF_ID, @@ -58,7 +58,7 @@ enum }; // 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_DIGESTSIZE 20 @@ -105,7 +105,7 @@ enum { NONE = 0, AES, - SERPENT, + SERPENT, TWOFISH }; @@ -221,12 +221,12 @@ typedef struct CRYPTO_INFO_t #ifndef TC_WINDOWS_BOOT 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 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]; - int noIterations; + int noIterations; BOOL bTrueCryptMode; 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 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 hiddenVolumeSize; // Size of the hidden volume excluding the header (in bytes). Set to 0 for standard volumes. diff --git a/src/Common/Dictionary.c b/src/Common/Dictionary.c index 34741951..c6135e3e 100644 --- a/src/Common/Dictionary.c +++ b/src/Common/Dictionary.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -41,7 +41,7 @@ void AddDictionaryEntry (char *key, int intKey, void *value) void *GetDictionaryValue (const char *key) { map <string, void *>::const_iterator i = StringKeyMap.find (key); - + if (i == StringKeyMap.end()) return NULL; diff --git a/src/Common/Dictionary.h b/src/Common/Dictionary.h index 0fa9c7ee..97c7938c 100644 --- a/src/Common/Dictionary.h +++ b/src/Common/Dictionary.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index ef6a942f..fd2601b4 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -113,9 +113,9 @@ BOOL bMountFavoritesOnLogon = FALSE; BOOL bHistory = FALSE; -// Status of detection of hidden sectors (whole-system-drive encryption). +// Status of detection of hidden sectors (whole-system-drive encryption). // 0 - Unknown/undetermined/completed, 1: Detection is or was in progress (but did not complete e.g. due to system crash). -int HiddenSectorDetectionStatus = 0; +int HiddenSectorDetectionStatus = 0; OSVersionEnum nCurrentOS = WIN_UNKNOWN; int CurrentOSMajor = 0; @@ -128,7 +128,7 @@ BOOL bPortableModeConfirmed = FALSE; // TRUE if it is certain that the instance BOOL bInPlaceEncNonSysPending = FALSE; // TRUE if the non-system in-place encryption config file indicates that one or more partitions are scheduled to be encrypted. This flag is set only when config files are loaded during app startup. -/* Globals used by Mount and Format (separately per instance) */ +/* Globals used by Mount and Format (separately per instance) */ BOOL PimEnable = FALSE; BOOL KeyFilesEnable = FALSE; KeyFile *FirstKeyFile = NULL; @@ -147,7 +147,7 @@ BOOL WaitDialogDisplaying = FALSE; HANDLE hDriver = INVALID_HANDLE_VALUE; /* This mutex is used to prevent multiple instances of the wizard or main app from dealing with system encryption */ -volatile HANDLE hSysEncMutex = NULL; +volatile HANDLE hSysEncMutex = NULL; /* This mutex is used for non-system in-place encryption but only for informative (non-blocking) purposes, such as whether an app should prompt the user whether to resume scheduled process. */ @@ -171,7 +171,7 @@ ATOM hDlgClass, hSplashClass; /* This value may changed only by calling ChangeSystemEncryptionStatus(). Only the wizard can change it (others may still read it though). */ -int SystemEncryptionStatus = SYSENC_STATUS_NONE; +int SystemEncryptionStatus = SYSENC_STATUS_NONE; /* Only the wizard can change this value (others may only read it). */ WipeAlgorithmId nWipeMode = TC_WIPE_NONE; @@ -294,13 +294,13 @@ ChangeWindowMessageFilterPtr ChangeWindowMessageFilterFn = NULL; #error PKCS5_BENCHMARKS and HASH_FNC_BENCHMARKS are both TRUE (at least one of them should be FALSE). #endif -enum +enum { BENCHMARK_SORT_BY_NAME = 0, BENCHMARK_SORT_BY_SPEED }; -typedef struct +typedef struct { int id; wchar_t name[100]; @@ -319,7 +319,7 @@ LARGE_INTEGER benchmarkPerformanceFrequency; #endif // #ifndef SETUP -typedef struct +typedef struct { void *strings; BOOL bold; @@ -356,7 +356,7 @@ void cleanup () /* Close the device driver handle */ if (hDriver != INVALID_HANDLE_VALUE) { - // Unload driver mode if possible (non-install mode) + // Unload driver mode if possible (non-install mode) if (IsNonInstallMode ()) { // If a dismount was forced in the lifetime of the driver, Windows may later prevent it to be loaded again from @@ -710,7 +710,7 @@ BOOL IsDiskError (DWORD error) DWORD handleWin32Error (HWND hwndDlg, const char* srcPos) { PWSTR lpMsgBuf; - DWORD dwError = GetLastError (); + DWORD dwError = GetLastError (); wchar_t szErrorValue[32]; wchar_t* pszDesc; @@ -833,7 +833,7 @@ int GetTextGfxWidth (HWND hwndDlgItem, const wchar_t *text, HFONT hFont) { SIZE sizes; TEXTMETRIC textMetrics; - HDC hdc = GetDC (hwndDlgItem); + HDC hdc = GetDC (hwndDlgItem); SelectObject(hdc, (HGDIOBJ) hFont); @@ -841,7 +841,7 @@ int GetTextGfxWidth (HWND hwndDlgItem, const wchar_t *text, HFONT hFont) GetTextMetrics(hdc, &textMetrics); // Necessary for non-TrueType raster fonts (tmOverhang) - ReleaseDC (hwndDlgItem, hdc); + ReleaseDC (hwndDlgItem, hdc); return ((int) sizes.cx - (int) textMetrics.tmOverhang); } @@ -850,13 +850,13 @@ int GetTextGfxWidth (HWND hwndDlgItem, const wchar_t *text, HFONT hFont) int GetTextGfxHeight (HWND hwndDlgItem, const wchar_t *text, HFONT hFont) { SIZE sizes; - HDC hdc = GetDC (hwndDlgItem); + HDC hdc = GetDC (hwndDlgItem); SelectObject(hdc, (HGDIOBJ) hFont); GetTextExtentPoint32W (hdc, text, (int) wcslen (text), &sizes); - ReleaseDC (hwndDlgItem, hdc); + ReleaseDC (hwndDlgItem, hdc); return ((int) sizes.cy); } @@ -872,7 +872,7 @@ std::wstring FitPathInGfxWidth (HWND hwnd, HFONT hFont, LONG width, const std::w rect.right = width; rect.bottom = LONG_MAX; - HDC hdc = GetDC (hwnd); + HDC hdc = GetDC (hwnd); SelectObject (hdc, (HGDIOBJ) hFont); wchar_t pathBuf[TC_MAX_PATH]; @@ -881,7 +881,7 @@ std::wstring FitPathInGfxWidth (HWND hwnd, HFONT hFont, LONG width, const std::w if (DrawText (hdc, pathBuf, (int) path.size(), &rect, DT_CALCRECT | DT_MODIFYSTRING | DT_PATH_ELLIPSIS | DT_SINGLELINE) != 0) newPath = pathBuf; - ReleaseDC (hwnd, hdc); + ReleaseDC (hwnd, hdc); return newPath; } @@ -961,12 +961,12 @@ void AccommodateTextField (HWND hwndDlg, UINT ctrlId, BOOL bFirstUpdate, HFONT h width = GetTextGfxWidth (hwndCtrl, text, hFont); height = GetTextGfxHeight (hwndCtrl, text, hFont); - GetClientRect (hwndCtrl, &rec); + GetClientRect (hwndCtrl, &rec); origWidth = rec.right; origHeight = rec.bottom; if (width >= 0 - && (!bFirstUpdate || origWidth > width)) // The original width of the field is the maximum allowed size + && (!bFirstUpdate || origWidth > width)) // The original width of the field is the maximum allowed size { horizSubOffset = origWidth - width; vertSubOffset = origHeight - height; @@ -989,7 +989,7 @@ void AccommodateTextField (HWND hwndDlg, UINT ctrlId, BOOL bFirstUpdate, HFONT h alignPosDiff = horizSubOffset / 2; else if (windowInfo.dwStyle & SS_RIGHT) alignPosDiff = horizSubOffset; - + // Resize/move if (alignPosDiff > 0) { @@ -1044,7 +1044,7 @@ static LRESULT CALLBACK BootPwdFieldProc (HWND hwnd, UINT message, WPARAM wParam // Protects an input field from having its content updated by a Paste action. Used for pre-boot password -// input fields (only the US keyboard layout is supported in pre-boot environment so we must prevent the +// input fields (only the US keyboard layout is supported in pre-boot environment so we must prevent the // user from pasting a password typed using a non-US keyboard layout). void ToBootPwdField (HWND hwndDlg, UINT ctrlId) { @@ -1071,7 +1071,7 @@ BOOL CALLBACK AuxiliaryDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (hDC) { ScreenDPI = GetDeviceCaps (hDC, LOGPIXELSY); - ReleaseDC (hwndDlg, hDC); + ReleaseDC (hwndDlg, hDC); } DPIScaleFactorX = 1; @@ -1080,7 +1080,7 @@ BOOL CALLBACK AuxiliaryDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (ScreenDPI != USER_DEFAULT_SCREEN_DPI) { - // Windows skews the GUI aspect ratio if the user has a non-default DPI. Hence, working with + // Windows skews the GUI aspect ratio if the user has a non-default DPI. Hence, working with // actual screen DPI is redundant and leads to incorrect results. What really matters here is // how Windows actually renders our GUI. This is determined by comparing the expected and current // sizes of a hidden calibration text field. @@ -1139,7 +1139,7 @@ BOOL CALLBACK AboutDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam GetClientRect (GetDlgItem (hwndDlg, IDC_ABOUT_LOGO_AREA), &rec); SetWindowPos (GetDlgItem (hwndDlg, IDC_ABOUT_BKG), HWND_TOP, 0, 0, rec.right, rec.bottom, SWP_NOMOVE); - // Resize the logo bitmap if the user has a non-default DPI + // Resize the logo bitmap if the user has a non-default DPI if (ScreenDPI != USER_DEFAULT_SCREEN_DPI) { // Logo (must recreate and keep the original aspect ratio as Windows distorts it) @@ -1455,7 +1455,7 @@ void InitDialog (HWND hwndDlg) void ProcessPaintMessages (HWND hwnd, int maxMessagesToProcess) { MSG paintMsg; - int msgCounter = maxMessagesToProcess; + int msgCounter = maxMessagesToProcess; while (PeekMessageW (&paintMsg, hwnd, 0, 0, PM_REMOVE | PM_QS_PAINT) != 0 && msgCounter-- > 0) { @@ -1483,16 +1483,16 @@ HDC CreateMemBitmap (HINSTANCE hInstance, HWND hwnd, wchar_t *resource) } -/* Renders the specified bitmap at the specified location and stretches it to fit (anti-aliasing is applied). +/* Renders the specified bitmap at the specified location and stretches it to fit (anti-aliasing is applied). If bDirectRender is FALSE and both nWidth and nHeight are zero, the width and height of hwndDest are retrieved and adjusted according to screen DPI (the width and height of the resultant image are adjusted the same way); furthermore, if bKeepAspectRatio is TRUE, the smaller DPI factor of the two (i.e. horiz. or vert.) is used both for horiz. and vert. scaling (note that the overall GUI aspect ratio changes irregularly in -both directions depending on the DPI). If bDirectRender is TRUE, bKeepAspectRatio is ignored. +both directions depending on the DPI). If bDirectRender is TRUE, bKeepAspectRatio is ignored. This function returns a handle to the scaled bitmap. When the bitmap is no longer needed, it should be -deleted by calling DeleteObject() with the handle passed as the parameter. -Known Windows issues: -- For some reason, anti-aliasing is not applied if the source bitmap contains less than 16K pixels. +deleted by calling DeleteObject() with the handle passed as the parameter. +Known Windows issues: +- For some reason, anti-aliasing is not applied if the source bitmap contains less than 16K pixels. - Windows 2000 may produce slightly inaccurate colors even when source, buffer, and target are 24-bit true color. */ HBITMAP RenderBitmap (wchar_t *resource, HWND hwndDest, int x, int y, int nWidth, int nHeight, BOOL bDirectRender, BOOL bKeepAspectRatio) { @@ -1541,11 +1541,11 @@ HBITMAP RenderBitmap (wchar_t *resource, HWND hwndDest, int x, int y, int nWidth GetObject (picture, sizeof (BITMAP), &bitmap); - hdcRescaled = CreateCompatibleDC (hdcSrc); + hdcRescaled = CreateCompatibleDC (hdcSrc); if (hdcRescaled) { - hbmpRescaled = CreateCompatibleBitmap (hdcSrc, nWidth, nHeight); + hbmpRescaled = CreateCompatibleBitmap (hdcSrc, nWidth, nHeight); SelectObject (hdcRescaled, hbmpRescaled); @@ -1561,7 +1561,7 @@ HBITMAP RenderBitmap (wchar_t *resource, HWND hwndDest, int x, int y, int nWidth hdcSrc, 0, 0, - bitmap.bmWidth, + bitmap.bmWidth, bitmap.bmHeight, SRCCOPY); @@ -1670,8 +1670,8 @@ RegisterRedTick (HINSTANCE hInstance) wc.hCursor = NULL; wc.hbrBackground = (HBRUSH) GetStockObject (LTGRAY_BRUSH); wc.lpszClassName = L"VCREDTICK"; - wc.lpfnWndProc = &RedTick; - + wc.lpfnWndProc = &RedTick; + rc = (ULONG) RegisterClassW (&wc); return rc == 0 ? FALSE : TRUE; @@ -1788,7 +1788,7 @@ void PopulateWipeModeCombo (HWND hComboBox, BOOL bNA, BOOL bInPlaceEncryption, B { if (!bHeaderWipe) { - AddComboPair (hComboBox, GetString ("WIPE_MODE_NONE"), TC_WIPE_NONE); + AddComboPair (hComboBox, GetString ("WIPE_MODE_NONE"), TC_WIPE_NONE); } AddComboPair (hComboBox, GetString ("WIPE_MODE_1_RAND"), TC_WIPE_1_RAND); @@ -2055,7 +2055,7 @@ void ExceptionHandlerThread (void *threadArg) else lpack[0] = 0; - + sprintf (url, TC_APPLINK_SECURE "&dest=err-report%s&os=%s&osver=%d.%d.%d&arch=%s&cpus=%d&app=%s&cksum=%x&dlg=%s&err=%x&addr=%x" , lpack , GetWindowsEdition().c_str() @@ -2124,7 +2124,7 @@ static LRESULT CALLBACK NonInstallUacWndProc (HWND hWnd, UINT message, WPARAM wP // Mutex handling to prevent multiple instances of the wizard or main app from dealing with system encryption. -// Returns TRUE if the mutex is (or had been) successfully acquired (otherwise FALSE). +// Returns TRUE if the mutex is (or had been) successfully acquired (otherwise FALSE). BOOL CreateSysEncMutex (void) { return TCCreateMutex (&hSysEncMutex, TC_MUTEX_NAME_SYSENC); @@ -2144,7 +2144,7 @@ void CloseSysEncMutex (void) } -// Returns TRUE if the mutex is (or had been) successfully acquired (otherwise FALSE). +// Returns TRUE if the mutex is (or had been) successfully acquired (otherwise FALSE). BOOL CreateNonSysInplaceEncMutex (void) { return TCCreateMutex (&hNonSysInplaceEncMutex, TC_MUTEX_NAME_NONSYS_INPLACE_ENC); @@ -2166,14 +2166,14 @@ void CloseNonSysInplaceEncMutex (void) // Returns TRUE if another instance of the wizard is preparing, resuming or performing non-system in-place encryption BOOL NonSysInplaceEncInProgressElsewhere (void) { - return (!InstanceHasNonSysInplaceEncMutex () + return (!InstanceHasNonSysInplaceEncMutex () && MutexExistsOnSystem (TC_MUTEX_NAME_NONSYS_INPLACE_ENC)); } // Mutex handling to prevent multiple instances of the wizard or main app from trying to install // or register the driver or from trying to launch it in portable mode at the same time. -// Returns TRUE if the mutex is (or had been) successfully acquired (otherwise FALSE). +// Returns TRUE if the mutex is (or had been) successfully acquired (otherwise FALSE). BOOL CreateDriverSetupMutex (void) { return TCCreateMutex (&hDriverSetupMutex, TC_MUTEX_NAME_DRIVER_SETUP); @@ -2204,7 +2204,7 @@ BOOL IsTrueCryptInstallerRunning (void) } -// Returns TRUE if the mutex is (or had been) successfully acquired (otherwise FALSE). +// Returns TRUE if the mutex is (or had been) successfully acquired (otherwise FALSE). BOOL TCCreateMutex (volatile HANDLE *hMutex, wchar_t *name) { if (*hMutex != NULL) @@ -2244,7 +2244,7 @@ void TCCloseMutex (volatile HANDLE *hMutex) } -// Returns TRUE if a process running on the system has the specified mutex (otherwise FALSE). +// Returns TRUE if a process running on the system has the specified mutex (otherwise FALSE). BOOL MutexExistsOnSystem (wchar_t *name) { if (name[0] == 0) @@ -2258,7 +2258,7 @@ BOOL MutexExistsOnSystem (wchar_t *name) return FALSE; if (GetLastError () == ERROR_ACCESS_DENIED) // On Vista, this is returned if the owner of the mutex is elevated while we are not - return TRUE; + return TRUE; // The call failed and it is not certain whether the mutex exists or not return FALSE; @@ -2530,8 +2530,8 @@ static void LoadSystemDll (LPCTSTR szModuleName, HMODULE *pHandle, BOOL bIgnoreE void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine) { WNDCLASSW wc; - char langId[6]; - InitCommonControlsPtr InitCommonControlsFn = NULL; + char langId[6]; + InitCommonControlsPtr InitCommonControlsFn = NULL; InitOSVersionInfo(); @@ -2553,9 +2553,9 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine) LoadSystemDll (L"Usp10.DLL", &hUsp10Dll, TRUE, SRC_POS); LoadSystemDll (L"UXTheme.dll", &hUXThemeDll, TRUE, SRC_POS); - LoadSystemDll (L"msls31.dll", &hMsls31, TRUE, SRC_POS); + LoadSystemDll (L"msls31.dll", &hMsls31, TRUE, SRC_POS); LoadSystemDll (L"SETUPAPI.DLL", &hSetupDll, FALSE, SRC_POS); - LoadSystemDll (L"SHLWAPI.DLL", &hShlwapiDll, FALSE, SRC_POS); + LoadSystemDll (L"SHLWAPI.DLL", &hShlwapiDll, FALSE, SRC_POS); LoadSystemDll (L"userenv.dll", &hUserenvDll, TRUE, SRC_POS); LoadSystemDll (L"rsaenh.dll", &hRsaenhDll, TRUE, SRC_POS); @@ -2572,7 +2572,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine) } if (IsOSAtLeast (WIN_VISTA)) - { + { LoadSystemDll (L"netapi32.dll", &hnetapi32dll, TRUE, SRC_POS); LoadSystemDll (L"authz.dll", &hauthzdll, TRUE, SRC_POS); LoadSystemDll (L"xmllite.dll", &hxmllitedll, TRUE, SRC_POS); @@ -2580,7 +2580,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine) } if (IsOSAtLeast (WIN_VISTA)) - { + { LoadSystemDll (L"spp.dll", &hsppdll, TRUE, SRC_POS); LoadSystemDll (L"vssapi.dll", &vssapidll, TRUE, SRC_POS); LoadSystemDll (L"vsstrace.dll", &hvsstracedll, TRUE, SRC_POS); @@ -2592,21 +2592,21 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine) LoadSystemDll (L"cfgmgr32.dll", &hcfgmgr32dll, TRUE, SRC_POS); LoadSystemDll (L"devobj.dll", &hdevobjdll, TRUE, SRC_POS); LoadSystemDll (L"powrprof.dll", &hpowrprofdll, TRUE, SRC_POS); - + LoadSystemDll (L"dwmapi.dll", &hdwmapidll, TRUE, SRC_POS); - + LoadSystemDll (L"crypt32.dll", &hcrypt32dll, TRUE, SRC_POS); LoadSystemDll (L"bcrypt.dll", &hbcryptdll, TRUE, SRC_POS); - LoadSystemDll (L"bcryptprimitives.dll", &hbcryptprimitivesdll, TRUE, SRC_POS); + LoadSystemDll (L"bcryptprimitives.dll", &hbcryptprimitivesdll, TRUE, SRC_POS); } - } + } #else LoadSystemDll (L"WINSCARD.DLL", &hwinscarddll, TRUE, SRC_POS); #endif LoadSystemDll (L"COMCTL32.DLL", &hComctl32Dll, FALSE, SRC_POS); - + // call InitCommonControls function InitCommonControlsFn = (InitCommonControlsPtr) GetProcAddress (hComctl32Dll, "InitCommonControls"); ImageList_AddFn = (ImageList_AddPtr) GetProcAddress (hComctl32Dll, "ImageList_Add"); @@ -2667,7 +2667,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine) // Language langId[0] = 0; SetPreferredLangId (ConfigReadString ("Language", "", langId, sizeof (langId))); - + if (langId[0] == 0) { if (IsNonInstallMode ()) @@ -2703,7 +2703,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine) } memset (&wcex, 0, sizeof (wcex)); - wcex.cbSize = sizeof(WNDCLASSEX); + wcex.cbSize = sizeof(WNDCLASSEX); wcex.lpfnWndProc = (WNDPROC) NonInstallUacWndProc; wcex.hInstance = hInstance; wcex.lpszClassName = L"VeraCrypt"; @@ -2781,7 +2781,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine) break; } } - + /* Get the attributes for the standard dialog class */ if ((GetClassInfoW (hInst, WINDOWS_DIALOG_CLASS, &wc)) == 0) { @@ -2972,7 +2972,7 @@ BOOL OpenDevice (const wchar_t *lpszPath, OPEN_TEST_STRUCT *driver, BOOL detectF &dwResult, NULL); // check variable driver - if ( bResult + if ( bResult && ( (driver->bDetectTCBootLoader != TRUE && driver->bDetectTCBootLoader != FALSE) || (driver->TCBootLoaderDetected != TRUE && driver->TCBootLoaderDetected != FALSE) || (driver->DetectFilesystem != TRUE && driver->DetectFilesystem != FALSE) || @@ -2998,7 +2998,7 @@ BOOL OpenDevice (const wchar_t *lpszPath, OPEN_TEST_STRUCT *driver, BOOL detectF else return FALSE; } - + return TRUE; } @@ -3026,10 +3026,10 @@ BOOL GetDriveLabel (int driveNo, wchar_t *label, int labelSize) /* Stores the device path of the system partition in SysPartitionDevicePath and the device path of the system drive in SysDriveDevicePath. -IMPORTANT: As this may take a very long time if called for the first time, it should be called only before performing - a dangerous operation (such as header backup restore or formatting a supposedly non-system device) never - at WM_INITDIALOG or any other GUI events -- instead call IsSystemDevicePath (path, hwndDlg, FALSE) for - very fast preliminary GUI checks; also note that right after the "Select Device" dialog exits with an OK +IMPORTANT: As this may take a very long time if called for the first time, it should be called only before performing + a dangerous operation (such as header backup restore or formatting a supposedly non-system device) never + at WM_INITDIALOG or any other GUI events -- instead call IsSystemDevicePath (path, hwndDlg, FALSE) for + very fast preliminary GUI checks; also note that right after the "Select Device" dialog exits with an OK return code, you can use the global flags bSysPartitionSelected and bSysDriveSelected to see if the user selected the system partition/device. After this function completes successfully, the results are cached for the rest of the session and repeated @@ -3037,13 +3037,13 @@ executions complete very fast. Returns TRUE if successful (otherwise FALSE). */ BOOL GetSysDevicePaths (HWND hwndDlg) { if (!bCachedSysDevicePathsValid - || wcslen (SysPartitionDevicePath) <= 1 + || wcslen (SysPartitionDevicePath) <= 1 || wcslen (SysDriveDevicePath) <= 1) { foreach (const HostDevice &device, GetAvailableHostDevices (false, true)) { if (device.ContainsSystem) - StringCchCopyW (device.IsPartition ? SysPartitionDevicePath : SysDriveDevicePath, TC_MAX_PATH, device.Path.c_str()); + StringCchCopyW (device.IsPartition ? SysPartitionDevicePath : SysDriveDevicePath, TC_MAX_PATH, device.Path.c_str()); } if (IsOSAtLeast (WIN_7)) @@ -3070,24 +3070,24 @@ BOOL GetSysDevicePaths (HWND hwndDlg) bCachedSysDevicePathsValid = 1; } - return (bCachedSysDevicePathsValid - && wcslen (SysPartitionDevicePath) > 1 + return (bCachedSysDevicePathsValid + && wcslen (SysPartitionDevicePath) > 1 && wcslen (SysDriveDevicePath) > 1); } -/* Determines whether the device path is the path of the system partition or of the system drive (or neither). -If bReliableRequired is TRUE, very fast execution is guaranteed, but the results cannot be relied upon. +/* Determines whether the device path is the path of the system partition or of the system drive (or neither). +If bReliableRequired is TRUE, very fast execution is guaranteed, but the results cannot be relied upon. If it's FALSE and the function is called for the first time, execution may take up to one minute but the results are reliable. IMPORTANT: As the execution may take a very long time if called for the first time with bReliableRequired set to TRUE, it should be called with bReliableRequired set to TRUE only before performing a dangerous - operation (such as header backup restore or formatting a supposedly non-system device) never at - WM_INITDIALOG or any other GUI events (use IsSystemDevicePath(path, hwndDlg, FALSE) for fast - preliminary GUI checks; also note that right after the "Select Device" dialog exits with an OK + operation (such as header backup restore or formatting a supposedly non-system device) never at + WM_INITDIALOG or any other GUI events (use IsSystemDevicePath(path, hwndDlg, FALSE) for fast + preliminary GUI checks; also note that right after the "Select Device" dialog exits with an OK return code, you can use the global flags bSysPartitionSelected and bSysDriveSelected to see if the user selected the system partition/device). After this function completes successfully, the results are cached for the rest of the session, bReliableRequired -is ignored (TRUE implied), repeated executions complete very fast, and the results are always reliable. +is ignored (TRUE implied), repeated executions complete very fast, and the results are always reliable. Return codes: 1 - it is the system partition path (e.g. \Device\Harddisk0\Partition1) 2 - it is the system drive path (e.g. \Device\Harddisk0\Partition0) @@ -3122,10 +3122,10 @@ int IsSystemDevicePath (const wchar_t *path, HWND hwndDlg, BOOL bReliableRequire /* Determines whether the path points to a non-system partition on the system drive. IMPORTANT: As this may take a very long time if called for the first time, it should be called - only before performing a dangerous operation, never at WM_INITDIALOG or any other GUI events. + only before performing a dangerous operation, never at WM_INITDIALOG or any other GUI events. Return codes: -0 - it isn't a non-system partition on the system drive -1 - it's a non-system partition on the system drive +0 - it isn't a non-system partition on the system drive +1 - it's a non-system partition on the system drive -1 - the result can't be determined, isn't reliable, or there was an error. */ int IsNonSysPartitionOnSysDrive (const wchar_t *path) { @@ -3165,12 +3165,12 @@ int IsNonSysPartitionOnSysDrive (const wchar_t *path) if (wcsncmp (tmpPath, SysDriveDevicePath, max (wcslen(tmpPath), wcslen(SysDriveDevicePath))) == 0) { - // It is a non-system partition on the system drive + // It is a non-system partition on the system drive return 1; } - else + else { - // The partition is not on the system drive + // The partition is not on the system drive return 0; } } @@ -3415,17 +3415,17 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l LocalizeDialog (hwndDlg, "IDD_RAWDEVICES_DLG"); SendMessage (hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0, - LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_TWOCLICKACTIVATE|LVS_EX_LABELTIP - ); + LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_TWOCLICKACTIVATE|LVS_EX_LABELTIP + ); - memset (&LvCol,0,sizeof(LvCol)); - LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT; + memset (&LvCol,0,sizeof(LvCol)); + LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT; LvCol.pszText = GetString ("DEVICE"); LvCol.cx = CompensateXDPI (186); LvCol.fmt = LVCFMT_LEFT; SendMessage (hList,LVM_INSERTCOLUMNW,0,(LPARAM)&LvCol); - LvCol.pszText = GetString ("DRIVE"); + LvCol.pszText = GetString ("DRIVE"); LvCol.cx = CompensateXDPI (38); LvCol.fmt = LVCFMT_LEFT; SendMessage (hList,LVM_INSERTCOLUMNW,1,(LPARAM)&LvCol); @@ -3479,7 +3479,7 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l // Path if (!device.IsPartition || device.DynamicVolume) { - if (!device.Floppy && (device.Size == 0) + if (!device.Floppy && (device.Size == 0) && (device.IsPartition || device.Partitions.empty() || device.Partitions[0].Size == 0) ) continue; @@ -3487,7 +3487,7 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (line > 1) { ListItemAdd (hList, item.iItem, L""); - item.iItem = line++; + item.iItem = line++; } if (device.Floppy || device.DynamicVolume) @@ -3540,7 +3540,7 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l } #endif - item.iItem = line++; + item.iItem = line++; } SendMessageW(hList, LVM_SETCOLUMNWIDTH, 0, MAKELPARAM(LVSCW_AUTOSIZE_USEHEADER, 0)); @@ -3563,8 +3563,8 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l { BOOL bEnableOkButton = FALSE; LVITEM LvItem; - memset(&LvItem,0,sizeof(LvItem)); - LvItem.mask = LVIF_TEXT | LVIF_PARAM; + memset(&LvItem,0,sizeof(LvItem)); + LvItem.mask = LVIF_TEXT | LVIF_PARAM; LvItem.iItem = ((LPNMLISTVIEW) lParam)->iItem; LvItem.pszText = lpszFileName; LvItem.cchTextMax = TC_MAX_PATH; @@ -3597,7 +3597,7 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l int selectedItem = ListView_GetSelectionMark (GetDlgItem (hwndDlg, IDC_DEVICELIST)); if (selectedItem == -1 || itemToDeviceMap.find (selectedItem) == itemToDeviceMap.end()) - return 1; // non-device line selected + return 1; // non-device line selected const HostDevice selectedDevice = itemToDeviceMap[selectedItem]; StringCchCopyW (lpszFileName, TC_MAX_PATH, selectedDevice.Path.c_str()); @@ -3710,7 +3710,7 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l } } - // Disallow format if the device contains partitions, but not if the partition is virtual or system + // Disallow format if the device contains partitions, but not if the partition is virtual or system if (!selectedDevice.IsVirtualPartition && !bHiddenVolDirect) { @@ -3731,7 +3731,7 @@ BOOL CALLBACK RawDevicesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l #endif // #ifdef VOLFORMAT } - else + else bSysDriveSelected = FALSE; #ifdef VOLFORMAT @@ -3908,7 +3908,7 @@ BOOL DriverUnload () if (hDriver == INVALID_HANDLE_VALUE) return TRUE; - + try { if (BootEncryption (NULL).GetStatus().DeviceFilterActive) @@ -4025,7 +4025,7 @@ start: } // Try to open a handle to the driver again (keep the mutex in case the other instance failed) - goto start; + goto start; } else { @@ -4034,7 +4034,7 @@ start: if (SystemEncryptionStatus != SYSENC_STATUS_NONE) { // This is an inconsistent state. The config file indicates system encryption should be - // active, but the driver is not running. This may happen e.g. when the pretest fails and + // active, but the driver is not running. This may happen e.g. when the pretest fails and // the user selects "Last Known Good Configuration" from the Windows boot menu. // To fix this, we're going to reinstall the driver, start it, and register it for boot. @@ -4068,7 +4068,7 @@ load: return res; bPortableModeConfirmed = TRUE; - + if (hDriver != INVALID_HANDLE_VALUE) CloseHandle (hDriver); hDriver = CreateFile (WIN32_ROOT_PREFIX, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); @@ -4242,7 +4242,7 @@ BOOL SelectMultipleFiles (HWND hwndDlg, const char *stringId, wchar_t *lpszFileN | OFN_PATHMUSTEXIST | OFN_ALLOWMULTISELECT | (keepHistory ? 0 : OFN_DONTADDTORECENT); - + if (!keepHistory) CleanLastVisitedMRU (); @@ -4272,7 +4272,7 @@ BOOL SelectMultipleFiles (HWND hwndDlg, const char *stringId, wchar_t *lpszFileN CleanLastVisitedMRU (); status = TRUE; - + ret: SystemFileSelectorCallPending = FALSE; ResetCurrentDirectory(); @@ -4306,10 +4306,10 @@ BOOL SelectMultipleFilesNext (wchar_t *lpszFileName, size_t cbFileName) } -static int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData) +static int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pData) { switch(uMsg) { - case BFFM_INITIALIZED: + case BFFM_INITIALIZED: { /* WParam is TRUE since we are passing a path. It would be FALSE if we were passing a pidl. */ @@ -4317,12 +4317,12 @@ static int CALLBACK BrowseCallbackProc(HWND hwnd,UINT uMsg,LPARAM lp, LPARAM pDa break; } - case BFFM_SELCHANGED: + case BFFM_SELCHANGED: { wchar_t szDir[TC_MAX_PATH]; /* Set the status window to the currently selected path. */ - if (SHGetPathFromIDList((LPITEMIDLIST) lp ,szDir)) + if (SHGetPathFromIDList((LPITEMIDLIST) lp ,szDir)) { SendMessage (hwnd,BFFM_SETSTATUSTEXT,0,(LPARAM)szDir); } @@ -4346,7 +4346,7 @@ BOOL BrowseDirectories (HWND hwndDlg, char *lpszTitle, wchar_t *dirName) CoInitialize (NULL); - if (SUCCEEDED (SHGetMalloc (&pMalloc))) + if (SUCCEEDED (SHGetMalloc (&pMalloc))) { ZeroMemory (&bi, sizeof(bi)); bi.hwndOwner = hwndDlg; @@ -4358,9 +4358,9 @@ BOOL BrowseDirectories (HWND hwndDlg, char *lpszTitle, wchar_t *dirName) bi.lParam = (LPARAM)dirName; pidl = SHBrowseForFolderW (&bi); - if (pidl != NULL) + if (pidl != NULL) { - if (SHGetPathFromIDList(pidl, dirName)) + if (SHGetPathFromIDList(pidl, dirName)) { bOK = TRUE; } @@ -4574,7 +4574,7 @@ static BOOL CALLBACK LocalizeDialogEnum( HWND hwnd, LPARAM font) // Font SendMessageW (hwnd, WM_SETFONT, (WPARAM) font, 0); - + return TRUE; } @@ -4588,7 +4588,7 @@ void LocalizeDialog (HWND hwnd, char *stringId) SetWindowTextW (hwnd, L"VeraCrypt"); else SetWindowTextW (hwnd, GetString (stringId)); - + if (hUserFont != 0) EnumChildWindows (hwnd, LocalizeDialogEnum, (LPARAM) hUserFont); } @@ -4669,10 +4669,10 @@ BOOL UpdateDriveCustomLabel (int driveNo, wchar_t* effectiveLabel, BOOL bSetValu DWORD cbLabelLen = (DWORD) ((wcslen (effectiveLabel) + 1) * sizeof (wchar_t)); BOOL bToBeDeleted = FALSE; - StringCbPrintfW (wszRegPath, sizeof (wszRegPath), L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\DriveIcons\\%s\\DefaultLabel", driveStr); - + StringCbPrintfW (wszRegPath, sizeof (wszRegPath), L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\DriveIcons\\%s\\DefaultLabel", driveStr); + if (bSetValue) - lStatus = RegCreateKeyExW (HKEY_CURRENT_USER, wszRegPath, NULL, NULL, 0, + lStatus = RegCreateKeyExW (HKEY_CURRENT_USER, wszRegPath, NULL, NULL, 0, KEY_READ | KEY_WRITE | KEY_SET_VALUE, NULL, &hKey, NULL); else lStatus = RegOpenKeyExW (HKEY_CURRENT_USER, wszRegPath, 0, KEY_READ | KEY_WRITE | KEY_SET_VALUE, &hKey); @@ -4696,7 +4696,7 @@ BOOL UpdateDriveCustomLabel (int driveNo, wchar_t* effectiveLabel, BOOL bSetValu if (bToBeDeleted) { - StringCbPrintfW (wszRegPath, sizeof (wszRegPath), L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\DriveIcons\\%s", driveStr); + StringCbPrintfW (wszRegPath, sizeof (wszRegPath), L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\DriveIcons\\%s", driveStr); lStatus = RegOpenKeyExW (HKEY_CURRENT_USER, wszRegPath, 0, KEY_READ | KEY_WRITE | KEY_SET_VALUE, &hKey); if (ERROR_SUCCESS == lStatus) { @@ -4722,7 +4722,7 @@ wstring GetUserFriendlyVersionString (int version) versionString.insert (version > 0xfff ? 2 : 1,L"."); if (versionString[versionString.length()-1] == L'0') - versionString.erase (versionString.length()-1, 1); + versionString.erase (versionString.length()-1, 1); return (versionString); } @@ -4774,7 +4774,7 @@ bool HexWideStringToArray (const wchar_t* hexStr, std::vector<byte>& arr) arr.clear(); if (len %2) return false; - + for (i = 0; i < len/2; i++) { if (!HexToByte (*hexStr++, b1) || !HexToByte (*hexStr++, b2)) @@ -4837,7 +4837,7 @@ void GetSpeedString (unsigned __int64 speed, wchar_t *str, size_t cbStr) { static wchar_t *b, *kb, *mb, *gb, *tb, *pb; static int serNo; - + if (b == NULL || serNo != LocalizationSerialNo) { serNo = LocalizationSerialNo; @@ -4920,7 +4920,7 @@ static void DisplayBenchmarkResults (HWND hwndDlg) } break; } - + /* Render the results */ SendMessage (hList,LVM_DELETEALLITEMS,0,(LPARAM)&LvItem); @@ -4934,7 +4934,7 @@ static void DisplayBenchmarkResults (HWND hwndDlg) LvItem.iItem = i; LvItem.iSubItem = 0; LvItem.pszText = (LPWSTR) benchmarkTable[i].name; - SendMessageW (hList, LVM_INSERTITEM, 0, (LPARAM)&LvItem); + SendMessageW (hList, LVM_INSERTITEM, 0, (LPARAM)&LvItem); #if PKCS5_BENCHMARKS wcscpy (item1, L"-"); @@ -4944,7 +4944,7 @@ static void DisplayBenchmarkResults (HWND hwndDlg) LvItem.iSubItem = 1; LvItem.pszText = item1; - SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem); + SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem); #if PKCS5_BENCHMARKS wcscpy (item1, L"-"); @@ -4954,7 +4954,7 @@ static void DisplayBenchmarkResults (HWND hwndDlg) LvItem.iSubItem = 2; LvItem.pszText = item1; - SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem); + SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem); #if PKCS5_BENCHMARKS swprintf (item1, L"%d t", benchmarkTable[i].encSpeed); @@ -4964,7 +4964,7 @@ static void DisplayBenchmarkResults (HWND hwndDlg) LvItem.iSubItem = 3; LvItem.pszText = item1; - SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem); + SendMessageW (hList, LVM_SETITEMW, 0, (LPARAM)&LvItem); } SendMessageW(hList, LVM_SETCOLUMNWIDTH, 0, MAKELPARAM(LVSCW_AUTOSIZE_USEHEADER, 0)); @@ -4978,7 +4978,7 @@ static void DisplayBenchmarkResults (HWND hwndDlg) typedef struct { HWND hBenchDlg; - BOOL bStatus; + BOOL bStatus; } BenchmarkThreadParam; static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg); @@ -5049,9 +5049,9 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg) #if HASH_FNC_BENCHMARKS /* Measures the speed at which each of the hash algorithms processes the message to produce - a single digest. + a single digest. - The hash algorithm benchmarks are included here for development purposes only. Do not enable + The hash algorithm benchmarks are included here for development purposes only. Do not enable them when building a public release (the benchmark GUI strings wouldn't make sense). */ { @@ -5062,7 +5062,7 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg) sha256_ctx s256ctx; int hid; - for (hid = FIRST_PRF_ID; hid <= LAST_PRF_ID; hid++) + for (hid = FIRST_PRF_ID; hid <= LAST_PRF_ID; hid++) { if (QueryPerformanceCounter (&performanceCountStart) == 0) goto counter_error; @@ -5112,21 +5112,21 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg) #elif PKCS5_BENCHMARKS // #if HASH_FNC_BENCHMARKS /* Measures the time that it takes for the PKCS-5 routine to derive a header key using - each of the implemented PRF algorithms. + each of the implemented PRF algorithms. - The PKCS-5 benchmarks are included here for development purposes only. Do not enable + The PKCS-5 benchmarks are included here for development purposes only. Do not enable them when building a public release (the benchmark GUI strings wouldn't make sense). */ { int thid, i; char dk[MASTER_KEYDATA_SIZE]; char *tmp_salt = {"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF\x01\x23\x45\x67\x89\xAB\xCD\xEF\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xAA\xBB\xCC\xDD\xEE\xFF"}; - for (thid = FIRST_PRF_ID; thid <= LAST_PRF_ID; thid++) + for (thid = FIRST_PRF_ID; thid <= LAST_PRF_ID; thid++) { if (QueryPerformanceCounter (&performanceCountStart) == 0) goto counter_error; - for (i = 1; i <= 5; i++) + for (i = 1; i <= 5; i++) { switch (thid) { @@ -5167,7 +5167,7 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg) #else // #elif PKCS5_BENCHMARKS /* Encryption algorithm benchmarks */ - + for (ci->ea = EAGetFirst(); ci->ea != 0; ci->ea = EAGetNext(ci->ea)) { if (!EAIsFormatEnabled (ci->ea)) @@ -5226,7 +5226,7 @@ static BOOL PerformBenchmark(HWND hBenchDlg, HWND hwndDlg) return TRUE; counter_error: - + if (ci) crypto_close (ci); @@ -5265,11 +5265,11 @@ BOOL CALLBACK BenchmarkDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP benchmarkSortMethod = BENCHMARK_SORT_BY_SPEED; SendMessage (hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0, - LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_LABELTIP - ); + LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_LABELTIP + ); - memset (&LvCol,0,sizeof(LvCol)); - LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT; + memset (&LvCol,0,sizeof(LvCol)); + LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT; LvCol.pszText = GetString ("ALGORITHM"); LvCol.cx = CompensateXDPI (114); LvCol.fmt = LVCFMT_LEFT; @@ -5518,7 +5518,7 @@ static BOOL CALLBACK RandomPoolEnrichementDlgProc (HWND hwndDlg, UINT msg, WPARA SetTimer (hwndDlg, 0xfd, RANDPOOL_DISPLAY_REFRESH_INTERVAL, NULL); SendMessage (GetDlgItem (hwndDlg, IDC_POOL_CONTENTS), WM_SETFONT, (WPARAM) hFixedDigitFont, (LPARAM) TRUE); - + hEntropyBar = GetDlgItem (hwndDlg, IDC_ENTROPY_BAR); SendMessage (hEntropyBar, PBM_SETRANGE32, 0, maxEntropyLevel); SendMessage (hEntropyBar, PBM_SETSTEP, 1, 0); @@ -5553,7 +5553,7 @@ static BOOL CALLBACK RandomPoolEnrichementDlgProc (HWND hwndDlg, UINT msg, WPARA else if (bUseMask) { /* use mask to compute a randomized ascii representation */ - tmpByte = (randPool[row * RANDPOOL_DISPLAY_COLUMNS + col] - + tmpByte = (randPool[row * RANDPOOL_DISPLAY_COLUMNS + col] - lastRandPool[row * RANDPOOL_DISPLAY_COLUMNS + col]) ^ maskRandPool [row * RANDPOOL_DISPLAY_COLUMNS + col]; tmp[0] = (wchar_t) (((tmpByte >> 4) % 6) + L'*'); tmp[1] = (wchar_t) (((tmpByte & 0x0F) % 6) + L'*'); @@ -5714,8 +5714,8 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP SendMessage (hEntropyBar, PBM_SETSTEP, 1, 0); SendMessage (hEntropyBar, PBM_SETSTATE, PBST_ERROR, 0); -#ifndef VOLFORMAT - if (Randinit ()) +#ifndef VOLFORMAT + if (Randinit ()) { handleError (hwndDlg, (CryptoAPILastError == ERROR_SUCCESS)? ERR_RAND_INIT_FAILED : ERR_CAPI_INIT_FAILED, SRC_POS); EndDialog (hwndDlg, IDCLOSE); @@ -5761,7 +5761,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP else if (bUseMask) { /* use mask to compute a randomized ASCII representation */ - tmpByte = (randPool[row * RANDPOOL_DISPLAY_COLUMNS + col] - + tmpByte = (randPool[row * RANDPOOL_DISPLAY_COLUMNS + col] - lastRandPool[row * RANDPOOL_DISPLAY_COLUMNS + col]) ^ maskRandPool [row * RANDPOOL_DISPLAY_COLUMNS + col]; tmp[0] = (wchar_t) (((tmpByte >> 4) % 6) + L'*'); tmp[1] = (wchar_t) (((tmpByte & 0x0F) % 6) + L'*'); @@ -5889,7 +5889,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP for (i= 0; i < keyfilesCount; i++) { StringCbCopyW(szFileName, sizeof(szFileName), szDirName); - + if (i > 0) { StringCbPrintfW(szSuffix, sizeof(szSuffix), L"_%d", i); @@ -5946,7 +5946,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP NormalCursor(); return 1; } - + /* since keyfilesSize < 1024 * 1024, we mask with 0x000FFFFF */ keyfilesSize = (long) (((unsigned long) keyfilesSize) & 0x000FFFFF); @@ -5954,7 +5954,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP keyfilesSize += 64; } - /* Generate the keyfile */ + /* Generate the keyfile */ if (!RandgetBytesFull (hwndDlg, keyfile, keyfilesSize, TRUE, TRUE)) { _close (fhKeyfile); @@ -5962,7 +5962,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP TCfree(keyfile); NormalCursor(); return 1; - } + } /* Write the keyfile */ status = _write (fhKeyfile, keyfile, keyfilesSize); @@ -5975,7 +5975,7 @@ BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LP NormalCursor(); handleWin32Error (hwndDlg, SRC_POS); return 1; - } + } } TCfree(keyfile); @@ -5994,7 +5994,7 @@ exit: WaitCursor(); KillTimer (hwndDlg, 0xfd); -#ifndef VOLFORMAT +#ifndef VOLFORMAT RandStop (FALSE); #endif /* Cleanup */ @@ -6109,7 +6109,7 @@ CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { ShowWindow(GetDlgItem(hwndDlg, IDC_TESTS_MESSAGE), SW_SHOWNORMAL); SetWindowTextW(GetDlgItem(hwndDlg, IDC_TESTS_MESSAGE), GetString ("TESTS_FAILED")); - } + } else { ShowWindow(GetDlgItem(hwndDlg, IDC_TESTS_MESSAGE), SW_SHOWNORMAL); @@ -6215,7 +6215,7 @@ CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) inputtext[n] = (char) x; } - + // XTS if (bXTSTestEnabled) { @@ -6272,10 +6272,10 @@ CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) blockNo = (int) SendMessage (GetDlgItem (hwndDlg, IDC_TEST_BLOCK_NUMBER), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_TEST_BLOCK_NUMBER), CB_GETCURSEL, 0, 0), 0); } // if (bXTSTestEnabled) - + /* Perform the actual tests */ - if (ks != CB_ERR && pt != CB_ERR) + if (ks != CB_ERR && pt != CB_ERR) { char tmp[128]; int tmpRetVal; @@ -6372,7 +6372,7 @@ CipherTestDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; } -void +void ResetCipherTest(HWND hwndDlg, int idTestCipher) { int ndx; @@ -6406,7 +6406,7 @@ ResetCipherTest(HWND hwndDlg, int idTestCipher) SetWindowText(GetDlgItem(hwndDlg, IDC_SECONDARY_KEY), L"0000000000000000000000000000000000000000000000000000000000000000"); SetWindowText(GetDlgItem(hwndDlg, IDC_TEST_DATA_UNIT_NUMBER), L"0"); - + SetWindowText(GetDlgItem(hwndDlg, IDC_PLAINTEXT), L"0000000000000000"); SetWindowText(GetDlgItem(hwndDlg, IDC_CIPHERTEXT), L"0000000000000000"); @@ -6476,7 +6476,7 @@ BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA pStr++; pwStr++; - do + do { if (*pStr != 0) { @@ -6490,7 +6490,7 @@ BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA hUserFont), nLongestButtonCaptionWidth); - nLongestButtonCaptionCharLen = max (nLongestButtonCaptionCharLen, + nLongestButtonCaptionCharLen = max (nLongestButtonCaptionCharLen, (int) wcslen ((const wchar_t *) (bResolve ? GetString(*pStr) : *pwStr))); } @@ -6509,14 +6509,14 @@ BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA // Length of main message in characters (not bytes) nMainTextLenInChars = (int) wcslen ((const wchar_t *) (bResolve ? GetString(*(pStrOrig+1)) : *(pwStrOrig+1))); - if (nMainTextLenInChars > 200 + if (nMainTextLenInChars > 200 && nMainTextLenInChars / nLongestButtonCaptionCharLen >= 10) { - // As the main text is longer than 200 characters, we will "pad" the widest button caption with - // spaces (if it is not wide enough) so as to increase the width of the whole dialog window. + // As the main text is longer than 200 characters, we will "pad" the widest button caption with + // spaces (if it is not wide enough) so as to increase the width of the whole dialog window. // Otherwise, it would look too tall (dialog boxes look better when they are more wide than tall). nLongestButtonCaptionWidth = CompensateXDPI (max ( - nLongestButtonCaptionWidth, + nLongestButtonCaptionWidth, min (350, nMainTextLenInChars))); } @@ -6544,10 +6544,10 @@ BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA do { - offset = FindString ((char *) (bResolve ? GetString(*(pStrOrig+1)) : *(pwStrOrig+1)), + offset = FindString ((char *) (bResolve ? GetString(*(pStrOrig+1)) : *(pwStrOrig+1)), (char *) L"\n", - nMainTextLenInChars * 2, - (int) wcslen (L"\n") * 2, + nMainTextLenInChars * 2, + (int) wcslen (L"\n") * 2, offset + 1); newLineSeqCount++; @@ -6568,8 +6568,8 @@ BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA // Reduction in height according to the number of shown buttons vertSubOffset = ((MAX_MULTI_CHOICES - nActiveChoices) * nBaseButtonHeight); - if (horizSubOffset > 0 - || vertMsgHeightOffset > 0 + if (horizSubOffset > 0 + || vertMsgHeightOffset > 0 || vertOffset > 0) { // Resize/move each button if necessary @@ -6603,7 +6603,7 @@ BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA trec.right + 2 + horizSubOffset, trec.bottom + 2, TRUE); - + GetWindowRect(GetDlgItem(hwndDlg, IDC_MC_DLG_HR2), &rec); GetClientRect(GetDlgItem(hwndDlg, IDC_MC_DLG_HR2), &trec); MoveWindow (GetDlgItem(hwndDlg, IDC_MC_DLG_HR2), @@ -6657,7 +6657,7 @@ BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA BOOL CheckCapsLock (HWND hwnd, BOOL quiet) { - if ((GetKeyState(VK_CAPITAL) & 1) != 0) + if ((GetKeyState(VK_CAPITAL) & 1) != 0) { if (!quiet) { @@ -6686,7 +6686,7 @@ BOOL CheckFileExtension (wchar_t *fileName) L".vb", L".vbe", L".vbs", L".vsmacros", L".vss", L".vst", L".vsw", L".ws", L".wsc", L".wsf", L".wsh", L".xsd", L".xsl", // These additional file extensions are usually watched by antivirus programs L".386", L".acm", L".ade", L".adp", L".ani", L".app", L".asd", L".asf", L".asx", L".awx", L".ax", L".boo", L".bz2", L".cdf", - L".class", L".dhtm", L".dhtml",L".dlo", L".emf", L".eml", L".flt", L".fot", L".gz", L".hlp", L".htm", L".html", L".ini", + L".class", L".dhtm", L".dhtml",L".dlo", L".emf", L".eml", L".flt", L".fot", L".gz", L".hlp", L".htm", L".html", L".ini", L".j2k", L".jar", L".jff", L".jif", L".jmh", L".jng", L".jp2", L".jpe", L".jpeg", L".jpg", L".lsp", L".mod", L".nws", L".obj", L".olb", L".osd", L".ov1", L".ov2", L".ov3", L".ovl", L".ovl", L".ovr", L".pdr", L".pgm", L".php", L".pkg", L".pl", L".png", L".pot", L".pps", L".ppt", L".ps1", L".ps1xml", L".psc1", L".rar", L".rpl", L".rtf", L".sbf", L".script", L".sh", L".sha", L".shtm", @@ -6858,7 +6858,7 @@ int DriverUnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forced) memcpy (wszLabel, prop.wszLabel, sizeof (wszLabel)); bDriverSetLabel = prop.bDriverSetLabel; } - + unmount.nDosDriveNo = nDosDriveNo; unmount.ignoreOpenFiles = forced; @@ -6928,11 +6928,11 @@ void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap) } } - dbv.dbcv_size = sizeof (dbv); - dbv.dbcv_devicetype = DBT_DEVTYP_VOLUME; + dbv.dbcv_size = sizeof (dbv); + dbv.dbcv_devicetype = DBT_DEVTYP_VOLUME; dbv.dbcv_reserved = 0; dbv.dbcv_unitmask = driveMap; - dbv.dbcv_flags = 0; + dbv.dbcv_flags = 0; UINT timeOut = 1000; @@ -7032,8 +7032,8 @@ BOOL CALLBACK WaitDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) SetWindowLongPtrW (hProgress, GWL_STYLE, PBS_MARQUEE | GetWindowLongPtrW (hProgress, GWL_STYLE)); ::SendMessageW(hProgress, PBM_SETMARQUEE, (WPARAM) TRUE, (LPARAM) 0); } - - thParam->hwnd = hwndDlg; + + thParam->hwnd = hwndDlg; // For now, we don't have system menu is the resources but we leave this code // if it is enabled in the future @@ -7047,8 +7047,8 @@ BOOL CALLBACK WaitDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) HICON hIcon = (HICON)::LoadImage(hInst, MAKEINTRESOURCE(IDI_TRUECRYPT_ICON), IMAGE_ICON, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR); ::SendMessage(hwndDlg, WM_SETICON, TRUE, (LPARAM)hIcon); HICON hIconSmall = (HICON)::LoadImage(hInst, MAKEINTRESOURCE(IDI_TRUECRYPT_ICON), IMAGE_ICON, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR); - ::SendMessage(hwndDlg, WM_SETICON, FALSE, (LPARAM)hIconSmall); - } + ::SendMessage(hwndDlg, WM_SETICON, FALSE, (LPARAM)hIconSmall); + } LocalizeDialog (hwndDlg, NULL); _beginthread(WaitThread, 0, thParam); @@ -7076,26 +7076,26 @@ BOOL CALLBACK WaitDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) void BringToForeground(HWND hWnd) { if(!::IsWindow(hWnd)) return; - + DWORD lockTimeOut = 0; HWND hCurrWnd = ::GetForegroundWindow(); DWORD dwThisTID = ::GetCurrentThreadId(), dwCurrTID = ::GetWindowThreadProcessId(hCurrWnd,0); - + if (hCurrWnd != hWnd) { if(dwThisTID != dwCurrTID) { ::AttachThreadInput(dwThisTID, dwCurrTID, TRUE); - + ::SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT,0,&lockTimeOut,0); ::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,0,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE); - + ::AllowSetForegroundWindow(ASFW_ANY); } - + ::SetForegroundWindow(hWnd); - + if(dwThisTID != dwCurrTID) { ::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,(PVOID)lockTimeOut,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE); @@ -7168,12 +7168,12 @@ static BOOL PerformMountIoctl (MOUNT_STRUCT* pmount, LPDWORD pdwResult, BOOL use CreateFullVolumePath (pmount->wszVolume, sizeof(pmount->wszVolume), devicePath.c_str(), &bDevice); } } - + return DeviceIoControl (hDriver, TC_IOCTL_MOUNT_VOLUME, pmount, sizeof (MOUNT_STRUCT), pmount, sizeof (MOUNT_STRUCT), pdwResult, NULL); } -// specific definitions and implementation for support of mount operation +// specific definitions and implementation for support of mount operation // in wait dialog mechanism typedef struct @@ -7306,7 +7306,7 @@ retry: path = path.substr (4); StringCchCopyW (volumePath, TC_MAX_PATH, path.c_str()); } - + if (path.find (L"Volume{") == 0 && path.rfind (L"}\\") == path.size() - 2) { wstring resolvedPath = VolumeGuidPathToDevicePath (path); @@ -7318,7 +7318,7 @@ retry: if ((path.length () >= 3) && (_wcsnicmp (path.c_str(), L"ID:", 3) == 0)) { std::vector<byte> arr; - if ( (path.length() == (3 + 2*VOLUME_ID_SIZE)) + if ( (path.length() == (3 + 2*VOLUME_ID_SIZE)) && HexWideStringToArray (path.c_str() + 3, arr) && (arr.size() == VOLUME_ID_SIZE) ) @@ -7355,7 +7355,7 @@ retry: mount.BytesPerSector = bps; mount.BytesPerPhysicalSector = bps; } - + if (IsOSAtLeast (WIN_VISTA)) { if ( (wcslen(root) >= 2) @@ -7463,7 +7463,7 @@ retry: goto retry; } - // Ask user + // Ask user if (IDYES == AskWarnNoYes ("FILE_IN_USE", hwndDlg)) { mount.bExclusiveAccess = FALSE; @@ -7484,12 +7484,12 @@ retry: { if (mount.nReturnCode == ERR_PASSWORD_WRONG) { - // Do not report wrong password, if not instructed to + // Do not report wrong password, if not instructed to if (bReportWrongPassword) { IncreaseWrongPwdRetryCount (1); // We increase the count here only if bReportWrongPassword is TRUE, because "Auto-Mount All Devices" and other callers do it separately - if (WrongPwdRetryCountOverLimit () + if (WrongPwdRetryCountOverLimit () && !mount.UseBackupHeader) { // Retry using embedded header backup (if any) @@ -7537,7 +7537,7 @@ retry: if (bReportWrongPassword && !Silent) Warning ("HEADER_DAMAGED_AUTO_USED_HEADER_BAK", hwndDlg); } - + LastMountedVolumeDirty = mount.FilesystemDirty; if (mount.FilesystemDirty) @@ -7661,7 +7661,7 @@ retry: } else { - ShowWaitDialog (hwndDlg, FALSE, UnmountWaitThreadProc, ¶m); + ShowWaitDialog (hwndDlg, FALSE, UnmountWaitThreadProc, ¶m); } SetLastError (param.dwLastError); @@ -7689,8 +7689,8 @@ retry: Error ("UNMOUNT_FAILED", hwndDlg); return FALSE; - } - + } + BroadcastDeviceChange (DBT_DEVICEREMOVECOMPLETE, nDosDriveNo, 0); return TRUE; @@ -7939,7 +7939,7 @@ BOOL GetPhysicalDriveGeometry (int driveNumber, PDISK_GEOMETRY diskGeometry) ZeroMemory (diskGeometry, sizeof (DISK_GEOMETRY)); if ( DeviceIoControl (hDev, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, diskGeometry, sizeof (DISK_GEOMETRY), &bytesRead, NULL) - && (bytesRead == sizeof (DISK_GEOMETRY)) + && (bytesRead == sizeof (DISK_GEOMETRY)) && diskGeometry->BytesPerSector) { bResult = TRUE; @@ -8006,7 +8006,7 @@ int FileSystemAppearsEmpty (const wchar_t *devicePath) // Returns the free space on the specified partition (volume) in bytes. If the 'occupiedBytes' pointer // is not NULL, size of occupied space (in bytes) is written to the pointed location. In addition, if the -// 'percent' pointer is not NULL, % of free space is stored in the pointed location. If there's an error, +// 'percent' pointer is not NULL, % of free space is stored in the pointed location. If there's an error, // returns -1. __int64 GetStatsFreeSpaceOnPartition (const wchar_t *devicePath, float *percentFree, __int64 *occupiedBytes, BOOL silent) { @@ -8094,12 +8094,12 @@ HANDLE DismountDrive (wchar_t *devName, wchar_t *devicePath) return INVALID_HANDLE_VALUE; - // Try to lock the volume first so that dismount is not forced. + // Try to lock the volume first so that dismount is not forced. // If we fail, we will dismount anyway even if it needs to be forced. CloseVolumeExplorerWindows (MainDlg, driveLetterNo); - while (!(bResult = DeviceIoControl (hVolume, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &dwResult, NULL)) + while (!(bResult = DeviceIoControl (hVolume, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &dwResult, NULL)) && attempt > 0) { Sleep (UNMOUNT_AUTO_RETRY_DELAY); @@ -8111,7 +8111,7 @@ HANDLE DismountDrive (wchar_t *devName, wchar_t *devicePath) attempt = UNMOUNT_MAX_AUTO_RETRIES; - while (!(bResult = DeviceIoControl (hVolume, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &dwResult, NULL)) + while (!(bResult = DeviceIoControl (hVolume, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &dwResult, NULL)) && attempt > 0) { Sleep (UNMOUNT_AUTO_RETRY_DELAY); @@ -8125,12 +8125,12 @@ HANDLE DismountDrive (wchar_t *devName, wchar_t *devicePath) } // Returns -1 if the specified string is not found in the buffer. Otherwise, returns the -// offset of the first occurrence of the string. The string and the buffer may contain zeroes, +// offset of the first occurrence of the string. The string and the buffer may contain zeroes, // which do NOT terminate them. int64 FindString (const char *buf, const char *str, int64 bufLen, int64 strLen, int64 startOffset) { - if (buf == NULL - || str == NULL + if (buf == NULL + || str == NULL || strLen > bufLen || bufLen < 1 || strLen < 1 @@ -8172,7 +8172,7 @@ BOOL FileExists (const wchar_t *filePathPtr) // Searches the file from its end for the LAST occurrence of the string str. // The string may contain zeroes, which do NOT terminate the string. -// If the string is found, its offset from the start of the file is returned. +// If the string is found, its offset from the start of the file is returned. // If the string isn't found or if any error occurs, -1 is returned. __int64 FindStringInFile (const wchar_t *filePath, const char* str, int strLen) { @@ -8188,8 +8188,8 @@ __int64 FindStringInFile (const wchar_t *filePath, const char* str, int strLen) int filePosStep; __int64 retVal = -1; - if (filePos <= 0 - || buffer == NULL + if (filePos <= 0 + || buffer == NULL || strLen > bufSize || strLen < 1) { @@ -8223,7 +8223,7 @@ __int64 FindStringInFile (const wchar_t *filePath, const char* str, int strLen) if (SetFilePointerEx (src, seekOffset, &seekOffsetNew, FILE_BEGIN) == 0) goto fsif_end; - if ((readRetVal = ReadFile (src, buffer, bufSize, &bytesRead, NULL)) == 0 + if ((readRetVal = ReadFile (src, buffer, bufSize, &bytesRead, NULL)) == 0 || bytesRead == 0) goto fsif_end; @@ -8316,7 +8316,7 @@ BOOL TCCopyFile (wchar_t *sourceFileName, wchar_t *destinationFile) return TCCopyFileBase (src, dst); } -// If bAppend is TRUE, the buffer is appended to an existing file. If bAppend is FALSE, any existing file +// If bAppend is TRUE, the buffer is appended to an existing file. If bAppend is FALSE, any existing file // is replaced. If an error occurs, the incomplete file is deleted (provided that bAppend is FALSE). BOOL SaveBufferToFile (const char *inputBuffer, const wchar_t *destinationFile, DWORD inputLength, BOOL bAppend, BOOL bRenameIfFailed) { @@ -8355,7 +8355,7 @@ BOOL SaveBufferToFile (const char *inputBuffer, const wchar_t *destinationFile, } } } - + if (dst == INVALID_HANDLE_VALUE) { SetLastError (dwLastError); @@ -8376,7 +8376,7 @@ BOOL SaveBufferToFile (const char *inputBuffer, const wchar_t *destinationFile, { // If CREATE_ALWAYS is used, ERROR_ALREADY_EXISTS is returned after successful overwrite // of an existing file (it's not an error) - if (! (GetLastError() == ERROR_ALREADY_EXISTS && !bAppend) ) + if (! (GetLastError() == ERROR_ALREADY_EXISTS && !bAppend) ) handleWin32Error (MainDlg, SRC_POS); } @@ -8405,7 +8405,7 @@ BOOL TCFlushFile (FILE *f) // Prints a UTF-16 text (note that this involves a real printer, not a screen). // textByteLen - length of the text in bytes -// title - printed as part of the page header and used as the filename for a temporary file +// title - printed as part of the page header and used as the filename for a temporary file BOOL PrintHardCopyTextUTF16 (wchar_t *text, wchar_t *title, size_t textByteLen) { wchar_t cl [MAX_PATH*3] = {L"/p \""}; @@ -8486,7 +8486,7 @@ BOOL IsNonInstallMode () else { // This is also returned if we fail to determine the status (it does not mean that portable mode is disproved). - return FALSE; + return FALSE; } } else @@ -8510,7 +8510,7 @@ BOOL IsNonInstallMode () if (FileExists (path)) { // To maintain consistency and safety, if the system encryption config file exits, we cannot - // allow portable mode. (This happens e.g. when the pretest fails and the user selects + // allow portable mode. (This happens e.g. when the pretest fails and the user selects // "Last Known Good Configuration" from the Windows boot menu.) // However, if UAC elevation is needed, we have to confirm portable mode first (after we are elevated, we won't). @@ -8522,7 +8522,7 @@ BOOL IsNonInstallMode () } // As the driver was not found in the system path, we can predict that we will run in portable mode - return TRUE; + return TRUE; } else CloseHandle (hDriverTmp); @@ -8669,7 +8669,7 @@ void CleanLastVisitedMRU (void) if ((len = ReadRegistryBytes (regPath, key, (char *) strTmp, sizeof (strTmp))) > 0) { - if (_wcsicmp (strTmp, strToMatch) == 0) + if (_wcsicmp (strTmp, strToMatch) == 0) { char buf[65536], bufout[sizeof (buf)]; @@ -8752,7 +8752,7 @@ LRESULT ListItemAdd (HWND list, int index, const wchar_t *string) li.mask = LVIF_TEXT; li.pszText = (wchar_t*) string; - li.iItem = index; + li.iItem = index; li.iSubItem = 0; return ListView_InsertItem (list, &li); } @@ -8765,7 +8765,7 @@ LRESULT ListSubItemSet (HWND list, int index, int subIndex, const wchar_t *strin li.mask = LVIF_TEXT; li.pszText = (wchar_t*) string; - li.iItem = index; + li.iItem = index; li.iSubItem = subIndex; return ListView_SetItem (list, &li); } @@ -8825,7 +8825,7 @@ BOOL LoadInt32 (const wchar_t *filePath, unsigned __int32 *result, __int64 fileO if (SetFilePointerEx (src, seekOffset, &seekOffsetNew, FILE_BEGIN) == 0) goto fsif_end; - if (ReadFile (src, buffer, bufSize, &bytesRead, NULL) == 0 + if (ReadFile (src, buffer, bufSize, &bytesRead, NULL) == 0 || bytesRead != bufSize) goto fsif_end; @@ -8869,7 +8869,7 @@ BOOL LoadInt16 (const wchar_t *filePath, int *result, __int64 fileOffset) if (SetFilePointerEx (src, seekOffset, &seekOffsetNew, FILE_BEGIN) == 0) goto fsif_end; - if (ReadFile (src, buffer, bufSize, &bytesRead, NULL) == 0 + if (ReadFile (src, buffer, bufSize, &bytesRead, NULL) == 0 || bytesRead != bufSize) goto fsif_end; @@ -9038,7 +9038,7 @@ wchar_t *GetProgramConfigPath (wchar_t *fileName) std::wstring GetServiceConfigPath (const wchar_t *fileName, bool useLegacy) { wchar_t sysPath[TC_MAX_PATH]; - + if (Is64BitOs() && useLegacy) { typedef UINT (WINAPI *GetSystemWow64Directory_t) (LPWSTR lpBuffer, UINT uSize); @@ -9073,18 +9073,18 @@ void TaskBarIconDisplayBalloonTooltip (HWND hwnd, wchar_t *headline, wchar_t *te return; } - NOTIFYICONDATAW tnid; + NOTIFYICONDATAW tnid; ZeroMemory (&tnid, sizeof (tnid)); - tnid.cbSize = sizeof (tnid); - tnid.hWnd = hwnd; - tnid.uID = IDI_TRUECRYPT_ICON; + tnid.cbSize = sizeof (tnid); + tnid.hWnd = hwnd; + tnid.uID = IDI_TRUECRYPT_ICON; //tnid.uVersion = (IsOSAtLeast (WIN_VISTA) ? NOTIFYICON_VERSION_4 : NOTIFYICON_VERSION); //Shell_NotifyIconW (NIM_SETVERSION, &tnid); - tnid.uFlags = NIF_INFO; + tnid.uFlags = NIF_INFO; tnid.dwInfoFlags = (warning ? NIIF_WARNING : NIIF_INFO); tnid.uTimeout = (IsOSAtLeast (WIN_VISTA) ? 1000 : 5000); // in ms @@ -9100,12 +9100,12 @@ void TaskBarIconDisplayBalloonTooltip (HWND hwnd, wchar_t *headline, wchar_t *te // Either of the pointers may be NULL void InfoBalloon (char *headingStringId, char *textStringId, HWND hwnd) { - if (Silent) + if (Silent) return; TaskBarIconDisplayBalloonTooltip (hwnd, - headingStringId == NULL ? L"VeraCrypt" : GetString (headingStringId), - textStringId == NULL ? L" " : GetString (textStringId), + headingStringId == NULL ? L"VeraCrypt" : GetString (headingStringId), + textStringId == NULL ? L" " : GetString (textStringId), FALSE); } @@ -9113,12 +9113,12 @@ void InfoBalloon (char *headingStringId, char *textStringId, HWND hwnd) // Either of the pointers may be NULL void InfoBalloonDirect (wchar_t *headingString, wchar_t *textString, HWND hwnd) { - if (Silent) + if (Silent) return; TaskBarIconDisplayBalloonTooltip (hwnd, - headingString == NULL ? L"VeraCrypt" : headingString, - textString == NULL ? L" " : textString, + headingString == NULL ? L"VeraCrypt" : headingString, + textString == NULL ? L" " : textString, FALSE); } @@ -9126,12 +9126,12 @@ void InfoBalloonDirect (wchar_t *headingString, wchar_t *textString, HWND hwnd) // Either of the pointers may be NULL void WarningBalloon (char *headingStringId, char *textStringId, HWND hwnd) { - if (Silent) + if (Silent) return; TaskBarIconDisplayBalloonTooltip (hwnd, - headingStringId == NULL ? L"VeraCrypt" : GetString (headingStringId), - textStringId == NULL ? L" " : GetString (textStringId), + headingStringId == NULL ? L"VeraCrypt" : GetString (headingStringId), + textStringId == NULL ? L" " : GetString (textStringId), TRUE); } @@ -9139,12 +9139,12 @@ void WarningBalloon (char *headingStringId, char *textStringId, HWND hwnd) // Either of the pointers may be NULL void WarningBalloonDirect (wchar_t *headingString, wchar_t *textString, HWND hwnd) { - if (Silent) + if (Silent) return; TaskBarIconDisplayBalloonTooltip (hwnd, - headingString == NULL ? L"VeraCrypt" : headingString, - textString == NULL ? L" " : textString, + headingString == NULL ? L"VeraCrypt" : headingString, + textString == NULL ? L" " : textString, TRUE); } @@ -9347,7 +9347,7 @@ int AskMultiChoice (void *strings[], BOOL bBold, HWND hwnd) params.strings = &strings[0]; params.bold = bBold; - return (int) DialogBoxParamW (hInst, + return (int) DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_MULTI_CHOICE_DLG), hwnd, (DLGPROC) MultiChoiceDialogProc, (LPARAM) ¶ms); } @@ -9356,7 +9356,7 @@ int AskMultiChoice (void *strings[], BOOL bBold, HWND hwnd) BOOL ConfigWriteBegin () { DWORD size; - if (ConfigFileHandle != NULL) + if (ConfigFileHandle != NULL) return FALSE; if (ConfigBuffer == NULL) @@ -9540,7 +9540,7 @@ void ConfigReadCompareString (char *configKey, char *defaultValue, char *str, in *pbModified = TRUE; if (!bOnlyCheckModified) ConfigReadString (configKey, defaultValue, str, maxLen); - + } } @@ -9597,7 +9597,7 @@ BOOL LoadDefaultKeyFilesParam (void) char *xml = defaultKeyfilesFile; KeyFile *kf; - if (xml == NULL) + if (xml == NULL) return FALSE; KeyFileRemoveAll (&defaultKeyFilesParam.FirstKeyFile); @@ -9738,7 +9738,7 @@ BOOL IsServerOS () } -// Returns TRUE, if the currently running operating system is installed in a hidden volume. If it's not, or if +// Returns TRUE, if the currently running operating system is installed in a hidden volume. If it's not, or if // there's an error, returns FALSE. BOOL IsHiddenOSRunning (void) { @@ -9777,30 +9777,30 @@ BOOL EnableWow64FsRedirection (BOOL enable) BOOL RestartComputer (void) { - TOKEN_PRIVILEGES tokenPrivil; - HANDLE hTkn; + TOKEN_PRIVILEGES tokenPrivil; + HANDLE hTkn; if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY|TOKEN_ADJUST_PRIVILEGES, &hTkn)) { - return false; + return false; } - LookupPrivilegeValue (NULL, SE_SHUTDOWN_NAME, &tokenPrivil.Privileges[0].Luid); - tokenPrivil.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; - tokenPrivil.PrivilegeCount = 1; + LookupPrivilegeValue (NULL, SE_SHUTDOWN_NAME, &tokenPrivil.Privileges[0].Luid); + tokenPrivil.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + tokenPrivil.PrivilegeCount = 1; - AdjustTokenPrivileges (hTkn, false, &tokenPrivil, 0, (PTOKEN_PRIVILEGES) NULL, 0); - if (GetLastError() != ERROR_SUCCESS) + AdjustTokenPrivileges (hTkn, false, &tokenPrivil, 0, (PTOKEN_PRIVILEGES) NULL, 0); + if (GetLastError() != ERROR_SUCCESS) { CloseHandle(hTkn); - return false; + return false; } if (!ExitWindowsEx (EWX_REBOOT, - SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED)) + SHTDN_REASON_MAJOR_OTHER | SHTDN_REASON_MINOR_OTHER | SHTDN_REASON_FLAG_PLANNED)) { CloseHandle(hTkn); - return false; + return false; } CloseHandle(hTkn); @@ -9873,7 +9873,7 @@ std::wstring GetWindowsEdition () osname += L"-server"; if (IsOSAtLeast (WIN_VISTA)) - { + { if (home) osname += L"-home"; else if (wcsstr (productName, L"Standard") != 0) @@ -10068,7 +10068,7 @@ void HandleDriveNotReadyError (HWND hwnd) 0, KEY_READ, &hkey) != ERROR_SUCCESS) return; - if (RegQueryValueEx (hkey, L"NoAutoMount", 0, 0, (LPBYTE) &value, &size) == ERROR_SUCCESS + if (RegQueryValueEx (hkey, L"NoAutoMount", 0, 0, (LPBYTE) &value, &size) == ERROR_SUCCESS && value != 0) { Warning ("SYS_AUTOMOUNT_DISABLED", hwnd); @@ -10124,7 +10124,7 @@ BOOL CALLBACK FindTCWindowEnum (HWND hwnd, LPARAM lParam) BYTE *MapResource (wchar_t *resourceType, int resourceId, PDWORD size) { - HGLOBAL hResL; + HGLOBAL hResL; HRSRC hRes; hRes = FindResource (NULL, MAKEINTRESOURCE(resourceId), resourceType); @@ -10132,7 +10132,7 @@ BYTE *MapResource (wchar_t *resourceType, int resourceId, PDWORD size) if (size != NULL) *size = SizeofResource (NULL, hRes); - + return (BYTE *) LockResource (hResL); } @@ -10205,8 +10205,8 @@ int OpenVolume (OpenVolumeContext *context, const wchar_t *volumePath, Password if (context->IsDevice) { - // Try to gain "raw" access to the partition in case there is a live filesystem on it (otherwise, - // the NTFS driver guards hidden sectors and prevents e.g. header backup restore after the user + // Try to gain "raw" access to the partition in case there is a live filesystem on it (otherwise, + // the NTFS driver guards hidden sectors and prevents e.g. header backup restore after the user // accidentally quick-formats a dismounted partition-hosted TrueCrypt volume as NTFS, etc.) DeviceIoControl (context->HostFileHandle, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, 0, NULL, 0, &dwResult, NULL); @@ -10299,7 +10299,7 @@ int OpenVolume (OpenVolumeContext *context, const wchar_t *volumePath, Password && context->IsDevice) { // If FSCTL_ALLOW_EXTENDED_DASD_IO failed and there is a live filesystem on the partition, then the - // filesystem driver may report EOF when we are reading hidden sectors (when the filesystem is + // filesystem driver may report EOF when we are reading hidden sectors (when the filesystem is // shorter than the partition). This can happen for example after the user quick-formats a dismounted // partition-hosted TrueCrypt volume and then tries to read the embedded backup header. @@ -10355,7 +10355,7 @@ void CloseVolume (OpenVolumeContext *context) int ReEncryptVolumeHeader (HWND hwndDlg, char *buffer, BOOL bBoot, CRYPTO_INFO *cryptoInfo, Password *password, int pim, BOOL wipeMode) { CRYPTO_INFO *newCryptoInfo = NULL; - + RandSetHashFunction (cryptoInfo->pkcs5); if (Randinit() != ERR_SUCCESS) @@ -10401,7 +10401,7 @@ BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly) wchar_t data[65536]; DWORD size = sizeof (data); - + if (IsPagingFileWildcardActive()) return TRUE; @@ -10426,7 +10426,7 @@ BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly) } HANDLE handle = CreateFile (drivePath.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); - + if (handle == INVALID_HANDLE_VALUE) continue; @@ -10446,7 +10446,7 @@ BOOL IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly) path[0] = drive; handle = CreateFile (path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - + if (handle != INVALID_HANDLE_VALUE) CloseHandle (handle); else if (GetLastError() == ERROR_SHARING_VIOLATION) @@ -10488,7 +10488,7 @@ std::wstring SingleStringToWide (const std::string &singleString) WCHAR wbuf[65536]; int wideLen = MultiByteToWideChar (CP_ACP, 0, singleString.c_str(), -1, wbuf, array_capacity (wbuf) - 1); - + // We don't throw exception here and only return empty string. // All calls to this function use valid strings. // throw_sys_if (wideLen == 0); @@ -10531,7 +10531,7 @@ std::string WideToUtf8String (const std::wstring &wideString) BOOL CALLBACK SecurityTokenPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { WORD lw = LOWORD (wParam); - static string *password; + static string *password; switch (msg) { @@ -10578,7 +10578,7 @@ BOOL CALLBACK SecurityTokenPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wPara wchar_t tmp[SecurityToken::MaxPasswordLength+1]; wmemset (tmp, 'X', SecurityToken::MaxPasswordLength); tmp[SecurityToken::MaxPasswordLength] = 0; - SetWindowText (GetDlgItem (hwndDlg, IDC_TOKEN_PASSWORD), tmp); + SetWindowText (GetDlgItem (hwndDlg, IDC_TOKEN_PASSWORD), tmp); EndDialog (hwndDlg, lw); } @@ -10699,8 +10699,8 @@ static void SecurityTokenKeyfileDlgFillList (HWND hwndDlg, const vector <Securit foreach (const SecurityTokenKeyfile &keyfile, keyfiles) { memset (&lvItem, 0, sizeof(lvItem)); - lvItem.mask = LVIF_TEXT; - lvItem.iItem = line++; + lvItem.mask = LVIF_TEXT; + lvItem.iItem = line++; wstringstream s; s << keyfile.SlotId; @@ -10750,11 +10750,11 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam LocalizeDialog (hwndDlg, selectedTokenKeyfiles ? "SELECT_TOKEN_KEYFILES" : "IDD_TOKEN_KEYFILES"); SendMessage (tokenListControl,LVM_SETEXTENDEDLISTVIEWSTYLE, 0, - LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_TWOCLICKACTIVATE|LVS_EX_LABELTIP - ); + LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_TWOCLICKACTIVATE|LVS_EX_LABELTIP + ); - memset (&LvCol, 0, sizeof(LvCol)); - LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT; + memset (&LvCol, 0, sizeof(LvCol)); + LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT; LvCol.pszText = GetString ("TOKEN_SLOT_ID"); LvCol.cx = CompensateXDPI (40); LvCol.fmt = LVCFMT_CENTER; @@ -10794,7 +10794,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam return 1; } } - + SecurityTokenKeyfileDlgFillList (hwndDlg, keyfiles); return 1; } @@ -10808,7 +10808,7 @@ BOOL CALLBACK SecurityTokenKeyfileDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam foreach (const SecurityTokenKeyfile &keyfile, SecurityTokenKeyfileDlgGetSelected (hwndDlg, keyfiles)) { selectedTokenKeyfiles->push_back (SecurityTokenKeyfilePath (keyfile)); - } + } } EndDialog (hwndDlg, IDOK); @@ -11062,7 +11062,7 @@ std::vector <HostDevice> GetAvailableHostDevices (bool noDeviceProperties, bool || ((partNumber == 0) && GetPhysicalDriveGeometry (devNumber, &deviceGeometry)) ) { - device.Size = deviceGeometry.Cylinders.QuadPart * (LONGLONG) deviceGeometry.BytesPerSector + device.Size = deviceGeometry.Cylinders.QuadPart * (LONGLONG) deviceGeometry.BytesPerSector * (LONGLONG) deviceGeometry.SectorsPerTrack * (LONGLONG) deviceGeometry.TracksPerCylinder; } } @@ -11306,7 +11306,7 @@ int AskNonSysInPlaceEncryptionResume (HWND hwndDlg, BOOL *pbDecrypt) return IDYES; default: break; - } + } } char *multiChoiceStr[] = { 0, "ASK_NONSYS_INPLACE_ENC_NOTIFICATION_REMOVAL", "DO_NOT_PROMPT_ME", "KEEP_PROMPTING_ME", 0 }; @@ -11399,7 +11399,7 @@ void EnableElevatedCursorChange (HWND parent) HWND hWnd; memset (&winClass, 0, sizeof (winClass)); - winClass.cbSize = sizeof (WNDCLASSEX); + winClass.cbSize = sizeof (WNDCLASSEX); winClass.lpfnWndProc = (WNDPROC) EnableElevatedCursorChangeWndProc; winClass.hInstance = hInst; winClass.lpszClassName = className; @@ -11430,7 +11430,7 @@ BOOL DisableFileCompression (HANDLE file) return TRUE; format = COMPRESSION_FORMAT_NONE; - return DeviceIoControl (file, FSCTL_SET_COMPRESSION, &format, sizeof (format), NULL, 0, &bytesOut, NULL); + return DeviceIoControl (file, FSCTL_SET_COMPRESSION, &format, sizeof (format), NULL, 0, &bytesOut, NULL); } @@ -11779,8 +11779,8 @@ void ProcessEntropyEstimate (HWND hProgress, DWORD* pdwInitialValue, DWORD dwCou } else { - if ( *pdwEntropy < dwMaxLevel - && (dwCounter >= *pdwInitialValue) + if ( *pdwEntropy < dwMaxLevel + && (dwCounter >= *pdwInitialValue) && (dwCounter - *pdwInitialValue) <= dwMaxLevel) *pdwEntropy = dwCounter - *pdwInitialValue; else @@ -11797,7 +11797,7 @@ void ProcessEntropyEstimate (HWND hProgress, DWORD* pdwInitialValue, DWORD dwCou SendMessage (hProgress, PBM_SETSTATE, state, 0); } - SendMessage (hProgress, PBM_SETPOS, + SendMessage (hProgress, PBM_SETPOS, (WPARAM) (*pdwEntropy), 0); } @@ -11834,7 +11834,7 @@ BOOL TranslateVolumeID (HWND hwndDlg, wchar_t* pathValue, size_t cchPathValue) if ((pathLen >= 3) && (_wcsnicmp (pathValue, L"ID:", 3) == 0)) { std::vector<byte> arr; - if ( (pathLen == (3 + 2*VOLUME_ID_SIZE)) + if ( (pathLen == (3 + 2*VOLUME_ID_SIZE)) && HexWideStringToArray (pathValue + 3, arr) && (arr.size() == VOLUME_ID_SIZE) ) @@ -11859,7 +11859,7 @@ BOOL TranslateVolumeID (HWND hwndDlg, wchar_t* pathValue, size_t cchPathValue) bRet = FALSE; } } - + return bRet; } diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index dd6eb801..9387336e 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -132,7 +132,7 @@ extern int CurrentOSServicePack; extern BOOL RemoteSession; extern HANDLE hDriver; extern HINSTANCE hInst; -extern int SystemEncryptionStatus; +extern int SystemEncryptionStatus; extern WipeAlgorithmId nWipeMode; extern BOOL bSysPartitionSelected; extern BOOL bSysDriveSelected; @@ -170,11 +170,11 @@ enum tc_app_msg_ids TC_APPMSG_SYSENC_CONFIG_UPDATE = WM_APP + 101, TC_APPMSG_TASKBAR_ICON = WM_APP + 102, TC_APPMSG_LOAD_TEXT_BOX_CONTENT = WM_APP + 103, - // Mount + // Mount TC_APPMSG_MOUNT_ENABLE_DISABLE_CONTROLS = WM_APP + 201, TC_APPMSG_MOUNT_SHOW_WINDOW = WM_APP + 202, TC_APPMSG_PREBOOT_PASSWORD_MODE = WM_APP + 203, - // Format + // Format TC_APPMSG_VOL_TRANSFORM_THREAD_ENDED = WM_APP + 301, TC_APPMSG_FORMAT_FINISHED = WM_APP + 302, TC_APPMSG_FORMAT_USER_QUIT = WM_APP + 303, diff --git a/src/Common/EncryptionThreadPool.c b/src/Common/EncryptionThreadPool.c index 9cc641cc..f0889a34 100644 --- a/src/Common/EncryptionThreadPool.c +++ b/src/Common/EncryptionThreadPool.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -182,13 +182,13 @@ static TC_THREAD_PROC EncryptionThreadProc (void *threadArg) workItem->KeyDerivation.IterationCount, workItem->KeyDerivation.DerivedKey, GetMaxPkcs5OutSize()); break; - default: + default: TC_THROW_FATAL_EXCEPTION; - } + } InterlockedExchange (workItem->KeyDerivation.CompletionFlag, TRUE); TC_SET_EVENT (*workItem->KeyDerivation.CompletionEvent); - + if (InterlockedDecrement (workItem->KeyDerivation.OutstandingWorkItemCount) == 0) TC_SET_EVENT (*workItem->KeyDerivation.NoOutstandingWorkItemEvent); @@ -256,12 +256,12 @@ BOOL EncryptionThreadPoolStart (size_t encryptionFreeCpuCount) WorkItemReadyEvent = CreateEvent (NULL, FALSE, FALSE, NULL); if (!WorkItemReadyEvent) return FALSE; - + WorkItemCompletedEvent = CreateEvent (NULL, FALSE, FALSE, NULL); if (!WorkItemCompletedEvent) return FALSE; #endif - + #ifdef DEVICE_DRIVER ExInitializeFastMutex (&DequeueMutex); ExInitializeFastMutex (&EnqueueMutex); @@ -400,10 +400,10 @@ void EncryptionThreadPoolDoWork (EncryptionThreadPoolWorkType type, byte *data, EncryptionThreadPoolWorkItem *workItem; EncryptionThreadPoolWorkItem *firstFragmentWorkItem; - + if (unitCount == 0) return; - + if (!ThreadPoolRunning || unitCount == 1) { switch (type) @@ -432,7 +432,7 @@ void EncryptionThreadPoolDoWork (EncryptionThreadPoolWorkType type, byte *data, else { /* 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. */ fragmentCount = ThreadCount; @@ -442,7 +442,7 @@ void EncryptionThreadPoolDoWork (EncryptionThreadPoolWorkType type, byte *data, if (remainder > 0) ++unitsPerFragment; } - + fragmentData = data; fragmentStartUnitNo = startUnitNo->Value; diff --git a/src/Common/EncryptionThreadPool.h b/src/Common/EncryptionThreadPool.h index 5ca131f5..9bc10c94 100644 --- a/src/Common/EncryptionThreadPool.h +++ b/src/Common/EncryptionThreadPool.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Common/Endian.c b/src/Common/Endian.c index 44d96e40..0327a102 100644 --- a/src/Common/Endian.c +++ b/src/Common/Endian.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source diff --git a/src/Common/Endian.h b/src/Common/Endian.h index 7d97e5fb..00fed048 100644 --- a/src/Common/Endian.h +++ b/src/Common/Endian.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 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 ] ) #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) \ ( ( unsigned char ) *memPtr++ ) @@ -139,7 +139,7 @@ unsigned __int16 MirrorBytes16 (unsigned __int16 x); unsigned __int32 MirrorBytes32 (unsigned __int32 x); #ifndef TC_NO_COMPILER_INT64 uint64 MirrorBytes64 (uint64 x); -#endif +#endif void LongReverse ( unsigned __int32 *buffer , unsigned byteCount ); #if defined(__cplusplus) diff --git a/src/Common/Exception.h b/src/Common/Exception.h index c4cd1b10..e7a790a1 100644 --- a/src/Common/Exception.h +++ b/src/Common/Exception.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Common/Fat.c b/src/Common/Fat.c index fadb80b1..fb7dc1ff 100644 --- a/src/Common/Fat.c +++ b/src/Common/Fat.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -58,7 +58,7 @@ GetFatParams (fatparams * ft) clusterSize = 512; ft->cluster_size = clusterSize / ft->sector_size; - + if (ft->cluster_size == 0) ft->cluster_size = 1; @@ -73,8 +73,8 @@ GetFatParams (fatparams * ft) ft->cluster_size = 1; // Geometry always set to SECTORS/1/1 - ft->secs_track = 1; - ft->heads = 1; + ft->secs_track = 1; + ft->heads = 1; ft->dir_entries = 512; 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->fat_length = (ft->cluster_count * 2 + ft->sector_size - 1) / ft->sector_size; } - + if(ft->cluster_count >= 65525) // FAT32 { ft->size_fat = 32; @@ -165,13 +165,13 @@ PutBoot (fatparams * ft, unsigned char *boot) cnt += 2; boot[cnt++] = (__int8) ft->media; /* media byte */ - if(ft->size_fat == 32) + if(ft->size_fat == 32) { boot[cnt++] = 0x00; boot[cnt++] = 0x00; } - else - { + else + { *(__int16 *)(boot + cnt) = LE16((uint16) ft->fat_length); /* fat size */ cnt += 2; } @@ -233,13 +233,13 @@ static void PutFSInfo (unsigned char *sector, fatparams *ft) { memset (sector, 0, ft->sector_size); sector[3]=0x41; /* LeadSig */ - sector[2]=0x61; - sector[1]=0x52; - sector[0]=0x52; + sector[2]=0x61; + sector[1]=0x52; + sector[0]=0x52; sector[484+3]=0x61; /* StrucSig */ - sector[484+2]=0x41; - sector[484+1]=0x72; - sector[484+0]=0x72; + sector[484+2]=0x41; + sector[484+1]=0x72; + sector[484+0]=0x72; // Free cluster count *(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; /* fat32 boot area */ - if (ft->size_fat == 32) + if (ft->size_fat == 32) { /* fsinfo */ PutFSInfo((unsigned char *) sector, ft); @@ -311,7 +311,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void cryptoInfo) == FALSE) goto fail; } - + /* bootsector backup */ memset (sector, 0, ft->sector_size); 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[11] = 0x0f; memcpy (sector, fat_sig, 12); - } + } else if (ft->size_fat == 16) { fat_sig[0] = (unsigned char) ft->media; @@ -407,7 +407,7 @@ FormatFat (void* hwndDlgPtr, unsigned __int64 startSector, fatparams * ft, void goto fail; // 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; retVal = EAInit (cryptoInfo->ea, temporaryKey, cryptoInfo->ks); diff --git a/src/Common/Fat.h b/src/Common/Fat.h index b637f8ec..2d1264c8 100644 --- a/src/Common/Fat.h +++ b/src/Common/Fat.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source diff --git a/src/Common/Format.c b/src/Common/Format.c index 43a96d04..f3114e5e 100644 --- a/src/Common/Format.c +++ b/src/Common/Format.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 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 # error TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE_HIGH too small. #endif - + if (volumeSize < TC_VOLUME_SMALL_SIZE_THRESHOLD) reservedSize = TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE; else @@ -108,16 +108,16 @@ int TCFormatVolume (volatile FORMAT_VOL_PARAMETERS *volParams) || FormatSectorSize % ENCRYPTION_DATA_UNIT_SIZE != 0) { 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 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 - 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. + 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. 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. */ if (volParams->hiddenVol) @@ -187,17 +187,17 @@ begin_format: if ((dev = DismountDrive (devName, volParams->volumePath)) == INVALID_HANDLE_VALUE) { Error ("FORMAT_CANT_DISMOUNT_FILESYS", hwndDlg); - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; 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). */ if (!DeviceIoControl (dev, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, - 0, + 0, NULL, 0, &dwResult, @@ -208,7 +208,7 @@ begin_format: } 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 // around by assigning a drive letter to the partition temporarily. @@ -219,7 +219,7 @@ begin_format: BOOL bResult = FALSE; tmpDriveLetter = GetFirstAvailableDrive (); - + if (tmpDriveLetter != -1) { rootPath[0] += (wchar_t) tmpDriveLetter; @@ -233,7 +233,7 @@ begin_format: szDriveLetter, volParams->volumePath); - if (bResult + if (bResult && SetVolumeMountPoint (rootPath, uniqVolName)) { // 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 // 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 // send FSCTL_ALLOW_EXTENDED_DASD_IO (possibly for a second time) without checking the result. DeviceIoControl (dev, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, - 0, + 0, NULL, 0, &dwResult, 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. 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)))) { - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; goto error; } } @@ -293,7 +293,7 @@ begin_format: { handleWin32Error (volParams->hwndDlg, SRC_POS); Error ("CANT_ACCESS_VOL", hwndDlg); - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; goto error; } } @@ -306,13 +306,13 @@ begin_format: char buf [2 * TC_MAX_VOLUME_SECTOR_SIZE]; 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 memset (buf, 0, sizeof (buf)); if (!WriteFile (dev, buf, sizeof (buf), &bw, NULL)) { - nStatus = ERR_OS_ERROR; + nStatus = ERR_OS_ERROR; goto error; } @@ -325,7 +325,7 @@ begin_format: if (DeviceIoControl (dev, FSCTL_IS_VOLUME_MOUNTED, NULL, 0, NULL, 0, &dwResult, NULL)) { Error ("FORMAT_CANT_DISMOUNT_FILESYS", hwndDlg); - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; goto error; } } @@ -339,7 +339,7 @@ begin_format: if (dev == INVALID_HANDLE_VALUE) { - nStatus = ERR_OS_ERROR; + nStatus = ERR_OS_ERROR; goto error; } @@ -356,7 +356,7 @@ begin_format: DWORD tmp; if (!DeviceIoControl (dev, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &tmp, NULL)) { - nStatus = ERR_OS_ERROR; + nStatus = ERR_OS_ERROR; goto error; } } @@ -391,13 +391,13 @@ begin_format: // Check hidden volume size if (volParams->hiddenVolHostSize < TC_MIN_HIDDEN_VOLUME_HOST_SIZE || volParams->hiddenVolHostSize > TC_MAX_HIDDEN_VOLUME_HOST_SIZE) - { + { nStatus = ERR_VOL_SIZE_WRONG; goto error; } // Seek to hidden volume header location - + headerOffset.QuadPart = TC_HIDDEN_VOLUME_HEADER_OFFSET; if (!SetFilePointerEx ((HANDLE) dev, headerOffset, NULL, FILE_BEGIN)) @@ -458,7 +458,7 @@ begin_format: // Validate the offset if (dataOffset % FormatSectorSize != 0) { - nStatus = ERR_VOL_SIZE_WRONG; + nStatus = ERR_VOL_SIZE_WRONG; goto error; } @@ -478,7 +478,7 @@ begin_format: if (volParams->bDevice && !StartFormatWriteThread()) { - nStatus = ERR_OS_ERROR; + nStatus = ERR_OS_ERROR; goto error; } @@ -488,11 +488,11 @@ begin_format: StopFormatWriteThread(); break; - + case FILESYS_FAT: if (num_sectors > 0xFFFFffff) { - nStatus = ERR_VOL_SIZE_WRONG; + nStatus = ERR_VOL_SIZE_WRONG; goto error; } @@ -506,12 +506,12 @@ begin_format: ft.sector_size = (uint16) FormatSectorSize; ft.cluster_size = volParams->clusterSize; memcpy (ft.volume_name, "NO NAME ", 11); - GetFatParams (&ft); + GetFatParams (&ft); *(volParams->realClusterSize) = ft.cluster_size * FormatSectorSize; if (volParams->bDevice && !StartFormatWriteThread()) { - nStatus = ERR_OS_ERROR; + nStatus = ERR_OS_ERROR; goto error; } @@ -523,7 +523,7 @@ begin_format: break; default: - nStatus = ERR_PARAMETER_INCORRECT; + nStatus = ERR_PARAMETER_INCORRECT; goto error; } @@ -883,14 +883,14 @@ BOOL FormatFs (int driveNo, int clusterSize, int fsType) return FALSE; } - + if (GetSystemDirectory (dllPath, MAX_PATH)) { StringCchCatW(dllPath, ARRAYSIZE(dllPath), L"\\fmifs.dll"); } else StringCchCopyW(dllPath, ARRAYSIZE(dllPath), L"C:\\Windows\\System32\\fmifs.dll"); - + hModule = LoadLibrary (dllPath); if (hModule == NULL) @@ -905,7 +905,7 @@ BOOL FormatFs (int driveNo, int clusterSize, int fsType) StringCchCatW (dir, ARRAYSIZE(dir), L":\\"); FormatExError = TRUE; - + // Windows sometimes fails to format a volume (hosted on a removable medium) as NTFS. // It often helps to retry several times. 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)) return FALSE; - + if (GetTickCount () - updateTime > 25) { if (UpdateProgressBar (*nSecNo * FormatSectorSize)) @@ -962,7 +962,7 @@ static HANDLE WriteBufferEmptyEvent; static HANDLE WriteBufferFullEvent; static volatile HANDLE WriteRequestHandle; -static volatile int WriteRequestSize; +static volatile int WriteRequestSize; static volatile DWORD WriteRequestResult; @@ -985,7 +985,7 @@ static void __cdecl FormatWriteThreadProc (void *arg) if (!WriteFile (WriteRequestHandle, WriteThreadBuffer, WriteRequestSize, &bytesWritten, NULL)) WriteRequestResult = GetLastError(); - else + else WriteRequestResult = ERROR_SUCCESS; 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) return FALSE; - + if (WriteRequestResult != ERROR_SUCCESS) { SetEvent (WriteBufferEmptyEvent); diff --git a/src/Common/Format.h b/src/Common/Format.h index de342b93..0d29ab3b 100644 --- a/src/Common/Format.h +++ b/src/Common/Format.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -21,7 +21,7 @@ extern "C" { #endif // 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 struct diff --git a/src/Common/GfMul.c b/src/Common/GfMul.c index 9cd74a89..970e6318 100644 --- a/src/Common/GfMul.c +++ b/src/Common/GfMul.c @@ -24,11 +24,11 @@ --------------------------------------------------------------------------- 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. */ -/* +/* --------------------------------------------------------------------------- Portions Copyright (c) 2005 TrueCrypt Developers Association @@ -630,9 +630,9 @@ int Gf128Tab64Init (unsigned __int8 *a, GfCtx *ctx) compile_8k_table (am, ctx8k); /* 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; 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) */ void Gf128MulBy64Tab (unsigned __int8 a[8], unsigned __int8 p[16], GfCtx *ctx) -{ +{ unsigned __int32 r[CBLK_LEN >> 2]; move_block_aligned(r, ctx->gf_t128[7*2][a[7] & 15]); @@ -751,7 +751,7 @@ BOOL GfMulSelfTest () } GfMul128Basic (a, b, p1); - + Gf128Tab64Init (a, gfCtx); Gf128MulBy64Tab (b + 8, p2, gfCtx); diff --git a/src/Common/Inflate.c b/src/Common/Inflate.c index 2d8c96b6..cb46b098 100644 --- a/src/Common/Inflate.c +++ b/src/Common/Inflate.c @@ -1311,7 +1311,7 @@ int DecompressDeflatedData (char *out, char *in, int inLength) G.incnt = inLength; G.outCounter = 0; - if (inflate(__G) != 0) + if (inflate(__G) != 0) { // Error decompressing return 0; diff --git a/src/Common/Inflate.h b/src/Common/Inflate.h index c2810c82..8420f3dc 100644 --- a/src/Common/Inflate.h +++ b/src/Common/Inflate.h @@ -10,17 +10,17 @@ typedef unsigned char uch; typedef unsigned short ush; typedef void zvoid; -typedef struct huft +typedef struct huft { uch b, e; - union + union { ush n; struct huft *t; }v; }; -typedef struct +typedef struct { uch *inptr, *outbufptr; int incnt; diff --git a/src/Common/Keyfiles.c b/src/Common/Keyfiles.c index c59ab374..10f49b5d 100644 --- a/src/Common/Keyfiles.c +++ b/src/Common/Keyfiles.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -218,7 +218,7 @@ static BOOL KeyFileProcess (unsigned __int8 *keyPool, KeyFile *keyFile) else if (totalRead == 0) { status = FALSE; - SetLastError (ERROR_HANDLE_EOF); + SetLastError (ERROR_HANDLE_EOF); } close: @@ -275,7 +275,7 @@ BOOL KeyFilesApplyWithPin (HWND hwndDlg, Password *password, char* pin, KeyFile if (keyfileData.empty()) { - SetLastError (ERROR_HANDLE_EOF); + SetLastError (ERROR_HANDLE_EOF); handleWin32Error (hwndDlg, SRC_POS); Error ("ERR_PROCESS_KEYFILE", hwndDlg); 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, L'\\', fBuf.name - ); + ); // Determine whether it's a path or a file 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 { // Prevent recursive folder scanning - continue; + continue; } // Skip hidden files @@ -363,7 +363,7 @@ BOOL KeyFilesApplyWithPin (HWND hwndDlg, Password *password, char* pin, KeyFile && (fileAttributes.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0) { HiddenFilesPresentInKeyfilePath = TRUE; - continue; + continue; } CorrectFileName (kfSub->FileName); @@ -474,18 +474,18 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa SendMessageW (hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0, LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP - ); + ); - memset (&LvCol,0,sizeof(LvCol)); - LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT; - LvCol.pszText = GetString ("KEYFILE"); + memset (&LvCol,0,sizeof(LvCol)); + LvCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM|LVCF_FMT; + LvCol.pszText = GetString ("KEYFILE"); LvCol.cx = CompensateXDPI (374); LvCol.fmt = LVCFMT_LEFT; SendMessageW (hList, LVM_INSERTCOLUMNW, 0, (LPARAM)&LvCol); LoadKeyList (hwndDlg, param->FirstKeyFile); SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, param->EnableKeyFiles); - + #ifdef TCMOUNT if ( (origParam.EnableKeyFiles == defaultKeyFilesParam.EnableKeyFiles) && (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); LVITEM LvItem; memset (&LvItem, 0, sizeof(LvItem)); - LvItem.mask = LVIF_PARAM; + LvItem.mask = LVIF_PARAM; LvItem.iItem = -1; while (-1 != (LvItem.iItem = ListView_GetNextItem (list, LvItem.iItem, LVIS_SELECTED))) { ListView_GetItem (list, &LvItem); param->FirstKeyFile = KeyFileRemove (param->FirstKeyFile, (KeyFile *) LvItem.lParam); - } - + } + LoadKeyList (hwndDlg, param->FirstKeyFile); return 1; } @@ -602,7 +602,7 @@ BOOL CALLBACK KeyFilesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa if (lw == IDC_GENERATE_KEYFILE) { - DialogBoxParamW (hInst, + DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_KEYFILE_GENERATOR), hwndDlg, (DLGPROC) KeyfileGeneratorDlgProc, (LPARAM) 0); return 1; diff --git a/src/Common/Keyfiles.h b/src/Common/Keyfiles.h index dea906b1..c94f1378 100644 --- a/src/Common/Keyfiles.h +++ b/src/Common/Keyfiles.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -51,4 +51,4 @@ extern BOOL HiddenFilesPresentInKeyfilePath; } #endif -#endif /* #ifndef KEYFILES_H */ +#endif /* #ifndef KEYFILES_H */ diff --git a/src/Common/Language.c b/src/Common/Language.c index 3d9b22d3..f03a4e54 100644 --- a/src/Common/Language.c +++ b/src/Common/Language.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -101,7 +101,7 @@ static char *MapNextLanguageFile () GetModuleFileNameW (NULL, f, sizeof (f) / sizeof (f[0])); t = wcsrchr (f, L'\\'); if (t == NULL) return NULL; - + *t = 0; StringCbCatW (f, sizeof(f), L"\\Language*.xml"); @@ -236,10 +236,10 @@ BOOL LoadLanguageFile () memset (&font, 0, sizeof (font)); XmlGetAttributeText (xml, "face", attr, sizeof (attr)); - + len = MultiByteToWideChar (CP_UTF8, 0, attr, -1, wattr, sizeof (wattr) / sizeof(wattr[0])); font.FaceName = AddPoolData ((void *) wattr, len * 2); - + XmlGetAttributeText (xml, "size", attr, sizeof (attr)); sscanf (attr, "%d", &font.Size); @@ -332,7 +332,7 @@ BOOL LoadLanguageFile () LocalizationSerialNo++; // Create control ID dictionary - + // Default controls AddDictionaryEntry (NULL, 1, GetString ("IDOK")); 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); - // Language pack version + // Language pack version if (!ActiveLangPackVersion[0] || memcmp (ActiveLangPackVersion, "0.0.0", 5) == 0) { 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) { // Auto mode - if (langCount < 2) + if (langCount < 2) EndDialog (hwndDlg, IDCANCEL); if (langCount == 2) StringCbCopyA (PreferredLangId, sizeof(PreferredLangId), lastLangId); - + EndDialog (hwndDlg, IDOK); } @@ -511,8 +511,8 @@ BOOL CALLBACK LanguageDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa l[3] = (char) (id >> 16); l[4] = id >> 24; l[5] = 0; - } - + } + if (SendDlgItemMessage (hwndDlg, IDC_LANGLIST, LB_GETCOUNT, 0, 0) > 1) StringCbCopyA (PreferredLangId, sizeof(PreferredLangId), l); } diff --git a/src/Common/Language.h b/src/Common/Language.h index 4e4c1795..3b5501d9 100644 --- a/src/Common/Language.h +++ b/src/Common/Language.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Common/Password.c b/src/Common/Password.c index 4d7c7952..2c9e77c3 100644 --- a/src/Common/Password.c +++ b/src/Common/Password.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 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) { int i, len; - + if (hPassword == NULL) { if (ptrPw) @@ -113,7 +113,7 @@ BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw) len = GetWindowTextLength (hPassword); if (len > MAX_PASSWORD) - return FALSE; + return FALSE; GetWindowTextW (hPassword, s, sizeof (s) / sizeof (wchar_t)); @@ -126,7 +126,7 @@ BOOL CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw) burn (s, sizeof(s)); if (i < len) - return FALSE; + return FALSE; } return TRUE; @@ -141,7 +141,7 @@ BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim if (bCustomPimSmall) { Error (bForBoot? "BOOT_PIM_REQUIRE_LONG_PASSWORD": "PIM_REQUIRE_LONG_PASSWORD", hwndDlg); - return FALSE; + return FALSE; } #ifndef _DEBUG @@ -215,14 +215,14 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, else { nDosLinkCreated = FakeDosNameForDevice (szDiskFile, szDosDevice, sizeof(szDosDevice), szCFDevice, sizeof(szCFDevice),FALSE); - + if (nDosLinkCreated != 0) goto error; } 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; if (bDevice) @@ -328,7 +328,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, 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)); } @@ -347,7 +347,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, cryptoInfo = NULL; goto error; } - else + else break; } @@ -374,12 +374,12 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, EnableElevatedCursorChange (hwndDlg); WaitCursor(); - /* Re-encrypt the volume header */ + /* Re-encrypt the volume header */ backupHeader = FALSE; 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 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 @@ -447,7 +447,7 @@ int ChangePwd (const wchar_t *lpszVolume, Password *oldPassword, int old_pkcs5, if (backupHeader || cryptoInfo->LegacyVolume) break; - + backupHeader = TRUE; headerOffset.QuadPart += hostSize - TC_VOLUME_HEADER_GROUP_SIZE; } diff --git a/src/Common/Password.h b/src/Common/Password.h index 8cc0b7ea..8818804e 100644 --- a/src/Common/Password.h +++ b/src/Common/Password.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 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) 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 CheckPasswordCharEncoding (HWND hPassword, Password *ptrPw); +BOOL CheckPasswordLength (HWND hwndDlg, unsigned __int32 passwordLength, int pim, BOOL bForBoot, BOOL bSkipPasswordWarning, BOOL bSkipPimWarning); +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); #endif // defined(_WIN32) && !defined(TC_WINDOWS_DRIVER) diff --git a/src/Common/Pkcs5.c b/src/Common/Pkcs5.c index a71be573..8bc828ef 100644 --- a/src/Common/Pkcs5.c +++ b/src/Common/Pkcs5.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 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* u = hmac->u; uint32 c; - int i; + int i; #ifdef TC_WINDOWS_BOOT /* 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 */ memcpy (k, salt, salt_len); /* salt */ - + /* big-endian block number */ memset (&k[salt_len], 0, 3); 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) -{ +{ hmac_sha256_ctx hmac; sha256_ctx* ctx; char* buf = hmac.k; @@ -315,7 +315,7 @@ void hmac_sha512 char *k, /* secret key */ int lk, /* length of the key in 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; @@ -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, let key = ripemd160(key), as per HMAC specifications. */ - if (keylen > RIPEMD160_BLOCKSIZE) + if (keylen > RIPEMD160_BLOCKSIZE) { RMD160_CTX tctx; @@ -533,14 +533,14 @@ void hmac_ripemd160 (char *key, int keylen, char *input_digest, int len) keylen = RIPEMD160_DIGESTSIZE; burn (&tctx, sizeof(tctx)); // Prevent leaks - } + } /* perform inner RIPEMD-160 */ ctx = &(hmac.inner_digest_ctx); /* start out by storing key in pads */ memset(k_pad, 0x36, 64); /* XOR key with ipad and opad values */ - for (i=0; i<keylen; i++) + for (i=0; i<keylen; 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 */ ctx = &(hmac.outer_digest_ctx); memset(k_pad, 0x5c, 64); - for (i=0; i<keylen; i++) + for (i=0; i<keylen; 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 */ memcpy (k, salt, salt_len); /* salt */ - + /* big-endian block number */ memset (&k[salt_len], 0, 3); 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) -{ +{ int b, l, r; hmac_ripemd160_ctx hmac; 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]; /* If the password is longer than the hash algorithm block size, let password = ripemd160(password), as per HMAC specifications. */ - if (pwd_len > RIPEMD160_BLOCKSIZE) + if (pwd_len > RIPEMD160_BLOCKSIZE) { 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 */ memset(k_pad, 0x36, 64); /* 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]; } @@ -663,7 +663,7 @@ void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, uin /* perform outer RIPEMD-160 */ ctx = &(hmac.outer_digest_ctx); memset(k_pad, 0x5c, 64); - for (b=0; b<pwd_len; b++) + for (b=0; b<pwd_len; 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 */ memcpy (k, salt, salt_len); /* salt */ /* big-endian block number */ - memset (&k[salt_len], 0, 3); + memset (&k[salt_len], 0, 3); k[salt_len + 3] = (char) b; 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) { - case SHA512: + case SHA512: return L"HMAC-SHA-512"; - case SHA256: + case SHA256: return L"HMAC-SHA-256"; - case RIPEMD160: + case RIPEMD160: return L"HMAC-RIPEMD-160"; - case WHIRLPOOL: + case WHIRLPOOL: return L"HMAC-Whirlpool"; - default: + default: 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) { - case RIPEMD160: + case RIPEMD160: if (truecryptMode) return bBoot ? 1000 : 2000; 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; } - case SHA512: + case SHA512: return truecryptMode? 1000 : ((pim == 0)? 500000 : 15000 + pim * 1000); - case WHIRLPOOL: + case WHIRLPOOL: return truecryptMode? 1000 : ((pim == 0)? 500000 : 15000 + pim * 1000); 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; } - default: + default: TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID } return 0; diff --git a/src/Common/Pkcs5.h b/src/Common/Pkcs5.h index ec9bf434..81d9de64 100644 --- a/src/Common/Pkcs5.h +++ b/src/Common/Pkcs5.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source diff --git a/src/Common/Progress.c b/src/Common/Progress.c index ceb528f2..42ff7639 100644 --- a/src/Common/Progress.c +++ b/src/Common/Progress.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -126,7 +126,7 @@ BOOL UpdateProgressBarProc (__int64 byteOffset) prevTime = time; - SendMessage (hProgressBar, PBM_SETPOS, + SendMessage (hProgressBar, PBM_SETPOS, (int) (10000.0 * (bProgressBarReverse ? (TotalSize - byteOffset) : byteOffset) / (TotalSize == 0 ? 1 : TotalSize)), 0); diff --git a/src/Common/Progress.h b/src/Common/Progress.h index f3579d69..0410023d 100644 --- a/src/Common/Progress.h +++ b/src/Common/Progress.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source diff --git a/src/Common/Random.c b/src/Common/Random.c index 56431262..32b38e44 100644 --- a/src/Common/Random.c +++ b/src/Common/Random.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 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) { - RandaddByte(x); - RandaddByte((x >> 8)); + RandaddByte(x); + RandaddByte((x >> 8)); RandaddByte((x >> 16)); RandaddByte((x >> 24)); } void RandAddInt64 (unsigned __int64 x) { - RandaddByte(x); - RandaddByte((x >> 8)); + RandaddByte(x); + RandaddByte((x >> 8)); RandaddByte((x >> 16)); RandaddByte((x >> 24)); @@ -97,7 +97,7 @@ int Randinit () if (GetMaxPkcs5OutSize() > RNG_POOL_SIZE) TC_THROW_FATAL_EXCEPTION; - if(bRandDidInit) + if(bRandDidInit) return 0; InitializeCriticalSection (&critRandProt); @@ -128,9 +128,9 @@ int Randinit () handleWin32Error (0, SRC_POS); goto error; } - + if (!CryptAcquireContext (&hCryptProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) - { + { CryptoAPIAvailable = FALSE; CryptoAPILastError = GetLastError (); goto error; @@ -274,7 +274,7 @@ BOOL Randmix () if (RNG_POOL_SIZE % digestSize) 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. */ switch (HashFunction) @@ -303,7 +303,7 @@ BOOL Randmix () WHIRLPOOL_finalize (&wctx, hashOutputBuffer); break; - default: + default: // Unknown/wrong ID TC_THROW_FATAL_EXCEPTION; } @@ -316,26 +316,26 @@ BOOL Randmix () } /* Prevent leaks */ - burn (hashOutputBuffer, MAX_DIGESTSIZE); + burn (hashOutputBuffer, MAX_DIGESTSIZE); switch (HashFunction) { case RIPEMD160: - burn (&rctx, sizeof(rctx)); + burn (&rctx, sizeof(rctx)); break; case SHA512: - burn (&sctx, sizeof(sctx)); + burn (&sctx, sizeof(sctx)); break; case SHA256: - burn (&s256ctx, sizeof(s256ctx)); + burn (&s256ctx, sizeof(s256ctx)); break; case WHIRLPOOL: - burn (&wctx, sizeof(wctx)); + burn (&wctx, sizeof(wctx)); break; - default: + default: // Unknown/wrong ID TC_THROW_FATAL_EXCEPTION; } @@ -360,7 +360,7 @@ BOOL RandpeekBytes (void* hwndDlg, unsigned char *buf, int len, DWORD* mouseCoun 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; } @@ -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 */ 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; LeaveCriticalSection (&critRandProt); return FALSE; @@ -515,7 +515,7 @@ LRESULT CALLBACK MouseProc (int nCode, WPARAM wParam, LPARAM lParam) EnterCriticalSection (&critRandProt); /* 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))) { ProcessedMouseEventsCounter++; @@ -748,7 +748,7 @@ BOOL SlowPoll (void) // we keep the check for clarity purpose if ( !CryptoAPIAvailable ) return FALSE; - if (CryptGenRandom (hCryptProv, sizeof (buffer), buffer)) + if (CryptGenRandom (hCryptProv, sizeof (buffer), buffer)) { RandaddBuf (buffer, sizeof (buffer)); @@ -759,7 +759,7 @@ BOOL SlowPoll (void) else { /* return error in case CryptGenRandom fails */ - CryptoAPILastError = GetLastError (); + CryptoAPILastError = GetLastError (); return FALSE; } } @@ -870,7 +870,7 @@ BOOL FastPoll (void) // we keep the check for clarity purpose if ( !CryptoAPIAvailable ) return FALSE; - if (CryptGenRandom (hCryptProv, sizeof (buffer), buffer)) + if (CryptGenRandom (hCryptProv, sizeof (buffer), buffer)) { RandaddBuf (buffer, sizeof (buffer)); burn (buffer, sizeof(buffer)); diff --git a/src/Common/Random.h b/src/Common/Random.h index ecf04ca3..f41428f4 100644 --- a/src/Common/Random.h +++ b/src/Common/Random.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source diff --git a/src/Common/Registry.c b/src/Common/Registry.c index 1e5883a2..3daf3a45 100644 --- a/src/Common/Registry.c +++ b/src/Common/Registry.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -287,14 +287,14 @@ void DeleteRegistryValue (wchar_t *subKey, wchar_t *name) 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). StringCbPrintfW (regk, cbRegk,L"%s%s", L"Software\\Microsoft\\Windows\\Curren", L"tVersion\\Run"); } 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). StringCbPrintfW (regk, cbRegk,L"%s%s%s%s", L"Software\\Microsoft\\Windows", L" NT\\Curren", L"tVersion\\Sy", L"stemRestore"); }
\ No newline at end of file diff --git a/src/Common/Registry.h b/src/Common/Registry.h index be80fa4d..37bb1bdf 100644 --- a/src/Common/Registry.h +++ b/src/Common/Registry.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Common/Resource.h b/src/Common/Resource.h index 3eca197e..03d42664 100644 --- a/src/Common/Resource.h +++ b/src/Common/Resource.h @@ -199,7 +199,7 @@ #define IDT_ENTROPY_BAR 5137 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 diff --git a/src/Common/SecurityToken.cpp b/src/Common/SecurityToken.cpp index 8909059d..78a3e6c1 100644 --- a/src/Common/SecurityToken.cpp +++ b/src/Common/SecurityToken.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -174,7 +174,7 @@ namespace VeraCrypt void SecurityToken::DeleteKeyfile (const SecurityTokenKeyfile &keyfile) { LoginUserIfRequired (keyfile.SlotId); - + CK_RV status = Pkcs11Functions->C_DestroyObject (Sessions[keyfile.SlotId].Handle, keyfile.Handle); if (status != CKR_OK) throw Pkcs11Exception (status); @@ -339,7 +339,7 @@ namespace VeraCrypt 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; while (true) @@ -451,7 +451,7 @@ namespace VeraCrypt { CK_SESSION_INFO sessionInfo; status = Pkcs11Functions->C_GetSessionInfo (Sessions[slotId].Handle, &sessionInfo); - + if (status == CKR_OK) { 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); throw_sys_sub_if (!Pkcs11LibraryHandle, dlerror()); #endif - + typedef CK_RV (*C_GetFunctionList_t) (CK_FUNCTION_LIST_PTR_PTR ppFunctionList); #ifdef TC_WINDOWS diff --git a/src/Common/SecurityToken.h b/src/Common/SecurityToken.h index 00d543a2..95d95fc8 100644 --- a/src/Common/SecurityToken.h +++ b/src/Common/SecurityToken.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -139,7 +139,7 @@ namespace VeraCrypt { void Show (HWND parent) const { Error (SecurityTokenLibraryPath[0] == 0 ? "NO_PKCS11_MODULE_SPECIFIED" : "PKCS11_MODULE_INIT_FAILED", parent); } }; - + struct InvalidSecurityTokenKeyfilePath : public Exception { void Show (HWND parent) const { Error ("INVALID_TOKEN_KEYFILE_PATH", parent); } @@ -197,7 +197,7 @@ namespace VeraCrypt #endif static bool IsInitialized () { return Initialized; } static bool IsKeyfilePathValid (const wstring &securityTokenKeyfilePath); - + static const size_t MaxPasswordLength = 128; protected: diff --git a/src/Common/Tcdefs.h b/src/Common/Tcdefs.h index 85cb01d0..2d8a6fe3 100644 --- a/src/Common/Tcdefs.h +++ b/src/Common/Tcdefs.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -16,7 +16,7 @@ #define TC_APP_NAME "VeraCrypt" -// Version displayed to user +// Version displayed to user #define VERSION_STRING "1.17" // Version number to compare against driver @@ -106,9 +106,9 @@ typedef unsigned __int32 uint_32t; typedef uint64 uint_64t; #endif -typedef union +typedef union { - struct + struct { unsigned __int32 LowPart; unsigned __int32 HighPart; @@ -276,9 +276,9 @@ void EraseMemory (void *memory, int size); 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 - (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). */ ERR_SUCCESS = 0, diff --git a/src/Common/Tests.c b/src/Common/Tests.c index 8dc72d2c..9d9e8118 100644 --- a/src/Common/Tests.c +++ b/src/Common/Tests.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 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 }, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff }, 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, 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, @@ -56,9 +56,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, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, - { + { 0x1c, 0x3b, 0x3a, 0x10, 0x2f, 0x77, 0x03, 0x86, 0xe4, 0x83, 0x6c, 0x99, 0xe3, 0x70, 0xcf, 0x9b, 0xea, 0x00, 0x80, 0x3f, 0x5e, 0x48, 0x23, 0x57, 0xa4, 0xae, 0x12, 0xd4, 0x14, 0xa3, 0xe6, 0x3b, 0x5d, 0x31, 0xe2, 0x76, 0xf8, 0xfe, 0x4a, 0x8d, 0x66, 0xb3, 0x17, 0xf9, 0xac, 0x68, 0x3f, 0x44, 0x68, 0x0a, 0x86, 0xac, 0x35, 0xad, 0xfc, 0x33, 0x45, 0xbe, 0xfe, 0xcb, 0x4b, 0xb1, 0x88, 0xfd, 0x57, 0x76, 0x92, 0x6c, 0x49, 0xa3, 0x09, 0x5e, 0xb1, 0x08, 0xfd, 0x10, 0x98, 0xba, 0xec, 0x70, 0xaa, 0xa6, 0x69, 0x99, 0xa7, 0x2a, 0x82, 0xf2, 0x7d, 0x84, 0x8b, 0x21, 0xd4, 0xa7, 0x41, 0xb0, @@ -74,7 +74,7 @@ XTS_TEST XTS_vectors[XTS_TEST_COUNT] = { 0x6e, 0x33, 0x3b, 0x93, 0xeb, 0x4a, 0xff, 0x04, 0x79, 0xda, 0x9a, 0x41, 0x0e, 0x44, 0x50, 0xe0, 0xdd, 0x7a, 0xe4, 0xc6, 0xe2, 0x91, 0x09, 0x00, 0x57, 0x5d, 0xa4, 0x01, 0xfc, 0x07, 0x05, 0x9f, 0x64, 0x5e, 0x8b, 0x7e, 0x9b, 0xfd, 0xef, 0x33, 0x94, 0x30, 0x54, 0xff, 0x84, 0x01, 0x14, 0x93, 0xc2, 0x7b, 0x34, 0x29, 0xea, 0xed, 0xb4, 0xed, 0x53, 0x76, 0x44, 0x1a, 0x77, 0xed, 0x43, 0x85, 0x1a, 0xd7, 0x7f, 0x16, 0xf5, 0x41, 0xdf, 0xd2, 0x69, 0xd5, 0x0d, 0x6a, 0x5f, 0x14, 0xfb, 0x0a, 0xab, 0x1c, 0xbb, 0x4c, 0x15, 0x50, 0xbe, 0x97, 0xf7, 0xab, 0x40, 0x66, 0x19, 0x3c, 0x4c, 0xaa, - 0x77, 0x3d, 0xad, 0x38, 0x01, 0x4b, 0xd2, 0x09, 0x2f, 0xa7, 0x55, 0xc8, 0x24, 0xbb, 0x5e, 0x54, 0xc4, 0xf3, 0x6f, 0xfd, 0xa9, 0xfc, 0xea, 0x70, 0xb9, 0xc6, 0xe6, 0x93, 0xe1, 0x48, 0xc1, 0x51 + 0x77, 0x3d, 0xad, 0x38, 0x01, 0x4b, 0xd2, 0x09, 0x2f, 0xa7, 0x55, 0xc8, 0x24, 0xbb, 0x5e, 0x54, 0xc4, 0xf3, 0x6f, 0xfd, 0xa9, 0xfc, 0xea, 0x70, 0xb9, 0xc6, 0xe6, 0x93, 0xe1, 0x48, 0xc1, 0x51 } }, { @@ -83,8 +83,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 }, { 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 }, - 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, 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, @@ -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, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, - { + { 0x77, 0xa3, 0x12, 0x51, 0x61, 0x8a, 0x15, 0xe6, 0xb9, 0x2d, 0x1d, 0x66, 0xdf, 0xfe, 0x7b, 0x50, 0xb5, 0x0b, 0xad, 0x55, 0x23, 0x05, 0xba, 0x02, 0x17, 0xa6, 0x10, 0x68, 0x8e, 0xff, 0x7e, 0x11, 0xe1, 0xd0, 0x22, 0x54, 0x38, 0xe0, 0x93, 0x24, 0x2d, 0x6d, 0xb2, 0x74, 0xfd, 0xe8, 0x01, 0xd4, 0xca, 0xe0, 0x6f, 0x20, 0x92, 0xc7, 0x28, 0xb2, 0x47, 0x85, 0x59, 0xdf, 0x58, 0xe8, 0x37, 0xc2, 0x46, 0x9e, 0xe4, 0xa4, 0xfa, 0x79, 0x4e, 0x4b, 0xbc, 0x7f, 0x39, 0xbc, 0x02, 0x6e, 0x3c, 0xb7, 0x2c, 0x33, 0xb0, 0x88, 0x8f, 0x25, 0xb4, 0xac, 0xf5, 0x6a, 0x2a, 0x98, 0x04, 0xf1, 0xce, 0x6d, @@ -118,7 +118,7 @@ XTS_TEST XTS_vectors[XTS_TEST_COUNT] = { 0x09, 0x4f, 0x7c, 0x45, 0x3b, 0x7f, 0xf8, 0x7c, 0xb5, 0xbb, 0x36, 0xb7, 0xc7, 0x9e, 0xfb, 0x08, 0x72, 0xd1, 0x70, 0x58, 0xb8, 0x3b, 0x15, 0xab, 0x08, 0x66, 0xad, 0x8a, 0x58, 0x65, 0x6c, 0x5a, 0x7e, 0x20, 0xdb, 0xdf, 0x30, 0x8b, 0x24, 0x61, 0xd9, 0x7c, 0x0e, 0xc0, 0x02, 0x4a, 0x27, 0x15, 0x05, 0x52, 0x49, 0xcf, 0x3b, 0x47, 0x8d, 0xdd, 0x47, 0x40, 0xde, 0x65, 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, - 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 }, { 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 }, - 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, 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, @@ -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, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, - { + { 0xe3, 0x87, 0xaa, 0xa5, 0x8b, 0xa4, 0x83, 0xaf, 0xa7, 0xe8, 0xeb, 0x46, 0x97, 0x78, 0x31, 0x7e, 0xcf, 0x4c, 0xf5, 0x73, 0xaa, 0x9d, 0x4e, 0xac, 0x23, 0xf2, 0xcd, 0xf9, 0x14, 0xe4, 0xe2, 0x00, 0xa8, 0xb4, 0x90, 0xe4, 0x2e, 0xe6, 0x46, 0x80, 0x2d, 0xc6, 0xee, 0x2b, 0x47, 0x1b, 0x27, 0x81, 0x95, 0xd6, 0x09, 0x18, 0xec, 0xec, 0xb4, 0x4b, 0xf7, 0x99, 0x66, 0xf8, 0x3f, 0xab, 0xa0, 0x49, 0x92, 0x98, 0xeb, 0xc6, 0x99, 0xc0, 0xc8, 0x63, 0x47, 0x15, 0xa3, 0x20, 0xbb, 0x4f, 0x07, 0x5d, 0x62, 0x2e, 0x74, 0xc8, 0xc9, 0x32, 0x00, 0x4f, 0x25, 0xb4, 0x1e, 0x36, 0x10, 0x25, 0xb5, 0xa8, @@ -162,7 +162,7 @@ XTS_TEST XTS_vectors[XTS_TEST_COUNT] = { 0xf0, 0x8a, 0xd7, 0xba, 0x89, 0x21, 0x28, 0x7e, 0x3b, 0xbe, 0xe3, 0x1b, 0x76, 0x7b, 0xe0, 0x6a, 0x0e, 0x70, 0x5c, 0x86, 0x4a, 0x76, 0x91, 0x37, 0xdf, 0x28, 0x29, 0x22, 0x83, 0xea, 0x81, 0xa2, 0x48, 0x02, 0x41, 0xb4, 0x4d, 0x99, 0x21, 0xcd, 0xbe, 0xc1, 0xbc, 0x28, 0xdc, 0x1f, 0xda, 0x11, 0x4b, 0xd8, 0xe5, 0x21, 0x7a, 0xc9, 0xd8, 0xeb, 0xaf, 0xa7, 0x20, 0xe9, 0xda, 0x4f, 0x9a, 0xce, 0x23, 0x1c, 0xc9, 0x49, 0xe5, 0xb9, 0x6f, 0xe7, 0x6f, 0xfc, 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 }, { 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 }, - 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, 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, @@ -188,9 +188,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, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, - { + { 0xbf, 0x53, 0xd2, 0xda, 0xde, 0x78, 0xe8, 0x22, 0xa4, 0xd9, 0x49, 0xa9, 0xbc, 0x67, 0x66, 0xb0, 0x1b, 0x06, 0xa8, 0xef, 0x70, 0xd2, 0x67, 0x48, 0xc6, 0xa7, 0xfc, 0x36, 0xd8, 0x0a, 0xe4, 0xc5, 0x52, 0x0f, 0x7c, 0x4a, 0xb0, 0xac, 0x85, 0x44, 0x42, 0x4f, 0xa4, 0x05, 0x16, 0x2f, 0xef, 0x5a, 0x6b, 0x7f, 0x22, 0x94, 0x98, 0x06, 0x36, 0x18, 0xd3, 0x9f, 0x00, 0x03, 0xcb, 0x5f, 0xb8, 0xd1, 0xc8, 0x6b, 0x64, 0x34, 0x97, 0xda, 0x1f, 0xf9, 0x45, 0xc8, 0xd3, 0xbe, 0xde, 0xca, 0x4f, 0x47, 0x97, 0x02, 0xa7, 0xa7, 0x35, 0xf0, 0x43, 0xdd, 0xb1, 0xd6, 0xaa, 0xad, 0xe3, 0xc4, 0xa0, 0xac, @@ -206,7 +206,7 @@ XTS_TEST XTS_vectors[XTS_TEST_COUNT] = { 0x77, 0xad, 0x22, 0x00, 0x0f, 0x1d, 0x50, 0x78, 0xf6, 0xb8, 0x66, 0x31, 0x8c, 0x66, 0x8f, 0x1a, 0xd0, 0x3d, 0x5a, 0x5f, 0xce, 0xd5, 0x21, 0x9f, 0x2e, 0xab, 0xbd, 0x0a, 0xa5, 0xc0, 0xf4, 0x60, 0xd1, 0x83, 0xf0, 0x44, 0x04, 0xa0, 0xd6, 0xf4, 0x69, 0x55, 0x8e, 0x81, 0xfa, 0xb2, 0x4a, 0x16, 0x79, 0x05, 0xab, 0x4c, 0x78, 0x78, 0x50, 0x2a, 0xd3, 0xe3, 0x8f, 0xdb, 0xe6, 0x2a, 0x41, 0x55, 0x6c, 0xec, 0x37, 0x32, 0x57, 0x59, 0x53, 0x3c, 0xe8, 0xf2, 0x5f, 0x36, 0x7c, 0x87, 0xbb, 0x55, 0x78, 0xd6, 0x67, 0xae, 0x93, 0xf9, 0xe2, 0xfd, 0x99, 0xbc, 0xbc, 0x5f, 0x2f, 0xbb, 0xa8, 0x8c, - 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 + 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 }, { 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 }, - 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, - 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, - 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, - 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, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, - 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, - 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, - 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, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff + 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, + 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, + 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, + 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, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, + 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, + 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, + 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, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff }, - { - 0x64, 0x49, 0x7e, 0x5a, 0x83, 0x1e, 0x4a, 0x93, 0x2c, 0x09, 0xbe, 0x3e, 0x53, 0x93, 0x37, 0x6d, 0xaa, 0x59, 0x95, 0x48, 0xb8, 0x16, 0x03, 0x1d, 0x22, 0x4b, 0xbf, 0x50, 0xa8, 0x18, 0xed, 0x23, - 0x50, 0xea, 0xe7, 0xe9, 0x60, 0x87, 0xc8, 0xa0, 0xdb, 0x51, 0xad, 0x29, 0x0b, 0xd0, 0x0c, 0x1a, 0xc1, 0x62, 0x08, 0x57, 0x63, 0x5b, 0xf2, 0x46, 0xc1, 0x76, 0xab, 0x46, 0x3b, 0xe3, 0x0b, 0x80, - 0x8d, 0xa5, 0x48, 0x08, 0x1a, 0xc8, 0x47, 0xb1, 0x58, 0xe1, 0x26, 0x4b, 0xe2, 0x5b, 0xb0, 0x91, 0x0b, 0xbc, 0x92, 0x64, 0x71, 0x08, 0x08, 0x94, 0x15, 0xd4, 0x5f, 0xab, 0x1b, 0x3d, 0x26, 0x04, - 0xe8, 0xa8, 0xef, 0xf1, 0xae, 0x40, 0x20, 0xcf, 0xa3, 0x99, 0x36, 0xb6, 0x68, 0x27, 0xb2, 0x3f, 0x37, 0x1b, 0x92, 0x20, 0x0b, 0xe9, 0x02, 0x51, 0xe6, 0xd7, 0x3c, 0x5f, 0x86, 0xde, 0x5f, 0xd4, - 0xa9, 0x50, 0x78, 0x19, 0x33, 0xd7, 0x9a, 0x28, 0x27, 0x2b, 0x78, 0x2a, 0x2e, 0xc3, 0x13, 0xef, 0xdf, 0xcc, 0x06, 0x28, 0xf4, 0x3d, 0x74, 0x4c, 0x2d, 0xc2, 0xff, 0x3d, 0xcb, 0x66, 0x99, 0x9b, - 0x50, 0xc7, 0xca, 0x89, 0x5b, 0x0c, 0x64, 0x79, 0x1e, 0xea, 0xa5, 0xf2, 0x94, 0x99, 0xfb, 0x1c, 0x02, 0x6f, 0x84, 0xce, 0x5b, 0x5c, 0x72, 0xba, 0x10, 0x83, 0xcd, 0xdb, 0x5c, 0xe4, 0x54, 0x34, - 0x63, 0x16, 0x65, 0xc3, 0x33, 0xb6, 0x0b, 0x11, 0x59, 0x3f, 0xb2, 0x53, 0xc5, 0x17, 0x9a, 0x2c, 0x8d, 0xb8, 0x13, 0x78, 0x2a, 0x00, 0x48, 0x56, 0xa1, 0x65, 0x30, 0x11, 0xe9, 0x3f, 0xb6, 0xd8, - 0x76, 0xc1, 0x83, 0x66, 0xdd, 0x86, 0x83, 0xf5, 0x34, 0x12, 0xc0, 0xc1, 0x80, 0xf9, 0xc8, 0x48, 0x59, 0x2d, 0x59, 0x3f, 0x86, 0x09, 0xca, 0x73, 0x63, 0x17, 0xd3, 0x56, 0xe1, 0x3e, 0x2b, 0xff, - 0x3a, 0x9f, 0x59, 0xcd, 0x9a, 0xeb, 0x19, 0xcd, 0x48, 0x25, 0x93, 0xd8, 0xc4, 0x61, 0x28, 0xbb, 0x32, 0x42, 0x3b, 0x37, 0xa9, 0xad, 0xfb, 0x48, 0x2b, 0x99, 0x45, 0x3f, 0xbe, 0x25, 0xa4, 0x1b, - 0xf6, 0xfe, 0xb4, 0xaa, 0x0b, 0xef, 0x5e, 0xd2, 0x4b, 0xf7, 0x3c, 0x76, 0x29, 0x78, 0x02, 0x54, 0x82, 0xc1, 0x31, 0x15, 0xe4, 0x01, 0x5a, 0xac, 0x99, 0x2e, 0x56, 0x13, 0xa3, 0xb5, 0xc2, 0xf6, - 0x85, 0xb8, 0x47, 0x95, 0xcb, 0x6e, 0x9b, 0x26, 0x56, 0xd8, 0xc8, 0x81, 0x57, 0xe5, 0x2c, 0x42, 0xf9, 0x78, 0xd8, 0x63, 0x4c, 0x43, 0xd0, 0x6f, 0xea, 0x92, 0x8f, 0x28, 0x22, 0xe4, 0x65, 0xaa, - 0x65, 0x76, 0xe9, 0xbf, 0x41, 0x93, 0x84, 0x50, 0x6c, 0xc3, 0xce, 0x3c, 0x54, 0xac, 0x1a, 0x6f, 0x67, 0xdc, 0x66, 0xf3, 0xb3, 0x01, 0x91, 0xe6, 0x98, 0x38, 0x0b, 0xc9, 0x99, 0xb0, 0x5a, 0xbc, - 0xe1, 0x9d, 0xc0, 0xc6, 0xdc, 0xc2, 0xdd, 0x00, 0x1e, 0xc5, 0x35, 0xba, 0x18, 0xde, 0xb2, 0xdf, 0x1a, 0x10, 0x10, 0x23, 0x10, 0x83, 0x18, 0xc7, 0x5d, 0xc9, 0x86, 0x11, 0xa0, 0x9d, 0xc4, 0x8a, - 0x0a, 0xcd, 0xec, 0x67, 0x6f, 0xab, 0xdf, 0x22, 0x2f, 0x07, 0xe0, 0x26, 0xf0, 0x59, 0xb6, 0x72, 0xb5, 0x6e, 0x5c, 0xbc, 0x8e, 0x1d, 0x21, 0xbb, 0xd8, 0x67, 0xdd, 0x92, 0x72, 0x12, 0x05, 0x46, - 0x81, 0xd7, 0x0e, 0xa7, 0x37, 0x13, 0x4c, 0xdf, 0xce, 0x93, 0xb6, 0xf8, 0x2a, 0xe2, 0x24, 0x23, 0x27, 0x4e, 0x58, 0xa0, 0x82, 0x1c, 0xc5, 0x50, 0x2e, 0x2d, 0x0a, 0xb4, 0x58, 0x5e, 0x94, 0xde, - 0x69, 0x75, 0xbe, 0x5e, 0x0b, 0x4e, 0xfc, 0xe5, 0x1c, 0xd3, 0xe7, 0x0c, 0x25, 0xa1, 0xfb, 0xbb, 0xd6, 0x09, 0xd2, 0x73, 0xad, 0x5b, 0x0d, 0x59, 0x63, 0x1c, 0x53, 0x1f, 0x6a, 0x0a, 0x57, 0xb9 + { + 0x64, 0x49, 0x7e, 0x5a, 0x83, 0x1e, 0x4a, 0x93, 0x2c, 0x09, 0xbe, 0x3e, 0x53, 0x93, 0x37, 0x6d, 0xaa, 0x59, 0x95, 0x48, 0xb8, 0x16, 0x03, 0x1d, 0x22, 0x4b, 0xbf, 0x50, 0xa8, 0x18, 0xed, 0x23, + 0x50, 0xea, 0xe7, 0xe9, 0x60, 0x87, 0xc8, 0xa0, 0xdb, 0x51, 0xad, 0x29, 0x0b, 0xd0, 0x0c, 0x1a, 0xc1, 0x62, 0x08, 0x57, 0x63, 0x5b, 0xf2, 0x46, 0xc1, 0x76, 0xab, 0x46, 0x3b, 0xe3, 0x0b, 0x80, + 0x8d, 0xa5, 0x48, 0x08, 0x1a, 0xc8, 0x47, 0xb1, 0x58, 0xe1, 0x26, 0x4b, 0xe2, 0x5b, 0xb0, 0x91, 0x0b, 0xbc, 0x92, 0x64, 0x71, 0x08, 0x08, 0x94, 0x15, 0xd4, 0x5f, 0xab, 0x1b, 0x3d, 0x26, 0x04, + 0xe8, 0xa8, 0xef, 0xf1, 0xae, 0x40, 0x20, 0xcf, 0xa3, 0x99, 0x36, 0xb6, 0x68, 0x27, 0xb2, 0x3f, 0x37, 0x1b, 0x92, 0x20, 0x0b, 0xe9, 0x02, 0x51, 0xe6, 0xd7, 0x3c, 0x5f, 0x86, 0xde, 0x5f, 0xd4, + 0xa9, 0x50, 0x78, 0x19, 0x33, 0xd7, 0x9a, 0x28, 0x27, 0x2b, 0x78, 0x2a, 0x2e, 0xc3, 0x13, 0xef, 0xdf, 0xcc, 0x06, 0x28, 0xf4, 0x3d, 0x74, 0x4c, 0x2d, 0xc2, 0xff, 0x3d, 0xcb, 0x66, 0x99, 0x9b, + 0x50, 0xc7, 0xca, 0x89, 0x5b, 0x0c, 0x64, 0x79, 0x1e, 0xea, 0xa5, 0xf2, 0x94, 0x99, 0xfb, 0x1c, 0x02, 0x6f, 0x84, 0xce, 0x5b, 0x5c, 0x72, 0xba, 0x10, 0x83, 0xcd, 0xdb, 0x5c, 0xe4, 0x54, 0x34, + 0x63, 0x16, 0x65, 0xc3, 0x33, 0xb6, 0x0b, 0x11, 0x59, 0x3f, 0xb2, 0x53, 0xc5, 0x17, 0x9a, 0x2c, 0x8d, 0xb8, 0x13, 0x78, 0x2a, 0x00, 0x48, 0x56, 0xa1, 0x65, 0x30, 0x11, 0xe9, 0x3f, 0xb6, 0xd8, + 0x76, 0xc1, 0x83, 0x66, 0xdd, 0x86, 0x83, 0xf5, 0x34, 0x12, 0xc0, 0xc1, 0x80, 0xf9, 0xc8, 0x48, 0x59, 0x2d, 0x59, 0x3f, 0x86, 0x09, 0xca, 0x73, 0x63, 0x17, 0xd3, 0x56, 0xe1, 0x3e, 0x2b, 0xff, + 0x3a, 0x9f, 0x59, 0xcd, 0x9a, 0xeb, 0x19, 0xcd, 0x48, 0x25, 0x93, 0xd8, 0xc4, 0x61, 0x28, 0xbb, 0x32, 0x42, 0x3b, 0x37, 0xa9, 0xad, 0xfb, 0x48, 0x2b, 0x99, 0x45, 0x3f, 0xbe, 0x25, 0xa4, 0x1b, + 0xf6, 0xfe, 0xb4, 0xaa, 0x0b, 0xef, 0x5e, 0xd2, 0x4b, 0xf7, 0x3c, 0x76, 0x29, 0x78, 0x02, 0x54, 0x82, 0xc1, 0x31, 0x15, 0xe4, 0x01, 0x5a, 0xac, 0x99, 0x2e, 0x56, 0x13, 0xa3, 0xb5, 0xc2, 0xf6, + 0x85, 0xb8, 0x47, 0x95, 0xcb, 0x6e, 0x9b, 0x26, 0x56, 0xd8, 0xc8, 0x81, 0x57, 0xe5, 0x2c, 0x42, 0xf9, 0x78, 0xd8, 0x63, 0x4c, 0x43, 0xd0, 0x6f, 0xea, 0x92, 0x8f, 0x28, 0x22, 0xe4, 0x65, 0xaa, + 0x65, 0x76, 0xe9, 0xbf, 0x41, 0x93, 0x84, 0x50, 0x6c, 0xc3, 0xce, 0x3c, 0x54, 0xac, 0x1a, 0x6f, 0x67, 0xdc, 0x66, 0xf3, 0xb3, 0x01, 0x91, 0xe6, 0x98, 0x38, 0x0b, 0xc9, 0x99, 0xb0, 0x5a, 0xbc, + 0xe1, 0x9d, 0xc0, 0xc6, 0xdc, 0xc2, 0xdd, 0x00, 0x1e, 0xc5, 0x35, 0xba, 0x18, 0xde, 0xb2, 0xdf, 0x1a, 0x10, 0x10, 0x23, 0x10, 0x83, 0x18, 0xc7, 0x5d, 0xc9, 0x86, 0x11, 0xa0, 0x9d, 0xc4, 0x8a, + 0x0a, 0xcd, 0xec, 0x67, 0x6f, 0xab, 0xdf, 0x22, 0x2f, 0x07, 0xe0, 0x26, 0xf0, 0x59, 0xb6, 0x72, 0xb5, 0x6e, 0x5c, 0xbc, 0x8e, 0x1d, 0x21, 0xbb, 0xd8, 0x67, 0xdd, 0x92, 0x72, 0x12, 0x05, 0x46, + 0x81, 0xd7, 0x0e, 0xa7, 0x37, 0x13, 0x4c, 0xdf, 0xce, 0x93, 0xb6, 0xf8, 0x2a, 0xe2, 0x24, 0x23, 0x27, 0x4e, 0x58, 0xa0, 0x82, 0x1c, 0xc5, 0x50, 0x2e, 0x2d, 0x0a, 0xb4, 0x58, 0x5e, 0x94, 0xde, + 0x69, 0x75, 0xbe, 0x5e, 0x0b, 0x4e, 0xfc, 0xe5, 0x1c, 0xd3, 0xe7, 0x0c, 0x25, 0xa1, 0xfb, 0xbb, 0xd6, 0x09, 0xd2, 0x73, 0xad, 0x5b, 0x0d, 0x59, 0x63, 0x1c, 0x53, 0x1f, 0x6a, 0x0a, 0x57, 0xb9 } } }; // XTS_TEST XTS_vectors[] @@ -446,9 +446,9 @@ char *hmac_whirlpool_test_vectors = "\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) { @@ -465,7 +465,7 @@ void CipherInit2(int cipher, void* key, void* ks, int key_len) CipherInit(cipher,key,ks); break; - default: + default: /* Unknown/wrong ID */ TC_THROW_FATAL_EXCEPTION; } @@ -485,7 +485,7 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci) int nTestsPerformed = 0; 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, 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 @@ -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 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. */ - for (writeOffset = 562949953420800ULL; - writeOffset > 562949953420800ULL - nbrUnits * ENCRYPTION_DATA_UNIT_SIZE; + for (writeOffset = 562949953420800ULL; + writeOffset > 562949953420800ULL - nbrUnits * ENCRYPTION_DATA_UNIT_SIZE; 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 for (i = 0; i < nbrUnits; i++) { - memcpy ((unsigned char *) buf + i * ENCRYPTION_DATA_UNIT_SIZE, - XTS_vectors[XTS_TEST_COUNT-1].plaintext, + memcpy ((unsigned char *) buf + i * ENCRYPTION_DATA_UNIT_SIZE, + XTS_vectors[XTS_TEST_COUNT-1].plaintext, 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 switch (testCase) { - case 0: + case 0: if (crc != 0x888f2990) return FALSE; nTestsPerformed++; @@ -792,8 +792,8 @@ BOOL TestSectorBufEncryption (PCRYPTO_INFO ci) // Each data unit will contain the same plaintext for (i = 0; i < nbrUnits; i++) { - memcpy ((unsigned char *) buf + i * ENCRYPTION_DATA_UNIT_SIZE, - XTS_vectors[XTS_TEST_COUNT-1].plaintext, + memcpy ((unsigned char *) buf + i * ENCRYPTION_DATA_UNIT_SIZE, + XTS_vectors[XTS_TEST_COUNT-1].plaintext, ENCRYPTION_DATA_UNIT_SIZE); } @@ -881,7 +881,7 @@ static BOOL DoAutoTestAlgorithms (void) /* AES */ for (i = 0; i < AES_TEST_COUNT; i++) - { + { int cipher = AES; memcpy(key, aes_ecb_vectors[i].key, 32); memcpy(tmp, aes_ecb_vectors[i].plaintext, 16); @@ -926,7 +926,7 @@ static BOOL DoAutoTestAlgorithms (void) /* Serpent */ for (i = 0; i < SERPENT_TEST_COUNT; i++) - { + { int cipher = SERPENT; memcpy(key, serpent_vectors[i].key, 32); memcpy(tmp, serpent_vectors[i].plaintext, 16); @@ -947,7 +947,7 @@ static BOOL DoAutoTestAlgorithms (void) /* Twofish */ for (i = 0; i < TWOFISH_TEST_COUNT; i++) - { + { int cipher = TWOFISH; memcpy(key, twofish_vectors[i].key, 32); memcpy(tmp, twofish_vectors[i].plaintext, 16); @@ -964,7 +964,7 @@ static BOOL DoAutoTestAlgorithms (void) if (i != TWOFISH_TEST_COUNT) bFailed = TRUE; - + /* PKCS #5 and HMACs */ if (!test_pkcs5 ()) bFailed = TRUE; @@ -986,7 +986,7 @@ static BOOL DoAutoTestAlgorithms (void) /* Sector and buffer related algorithms */ if (!TestSectorBufEncryption (ci)) bFailed = TRUE; - + crypto_close (ci); return !bFailed; } diff --git a/src/Common/Tests.h b/src/Common/Tests.h index 5e56ff55..f2f99502 100644 --- a/src/Common/Tests.h +++ b/src/Common/Tests.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -15,7 +15,7 @@ extern "C" { #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); BOOL test_hmac_sha512 (void); diff --git a/src/Common/Volumes.c b/src/Common/Volumes.c index d2a54b5c..007a1c08 100644 --- a/src/Common/Volumes.c +++ b/src/Common/Volumes.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 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 } - + #ifndef DEVICE_DRIVER VirtualLock (&keyInfo, sizeof (keyInfo)); VirtualLock (&dk, sizeof (dk)); @@ -256,7 +256,7 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int // Test all available PKCS5 PRFs for (enqPkcs5Prf = FIRST_PRF_ID; enqPkcs5Prf <= LAST_PRF_ID || queuedWorkItems > 0; ++enqPkcs5Prf) - { + { // if a PRF is specified, we skip all other PRFs if (selected_pkcs5_prf != 0 && enqPkcs5Prf != selected_pkcs5_prf) continue; @@ -282,7 +282,7 @@ int ReadVolumeHeader (BOOL bBoot, char *encryptedHeader, Password *password, int EncryptionThreadPoolBeginKeyDerivation (&keyDerivationCompletedEvent, &noOutstandingWorkItemEvent, &item->KeyReady, &outstandingWorkItemCount, enqPkcs5Prf, keyInfo.userKey, keyInfo.keyLength, keyInfo.salt, get_pkcs5_iteration_count (enqPkcs5Prf, pim, truecryptMode, bBoot), item->DerivedKey); - + ++queuedWorkItems; break; } @@ -345,10 +345,10 @@ KeyReady: ; PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize()); break; - default: + default: // Unknown/wrong ID TC_THROW_FATAL_EXCEPTION; - } + } } // Test all available modes of operation @@ -401,7 +401,7 @@ KeyReady: ; // Copy the header for decryption memcpy (header, encryptedHeader, sizeof (header)); - // Try to decrypt header + // Try to decrypt header DecryptBuffer (header + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, cryptoInfo); @@ -413,7 +413,7 @@ KeyReady: ; // Header version headerVersion = GetHeaderField16 (header, TC_HEADER_OFFSET_VERSION); - + if (headerVersion > VOLUME_HEADER_VERSION) { status = ERR_NEW_VERSION_REQUIRED; @@ -471,7 +471,7 @@ KeyReady: ; // Volume size cryptoInfo->VolumeSize = GetHeaderField64 (header, TC_HEADER_OFFSET_VOLUME_SIZE); - + // Encrypted area size and length cryptoInfo->EncryptedAreaStart = GetHeaderField64 (header, TC_HEADER_OFFSET_ENCRYPTED_AREA_START); cryptoInfo->EncryptedAreaLength = GetHeaderField64 (header, TC_HEADER_OFFSET_ENCRYPTED_AREA_LENGTH); @@ -493,7 +493,7 @@ KeyReady: ; goto err; } - // Preserve scheduled header keys if requested + // Preserve scheduled header keys if requested if (retHeaderCryptoInfo) { if (retInfo == NULL) @@ -557,7 +557,7 @@ err: if (cryptoInfo != retHeaderCryptoInfo) { crypto_close(cryptoInfo); - *retInfo = NULL; + *retInfo = NULL; } ret: @@ -601,7 +601,7 @@ void ComputeBootloaderFingerprint (byte *bootLoaderBuf, unsigned int bootLoaderS WHIRLPOOL_CTX whirlpool; sha512_ctx sha2; - + WHIRLPOOL_init (&whirlpool); 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); #endif - // Try to decrypt header + // Try to decrypt header DecryptBuffer (header + HEADER_ENCRYPTED_DATA_OFFSET, HEADER_ENCRYPTED_DATA_SIZE, cryptoInfo); - + // Check magic 'VERA' and CRC-32 of header fields and master keydata 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)) @@ -774,7 +774,7 @@ err: if (cryptoInfo != retHeaderCryptoInfo) { crypto_close(cryptoInfo); - *retInfo = NULL; + *retInfo = NULL; } ret: @@ -844,7 +844,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea, memcpy (keyInfo.master_keydata, masterKeydata, MASTER_KEYDATA_SIZE); } - // User key + // User key memcpy (keyInfo.userKey, password->Text, nUserKeyLen); keyInfo.keyLength = nUserKeyLen; 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 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 switch (pkcs5_prf) @@ -888,15 +888,15 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea, PKCS5_SALT_SIZE, keyInfo.noIterations, dk, GetMaxPkcs5OutSize()); break; - default: + default: // Unknown/wrong ID TC_THROW_FATAL_EXCEPTION; - } + } /* Header setup */ // Salt - mputBytes (p, keyInfo.salt, PKCS5_SALT_SIZE); + mputBytes (p, keyInfo.salt, PKCS5_SALT_SIZE); // Magic mputLong (p, 0x56455241); @@ -985,7 +985,7 @@ int CreateVolumeHeaderInMemory (HWND hwndDlg, BOOL bBoot, char *header, int ea, /* 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); if (retVal != ERR_SUCCESS) return retVal; @@ -1080,7 +1080,7 @@ BOOL ReadEffectiveVolumeHeader (BOOL device, HANDLE fileHandle, byte *header, DW return FALSE; memcpy (header, sectorBuffer, min (*bytesRead, TC_VOLUME_HEADER_EFFECTIVE_SIZE)); - + if (*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) || !RandgetBytes (hwndDlg, cryptoInfo->k2, sizeof (cryptoInfo->k2), FALSE)) { - nStatus = ERR_PARAMETER_INCORRECT; + nStatus = ERR_PARAMETER_INCORRECT; goto final_seq; } diff --git a/src/Common/Volumes.h b/src/Common/Volumes.h index 43aaaf73..fdd1444f 100644 --- a/src/Common/Volumes.h +++ b/src/Common/Volumes.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -19,7 +19,7 @@ extern "C" { #endif // Volume header version -#define VOLUME_HEADER_VERSION 0x0005 +#define VOLUME_HEADER_VERSION 0x0005 // Version number written to volume header during format; // specifies the minimum program version required to mount the volume @@ -101,7 +101,7 @@ extern "C" { #define HEADER_SALT_OFFSET 0 #define HEADER_ENCRYPTED_DATA_OFFSET PKCS5_SALT_SIZE #define HEADER_MASTER_KEYDATA_OFFSET 256 - + #define TC_HEADER_OFFSET_MAGIC 64 #define TC_HEADER_OFFSET_VERSION 68 #define TC_HEADER_OFFSET_REQUIRED_VERSION 70 diff --git a/src/Common/Wipe.c b/src/Common/Wipe.c index 83099547..5b07ced5 100644 --- a/src/Common/Wipe.c +++ b/src/Common/Wipe.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Common/Wipe.h b/src/Common/Wipe.h index 97011085..a6ca748f 100644 --- a/src/Common/Wipe.h +++ b/src/Common/Wipe.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Common/Xml.c b/src/Common/Xml.c index 60dd8266..d733dac1 100644 --- a/src/Common/Xml.c +++ b/src/Common/Xml.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -172,7 +172,7 @@ char *XmlQuoteText (const char *textSrc, char *textDst, int textDstMaxSize) if (textDstMaxSize == 0) return NULL; - while (*textSrc != 0 && textDst <= textDstLast) + while (*textSrc != 0 && textDst <= textDstLast) { char c = *textSrc++; switch (c) @@ -217,7 +217,7 @@ wchar_t *XmlQuoteTextW (const wchar_t *textSrc, wchar_t *textDst, int textDstMax if (textDstMaxSize == 0) return NULL; - while (*textSrc != 0 && textDst <= textDstLast) + while (*textSrc != 0 && textDst <= textDstLast) { wchar_t c = *textSrc++; switch (c) diff --git a/src/Common/Xml.h b/src/Common/Xml.h index 41daf40f..3dfb58e1 100644 --- a/src/Common/Xml.h +++ b/src/Common/Xml.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Common/Xts.c b/src/Common/Xts.c index 0bdb8271..02977887 100644 --- a/src/Common/Xts.c +++ b/src/Common/Xts.c @@ -3,14 +3,14 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 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. */ @@ -37,7 +37,7 @@ For big-endian platforms define BYTE_ORDER as BIG_ENDIAN. */ // ks2: the secondary key schedule // 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. -// 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 // 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 @@ -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 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. dataUnitNo = startDataUnitNo->Value; *((unsigned __int64 *) byteBufUnitNo) = LE64 (dataUnitNo); @@ -107,7 +107,7 @@ static void EncryptBufferXTSParallel (unsigned __int8 *buffer, whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; 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) *whiteningValuePtr64 = *((unsigned __int64 *) byteBufUnitNo); *(whiteningValuePtr64 + 1) = 0; @@ -131,21 +131,21 @@ static void EncryptBufferXTSParallel (unsigned __int8 *buffer, // Little-endian platforms - finalCarry = + finalCarry = (*whiteningValuePtr64 & 0x8000000000000000) ? 135 : 0; *whiteningValuePtr64-- <<= 1; if (*whiteningValuePtr64 & 0x8000000000000000) - *(whiteningValuePtr64 + 1) |= 1; + *(whiteningValuePtr64 + 1) |= 1; *whiteningValuePtr64 <<= 1; #else // Big-endian platforms - finalCarry = + finalCarry = (*whiteningValuePtr64 & 0x80) ? 135 : 0; @@ -154,7 +154,7 @@ static void EncryptBufferXTSParallel (unsigned __int8 *buffer, whiteningValuePtr64--; if (*whiteningValuePtr64 & 0x80) - *(whiteningValuePtr64 + 1) |= 0x0100000000000000; + *(whiteningValuePtr64 + 1) |= 0x0100000000000000; *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); #endif @@ -176,7 +176,7 @@ static void EncryptBufferXTSParallel (unsigned __int8 *buffer, // Actual encryption EncipherBlocks (cipher, dataUnitBufPtr, ks, endBlock - startBlock); - + bufPtr = dataUnitBufPtr; 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 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. dataUnitNo = startDataUnitNo->Value; *((unsigned __int64 *) byteBufUnitNo) = LE64 (dataUnitNo); @@ -243,7 +243,7 @@ static void EncryptBufferXTSNonParallel (unsigned __int8 *buffer, 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) *whiteningValuePtr64 = *((unsigned __int64 *) byteBufUnitNo); *(whiteningValuePtr64 + 1) = 0; @@ -275,21 +275,21 @@ static void EncryptBufferXTSNonParallel (unsigned __int8 *buffer, // Little-endian platforms - finalCarry = + finalCarry = (*whiteningValuePtr64 & 0x8000000000000000) ? 135 : 0; *whiteningValuePtr64-- <<= 1; if (*whiteningValuePtr64 & 0x8000000000000000) - *(whiteningValuePtr64 + 1) |= 1; + *(whiteningValuePtr64 + 1) |= 1; *whiteningValuePtr64 <<= 1; #else // Big-endian platforms - finalCarry = + finalCarry = (*whiteningValuePtr64 & 0x80) ? 135 : 0; @@ -298,7 +298,7 @@ static void EncryptBufferXTSNonParallel (unsigned __int8 *buffer, whiteningValuePtr64--; if (*whiteningValuePtr64 & 0x80) - *(whiteningValuePtr64 + 1) |= 0x0100000000000000; + *(whiteningValuePtr64 + 1) |= 0x0100000000000000; *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); #endif @@ -353,7 +353,7 @@ static void DecryptBufferXTSParallel (unsigned __int8 *buffer, unsigned __int64 *const finalInt64WhiteningValuesPtr = whiteningValuesPtr64 + sizeof (whiteningValues) / sizeof (*whiteningValuesPtr64) - 1; 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. dataUnitNo = startDataUnitNo->Value; *((unsigned __int64 *) byteBufUnitNo) = LE64 (dataUnitNo); @@ -375,7 +375,7 @@ static void DecryptBufferXTSParallel (unsigned __int8 *buffer, whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; 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) *whiteningValuePtr64 = *((unsigned __int64 *) byteBufUnitNo); *(whiteningValuePtr64 + 1) = 0; @@ -399,21 +399,21 @@ static void DecryptBufferXTSParallel (unsigned __int8 *buffer, // Little-endian platforms - finalCarry = + finalCarry = (*whiteningValuePtr64 & 0x8000000000000000) ? 135 : 0; *whiteningValuePtr64-- <<= 1; if (*whiteningValuePtr64 & 0x8000000000000000) - *(whiteningValuePtr64 + 1) |= 1; + *(whiteningValuePtr64 + 1) |= 1; *whiteningValuePtr64 <<= 1; #else // Big-endian platforms - finalCarry = + finalCarry = (*whiteningValuePtr64 & 0x80) ? 135 : 0; @@ -422,7 +422,7 @@ static void DecryptBufferXTSParallel (unsigned __int8 *buffer, whiteningValuePtr64--; if (*whiteningValuePtr64 & 0x80) - *(whiteningValuePtr64 + 1) |= 0x0100000000000000; + *(whiteningValuePtr64 + 1) |= 0x0100000000000000; *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); #endif @@ -481,7 +481,7 @@ static void DecryptBufferXTSNonParallel (unsigned __int8 *buffer, unsigned int startBlock = startCipherBlockNo, endBlock, block; 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. dataUnitNo = startDataUnitNo->Value; *((unsigned __int64 *) byteBufUnitNo) = LE64 (dataUnitNo); @@ -502,7 +502,7 @@ static void DecryptBufferXTSNonParallel (unsigned __int8 *buffer, 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) *whiteningValuePtr64 = *((unsigned __int64 *) byteBufUnitNo); *(whiteningValuePtr64 + 1) = 0; @@ -534,21 +534,21 @@ static void DecryptBufferXTSNonParallel (unsigned __int8 *buffer, // Little-endian platforms - finalCarry = + finalCarry = (*whiteningValuePtr64 & 0x8000000000000000) ? 135 : 0; *whiteningValuePtr64-- <<= 1; if (*whiteningValuePtr64 & 0x8000000000000000) - *(whiteningValuePtr64 + 1) |= 1; + *(whiteningValuePtr64 + 1) |= 1; *whiteningValuePtr64 <<= 1; #else // Big-endian platforms - finalCarry = + finalCarry = (*whiteningValuePtr64 & 0x80) ? 135 : 0; @@ -557,7 +557,7 @@ static void DecryptBufferXTSNonParallel (unsigned __int8 *buffer, whiteningValuePtr64--; if (*whiteningValuePtr64 & 0x80) - *(whiteningValuePtr64 + 1) |= 0x0100000000000000; + *(whiteningValuePtr64 + 1) |= 0x0100000000000000; *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); #endif @@ -581,7 +581,7 @@ static void DecryptBufferXTSNonParallel (unsigned __int8 *buffer, #if BYTE_ORDER == BIG_ENDIAN #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 @@ -627,7 +627,7 @@ static void EncryptDecryptBufferXTS32 (const unsigned __int8 *buffer, 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.) Uint64ToLE16ByteArray (byteBufUnitNo, dataUnitNo.HighPart, dataUnitNo.LowPart); @@ -639,7 +639,7 @@ static void EncryptDecryptBufferXTS32 (const unsigned __int8 *buffer, else 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) memcpy (whiteningValue, byteBufUnitNo, BYTES_PER_XTS_BLOCK); EncipherBlock (cipher, whiteningValue, ks2); @@ -690,7 +690,7 @@ static void EncryptDecryptBufferXTS32 (const unsigned __int8 *buffer, // A regular carry *(whiteningValuePtr32 + 1) |= 1; } - else + else { // The highest byte shift will result in a carry finalCarry = 135; @@ -712,7 +712,7 @@ static void EncryptDecryptBufferXTS32 (const unsigned __int8 *buffer, 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); } diff --git a/src/Common/Xts.h b/src/Common/Xts.h index f4f4ab5b..2cf0a95d 100644 --- a/src/Common/Xts.h +++ b/src/Common/Xts.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -54,9 +54,9 @@ extern "C" { #endif #ifndef TCDEFS_H -typedef union +typedef union { - struct + struct { unsigned __int32 LowPart; unsigned __int32 HighPart; diff --git a/src/Core/Core.h b/src/Core/Core.h index 07a055a0..50c00e91 100644 --- a/src/Core/Core.h +++ b/src/Core/Core.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -157,7 +157,7 @@ namespace VeraCrypt public: WaitThreadUI(WaitThreadRoutine* pRoutine): m_pRoutine(pRoutine) {} virtual ~WaitThreadUI() {} - virtual void Run(void) { m_pRoutine->ExecutionCode();} + virtual void Run(void) { m_pRoutine->ExecutionCode();} WaitThreadRoutine* m_pRoutine; }; } diff --git a/src/Core/Core.make b/src/Core/Core.make index 9764f34d..f3fc3406 100644 --- a/src/Core/Core.make +++ b/src/Core/Core.make @@ -3,7 +3,7 @@ # Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed # 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 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 diff --git a/src/Core/CoreBase.cpp b/src/Core/CoreBase.cpp index b39e56d8..1703feea 100644 --- a/src/Core/CoreBase.cpp +++ b/src/Core/CoreBase.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -79,7 +79,7 @@ namespace VeraCrypt 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 { shared_ptr <Volume> volume = OpenVolume (volumePath, preserveTimestamps, password, pim, kdf, truecryptMode, keyfiles); @@ -147,7 +147,7 @@ namespace VeraCrypt outerVolume->ReadSectors (bootSectorBuffer, 0); int fatType; - byte *bootSector = bootSectorBuffer.Ptr(); + byte *bootSector = bootSectorBuffer.Ptr(); if (memcmp (bootSector + 54, "FAT12", 5) == 0) 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); return volume; } - + void CoreBase::RandomizeEncryptionAlgorithmKey (shared_ptr <EncryptionAlgorithm> encryptionAlgorithm) const { SecureBuffer eaKey (encryptionAlgorithm->GetKeySize()); diff --git a/src/Core/CoreBase.h b/src/Core/CoreBase.h index 15bfce3f..34ce9b42 100644 --- a/src/Core/CoreBase.h +++ b/src/Core/CoreBase.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -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 <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 CreateKeyfile (const FilePath &keyfilePath) const; virtual void DismountFilesystem (const DirectoryPath &mountPoint, bool force) const = 0; diff --git a/src/Core/CoreException.cpp b/src/Core/CoreException.cpp index fd4ea2af..9f0bf04b 100644 --- a/src/Core/CoreException.cpp +++ b/src/Core/CoreException.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/CoreException.h b/src/Core/CoreException.h index 62c56661..36dc1822 100644 --- a/src/Core/CoreException.h +++ b/src/Core/CoreException.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/FatFormatter.cpp b/src/Core/FatFormatter.cpp index 807fa30c..9fb54ff7 100644 --- a/src/Core/FatFormatter.cpp +++ b/src/Core/FatFormatter.cpp @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -89,8 +89,8 @@ namespace VeraCrypt ft->cluster_size = 1; // Geometry always set to SECTORS/1/1 - ft->secs_track = 1; - ft->heads = 1; + ft->secs_track = 1; + ft->heads = 1; ft->dir_entries = 512; ft->fats = 2; @@ -180,13 +180,13 @@ namespace VeraCrypt cnt += 2; boot[cnt++] = (int8) ft->media; /* media byte */ - if(ft->size_fat == 32) + if(ft->size_fat == 32) { boot[cnt++] = 0x00; boot[cnt++] = 0x00; } - else - { + else + { *(uint16 *)(boot + cnt) = Endian::Little ((uint16) ft->fat_length); /* fat size */ cnt += 2; } @@ -248,13 +248,13 @@ namespace VeraCrypt { memset (sector, 0, ft->sector_size); sector[3] = 0x41; /* LeadSig */ - sector[2] = 0x61; - sector[1] = 0x52; - sector[0] = 0x52; + sector[2] = 0x61; + sector[1] = 0x52; + sector[0] = 0x52; sector[484+3] = 0x61; /* StrucSig */ - sector[484+2] = 0x41; - sector[484+1] = 0x72; - sector[484+0] = 0x72; + sector[484+2] = 0x41; + sector[484+1] = 0x72; + sector[484+0] = 0x72; // Free cluster count *(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.cluster_size = clusterSize / fatParams.sector_size; memcpy (fatParams.volume_name, "NO NAME ", 11); - GetFatParams (&fatParams); + GetFatParams (&fatParams); fatparams *ft = &fatParams; SecureBuffer sector (ft->sector_size); @@ -300,7 +300,7 @@ namespace VeraCrypt writeSector (sector); ++sectorNumber; /* fat32 boot area */ - if (ft->size_fat == 32) + if (ft->size_fat == 32) { /* fsinfo */ PutFSInfo((byte *) sector, ft); @@ -351,7 +351,7 @@ namespace VeraCrypt fat_sig[8] = fat_sig[9] = fat_sig[10] = 0xff; fat_sig[11] = 0x0f; memcpy (sector, fat_sig, 12); - } + } else if (ft->size_fat == 16) { fat_sig[0] = (byte) ft->media; diff --git a/src/Core/FatFormatter.h b/src/Core/FatFormatter.h index 520e58b1..3b129527 100644 --- a/src/Core/FatFormatter.h +++ b/src/Core/FatFormatter.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/HostDevice.cpp b/src/Core/HostDevice.cpp index 61229983..69788095 100644 --- a/src/Core/HostDevice.cpp +++ b/src/Core/HostDevice.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -41,7 +41,7 @@ namespace VeraCrypt sr.Serialize ("Removable", Removable); sr.Serialize ("Size", Size); sr.Serialize ("SystemNumber", SystemNumber); - + sr.Serialize ("Partitions", (uint32) Partitions.size()); foreach_ref (const HostDevice &partition, Partitions) partition.Serialize (stream); diff --git a/src/Core/HostDevice.h b/src/Core/HostDevice.h index 47e478c6..a790878e 100644 --- a/src/Core/HostDevice.h +++ b/src/Core/HostDevice.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/MountOptions.cpp b/src/Core/MountOptions.cpp index c3529efb..29f554e6 100644 --- a/src/Core/MountOptions.cpp +++ b/src/Core/MountOptions.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -102,14 +102,14 @@ namespace VeraCrypt sr.Deserialize ("UseBackupHeaders", UseBackupHeaders); sr.Deserialize ("TrueCryptMode", TrueCryptMode); - + try { if (!sr.DeserializeBool ("KdfNull")) { sr.Deserialize ("Kdf", nameValue); Kdf = Pkcs5Kdf::GetAlgorithm (nameValue, TrueCryptMode); - } + } } catch(...) {} @@ -122,7 +122,7 @@ namespace VeraCrypt } } catch(...) {} - + sr.Deserialize ("Pim", Pim); sr.Deserialize ("ProtectionPim", ProtectionPim); } @@ -144,7 +144,7 @@ namespace VeraCrypt sr.Serialize ("NoFilesystem", NoFilesystem); sr.Serialize ("NoHardwareCrypto", NoHardwareCrypto); sr.Serialize ("NoKernelCrypto", NoKernelCrypto); - + sr.Serialize ("PasswordNull", Password == nullptr); if (Password) Password->Serialize (stream); @@ -176,7 +176,7 @@ namespace VeraCrypt sr.Serialize ("ProtectionKdfNull", ProtectionKdf == nullptr); if (ProtectionKdf) sr.Serialize ("ProtectionKdf", ProtectionKdf->GetName()); - + sr.Serialize ("Pim", Pim); sr.Serialize ("ProtectionPim", ProtectionPim); } diff --git a/src/Core/MountOptions.h b/src/Core/MountOptions.h index b9319b55..2dcc5e1b 100644 --- a/src/Core/MountOptions.h +++ b/src/Core/MountOptions.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/RandomNumberGenerator.cpp b/src/Core/RandomNumberGenerator.cpp index 403eb288..9551f585 100644 --- a/src/Core/RandomNumberGenerator.cpp +++ b/src/Core/RandomNumberGenerator.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -124,7 +124,7 @@ namespace VeraCrypt if (ReadOffset >= PoolSize) ReadOffset = 0; } - + pbBuffer += loopLen; } } @@ -186,7 +186,7 @@ namespace VeraCrypt } void RandomNumberGenerator::Stop () - { + { ScopeLock lock (AccessMutex); if (Pool.IsAllocated()) diff --git a/src/Core/RandomNumberGenerator.h b/src/Core/RandomNumberGenerator.h index c7608a1a..53482301 100644 --- a/src/Core/RandomNumberGenerator.h +++ b/src/Core/RandomNumberGenerator.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/Unix/CoreService.cpp b/src/Core/Unix/CoreService.cpp index a4f85ba7..caa8c2b0 100644 --- a/src/Core/Unix/CoreService.cpp +++ b/src/Core/Unix/CoreService.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -30,7 +30,7 @@ namespace VeraCrypt auto_ptr <T> CoreService::GetResponse () { auto_ptr <Serializable> deserializedObject (Serializable::DeserializeNew (ServiceOutputStream)); - + Exception *deserializedException = dynamic_cast <Exception*> (deserializedObject.get()); if (deserializedException) deserializedException->Throw(); @@ -60,11 +60,11 @@ namespace VeraCrypt throw_sys_if (read (STDIN_FILENO, &b, 1) != 1); if (b != 0x00) continue; - + throw_sys_if (read (STDIN_FILENO, &b, 1) != 1); if (b != 0x11) continue; - + throw_sys_if (read (STDIN_FILENO, &b, 1) != 1); if (b == 0x22) break; @@ -113,7 +113,7 @@ namespace VeraCrypt if (!ElevatedServiceAvailable) { finally_do_arg (string *, &request->AdminPassword, { StringConverter::Erase (*finally_arg); }); - + CoreService::StartElevated (*request); ElevatedServiceAvailable = true; } @@ -128,7 +128,7 @@ namespace VeraCrypt if (checkRequest) { Core->CheckFilesystem (checkRequest->MountedVolumeInfo, checkRequest->Repair); - + CheckFilesystemResponse().Serialize (outputStream); continue; } @@ -263,7 +263,7 @@ namespace VeraCrypt GetHostDevicesRequest request (pathListOnly); return SendRequest <GetHostDevicesResponse> (request)->HostDevices; } - + shared_ptr <VolumeInfo> CoreService::RequestMountVolume (MountOptions &options) { MountVolumeRequest request (&options); @@ -456,7 +456,7 @@ namespace VeraCrypt inPipe->Close(); outPipe->Close(); errPipe.Close(); - + if (request.FastElevation) { // Prevent defunct process @@ -532,7 +532,7 @@ namespace VeraCrypt ExitRequest exitRequest; exitRequest.Serialize (ServiceInputStream); } - + shared_ptr <GetStringFunctor> CoreService::AdminPasswordCallback; auto_ptr <Pipe> CoreService::AdminInputPipe; diff --git a/src/Core/Unix/CoreService.h b/src/Core/Unix/CoreService.h index da6d2321..4dce35a0 100644 --- a/src/Core/Unix/CoreService.h +++ b/src/Core/Unix/CoreService.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/Unix/CoreServiceProxy.h b/src/Core/Unix/CoreServiceProxy.h index 9198dd56..33b2be01 100644 --- a/src/Core/Unix/CoreServiceProxy.h +++ b/src/Core/Unix/CoreServiceProxy.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -97,7 +97,7 @@ namespace VeraCrypt else { MountOptions newOptions = options; - + newOptions.Password = Keyfile::ApplyListToPassword (options.Keyfiles, options.Password); if (newOptions.Keyfiles) newOptions.Keyfiles->clear(); diff --git a/src/Core/Unix/CoreServiceRequest.cpp b/src/Core/Unix/CoreServiceRequest.cpp index b19f0f81..51e26c0c 100644 --- a/src/Core/Unix/CoreServiceRequest.cpp +++ b/src/Core/Unix/CoreServiceRequest.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -229,13 +229,13 @@ namespace VeraCrypt Serializer sr (stream); Options->Serialize (stream); } - + // SetFileOwnerRequest void SetFileOwnerRequest::Deserialize (shared_ptr <Stream> stream) { CoreServiceRequest::Deserialize (stream); Serializer sr (stream); - + uint64 owner; sr.Deserialize ("Owner", owner); Owner.SystemId = static_cast <uid_t> (owner); diff --git a/src/Core/Unix/CoreServiceRequest.h b/src/Core/Unix/CoreServiceRequest.h index 61b673ec..b6798e41 100644 --- a/src/Core/Unix/CoreServiceRequest.h +++ b/src/Core/Unix/CoreServiceRequest.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/Unix/CoreServiceResponse.cpp b/src/Core/Unix/CoreServiceResponse.cpp index 9980cc91..e56ac123 100644 --- a/src/Core/Unix/CoreServiceResponse.cpp +++ b/src/Core/Unix/CoreServiceResponse.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -75,7 +75,7 @@ namespace VeraCrypt Serializer sr (stream); sr.Serialize ("Size", Size); } - + // GetHostDevicesResponse void GetHostDevicesResponse::Deserialize (shared_ptr <Stream> stream) { diff --git a/src/Core/Unix/CoreServiceResponse.h b/src/Core/Unix/CoreServiceResponse.h index d5956f8e..24c7b64c 100644 --- a/src/Core/Unix/CoreServiceResponse.h +++ b/src/Core/Unix/CoreServiceResponse.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/Unix/CoreUnix.cpp b/src/Core/Unix/CoreUnix.cpp index 43c37a28..12287038 100644 --- a/src/Core/Unix/CoreUnix.cpp +++ b/src/Core/Unix/CoreUnix.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -27,7 +27,7 @@ namespace VeraCrypt CoreUnix::CoreUnix () { signal (SIGPIPE, SIG_IGN); - + char *loc = setlocale (LC_ALL, ""); if (!loc || string (loc) == "C") setlocale (LC_ALL, "en_US.UTF-8"); @@ -36,7 +36,7 @@ namespace VeraCrypt CoreUnix::~CoreUnix () { } - + void CoreUnix::CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair) const { if (!mountedVolume->MountPoint.IsEmpty()) @@ -77,9 +77,9 @@ namespace VeraCrypt args.push_back ("fsck"); args.push_back ("--caption"); args.push_back ("fsck"); - args.push_back ("-e"); - args.push_back ("sh"); - args.push_back ("-c"); + args.push_back ("-e"); + args.push_back ("sh"); + args.push_back ("-c"); args.push_back (xargs); try { @@ -176,7 +176,7 @@ namespace VeraCrypt { string path = filePath; size_t pos; - + while ((pos = path.find_last_of ('/')) != string::npos) { path = path.substr (0, pos); @@ -224,7 +224,7 @@ namespace VeraCrypt device.SeekAt (0); device.ReadCompleteBuffer (bootSector); - byte *b = bootSector.Ptr(); + byte *b = bootSector.Ptr(); return memcmp (b + 3, "NTFS", 4) != 0 && memcmp (b + 54, "FAT", 3) != 0 @@ -237,13 +237,13 @@ namespace VeraCrypt const char *envPrefix = getenv ("VERACRYPT_MOUNT_PREFIX"); if (envPrefix && !string (envPrefix).empty()) return envPrefix; - + if (FilesystemPath ("/media").IsDirectory()) return "/media/veracrypt"; - + if (FilesystemPath ("/mnt").IsDirectory()) return "/mnt/veracrypt"; - + return GetTempDirectory() + "/veracrypt_mnt"; } @@ -298,7 +298,7 @@ namespace VeraCrypt { continue; } - + if (!volumePath.IsEmpty() && wstring (mountedVol->Path).compare (volumePath) != 0) continue; @@ -320,7 +320,7 @@ namespace VeraCrypt return volumes; } - + gid_t CoreUnix::GetRealGroupId () const { const char *env = getenv ("SUDO_GID"); @@ -352,7 +352,7 @@ namespace VeraCrypt return getuid(); } - + string CoreUnix::GetTempDirectory () const { char *envDir = getenv ("TMPDIR"); @@ -583,7 +583,7 @@ namespace VeraCrypt throw; } -#ifndef TC_MACOSX +#ifndef TC_MACOSX // set again correct ownership of the mount point to avoid any issues if (!options.NoFilesystem && options.MountPoint) { diff --git a/src/Core/Unix/CoreUnix.h b/src/Core/Unix/CoreUnix.h index e4c3aa3e..4d12d4b0 100644 --- a/src/Core/Unix/CoreUnix.h +++ b/src/Core/Unix/CoreUnix.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -26,7 +26,7 @@ namespace VeraCrypt CoreUnix (); virtual ~CoreUnix (); - virtual void CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair = false) const; + virtual void CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair = false) const; virtual void DismountFilesystem (const DirectoryPath &mountPoint, bool force) const; virtual shared_ptr <VolumeInfo> DismountVolume (shared_ptr <VolumeInfo> mountedVolume, bool ignoreOpenFiles = false, bool syncVolumeInfo = false); virtual bool FilesystemSupportsLargeFiles (const FilePath &filePath) const; @@ -63,7 +63,7 @@ namespace VeraCrypt virtual void MountFilesystem (const DevicePath &devicePath, const DirectoryPath &mountPoint, const string &filesystemType, bool readOnly, const string &systemMountOptions) const; virtual void MountAuxVolumeImage (const DirectoryPath &auxMountPoint, const MountOptions &options) const; virtual void MountVolumeNative (shared_ptr <Volume> volume, MountOptions &options, const DirectoryPath &auxMountPoint) const { throw NotApplicable (SRC_POS); } - + private: CoreUnix (const CoreUnix &); CoreUnix &operator= (const CoreUnix &); diff --git a/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp b/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp index 20575067..2dd6be0b 100644 --- a/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp +++ b/src/Core/Unix/FreeBSD/CoreFreeBSD.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -127,8 +127,8 @@ namespace VeraCrypt partition->Path = partPath.str(); if (!pathListOnly) { - try - { + try + { partition->Size = GetDeviceSize (partition->Path); } catch (...) diff --git a/src/Core/Unix/FreeBSD/CoreFreeBSD.h b/src/Core/Unix/FreeBSD/CoreFreeBSD.h index 6c6b8062..c7d496fb 100644 --- a/src/Core/Unix/FreeBSD/CoreFreeBSD.h +++ b/src/Core/Unix/FreeBSD/CoreFreeBSD.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -24,7 +24,7 @@ namespace VeraCrypt CoreFreeBSD (); virtual ~CoreFreeBSD (); - virtual HostDeviceList GetHostDevices (bool pathListOnly = false) const; + virtual HostDeviceList GetHostDevices (bool pathListOnly = false) const; protected: virtual DevicePath AttachFileToLoopDevice (const FilePath &filePath, bool readOnly) const; diff --git a/src/Core/Unix/FreeBSD/System.h b/src/Core/Unix/FreeBSD/System.h index c97f60d2..26daade0 100644 --- a/src/Core/Unix/FreeBSD/System.h +++ b/src/Core/Unix/FreeBSD/System.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/Unix/Linux/CoreLinux.cpp b/src/Core/Unix/Linux/CoreLinux.cpp index 50d546d4..eb4545fd 100644 --- a/src/Core/Unix/Linux/CoreLinux.cpp +++ b/src/Core/Unix/Linux/CoreLinux.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -41,7 +41,7 @@ namespace VeraCrypt loopPaths.push_back ("/dev/loop"); loopPaths.push_back ("/dev/loop/"); loopPaths.push_back ("/dev/.static/dev/loop"); - + // On Fedora 23,"losetup -f" must be called first to create a default loop device list <string> args; args.push_back ("-f"); @@ -171,7 +171,7 @@ namespace VeraCrypt while (tr.ReadLine (line)) { vector <string> fields = StringConverter::Split (line); - + if (fields.size() != 4 || fields[3].find ("loop") == 0 // skip loop devices || fields[3].find ("cloop") == 0 @@ -390,10 +390,10 @@ namespace VeraCrypt stringstream nativeDevName; nativeDevName << "veracrypt" << options.SlotNumber; - + if (nativeDevCount != cipherCount - 1) nativeDevName << "_" << cipherCount - nativeDevCount - 2; - + nativeDevPath = "/dev/mapper/" + nativeDevName.str(); execArgs.clear(); @@ -401,7 +401,7 @@ namespace VeraCrypt execArgs.push_back (nativeDevName.str()); Process::Execute ("dmsetup", execArgs, -1, nullptr, &dmCreateArgsBuf); - + // Wait for the device to be created for (int t = 0; true; t++) { diff --git a/src/Core/Unix/Linux/CoreLinux.h b/src/Core/Unix/Linux/CoreLinux.h index 949313bf..d31ba570 100644 --- a/src/Core/Unix/Linux/CoreLinux.h +++ b/src/Core/Unix/Linux/CoreLinux.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -24,7 +24,7 @@ namespace VeraCrypt CoreLinux (); virtual ~CoreLinux (); - virtual HostDeviceList GetHostDevices (bool pathListOnly = false) const; + virtual HostDeviceList GetHostDevices (bool pathListOnly = false) const; protected: virtual DevicePath AttachFileToLoopDevice (const FilePath &filePath, bool readOnly) const; diff --git a/src/Core/Unix/Linux/System.h b/src/Core/Unix/Linux/System.h index df7d9ba7..3acfa166 100644 --- a/src/Core/Unix/Linux/System.h +++ b/src/Core/Unix/Linux/System.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/Unix/MacOSX/CoreMacOSX.cpp b/src/Core/Unix/MacOSX/CoreMacOSX.cpp index b2a10017..e7572e68 100644 --- a/src/Core/Unix/MacOSX/CoreMacOSX.cpp +++ b/src/Core/Unix/MacOSX/CoreMacOSX.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -139,7 +139,7 @@ namespace VeraCrypt } else throw HigherFuseVersionRequired (SRC_POS); - + } vector <string> fuseVersion = StringConverter::Split (string (fuseVersionString), "."); @@ -187,7 +187,7 @@ namespace VeraCrypt args.push_back ("-readonly"); string xml; - + while (true) { try @@ -202,7 +202,7 @@ namespace VeraCrypt args.remove ("-noautofsck"); continue; } - + throw; } } diff --git a/src/Core/Unix/MacOSX/CoreMacOSX.h b/src/Core/Unix/MacOSX/CoreMacOSX.h index f3bf6bf7..5b190e4a 100644 --- a/src/Core/Unix/MacOSX/CoreMacOSX.h +++ b/src/Core/Unix/MacOSX/CoreMacOSX.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -24,7 +24,7 @@ namespace VeraCrypt CoreMacOSX (); virtual ~CoreMacOSX (); - virtual void CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair = false) const; + virtual void CheckFilesystem (shared_ptr <VolumeInfo> mountedVolume, bool repair = false) const; virtual shared_ptr <VolumeInfo> DismountVolume (shared_ptr <VolumeInfo> mountedVolume, bool ignoreOpenFiles = false, bool syncVolumeInfo = false); virtual string GetDefaultMountPointPrefix () const { return "/Volumes/veracrypt"; } diff --git a/src/Core/Unix/MacOSX/System.h b/src/Core/Unix/MacOSX/System.h index 04d08a57..5931628b 100644 --- a/src/Core/Unix/MacOSX/System.h +++ b/src/Core/Unix/MacOSX/System.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/Unix/MountedFilesystem.h b/src/Core/Unix/MountedFilesystem.h index 741c49d6..f47fc946 100644 --- a/src/Core/Unix/MountedFilesystem.h +++ b/src/Core/Unix/MountedFilesystem.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/Unix/Solaris/CoreSolaris.cpp b/src/Core/Unix/Solaris/CoreSolaris.cpp index 9101e4f8..1e99d98f 100644 --- a/src/Core/Unix/Solaris/CoreSolaris.cpp +++ b/src/Core/Unix/Solaris/CoreSolaris.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -80,7 +80,7 @@ namespace VeraCrypt { device->Size = 0; } - + if (device->Size == 0) continue; @@ -99,8 +99,8 @@ namespace VeraCrypt make_shared_auto (HostDevice, partition); partition->Path = partPath.str(); - try - { + try + { partition->Size = GetDeviceSize (partition->Path); } catch (...) diff --git a/src/Core/Unix/Solaris/CoreSolaris.h b/src/Core/Unix/Solaris/CoreSolaris.h index 26543220..2e9dbc1c 100644 --- a/src/Core/Unix/Solaris/CoreSolaris.h +++ b/src/Core/Unix/Solaris/CoreSolaris.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -24,7 +24,7 @@ namespace VeraCrypt CoreSolaris (); virtual ~CoreSolaris (); - virtual HostDeviceList GetHostDevices (bool pathListOnly = false) const; + virtual HostDeviceList GetHostDevices (bool pathListOnly = false) const; protected: virtual DevicePath AttachFileToLoopDevice (const FilePath &filePath, bool readOnly) const; diff --git a/src/Core/Unix/Solaris/System.h b/src/Core/Unix/Solaris/System.h index 5bff4c5e..e8b05dac 100644 --- a/src/Core/Unix/Solaris/System.h +++ b/src/Core/Unix/Solaris/System.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/Unix/System.h b/src/Core/Unix/System.h index e322d331..30384907 100644 --- a/src/Core/Unix/System.h +++ b/src/Core/Unix/System.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Core/VolumeCreator.cpp b/src/Core/VolumeCreator.cpp index a920eba1..94aba4bc 100644 --- a/src/Core/VolumeCreator.cpp +++ b/src/Core/VolumeCreator.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -33,7 +33,7 @@ namespace VeraCrypt VolumeCreator::~VolumeCreator () { } - + void VolumeCreator::Abort () { AbortRequested = true; diff --git a/src/Core/VolumeCreator.h b/src/Core/VolumeCreator.h index 2c9fff3a..55f51e50 100644 --- a/src/Core/VolumeCreator.h +++ b/src/Core/VolumeCreator.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -19,7 +19,7 @@ namespace VeraCrypt { - + struct VolumeCreationOptions { VolumePath Path; diff --git a/src/Crypto/AesSmall_x86.asm b/src/Crypto/AesSmall_x86.asm index de32fc66..20008194 100644 --- a/src/Crypto/AesSmall_x86.asm +++ b/src/Crypto/AesSmall_x86.asm @@ -1,23 +1,23 @@ ; --------------------------------------------------------------------------- ; Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. -; +; ; LICENSE TERMS -; +; ; The free distribution and use of this software is allowed (with or without ; changes) provided that: -; +; ; 1. source code distributions include the above copyright notice, this ; list of conditions and the following disclaimer; -; +; ; 2. binary distributions include the above copyright notice, this list ; of conditions and the following disclaimer in their documentation; -; +; ; 3. the name of the copyright holder is not used to endorse products ; built using this software without specific written permission. -; +; ; DISCLAIMER -; +; ; This software is provided 'as is' with no explicit or implied warranties ; in respect of its properties, including, but not limited to, correctness ; and/or fitness for purpose. @@ -367,7 +367,7 @@ extern _aes_enc_tab ; Apply S-Box to the 4 bytes in a 32-bit word and rotate byte positions %ifdef REDUCE_CODE_SIZE - + l3s_col: movzx ecx,al ; in eax movzx ecx, etab_b(ecx) ; out eax @@ -413,7 +413,7 @@ l3s_col: %endmacro %endif - + ; offsets to parameters in_blk equ 2 ; input byte array address parameter @@ -444,7 +444,7 @@ enc_round: xor ebx,[ebp+4] add sp, 2 ret - + %else %macro enc_round 0 @@ -724,7 +724,7 @@ enc_round: mov ax, sp movzx esp, ax - + push ebp push ebx push esi @@ -1000,7 +1000,7 @@ dec_round: ; AES Decryption Subroutine do_name _aes_decrypt,12 - + mov ax, sp movzx esp, ax @@ -1095,7 +1095,7 @@ inv_mix_col: %else -%macro inv_mix_col 0 +%macro inv_mix_col 0 movzx ecx,dl ; input eax, edx movzx ecx,etab_b(ecx) ; output eax @@ -1243,14 +1243,14 @@ inv_mix_col: %endif do_name _aes_decrypt_key256,8 - + mov ax, sp movzx esp, ax push ebp push ebx push esi push edi - + movzx eax, word [esp+20] ; ks movzx edx, word [esp+18] ; key push ax diff --git a/src/Crypto/Aes_hw_cpu.asm b/src/Crypto/Aes_hw_cpu.asm index 53852665..faaba4f3 100644 --- a/src/Crypto/Aes_hw_cpu.asm +++ b/src/Crypto/Aes_hw_cpu.asm @@ -254,7 +254,7 @@ cmp ax, 0 jl .decrypt - + aesenc xmm1, xmm0 jmp .2 .decrypt: @@ -264,7 +264,7 @@ add si, ax movdqu xmm0, [si] - + cmp ax, 0 jl .decrypt_last diff --git a/src/Crypto/Aes_hw_cpu.h b/src/Crypto/Aes_hw_cpu.h index e2fed1a1..1265ac47 100644 --- a/src/Crypto/Aes_hw_cpu.h +++ b/src/Crypto/Aes_hw_cpu.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Crypto/Aes_x64.asm b/src/Crypto/Aes_x64.asm index 06d57ac2..f74d0328 100644 --- a/src/Crypto/Aes_x64.asm +++ b/src/Crypto/Aes_x64.asm @@ -1,23 +1,23 @@ ; --------------------------------------------------------------------------- ; Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. -; +; ; LICENSE TERMS -; +; ; The free distribution and use of this software is allowed (with or without ; changes) provided that: -; +; ; 1. source code distributions include the above copyright notice, this ; list of conditions and the following disclaimer; -; +; ; 2. binary distributions include the above copyright notice, this list ; of conditions and the following disclaimer in their documentation; -; +; ; 3. the name of the copyright holder is not used to endorse products ; built using this software without specific written permission. -; +; ; DISCLAIMER -; +; ; This software is provided 'as is' with no explicit or implied warranties ; in respect of its properties, including, but not limited to, correctness ; and/or fitness for purpose. diff --git a/src/Crypto/Aes_x86.asm b/src/Crypto/Aes_x86.asm index 3825deee..484e31a7 100644 --- a/src/Crypto/Aes_x86.asm +++ b/src/Crypto/Aes_x86.asm @@ -1,23 +1,23 @@ ; --------------------------------------------------------------------------- ; Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. -; +; ; LICENSE TERMS -; +; ; The free distribution and use of this software is allowed (with or without ; changes) provided that: -; +; ; 1. source code distributions include the above copyright notice, this ; list of conditions and the following disclaimer; -; +; ; 2. binary distributions include the above copyright notice, this list ; of conditions and the following disclaimer in their documentation; -; +; ; 3. the name of the copyright holder is not used to endorse products ; built using this software without specific written permission. -; +; ; DISCLAIMER -; +; ; This software is provided 'as is' with no explicit or implied warranties ; in respect of its properties, including, but not limited to, correctness ; and/or fitness for purpose. diff --git a/src/Crypto/Aestab.c b/src/Crypto/Aestab.c index 1effb6f6..afa633ec 100644 --- a/src/Crypto/Aestab.c +++ b/src/Crypto/Aestab.c @@ -280,7 +280,7 @@ AES_RETURN aes_init(void) return EXIT_SUCCESS; for (i = 0; i < 256; ++i) - { + { uint_8t x = fwd_affine(fi((uint_8t)i)); aes_enc_tab[i][0] = 0; aes_enc_tab[i][1] = x; diff --git a/src/Crypto/Rmd160.c b/src/Crypto/Rmd160.c index 75a34c3e..9387f9ba 100644 --- a/src/Crypto/Rmd160.c +++ b/src/Crypto/Rmd160.c @@ -15,7 +15,7 @@ #include "Common/Endian.h" #include "Rmd160.h" -#define F(x, y, z) (x ^ y ^ z) +#define F(x, y, z) (x ^ y ^ z) #define G(x, y, z) (z ^ (x & (y^z))) #define H(x, y, z) (z ^ (x | ~y)) #define I(x, y, z) (y ^ (z & (x^y))) @@ -300,7 +300,7 @@ void RMD160Transform (unsigned __int32 *digest, const unsigned __int32 *data) Subround(J, b2, c2, d2, e2, a2, X[ 3], 12, k5); Subround(J, a2, b2, c2, d2, e2, X[12], 6, k5); - Subround(I, e2, a2, b2, c2, d2, X[ 6], 9, k6); + Subround(I, e2, a2, b2, c2, d2, X[ 6], 9, k6); Subround(I, d2, e2, a2, b2, c2, X[11], 13, k6); Subround(I, c2, d2, e2, a2, b2, X[ 3], 15, k6); Subround(I, b2, c2, d2, e2, a2, X[ 7], 7, k6); @@ -383,7 +383,7 @@ void RMD160Transform (unsigned __int32 *digest, const unsigned __int32 *data) Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -454,7 +454,7 @@ void RMD160Transform (unsigned __int32 *state, const unsigned __int32 *data) for (pos = 0; pos < 160; ++pos) { tmp = a + data[OrderTab[pos]] + KTab[pos >> 4]; - + switch (pos >> 4) { case 0: case 9: tmp += F (b, c, d); break; diff --git a/src/Crypto/Serpent.c b/src/Crypto/Serpent.c index a8c528de..2db76deb 100644 --- a/src/Crypto/Serpent.c +++ b/src/Crypto/Serpent.c @@ -64,7 +64,7 @@ #define afterI1(f) f(1,a,b,c,e,d) #define afterI0(f) f(0,a,d,b,e,c) -// The instruction sequences for the S-box functions +// The instruction sequences for the S-box functions // come from Dag Arne Osvik's paper "Speeding up Serpent". #define S0(i, r0, r1, r2, r3, r4) \ @@ -462,9 +462,9 @@ static void S0f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r } static void S1f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4) -{ - *r0 = ~*r0; - *r2 = ~*r2; +{ + *r0 = ~*r0; + *r2 = ~*r2; *r4 = *r0; *r0 &= *r1; *r2 ^= *r0; @@ -484,7 +484,7 @@ static void S1f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r } static void S2f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4) -{ +{ *r4 = *r0; *r0 &= *r2; *r0 ^= *r3; @@ -500,11 +500,11 @@ static void S2f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r *r4 ^= *r0; *r1 ^= *r3; *r1 ^= *r4; - *r4 = ~*r4; + *r4 = ~*r4; } static void S3f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4) -{ +{ *r4 = *r0; *r0 |= *r3; *r3 ^= *r1; @@ -527,9 +527,9 @@ static void S3f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r } static void S4f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4) -{ +{ *r1 ^= *r3; - *r3 = ~*r3; + *r3 = ~*r3; *r2 ^= *r3; *r3 ^= *r0; *r4 = *r1; @@ -546,15 +546,15 @@ static void S4f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r *r0 |= *r3; *r0 ^= *r2; *r2 &= *r3; - *r0 = ~*r0; + *r0 = ~*r0; *r4 ^= *r2; } static void S5f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4) -{ +{ *r0 ^= *r1; *r1 ^= *r3; - *r3 = ~*r3; + *r3 = ~*r3; *r4 = *r1; *r1 &= *r0; *r2 ^= *r3; @@ -567,15 +567,15 @@ static void S5f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r *r4 ^= *r2; *r2 ^= *r0; *r0 &= *r3; - *r2 = ~*r2; + *r2 = ~*r2; *r0 ^= *r4; *r4 |= *r3; *r2 ^= *r4; } static void S6f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4) -{ - *r2 = ~*r2; +{ + *r2 = ~*r2; *r4 = *r3; *r3 &= *r0; *r0 ^= *r4; @@ -590,13 +590,13 @@ static void S6f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r *r0 ^= *r2; *r4 ^= *r3; *r4 ^= *r0; - *r3 = ~*r3; + *r3 = ~*r3; *r2 &= *r4; *r2 ^= *r3; } static void S7f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r2, unsigned __int32 *r3, unsigned __int32 *r4) -{ +{ *r4 = *r2; *r2 &= *r1; *r2 ^= *r3; @@ -612,7 +612,7 @@ static void S7f (unsigned __int32 *r0, unsigned __int32 *r1, unsigned __int32 *r *r3 ^= *r4; *r4 ^= *r2; *r2 &= *r0; - *r4 = ~*r4; + *r4 = ~*r4; *r2 ^= *r4; *r4 &= *r0; *r1 ^= *r3; @@ -767,7 +767,7 @@ void serpent_encrypt(const unsigned __int8 *inBlock, unsigned __int8 *outBlock, while (1); afterS7(KX); - + out[0] = LE32(d); out[1] = LE32(e); out[2] = LE32(b); @@ -827,7 +827,7 @@ void serpent_encrypt(const unsigned __int8 *inBlock, unsigned __int8 *outBlock, while (1); KXf (k, 32, &d, &e, &b, &a); - + out[0] = LE32(d); out[1] = LE32(e); out[2] = LE32(b); @@ -862,17 +862,17 @@ void serpent_decrypt(const unsigned __int8 *inBlock, unsigned __int8 *outBlock, k -= 32; beforeI7(ILT); start: - beforeI7(I7); afterI7(KX); - afterI7(ILT); afterI7(I6); afterI6(KX); - afterI6(ILT); afterI6(I5); afterI5(KX); - afterI5(ILT); afterI5(I4); afterI4(KX); - afterI4(ILT); afterI4(I3); afterI3(KX); - afterI3(ILT); afterI3(I2); afterI2(KX); - afterI2(ILT); afterI2(I1); afterI1(KX); + beforeI7(I7); afterI7(KX); + afterI7(ILT); afterI7(I6); afterI6(KX); + afterI6(ILT); afterI6(I5); afterI5(KX); + afterI5(ILT); afterI5(I4); afterI4(KX); + afterI4(ILT); afterI4(I3); afterI3(KX); + afterI3(ILT); afterI3(I2); afterI2(KX); + afterI2(ILT); afterI2(I1); afterI1(KX); afterI1(ILT); afterI1(I0); afterI0(KX); } while (--i != 0); - + out[0] = LE32(a); out[1] = LE32(d); out[2] = LE32(b); @@ -882,7 +882,7 @@ start: #else // TC_MINIMIZE_CODE_SIZE static void ILTf (uint32 *a, uint32 *b, uint32 *c, uint32 *d) -{ +{ *c = rotrFixed(*c, 22); *a = rotrFixed(*a, 5); *c ^= *d ^ (*b << 7); @@ -919,16 +919,16 @@ void serpent_decrypt(const unsigned __int8 *inBlock, unsigned __int8 *outBlock, beforeI7(ILT); start: beforeI7(I7); KXf (k, 28, &d, &a, &b, &e); - ILTf (&d, &a, &b, &e); afterI7(I6); KXf (k, 24, &a, &b, &c, &e); - ILTf (&a, &b, &c, &e); afterI6(I5); KXf (k, 20, &b, &d, &e, &c); - ILTf (&b, &d, &e, &c); afterI5(I4); KXf (k, 16, &b, &c, &e, &a); + ILTf (&d, &a, &b, &e); afterI7(I6); KXf (k, 24, &a, &b, &c, &e); + ILTf (&a, &b, &c, &e); afterI6(I5); KXf (k, 20, &b, &d, &e, &c); + ILTf (&b, &d, &e, &c); afterI5(I4); KXf (k, 16, &b, &c, &e, &a); ILTf (&b, &c, &e, &a); afterI4(I3); KXf (k, 12, &a, &b, &e, &c); ILTf (&a, &b, &e, &c); afterI3(I2); KXf (k, 8, &b, &d, &e, &c); ILTf (&b, &d, &e, &c); afterI2(I1); KXf (k, 4, &a, &b, &c, &e); ILTf (&a, &b, &c, &e); afterI1(I0); KXf (k, 0, &a, &d, &b, &e); } while (--i != 0); - + out[0] = LE32(a); out[1] = LE32(d); out[2] = LE32(b); diff --git a/src/Crypto/Sha2Small.c b/src/Crypto/Sha2Small.c index 539ff05d..08318833 100644 --- a/src/Crypto/Sha2Small.c +++ b/src/Crypto/Sha2Small.c @@ -52,7 +52,7 @@ static const uint32 K[64] = { Various logical functions */ #define Ch(x,y,z) (z ^ (x & (y ^ z))) -#define Maj(x,y,z) (((x | y) & z) | (x & y)) +#define Maj(x,y,z) (((x | y) & z) | (x & y)) #define S(x, n) RORc((x),(n)) #define R(x, n) ((x)>>(n)) #define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) @@ -119,7 +119,7 @@ static void sha256_compress(sha256_ctx * ctx, unsigned char *buf) for (i = 0; i < 64; ++i) { RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],i); - t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4]; + t = S[7]; S[7] = S[6]; S[6] = S[5]; S[5] = S[4]; S[4] = S[3]; S[3] = S[2]; S[2] = S[1]; S[1] = S[0]; S[0] = t; } @@ -154,7 +154,7 @@ VOID_RETURN sha256_hash(unsigned char* data, unsigned int len, sha256_ctx* ctx) { uint32 n; while (len > 0) { - if (ctx->curlen == 0 && len >= 64) { + if (ctx->curlen == 0 && len >= 64) { sha256_compress(ctx, (unsigned char *)data); n = ctx->lowLength + 512; @@ -178,7 +178,7 @@ VOID_RETURN sha256_hash(unsigned char* data, unsigned int len, sha256_ctx* ctx) if (n < ctx->lowLength) { ctx->highLength++; } - ctx->lowLength = n; + ctx->lowLength = n; ctx->curlen = 0; } } @@ -232,7 +232,7 @@ VOID_RETURN sha256_end(unsigned char* hval, sha256_ctx* ctx) STORE32H(ctx->highLength, ctx->buf, 56); STORE32H(ctx->lowLength, ctx->buf, 60); - + sha256_compress(ctx, ctx->buf); /* diff --git a/src/Crypto/Twofish.c b/src/Crypto/Twofish.c index 7c58c91e..09f6edaf 100644 --- a/src/Crypto/Twofish.c +++ b/src/Crypto/Twofish.c @@ -63,26 +63,26 @@ static u1byte tab_ef[4] = { 0, (G_M >> 1) ^ (G_M >> 2), G_M >> 1, G_M >> 2 }; static u1byte ror4[16] = { 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 }; static u1byte ashx[16] = { 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 5, 14, 7 }; -static u1byte qt0[2][16] = +static u1byte qt0[2][16] = { { 8, 1, 7, 13, 6, 15, 3, 2, 0, 11, 5, 9, 14, 12, 10, 4 }, { 2, 8, 11, 13, 15, 7, 6, 14, 3, 1, 9, 4, 0, 10, 12, 5 } }; static u1byte qt1[2][16] = -{ { 14, 12, 11, 8, 1, 2, 3, 5, 15, 4, 10, 6, 7, 0, 9, 13 }, +{ { 14, 12, 11, 8, 1, 2, 3, 5, 15, 4, 10, 6, 7, 0, 9, 13 }, { 1, 14, 2, 11, 4, 12, 3, 7, 6, 13, 10, 5, 15, 9, 0, 8 } }; -static u1byte qt2[2][16] = +static u1byte qt2[2][16] = { { 11, 10, 5, 14, 6, 13, 9, 0, 12, 8, 15, 3, 2, 4, 7, 1 }, { 4, 12, 7, 5, 1, 6, 9, 10, 0, 14, 13, 8, 2, 11, 3, 15 } }; -static u1byte qt3[2][16] = +static u1byte qt3[2][16] = { { 13, 7, 15, 4, 1, 2, 6, 14, 9, 11, 3, 0, 8, 5, 12, 10 }, { 11, 9, 5, 1, 12, 3, 13, 14, 6, 4, 7, 15, 2, 0, 8, 10 } }; - + static u1byte qp(const u4byte n, const u1byte x) { u1byte a0, a1, a2, a3, a4, b0, b1, b2, b3, b4; @@ -105,7 +105,7 @@ static void gen_qtab(void) { u4byte i; for(i = 0; i < 256; ++i) - { + { q(0,i) = qp(0, (u1byte)i); q(1,i) = qp(1, (u1byte)i); } @@ -124,7 +124,7 @@ static u4byte m_tab[4][256]; static void gen_mtab(void) { u4byte i, f01, f5b, fef; - + for(i = 0; i < 256; ++i) { f01 = q(1,i); f5b = ffm_5b(f01); fef = ffm_ef(f01); @@ -254,12 +254,12 @@ static void gen_mk_tab(TwofishInstance *instance, u4byte key[]) mk_tab[0 + 4*i] = mds(0, q20(by)); mk_tab[1 + 4*i] = mds(1, q21(by)); mk_tab[2 + 4*i] = mds(2, q22(by)); mk_tab[3 + 4*i] = mds(3, q23(by)); #else - sb[0][i] = q20(by); sb[1][i] = q21(by); + sb[0][i] = q20(by); sb[1][i] = q21(by); sb[2][i] = q22(by); sb[3][i] = q23(by); #endif } break; - + case 3: for(i = 0; i < 256; ++i) { by = (u1byte)i; @@ -267,12 +267,12 @@ static void gen_mk_tab(TwofishInstance *instance, u4byte key[]) mk_tab[0 + 4*i] = mds(0, q30(by)); mk_tab[1 + 4*i] = mds(1, q31(by)); mk_tab[2 + 4*i] = mds(2, q32(by)); mk_tab[3 + 4*i] = mds(3, q33(by)); #else - sb[0][i] = q30(by); sb[1][i] = q31(by); + sb[0][i] = q30(by); sb[1][i] = q31(by); sb[2][i] = q32(by); sb[3][i] = q33(by); #endif } break; - + case 4: for(i = 0; i < 256; ++i) { by = (u1byte)i; @@ -280,7 +280,7 @@ static void gen_mk_tab(TwofishInstance *instance, u4byte key[]) mk_tab[0 + 4*i] = mds(0, q40(by)); mk_tab[1 + 4*i] = mds(1, q41(by)); mk_tab[2 + 4*i] = mds(2, q42(by)); mk_tab[3 + 4*i] = mds(3, q43(by)); #else - sb[0][i] = q40(by); sb[1][i] = q41(by); + sb[0][i] = q40(by); sb[1][i] = q41(by); sb[2][i] = q42(by); sb[3][i] = q43(by); #endif } @@ -315,22 +315,22 @@ static void gen_mk_tab(TwofishInstance *instance, u4byte key[]) where the coefficients are in the finite field GF(2^8) with a modular polynomial a^8 + a^6 + a^3 + a^2 + 1. To generate the remainder we have to start with a 12th order polynomial with our -eight input bytes as the coefficients of the 4th to 11th terms. +eight input bytes as the coefficients of the 4th to 11th terms. That is: m[7] * x^11 + m[6] * x^10 ... + m[0] * x^4 + 0 * x^3 +... + 0 - + We then multiply the generator polynomial by m[7] * x^7 and subtract -it - xor in GF(2^8) - from the above to eliminate the x^7 term (the -artihmetic on the coefficients is done in GF(2^8). We then multiply +it - xor in GF(2^8) - from the above to eliminate the x^7 term (the +artihmetic on the coefficients is done in GF(2^8). We then multiply the generator polynomial by x^6 * coeff(x^10) and use this to remove the x^10 term. We carry on in this way until the x^4 term is removed so that we are left with: r[3] * x^3 + r[2] * x^2 + r[1] 8 x^1 + r[0] -which give the resulting 4 bytes of the remainder. This is equivalent -to the matrix multiplication in the Twofish description but much faster +which give the resulting 4 bytes of the remainder. This is equivalent +to the matrix multiplication in the Twofish description but much faster to implement. */ @@ -343,23 +343,23 @@ static u4byte mds_rem(u4byte p0, u4byte p1) for(i = 0; i < 8; ++i) { t = p1 >> 24; // get most significant coefficient - + p1 = (p1 << 8) | (p0 >> 24); p0 <<= 8; // shift others up - + // multiply t by a (the primitive element - i.e. left shift) - u = (t << 1); - + u = (t << 1); + if(t & 0x80) // subtract modular polynomial on overflow - - u ^= G_MOD; - p1 ^= t ^ (u << 16); // remove t * (a * x^2 + 1) + u ^= G_MOD; + + p1 ^= t ^ (u << 16); // remove t * (a * x^2 + 1) + + u ^= (t >> 1); // form u = a * t + t / a = t * (a + 1 / a); - u ^= (t >> 1); // form u = a * t + t / a = t * (a + 1 / a); - if(t & 0x01) // add the modular polynomial on underflow - + u ^= G_MOD >> 1; p1 ^= (u << 24) | (u << 8); // remove t * (a + 1/a) * (x^3 + x) @@ -445,7 +445,7 @@ void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte o out_blk[0] = LE32(blk[2] ^ l_key[4]); out_blk[1] = LE32(blk[3] ^ l_key[5]); out_blk[2] = LE32(blk[0] ^ l_key[6]); - out_blk[3] = LE32(blk[1] ^ l_key[7]); + out_blk[3] = LE32(blk[1] ^ l_key[7]); }; #else // TC_MINIMIZE_CODE_SIZE @@ -477,7 +477,7 @@ void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte o out_blk[0] = LE32(blk[2] ^ l_key[4]); out_blk[1] = LE32(blk[3] ^ l_key[5]); out_blk[2] = LE32(blk[0] ^ l_key[6]); - out_blk[3] = LE32(blk[1] ^ l_key[7]); + out_blk[3] = LE32(blk[1] ^ l_key[7]); }; #endif // TC_MINIMIZE_CODE_SIZE @@ -511,7 +511,7 @@ void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte o out_blk[0] = LE32(blk[2] ^ l_key[0]); out_blk[1] = LE32(blk[3] ^ l_key[1]); out_blk[2] = LE32(blk[0] ^ l_key[2]); - out_blk[3] = LE32(blk[1] ^ l_key[3]); + out_blk[3] = LE32(blk[1] ^ l_key[3]); }; #else // TC_MINIMIZE_CODE_SIZE @@ -543,7 +543,7 @@ void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte o out_blk[0] = LE32(blk[2] ^ l_key[0]); out_blk[1] = LE32(blk[3] ^ l_key[1]); out_blk[2] = LE32(blk[0] ^ l_key[2]); - out_blk[3] = LE32(blk[1] ^ l_key[3]); + out_blk[3] = LE32(blk[1] ^ l_key[3]); }; #endif // TC_MINIMIZE_CODE_SIZE diff --git a/src/Crypto/Whirlpool.c b/src/Crypto/Whirlpool.c index c0e5b884..ee109d81 100644 --- a/src/Crypto/Whirlpool.c +++ b/src/Crypto/Whirlpool.c @@ -26,7 +26,7 @@ * ``The Whirlpool hashing function,'' * NESSIE submission, 2000 (tweaked version, 2001), * <https://www.cosic.esat.kuleuven.ac.be/nessie/workshop/submissions/whirlpool.zip> - * + * * @author Paulo S.L.M. Barreto * @author Vincent Rijmen. * @@ -397,7 +397,7 @@ void WhirlpoolTransform(uint64 *digest, const uint64 *block) AS2( and esp, -16) AS2( sub esp, 16*8) AS_PUSH_IF86( ax) - + #if CRYPTOPP_BOOL_X86 #define SSE2_workspace esp+WORD_SZ #elif CRYPTOPP_BOOL_X32 @@ -722,7 +722,7 @@ void WHIRLPOOL_init(WHIRLPOOL_CTX * const ctx) { */ void WHIRLPOOL_add(const unsigned char * input, unsigned __int32 sourceBits, - WHIRLPOOL_CTX * const ctx) + WHIRLPOOL_CTX * const ctx) { uint64 num, oldCountLo = ctx->countLo, oldCountHi = ctx->countHi; uint64 len = sourceBits >> 3; @@ -734,7 +734,7 @@ void WHIRLPOOL_add(const unsigned char * input, else { uint64* dataBuf = ctx->data; - byte* data = (byte *)dataBuf; + byte* data = (byte *)dataBuf; num = oldCountLo & 63; if (num != 0) // process left over data @@ -786,11 +786,11 @@ void WHIRLPOOL_add(const unsigned char * input, /** * Get the hash value from the hashing state. - * + * * This method uses the invariant: bufferBits < DIGESTBITS */ void WHIRLPOOL_finalize(WHIRLPOOL_CTX * const ctx, - unsigned char * result) + unsigned char * result) { unsigned int num = ctx->countLo & 63; uint64* dataBuf = ctx->data; diff --git a/src/Crypto/cpu.c b/src/Crypto/cpu.c index 4274a8ae..3de87069 100644 --- a/src/Crypto/cpu.c +++ b/src/Crypto/cpu.c @@ -76,7 +76,7 @@ int CpuId(uint32 input, uint32 output[4]) { return 0; } - + // function 0 returns the highest basic function understood in EAX if(input == 0) return !!output[0]? 1 : 0; diff --git a/src/Crypto/cpu.h b/src/Crypto/cpu.h index 7ef509ec..44da8cc3 100644 --- a/src/Crypto/cpu.h +++ b/src/Crypto/cpu.h @@ -36,7 +36,7 @@ extern __m128i _mm_insert_epi32(__m128i dst, int s, const int ndx); #if (defined(__AES__) && defined(__PCLMUL__)) || defined(__INTEL_COMPILER) #ifdef TC_WINDOWS_DRIVER -extern __m128i _mm_clmulepi64_si128(__m128i v1, __m128i v2, +extern __m128i _mm_clmulepi64_si128(__m128i v1, __m128i v2, const int imm8); extern __m128i _mm_aeskeygenassist_si128(__m128i ckey, const int rcon); extern __m128i _mm_aesimc_si128(__m128i v); diff --git a/src/Driver/BuildDriver.cmd b/src/Driver/BuildDriver.cmd index bfeee2db..42f715dc 100644 --- a/src/Driver/BuildDriver.cmd +++ b/src/Driver/BuildDriver.cmd @@ -3,7 +3,7 @@ :: Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed :: 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 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 @@ -128,7 +128,7 @@ pushd . set BUILD_ALT_DIR=%TC_BUILD_ALT_DIR% build %TC_BUILD_OPTS% -w -nmake /S -nmake /C 2>build_errors.log 1>&2 - + if errorlevel 1 ( type build_errors.log type build_errors_asm.log 2>NUL: @@ -138,7 +138,7 @@ pushd . ) shift - + goto build_dirs :done popd diff --git a/src/Driver/DriveFilter.c b/src/Driver/DriveFilter.c index c090ee8c..49563592 100644 --- a/src/Driver/DriveFilter.c +++ b/src/Driver/DriveFilter.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -167,7 +167,7 @@ NTSTATUS DriveFilterAddDevice (PDRIVER_OBJECT driverObject, PDEVICE_OBJECT pdo) Extension = (DriveFilterExtension *) filterDeviceObject->DeviceExtension; memset (Extension, 0, sizeof (DriveFilterExtension)); - status = IoAttachDeviceToDeviceStackSafe (filterDeviceObject, pdo, &(Extension->LowerDeviceObject)); + status = IoAttachDeviceToDeviceStackSafe (filterDeviceObject, pdo, &(Extension->LowerDeviceObject)); if (!NT_SUCCESS (status)) { goto err; @@ -182,7 +182,7 @@ NTSTATUS DriveFilterAddDevice (PDRIVER_OBJECT driverObject, PDEVICE_OBJECT pdo) Extension->IsDriveFilterDevice = Extension->Queue.IsFilterDevice = TRUE; Extension->DeviceObject = Extension->Queue.DeviceObject = filterDeviceObject; Extension->Pdo = pdo; - + Extension->Queue.LowerDeviceObject = Extension->LowerDeviceObject; IoInitializeRemoveLock (&Extension->Queue.RemoveLock, 'LRCV', 0, 0); @@ -215,7 +215,7 @@ static void DismountDrive (DriveFilterExtension *Extension, BOOL stopIoQueue) { Dump ("Dismounting drive\n"); ASSERT (Extension->DriveMounted); - + if (stopIoQueue && EncryptedIoQueueIsRunning (&Extension->Queue)) EncryptedIoQueueStop (&Extension->Queue); @@ -249,7 +249,7 @@ static void ComputeBootLoaderFingerprint(PDEVICE_OBJECT LowerDeviceObject, byte* // TC_BOOT_SECTOR_USER_CONFIG_OFFSET = 438 // // we have: TC_BOOT_SECTOR_USER_MESSAGE_OFFSET = TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET + TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE - + WHIRLPOOL_init (&whirlpool); sha512_begin (&sha2); // read the first 512 bytes @@ -362,8 +362,8 @@ static NTSTATUS MountDrive (DriveFilterExtension *Extension, Password *password, if (BootArgs.CryptoInfoLength > 0) { - PHYSICAL_ADDRESS cryptoInfoAddress; - + PHYSICAL_ADDRESS cryptoInfoAddress; + cryptoInfoAddress.QuadPart = (BootLoaderSegment << 4) + BootArgs.CryptoInfoOffset; #ifdef DEBUG Dump ("Wiping memory %x %d\n", cryptoInfoAddress.LowPart, BootArgs.CryptoInfoLength); @@ -389,20 +389,20 @@ static NTSTATUS MountDrive (DriveFilterExtension *Extension, Password *password, // calculate Fingerprint ComputeBootLoaderFingerprint (Extension->LowerDeviceObject, header); - + if (Extension->Queue.CryptoInfo->hiddenVolume) { int64 hiddenPartitionOffset = BootArgs.HiddenSystemPartitionStart; Dump ("Hidden volume start offset = %I64d\n", Extension->Queue.CryptoInfo->EncryptedAreaStart.Value + hiddenPartitionOffset); - + Extension->HiddenSystem = TRUE; Extension->Queue.RemapEncryptedArea = TRUE; Extension->Queue.RemappedAreaOffset = hiddenPartitionOffset + Extension->Queue.CryptoInfo->EncryptedAreaStart.Value - BootArgs.DecoySystemPartitionStart; Extension->Queue.RemappedAreaDataUnitOffset = Extension->Queue.CryptoInfo->EncryptedAreaStart.Value / ENCRYPTION_DATA_UNIT_SIZE - BootArgs.DecoySystemPartitionStart / ENCRYPTION_DATA_UNIT_SIZE; - + Extension->Queue.CryptoInfo->EncryptedAreaStart.Value = BootArgs.DecoySystemPartitionStart; - + if (Extension->Queue.CryptoInfo->VolumeSize.Value > hiddenPartitionOffset - BootArgs.DecoySystemPartitionStart) TC_THROW_FATAL_EXCEPTION; @@ -461,7 +461,7 @@ static NTSTATUS MountDrive (DriveFilterExtension *Extension, Password *password, } status = SendDeviceIoControlRequest (Extension->LowerDeviceObject, IOCTL_DISK_GET_LENGTH_INFO, NULL, 0, &BootDriveLength, sizeof (BootDriveLength)); - + if (!NT_SUCCESS (status)) { Dump ("Failed to get drive length - error %x\n", status); @@ -470,7 +470,7 @@ static NTSTATUS MountDrive (DriveFilterExtension *Extension, Password *password, } else Extension->Queue.MaxReadAheadOffset = BootDriveLength; - + status = EncryptedIoQueueStart (&Extension->Queue); if (!NT_SUCCESS (status)) TC_BUG_CHECK (status); @@ -526,7 +526,7 @@ static NTSTATUS SaveDriveVolumeHeader (DriveFilterExtension *Extension) Dump ("Saving: ConfiguredEncryptedAreaStart=%I64d (%I64d) ConfiguredEncryptedAreaEnd=%I64d (%I64d)\n", Extension->ConfiguredEncryptedAreaStart / 1024 / 1024, Extension->ConfiguredEncryptedAreaStart, Extension->ConfiguredEncryptedAreaEnd / 1024 / 1024, Extension->ConfiguredEncryptedAreaEnd); Dump ("Saving: EncryptedAreaStart=%I64d (%I64d) EncryptedAreaEnd=%I64d (%I64d)\n", Extension->Queue.EncryptedAreaStart / 1024 / 1024, Extension->Queue.EncryptedAreaStart, Extension->Queue.EncryptedAreaEnd / 1024 / 1024, Extension->Queue.EncryptedAreaEnd); - + if (Extension->Queue.EncryptedAreaStart == -1 || Extension->Queue.EncryptedAreaEnd == -1 || Extension->Queue.EncryptedAreaEnd <= Extension->Queue.EncryptedAreaStart) { @@ -678,7 +678,7 @@ static NTSTATUS OnStartDeviceCompleted (PDEVICE_OBJECT filterDeviceObject, PIRP } KeInitializeEvent (&Extension->MountWorkItemCompletedEvent, SynchronizationEvent, FALSE); - IoQueueWorkItem (workItem, MountDriveWorkItemRoutine, DelayedWorkQueue, Extension); + IoQueueWorkItem (workItem, MountDriveWorkItemRoutine, DelayedWorkQueue, Extension); KeWaitForSingleObject (&Extension->MountWorkItemCompletedEvent, Executive, KernelMode, FALSE, NULL); IoFreeWorkItem (workItem); @@ -817,7 +817,7 @@ NTSTATUS DriveFilterDispatchIrp (PDEVICE_OBJECT DeviceObject, PIRP Irp) if (Extension->BootDrive) { status = EncryptedIoQueueAddIrp (&Extension->Queue, Irp); - + if (status != STATUS_PENDING) TCCompleteDiskIrp (Irp, status, 0); @@ -895,7 +895,7 @@ void ReopenBootVolumeHeader (PIRP irp, PIO_STACK_LOCATION irpSp) { Dump ("Header reopened\n"); ComputeBootLoaderFingerprint (BootDriveFilterExtension->LowerDeviceObject, header); - + BootDriveFilterExtension->Queue.CryptoInfo->header_creation_time = BootDriveFilterExtension->HeaderCryptoInfo->header_creation_time; BootDriveFilterExtension->Queue.CryptoInfo->pkcs5 = BootDriveFilterExtension->HeaderCryptoInfo->pkcs5; BootDriveFilterExtension->Queue.CryptoInfo->noIterations = BootDriveFilterExtension->HeaderCryptoInfo->noIterations; @@ -1025,7 +1025,7 @@ static NTSTATUS HiberDriverWriteFunctionFilter (int filterNumber, PLARGE_INTEGER if (writeB) return (*OriginalHiberDriverWriteFunctionsB[filterNumber]) (writeOffset, encryptedDataMdl); - + return (*OriginalHiberDriverWriteFunctionsA[filterNumber]) (arg0WriteA, writeOffset, encryptedDataMdl, arg3WriteA); } @@ -1269,11 +1269,11 @@ static VOID SetupThreadProc (PVOID threadArg) byte *wipeBuffer = NULL; byte wipeRandChars[TC_WIPE_RAND_CHAR_COUNT]; byte wipeRandCharsUpdate[TC_WIPE_RAND_CHAR_COUNT]; - + KIRQL irql; NTSTATUS status; - // generate real random values for wipeRandChars and + // generate real random values for wipeRandChars and // wipeRandCharsUpdate instead of relying on uninitialized stack memory LARGE_INTEGER iSeed; KeQuerySystemTime( &iSeed ); @@ -1300,7 +1300,7 @@ static VOID SetupThreadProc (PVOID threadArg) burn (digest, SHA512_DIGESTSIZE); burn (&tctx, sizeof (tctx)); } - + burn (&iSeed, sizeof(iSeed)); SetupResult = STATUS_UNSUCCESSFUL; @@ -1376,7 +1376,7 @@ static VOID SetupThreadProc (PVOID threadArg) } EncryptedIoQueueResumeFromHold (&Extension->Queue); - + Dump ("EncryptedAreaStart=%I64d\n", Extension->Queue.EncryptedAreaStart); Dump ("EncryptedAreaEnd=%I64d\n", Extension->Queue.EncryptedAreaEnd); Dump ("ConfiguredEncryptedAreaStart=%I64d\n", Extension->ConfiguredEncryptedAreaStart); @@ -1485,7 +1485,7 @@ static VOID SetupThreadProc (PVOID threadArg) } EncryptDataUnits (wipeBuffer, &dataUnit, setupBlockSize / ENCRYPTION_DATA_UNIT_SIZE, Extension->Queue.CryptoInfo); - memcpy (wipeRandCharsUpdate, wipeBuffer, sizeof (wipeRandCharsUpdate)); + memcpy (wipeRandCharsUpdate, wipeBuffer, sizeof (wipeRandCharsUpdate)); } status = TCWriteDevice (BootDriveFilterExtension->LowerDeviceObject, wipeBuffer, offset, setupBlockSize); @@ -1500,7 +1500,7 @@ static VOID SetupThreadProc (PVOID threadArg) } } - memcpy (wipeRandChars, wipeRandCharsUpdate, sizeof (wipeRandCharsUpdate)); + memcpy (wipeRandChars, wipeRandCharsUpdate, sizeof (wipeRandCharsUpdate)); } } else @@ -1646,7 +1646,7 @@ NTSTATUS StartBootEncryptionSetup (PDEVICE_OBJECT DeviceObject, PIRP irp, PIO_ST SetupInProgress = TRUE; status = TCStartThread (SetupThreadProc, DeviceObject, &EncryptionSetupThread); - + if (!NT_SUCCESS (status)) SetupInProgress = FALSE; @@ -1742,7 +1742,7 @@ void GetBootEncryptionStatus (PIRP irp, PIO_STACK_LOCATION irpSp) bootEncStatus->HiddenSysLeakProtectionCount = HiddenSysLeakProtectionCount; bootEncStatus->HiddenSystem = Extension->HiddenSystem; - + if (Extension->HiddenSystem) bootEncStatus->HiddenSystemPartitionStart = BootArgs.HiddenSystemPartitionStart; } @@ -1778,7 +1778,7 @@ void GetBootLoaderFingerprint (PIRP irp, PIO_STACK_LOCATION irpSp) irp->IoStatus.Information = 0; if (BootArgsValid && BootDriveFound && BootDriveFilterExtension && BootDriveFilterExtension->DriveMounted && BootDriveFilterExtension->HeaderCryptoInfo) { - BootLoaderFingerprintRequest *bootLoaderFingerprint = (BootLoaderFingerprintRequest *) irp->AssociatedIrp.SystemBuffer; + BootLoaderFingerprintRequest *bootLoaderFingerprint = (BootLoaderFingerprintRequest *) irp->AssociatedIrp.SystemBuffer; /* compute the fingerprint again and check if it is the same as the one retrieved during boot */ char *header = TCalloc (TC_BOOT_ENCRYPTION_VOLUME_HEADER_SIZE); @@ -1808,7 +1808,7 @@ void GetBootLoaderFingerprint (PIRP irp, PIO_STACK_LOCATION irpSp) } else { - irp->IoStatus.Status = STATUS_INVALID_PARAMETER; + irp->IoStatus.Status = STATUS_INVALID_PARAMETER; } } } @@ -1919,7 +1919,7 @@ static VOID DecoySystemWipeThreadProc (PVOID threadArg) DecoySystemWipeResult = STATUS_INSUFFICIENT_RESOURCES; goto ret; } - + wipeRandBuffer = TCalloc (TC_ENCRYPTION_SETUP_IO_BLOCK_SIZE); if (!wipeRandBuffer) { @@ -1944,7 +1944,7 @@ static VOID DecoySystemWipeThreadProc (PVOID threadArg) } memcpy (wipeCryptoInfo->k2, WipeDecoyRequest.WipeKey + EAGetKeySize (ea), EAGetKeySize (ea)); - + if (!EAInitMode (wipeCryptoInfo)) { DecoySystemWipeResult = STATUS_INVALID_PARAMETER; @@ -1957,7 +1957,7 @@ static VOID DecoySystemWipeThreadProc (PVOID threadArg) burn (WipeDecoyRequest.WipeKey, sizeof (WipeDecoyRequest.WipeKey)); offset.QuadPart = Extension->ConfiguredEncryptedAreaStart; - + Dump ("Wiping decoy system: start offset = %I64d\n", offset.QuadPart); while (!DecoySystemWipeThreadAbortRequested) @@ -2061,7 +2061,7 @@ NTSTATUS StartDecoySystemWipe (PDEVICE_OBJECT DeviceObject, PIRP irp, PIO_STACK_ DecoySystemWipeInProgress = TRUE; status = TCStartThread (DecoySystemWipeThreadProc, DeviceObject, &DecoySystemWipeThread); - + if (!NT_SUCCESS (status)) DecoySystemWipeInProgress = FALSE; @@ -2100,7 +2100,7 @@ void GetDecoySystemWipeStatus (PIRP irp, PIO_STACK_LOCATION irpSp) } else wipeStatus->WipedAreaEnd = DecoySystemWipedAreaEnd; - + irp->IoStatus.Information = sizeof (DecoySystemWipeStatus); irp->IoStatus.Status = STATUS_SUCCESS; } diff --git a/src/Driver/DriveFilter.h b/src/Driver/DriveFilter.h index e0c1bdff..fbbfcac0 100644 --- a/src/Driver/DriveFilter.h +++ b/src/Driver/DriveFilter.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Driver/Driver.rc b/src/Driver/Driver.rc index 51030c5c..a3f177a5 100644 --- a/src/Driver/Driver.rc +++ b/src/Driver/Driver.rc @@ -65,18 +65,18 @@ END // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\r\n" "\0" diff --git a/src/Driver/DumpFilter.c b/src/Driver/DumpFilter.c index d67b1654..ce3365d5 100644 --- a/src/Driver/DumpFilter.c +++ b/src/Driver/DumpFilter.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Driver/DumpFilter.h b/src/Driver/DumpFilter.h index ea6599a5..7582e939 100644 --- a/src/Driver/DumpFilter.h +++ b/src/Driver/DumpFilter.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Driver/EncryptedIoQueue.c b/src/Driver/EncryptedIoQueue.c index 637f8504..029a42f5 100644 --- a/src/Driver/EncryptedIoQueue.c +++ b/src/Driver/EncryptedIoQueue.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -112,7 +112,7 @@ static void ReleasePoolBuffer (EncryptedIoQueue *queue, void *address) { EncryptedIoQueueBuffer *buffer; AcquireBufferPoolMutex (queue); - + for (buffer = queue->FirstPoolBuffer; buffer != NULL; buffer = buffer->NextBuffer) { if (buffer->Address == address) @@ -329,7 +329,7 @@ static VOID IoThreadProc (PVOID threadArg) { InterlockedDecrement (&queue->IoThreadPendingRequestCount); request = CONTAINING_RECORD (listEntry, EncryptedIoRequest, ListEntry); - + #ifdef TC_TRACE_IO_QUEUE Dump ("%c %I64d [%I64d] roff=%I64d rlen=%d\n", request->Item->Write ? 'W' : 'R', request->Item->OriginalIrpOffset.QuadPart, GetElapsedTime (&queue->LastPerformanceCounter), request->Offset.QuadPart, request->Length); #endif @@ -512,7 +512,7 @@ static VOID MainThreadProc (PVOID threadArg) { PIRP irp = CONTAINING_RECORD (listEntry, IRP, Tail.Overlay.ListEntry); PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation (irp); - + if (queue->Suspended) KeWaitForSingleObject (&queue->QueueResumedEvent, Executive, KernelMode, FALSE, NULL); @@ -622,7 +622,7 @@ static VOID MainThreadProc (PVOID threadArg) if (item->OriginalLength == 0 || (item->OriginalLength & (ENCRYPTION_DATA_UNIT_SIZE - 1)) != 0 || (item->OriginalOffset.QuadPart & (ENCRYPTION_DATA_UNIT_SIZE - 1)) != 0 - || ( !queue->IsFilterDevice && + || ( !queue->IsFilterDevice && ( (S_OK != ULongLongAdd(item->OriginalOffset.QuadPart, item->OriginalLength, &addResult)) || (addResult > (ULONGLONG) queue->VirtualDeviceLength) ) @@ -643,7 +643,7 @@ static VOID MainThreadProc (PVOID threadArg) if (queue->CryptoInfo->hiddenVolume) hResult = ULongLongAdd(item->OriginalOffset.QuadPart, queue->CryptoInfo->hiddenVolumeOffset, &addResult); else - hResult = ULongLongAdd(item->OriginalOffset.QuadPart, queue->CryptoInfo->volDataAreaOffset, &addResult); + hResult = ULongLongAdd(item->OriginalOffset.QuadPart, queue->CryptoInfo->volDataAreaOffset, &addResult); if (hResult != S_OK) { @@ -658,7 +658,7 @@ static VOID MainThreadProc (PVOID threadArg) { // If there has already been a write operation denied in order to protect the // hidden volume (since the volume mount time) - if (queue->CryptoInfo->bHiddenVolProtectionAction) + if (queue->CryptoInfo->bHiddenVolProtectionAction) { // Do not allow writing to this volume anymore. This is to fake a complete volume // or system failure (otherwise certain kinds of inconsistency within the file @@ -715,7 +715,7 @@ static VOID MainThreadProc (PVOID threadArg) while (dataRemaining > 0) { BOOL isLastFragment = dataRemaining <= TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE; - + ULONG dataFragmentLength = isLastFragment ? dataRemaining : TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE; activeFragmentBuffer = (activeFragmentBuffer == queue->FragmentBufferA ? queue->FragmentBufferB : queue->FragmentBufferA); @@ -774,7 +774,7 @@ static VOID MainThreadProc (PVOID threadArg) dataUnit.Value += queue->CryptoInfo->FirstDataUnitNo.Value; else if (queue->RemapEncryptedArea) dataUnit.Value += queue->RemappedAreaDataUnitOffset; - + EncryptDataUnits (activeFragmentBuffer + request->EncryptedOffset, &dataUnit, request->EncryptedLength / ENCRYPTION_DATA_UNIT_SIZE, queue->CryptoInfo); } } @@ -824,7 +824,7 @@ NTSTATUS EncryptedIoQueueAddIrp (EncryptedIoQueue *queue, PIRP irp) ExInterlockedInsertTailList (&queue->MainThreadQueue, &irp->Tail.Overlay.ListEntry, &queue->MainThreadQueueLock); KeSetEvent (&queue->MainThreadQueueNotEmptyEvent, IO_DISK_INCREMENT, FALSE); - + return STATUS_PENDING; err: @@ -839,7 +839,7 @@ NTSTATUS EncryptedIoQueueHoldWhenIdle (EncryptedIoQueue *queue, int64 timeout) ASSERT (!queue->Suspended); queue->SuspendPending = TRUE; - + while (TRUE) { while (InterlockedExchangeAdd (&queue->OutstandingIoCount, 0) > 0) @@ -898,7 +898,7 @@ BOOL EncryptedIoQueueIsRunning (EncryptedIoQueue *queue) NTSTATUS EncryptedIoQueueResumeFromHold (EncryptedIoQueue *queue) { ASSERT (queue->Suspended); - + queue->Suspended = FALSE; KeSetEvent (&queue->QueueResumedEvent, IO_DISK_INCREMENT, FALSE); @@ -1024,7 +1024,7 @@ NTSTATUS EncryptedIoQueueStop (EncryptedIoQueue *queue) { ASSERT (!queue->StopPending); queue->StopPending = TRUE; - + while (InterlockedExchangeAdd (&queue->OutstandingIoCount, 0) > 0) { KeWaitForSingleObject (&queue->NoOutstandingIoEvent, Executive, KernelMode, FALSE, NULL); diff --git a/src/Driver/EncryptedIoQueue.h b/src/Driver/EncryptedIoQueue.h index 044009b7..ffe71471 100644 --- a/src/Driver/EncryptedIoQueue.h +++ b/src/Driver/EncryptedIoQueue.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -40,12 +40,12 @@ typedef struct EncryptedIoQueueBufferStruct typedef struct { PDEVICE_OBJECT DeviceObject; - + KMUTEX BufferPoolMutex; EncryptedIoQueueBuffer *FirstPoolBuffer; CRYPTO_INFO *CryptoInfo; - + // File-handle-based IO HANDLE HostFileHandle; int64 VirtualDeviceLength; @@ -106,7 +106,7 @@ typedef struct volatile BOOL StartPending; volatile BOOL ThreadExitRequested; - + volatile BOOL Suspended; volatile BOOL SuspendPending; volatile BOOL StopPending; diff --git a/src/Driver/Fuse/Driver.make b/src/Driver/Fuse/Driver.make index 61e57577..169d0354 100644 --- a/src/Driver/Fuse/Driver.make +++ b/src/Driver/Fuse/Driver.make @@ -3,7 +3,7 @@ # Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed # 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 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 diff --git a/src/Driver/Fuse/FuseService.cpp b/src/Driver/Fuse/FuseService.cpp index bf0fad8e..97316532 100644 --- a/src/Driver/Fuse/FuseService.cpp +++ b/src/Driver/Fuse/FuseService.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -320,7 +320,7 @@ namespace VeraCrypt { return fuse_get_context()->uid == 0 || fuse_get_context()->uid == UserId; } - + void FuseService::CloseMountedVolume () { if (MountedVolume) @@ -403,7 +403,7 @@ namespace VeraCrypt return outBuf; } - + const char *FuseService::GetVolumeImagePath () { #ifdef TC_MACOSX @@ -439,7 +439,7 @@ namespace VeraCrypt args.push_back ("-o"); args.push_back ("allow_other"); } - + ExecFunctor execFunctor (openVolume, slotNumber); Process::Execute ("fuse", args, -1, &execFunctor); @@ -498,13 +498,13 @@ namespace VeraCrypt MountedVolume->WriteSectors (buffer, byteOffset); } - + void FuseService::OnSignal (int signal) { try { shared_ptr <VolumeInfo> volume = Core->GetMountedVolume (SlotNumber); - + if (volume) Core->DismountVolume (volume, true); } diff --git a/src/Driver/Fuse/FuseService.h b/src/Driver/Fuse/FuseService.h index 0c3a6920..0498a42a 100644 --- a/src/Driver/Fuse/FuseService.h +++ b/src/Driver/Fuse/FuseService.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c index c771b3ce..9b683f9b 100644 --- a/src/Driver/Ntdriver.c +++ b/src/Driver/Ntdriver.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -89,7 +89,7 @@ NTSTATUS DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) SelfTestsPassed = AutoTestAlgorithms(); // Enable device class filters and load boot arguments if the driver is set to start at system boot - + if (NT_SUCCESS (TCReadRegistryKey (RegistryPath, L"Start", &startKeyValue))) { if (startKeyValue->Type == REG_DWORD && *((uint32 *) startKeyValue->Data) == SERVICE_BOOT_START) @@ -156,7 +156,7 @@ void DumpMemory (void *mem, int size) for (j = 0; j < size / 8; j++) { memset (str,0,sizeof str); - for (i = 0; i < 8; i++) + for (i = 0; i < 8; i++) { if (m[i] > ' ' && m[i] <= '~') str[i]=m[i]; @@ -330,10 +330,10 @@ NTSTATUS TCDispatchQueueIRP (PDEVICE_OBJECT DeviceObject, PIRP Irp) return TCCompleteIrp (Irp, ntStatus, 0); IoMarkIrpPending (Irp); - + ExInterlockedInsertTailList (&Extension->ListEntry, &Irp->Tail.Overlay.ListEntry, &Extension->ListSpinLock); KeReleaseSemaphore (&Extension->RequestSemaphore, IO_DISK_INCREMENT, 1, FALSE); - + return STATUS_PENDING; case IRP_MJ_FLUSH_BUFFERS: @@ -375,7 +375,7 @@ NTSTATUS TCCreateRootDeviceObject (PDRIVER_OBJECT DriverObject) RtlInitUnicodeString (&Win32NameString, dosname); Dump ("Creating root device nt=%ls dos=%ls\n", ntname, dosname); - + ntStatus = IoCreateDevice ( DriverObject, sizeof (BOOL), @@ -559,10 +559,10 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION UCHAR volId[128], tmp[] = { 0,0 }; PMOUNTDEV_UNIQUE_ID outputBuffer = (PMOUNTDEV_UNIQUE_ID) Irp->AssociatedIrp.SystemBuffer; - RtlStringCbCopyA (volId, sizeof(volId),TC_UNIQUE_ID_PREFIX); + RtlStringCbCopyA (volId, sizeof(volId),TC_UNIQUE_ID_PREFIX); tmp[0] = 'A' + (UCHAR) Extension->nDosDriveNo; RtlStringCbCatA (volId, sizeof(volId),tmp); - + outputBuffer->UniqueIdLength = (USHORT) strlen (volId); outLength = (ULONG) (strlen (volId) + sizeof (USHORT)); @@ -593,7 +593,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION { Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; Irp->IoStatus.Information = 0; - break; + break; } TCGetDosNameFromNumber (ntName, sizeof(ntName),Extension->nDosDriveNo, DeviceNamespaceDefault); @@ -612,7 +612,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION } RtlCopyMemory ((PCHAR)outputBuffer->Name,ntUnicodeString.Buffer, ntUnicodeString.Length); - + Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = outLength; @@ -643,7 +643,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION if (EnableExtendedIoctlSupport) { if (ValidateIOBufferSize (Irp, sizeof (STORAGE_PROPERTY_QUERY), ValidateInput)) - { + { PSTORAGE_PROPERTY_QUERY pStoragePropQuery = (PSTORAGE_PROPERTY_QUERY) Irp->AssociatedIrp.SystemBuffer; STORAGE_QUERY_TYPE type = pStoragePropQuery->QueryType; @@ -702,7 +702,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION } else return TCCompleteIrp (Irp, STATUS_INVALID_DEVICE_REQUEST, 0); - + break; case IOCTL_DISK_GET_PARTITION_INFO: @@ -783,13 +783,13 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION if (ValidateIOBufferSize (Irp, sizeof (VERIFY_INFORMATION), ValidateInput)) { HRESULT hResult; - ULONGLONG ullStartingOffset, ullNewOffset, ullEndOffset; + ULONGLONG ullStartingOffset, ullNewOffset, ullEndOffset; PVERIFY_INFORMATION pVerifyInformation; pVerifyInformation = (PVERIFY_INFORMATION) Irp->AssociatedIrp.SystemBuffer; ullStartingOffset = (ULONGLONG) pVerifyInformation->StartingOffset.QuadPart; - hResult = ULongLongAdd(ullStartingOffset, - (ULONGLONG) Extension->cryptoInfo->hiddenVolume ? Extension->cryptoInfo->hiddenVolumeOffset : Extension->cryptoInfo->volDataAreaOffset, + hResult = ULongLongAdd(ullStartingOffset, + (ULONGLONG) Extension->cryptoInfo->hiddenVolume ? Extension->cryptoInfo->hiddenVolumeOffset : Extension->cryptoInfo->volDataAreaOffset, &ullNewOffset); if (hResult != S_OK) Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; @@ -801,7 +801,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION { IO_STATUS_BLOCK ioStatus; PVOID buffer = TCalloc (max (pVerifyInformation->Length, PAGE_SIZE)); - + if (!buffer) { Irp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES; @@ -847,7 +847,7 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION } break; - + case IOCTL_VOLUME_ONLINE: Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Information = 0; @@ -1054,7 +1054,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex // Go through all volume types (e.g., normal, hidden) for (volumeType = TC_VOLUME_TYPE_NORMAL; volumeType < TC_VOLUME_TYPE_COUNT; - volumeType++) + volumeType++) { /* Read the volume header */ switch (volumeType) @@ -1121,7 +1121,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex IO_STATUS_BLOCK IoStatus; LARGE_INTEGER offset; byte readBuffer [TC_SECTOR_SIZE_BIOS]; - + if (!ValidateIOBufferSize (Irp, sizeof (GetSystemDriveConfigurationRequest), ValidateInputOutput)) break; @@ -1254,7 +1254,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex for (drive = MIN_MOUNTED_VOLUME_DRIVE_NUMBER; drive <= MAX_MOUNTED_VOLUME_DRIVE_NUMBER; ++drive) { PEXTENSION ListExtension; - + ListDevice = GetVirtualVolumeDeviceObject (drive); if (!ListDevice) continue; @@ -1500,9 +1500,9 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex MOUNT_STRUCT *mount = (MOUNT_STRUCT *) Irp->AssociatedIrp.SystemBuffer; if (mount->VolumePassword.Length > MAX_PASSWORD || mount->ProtectedHidVolPassword.Length > MAX_PASSWORD - || mount->pkcs5_prf < 0 || mount->pkcs5_prf > LAST_PRF_ID + || mount->pkcs5_prf < 0 || mount->pkcs5_prf > LAST_PRF_ID || mount->VolumePim < -1 || mount->VolumePim == INT_MAX - || mount->ProtectedHidVolPkcs5Prf < 0 || mount->ProtectedHidVolPkcs5Prf > LAST_PRF_ID + || mount->ProtectedHidVolPkcs5Prf < 0 || mount->ProtectedHidVolPkcs5Prf > LAST_PRF_ID || (mount->bTrueCryptMode != FALSE && mount->bTrueCryptMode != TRUE) ) { @@ -1690,7 +1690,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex return TCCompleteIrp (Irp, STATUS_INVALID_DEVICE_REQUEST, 0); } - + #ifdef DEBUG if (!NT_SUCCESS (Irp->IoStatus.Status)) { @@ -1739,7 +1739,7 @@ NTSTATUS TCStartThreadInProcess (PKSTART_ROUTINE threadProc, PVOID threadArg, PK } InitializeObjectAttributes (&threadObjAttributes, NULL, OBJ_KERNEL_HANDLE, NULL, NULL); - + status = PsCreateSystemThread (&threadHandle, THREAD_ALL_ACCESS, &threadObjAttributes, processHandle, NULL, threadProc, threadArg); if (!NT_SUCCESS (status)) return status; @@ -2255,7 +2255,7 @@ void TCDeleteDeviceObject (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension) PsDereferenceImpersonationTokenD = MmGetSystemRoutineAddress (&name); if (!PsDereferenceImpersonationTokenD) TC_BUG_CHECK (STATUS_NOT_IMPLEMENTED); - + # define PsDereferencePrimaryToken # define PsDereferenceImpersonationToken PsDereferenceImpersonationTokenD @@ -2390,11 +2390,11 @@ NTSTATUS SendDeviceIoControlRequest (PDEVICE_OBJECT deviceObject, ULONG ioContro args.outputBufferSize = outputBufferSize; KeInitializeEvent (&args.WorkItemCompletedEvent, SynchronizationEvent, FALSE); - IoQueueWorkItem (workItem, SendDeviceIoControlRequestWorkItemRoutine, DelayedWorkQueue, &args); + IoQueueWorkItem (workItem, SendDeviceIoControlRequestWorkItemRoutine, DelayedWorkQueue, &args); KeWaitForSingleObject (&args.WorkItemCompletedEvent, Executive, KernelMode, FALSE, NULL); IoFreeWorkItem (workItem); - + return args.Status; } @@ -2449,7 +2449,7 @@ NTSTATUS ProbeRealDriveSize (PDEVICE_OBJECT driveDeviceObject, LARGE_INTEGER *dr for (offset.QuadPart = sysLength.QuadPart; ; offset.QuadPart += TC_SECTOR_SIZE_BIOS) { status = TCReadDevice (driveDeviceObject, sectorBuffer, offset, TC_SECTOR_SIZE_BIOS); - + if (NT_SUCCESS (status)) status = TCWriteDevice (driveDeviceObject, sectorBuffer, offset, TC_SECTOR_SIZE_BIOS); @@ -2587,7 +2587,7 @@ NTSTATUS TCFsctlCall (PFILE_OBJECT fileObject, LONG IoControlCode, return STATUS_INSUFFICIENT_RESOURCES; stack = IoGetNextIrpStackLocation(irp); - + stack->MajorFunction = IRP_MJ_FILE_SYSTEM_CONTROL; stack->MinorFunction = IRP_MN_USER_FS_REQUEST; stack->FileObject = fileObject; @@ -2638,7 +2638,7 @@ NTSTATUS RemoveDriveLink (int nDosDriveNo) NTSTATUS MountManagerMount (MOUNT_STRUCT *mount) { - NTSTATUS ntStatus; + NTSTATUS ntStatus; WCHAR arrVolume[256]; char buf[200]; PMOUNTMGR_TARGET_NAME in = (PMOUNTMGR_TARGET_NAME) buf; @@ -2670,7 +2670,7 @@ NTSTATUS MountManagerMount (MOUNT_STRUCT *mount) NTSTATUS MountManagerUnmount (int nDosDriveNo) { - NTSTATUS ntStatus; + NTSTATUS ntStatus; char buf[256], out[300]; PMOUNTMGR_MOUNT_POINT in = (PMOUNTMGR_MOUNT_POINT) buf; @@ -2694,10 +2694,10 @@ NTSTATUS MountManagerUnmount (int nDosDriveNo) NTSTATUS MountDevice (PDEVICE_OBJECT DeviceObject, MOUNT_STRUCT *mount) { PDEVICE_OBJECT NewDeviceObject; - NTSTATUS ntStatus; + NTSTATUS ntStatus; // Make sure the user is asking for a reasonable nDosDriveNo - if (mount->nDosDriveNo >= 0 && mount->nDosDriveNo <= 25 + if (mount->nDosDriveNo >= 0 && mount->nDosDriveNo <= 25 && IsDriveLetterAvailable (mount->nDosDriveNo, DeviceNamespaceDefault) // drive letter must not exist both locally and globally && IsDriveLetterAvailable (mount->nDosDriveNo, DeviceNamespaceGlobal) ) @@ -2868,7 +2868,7 @@ NTSTATUS MountDevice (PDEVICE_OBJECT DeviceObject, MOUNT_STRUCT *mount) FILE_FS_LABEL_INFORMATION* labelInfo = (FILE_FS_LABEL_INFORMATION*) TCalloc (labelInfoSize); labelInfo->VolumeLabelLength = labelEffectiveLen * sizeof(WCHAR); memcpy (labelInfo->VolumeLabel, mount->wszLabel, labelInfo->VolumeLabelLength); - + if (STATUS_SUCCESS == ZwSetVolumeInformationFile (volumeHandle, &ioblock, labelInfo, labelInfoSize, FileFsLabelInformation)) { mount->bDriverSetLabel = TRUE; @@ -2891,7 +2891,7 @@ NTSTATUS MountDevice (PDEVICE_OBJECT DeviceObject, MOUNT_STRUCT *mount) Dump ("Mount FAILURE TC code = 0x%08x\n", mount->nReturnCode); TCDeleteDeviceObject (NewDeviceObject, NewExtension); } - + return STATUS_SUCCESS; } } @@ -2949,7 +2949,7 @@ NTSTATUS UnmountDevice (UNMOUNT_STRUCT *unmountRequest, PDEVICE_OBJECT deviceObj TCSleep (100); } } - else + else { // Volume cannot be opened => force dismount if allowed if (!ignoreOpenFiles) @@ -3084,10 +3084,10 @@ void GetIntersection (uint64 start1, uint32 length1, uint64 start2, uint64 end2, { uint64 end1 = start1 + length1 - 1; uint64 intersectEnd = (end1 <= end2) ? end1 : end2; - + *intersectStart = (start1 >= start2) ? start1 : start2; *intersectLength = (uint32) ((*intersectStart > intersectEnd) ? 0 : intersectEnd + 1 - *intersectStart); - + if (*intersectLength == 0) *intersectStart = start1; } @@ -3103,7 +3103,7 @@ BOOL IsAccessibleByUser (PUNICODE_STRING objectFileName, BOOL readOnly) ASSERT (!IoIsSystemThread (PsGetCurrentThread())); InitializeObjectAttributes (&fileObjAttributes, objectFileName, OBJ_CASE_INSENSITIVE | OBJ_FORCE_ACCESS_CHECK | OBJ_KERNEL_HANDLE, NULL, NULL); - + status = ZwCreateFile (&fileHandle, readOnly ? GENERIC_READ : GENERIC_READ | GENERIC_WRITE, &fileObjAttributes, @@ -3243,7 +3243,7 @@ NTSTATUS TCReadRegistryKey (PUNICODE_STRING keyPath, wchar_t *keyValueName, PKEY RtlInitUnicodeString (&valName, keyValueName); status = ZwQueryValueKey (regKeyHandle, &valName, KeyValuePartialInformation, NULL, 0, &size); - + if (!NT_SUCCESS (status) && status != STATUS_BUFFER_OVERFLOW && status != STATUS_BUFFER_TOO_SMALL) { ZwClose (regKeyHandle); @@ -3356,7 +3356,7 @@ NTSTATUS ReadRegistryConfigFlags (BOOL driverEntry) } EnableHwEncryption ((flags & TC_DRIVER_CONFIG_DISABLE_HARDWARE_ENCRYPTION) ? FALSE : TRUE); - + EnableExtendedIoctlSupport = (flags & TC_DRIVER_CONFIG_ENABLE_EXTENDED_IOCTL)? TRUE : FALSE; } else @@ -3495,7 +3495,7 @@ BOOL IsVolumeAccessibleByCurrentUser (PEXTENSION volumeDeviceExtension) if (!accessToken) goto ret; - + if (SeTokenIsAdmin (accessToken)) { result = TRUE; diff --git a/src/Driver/Ntdriver.h b/src/Driver/Ntdriver.h index d5d548e8..2c5f13da 100644 --- a/src/Driver/Ntdriver.h +++ b/src/Driver/Ntdriver.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -54,7 +54,7 @@ typedef struct EXTENSION CRYPTO_INFO *cryptoInfo; /* Cryptographic and other information for this device */ __int64 HostLength; - __int64 DiskLength; /* The length of the disk referred to by this device */ + __int64 DiskLength; /* The length of the disk referred to by this device */ __int64 NumberOfCylinders; /* Partition info */ ULONG TracksPerCylinder; /* Partition info */ ULONG SectorsPerTrack; /* Partition info */ diff --git a/src/Driver/Ntvol.c b/src/Driver/Ntvol.c index 34ee2dbb..cfcc45e6 100644 --- a/src/Driver/Ntvol.c +++ b/src/Driver/Ntvol.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -82,7 +82,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject, PARTITION_INFORMATION pi; PARTITION_INFORMATION_EX pix; LARGE_INTEGER diskLengthInfo; - DISK_GEOMETRY dg; + DISK_GEOMETRY dg; STORAGE_PROPERTY_QUERY storagePropertyQuery = {0}; STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR storageDescriptor = {0}; @@ -105,8 +105,8 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject, storagePropertyQuery.QueryType = PropertyStandardQuery; /* IOCTL_STORAGE_QUERY_PROPERTY supported only on Vista and above */ - if (NT_SUCCESS (TCSendHostDeviceIoControlRequestEx (DeviceObject, Extension, IOCTL_STORAGE_QUERY_PROPERTY, - (char*) &storagePropertyQuery, sizeof(storagePropertyQuery), + if (NT_SUCCESS (TCSendHostDeviceIoControlRequestEx (DeviceObject, Extension, IOCTL_STORAGE_QUERY_PROPERTY, + (char*) &storagePropertyQuery, sizeof(storagePropertyQuery), (char *) &storageDescriptor, sizeof (storageDescriptor)))) { Extension->HostBytesPerPhysicalSector = storageDescriptor.BytesPerPhysicalSector; @@ -300,8 +300,8 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject, } else { - // Try to gain "raw" access to the partition in case there is a live filesystem on it (otherwise, - // the NTFS driver guards hidden sectors and prevents mounting using a backup header e.g. after the user + // Try to gain "raw" access to the partition in case there is a live filesystem on it (otherwise, + // the NTFS driver guards hidden sectors and prevents mounting using a backup header e.g. after the user // accidentally quick-formats a dismounted partition-hosted TrueCrypt volume as NTFS). PFILE_OBJECT pfoTmpDeviceFile = NULL; @@ -335,7 +335,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject, // Go through all volume types (e.g., normal, hidden) for (volumeType = TC_VOLUME_TYPE_NORMAL; volumeType < TC_VOLUME_TYPE_COUNT; - volumeType++) + volumeType++) { Dump ("Trying to open volume type %d\n", volumeType); @@ -451,7 +451,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject, Dump ("Read didn't read enough data\n"); // If FSCTL_ALLOW_EXTENDED_DASD_IO failed and there is a live filesystem on the partition, then the - // filesystem driver may report EOF when we are reading hidden sectors (when the filesystem is + // filesystem driver may report EOF when we are reading hidden sectors (when the filesystem is // shorter than the partition). This can happen for example after the user quick-formats a dismounted // partition-hosted TrueCrypt volume and then tries to mount the volume using the embedded backup header. memset (readBuffer, 0, TC_VOLUME_HEADER_EFFECTIVE_SIZE); @@ -610,7 +610,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject, } // If we are supposed to actually mount the hidden volume (not just to protect it) - if (!mount->bProtectHiddenVolume) + if (!mount->bProtectHiddenVolume) { Extension->DiskLength = cryptoInfoPtr->hiddenVolumeSize; Extension->cryptoInfo->hiddenVolume = TRUE; @@ -621,7 +621,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject, // Hidden volume protection Extension->cryptoInfo->hiddenVolume = FALSE; Extension->cryptoInfo->bProtectHiddenVolume = TRUE; - + Extension->cryptoInfo->hiddenVolumeProtectedSize = tmpCryptoInfo->hiddenVolumeSize; Dump ("Hidden volume protection active: %I64d-%I64d (%I64d)\n", Extension->cryptoInfo->hiddenVolumeOffset, Extension->cryptoInfo->hiddenVolumeProtectedSize + Extension->cryptoInfo->hiddenVolumeOffset - 1, Extension->cryptoInfo->hiddenVolumeProtectedSize); @@ -642,7 +642,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject, // If this is a hidden volume, make sure we are supposed to actually // mount it (i.e. not just to protect it) - if (volumeType == TC_VOLUME_TYPE_NORMAL || !mount->bProtectHiddenVolume) + if (volumeType == TC_VOLUME_TYPE_NORMAL || !mount->bProtectHiddenVolume) { // Validate sector size if (bRawDevice && Extension->cryptoInfo->SectorSize != Extension->HostBytesPerSector) @@ -660,7 +660,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject, Extension->PartitionType = 0; Extension->bRawDevice = bRawDevice; - + memset (Extension->wszVolume, 0, sizeof (Extension->wszVolume)); if (wcsstr (pwszMountVolume, WIDE ("\\??\\UNC\\")) == pwszMountVolume) { @@ -690,7 +690,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject, crypto_close (tmpCryptoInfo); tmpCryptoInfo = NULL; } - + return STATUS_SUCCESS; } } @@ -698,7 +698,7 @@ NTSTATUS TCOpenVolume (PDEVICE_OBJECT DeviceObject, || mount->nReturnCode != ERR_PASSWORD_WRONG) { /* If we are not supposed to protect a hidden volume, the only error that is - tolerated is ERR_PASSWORD_WRONG (to allow mounting a possible hidden volume). + tolerated is ERR_PASSWORD_WRONG (to allow mounting a possible hidden volume). If we _are_ supposed to protect a hidden volume, we do not tolerate any error (both volume headers must be successfully decrypted). */ @@ -863,8 +863,8 @@ static void RestoreTimeStamp (PEXTENSION Extension) FILE_BASIC_INFORMATION FileBasicInfo; IO_STATUS_BLOCK IoStatusBlock; - if (Extension->hDeviceFile != NULL - && Extension->bRawDevice == FALSE + if (Extension->hDeviceFile != NULL + && Extension->bRawDevice == FALSE && Extension->bReadOnly == FALSE && Extension->bTimeStampValid) { @@ -872,7 +872,7 @@ static void RestoreTimeStamp (PEXTENSION Extension) &IoStatusBlock, &FileBasicInfo, sizeof (FileBasicInfo), - FileBasicInformation); + FileBasicInformation); if (!NT_SUCCESS (ntStatus)) { @@ -891,7 +891,7 @@ static void RestoreTimeStamp (PEXTENSION Extension) &IoStatusBlock, &FileBasicInfo, sizeof (FileBasicInfo), - FileBasicInformation); + FileBasicInformation); if (!NT_SUCCESS (ntStatus)) Dump ("ZwSetInformationFile failed in RestoreTimeStamp: NTSTATUS 0x%08x\n",ntStatus); diff --git a/src/Driver/Ntvol.h b/src/Driver/Ntvol.h index 912c02b0..ae7d9cb3 100644 --- a/src/Driver/Ntvol.h +++ b/src/Driver/Ntvol.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source diff --git a/src/Driver/Resource.h b/src/Driver/Resource.h index a3e73646..ea7f5c74 100644 --- a/src/Driver/Resource.h +++ b/src/Driver/Resource.h @@ -4,7 +4,7 @@ // // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 diff --git a/src/Driver/VolumeFilter.c b/src/Driver/VolumeFilter.c index 8cb675f6..50ac74da 100644 --- a/src/Driver/VolumeFilter.c +++ b/src/Driver/VolumeFilter.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -57,7 +57,7 @@ NTSTATUS VolumeFilterAddDevice (PDRIVER_OBJECT driverObject, PDEVICE_OBJECT pdo) status = STATUS_DEVICE_REMOVED; goto err; } - + Extension->IsVolumeFilterDevice = TRUE; Extension->DeviceObject = filterDeviceObject; Extension->Pdo = pdo; diff --git a/src/Driver/VolumeFilter.h b/src/Driver/VolumeFilter.h index be0cbd0b..b73b4f48 100644 --- a/src/Driver/VolumeFilter.h +++ b/src/Driver/VolumeFilter.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/ExpandVolume/DlgExpandVolume.cpp b/src/ExpandVolume/DlgExpandVolume.cpp index e08721b3..d0a98fef 100644 --- a/src/ExpandVolume/DlgExpandVolume.cpp +++ b/src/ExpandVolume/DlgExpandVolume.cpp @@ -1,14 +1,14 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' and also from the source code of extcv, which is Copyright (c) 2009-2010 Kih-Oskh or Copyright (c) 2012-2013 Josef Schneider <josef@netpage.dk> - 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 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 @@ -198,7 +198,7 @@ BOOL CALLBACK ExpandVolSizeDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA pVolExpandParam->bInitFreeSpace = IsButtonChecked (GetDlgItem (hwndDlg, IDC_INIT_NEWSPACE)); if (!pVolExpandParam->bIsDevice) // for devices new size is set by calling function - { + { GetWindowText (GetDlgItem (hwndDlg, IDC_SIZEBOX), szTemp, ARRAYSIZE (szTemp)); pVolExpandParam->newSize = _wtoi64(szTemp) * GetSizeBoxMultiplier(hwndDlg); } @@ -349,7 +349,7 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L ProcessEntropyEstimate (hEntropyBar, &mouseEventsInitialCount, mouseEventsCounter, maxEntropyLevel, &mouseEntropyGathered); if (showRandPool) - StringCbPrintfW (szRndPool, sizeof(szRndPool), L"%08X%08X%08X%08X", + StringCbPrintfW (szRndPool, sizeof(szRndPool), L"%08X%08X%08X%08X", *((DWORD*) (randPool + 12)), *((DWORD*) (randPool + 8)), *((DWORD*) (randPool + 4)), *((DWORD*) (randPool))); else if (bUseMask) { @@ -585,11 +585,11 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume) { bIsDevice = expandVol.IsDevice; bIsLegacy = expandVol.CryptoInfo->LegacyVolume; - hostSize = expandVol.HostSize; + hostSize = expandVol.HostSize; VolumePkcs5 = expandVol.CryptoInfo->pkcs5; if ( bIsLegacy ) { - if ( bIsDevice ) + if ( bIsDevice ) volSize = 0; // updated later else volSize = hostSize; @@ -629,7 +629,7 @@ void ExpandVolumeWizard (HWND hwndDlg, wchar_t *lpszVolume) { uint64 NumberOfSectors; DWORD BytesPerSector; - + if ( !GetNtfsNumberOfSectors(rootPath, &NumberOfSectors, &BytesPerSector) ) nStatus = ERR_OS_ERROR; diff --git a/src/ExpandVolume/ExpandVolume.c b/src/ExpandVolume/ExpandVolume.c index 9deb3af4..abe09557 100644 --- a/src/ExpandVolume/ExpandVolume.c +++ b/src/ExpandVolume/ExpandVolume.c @@ -1,14 +1,14 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' and also from the source code of extcv, which is Copyright (c) 2009-2010 Kih-Oskh or Copyright (c) 2012-2013 Josef Schneider <josef@netpage.dk> - 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 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 @@ -860,7 +860,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas /* wipe old backup header */ if ( !cryptoInfo->LegacyVolume ) - { + { byte wipeRandChars [TC_WIPE_RAND_CHAR_COUNT]; byte wipeRandCharsUpdate [TC_WIPE_RAND_CHAR_COUNT]; byte wipePass; diff --git a/src/ExpandVolume/ExpandVolume.h b/src/ExpandVolume/ExpandVolume.h index 87f0e42d..8a9ace64 100644 --- a/src/ExpandVolume/ExpandVolume.h +++ b/src/ExpandVolume/ExpandVolume.h @@ -1,14 +1,14 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' and also from the source code of extcv, which is Copyright (c) 2009-2010 Kih-Oskh or Copyright (c) 2012-2013 Josef Schneider <josef@netpage.dk> - 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 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 diff --git a/src/ExpandVolume/ExpandVolume.rc b/src/ExpandVolume/ExpandVolume.rc index 31f71d95..6659d0f3 100644 --- a/src/ExpandVolume/ExpandVolume.rc +++ b/src/ExpandVolume/ExpandVolume.rc @@ -141,7 +141,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_SIZE_DIALOG, DIALOG BEGIN @@ -230,19 +230,19 @@ END // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "#include ""..\\\\common\\\\resource.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "#include ""..\\\\common\\\\common.rc""\r\n" "\0" @@ -264,7 +264,7 @@ IDB_LOGO_288DPI BITMAP "Logo_288dpi.bmp" // Menu // -IDR_MENU MENUEX +IDR_MENU MENUEX BEGIN MENUITEM "About", IDM_ABOUT,MFT_STRING,MFS_ENABLED MENUITEM "Homepage", IDM_HOMEPAGE,MFT_STRING | MFT_RIGHTJUSTIFY,MFS_ENABLED @@ -276,7 +276,7 @@ END // String Table // -STRINGTABLE +STRINGTABLE BEGIN IDS_UACSTRING "VeraCrypt Expander" END diff --git a/src/ExpandVolume/InitDataArea.c b/src/ExpandVolume/InitDataArea.c index 4e6417be..3e2bf494 100644 --- a/src/ExpandVolume/InitDataArea.c +++ b/src/ExpandVolume/InitDataArea.c @@ -1,14 +1,14 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' and also from the source code of extcv, which is Copyright (c) 2009-2010 Kih-Oskh or Copyright (c) 2012-2013 Josef Schneider <josef@netpage.dk> - 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 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 diff --git a/src/ExpandVolume/InitDataArea.h b/src/ExpandVolume/InitDataArea.h index 35c6bbd5..49958a00 100644 --- a/src/ExpandVolume/InitDataArea.h +++ b/src/ExpandVolume/InitDataArea.h @@ -2,10 +2,10 @@ Derived from source code of TrueCrypt 7.1a, which is Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0, and also derived from source code of extcv which - is Copyright (c) 2009-2010 by Kih-Oskh or Copyright (c) 2012-2013 Josef Schneider + is Copyright (c) 2009-2010 by Kih-Oskh or Copyright (c) 2012-2013 Josef Schneider <josef@netpage.dk> - 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 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 diff --git a/src/ExpandVolume/WinMain.cpp b/src/ExpandVolume/WinMain.cpp index 630fc79d..ad0d2f50 100644 --- a/src/ExpandVolume/WinMain.cpp +++ b/src/ExpandVolume/WinMain.cpp @@ -1,14 +1,14 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' and also from the source code of extcv, which is Copyright (c) 2009-2010 Kih-Oskh or Copyright (c) 2012-2013 Josef Schneider <josef@netpage.dk> - 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 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 @@ -469,7 +469,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA EnableWindow (GetDlgItem (hwndDlg, IDC_MOUNT_OPTIONS), FALSE); } - /* No support for mounting TrueCrypt volumes */ + /* No support for mounting TrueCrypt volumes */ SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), FALSE); @@ -493,7 +493,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case TC_APPMSG_PREBOOT_PASSWORD_MODE: { - /* No support for mounting TrueCrypt system partition */ + /* No support for mounting TrueCrypt system partition */ SetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE, FALSE); EnableWindow (GetDlgItem (hwndDlg, IDC_TRUECRYPT_MODE), FALSE); @@ -605,7 +605,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (lw == IDC_MOUNT_OPTIONS) { - DialogBoxParamW (hInst, + DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_MOUNT_OPTIONS), hwndDlg, (DLGPROC) MountOptionsDlgProc, (LPARAM) &mountOptions); @@ -670,16 +670,16 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (GetPassword (hwndDlg, IDC_PASSWORD, (LPSTR) szXPwd->Text, MAX_PASSWORD + 1, TRUE)) szXPwd->Length = strlen ((char *) szXPwd->Text); else - return 1; + return 1; - bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_CACHE)); + bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_CACHE)); *pkcs5 = (int) SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETITEMDATA, SendMessage (GetDlgItem (hwndDlg, IDC_PKCS5_PRF_ID), CB_GETCURSEL, 0, 0), 0); *truecryptMode = GetCheckBox (hwndDlg, IDC_TRUECRYPT_MODE); *pim = GetPim (hwndDlg, IDC_PIM); /* SHA-256 is not supported by TrueCrypt */ - if ( (*truecryptMode) + if ( (*truecryptMode) && ((*pkcs5 == SHA256) || (mountOptions.ProtectHiddenVolume && mountOptions.ProtectedHidVolPkcs5Prf == SHA256)) ) { @@ -687,7 +687,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return 1; } - if ( (*truecryptMode) + if ( (*truecryptMode) && (*pim != 0) ) { @@ -699,8 +699,8 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA // Attempt to wipe password stored in the input field buffer wmemset (tmp, L'X', MAX_PASSWORD); tmp[MAX_PASSWORD] = 0; - SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp); - SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), tmp); + SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD), tmp); + SetWindowText (GetDlgItem (hwndDlg, IDC_PASSWORD_PROT_HIDVOL), tmp); if (hidVolProtKeyFilesParam.FirstKeyFile != NULL) { @@ -713,7 +713,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA KillTimer (hwndDlg, TIMER_ID_KEYB_LAYOUT_GUARD); // Restore the original keyboard layout - if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL) + if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL) Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT", hwndDlg); } @@ -748,7 +748,7 @@ BOOL CALLBACK ExtcvPasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } } } - break; + break; case WM_DROPFILES: { @@ -807,7 +807,7 @@ int ExtcvAskVolumePassword (HWND hwndDlg, const wchar_t* fileName, Password *pas StringCbCopyW (PasswordDlgVolume, sizeof(PasswordDlgVolume), fileName); - result = DialogBoxParamW (hInst, + result = DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_PASSWORD_DLG), hwndDlg, (DLGPROC) ExtcvPasswordDlgProc, (LPARAM) &dlgParam); diff --git a/src/ExpandVolume/resource.h b/src/ExpandVolume/resource.h index 42b9f2b4..993c414f 100644 --- a/src/ExpandVolume/resource.h +++ b/src/ExpandVolume/resource.h @@ -135,7 +135,7 @@ #define IDM_MANAGE_TOKEN_KEYFILES 40062 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 diff --git a/src/Format/Format.rc b/src/Format/Format.rc index 1f2cc41d..eb2fcfa0 100644 --- a/src/Format/Format.rc +++ b/src/Format/Format.rc @@ -459,19 +459,19 @@ END // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "#include ""..\\\\common\\\\resource.h""\r\n" "\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "#include ""..\\\\common\\\\common.rc""\r\n" "\0" @@ -486,7 +486,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_VOL_CREATION_WIZARD_DLG, DIALOG BEGIN @@ -725,7 +725,7 @@ IDB_WIZARD BITMAP "VeraCrypt_wizard.bmp" // String Table // -STRINGTABLE +STRINGTABLE BEGIN IDS_UACSTRING_FMT "VeraCrypt" END diff --git a/src/Format/FormatCom.cpp b/src/Format/FormatCom.cpp index 8ba2372f..96e3e3cd 100644 --- a/src/Format/FormatCom.cpp +++ b/src/Format/FormatCom.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -74,7 +74,7 @@ public: AddRef (); return S_OK; } - + virtual DWORD STDMETHODCALLTYPE CallDriver (DWORD ioctl, BSTR input, BSTR *output) { return BaseCom::CallDriver (ioctl, input, output); diff --git a/src/Format/FormatCom.h b/src/Format/FormatCom.h index 3d545b20..65fadbe9 100644 --- a/src/Format/FormatCom.h +++ b/src/Format/FormatCom.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Format/FormatCom.idl b/src/Format/FormatCom.idl index 764663b1..23d987a7 100644 --- a/src/Format/FormatCom.idl +++ b/src/Format/FormatCom.idl @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Format/InPlace.c b/src/Format/InPlace.c index ff7fed1b..d3b3212b 100644 --- a/src/Format/InPlace.c +++ b/src/Format/InPlace.c @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -63,7 +63,7 @@ using namespace VeraCrypt; #define TC_NONSYS_INPLACE_ENC_MIN_VOL_SIZE (TC_TOTAL_VOLUME_HEADERS_SIZE + TC_MIN_NTFS_FS_SIZE * 2) -// If the returned value is greater than 0, it is the desired volume size in NTFS sectors (not in bytes) +// If the returned value is greater than 0, it is the desired volume size in NTFS sectors (not in bytes) // after shrinking has been performed. If there's any error, returns -1. static __int64 NewFileSysSizeAfterShrink (HANDLE dev, const wchar_t *devicePath, int64 *totalClusterCount, DWORD *bytesPerCluster, BOOL silent) { @@ -78,7 +78,7 @@ static __int64 NewFileSysSizeAfterShrink (HANDLE dev, const wchar_t *devicePath, NULL, 0, (LPVOID) &ntfsVolData, - sizeof (ntfsVolData), + sizeof (ntfsVolData), &nBytesReturned, NULL)) { @@ -97,7 +97,7 @@ static __int64 NewFileSysSizeAfterShrink (HANDLE dev, const wchar_t *devicePath, handleWin32Error (MainDlg, SRC_POS); return -1; - } + } fileSysSize = ntfsVolData.NumberSectors.QuadPart * ntfsVolData.BytesPerSector; @@ -105,7 +105,7 @@ static __int64 NewFileSysSizeAfterShrink (HANDLE dev, const wchar_t *devicePath, if (desiredNbrSectors <= 0) return -1; - + if (totalClusterCount) *totalClusterCount = ntfsVolData.TotalClusters.QuadPart; if (bytesPerCluster) @@ -168,7 +168,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const wchar_t *devicePa if (!IsAdmin()) { - // We rely on the wizard process to call us only when the whole wizard process has been elevated (so UAC + // We rely on the wizard process to call us only when the whole wizard process has been elevated (so UAC // status can be ignored). In case the IsAdmin() detection somehow fails, we allow the user to continue. if (!silent) @@ -222,7 +222,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const wchar_t *devicePa NULL, 0, (LPVOID) &ntfsVolData, - sizeof (ntfsVolData), + sizeof (ntfsVolData), &nBytesReturned, NULL)) { @@ -289,7 +289,7 @@ BOOL CheckRequirementsForNonSysInPlaceEnc (HWND hwndDlg, const wchar_t *devicePa NULL, 0, (LPVOID) &ntfsVolData, - sizeof (ntfsVolData), + sizeof (ntfsVolData), &nBytesReturned, NULL)) { @@ -348,7 +348,7 @@ BOOL CheckRequirementsForNonSysInPlaceDec (HWND hwndDlg, const wchar_t *devicePa /* Admin rights */ if (!IsAdmin()) { - // We rely on the wizard process to call us only when the whole wizard process has been elevated (so UAC + // We rely on the wizard process to call us only when the whole wizard process has been elevated (so UAC // status can be ignored). In case the IsAdmin() detection somehow fails, we allow the user to continue. if (!silent) @@ -436,7 +436,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol if (dev == INVALID_HANDLE_VALUE) { - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; goto closing_seq; } } @@ -444,7 +444,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol { // The volume is not mounted so we can't work with the filesystem. Error ("ONLY_MOUNTED_VOL_SUPPORTED_FOR_NONSYS_INPLACE_ENC", hwndDlg); - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; goto closing_seq; } @@ -454,7 +454,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol if (!DeviceIoControl (dev, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, - 0, + 0, NULL, 0, &dwResult, @@ -462,7 +462,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol { handleWin32Error (MainDlg, SRC_POS); ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT", TRUE); - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; goto closing_seq; } @@ -478,7 +478,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol if (sizeToShrinkTo == -1) { ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_CANT_ACCESS_OR_GET_INFO_ON_VOL_ALT", TRUE); - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; goto closing_seq; } @@ -492,7 +492,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol if (!DeviceIoControl (dev, FSCTL_SHRINK_VOLUME, (LPVOID) &shrinkVolInfo, - sizeof (shrinkVolInfo), + sizeof (shrinkVolInfo), NULL, 0, &dwResult, @@ -500,7 +500,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol { handleWin32Error (hwndDlg, SRC_POS); ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "CANNOT_RESIZE_FILESYS", TRUE); - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; goto closing_seq; } @@ -514,7 +514,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol if (!DeviceIoControl (dev, FSCTL_SHRINK_VOLUME, &shrinkVolInfo, sizeof (shrinkVolInfo), NULL, 0, &dwResult, NULL)) { // If there are any occupied clusters beyond the new desired end of the volume, the call fails with - // ERROR_ACCESS_DENIED (STATUS_ALREADY_COMMITTED). + // ERROR_ACCESS_DENIED (STATUS_ALREADY_COMMITTED). if (GetLastError () == ERROR_ACCESS_DENIED) { if (!clustersMovedBeforeVolumeEnd) @@ -532,7 +532,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol handleWin32Error (hwndDlg, SRC_POS); ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "CANNOT_RESIZE_FILESYS", TRUE); - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; goto closing_seq; } @@ -552,15 +552,15 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol if (nStatus != ERR_SUCCESS) { - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; goto closing_seq; } - /* Create header backup on the partition. Until the volume is fully encrypted, the backup header will provide - us with the master key, encrypted range, and other data for pause/resume operations. We cannot create the - primary header until the entire partition is encrypted (because we encrypt backwards and the primary header + /* Create header backup on the partition. Until the volume is fully encrypted, the backup header will provide + us with the master key, encrypted range, and other data for pause/resume operations. We cannot create the + primary header until the entire partition is encrypted (because we encrypt backwards and the primary header area is occuppied by data until the very end of the process). */ // Prepare the backup header @@ -624,12 +624,12 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol goto closing_seq; } - // The backup header is valid so we know we should be able to safely resume in-place encryption + // The backup header is valid so we know we should be able to safely resume in-place encryption // of this partition even if the system/app crashes. - /* Conceal the NTFS filesystem (by performing an easy-to-undo modification). This will prevent Windows + /* Conceal the NTFS filesystem (by performing an easy-to-undo modification). This will prevent Windows and apps from interfering with the volume until it has been fully encrypted. */ nStatus = ConcealNTFS (dev); @@ -642,7 +642,7 @@ int EncryptPartitionInPlaceBegin (volatile FORMAT_VOL_PARAMETERS *volParams, vol // /* If a drive letter is assigned to the device, remove it (so that users do not try to open it, which //would cause Windows to ask them if they want to format the volume and other dangerous things). */ - //if (driveLetter >= 0) + //if (driveLetter >= 0) //{ // char rootPath[] = { driveLetter + 'A', ':', '\\', 0 }; @@ -796,7 +796,7 @@ int EncryptPartitionInPlaceResume (HANDLE dev, if (dev == INVALID_HANDLE_VALUE) { - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; goto closing_seq; } } @@ -805,7 +805,7 @@ int EncryptPartitionInPlaceResume (HANDLE dev, DeviceIoControl (dev, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, - 0, + 0, NULL, 0, &dwResult, @@ -910,7 +910,7 @@ inplace_enc_read: if (remainingBytes - workChunkSize < TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE) { // We reached the inital portion of the filesystem, which we had concealed (in order to prevent - // Windows from interfering with the volume). Now we need to undo that modification. + // Windows from interfering with the volume). Now we need to undo that modification. for (i = 0; i < TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE - (remainingBytes - workChunkSize); i++) buf[i] ^= TC_NTFS_CONCEAL_CONSTANT; @@ -949,7 +949,7 @@ inplace_enc_read: } EncryptDataUnits (wipeBuffer, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo); - memcpy (wipeRandCharsUpdate, wipeBuffer, sizeof (wipeRandCharsUpdate)); + memcpy (wipeRandCharsUpdate, wipeBuffer, sizeof (wipeRandCharsUpdate)); } if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0 @@ -971,7 +971,7 @@ inplace_enc_read: } } - memcpy (wipeRandChars, wipeRandCharsUpdate, sizeof (wipeRandCharsUpdate)); + memcpy (wipeRandChars, wipeRandCharsUpdate, sizeof (wipeRandCharsUpdate)); } @@ -1164,7 +1164,7 @@ closing_seq: GetSizeString (zeroedSectorCount * sectorSize, sizeStr, sizeof(sizeStr)); - StringCbPrintfW (msg, sizeof(msg), + StringCbPrintfW (msg, sizeof(msg), GetString ("ZEROED_BAD_SECTOR_COUNT"), zeroedSectorCount, sizeStr); @@ -1261,7 +1261,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile if (dev == INVALID_HANDLE_VALUE) { - nStatus = ERR_DONT_REPORT; + nStatus = ERR_DONT_REPORT; goto closing_seq; } @@ -1271,7 +1271,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile DeviceIoControl (dev, FSCTL_ALLOW_EXTENDED_DASD_IO, NULL, - 0, + 0, NULL, 0, &dwResult, @@ -1344,7 +1344,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile switch (AskMultiChoice ((void **) tmpStr, FALSE, hwndDlg)) { case 1: - // NOP + // NOP break; case 2: default: @@ -1475,7 +1475,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile goto closing_seq; } } - + // Decrypt the ciphertext in RAM DecryptDataUnits ((byte *) buf, &unitNo, workChunkSize / ENCRYPTION_DATA_UNIT_SIZE, masterCryptoInfo); @@ -1486,7 +1486,7 @@ int DecryptPartitionInPlace (volatile FORMAT_VOL_PARAMETERS *volParams, volatile if (workChunkStartByteOffset - TC_VOLUME_DATA_OFFSET < TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE) { - // We are decrypting the initial TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE bytes of the filesystem. We will + // We are decrypting the initial TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE bytes of the filesystem. We will // conceal this portion to prevent Windows and applications from interfering with the volume. for (i = 0; i < min (TC_INITIAL_NTFS_CONCEAL_PORTION_SIZE, workChunkStartByteOffset - TC_VOLUME_DATA_OFFSET + workChunkSize); i++) @@ -1821,7 +1821,7 @@ static HANDLE OpenPartitionVolume (HWND hwndDlg, const wchar_t *devName, dev = CreateFile (devName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_WRITE_THROUGH, NULL); if (dev != INVALID_HANDLE_VALUE) { - if (bSharedRequiresConfirmation + if (bSharedRequiresConfirmation && !bSilent && AskWarnNoYes ("DEVICE_IN_USE_INPLACE_ENC", hwndDlg) == IDNO) { @@ -1862,7 +1862,7 @@ static int DismountFileSystem (HWND hwndDlg, HANDLE dev, attempt = UNMOUNT_MAX_AUTO_RETRIES * 10; - while (!(bResult = DeviceIoControl (dev, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &dwResult, NULL)) + while (!(bResult = DeviceIoControl (dev, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &dwResult, NULL)) && attempt > 0) { Sleep (UNMOUNT_AUTO_RETRY_DELAY); @@ -1891,7 +1891,7 @@ static int DismountFileSystem (HWND hwndDlg, HANDLE dev, attempt = UNMOUNT_MAX_AUTO_RETRIES * 10; - while (!(bResult = DeviceIoControl (dev, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &dwResult, NULL)) + while (!(bResult = DeviceIoControl (dev, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0, &dwResult, NULL)) && attempt > 0) { Sleep (UNMOUNT_AUTO_RETRY_DELAY); @@ -1903,14 +1903,14 @@ static int DismountFileSystem (HWND hwndDlg, HANDLE dev, if (!bSilent) ShowInPlaceEncErrMsgWAltSteps (hwndDlg, "INPLACE_ENC_CANT_LOCK_OR_DISMOUNT_FILESYS", TRUE); - return ERR_DONT_REPORT; + return ERR_DONT_REPORT; } - return ERR_SUCCESS; + return ERR_SUCCESS; } -// Easy-to-undo modification applied to conceal the NTFS filesystem (to prevent Windows and apps from +// Easy-to-undo modification applied to conceal the NTFS filesystem (to prevent Windows and apps from // interfering with it until the volume has been fully encrypted). Note that this function will precisely // undo any modifications it made to the filesystem automatically if an error occurs when writing (including // physical drive defects). @@ -1923,7 +1923,7 @@ static int ConcealNTFS (HANDLE dev) DWORD dwError; offset.QuadPart = 0; - + if (SetFilePointerEx (dev, offset, NULL, FILE_BEGIN) == 0) return ERR_OS_ERROR; @@ -2018,20 +2018,20 @@ BOOL SaveNonSysInPlaceEncSettings (int delta, WipeAlgorithmId newWipeAlgorithm, StringCbPrintfA (str, sizeof(str), "%d", (int) newWipeAlgorithm); SaveBufferToFile (str, GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE), (DWORD) strlen(str), FALSE, FALSE); - } + } else if (FileExists (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE))) { _wremove (GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC_WIPE)); } } - + StringCbPrintfA (str, sizeof(str), "%d", count); return SaveBufferToFile (str, GetConfigPath (TC_APPD_FILENAME_NONSYS_INPLACE_ENC), (DWORD) strlen(str), FALSE, FALSE); } -// Repairs damaged sectors (i.e. those with read errors) by zeroing them. +// Repairs damaged sectors (i.e. those with read errors) by zeroing them. // Note that this operating fails if there are any write errors. int ZeroUnreadableSectors (HANDLE dev, LARGE_INTEGER startOffset, int64 size, int sectorSize, uint64 *zeroedSectorCount) { @@ -2179,7 +2179,7 @@ static BOOL GetFreeClusterBeforeThreshold (HANDLE volumeHandle, int64 *freeClust startLcn.StartingLcn.QuadPart += min (bitmapSize * 8, bitmap->BitmapSize.QuadPart); } - + err: SetLastError (ERROR_DISK_FULL); return FALSE; diff --git a/src/Format/InPlace.h b/src/Format/InPlace.h index 75cb9e94..ed24cb89 100644 --- a/src/Format/InPlace.h +++ b/src/Format/InPlace.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Format/Resource.h b/src/Format/Resource.h index c407a7f6..1bdc2f5c 100644 --- a/src/Format/Resource.h +++ b/src/Format/Resource.h @@ -147,7 +147,7 @@ #define IDC_SKIP_RESCUE_VERIFICATION 1108 // Next default values for new objects -// +// #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 diff --git a/src/Format/Tcformat.c b/src/Format/Tcformat.c index 2065cb5f..bb479395 100644 --- a/src/Format/Tcformat.c +++ b/src/Format/Tcformat.c @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source @@ -127,7 +127,7 @@ enum sys_encryption_cmd_line_switches SYSENC_COMMAND_CREATE_HIDDEN_OS_ELEV }; -typedef struct +typedef struct { int NumberOfSysDrives; // Number of drives that contain an operating system. -1: unknown, 1: one, 2: two or more int MultipleSystemsOnDrive; // Multiple systems are installed on the drive where the currently running system resides. -1: unknown, 0: no, 1: yes @@ -139,7 +139,7 @@ typedef struct #define SYSENC_PAUSE_RETRY_INTERVAL 100 #define SYSENC_PAUSE_RETRIES 200 -// Expected duration of system drive analysis, in ms +// Expected duration of system drive analysis, in ms #define SYSENC_DRIVE_ANALYSIS_ETA (4*60000) BootEncryption *BootEncObj = NULL; @@ -219,8 +219,8 @@ volatile HWND hVerifyPasswordInputField = NULL; /* Verify-password input field HBITMAP hbmWizardBitmapRescaled = NULL; wchar_t OrigKeyboardLayout [8+1] = L"00000409"; -BOOL bKeyboardLayoutChanged = FALSE; /* TRUE if the keyboard layout was changed to the standard US keyboard layout (from any other layout). */ -BOOL bKeybLayoutAltKeyWarningShown = FALSE; /* TRUE if the user has been informed that it is not possible to type characters by pressing keys while the right Alt key is held down. */ +BOOL bKeyboardLayoutChanged = FALSE; /* TRUE if the keyboard layout was changed to the standard US keyboard layout (from any other layout). */ +BOOL bKeybLayoutAltKeyWarningShown = FALSE; /* TRUE if the user has been informed that it is not possible to type characters by pressing keys while the right Alt key is held down. */ #ifndef _DEBUG BOOL bWarnDeviceFormatAdvanced = TRUE; @@ -277,7 +277,7 @@ BOOL bDisplayPoolContents = TRUE; volatile BOOL bSparseFileSwitch = FALSE; volatile BOOL quickFormat = FALSE; /* WARNING: Meaning of this variable depends on bSparseFileSwitch. If bSparseFileSwitch is TRUE, this variable represents the sparse file flag. */ -volatile int fileSystem = FILESYS_NONE; +volatile int fileSystem = FILESYS_NONE; volatile int clusterSize = 0; SYSENC_MULTIBOOT_CFG SysEncMultiBootCfg; @@ -286,7 +286,7 @@ volatile int NonSysInplaceEncStatus = NONSYS_INPLACE_ENC_STATUS_NONE; vector <HostDevice> DeferredNonSysInPlaceEncDevices; -// specific definitions and implementation for support of resume operation +// specific definitions and implementation for support of resume operation // in wait dialog mechanism void CALLBACK ResumeInPlaceEncWaitThreadProc(void* pArg, HWND hwndDlg) @@ -384,7 +384,7 @@ static BOOL ElevateWholeWizardProcess (wstring arguments) while (true) { if ((int)ShellExecute (MainDlg, L"runas", modPath, (wstring(L"/q UAC ") + arguments).c_str(), NULL, SW_SHOWNORMAL) > 32) - { + { exit (0); } else @@ -452,7 +452,7 @@ static void localcleanup (void) } CloseNonSysInplaceEncMutex (); - + // Device wipe @@ -608,7 +608,7 @@ static unsigned int DetermineHiddenOSCreationPhase (void) // IMPORTANT: This function may be called only by Format (other modules can only _read_ the status). // Returns TRUE if successful (otherwise FALSE) -static BOOL ChangeHiddenOSCreationPhase (int newPhase) +static BOOL ChangeHiddenOSCreationPhase (int newPhase) { if (!CreateSysEncMutex ()) { @@ -676,7 +676,7 @@ static BOOL ChangeSystemEncryptionStatus (int newStatus) // may be called only after CreateSysEncMutex() returns TRUE. It returns TRUE if successful (otherwise FALSE). static BOOL ChangeWizardMode (int newWizardMode) { - if (WizardMode != newWizardMode) + if (WizardMode != newWizardMode) { if (WizardMode == WIZARD_MODE_SYS_DEVICE || newWizardMode == WIZARD_MODE_SYS_DEVICE) { @@ -692,7 +692,7 @@ static BOOL ChangeWizardMode (int newWizardMode) // If the previous mode was different, the password may have been typed using a different // keyboard layout (which might confuse the user and cause other problems if system encryption // was or will be involved). - WipePasswordsAndKeyfiles(); + WipePasswordsAndKeyfiles(); } if (newWizardMode != WIZARD_MODE_NONSYS_DEVICE) @@ -719,10 +719,10 @@ static BOOL ChangeWizardMode (int newWizardMode) bDevice = (WizardMode != WIZARD_MODE_FILE_CONTAINER); - if (newWizardMode != WIZARD_MODE_SYS_DEVICE + if (newWizardMode != WIZARD_MODE_SYS_DEVICE && !bHiddenOS) { - CloseSysEncMutex (); + CloseSysEncMutex (); } return TRUE; @@ -730,7 +730,7 @@ static BOOL ChangeWizardMode (int newWizardMode) // Determines whether the wizard directly affects system encryption in any way. // Note, for example, that when the user enters a password for a hidden volume that is to host a hidden OS, -// WizardMode is NOT set to WIZARD_MODE_SYS_DEVICE. The keyboard layout, however, has to be US. That's why +// WizardMode is NOT set to WIZARD_MODE_SYS_DEVICE. The keyboard layout, however, has to be US. That's why // this function has to be called instead of checking the value of WizardMode. static BOOL SysEncInEffect (void) { @@ -740,7 +740,7 @@ static BOOL SysEncInEffect (void) static BOOL CreatingHiddenSysVol (void) { - return (bHiddenOS + return (bHiddenOS && bHiddenVol && !bHiddenVolHost); } @@ -791,7 +791,7 @@ static void LoadSettingsAndCheckModified (HWND hwndDlg, BOOL bOnlyCheckModified, StringCbCopyA (langid, sizeof(langid), "en"); if (pbSettingsModified && strcmp (langid, GetPreferredLangId ())) - *pbSettingsModified = TRUE; + *pbSettingsModified = TRUE; } else { @@ -858,7 +858,7 @@ static void EndMainDlg (HWND hwndDlg) MoveEditToCombo (GetDlgItem (hCurPage, IDC_COMBO_BOX), bHistory); SaveSettings (hCurPage); } - else + else { SaveSettings (NULL); } @@ -889,10 +889,10 @@ static BOOL SysEncryptionOrDecryptionRequired (void) return (SystemEncryptionStatus == SYSENC_STATUS_ENCRYPTING || SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING - || + || ( - locBootEncStatus.DriveMounted - && + locBootEncStatus.DriveMounted + && ( locBootEncStatus.ConfiguredEncryptedAreaStart != locBootEncStatus.EncryptedAreaStart || locBootEncStatus.ConfiguredEncryptedAreaEnd != locBootEncStatus.EncryptedAreaEnd @@ -963,7 +963,7 @@ BOOL SwitchWizardToSysEncMode (void) // The config file with status was lost or not written correctly if (!ResolveUnknownSysEncDirection ()) { - CloseSysEncMutex (); + CloseSysEncMutex (); NormalCursor (); return FALSE; } @@ -977,7 +977,7 @@ BOOL SwitchWizardToSysEncMode (void) } else { - CloseSysEncMutex (); + CloseSysEncMutex (); Error ("SYS_ENCRYPTION_OR_DECRYPTION_IN_PROGRESS", MainDlg); NormalCursor (); return FALSE; @@ -996,11 +996,11 @@ BOOL SwitchWizardToSysEncMode (void) { // If the config file with status was lost or not written correctly, we // don't know whether to encrypt or decrypt (but we know that encryption or - // decryption is required). Ask the user to select encryption, decryption, + // decryption is required). Ask the user to select encryption, decryption, // or cancel if (!ResolveUnknownSysEncDirection ()) { - CloseSysEncMutex (); + CloseSysEncMutex (); NormalCursor (); return FALSE; } @@ -1014,7 +1014,7 @@ BOOL SwitchWizardToSysEncMode (void) } else { - CloseSysEncMutex (); + CloseSysEncMutex (); Error ("SETUP_FAILED_BOOT_DRIVE_ENCRYPTED", MainDlg); NormalCursor (); return FALSE; @@ -1038,7 +1038,7 @@ BOOL SwitchWizardToSysEncMode (void) } catch (Exception &e) { - CloseSysEncMutex (); + CloseSysEncMutex (); e.Show (MainDlg); NormalCursor (); return FALSE; @@ -1089,7 +1089,7 @@ BOOL SwitchWizardToSysEncMode (void) Warning ("WDE_EXTENDED_PARTITIONS_WARNING", MainDlg); } } - else if (BootEncObj->SystemPartitionCoversWholeDrive() + else if (BootEncObj->SystemPartitionCoversWholeDrive() && !bWholeSysDrive) bWholeSysDrive = (AskYesNo ("WHOLE_SYC_DEVICE_RECOM", MainDlg) == IDYES); } @@ -1104,7 +1104,7 @@ BOOL SwitchWizardToSysEncMode (void) if (!bHiddenVol) { // Skip SYSENC_SPAN_PAGE and SYSENC_TYPE_PAGE as the user already made the choice - LoadPage (MainDlg, bWholeSysDrive ? SYSENC_PRE_DRIVE_ANALYSIS_PAGE : SYSENC_MULTI_BOOT_MODE_PAGE); + LoadPage (MainDlg, bWholeSysDrive ? SYSENC_PRE_DRIVE_ANALYSIS_PAGE : SYSENC_MULTI_BOOT_MODE_PAGE); } else { @@ -1162,7 +1162,7 @@ BOOL SwitchWizardToHiddenOSMode (void) if (bDirectSysEncModeCommand == SYSENC_COMMAND_CREATE_HIDDEN_OS_ELEV) { // Some of the requirements for hidden OS should have already been checked by the wizard process - // that launched us (in order to elevate), but we must recheck them. Otherwise, an advanced user + // that launched us (in order to elevate), but we must recheck them. Otherwise, an advanced user // could bypass the checks by using the undocumented CLI switch. Moreover, some requirements // can be checked only at this point (when we are elevated). try @@ -1299,7 +1299,7 @@ static BOOL ResolveUnknownSysEncDirection (void) } // This function should be used to resolve inconsistencies that might lead to a deadlock (inability to encrypt or -// decrypt the system partition/drive and to uninstall TrueCrypt). The function removes the system encryption key +// decrypt the system partition/drive and to uninstall TrueCrypt). The function removes the system encryption key // data ("volume header"), the TrueCrypt boot loader, restores the original system loader (if available), // unregisters the boot driver, etc. Note that if the system partition/drive is encrypted, it will start decrypting // it in the background (therefore, it should be used when the system partition/drive is not encrypted, ideally). @@ -1322,7 +1322,7 @@ static BOOL ForceRemoveSysEnc (void) if (locBootEncStatus.DriveMounted) { // Remove the header - BootEncObj->StartDecryption (DiscardUnreadableEncryptedSectors); + BootEncObj->StartDecryption (DiscardUnreadableEncryptedSectors); locBootEncStatus = BootEncObj->GetStatus(); while (locBootEncStatus.SetupInProgress) @@ -1403,7 +1403,7 @@ void ComboSelChangeEA (HWND hwndDlg) else if (wcscmp (name, L"Serpent") == 0) { StringCbPrintfW (hyperLink, sizeof(hyperLink) / 2, GetString ("MORE_INFO_ABOUT"), name); - + SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SERPENT_HELP")); } else if (wcscmp (name, L"Twofish") == 0) @@ -1419,13 +1419,13 @@ void ComboSelChangeEA (HWND hwndDlg) while (i = EAGetPreviousCipher(nIndex, i)) { cipherIDs[cnt] = i; - cnt++; + cnt++; } switch (cnt) // Number of ciphers in the cascade { case 2: - StringCbPrintfW (auxLine, sizeof(auxLine), GetString ("TWO_LAYER_CASCADE_HELP"), + StringCbPrintfW (auxLine, sizeof(auxLine), GetString ("TWO_LAYER_CASCADE_HELP"), CipherGetName (cipherIDs[1]), CipherGetKeySize (cipherIDs[1])*8, CipherGetName (cipherIDs[0]), @@ -1433,7 +1433,7 @@ void ComboSelChangeEA (HWND hwndDlg) break; case 3: - StringCbPrintfW (auxLine, sizeof(auxLine), GetString ("THREE_LAYER_CASCADE_HELP"), + StringCbPrintfW (auxLine, sizeof(auxLine), GetString ("THREE_LAYER_CASCADE_HELP"), CipherGetName (cipherIDs[2]), CipherGetKeySize (cipherIDs[2])*8, CipherGetName (cipherIDs[1]), @@ -1538,7 +1538,7 @@ static void VerifySizeAndUpdate (HWND hwndDlg, BOOL bUpdate) { // Change of volume size may make some file systems allowed or disallowed, so the default filesystem must // be reselected. - fileSystem = FILESYS_NONE; + fileSystem = FILESYS_NONE; nLastVolumeSize = nVolumeSize; } } @@ -1648,7 +1648,7 @@ static void UpdateSysEncProgressBar (void) return; } - if (locBootEncStatus.EncryptedAreaEnd == -1 + if (locBootEncStatus.EncryptedAreaEnd == -1 || locBootEncStatus.EncryptedAreaStart == -1) { UpdateProgressBarProc (0); @@ -1688,11 +1688,11 @@ static void InitSysEncProgressBar (void) return; } - if (locBootEncStatus.ConfiguredEncryptedAreaEnd == -1 + if (locBootEncStatus.ConfiguredEncryptedAreaEnd == -1 || locBootEncStatus.ConfiguredEncryptedAreaStart == -1) return; - InitProgressBar (locBootEncStatus.ConfiguredEncryptedAreaEnd + InitProgressBar (locBootEncStatus.ConfiguredEncryptedAreaEnd - locBootEncStatus.ConfiguredEncryptedAreaStart + 1, (locBootEncStatus.EncryptedAreaEnd == locBootEncStatus.EncryptedAreaStart || locBootEncStatus.EncryptedAreaEnd == -1) ? 0 : locBootEncStatus.EncryptedAreaEnd - locBootEncStatus.EncryptedAreaStart + 1, @@ -1715,8 +1715,8 @@ static void UpdateSysEncControls (void) return; } - EnableWindow (GetDlgItem (hCurPage, IDC_WIPE_MODE), - !locBootEncStatus.SetupInProgress + EnableWindow (GetDlgItem (hCurPage, IDC_WIPE_MODE), + !locBootEncStatus.SetupInProgress && SystemEncryptionStatus == SYSENC_STATUS_ENCRYPTING); SetWindowTextW (GetDlgItem (hCurPage, IDC_PAUSE), @@ -1808,7 +1808,7 @@ static void SysEncPause (void) Error ("FAILED_TO_INTERRUPT_SYSTEM_ENCRYPTION", MainDlg); return; } - + UpdateSysEncControls (); EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), TRUE); } @@ -1859,13 +1859,13 @@ static void SysEncResume (void) { case SYSENC_STATUS_ENCRYPTING: - BootEncObj->StartEncryption (nWipeMode, bTryToCorrectReadErrors ? true : false); + BootEncObj->StartEncryption (nWipeMode, bTryToCorrectReadErrors ? true : false); break; case SYSENC_STATUS_DECRYPTING: if (locBootEncStatus.DriveMounted) // If the drive is not encrypted we will just deinstall - BootEncObj->StartDecryption (DiscardUnreadableEncryptedSectors); + BootEncObj->StartDecryption (DiscardUnreadableEncryptedSectors); break; } @@ -1920,13 +1920,13 @@ static BOOL GetDevicePathForHiddenOS (void) return FALSE; } - return (szFileName[0] != 0 - && szDiskFile[0] != 0 + return (szFileName[0] != 0 + && szDiskFile[0] != 0 && tmpbDevice); } -// Returns TRUE if there is unallocated space greater than 64 MB (max possible slack space size) between the +// Returns TRUE if there is unallocated space greater than 64 MB (max possible slack space size) between the // boot partition and the first partition behind it. If there's none or if an error occurs, returns FALSE. static BOOL CheckGapBetweenSysAndHiddenOS (void) { @@ -1934,7 +1934,7 @@ static BOOL CheckGapBetweenSysAndHiddenOS (void) { SystemDriveConfiguration sysDriveCfg = BootEncObj->GetSystemDriveConfiguration(); - return (sysDriveCfg.SystemPartition.Info.StartingOffset.QuadPart + return (sysDriveCfg.SystemPartition.Info.StartingOffset.QuadPart + sysDriveCfg.SystemPartition.Info.PartitionLength.QuadPart + 64 * BYTES_PER_MB + 128 * BYTES_PER_KB @@ -1956,7 +1956,7 @@ static void NonSysInplaceEncPause (void) WaitCursor (); int waitThreshold = 100; // Do not block GUI events for more than 10 seconds. IMPORTANT: This prevents deadlocks when the thread calls us back e.g. to update GUI! - + while (bVolTransformThreadRunning || bVolTransformThreadToRun) { MSG guiMsg; @@ -2071,15 +2071,15 @@ void UpdateNonSysInPlaceEncControls (void) lastbInPlaceEncNonSysResumed = bInPlaceEncNonSysResumed; } - EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), bFirstNonSysInPlaceEncResumeDone + EnableWindow (GetDlgItem (hCurPage, IDC_PAUSE), bFirstNonSysInPlaceEncResumeDone && NonSysInplaceEncStatus != NONSYS_INPLACE_ENC_STATUS_FINALIZING && NonSysInplaceEncStatus != NONSYS_INPLACE_ENC_STATUS_FINISHED); EnableWindow (GetDlgItem (MainDlg, IDC_NEXT), !(bVolTransformThreadRunning || bVolTransformThreadToRun) && !bFirstNonSysInPlaceEncResumeDone); EnableWindow (GetDlgItem (MainDlg, IDC_PREV), !(bVolTransformThreadRunning || bVolTransformThreadToRun) && !bInPlaceEncNonSysResumed); - EnableWindow (GetDlgItem (MainDlg, IDCANCEL), - !(bVolTransformThreadToRun - || NonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_PREPARING + EnableWindow (GetDlgItem (MainDlg, IDCANCEL), + !(bVolTransformThreadToRun + || NonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_PREPARING || NonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_RESIZING || NonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_FINALIZING || NonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_FINISHED)); @@ -2132,7 +2132,7 @@ static void UpdateNonSysInplaceEncProgressBar (void) int nonSysInplaceEncStatus = NonSysInplaceEncStatus; __int64 totalSize = NonSysInplaceEncTotalSize; - if (bVolTransformThreadRunning + if (bVolTransformThreadRunning && (nonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_ENCRYPTING || nonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_DECRYPTING || nonSysInplaceEncStatus == NONSYS_INPLACE_ENC_STATUS_FINALIZING @@ -2181,7 +2181,7 @@ static void InitNonSysInplaceEncProgressBar (void) void DisplayRandPool (HWND hwndDlg, HWND hPoolDisplay, BOOL bShow) -{ +{ wchar_t tmp[4]; unsigned char tmpByte; int col, row; @@ -2209,7 +2209,7 @@ void DisplayRandPool (HWND hwndDlg, HWND hPoolDisplay, BOOL bShow) else if (bUseMask) { /* use mask to compute a randomized ASCII representation */ - tmpByte = (randPool[row * RANDPOOL_DISPLAY_COLUMNS + col] - + tmpByte = (randPool[row * RANDPOOL_DISPLAY_COLUMNS + col] - lastRandPool[row * RANDPOOL_DISPLAY_COLUMNS + col]) ^ maskRandPool [row * RANDPOOL_DISPLAY_COLUMNS + col]; tmp[0] = (wchar_t) (((tmpByte >> 4) % 6) + L'*'); tmp[1] = (wchar_t) (((tmpByte & 0x0F) % 6) + L'*'); @@ -2248,8 +2248,8 @@ static void WipeAbort (void) if (bHiddenOS && IsHiddenOSRunning()) { - /* Decoy system partition wipe */ - + /* Decoy system partition wipe */ + DecoySystemWipeStatus decoySysPartitionWipeStatus; try @@ -2328,7 +2328,7 @@ static void WipeStart (void) try { - BootEncObj->StartDecoyOSWipe (nWipeMode); + BootEncObj->StartDecoyOSWipe (nWipeMode); bDeviceWipeInProgress = TRUE; } @@ -2407,7 +2407,7 @@ static void InitWipeProgressBar (void) return; } - if (BootEncStatus.ConfiguredEncryptedAreaEnd == -1 + if (BootEncStatus.ConfiguredEncryptedAreaEnd == -1 || BootEncStatus.ConfiguredEncryptedAreaStart == -1) return; @@ -2510,7 +2510,7 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg) int nStatus; DWORD dwWin32FormatError; BOOL bHidden; - HWND hwndDlg = (HWND) hwndDlgArg; + HWND hwndDlg = (HWND) hwndDlgArg; volatile FORMAT_VOL_PARAMETERS *volParams = (FORMAT_VOL_PARAMETERS *) malloc (sizeof(FORMAT_VOL_PARAMETERS)); if (volParams == NULL) @@ -2785,7 +2785,7 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg) // NOP - Final steps for in-place decryption are handled with the TC_APPMSG_NONSYS_INPLACE_ENC_FINISHED message. } } - else + else { Info("FORMAT_FINISHED_INFO", hwndDlg); @@ -2797,7 +2797,7 @@ static void __cdecl volTransformThreadFunction (void *hwndDlgArg) { /* We've just created an outer volume (to host a hidden volume within) */ - bHiddenVolHost = FALSE; + bHiddenVolHost = FALSE; bHiddenVolFinished = FALSE; nHiddenVolHostSize = nVolumeSize; @@ -2872,15 +2872,15 @@ static void LoadPage (HWND hwndDlg, int nPageNo) if (hCurPage != NULL) { // WARNING: nCurPageNo must be set to a non-existent ID here before wiping the password fields below in - // this function, etc. Otherwise, such actions (SetWindowText) would invoke the EN_CHANGE handlers, which - // would, if keyfiles were applied, e.g. use strlen() on a buffer full of random data, in most cases + // this function, etc. Otherwise, such actions (SetWindowText) would invoke the EN_CHANGE handlers, which + // would, if keyfiles were applied, e.g. use strlen() on a buffer full of random data, in most cases // not null-terminated. nCurPageNo = -1; // Place here any actions that need to be performed at the latest possible time when leaving a wizard page // (i.e. right before "destroying" the page). Also, code that needs to be executed both on IDC_NEXT and - // on IDC_PREV can be placed here so as to avoid code doubling. + // on IDC_PREV can be placed here so as to avoid code doubling. switch (nLastPageNo) { @@ -2888,7 +2888,7 @@ static void LoadPage (HWND hwndDlg, int nPageNo) { wchar_t tmp[MAX_PASSWORD+1]; - // Attempt to wipe passwords stored in the input field buffers. This is performed here (and + // Attempt to wipe passwords stored in the input field buffers. This is performed here (and // not in the IDC_PREV or IDC_NEXT sections) in order to prevent certain race conditions // when keyfiles are used. wmemset (tmp, 'X', MAX_PASSWORD); @@ -2980,7 +2980,7 @@ static void LoadPage (HWND hwndDlg, int nPageNo) EnableWindow (GetDlgItem(hCurPage, IDC_NO_HISTORY), !bHistoryCmdLine); - EnableWindow (GetDlgItem (hwndDlg, IDC_NEXT), + EnableWindow (GetDlgItem (hwndDlg, IDC_NEXT), GetWindowTextLength (GetDlgItem (hCurPage, IDC_COMBO_BOX)) > 0); break; @@ -3122,7 +3122,7 @@ static void LoadPage (HWND hwndDlg, int nPageNo) MoveWindow (hCurPage, rD.left, rD.top, rW.right - rW.left, rW.bottom - rW.top, TRUE); ShowWindow (hCurPage, SW_SHOWNORMAL); - // Place here any message boxes that need to be displayed as soon as a new page is displayed. This + // Place here any message boxes that need to be displayed as soon as a new page is displayed. This // ensures that the page is fully rendered (otherwise it would remain blank, until the message box // is closed). switch (nPageNo) @@ -3200,7 +3200,7 @@ __int64 PrintFreeSpace (HWND hwndTextBox, wchar_t *lpszDrive, PLARGE_INTEGER lDi else nResourceString = "DISK_FREE_GB"; } - else + else { if (bHiddenVol && !bHiddenVolHost) // If it's a hidden volume nResourceString = "MAX_HIDVOL_SIZE_TB"; @@ -3545,7 +3545,7 @@ static BOOL FinalPreTransformPrompts (void) switch (AskMultiChoice ((void **) tmpStr, TRUE, MainDlg)) { case 1: - // Proceed + // Proceed // NOP break; @@ -4012,7 +4012,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa else { // The hidden volume must be as large as the system partition - nVolumeSize = GetSystemPartitionSize() + TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE_HIGH; + nVolumeSize = GetSystemPartitionSize() + TC_HIDDEN_VOLUME_HOST_FS_RESERVED_END_AREA_SIZE_HIGH; SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("HIDDEN_OS_PRE_CIPHER_HELP")); } @@ -4062,7 +4062,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa // For now, we keep RIPEMD160 for system encryption if (((hid == RIPEMD160) || !HashIsDeprecated (hid)) && HashForSystemEncryption (hid)) AddComboPair (GetDlgItem (hwndDlg, IDC_COMBO_BOX_HASH_ALGO), HashGetName(hid), hid); - } + } } else { @@ -4239,7 +4239,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa wchar_t str[1000]; hPasswordInputField = GetDlgItem (hwndDlg, IDC_PASSWORD); - hVerifyPasswordInputField = GetDlgItem (hwndDlg, IDC_VERIFY); + hVerifyPasswordInputField = GetDlgItem (hwndDlg, IDC_VERIFY); if (SysEncInEffect ()) { @@ -4292,7 +4292,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetPassword (hwndDlg, IDC_VERIFY, szVerify); SetFocus (GetDlgItem (hwndDlg, IDC_PASSWORD)); - + SetCheckBox (hwndDlg, IDC_PIM_ENABLE, PimEnable); SetCheckBox (hwndDlg, IDC_KEYFILES_ENABLE, KeyFilesEnable && !SysEncInEffect()); @@ -4515,7 +4515,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("WIPE_MODE_TITLE")); SetWindowTextW (GetDlgItem (hwndDlg, IDT_WIPE_MODE_INFO), GetString ("INPLACE_ENC_WIPE_MODE_INFO")); - PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), + PopulateWipeModeCombo (GetDlgItem (hwndDlg, IDC_WIPE_MODE), SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING && !bInPlaceEncNonSys, TRUE, FALSE); @@ -4548,7 +4548,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa try { StringCbPrintfW (finalMsg, sizeof(finalMsg), - GetString ("SYS_ENCRYPTION_PRETEST_INFO"), + GetString ("SYS_ENCRYPTION_PRETEST_INFO"), BootEncObj->GetSystemDriveConfiguration().DriveNumber); } catch (Exception &e) @@ -4656,12 +4656,12 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_PREV), TRUE); EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), FALSE); - + foreach (const HostDevice &device, DeferredNonSysInPlaceEncDevices) { SendMessage (GetDlgItem (hwndDlg, IDC_LIST_BOX), LB_ADDSTRING, 0, (LPARAM) device.Path.c_str()); } - + // Deselect all SendMessage (GetDlgItem (hwndDlg, IDC_LIST_BOX), LB_SETCURSEL, (WPARAM) -1, 0); } @@ -4744,14 +4744,14 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDCANCEL), GetString ("CANCEL")); - // The Cancel button and the X button must be disabled to prevent the user from forgetting to assign a drive letter to the partition by closing + // The Cancel button and the X button must be disabled to prevent the user from forgetting to assign a drive letter to the partition by closing // the window accidentally or clicking Cancel. The user is forced to click Finish to assign at least the pre-selected free drive letter. // This is critical because inexperienced users would not know how to access data on the decrypted volume without a drive letter. EnableWindow (GetDlgItem (GetParent (hwndDlg), IDCANCEL), FALSE); DisableCloseButton (MainDlg); bConfirmQuit = TRUE; // Alt-F4 will still work but the user will be prompted to confirm the action. - // Decryption of non-system volume finished, no drive letter is assigned to the decrypted volume, and free drive letters are available. + // Decryption of non-system volume finished, no drive letter is assigned to the decrypted volume, and free drive letters are available. // This is critical because inexperienced users would not know how to access data on the decrypted volume. We cannot allow exit // until a drive letter is freed up and assigned to the decrypted volume. @@ -4900,7 +4900,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa uint64 dataAreaSize = GetVolumeDataAreaSize (bHiddenVol && !bHiddenVolHost, nVolumeSize); - if (!CreatingHiddenSysVol()) + if (!CreatingHiddenSysVol()) { if (dataAreaSize >= TC_MIN_NTFS_FS_SIZE && dataAreaSize <= TC_MAX_NTFS_FS_SIZE) { @@ -4987,14 +4987,14 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa // Determine the maximum recommended total size of files that can be copied to the outer volume // while leaving enough space for the hidden volume, which must contain a clone of the OS - maxRecomOuterVolFillSize = nVolumeSize - GetSystemPartitionSize(); + maxRecomOuterVolFillSize = nVolumeSize - GetSystemPartitionSize(); // -50% reserve for filesystem "peculiarities" - maxRecomOuterVolFillSize /= 2; + maxRecomOuterVolFillSize /= 2; StringCbPrintfW (szMaxRecomOuterVolFillSize, sizeof(szMaxRecomOuterVolFillSize), L"%I64d %s", maxRecomOuterVolFillSize / BYTES_PER_MB, GetString ("MB")); - StringCbPrintfW (msg, sizeof(msg), GetString ("HIDVOL_HOST_FILLING_HELP_SYSENC"), hiddenVolHostDriveNo + 'A', szMaxRecomOuterVolFillSize); + StringCbPrintfW (msg, sizeof(msg), GetString ("HIDVOL_HOST_FILLING_HELP_SYSENC"), hiddenVolHostDriveNo + 'A', szMaxRecomOuterVolFillSize); } else StringCbPrintfW (msg, sizeof(msg), GetString ("HIDVOL_HOST_FILLING_HELP"), hiddenVolHostDriveNo + 'A'); @@ -5002,7 +5002,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), msg); SetWindowTextW (GetDlgItem (GetParent (hwndDlg), IDC_BOX_TITLE), GetString ("HIDVOL_HOST_FILLING_TITLE")); } - else + else { if (bHiddenOS) SetWindowTextW (GetDlgItem (hwndDlg, IDC_BOX_HELP), GetString ("SYSENC_HIDDEN_VOL_FORMAT_FINISHED_HELP")); @@ -5307,7 +5307,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (hw == CBN_SELCHANGE) { nWipeMode = (WipeAlgorithmId) SendMessage (GetDlgItem (hCurPage, IDC_WIPE_MODE), - CB_GETITEMDATA, + CB_GETITEMDATA, SendMessage (GetDlgItem (hCurPage, IDC_WIPE_MODE), CB_GETCURSEL, 0, 0), 0); @@ -5327,7 +5327,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { case NONSYS_INPLACE_ENC_RESUME_PARTITION_SEL_PAGE: - if (lw == IDC_LIST_BOX + if (lw == IDC_LIST_BOX && (hw == LBN_SELCHANGE || hw == LBN_DBLCLK)) { BOOL tmpbDevice = FALSE; @@ -5385,7 +5385,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (hw == CBN_SELCHANGE) { nWipeMode = (WipeAlgorithmId) SendMessage (GetDlgItem (hCurPage, IDC_WIPE_MODE), - CB_GETITEMDATA, + CB_GETITEMDATA, SendMessage (GetDlgItem (hCurPage, IDC_WIPE_MODE), CB_GETCURSEL, 0, 0), 0); @@ -5428,7 +5428,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa for (c = EAGetLastCipher (nVolumeEA); c != 0; c = EAGetPreviousCipher (nVolumeEA, c)) { - DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_CIPHER_TEST_DLG), + DialogBoxParamW (hInst, MAKEINTRESOURCEW (IDD_CIPHER_TEST_DLG), GetParent (hwndDlg), (DLGPROC) CipherTestDialogProc, (LPARAM) c); } return 1; @@ -5437,7 +5437,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (lw == IDC_BENCHMARK && nCurPageNo == CIPHER_PAGE) { // Reduce CPU load - bFastPollEnabled = FALSE; + bFastPollEnabled = FALSE; bRandmixEnabled = FALSE; DialogBoxParamW (hInst, @@ -5484,7 +5484,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (hw == CBN_EDITCHANGE && nCurPageNo == VOLUME_LOCATION_PAGE) { - EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), + EnableWindow (GetDlgItem (GetParent (hwndDlg), IDC_NEXT), GetWindowTextLength (GetDlgItem (hCurPage, IDC_COMBO_BOX)) > 0); bDeviceTransformModeChoiceMade = FALSE; @@ -5492,7 +5492,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa return 1; } - + if (hw == CBN_SELCHANGE && nCurPageNo == VOLUME_LOCATION_PAGE) { LPARAM nIndex; @@ -5510,13 +5510,13 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa return 1; } - + if (hw == EN_CHANGE && nCurPageNo == SIZE_PAGE) { VerifySizeAndUpdate (hwndDlg, FALSE); return 1; } - + if (hw == EN_CHANGE && nCurPageNo == PASSWORD_PAGE) { VerifyPasswordAndUpdate (hwndDlg, GetDlgItem (GetParent (hwndDlg), IDC_NEXT), @@ -5581,9 +5581,9 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } return 1; } - - if (nCurPageNo == PASSWORD_PAGE - || nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE + + if (nCurPageNo == PASSWORD_PAGE + || nCurPageNo == HIDDEN_VOL_HOST_PASSWORD_PAGE || nCurPageNo == NONSYS_INPLACE_ENC_RESUME_PASSWORD_PAGE) { if (lw == IDC_KEY_FILES) @@ -5770,7 +5770,7 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa bHiddenVolDirect = FALSE; return 1; } - + if (hw == CBN_SELCHANGE && nCurPageNo == CIPHER_PAGE) { switch (lw) @@ -5803,12 +5803,12 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (bSparseFileSwitch) { if (AskWarnYesNo("CONFIRM_SPARSE_FILE", MainDlg) == IDNO) - SetCheckBox (hwndDlg, IDC_QUICKFORMAT, FALSE); + SetCheckBox (hwndDlg, IDC_QUICKFORMAT, FALSE); } else { if (AskWarnYesNo("WARN_QUICK_FORMAT", MainDlg) == IDNO) - SetCheckBox (hwndDlg, IDC_QUICKFORMAT, FALSE); + SetCheckBox (hwndDlg, IDC_QUICKFORMAT, FALSE); } return 1; } @@ -5830,8 +5830,8 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa SetWindowText (GetDlgItem (hCurPage, IDC_DISK_KEY), showKeys ? L"" : L"******************************** "); return 1; } - - if (lw == IDC_DISPLAY_POOL_CONTENTS + + if (lw == IDC_DISPLAY_POOL_CONTENTS && (nCurPageNo == SYSENC_COLLECTING_RANDOM_DATA_PAGE || nCurPageNo == NONSYS_INPLACE_ENC_RAND_DATA_PAGE)) { showKeys = IsButtonChecked (GetDlgItem (hCurPage, IDC_DISPLAY_POOL_CONTENTS)); @@ -5882,13 +5882,13 @@ BOOL CALLBACK PageDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa return 1; } - if ((nCurPageNo == SYSENC_WIPE_MODE_PAGE - || nCurPageNo == NONSYS_INPLACE_ENC_WIPE_MODE_PAGE + if ((nCurPageNo == SYSENC_WIPE_MODE_PAGE + || nCurPageNo == NONSYS_INPLACE_ENC_WIPE_MODE_PAGE || nCurPageNo == DEVICE_WIPE_MODE_PAGE) && hw == CBN_SELCHANGE) { nWipeMode = (WipeAlgorithmId) SendMessage (GetDlgItem (hCurPage, IDC_WIPE_MODE), - CB_GETITEMDATA, + CB_GETITEMDATA, SendMessage (GetDlgItem (hCurPage, IDC_WIPE_MODE), CB_GETCURSEL, 0, 0), 0); @@ -5941,7 +5941,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (IsTrueCryptInstallerRunning()) AbortProcess ("TC_INSTALLER_IS_RUNNING"); - // Resize the bitmap if the user has a non-default DPI + // Resize the bitmap if the user has a non-default DPI if (ScreenDPI != USER_DEFAULT_SCREEN_DPI) { hbmWizardBitmapRescaled = RenderBitmap (MAKEINTRESOURCE (IDB_WIZARD), @@ -6002,7 +6002,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (CmdVolumePassword.Length == 0) AbortProcess ("ERR_PASSWORD_MISSING"); - + if (CmdVolumeFileSize == 0) AbortProcess ("ERR_SIZE_MISSING"); @@ -6056,7 +6056,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa handleWin32Error (hwndDlg, SRC_POS); exit (1); } - + if (CmdSparseFileSwitch) { /* Check if the host file system supports sparse files */ @@ -6098,21 +6098,21 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa dataAreaSize = GetVolumeDataAreaSize (bHiddenVol && !bHiddenVolHost, nVolumeSize); - if ( (fileSystem == FILESYS_NTFS) && + if ( (fileSystem == FILESYS_NTFS) && (dataAreaSize < TC_MIN_NTFS_FS_SIZE || dataAreaSize > TC_MAX_NTFS_FS_SIZE) ) { AbortProcess ("ERR_NTFS_INVALID_VOLUME_SIZE"); } - if ( (fileSystem == FILESYS_EXFAT) && + if ( (fileSystem == FILESYS_EXFAT) && (dataAreaSize < TC_MIN_EXFAT_FS_SIZE || dataAreaSize > TC_MAX_EXFAT_FS_SIZE) ) { AbortProcess ("ERR_EXFAT_INVALID_VOLUME_SIZE"); } - if ( (fileSystem == FILESYS_FAT) && + if ( (fileSystem == FILESYS_FAT) && (dataAreaSize < TC_MIN_FAT_FS_SIZE || dataAreaSize > (TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize())) ) { @@ -6139,7 +6139,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } if (volumePassword.Length > 0) - { + { // Check password length (check also done for outer volume which is not the case in TrueCrypt). if (!CheckPasswordLength (NULL, volumePassword.Length, volumePim, FALSE, Silent, Silent)) { @@ -6159,7 +6159,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { // Availability of in-place encryption (which is pre-selected by default whenever // possible) makes partition-hosted volume creation safer. - bWarnDeviceFormatAdvanced = FALSE; + bWarnDeviceFormatAdvanced = FALSE; } #ifdef _DEBUG @@ -6360,7 +6360,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { e.Show (hwndDlg); } - + ManageStartupSeqWiz (TRUE, L""); ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE); @@ -6499,7 +6499,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (bHiddenOS && IsHiddenOSRunning()) { - // Decoy system partition wipe + // Decoy system partition wipe DecoySystemWipeStatus decoySysPartitionWipeStatus; @@ -6637,7 +6637,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa StringCbCopyW (deviceName, sizeof(deviceName), szDiskFile); - if (GetDiskDeviceDriveLetter (deviceName) < 0) + if (GetDiskDeviceDriveLetter (deviceName) < 0) { // No drive letter is assigned to the device MessageBeep (MB_OK); @@ -6722,7 +6722,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { // System encryption/decryption in progress - if (AskYesNo (SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING ? + if (AskYesNo (SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING ? "SYSTEM_DECRYPTION_DEFER_CONFIRM" : "SYSTEM_ENCRYPTION_DEFER_CONFIRM", MainDlg) == IDYES) { if (nCurPageNo == SYSENC_PRETEST_RESULT_PAGE) @@ -6983,7 +6983,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { if (nMultiBoot > 1) { - // Multi-boot + // Multi-boot if (AskWarnNoYes ("MULTI_BOOT_FOR_ADVANCED_ONLY", hwndDlg) == IDNO) return 1; @@ -7027,7 +7027,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa else if (nMultiBoot <= 1) { // Single-boot (not creating a hidden OS) - + // Skip irrelevant pages nNewPageNo = CIPHER_PAGE - 1; } @@ -7049,13 +7049,13 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { // 2 or more drives contain an OS - SysEncMultiBootCfg.NumberOfSysDrives = 2; + SysEncMultiBootCfg.NumberOfSysDrives = 2; } else if (Get2RadButtonPageAnswer () == 1) { // Only 1 drive contains an OS - SysEncMultiBootCfg.NumberOfSysDrives = 1; + SysEncMultiBootCfg.NumberOfSysDrives = 1; if (bWholeSysDrive) { @@ -7236,7 +7236,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } else { - if (CheckFileExtension(szFileName) + if (CheckFileExtension(szFileName) && AskWarnNoYes ("EXE_FILE_EXTENSION_CONFIRM", hwndDlg) == IDNO) { NormalCursor (); @@ -7406,7 +7406,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa volumePassword.Length = (unsigned __int32) strlen ((char *) volumePassword.Text); if (volumePassword.Length > 0) - { + { // Password character encoding if (SysEncInEffect () && !CheckPasswordCharEncoding (GetDlgItem (hCurPage, IDC_PASSWORD), NULL)) { @@ -7424,7 +7424,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (!GetPassword (hCurPage, IDC_PASSWORD, szRawPassword, sizeof (szRawPassword), TRUE)) return 1; - if (!SysEncInEffect ()) + if (!SysEncInEffect ()) { if (KeyFilesEnable) { @@ -7447,7 +7447,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (bKeyboardLayoutChanged) { // Restore the original keyboard layout - if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL) + if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL) Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT", hwndDlg); else bKeyboardLayoutChanged = FALSE; @@ -7461,7 +7461,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa nNewPageNo = PIM_PAGE; volumePim = 0; - if (SysEncInEffect ()) + if (SysEncInEffect ()) { nNewPageNo = SYSENC_COLLECTING_RANDOM_DATA_PAGE - 1; // Skip irrelevant pages } @@ -7471,7 +7471,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa nNewPageNo = NONSYS_INPLACE_ENC_RAND_DATA_PAGE - 1; // Skip irrelevant pages } else if (WizardMode != WIZARD_MODE_SYS_DEVICE - && !FileSize4GBLimitQuestionNeeded () + && !FileSize4GBLimitQuestionNeeded () || CreatingHiddenSysVol()) // If we're creating a hidden volume for a hidden OS, we don't need to format it with any filesystem (the entire OS will be copied to the hidden volume sector by sector). { nNewPageNo = FORMAT_PAGE - 1; // Skip irrelevant pages @@ -7492,7 +7492,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } if (volumePassword.Length > 0) - { + { // Password character encoding if (SysEncInEffect() && (volumePim > MAX_BOOT_PIM_VALUE)) { @@ -7507,7 +7507,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } } - if (SysEncInEffect ()) + if (SysEncInEffect ()) { nNewPageNo = SYSENC_COLLECTING_RANDOM_DATA_PAGE - 1; // Skip irrelevant pages @@ -7518,7 +7518,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa nNewPageNo = NONSYS_INPLACE_ENC_RAND_DATA_PAGE - 1; // Skip irrelevant pages } else if (WizardMode != WIZARD_MODE_SYS_DEVICE - && !FileSize4GBLimitQuestionNeeded () + && !FileSize4GBLimitQuestionNeeded () || CreatingHiddenSysVol()) // If we're creating a hidden volume for a hidden OS, we don't need to format it with any filesystem (the entire OS will be copied to the hidden volume sector by sector). { nNewPageNo = FORMAT_PAGE - 1; // Skip irrelevant pages @@ -7552,7 +7552,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { KeyFilesApply (hwndDlg, &volumePassword, FirstKeyFile, NULL); } - + if (!bInPlaceEncNonSys) { @@ -7598,7 +7598,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa WaitCursor (); - // Verify that the outer volume contains a suitable file system, retrieve cluster size, and + // Verify that the outer volume contains a suitable file system, retrieve cluster size, and // scan the volume bitmap if (!IsAdmin () && IsUacSupported ()) retCode = UacAnalyzeHiddenVolumeHost (hwndDlg, &hiddenVolHostDriveNo, GetVolumeDataAreaSize (FALSE, nHiddenVolHostSize), &realClusterSize, &nbrFreeClusters); @@ -7657,7 +7657,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa { hiddenVolHostDriveNo = -1; - bHiddenVolHost = FALSE; + bHiddenVolHost = FALSE; bHiddenVolFinished = FALSE; // Clear the outer volume password @@ -7682,7 +7682,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa /* Scan all available partitions to discover all partitions where non-system in-place encryption/decryption has been interrupted. */ - BOOL tmpbDevice; + BOOL tmpbDevice; NormalCursor (); @@ -7716,14 +7716,14 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa } else { - /* Try to mount the non-system volume to decrypt in place (the process has not started yet, we are NOT trying to resume it). + /* Try to mount the non-system volume to decrypt in place (the process has not started yet, we are NOT trying to resume it). We will try to mount it using the backup header, which we require to work (i.e. be non-damaged) before we start writing - to the volume (the primary header will be overwritten by decrypted data soon after the decryption process begins, so the + to the volume (the primary header will be overwritten by decrypted data soon after the decryption process begins, so the backup header will contain the only copy of the master key). */ int driveNo = -1; - // The volume may already be mounted. We need to dismount it first in order to verify the supplied password/keyfile(s) is/are correct. + // The volume may already be mounted. We need to dismount it first in order to verify the supplied password/keyfile(s) is/are correct. if (IsMountedVolume (szFileName)) { driveNo = GetMountedVolumeDriveNo (szFileName); @@ -7840,7 +7840,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa if (nNeedToStoreFilesOver4GB != Get2RadButtonPageAnswer()) fileSystem = FILESYS_NONE; // The user may have gone back and changed the answer, so default file system must be reselected - + nNeedToStoreFilesOver4GB = Get2RadButtonPageAnswer(); nNewPageNo = FORMAT_PAGE - 1; // Skip irrelevant pages @@ -7961,7 +7961,7 @@ retryCDDriveCheck: { wchar_t szTmp[8000]; - StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("RESCUE_DISK_CHECK_FAILED"), + StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("RESCUE_DISK_CHECK_FAILED"), IsWindowsIsoBurnerAvailable () ? L"" : GetString ("RESCUE_DISK_CHECK_FAILED_SENTENCE_APPENDIX")); ErrorDirect (szTmp, hwndDlg); @@ -7990,7 +7990,7 @@ retryCDDriveCheck: else if (nCurPageNo == SYSENC_WIPE_MODE_PAGE || nCurPageNo == NONSYS_INPLACE_ENC_WIPE_MODE_PAGE) { - if (nWipeMode > 0 + if (nWipeMode > 0 && AskWarnYesNo ("WIPE_MODE_WARN", hwndDlg) == IDNO) return 1; } @@ -8002,7 +8002,7 @@ retryCDDriveCheck: return 1; bConfirmQuitSysEncPretest = TRUE; - + if (!bHiddenOS) // This text is not tailored to hidden OS TextInfoDialogBox (TC_TBXID_SYS_ENCRYPTION_PRETEST); @@ -8036,7 +8036,7 @@ retryCDDriveCheck: /* Add the main TrueCrypt app to the system startup sequence (the TrueCrypt Background Task), which - we need e.g. for notifications about prevented hibernation, about hidden OS leak protection, about + we need e.g. for notifications about prevented hibernation, about hidden OS leak protection, about inconsistent hidden OS installs (TrueCrypt upgraded in the decoy system but not in the hidden one), etc. Note that this must be done before calling ChangeSystemEncryptionStatus(), which broadcasts the change, so that the main app (if it's running with different cached settings) will not overwrite our new @@ -8049,7 +8049,7 @@ retryCDDriveCheck: if (bHiddenOS) { /* When we are going to create a hidden OS, the system encryption status is set - to SYSENC_STATUS_PRETEST (not to any special hidden-OS status), in case the XML + to SYSENC_STATUS_PRETEST (not to any special hidden-OS status), in case the XML configuration file and its properties somehow leaks somewhere outside the system partition (which will be wiped later on) indicating that a hidden OS has been created on the computer. Instead, we update our raw config flags in the master boot record @@ -8150,7 +8150,7 @@ retryCDDriveCheck: BOOL bDrvLetterAssignResult = FALSE; int tmpDriveLetter = (int) SendMessage (GetDlgItem (hCurPage, IDC_DRIVE_LETTER_LIST), - CB_GETITEMDATA, + CB_GETITEMDATA, SendMessage (GetDlgItem (hCurPage, IDC_DRIVE_LETTER_LIST), CB_GETCURSEL, 0, 0), 0); @@ -8174,7 +8174,7 @@ retryCDDriveCheck: szDriveLetter, szDiskFile); - if (bDrvLetterAssignResult) + if (bDrvLetterAssignResult) { if (SetVolumeMountPoint (rootPath, uniqVolName) == 0) bDrvLetterAssignResult = FALSE; @@ -8200,7 +8200,7 @@ retryCDDriveCheck: if (bVolTransformThreadRunning || bVolTransformThreadToRun) return 1; - + bVolTransformThreadCancel = FALSE; bVolTransformThreadToRun = TRUE; @@ -8218,7 +8218,7 @@ retryCDDriveCheck: { // Creating a non-hidden volume under a hidden OS - if (fileSystem == FILESYS_NTFS || fileSystem == FILESYS_EXFAT) + if (fileSystem == FILESYS_NTFS || fileSystem == FILESYS_EXFAT) { WarningDirect ((wstring (GetString ("CANNOT_CREATE_NON_HIDDEN_NTFS_VOLUMES_UNDER_HIDDEN_OS")) + L"\n\n" @@ -8249,7 +8249,7 @@ retryCDDriveCheck: hiddenVolHostDriveNo = -1; nMaximumHiddenVolSize = 0; - if (fileSystem == FILESYS_NTFS || fileSystem == FILESYS_EXFAT) + if (fileSystem == FILESYS_NTFS || fileSystem == FILESYS_EXFAT) { if (bHiddenOS && (fileSystem == FILESYS_NTFS) && (double) nVolumeSize / GetSystemPartitionSize() < MIN_HIDDENOS_DECOY_PARTITION_SIZE_RATIO_NTFS) @@ -8291,9 +8291,9 @@ retryCDDriveCheck: } else if (bHiddenVol) { - // Hidden volume is always quick-formatted (if, however, the meaning of quickFormat is + // Hidden volume is always quick-formatted (if, however, the meaning of quickFormat is // whether to create a sparse file, it must be set to FALSE). - quickFormat = !bSparseFileSwitch; + quickFormat = !bSparseFileSwitch; } @@ -8321,7 +8321,7 @@ retryCDDriveCheck: if (fileSystem == FILESYS_FAT && clusterSize > 0) { BOOL fixed = FALSE; - while (clusterSize < 128 + while (clusterSize < 128 && nVolumeSize / (clusterSize * GetFormatSectorSize()) > 0x2000000) { clusterSize *= 2; @@ -8350,7 +8350,7 @@ retryCDDriveCheck: return 1; // Hidden volume for hidden OS has been created. Now we will prepare our boot loader - // that will handle the OS cloning. + // that will handle the OS cloning. try { WaitCursor(); @@ -8422,7 +8422,7 @@ retryCDDriveCheck: /* Hidden volume host successfully mounted as read-only */ - // Verify that the outer volume contains a suitable file system, retrieve cluster size, and + // Verify that the outer volume contains a suitable file system, retrieve cluster size, and // scan the volume bitmap if (!IsAdmin () && IsUacSupported ()) retCode = UacAnalyzeHiddenVolumeHost (hwndDlg, &hiddenVolHostDriveNo, GetVolumeDataAreaSize (FALSE, nHiddenVolHostSize), &realClusterSize, &nbrFreeClusters); @@ -8518,9 +8518,9 @@ ovf_end: if (bHiddenOS) nNewPageNo = SYSENC_HIDDEN_OS_REQ_CHECK_PAGE + 1; else if (bWholeSysDrive) - nNewPageNo = SYSENC_PRE_DRIVE_ANALYSIS_PAGE + 1; + nNewPageNo = SYSENC_PRE_DRIVE_ANALYSIS_PAGE + 1; else - nNewPageNo = SYSENC_SPAN_PAGE + 1; + nNewPageNo = SYSENC_SPAN_PAGE + 1; } else if (nCurPageNo == SYSENC_MULTI_BOOT_NONWIN_BOOT_LOADER_PAGE) { @@ -8543,7 +8543,7 @@ ovf_end: // Skip irrelevant pages. // Note that we're ignoring nMultiBoot here, as the multi-boot question pages are skipped // when creating a hidden OS (only a single message box is displayed with requirements). - nNewPageNo = SYSENC_MULTI_BOOT_MODE_PAGE + 1; + nNewPageNo = SYSENC_MULTI_BOOT_MODE_PAGE + 1; } else { @@ -8598,7 +8598,7 @@ ovf_end: nNewPageNo = SYSENC_MULTI_BOOT_MODE_PAGE + 1; // Skip irrelevant pages } else if (!bHiddenVol) - nNewPageNo = (bDevice ? DEVICE_TRANSFORM_MODE_PAGE : VOLUME_LOCATION_PAGE) + 1; + nNewPageNo = (bDevice ? DEVICE_TRANSFORM_MODE_PAGE : VOLUME_LOCATION_PAGE) + 1; else if (bHiddenVolHost) nNewPageNo = HIDDEN_VOL_HOST_PRE_CIPHER_PAGE + 1; // Skip the info on the hidden volume } @@ -8612,7 +8612,7 @@ ovf_end: { if (nNeedToStoreFilesOver4GB != Get2RadButtonPageAnswer()) fileSystem = FILESYS_NONE; // The user may have gone back and changed the answer, so default file system must be reselected - + nNeedToStoreFilesOver4GB = Get2RadButtonPageAnswer(); nNewPageNo = (PimEnable? PIM_PAGE : PASSWORD_PAGE) + 1; // Skip PIM page if it is not enabled @@ -8644,7 +8644,7 @@ ovf_end: if (bKeyboardLayoutChanged) { // Restore the original keyboard layout - if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL) + if (LoadKeyboardLayout (OrigKeyboardLayout, KLF_ACTIVATE | KLF_SUBSTITUTE_OK) == NULL) Warning ("CANNOT_RESTORE_KEYBOARD_LAYOUT", hwndDlg); else bKeyboardLayoutChanged = FALSE; @@ -8728,7 +8728,7 @@ ovf_end: nNewPageNo = FILESYS_PAGE + 1; } else - nNewPageNo = (PimEnable? PIM_PAGE : PASSWORD_PAGE) + 1; + nNewPageNo = (PimEnable? PIM_PAGE : PASSWORD_PAGE) + 1; } } @@ -8818,15 +8818,15 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) { OptionDynamic, L"/dynamic", NULL, FALSE }, { OptionForce, L"/force", NULL, FALSE }, - // Internal + // Internal { CommandResumeSysEncLogOn, L"/acsysenc", L"/a", TRUE }, { CommandResumeSysEnc, L"/csysenc", L"/c", TRUE }, { CommandDecryptSysEnc, L"/dsysenc", L"/d", TRUE }, { CommandEncDev, L"/encdev", L"/e", TRUE }, - { CommandHiddenSys, L"/isysenc", L"/i", TRUE }, + { CommandHiddenSys, L"/isysenc", L"/i", TRUE }, { CommandResumeNonSysInplaceLogOn, L"/prinplace", L"/p", TRUE }, - { CommandResumeHiddenSys, L"/risysenc", L"/r", TRUE }, - { CommandSysEnc, L"/sysenc", L"/s", TRUE }, + { CommandResumeHiddenSys, L"/risysenc", L"/r", TRUE }, + { CommandSysEnc, L"/sysenc", L"/s", TRUE }, { CommandInplaceDec, L"/inplacedec", NULL, TRUE }, { CommandResumeInplaceDec, L"/resumeinplacedec",NULL, TRUE }, { CommandResumeInplace, L"/zinplace", L"/z", TRUE } @@ -8841,7 +8841,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) as.args = args; as.arg_cnt = sizeof(args)/ sizeof(args[0]); - + x = GetArgumentID (&as, lpszCommandLineArgs[i]); switch (x) @@ -8907,7 +8907,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) if (iLen > 0) CmdVolumePassword.Length = (unsigned __int32) (iLen - 1); else - AbortProcess ("COMMAND_LINE_ERROR"); + AbortProcess ("COMMAND_LINE_ERROR"); } else AbortProcess ("COMMAND_LINE_ERROR"); @@ -8971,7 +8971,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) { wchar_t szTmp[32] = {0}; if (HAS_ARGUMENT == GetArgumentValue (lpszCommandLineArgs, - &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)) + &i, nNoCommandLineArgs, szTmp, ARRAYSIZE (szTmp)) && (wcslen (szTmp) >= 2) ) { @@ -8998,7 +8998,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) szTmp [wcslen (szTmp) - 1] = 0; CmdVolumeFileSize = _wcstoui64(szTmp, &endPtr, 0); - if (CmdVolumeFileSize == 0 || CmdVolumeFileSize == _UI64_MAX + if (CmdVolumeFileSize == 0 || CmdVolumeFileSize == _UI64_MAX || endPtr == szTmp || *endPtr != L'\0') { AbortProcess ("COMMAND_LINE_ERROR"); @@ -9082,7 +9082,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) break; case CommandResumeSysEnc: - // Resume previous system-encryption operation (passed by Mount) e.g. encryption, decryption, or pretest + // Resume previous system-encryption operation (passed by Mount) e.g. encryption, decryption, or pretest // From now on, we should be the only instance of the TC wizard allowed to deal with system encryption if (CreateSysEncMutex ()) @@ -9181,7 +9181,7 @@ void ExtractCommandLine (HWND hwndDlg, wchar_t *lpszCommandLine) } } break; - + case OptionTokenLib: if (GetArgumentValue (lpszCommandLineArgs, &i, nNoCommandLineArgs, SecurityTokenLibraryPath, ARRAYSIZE (SecurityTokenLibraryPath)) == HAS_ARGUMENT) InitSecurityTokenLibrary(hwndDlg); @@ -9353,7 +9353,7 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi // FAT12/FAT16/FAT32 // Retrieve the cluster size - *realClusterSize = ((int) readBuffer[0xb] + ((int) readBuffer[0xc] << 8)) * (int) readBuffer[0xd]; + *realClusterSize = ((int) readBuffer[0xb] + ((int) readBuffer[0xc] << 8)) * (int) readBuffer[0xd]; // Get the map of the clusters that are free and in use on the outer volume. // The map will be scanned to determine the size of the uninterrupted block of free @@ -9379,10 +9379,10 @@ int AnalyzeHiddenVolumeHost (HWND hwndDlg, int *driveNo, __int64 hiddenVolHostSi if (bIsNtfs && bHiddenVolDirect && GetVolumeDataAreaSize (FALSE, hiddenVolHostSize) <= TC_MAX_FAT_SECTOR_COUNT * GetFormatSectorSize()) Info ("HIDDEN_VOL_HOST_NTFS", hwndDlg); - if (!GetDiskFreeSpace(szRootPathName, - &dwSectorsPerCluster, - &dwBytesPerSector, - &dwNumberOfFreeClusters, + if (!GetDiskFreeSpace(szRootPathName, + &dwSectorsPerCluster, + &dwBytesPerSector, + &dwNumberOfFreeClusters, &dwTotalNumberOfClusters)) { handleWin32Error (hwndDlg, SRC_POS); @@ -9494,7 +9494,7 @@ int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int &lpInBuffer, sizeof(lpInBuffer), lpOutBuffer, - bufLen, + bufLen, &lBytesReturned, NULL)) { @@ -9506,7 +9506,7 @@ int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int rmnd = (BYTE) (lpOutBuffer->BitmapSize.QuadPart % 8); - if ((rmnd != 0) + if ((rmnd != 0) && ((lpOutBuffer->Buffer[lpOutBuffer->BitmapSize.QuadPart / 8] & ((1 << rmnd)-1) ) != 0)) { *nbrFreeClusters = 0; @@ -9521,9 +9521,9 @@ int ScanVolClusterBitmap (HWND hwndDlg, int *driveNo, __int64 nbrClusters, __int { if (lpOutBuffer->Buffer[bitmapCnt] != 0) { - // There might be up to 7 extra free clusters in this byte of the bitmap. + // There might be up to 7 extra free clusters in this byte of the bitmap. // These are ignored because there is always a cluster reserve added anyway. - *nbrFreeClusters = lpOutBuffer->BitmapSize.QuadPart - ((bitmapCnt + 1) * 8); + *nbrFreeClusters = lpOutBuffer->BitmapSize.QuadPart - ((bitmapCnt + 1) * 8); break; } } @@ -9566,7 +9566,7 @@ static BOOL WipeHiddenOSCreationConfig (void) // Tasks that need to be performed after the WM_INITDIALOG message for the SYSENC_ENCRYPTION_PAGE dialog is -// handled should be done here (otherwise the UAC prompt causes the GUI to be only half-rendered). +// handled should be done here (otherwise the UAC prompt causes the GUI to be only half-rendered). static void AfterSysEncProgressWMInitTasks (HWND hwndDlg) { try @@ -9625,7 +9625,7 @@ static void AfterSysEncProgressWMInitTasks (HWND hwndDlg) } -// Tasks that need to be performed after the WM_INITDIALOG message is handled must be done here. +// Tasks that need to be performed after the WM_INITDIALOG message is handled must be done here. // For example, any tasks that may invoke the UAC prompt (otherwise the UAC dialog box would not be on top). static void AfterWMInitTasks (HWND hwndDlg) { @@ -9675,14 +9675,14 @@ static void AfterWMInitTasks (HWND hwndDlg) } else if (bDirectSysEncMode) { - // This is an inconsistent state. We have a direct system encryption command, + // This is an inconsistent state. We have a direct system encryption command, // SystemEncryptionStatus is SYSENC_STATUS_ENCRYPTING or SYSENC_STATUS_DECRYPTING, the // system drive is not 'mounted' and drive filter is active. Possible causes: 1) The drive had // been decrypted in the pre-boot environment. 2) The OS is not located on the lowest partition, - // the drive is to be fully encrypted, but the user rebooted before encryption reached the + // the drive is to be fully encrypted, but the user rebooted before encryption reached the // system partition and then pressed Esc in the boot loader screen. 3) Corrupted or stale config // file. 4) Damaged system. - + Warning ("SYSTEM_ENCRYPTION_SCHEDULED_BUT_PBA_FAILED", hwndDlg); EndMainDlg (MainDlg); return; @@ -9721,7 +9721,7 @@ static void AfterWMInitTasks (HWND hwndDlg) { // If the config file with status was lost or not written correctly, we // don't know whether to encrypt or decrypt (but we know that encryption or - // decryption is required). Ask the user to select encryption, decryption, + // decryption is required). Ask the user to select encryption, decryption, // or cancel if (!ResolveUnknownSysEncDirection ()) { @@ -9755,7 +9755,7 @@ static void AfterWMInitTasks (HWND hwndDlg) if (SysEncryptionOrDecryptionRequired ()) { // System partition/drive encryption process already initiated but is incomplete. - // If we were encrypting, resume the process directly. If we were decrypting, reverse + // If we were encrypting, resume the process directly. If we were decrypting, reverse // the process and start encrypting. ChangeSystemEncryptionStatus (SYSENC_STATUS_ENCRYPTING); @@ -9829,12 +9829,12 @@ static void AfterWMInitTasks (HWND hwndDlg) } else if ((SystemEncryptionStatus == SYSENC_STATUS_NONE || SystemEncryptionStatus == SYSENC_STATUS_DECRYPTING) - && !BootEncStatus.DriveEncrypted + && !BootEncStatus.DriveEncrypted && (BootEncStatus.DriveMounted || BootEncStatus.VolumeHeaderPresent)) { // The pretest may have been in progress but we can't be sure (it is not in the config file). // Another possibility is that the user had finished decrypting the drive, but the config file - // was not correctly updated. In both cases the best thing we can do is remove the header and + // was not correctly updated. In both cases the best thing we can do is remove the header and // deinstall. Otherwise, the result might be some kind of deadlock. if (CreateSysEncMutex ()) // If no other instance is currently taking care of system encryption @@ -9853,8 +9853,8 @@ static void AfterWMInitTasks (HWND hwndDlg) if (bDirectSysEncMode && CreateSysEncMutex ()) { - // We were launched either by Mount or by the system (startup sequence). Most of such cases should have - // been handled above already. Here we handle only the pretest phase (which can also be a hidden OS + // We were launched either by Mount or by the system (startup sequence). Most of such cases should have + // been handled above already. Here we handle only the pretest phase (which can also be a hidden OS // creation phase actually) and possible inconsistencies. switch (SystemEncryptionStatus) @@ -9893,7 +9893,7 @@ static void AfterWMInitTasks (HWND hwndDlg) { // The hidden OS has been booted for the first time since the user started installing a // new decoy OS (presumably, our MBR config flags have been erased). - + // As for things we are responsible for, the process of hidden OS creation is completed // (the rest is up to the user). @@ -9901,7 +9901,7 @@ static void AfterWMInitTasks (HWND hwndDlg) ChangeSystemEncryptionStatus (SYSENC_STATUS_NONE); EndMainDlg (MainDlg); - + return; } @@ -9938,7 +9938,7 @@ static void AfterWMInitTasks (HWND hwndDlg) { BOOL bAnswerTerminate = FALSE, bAnswerRetry = FALSE; - /* Pretest failed + /* Pretest failed or hidden OS cloning has been interrupted (and non-hidden OS is running) or wiping of the original OS has not been started (and non-hidden OS is running) */ @@ -9962,7 +9962,7 @@ static void AfterWMInitTasks (HWND hwndDlg) else { // Hidden OS cloning was interrupted or wiping of the original OS has not been started - + char *tmpStr[] = {0, hiddenOSCreationPhase == TC_HIDDEN_OS_CREATION_PHASE_WIPING ? "OS_WIPING_NOT_FINISHED_ASK" : "HIDDEN_OS_CREATION_NOT_FINISHED_ASK", "HIDDEN_OS_CREATION_NOT_FINISHED_CHOICE_RETRY", @@ -9998,7 +9998,7 @@ static void AfterWMInitTasks (HWND hwndDlg) // We re-register the driver for boot because the user may have selected // "Last Known Good Configuration" from the Windows boot menu. - // Note that we need to do this even when creating a hidden OS (because + // Note that we need to do this even when creating a hidden OS (because // the hidden OS needs our boot driver and it will be a clone of this OS). try { @@ -10047,7 +10047,7 @@ static void AfterWMInitTasks (HWND hwndDlg) EndMainDlg (MainDlg); return; } - else + else { // User doesn't want to take any action now @@ -10180,7 +10180,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz if (Randinit ()) { DWORD dwLastError = GetLastError (); - wchar_t szTmp[4096]; + wchar_t szTmp[4096]; if (CryptoAPILastError == ERROR_SUCCESS) StringCbPrintfW (szTmp, sizeof(szTmp), GetString ("INIT_RAND"), SRC_POS, dwLastError); else @@ -10208,7 +10208,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t *lpsz AbortProcess ("ERR_SELF_TESTS_FAILED"); /* Create the main dialog box */ - DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_VOL_CREATION_WIZARD_DLG), NULL, (DLGPROC) MainDialogProc, + DialogBoxParamW (hInstance, MAKEINTRESOURCEW (IDD_VOL_CREATION_WIZARD_DLG), NULL, (DLGPROC) MainDialogProc, (LPARAM)lpszCommandLine); FinalizeApp (); diff --git a/src/Format/Tcformat.h b/src/Format/Tcformat.h index c45e6916..14b0ff1c 100644 --- a/src/Format/Tcformat.h +++ b/src/Format/Tcformat.h @@ -1,11 +1,11 @@ /* Legal Notice: Some portions of the source code contained in this file were - derived from the source code of TrueCrypt 7.1a, which is - Copyright (c) 2003-2012 TrueCrypt Developers Association and which is + derived from the source code of TrueCrypt 7.1a, 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 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' - Modifications and additions to the original source code (contained in this file) + 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) 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 contained in the file License.txt included in VeraCrypt binary and source diff --git a/src/License.txt b/src/License.txt index 44c0c657..dc686dd1 100644 --- a/src/License.txt +++ b/src/License.txt @@ -8,16 +8,16 @@ BOUND BY ALL TERMS AND CONDITIONS OF THIS LICENSE. IF YOU DO NOT ACCEPT THEM, DO NOT USE, COPY, MODIFY, NOR (RE)DISTRIBUTE THE SOFTWARE, NOR ANY PART(S) THEREOF. -VeraCrypt is multi-licensed under Apache License 2.0 and -the TrueCrypt License version 3.0, a verbatim copy of both +VeraCrypt is multi-licensed under Apache License 2.0 and +the TrueCrypt License version 3.0, a verbatim copy of both licenses can be found below. -This license does not grant you rights to use any -contributors' name, logo, or trademarks, including IDRIX, +This license does not grant you rights to use any +contributors' name, logo, or trademarks, including IDRIX, VeraCrypt and all derivative names. -For example, the following names are not allowed: VeraCrypt, -VeraCrypt+, VeraCrypt Professional, iVeraCrypt, etc. Nor any -other names confusingly similar to the name VeraCrypt (e.g., +For example, the following names are not allowed: VeraCrypt, +VeraCrypt+, VeraCrypt Professional, iVeraCrypt, etc. Nor any +other names confusingly similar to the name VeraCrypt (e.g., Vera-Crypt, Vera Crypt, VerKrypt, etc.) ____________________________________________________________ diff --git a/src/Main/Application.h b/src/Main/Application.h index 23d281b6..b961ef4e 100644 --- a/src/Main/Application.h +++ b/src/Main/Application.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp index e48a495f..0a4f41b3 100644 --- a/src/Main/CommandLineInterface.cpp +++ b/src/Main/CommandLineInterface.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -104,7 +104,7 @@ namespace VeraCrypt if (parser.Parse () > 0) throw_err (_("Incorrect command line specified.")); - + if (parser.Found (L"help")) { ArgCommand = CommandId::Help; @@ -192,7 +192,7 @@ namespace VeraCrypt ArgCommand = CommandId::CreateKeyfile; param1IsFile = true; } - + if (parser.Found (L"delete-token-keyfiles")) { CheckCommandSingle(); @@ -205,7 +205,7 @@ namespace VeraCrypt ArgCommand = CommandId::DismountVolumes; param1IsMountedVolumeSpec = true; } - + if (parser.Found (L"export-token-keyfile")) { CheckCommandSingle(); @@ -294,7 +294,7 @@ namespace VeraCrypt else { ArgMountOptions.FilesystemType = wstring (str); - + if (str.IsSameAs (L"FAT", false)) ArgFilesystem = VolumeCreationOptions::FilesystemType::FAT; #ifdef TC_LINUX @@ -309,7 +309,7 @@ namespace VeraCrypt else if (str.IsSameAs (L"exFAT", false)) ArgFilesystem = VolumeCreationOptions::FilesystemType::exFAT; #elif defined (TC_MACOSX) - else if ( str.IsSameAs (L"HFS", false) + else if ( str.IsSameAs (L"HFS", false) || str.IsSameAs (L"HFS+", false) || str.IsSameAs (L"MacOsExt", false) ) @@ -328,7 +328,7 @@ namespace VeraCrypt } ArgForce = parser.Found (L"force"); - + ArgTrueCryptMode = parser.Found (L"truecrypt"); #if !defined(TC_WINDOWS) && !defined(TC_MACOSX) @@ -402,7 +402,7 @@ namespace VeraCrypt if (parser.Found (L"new-password", &str)) ArgNewPassword = ToUTF8Password (str.c_str()); - + if (parser.Found (L"new-pim", &str)) { try @@ -419,7 +419,7 @@ namespace VeraCrypt else if (ArgNewPim > 0 && ArgTrueCryptMode) throw_err (LangString["PIM_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]); } - + if (parser.Found (L"non-interactive")) { if (interfaceType != UserInterfaceType::Text) @@ -478,13 +478,13 @@ namespace VeraCrypt ArgMountOptions.ProtectionKeyfiles = ToKeyfileList (str); ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly; } - + if (parser.Found (L"protection-password", &str)) { ArgMountOptions.ProtectionPassword = ToUTF8Password (str.c_str()); ArgMountOptions.Protection = VolumeProtection::HiddenVolumeReadOnly; } - + if (parser.Found (L"protection-pim", &str)) { int pim = -1; @@ -609,7 +609,7 @@ namespace VeraCrypt // Parameters if (parser.GetParamCount() > 0) { - // in case of GUI interface, we load the preference when only + // in case of GUI interface, we load the preference when only // specifying volume path without any option/switch if (Application::GetUserInterfaceType() != UserInterfaceType::Text) { @@ -634,7 +634,7 @@ namespace VeraCrypt if (param1IsVolume) { wxFileName volPath (parser.GetParam (0)); - + #ifdef TC_WINDOWS if (!parser.GetParam (0).StartsWith (L"\\Device\\")) #endif @@ -699,7 +699,7 @@ namespace VeraCrypt continue; } } - + if (token.empty() && !tokenizer.HasMoreTokens()) break; @@ -758,7 +758,7 @@ namespace VeraCrypt filteredVolumes.push_back (volume); } } - + if (!mountedVolumeSpec.IsEmpty() && filteredVolumes.size() < 1) throw_err (_("No such volume is mounted.")); diff --git a/src/Main/CommandLineInterface.h b/src/Main/CommandLineInterface.h index ee6566d5..9bca2614 100644 --- a/src/Main/CommandLineInterface.h +++ b/src/Main/CommandLineInterface.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -95,7 +95,7 @@ namespace VeraCrypt CommandLineInterface (const CommandLineInterface &); CommandLineInterface &operator= (const CommandLineInterface &); }; - + shared_ptr<VolumePassword> ToUTF8Password (const wchar_t* str, size_t charCount = (size_t) -1); shared_ptr<SecureBuffer> ToUTF8Buffer (const wchar_t* str, size_t charCount = (size_t) -1); diff --git a/src/Main/FatalErrorHandler.cpp b/src/Main/FatalErrorHandler.cpp index 5bea2dd9..37a10e73 100644 --- a/src/Main/FatalErrorHandler.cpp +++ b/src/Main/FatalErrorHandler.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -111,7 +111,7 @@ namespace VeraCrypt std::set_terminate (DefaultTerminateHandler); #endif } - + uint32 FatalErrorHandler::GetAppChecksum () { uint32 checkSum = 0; @@ -130,7 +130,7 @@ namespace VeraCrypt } wstring FatalErrorHandler::GetCallStack (int depth) - { + { #if wxUSE_STACKWALKER == 1 class StackWalker : public wxStackWalker @@ -176,7 +176,7 @@ namespace VeraCrypt return stackWalker.StackVars.str(); #else // wxUSE_STACKWALKER - + return wstring(); #endif // wxUSE_STACKWALKER diff --git a/src/Main/FatalErrorHandler.h b/src/Main/FatalErrorHandler.h index bed16fa2..92139655 100644 --- a/src/Main/FatalErrorHandler.h +++ b/src/Main/FatalErrorHandler.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Main/FavoriteVolume.cpp b/src/Main/FavoriteVolume.cpp index e88bcd2f..9022d601 100644 --- a/src/Main/FavoriteVolume.cpp +++ b/src/Main/FavoriteVolume.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -31,7 +31,7 @@ namespace VeraCrypt wstring attr = wstring (node.Attributes[L"slotnumber"]); if (!attr.empty()) slotNumber = StringConverter::ToUInt64 (attr); - + bool readOnly = false; attr = wstring (node.Attributes[L"readonly"]); if (!attr.empty()) diff --git a/src/Main/FavoriteVolume.h b/src/Main/FavoriteVolume.h index 64055b4d..2a902c30 100644 --- a/src/Main/FavoriteVolume.h +++ b/src/Main/FavoriteVolume.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Main/Forms/AboutDialog.cpp b/src/Main/Forms/AboutDialog.cpp index e32c6263..8949673c 100644 --- a/src/Main/Forms/AboutDialog.cpp +++ b/src/Main/Forms/AboutDialog.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Main/Forms/AboutDialog.h b/src/Main/Forms/AboutDialog.h index e481a12e..53dfdcb3 100644 --- a/src/Main/Forms/AboutDialog.h +++ b/src/Main/Forms/AboutDialog.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -21,7 +21,7 @@ namespace VeraCrypt { public: AboutDialog (wxWindow* parent); - + void OnWebsiteHyperlinkClick (wxHyperlinkEvent& event) { Gui->OpenHomepageLink (this, L"main"); } }; } diff --git a/src/Main/Forms/BenchmarkDialog.cpp b/src/Main/Forms/BenchmarkDialog.cpp index 0f497650..95e225e2 100644 --- a/src/Main/Forms/BenchmarkDialog.cpp +++ b/src/Main/Forms/BenchmarkDialog.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -68,7 +68,7 @@ namespace VeraCrypt wxBusyCursor busy; Buffer buffer ((size_t) Gui->GetSelectedData <size_t> (BufferSizeChoice)); - + BenchmarkThreadRoutine routine(this, results, buffer); Gui->ExecuteWaitThreadRoutine (this, &routine); @@ -77,7 +77,7 @@ namespace VeraCrypt foreach (const BenchmarkResult &result, results) { vector <wstring> fields (BenchmarkListCtrl->GetColumnCount()); - + fields[ColumnAlgorithm] = result.AlgorithmName; fields[ColumnEncryption] = Gui->SpeedToString (result.EncryptionSpeed); fields[ColumnDecryption] = Gui->SpeedToString (result.DecryptionSpeed); @@ -85,10 +85,10 @@ namespace VeraCrypt Gui->AppendToListCtrl (BenchmarkListCtrl, fields); } - + BenchmarkListCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE); } - + void BenchmarkDialog::DoBenchmark (list<BenchmarkResult>& results, Buffer& buffer) { try diff --git a/src/Main/Forms/BenchmarkDialog.h b/src/Main/Forms/BenchmarkDialog.h index 228bbf21..403f3839 100644 --- a/src/Main/Forms/BenchmarkDialog.h +++ b/src/Main/Forms/BenchmarkDialog.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -42,7 +42,7 @@ namespace VeraCrypt void DoBenchmark (list<BenchmarkResult>& results, Buffer& buffer); void OnBenchmarkButtonClick (wxCommandEvent& event); - + class BenchmarkThreadRoutine : public WaitThreadRoutine { public: diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp index b3e0bd04..ac8e8147 100644 --- a/src/Main/Forms/ChangePasswordDialog.cpp +++ b/src/Main/Forms/ChangePasswordDialog.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -59,7 +59,7 @@ namespace VeraCrypt NewPasswordPanel = new VolumePasswordPanel (this, NULL, newPassword, true, newKeyfiles, false, enableNewPassword, enableNewKeyfiles, enableNewPassword, enablePkcs5Prf); NewPasswordPanel->UpdateEvent.Connect (EventConnector <ChangePasswordDialog> (this, &ChangePasswordDialog::OnPasswordPanelUpdate)); NewPasswordPanelSizer->Add (NewPasswordPanel, 1, wxALL | wxEXPAND); - + if (mode == Mode::RemoveAllKeyfiles) NewSizer->Show (false); @@ -98,7 +98,7 @@ namespace VeraCrypt CurrentPasswordPanel->SetFocusToPimTextCtrl(); return; } - + shared_ptr <VolumePassword> newPassword; int newPim = 0; if (DialogMode == Mode::ChangePasswordAndKeyfiles) @@ -110,7 +110,7 @@ namespace VeraCrypt catch (PasswordException& e) { Gui->ShowWarning (e); - NewPasswordPanel->SetFocusToPasswordTextCtrl(); + NewPasswordPanel->SetFocusToPasswordTextCtrl(); return; } newPim = NewPasswordPanel->GetVolumePim(); @@ -126,7 +126,7 @@ namespace VeraCrypt { if (newPim > 0 && newPim < 485) { - Gui->ShowError ("PIM_REQUIRE_LONG_PASSWORD"); + Gui->ShowError ("PIM_REQUIRE_LONG_PASSWORD"); return; } @@ -235,7 +235,7 @@ namespace VeraCrypt if (passwordEmpty && keyfilesEmpty) ok = false; - + if (CurrentPasswordPanel->GetVolumePim () == -1) ok = false; @@ -251,7 +251,7 @@ namespace VeraCrypt ok = false; if (DialogMode == Mode::ChangePasswordAndKeyfiles - && ( (NewPasswordPanel->GetPassword()->IsEmpty() && newKeyfilesEmpty) + && ( (NewPasswordPanel->GetPassword()->IsEmpty() && newKeyfilesEmpty) || !NewPasswordPanel->PasswordsMatch() || (NewPasswordPanel->GetVolumePim() == -1) ) @@ -265,12 +265,12 @@ namespace VeraCrypt } OKButton->Enable (ok); - + if (DialogMode == Mode::ChangePasswordAndKeyfiles) { bool pimChanged = (CurrentPasswordPanel->GetVolumePim() != NewPasswordPanel->GetVolumePim()); NewPasswordPanel->UpdatePimHelpText(pimChanged); } - + } } diff --git a/src/Main/Forms/ChangePasswordDialog.h b/src/Main/Forms/ChangePasswordDialog.h index 6caaaeab..2ba83991 100644 --- a/src/Main/Forms/ChangePasswordDialog.h +++ b/src/Main/Forms/ChangePasswordDialog.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Main/Forms/DeviceSelectionDialog.cpp b/src/Main/Forms/DeviceSelectionDialog.cpp index 9d706239..764edf3a 100644 --- a/src/Main/Forms/DeviceSelectionDialog.cpp +++ b/src/Main/Forms/DeviceSelectionDialog.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -39,7 +39,7 @@ namespace VeraCrypt DeviceListCtrl->InsertColumn (ColumnMountPoint, LangString["MOUNT_POINT"], wxLIST_FORMAT_LEFT, 1); colPermilles.push_back (396); #endif - + wxImageList *imageList = new wxImageList (16, 12, true); imageList->Add (Resources::GetDriveIconBitmap(), Resources::GetDriveIconMaskBitmap()); DeviceListCtrl->AssignImageList (imageList, wxIMAGE_LIST_SMALL); @@ -65,13 +65,13 @@ namespace VeraCrypt fields[ColumnMountPoint] = device.MountPoint; #endif fields[ColumnSize] = Gui->SizeToString (device.Size); - Gui->AppendToListCtrl (DeviceListCtrl, fields, 0, &device); + Gui->AppendToListCtrl (DeviceListCtrl, fields, 0, &device); foreach_ref (HostDevice &partition, device.Partitions) { - fields[ColumnDevice] = + fields[ColumnDevice] = #ifndef TC_WINDOWS - wstring (L" ") + + wstring (L" ") + #endif wstring (partition.Path); @@ -97,7 +97,7 @@ namespace VeraCrypt StdButtonsOK->Disable(); StdButtonsOK->SetDefault(); } - + void DeviceSelectionDialog::OnListItemActivated (wxListEvent& event) { if (StdButtonsOK->IsEnabled()) diff --git a/src/Main/Forms/DeviceSelectionDialog.h b/src/Main/Forms/DeviceSelectionDialog.h index db19e150..76aaa6f2 100644 --- a/src/Main/Forms/DeviceSelectionDialog.h +++ b/src/Main/Forms/DeviceSelectionDialog.h @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 diff --git a/src/Main/Forms/EncryptionOptionsWizardPage.cpp b/src/Main/Forms/EncryptionOptionsWizardPage.cpp index cedc9371..5af01d02 100644 --- a/src/Main/Forms/EncryptionOptionsWizardPage.cpp +++ b/src/Main/Forms/EncryptionOptionsWizardPage.cpp @@ -3,7 +3,7 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed 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 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 @@ -32,7 +32,7 @@ namespace VeraCrypt } EncryptionAlgorithmChoice->Select (0); - + Hashes = Hash::GetAvailableAlgorithms(); foreach (shared_ptr <Hash> h |