Compare commits

...
Author SHA1 Message Date
Mounir IDRASSI 2fef14ff76 Increment version to 1.18. Update user guide PDF file. 2016-08-16 10:19:39 +02:00
Mounir IDRASSI ce76957a10 Windows: Fix various issues detected by static analysis. 2016-08-16 10:04:07 +02:00
Mounir IDRASSI 1bf219b0dc Windows: fix SetupAPI issue on some machines where it fails to handle properly AddReg/DelReg operations during System encryption/decryption wizard. 2016-08-16 00:56:15 +02:00
Mounir IDRASSI a7056a6ac3 Windows: in system encryption setting dialog, put the checkbox for hiding at the bottom to keep the Note text coherent. 2016-08-15 19:06:26 +02:00
Mounir IDRASSI bba8a5be32 Language Files: update polish translation 2016-08-15 18:53:52 +02:00
Mounir IDRASSI 1e429d1fbf Language XML files: add new fields. 2016-08-15 18:53:50 +02:00
Mounir IDRASSI 5d5a645083 Windows: fix error caused by requesting large number of random bytes when writing randomly generated data to unused/reserved header areas. 2016-08-15 14:19:11 +02:00
Mounir IDRASSI 1506916487 Linux: avoid overflow when specifying TiB size in command line 2016-08-15 13:18:06 +02:00
Mounir IDRASSIandGitHub 2db742f465 Merge pull request #75 from oceanBT/revert-66-patch-1
Linux: added TiB support to text mode.
2016-08-15 13:10:01 +02:00
Mounir IDRASSI 8bc8f7c66e Documentation update. 2016-08-15 01:09:22 +02:00
Mounir IDRASSI 99d5145c24 Language XML files: update XML files with new fields and some changes. 2016-08-15 01:09:20 +02:00
Mounir IDRASSI 24560eae1d Windows: fill unused/reserved header areas with the result of encryption of random data instead of the encryption of zeros for better entropy of resulting random data. 2016-08-15 01:09:20 +02:00
Mounir IDRASSI 67031da928 Windows: Add DCS EFI Bootloader files that are signed. Add certificates and powershell script to update Secure Boot configuration. 2016-08-15 01:09:19 +02:00
Mounir IDRASSI 87ee61bcb1 Windows: in EFI encryption wizard, always select "Single Boot" by default since it is the only choice. 2016-08-15 01:09:19 +02:00
kavsrfandMounir IDRASSI 83885c1ebb Windows: Synchronize file with changes done in EFI Bootloader DCS. 2016-08-15 01:09:18 +02:00
Mounir IDRASSI 2d72e42c6c Windows: Implement Rescue Disk support for EFI system encryption 2016-08-15 01:09:17 +02:00
Mounir IDRASSI 71a38563ae Windows: various fixes for XZip library bugs 2016-08-15 01:09:17 +02:00
Mounir IDRASSI 4cf9db9f95 Windows: Add XZip library files (http://www.codeproject.com/Articles/4135/XZip-and-XUnzip-Add-zip-and-or-unzip-to-your-app-w) 2016-08-15 01:09:16 +02:00
Mounir IDRASSI c4d4ade9d0 Windows: Show only supported encryption algorithm in the system encryption wizard for MBR 2016-08-15 01:09:16 +02:00
Mounir IDRASSI d127393897 Windows: Add new crypto files to legacy VC++ 2008 project. 2016-08-15 01:09:15 +02:00
Mounir IDRASSI b51d8f5386 Windows: fix Windows 10 hibernate issue when EFI system encryption is active. 2016-08-15 01:09:15 +02:00
Mounir IDRASSI b146e235f8 Windows: align buffers used for keys to avoid issues when SSE used. 2016-08-15 01:09:14 +02:00
Mounir IDRASSI 07ee8c1069 Windows: Implement support for EFI system encryption in Windows GUI. 2016-08-15 01:09:13 +02:00
AlexandMounir IDRASSI 246233c402 Windows EFI Bootloader: modifications to prepare EFI system encryption support (common files with DcsBoot) 2016-08-15 01:09:12 +02:00
Mounir IDRASSI 58cff70724 Linux/MacOSX: Add help text for GOST89 and Kuznyechik 2016-08-15 01:09:12 +02:00
Mounir IDRASSI e90e24b30b Windows: Add support for Streebog (hash) and kuznyechik (encryption) 2016-08-15 01:09:11 +02:00
Mounir IDRASSI 0b2c8b09c6 Windows: Add Magma cipher (GOST-89) 2016-08-15 01:09:10 +02:00
Mounir IDRASSI 460f552a41 Windows Driver: Add extra traces and enable tracing in release build if DEBUG_TRACE defined. 2016-08-15 01:09:10 +02:00
Mounir IDRASSI 9bfe4780d4 Language XML files: add new fields related to UEFI and newly added ciphers. 2016-08-15 01:09:08 +02:00
Mounir IDRASSI f26ce59fb5 User Guide: further corrections and modifications to match online documentation. 2016-08-15 01:09:07 +02:00
Mounir IDRASSI f32f65d4f7 Linux/MacOSX: Similar fix to Windows one. Write fake hidden volume header that is created from same data format as legitimate one in order to metigate attack that are able to detect the presence of TrueCrypt/VeraCrypt hidden volumes (reported by Ivanov Alexey Mikhailovich from Moscow, Russia) 2016-08-15 01:09:06 +02:00
Mounir IDRASSI 5b381ce7d7 Windows: Fix vulnerability inherited from TrueCrypt that allows an attacker to detect with high probability if a hidden volume is present. Vulnerability reported by Ivanov Alexey Mikhailovich. 2016-08-15 01:09:05 +02:00
Mounir IDRASSI 3fb2eedab8 Linux: Enable gcc AES-NI built-in functions and adapt Hyper-V AES detection code to gcc. 2016-08-08 00:11:22 +02:00
Mounir IDRASSI fe31cf5b83 Crypto: Use Hyper-V AES-NI detection workaround when displaying AES hardware availability in GUI. 2016-07-29 22:40:44 +02:00
Mounir IDRASSI 2389561406 Windows: Use new Windows API to mitigate dll hijacking attacks. 2016-07-29 22:40:43 +02:00
Mounir IDRASSI a7f1ba05b4 Windows: Enhance protection against dll hijacking attacks following new report by Stefan Kanthak. 2016-07-26 00:53:18 +02:00
Mounir IDRASSI 3aaf5c7045 Windows: solve benchmark issue for Whirlpool which caused wrong numbers when a 1GB buffer is chosen. 2016-07-25 08:26:09 +02:00
Mounir IDRASSI 73703095b2 User Guide: Update User Guide odt file to match online documentation and FAQ. 2016-07-24 23:55:08 +02:00
Mounir IDRASSI 0fca588275 Crypto: Workaround for AES-NI issue under Hyper-V on Windows Server 2008 R2 which masks AES-NI from applications although it is available. 2016-07-24 23:48:07 +02:00
Mounir IDRASSI 2dbf366184 Language XML files: remove UTF-8 BOM from Dutch language file. 2016-06-27 00:21:53 +02:00
Mounir IDRASSI ed81267291 Language XML files: update to Dutch translation by Peter Tak. 2016-06-27 00:13:00 +02:00
oceanBTandGitHub 1a8ce8a611 added TiB size unit 2016-06-23 21:53:24 +02:00
Mounir IDRASSI c5b766969a Windows:solve compilation error under VC++ 2008 by using extern "C" only when needed. 2016-06-20 12:10:08 +02:00
Mounir IDRASSI 00eb49443a Crypto: Optimize 64-bit implementation of Whirlpool based on idea from compression function in Botan library. 2016-06-20 12:10:07 +02:00
Mounir IDRASSI 45617a3285 Linux/MacOSX: Solve compilation error linked to Camellia cipher addition. 2016-06-19 00:38:20 +02:00
Mounir IDRASSI 85cab3b85f Windows Driver: use more reliable way to correctly set path to VC++ 2010 in driver build batch file. 2016-06-18 19:17:19 +02:00
Mounir IDRASSI e4efd6820a Windows Driver: add declaration of missing intrinsic _mm_setr_epi32 (to be used by upcoming implementation) 2016-06-18 01:44:48 +02:00
Mounir IDRASSI 2faa1290c0 Windows Driver: save FPU state in 32-bit mode before run Whirlpool SSE implementation to avoid issues (https://msdn.microsoft.com/fr-fr/library/ff565388(v=vs.85).aspx) 2016-06-17 23:52:03 +02:00
Mounir IDRASSI bdc5782f16 Windows: Better heuristics for evaluating Pre-Boot PRF performance 2016-06-17 19:04:04 +02:00
Mounir IDRASSI 42373efcfd Windows: Use Visual C++ 2010 instead of Visual C++ 2008. 2016-06-17 15:50:47 +02:00
Mounir IDRASSI 6ae982cccf Update intrinsic support and cpu detection. 2016-06-17 15:50:46 +02:00
Mounir IDRASSI 842dce0e1b Language XML files: add new fields related to enhanced benchmark dialog 2016-06-17 15:50:44 +02:00
Mounir IDRASSI 27b53c6ff4 Windows: Add Hash and PRF benchmarks to the benchmark dialog. 2016-06-17 15:50:44 +02:00
Mounir IDRASSI aeb4e8a13a Windows: make Camellia help link open dedicated documentation page 2016-06-17 15:50:42 +02:00
Mounir IDRASSI c7756befee Language XML files: update German translation (Ettore Atalan) 2016-06-17 15:50:40 +02:00
Mounir IDRASSI 21d567f731 Crypto: make Serpent source code use the same rotl32/rotr32 primitives as the other files. 2016-06-17 15:50:40 +02:00
Mounir IDRASSI d4e95293d9 Windows: fix compiler warnings 2016-06-17 15:50:39 +02:00
Mounir IDRASSI 76d3bc631e Crypto: Add support for Japanese encryption standard Camellia, including for system encryption. 2016-06-02 00:12:00 +02:00
Mounir IDRASSI 99c4031d89 Windows: better implementation for support of smart card PIN in command line. Supported now also on Format. 2016-05-29 01:33:18 +02:00
Mounir IDRASSI a0d8b8a3b7 Linux/MacOSX: Implement passing smart card PIN as command line argument (--token-pin switch) 2016-05-29 01:33:17 +02:00
Mounir IDRASSI 3f806010d2 Windows: fix detection of Visual Studio version to activate assembly optimizations. 2016-05-24 07:34:13 +02:00
Mounir IDRASSI 94fdcdf18b Merge pull request #69 from anarchyonline/master
MacOSX: Added two line to enable support for retina ui on retina Macs.
2016-05-24 07:28:49 +02:00
AO 2bb419f92c Added two line to enable support for retina ui on retina Macs. 2016-05-20 16:22:42 +02:00
Mounir IDRASSI 635c3b7af7 Readme.txt:Fix wxWidget expected directory for OSX install 2016-05-19 19:39:01 +02:00
Mounir IDRASSI 6954b7c3ef Merge pull request #68 from strazzere/master
Fix wxWidget expected directory for OSX install in Readme
2016-05-19 19:33:59 +02:00
Tim Strazzere 2bb0cbe16e Fix wxWidget expected directory for OSX install 2016-05-18 14:03:40 -07:00
Mounir IDRASSI cdaeef20ce Language XML files: in German translation, replace PIM description "Personal Iterations Multiplier" by "Persönlicher IterationsMultiplikator".(Ettore Atalan) 2016-05-15 17:22:01 +02:00
Mounir IDRASSI ec4a0af41c Language XML files: update German translation (Ettore Atalan) 2016-05-14 22:51:32 +02:00
Mounir IDRASSI 37d7c75db8 Remove UTF8 BOM from language XML files 2016-05-14 13:47:38 +02:00
Mounir IDRASSI 1ad1c293a3 Language XML files: Update Arabic translation (contributed by Ali Khojah) 2016-05-14 13:25:32 +02:00
Mounir IDRASSI 085ab96abd Merge pull request #67 from veracrypt/revert-66-patch-1
Revert "Makefile: fix build under gcc6"
2016-05-13 22:36:05 +02:00
Mounir IDRASSI 438753522e Revert "Makefile: fix build under gcc6" 2016-05-13 22:34:33 +02:00
Mounir IDRASSI fc69e2541e Merge pull request #66 from FadeMind/patch-1
Makefile: fix build under gcc6
2016-05-13 22:28:35 +02:00
Mounir IDRASSI 942cf1635a Linux: Fix gcc-6 compilation errors. 2016-05-13 22:27:16 +02:00
Tomasz Przybył bf47711ee7 Makefile: fix build under gcc6
Veracrypt for build under GCC6 required using compatibility flag `-std=c++98` against change default C++ frontend in GCC6.

The C++ frontend now defaults to C++14 standard instead of C++98 it has
been defaulting to previously, for compiling older C++ code that might
require either explicitly compiling with selected older C++ standards,
or might require some code adjustment, see
http://gcc.gnu.org/gcc-6/porting_to.html for details.  The experimental
C++17 support has been enhanced in this release.

from: https://gcc.gnu.org/ml/gcc-announce/2016/msg00000.html
2016-05-13 08:39:22 +02:00
Mounir IDRASSI 723768137b Language XML files: fix some files. 2016-05-10 22:53:55 +02:00
Mounir IDRASSI 268ef2d8e9 Merge pull request #61 from davidfoerster/normalize-line-terminators
Normalize line terminators
2016-05-10 22:34:27 +02:00
David Foerster 5f47d8b6f1 Fix space before tab 2016-05-10 22:24:06 +02:00
David Foerster 11716ed2da Remove trailing whitespace 2016-05-10 22:18:34 +02:00
David Foerster 1910751558 Fix issues with .gitattributes
- Revert accidentally converted binary file
2016-05-10 21:58:40 +02:00
David Foerster fc37cc4a02 Normalize all line terminators 2016-05-10 20:20:14 +02:00
David Foerster 98b04198c6 Add .gitattributes file 2016-05-10 20:19:18 +02:00
Mounir IDRASSI 6d61f06a53 Update documentation with latest changes (changelog, wait dialog option). 2016-05-05 16:48:10 +02:00
Mounir IDRASSI 53aabf3f14 Windows: Add option and command line switch to hide waiting dialog when performing operations. 2016-05-05 16:48:05 +02:00
Mounir IDRASSI fb9a49cb1a Windows: convert some files encoding from UTF-16 to UTF-8 to be similar to other files. 2016-05-05 16:47:59 +02:00
Mounir IDRASSI fede2cfa18 Windows: Add checkbox in "VeraCrypt Format" to skip Rescue Disk verification during system encryption wizard 2016-05-05 16:47:55 +02:00
Mounir IDRASSI fc89bf6e2c Windows: Fix compilation error caused by previous commit 2016-05-05 01:12:51 +02:00
Mounir IDRASSI b261177b8f Windows/Linux/MacOSX: Set maximum PIM value to 2147468 in order to avoid having negative values for iterations count using the formula 15000 + (PIM x 1000). Add specific error message to XML language files. 2016-05-04 13:14:05 +02:00
Mounir IDRASSI 0b914c8f5d Merge pull request #55 from davidfoerster/xdg-config-paths
Use XDG_CONFIG_HOME to determine the path of the configuration
2016-05-02 07:19:29 +02:00
Mounir IDRASSI 650d913f51 Add User Guide in OpenDocument format and Update its PDF. 2016-05-02 07:14:59 +02:00
David Foerster faea63cb3c Use scoped instead of raw pointer 2016-05-01 23:31:07 +02:00
David Foerster 0c51cfa5f6 Reset bogus executable permissions 2016-05-01 23:29:43 +02:00
Mounir IDRASSI 570645a845 Language XML files: update German translation (Ettore Atalan) 2016-05-01 17:30:27 +02:00
Mounir IDRASSI 275ac8622a Language XML files: add new fields related to Volume ID feature. 2016-04-28 23:06:20 +02:00
Mounir IDRASSI 99de8a6dcd Windows: Only use A: and B: for mounting when no other free drive letter available or when explicitly chosen by user. This avoid side effects when mounting volumes as removable media and automatic drive selection (e.g. A: become invisible in explorer after closing all explorer instances although it is still mounted). 2016-04-28 23:06:11 +02:00
Mounir IDRASSI 91e3843732 Windows: resize Volume ID field on favorites dialog to display full value of ID 2016-04-28 23:06:06 +02:00
Mounir IDRASSI 32b42cff14 Windows: Display Volume ID of a System Favorite even if it is disconnected 2016-04-28 23:06:01 +02:00
Mounir IDRASSI 0163dfdcab Windows: Reduce memory usage of Rescue Disk for cascades by 1KB. 2016-04-20 00:48:30 +02:00
Mounir IDRASSI 1396269d57 Windows: Add option to avoid PIM prompt in pre-boot authentication by storing PIM value unencrypted in MBR. 2016-04-20 00:48:20 +02:00
Mounir IDRASSI bd9105794b Windows: Resize some controls and dialogs to fix text truncation for some non-English languages. 2016-04-20 00:48:10 +02:00
Mounir IDRASSI e51aafb499 Windows: fix keys parts not shown in system encryption wizard when the display keys checkbox is checked. This occurred when the "Display pool content" in the previous wizard page was unchecked before clicking Next. 2016-04-17 00:59:01 +02:00
Mounir IDRASSI 133afdc9e6 Windows: Add missing GUI modification from previous Volume ID commit 2016-04-17 00:58:58 +02:00
Mounir IDRASSI f5606a44a6 Windows: Finalize implementation of the new volume ID mechanism. Use SHA-256 instead of SHA-512 to compute volume ID to reduce string size and make more convenient to use. 2016-04-14 08:53:41 +02:00
Mounir IDRASSI 60575d9a49 Windows: start implementation of volume ID mechanism that will be used to identify VeraCrypt disk volumes instead of device name. 2016-04-08 23:53:49 +02:00
Mounir IDRASSI 409c0f79be Windows: allow drag-n-drop of files and receiving Explorer restart message when VeraCrypt running as elevated process. 2016-04-08 23:53:42 +02:00
Mounir IDRASSI 09b22c175b Windows Setup: Add missing Apache files used by the installer 2016-04-08 23:53:36 +02:00
David Foerster af327b49aa Use wx-provided wrapper around *getenv() 2016-04-01 08:29:17 +02:00
David Foerster 7d7c09e718 Use XDG_CONFIG_HOME to determine the path of the configuration
Adhere to XDG Desktop Specification and use the environment variable
XDG_CONFIG_HOME to determine location of configuration files on *all*
platforms. If it is unset or empty resort to platform-specific defaults.

On Windows and OS X, `wxStandardPaths` provides correct defaults (equal
to the previous hard-coded paths) but on Linux and other Unices
`~/.config/appinfo` would be better than `~/.appinfo`. This means we
treat those platforms as a special case. It also means that we may need
to fall back to the legacy location if it exists but the new location
doesn't.
2016-03-31 12:36:21 +02:00
David Foerster 39eae0e4c3 Remove some trailing whitespace 2016-03-31 12:24:41 +02:00
Mounir IDRASSI dc1593d60f Windows: reduce CPU usage by caching WNetGetConnection calls result for 2 seconds. 2016-03-24 01:36:12 +01:00
Mounir IDRASSI 1e204da223 Windows: Don't use the foreground setting code if the window is already foreground 2016-03-24 01:36:08 +01:00
Mounir IDRASSI ece26c7481 Windows: Implement passing smart card PIN as command line argument (/tokenpin switch) when explicitly mounting a volume. 2016-03-24 01:36:03 +01:00
Mounir IDRASSI 6738cba617 Windows: Better alignment for Group Boxes in favorites management dialog 2016-03-20 01:26:32 +01:00
Axel KöllhoferandMounir IDRASSI 1290e7836f Linux/MacOSX: Fix build error when using strict wxWidgets library that doesn't allow implicit conversions. 2016-03-20 01:26:28 +01:00
Mounir IDRASSI 646679da4d Linux: Completely fix gcc-5 "Invalid characters encountered" issue on mount. It was caused by an issue of gcc-5 STL implementation that is causing char* pointers retrieved from std::string using c_str method to become invalid in the child of a child process (after two fork calls). The workaround is to first copy the std:string values in the child before calling the second fork. 2016-03-18 16:27:29 +01:00
Mounir IDRASSI fd26f49958 Linux: fix mount failure with "Invalid characters encountered" error when building using gcc-5 by disabling the new C++ ABI. For this to work, wxWidgets static library must be built and used by VeraCrypt by specifying WXSTATIC=1 in make command line. 2016-03-17 14:09:59 +01:00
Mounir IDRASSI 8bfc7f1caa Windows: Correctly disable/enable the "Display PIM" checkbox in the favorites configuration dialog 2016-03-17 14:09:55 +01:00
Mounir IDRASSI 8580464e51 Language XML files: correct some entries to match English version 2016-03-17 14:09:51 +01:00
Mounir IDRASSI fffb3bde7a Linux: fix compilation error 2016-02-22 07:57:03 +01:00
Mounir IDRASSI facfda73eb Linux: fix mount issue on Fedora 23 by forcing the creation of a default loop device. 2016-02-22 00:34:36 +01:00
Mounir IDRASSI 50f85b4512 Windows bootloader: try to fix boot issues on some machines by increasing required memory by 1 KiB 2016-02-22 00:34:33 +01:00
Mounir IDRASSI e175adcd46 Windows: correct static inline declaration to solve Windows compilation error 2016-02-22 00:34:30 +01:00
Mounir IDRASSI 0c0ea60b77 Linux & MacOSX: better implementation for TC_THROW_FATAL_EXCEPTION to use __builtin_trap when available. 2016-02-21 10:59:16 +01:00
Mounir IDRASSI 87df2fd2fc Crypto: update Whirlpool implementation using latest code from Crypto++. 2016-02-21 10:59:13 +01:00
Mounir IDRASSI faf00ca1e0 MacOSX: Correctly detect newer versions of OSXFuse 2016-02-21 10:59:11 +01:00
Mounir IDRASSI b331668c06 Windows:Correct explanatory text in VeraCrypt Expander to reader "Mount" instead of "Start". 2016-02-20 02:05:48 +01:00
Mounir IDRASSI 8e8e273e11 Windows: Correctly remove driver file veracrypt.sys during uninstall on Windows 64-bit. Implement deleting locked files after machine reboot. 2016-02-20 02:05:45 +01:00
Mounir IDRASSI 6452fb3693 Language files: update French XML file with exFAT references. 2016-02-20 02:05:43 +01:00
Mounir IDRASSI 348a45132b Language files: Update German translation for PIM shortcut and exFAT references. 2016-02-20 02:05:41 +01:00
Mounir IDRASSI 3c87c095c3 Windows: use buffer with known maximum length as input to FakeDosNameForDevice 2016-02-16 23:21:45 +01:00
Mounir IDRASSI 2724d7880d Language XML files: update Russian XML file by Dmitry Yerokhin. 2016-02-16 23:21:42 +01:00
569 changed files with 218313 additions and 191758 deletions
+50
View File
@@ -0,0 +1,50 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files that could be normalized and converted
# to native line endings on checkout. However, as per the policy they're
# supposed to have LF endings on all platforms.
*.[ch] text diff=cpp eol=lf
*.[ch]pp text diff=cpp eol=lf
*.asm text eol=lf
Makefile text eol=lf
*.make text eol=lf
*.mk text eol=lf
*.inc text eol=lf
*.md text eol=lf
*.xml text eol=lf
*.xpm text -diff -merge eol=lf
*.pem text -diff -merge eol=lf
*.cer text -diff -merge eol=lf
*.manifest text eol=lf
*.sh text eol=lf
*.txt text eol=lf
*.html text diff=html eol=lf
*.idl text eol=lf
*.fbp text eol=lf
*.rgs text eol=lf
*.pkgproj text eol=lf
Sources text eol=lf
# Declare files that will always have LF line endings on checkout.
*.desktop text eol=lf
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
*.vcproj text eol=crlf
*.rc text eol=crlf
*.bat text eol=crlf
*.cmd text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.pdf binary
*.bmp binary
*.ico binary
*.od[fgpst] binary
*.hc binary
*.icns binary
*.rtf binary
*.bz2 binary
*.pfx binary
+503 -503
View File
File diff suppressed because it is too large Load Diff
+264 -264
View File
@@ -1,264 +1,264 @@
This archive contains the source code of VeraCrypt.
It is based on original TrueCrypt 7.1a with security enhancements and modifications.
Important
=========
You may use the source code contained in this archive only if you accept and
agree to the license terms contained in the file 'License.txt', which is
included in this archive.
Note that the license specifies, for example, that a derived work must not be
called 'TrueCrypt' or 'VeraCrypt'
Contents
========
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
Mac OS X specifics
III. FreeBSD and OpenSolaris
IV. Third-Party Developers (Contributors)
V. Legal Information
VI. Further Information
I. Windows
==========
Requirements for Building VeraCrypt for Windows:
------------------------------------------------
- Microsoft Visual C++ 2008 SP1 (Professional Edition or compatible)
- Microsoft Visual C++ 1.52 (available from MSDN Subscriber Downloads)
- Microsoft Windows SDK for Windows 7 (configured for Visual C++)
- Microsoft Windows SDK for Windows 8.1 (needed for SHA-256 code signing)
- Microsoft Windows Driver Kit 7.1.0 (build 7600.16385.1)
- 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)
- NASM assembler 2.08 or compatible
- gzip compressor
- upx packer (available at http://upx.sourceforge.net/)
IMPORTANT:
The 64-bit editions of Windows Vista and later versions of Windows, and in
some cases (e.g. playback of HD DVD content) also the 32-bit editions, do not
allow the VeraCrypt driver to run without an appropriate digital signature.
Therefore, all .sys files in official VeraCrypt binary packages are digitally
signed with the digital certificate of the IDRIX, which was
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).
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
10 KB greater than sizes of your binaries (there may be further differences
if you use a different version of the compiler, or if you install a different
or no service pack for Visual Studio, or different hotfixes for it, or if you
use different versions of the required SDKs).
Instructions for Building VeraCrypt for Windows:
------------------------------------------------
1) Create an environment variable 'MSVC16_ROOT' pointing to the folder 'MSVC15'
extracted from the Visual C++ 1.52 self-extracting package.
Note: The 16-bit installer MSVC15\SETUP.EXE cannot be run on 64-bit Windows,
but it is actually not necessary to run it. You only need to extract the
folder 'MSVC15', which contains the 32-bit binaries required to build the
VeraCrypt Boot Loader.
2) If you have installed the Windows Driver Development Kit in another
directory than '%SYSTEMDRIVE%\WinDDK', create an environment variable
'WINDDK_ROOT' pointing to the DDK installation directory.
3) Copy the PKCS #11 header files to a standard include path or create an
environment variable 'PKCS11_INC' pointing to the directory where
the PKCS #11 header files are installed.
4) Open the solution file 'VeraCrypt.sln' in Microsoft Visual Studio 2008.
5) Select 'All' as the active solution configuration.
6) Build the solution.
7) If successful, there should be newly built VeraCrypt binaries in the
'Release' folder.
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
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"
folder and then modify sign.bat accordingly.
II. Linux and Mac OS X
======================
Requirements for Building VeraCrypt for Linux and Mac OS X:
-----------------------------------------------------------
- GNU Make
- GNU C++ Compiler 4.0 or compatible
- Apple Xcode (Mac OS X only)
- NASM assembler 2.08 or compatible (x86/x64 architecture only)
- pkg-config
- makeself (Linux only)
- wxWidgets 3.0 shared library and header files installed or
wxWidgets 3.0 library source code (available at http://www.wxwidgets.org)
- FUSE library and header files (available at https://github.com/libfuse/libfuse
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'.
Instructions for Building VeraCrypt for Linux and Mac OS X:
-----------------------------------------------------------
1) Change the current directory to the root of the VeraCrypt source code.
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:
$ make WXSTATIC=1 WX_ROOT=/usr/src/wxWidgets wxbuild
The variable WX_ROOT must point to the location of the source code of the
wxWidgets library. Output files will be placed in the './wxrelease/'
directory.
3) To build VeraCrypt, run the following command:
$ 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
'Main'.
By default, a universal executable supporting both graphical and text user
interface (through the switch --text) is built.
On Linux, a console-only executable, which requires no GUI library, can be
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 :
$ ./configure --with-internal-glib
$ make
$ sudo make install
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
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
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")
The build process uses Code Signing certificates whose ID is specified in
src/Main/Main.make (lines 167 & 169). You'll have to modify these lines to put
the ID of your Code Signing certificates or comment them if you don't have one.
Because of incompatibility issues with OSXFUSE, the SDK 10.9 generates a
VeraCrypt binary that has issues communicating with the OSXFUSE kernel extension.
Thus, we recommend to use the SDK 10.8 or earlier for building VeraCrypt.
III. FreeBSD and OpenSolaris
============================
FreeBSD and OpenSolaris are not yet supported.
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.
3) Whether we need help of third-party developers with implementing the feature.
Information on how to contact us can be found at:
https://veracrypt.codeplex.com/
V. Legal Information
====================
Copyright Information
---------------------
This software as a whole:
Copyright (c) 2013-2015 IDRIX. All rights reserved.
Portions of this software:
Copyright (c) 2003-2012 TrueCrypt Developers Association. All rights reserved.
Copyright (c) 1998-2000 Paul Le Roux. All rights reserved.
Copyright (c) 1998-2008 Brian Gladman, Worcester, UK. All rights reserved.
Copyright (c) 2002-2004 Mark Adler. All rights reserved.
For more information, please see the legal notices attached to parts of the
source code.
Trademark Information
---------------------
Any trademarks contained in the source code, binaries, and/or in the
documentation, are the sole property of their respective owners.
VI. Further Information
=======================
http://www.veracrypt.fr
This archive contains the source code of VeraCrypt.
It is based on original TrueCrypt 7.1a with security enhancements and modifications.
Important
=========
You may use the source code contained in this archive only if you accept and
agree to the license terms contained in the file 'License.txt', which is
included in this archive.
Note that the license specifies, for example, that a derived work must not be
called 'TrueCrypt' or 'VeraCrypt'
Contents
========
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
Mac OS X specifics
III. FreeBSD and OpenSolaris
IV. Third-Party Developers (Contributors)
V. Legal Information
VI. Further Information
I. Windows
==========
Requirements for Building VeraCrypt for Windows:
------------------------------------------------
- Microsoft Visual C++ 2010 SP1 (Professional Edition or compatible)
- Microsoft Visual C++ 1.52 (available from MSDN Subscriber Downloads)
- Microsoft Windows SDK for Windows 7.1 (configured for Visual C++ 2010)
- Microsoft Windows SDK for Windows 8.1 (needed for SHA-256 code signing)
- Microsoft Windows Driver Kit 7.1.0 (build 7600.16385.1)
- 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)
- NASM assembler 2.08 or compatible
- gzip compressor
- upx packer (available at http://upx.sourceforge.net/)
IMPORTANT:
The 64-bit editions of Windows Vista and later versions of Windows, and in
some cases (e.g. playback of HD DVD content) also the 32-bit editions, do not
allow the VeraCrypt driver to run without an appropriate digital signature.
Therefore, all .sys files in official VeraCrypt binary packages are digitally
signed with the digital certificate of the IDRIX, which was
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).
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
10 KB greater than sizes of your binaries (there may be further differences
if you use a different version of the compiler, or if you install a different
or no service pack for Visual Studio, or different hotfixes for it, or if you
use different versions of the required SDKs).
Instructions for Building VeraCrypt for Windows:
------------------------------------------------
1) Create an environment variable 'MSVC16_ROOT' pointing to the folder 'MSVC15'
extracted from the Visual C++ 1.52 self-extracting package.
Note: The 16-bit installer MSVC15\SETUP.EXE cannot be run on 64-bit Windows,
but it is actually not necessary to run it. You only need to extract the
folder 'MSVC15', which contains the 32-bit binaries required to build the
VeraCrypt Boot Loader.
2) If you have installed the Windows Driver Development Kit in another
directory than '%SYSTEMDRIVE%\WinDDK', create an environment variable
'WINDDK_ROOT' pointing to the DDK installation directory.
3) Copy the PKCS #11 header files to a standard include path or create an
environment variable 'PKCS11_INC' pointing to the directory where
the PKCS #11 header files are installed.
4) Open the solution file 'VeraCrypt.sln' in Microsoft Visual Studio 2010.
5) Select 'All' as the active solution configuration.
6) Build the solution.
7) If successful, there should be newly built VeraCrypt binaries in the
'Release' folder.
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
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"
folder and then modify sign.bat accordingly.
II. Linux and Mac OS X
======================
Requirements for Building VeraCrypt for Linux and Mac OS X:
-----------------------------------------------------------
- GNU Make
- GNU C++ Compiler 4.0 or compatible
- Apple Xcode (Mac OS X only)
- NASM assembler 2.08 or compatible (x86/x64 architecture only)
- pkg-config
- makeself (Linux only)
- wxWidgets 3.0 shared library and header files installed or
wxWidgets 3.0 library source code (available at http://www.wxwidgets.org)
- FUSE library and header files (available at https://github.com/libfuse/libfuse
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'.
Instructions for Building VeraCrypt for Linux and Mac OS X:
-----------------------------------------------------------
1) Change the current directory to the root of the VeraCrypt source code.
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:
$ make WXSTATIC=1 WX_ROOT=/usr/src/wxWidgets wxbuild
The variable WX_ROOT must point to the location of the source code of the
wxWidgets library. Output files will be placed in the './wxrelease/'
directory.
3) To build VeraCrypt, run the following command:
$ 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
'Main'.
By default, a universal executable supporting both graphical and text user
interface (through the switch --text) is built.
On Linux, a console-only executable, which requires no GUI library, can be
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 :
$ ./configure --with-internal-glib
$ make
$ sudo make install
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
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
VeraCrypt sources (i.e. if "src" path is "/Users/joe/Projects/VeraCrypt/src"
then wxWidgets should be at "/Users/joe/Projects/wxWidgets-3.0.2")
The build process uses Code Signing certificates whose ID is specified in
src/Main/Main.make (lines 167 & 169). You'll have to modify these lines to put
the ID of your Code Signing certificates or comment them if you don't have one.
Because of incompatibility issues with OSXFUSE, the SDK 10.9 generates a
VeraCrypt binary that has issues communicating with the OSXFUSE kernel extension.
Thus, we recommend to use the SDK 10.8 or earlier for building VeraCrypt.
III. FreeBSD and OpenSolaris
============================
FreeBSD and OpenSolaris are not yet supported.
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.
3) Whether we need help of third-party developers with implementing the feature.
Information on how to contact us can be found at:
https://veracrypt.codeplex.com/
V. Legal Information
====================
Copyright Information
---------------------
This software as a whole:
Copyright (c) 2013-2015 IDRIX. All rights reserved.
Portions of this software:
Copyright (c) 2003-2012 TrueCrypt Developers Association. All rights reserved.
Copyright (c) 1998-2000 Paul Le Roux. All rights reserved.
Copyright (c) 1998-2008 Brian Gladman, Worcester, UK. All rights reserved.
Copyright (c) 2002-2004 Mark Adler. All rights reserved.
For more information, please see the legal notices attached to parts of the
source code.
Trademark Information
---------------------
Any trademarks contained in the source code, binaries, and/or in the
documentation, are the sole property of their respective owners.
VI. Further Information
=======================
http://www.veracrypt.fr
+321 -321
View File
@@ -1,321 +1,321 @@
@echo off
setlocal
call :freedrive mydriveletter && goto :cont
echo ERROR: No free drive letter found.
goto :exit
:cont
echo Using drive letter %mydriveletter%: for our tests
echo.
IF NOT EXIST test.sha512.hc GOTO :whirlpool
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount SHA-512 container (Normal)
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha512.hc /hash sha512 /l %mydriveletter% /password test /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo SHA-512 (Normal) = %hh%:%mm%:%ss%,%cc%
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount SHA-512 container (Hidden)
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha512.hc /hash sha512 /l %mydriveletter% /password testhidden /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo SHA-512 (Hidden) = %hh%:%mm%:%ss%,%cc%
echo.
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
:whirlpool
IF NOT EXIST test.whirlpool.hc GOTO :sha256
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount Whirlpool container (Normal).
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.whirlpool.hc /hash whirlpool /l %mydriveletter% /password test /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo Whirlpool (Normal) = %hh%:%mm%:%ss%,%cc%
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount Whirlpool container (Hidden).
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.whirlpool.hc /hash whirlpool /l %mydriveletter% /password testhidden /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo Whirlpool (Hidden) = %hh%:%mm%:%ss%,%cc%
echo.
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
:sha256
IF NOT EXIST test.sha256.hc GOTO :ripemd160
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount SHA-256 container (Normal)
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha256.hc /hash sha256 /l %mydriveletter% /password test /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo SHA-256 (Normal) = %hh%:%mm%:%ss%,%cc%
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount SHA-256 container (Hidden)
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha256.hc /hash sha256 /l %mydriveletter% /password testhidden /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo SHA-256 (Hidden) = %hh%:%mm%:%ss%,%cc%
echo.
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
:ripemd160
IF NOT EXIST test.ripemd160.hc GOTO :autodetect
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount RIPEMD-160 container (Normal)
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.ripemd160.hc /hash ripemd160 /l %mydriveletter% /password test /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo RIPEMD-160 (Normal) = %hh%:%mm%:%ss%,%cc%
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount RIPEMD-160 container (Hidden)
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.ripemd160.hc /hash ripemd160 /l %mydriveletter% /password testhidden /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo RIPEMD-160 (Hidden) = %hh%:%mm%:%ss%,%cc%
echo.
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
:autodetect
call :availablevolume testvolume && goto :contautodetect
goto :exit
:contautodetect
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Try to mount with a wrong password and PRF autodetection
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume %testvolume% /l %mydriveletter% /password wrongpassword /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo Wrong Password (PRF Auto-detection)= %hh%:%mm%:%ss%,%cc%
echo.
goto :exit
rem Finds a free drive letter.
rem
rem Parameters:
rem %1 = Output variable name.
rem
rem Example:
rem call :freedrive mydriveletter && goto :cont
rem echo ERROR: No free drive letter found.
rem goto :EOF
rem :cont
rem echo Found drive letter: %mydriveletter%
:freedrive
setlocal EnableDelayedExpansion
set exitcode=0
set "output_var=%~1"
for %%i in (C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z) do (
set "drive=%%i:"
rem If 'subst' fails, the drive letter is already in use.
rem This way we can even detect optical drives that have a drive
rem letter but no media in them, a case that goes undetected when
rem using 'if exist'.
subst !drive! %SystemDrive%\ >nul
if !errorlevel! == 0 (
subst !drive! /d >nul
set "drive=%%i"
goto :freedrive0
)
)
set exitcode=1
set drive=
:freedrive0
endlocal & set "%output_var%=%drive%" & exit /b %exitcode%
:availablevolume
setlocal EnableDelayedExpansion
set exitcode=0
set "output_var=%~1"
for %%i in (test.sha512.hc,test.sha256.hc,test.whirlpool.hc,test.ripemd160.hc) do (
if exist %%i (
set "volume=%%i"
goto :availablevolume0
)
)
set exitcode=1
set volume=
:availablevolume0
endlocal & set "%output_var%=%volume%" & exit /b %exitcode%
:exit
@echo off
setlocal
call :freedrive mydriveletter && goto :cont
echo ERROR: No free drive letter found.
goto :exit
:cont
echo Using drive letter %mydriveletter%: for our tests
echo.
IF NOT EXIST test.sha512.hc GOTO :whirlpool
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount SHA-512 container (Normal)
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha512.hc /hash sha512 /l %mydriveletter% /password test /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo SHA-512 (Normal) = %hh%:%mm%:%ss%,%cc%
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount SHA-512 container (Hidden)
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha512.hc /hash sha512 /l %mydriveletter% /password testhidden /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo SHA-512 (Hidden) = %hh%:%mm%:%ss%,%cc%
echo.
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
:whirlpool
IF NOT EXIST test.whirlpool.hc GOTO :sha256
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount Whirlpool container (Normal).
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.whirlpool.hc /hash whirlpool /l %mydriveletter% /password test /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo Whirlpool (Normal) = %hh%:%mm%:%ss%,%cc%
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount Whirlpool container (Hidden).
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.whirlpool.hc /hash whirlpool /l %mydriveletter% /password testhidden /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo Whirlpool (Hidden) = %hh%:%mm%:%ss%,%cc%
echo.
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
:sha256
IF NOT EXIST test.sha256.hc GOTO :ripemd160
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount SHA-256 container (Normal)
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha256.hc /hash sha256 /l %mydriveletter% /password test /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo SHA-256 (Normal) = %hh%:%mm%:%ss%,%cc%
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount SHA-256 container (Hidden)
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha256.hc /hash sha256 /l %mydriveletter% /password testhidden /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo SHA-256 (Hidden) = %hh%:%mm%:%ss%,%cc%
echo.
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
:ripemd160
IF NOT EXIST test.ripemd160.hc GOTO :autodetect
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount RIPEMD-160 container (Normal)
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.ripemd160.hc /hash ripemd160 /l %mydriveletter% /password test /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo RIPEMD-160 (Normal) = %hh%:%mm%:%ss%,%cc%
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Mount RIPEMD-160 container (Hidden)
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.ripemd160.hc /hash ripemd160 /l %mydriveletter% /password testhidden /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo RIPEMD-160 (Hidden) = %hh%:%mm%:%ss%,%cc%
echo.
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
:autodetect
call :availablevolume testvolume && goto :contautodetect
goto :exit
:contautodetect
rem Get start time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Try to mount with a wrong password and PRF autodetection
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume %testvolume% /l %mydriveletter% /password wrongpassword /q /silent /m ro
rem Get end time:
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
)
rem Get elapsed time:
set /A elapsed=end-start
rem Show elapsed time:
set /A hh=elapsed/(60*60*100), rest=elapsed%%(60*60*100), mm=rest/(60*100), rest%%=60*100, ss=rest/100, cc=rest%%100
if %hh% lss 10 set hh=0%hh%
if %mm% lss 10 set mm=0%mm%
if %ss% lss 10 set ss=0%ss%
if %cc% lss 10 set cc=0%cc%
echo Wrong Password (PRF Auto-detection)= %hh%:%mm%:%ss%,%cc%
echo.
goto :exit
rem Finds a free drive letter.
rem
rem Parameters:
rem %1 = Output variable name.
rem
rem Example:
rem call :freedrive mydriveletter && goto :cont
rem echo ERROR: No free drive letter found.
rem goto :EOF
rem :cont
rem echo Found drive letter: %mydriveletter%
:freedrive
setlocal EnableDelayedExpansion
set exitcode=0
set "output_var=%~1"
for %%i in (C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z) do (
set "drive=%%i:"
rem If 'subst' fails, the drive letter is already in use.
rem This way we can even detect optical drives that have a drive
rem letter but no media in them, a case that goes undetected when
rem using 'if exist'.
subst !drive! %SystemDrive%\ >nul
if !errorlevel! == 0 (
subst !drive! /d >nul
set "drive=%%i"
goto :freedrive0
)
)
set exitcode=1
set drive=
:freedrive0
endlocal & set "%output_var%=%drive%" & exit /b %exitcode%
:availablevolume
setlocal EnableDelayedExpansion
set exitcode=0
set "output_var=%~1"
for %%i in (test.sha512.hc,test.sha256.hc,test.whirlpool.hc,test.ripemd160.hc) do (
if exist %%i (
set "volume=%%i"
goto :availablevolume0
)
)
set exitcode=1
set volume=
:availablevolume0
endlocal & set "%output_var%=%volume%" & exit /b %exitcode%
:exit
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
+1470 -1447
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
+1472 -1447
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1470 -1446
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
+1465 -1440
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1468 -1443
View File
File diff suppressed because it is too large Load Diff
+1470 -1445
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
+1469 -1444
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
To update secure boot configuration
1. Enter BIOS configuration
2. Switch Secure boot to setup mode (or custom mode). It deletes PK (platform certificate) and allows to load DCS platform key.
3. Boot Windows
4. execute from admin command prompt
powershell -File sb_set_siglists.ps1
It sets in PK (platform key) - DCS_platform
It sets in KEK (key exchange key) - DCS_key_exchange
It sets in db - DCS_sign MicWinProPCA2011_2011-10-19 MicCorUEFCA2011_2011-06-27
All DCS modules are protected by DCS_sign.
All Windows modules are protected by MicWinProPCA2011_2011-10-19
All SHIM(linux) modules are protected by MicCorUEFCA2011_2011-06-27
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
Apart from DCS certificates, there are two public DB entries - one for Windows and one for the UEFI Certificate Authority (CA).
Windows DB: http://www.microsoft.com/pkiops/certs/MicWinProPCA2011_2011-10-19.crt
UEFI DB: http://www.microsoft.com/pkiops/certs/MicCorUEFCA2011_2011-06-27.crt
+22
View File
@@ -0,0 +1,22 @@
Set-ExecutionPolicy Bypass -Force
Import-Module secureboot
Set-SecureBootUEFI -Name PK -Time 2015-09-11 -Content $null
Set-SecureBootUEFI -Name KEK -Time 2015-09-11 -Content $null
Set-SecureBootUEFI -Name db -Time 2015-09-11 -Content $null
Set-SecureBootUEFI -Name dbx -Time 2015-09-11 -Content $null
Write-Host "Setting self-signed PK..."
Set-SecureBootUEFI -Time 2016-08-08T00:00:00Z -ContentFilePath siglists\DCS_platform_SigList.bin -SignedFilePath siglists\DCS_platform_SigList_Serialization.bin.p7 -Name PK
Write-Host "Setting PK-signed KEK..."
Set-SecureBootUEFI -Time 2016-08-08T00:00:00Z -ContentFilePath siglists\DCS_key_exchange_SigList.bin -SignedFilePath siglists\DCS_key_exchange_SigList_Serialization.bin.p7 -Name KEK
Write-Host "Setting KEK-signed DCS cert in db..."
Set-SecureBootUEFI -Time 2016-08-08T00:00:00Z -ContentFilePath siglists\DCS_sign_SigList.bin -SignedFilePath siglists\DCS_sign_SigList_Serialization.bin.p7 -Name db
Write-Host "Setting KEK-signed MS cert in db..."
Set-SecureBootUEFI -Time 2016-08-08T00:00:00Z -ContentFilePath siglists\MicWinProPCA2011_2011-10-19_SigList.bin -SignedFilePath siglists\MicWinProPCA2011_2011-10-19_SigList_Serialization.bin.p7 -Name db -AppendWrite:$true
Write-Host "Setting KEK-signed MS UEFI cert in db..."
Set-SecureBootUEFI -Time 2016-08-08T00:00:00Z -ContentFilePath siglists\MicCorUEFCA2011_2011-06-27_SigList.bin -SignedFilePath siglists\MicCorUEFCA2011_2011-06-27_SigList_Serialization.bin.p7 -Name db -AppendWrite:$true
Binary file not shown.
Binary file not shown.
Binary file not shown.
+32 -32
View File
@@ -1,32 +1,32 @@
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_Bios
#define TC_HEADER_Boot_Bios
#include "Platform.h"
#define TC_LB_SIZE_BIT_SHIFT_DIVISOR 9
#define TC_FIRST_BIOS_DRIVE 0x80
#define TC_LAST_BIOS_DRIVE 0x8f
#define TC_INVALID_BIOS_DRIVE (TC_FIRST_BIOS_DRIVE - 1)
enum
{
BiosResultSuccess = 0x00,
BiosResultInvalidFunction = 0x01
};
typedef byte BiosResult;
#endif // TC_HEADER_Boot_Bios
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_Bios
#define TC_HEADER_Boot_Bios
#include "Platform.h"
#define TC_LB_SIZE_BIT_SHIFT_DIVISOR 9
#define TC_FIRST_BIOS_DRIVE 0x80
#define TC_LAST_BIOS_DRIVE 0x8f
#define TC_INVALID_BIOS_DRIVE (TC_FIRST_BIOS_DRIVE - 1)
enum
{
BiosResultSuccess = 0x00,
BiosResultInvalidFunction = 0x01
};
typedef byte BiosResult;
#endif // TC_HEADER_Boot_Bios
+250 -246
View File
@@ -1,246 +1,250 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="Boot"
ProjectGUID="{8B7F059F-E4C7-4E11-88F5-EE8B8433072E}"
RootNamespace="Boot"
Keyword="MakeFileProj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1&#x0D;&#x0A;&#x0D;&#x0A;md Release_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Release_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES&#x0D;&#x0A;&#x0D;&#x0A;md Release_AES_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Release_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT&#x0D;&#x0A;&#x0D;&#x0A;md Release_Serpent_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Release_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH&#x0D;&#x0A;&#x0D;&#x0A;md Release_Twofish_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Rescue 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_AES_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_Serpent_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_Twofish_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1 SINGLE_PRF=SHA2"
ReBuildCommandLine="del /q /s Release &gt;NUL:&#x0D;&#x0A;md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_SHA2 &gt;NUL:&#x0D;&#x0A;md Release_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_AES &gt;NUL:&#x0D;&#x0A;md Release_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_AES_SHA2 &gt;NUL:&#x0D;&#x0A;md Release_AES_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Serpent &gt;NUL:&#x0D;&#x0A;md Release_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Serpent_SHA2 &gt;NUL:&#x0D;&#x0A;md Release_Serpent_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Twofish &gt;NUL:&#x0D;&#x0A;md Release_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Twofish_SHA2 &gt;NUL:&#x0D;&#x0A;md Release_Twofish_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue &gt;NUL:&#x0D;&#x0A;md Rescue 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_SHA2 &gt;NUL:&#x0D;&#x0A;md Rescue_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_AES &gt;NUL:&#x0D;&#x0A;md Rescue_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_AES_SHA2 &gt;NUL:&#x0D;&#x0A;md Rescue_AES_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_Serpent &gt;NUL:&#x0D;&#x0A;md Rescue_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_Serpent_SHA2 &gt;NUL:&#x0D;&#x0A;md Rescue_Serpent_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_Twofish &gt;NUL:&#x0D;&#x0A;md Rescue_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_Twofish_SHA2 &gt;NUL:&#x0D;&#x0A;md Rescue_Twofish_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1 SINGLE_PRF=SHA2"
CleanCommandLine="del /q /s Release Release_AES Release_Serpent Release_Twofish Rescue Rescue_AES Rescue_Serpent Rescue_Twofish &gt;NUL:&#x0D;&#x0A;del /q /s Release_SHA2 Release_AES_SHA2 Release_Serpent_SHA2 Release_Twofish_SHA2 Rescue_SHA2 Rescue_AES_SHA2 Rescue_Serpent_SHA2 Rescue_Twofish_SHA2 &gt;NUL:&#x0D;&#x0A;"
Output="Release\BootLoader.com"
PreprocessorDefinitions="WIN32;NDEBUG"
IncludeSearchPath="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)\Common&quot;;&quot;$(SolutionDir)\Crypto&quot;;&quot;$(MSVC16_ROOT)\Include&quot;"
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="Release Loader|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1&#x0D;&#x0A;&#x0D;&#x0A;md Release_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES&#x0D;&#x0A;&#x0D;&#x0A;md Release_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT&#x0D;&#x0A;&#x0D;&#x0A;md Release_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH"
ReBuildCommandLine="del /q /s Release &gt;NUL:&#x0D;&#x0A;md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_AES &gt;NUL:&#x0D;&#x0A;md Release_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Serpent &gt;NUL:&#x0D;&#x0A;md Release_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Twofish &gt;NUL:&#x0D;&#x0A;md Release_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH"
CleanCommandLine="del /q /s Release Release_AES Release_Serpent Release_Twofish &gt;NUL:"
Output="Release\BootLoader.com"
PreprocessorDefinitions="WIN32;NDEBUG"
IncludeSearchPath="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)\Common&quot;;&quot;$(SolutionDir)\Crypto&quot;;&quot;$(MSVC16_ROOT)\Include&quot;"
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\BootConfig.cpp"
>
</File>
<File
RelativePath=".\BootConsoleIo.cpp"
>
</File>
<File
RelativePath=".\BootCrt.asm"
>
</File>
<File
RelativePath=".\BootDebug.cpp"
>
</File>
<File
RelativePath=".\BootDiskIo.cpp"
>
</File>
<File
RelativePath=".\BootEncryptedIo.cpp"
>
</File>
<File
RelativePath=".\BootMain.cpp"
>
</File>
<File
RelativePath=".\BootMemory.cpp"
>
</File>
<File
RelativePath=".\BootSector.asm"
>
</File>
<File
RelativePath=".\Decompressor.c"
>
</File>
<File
RelativePath=".\IntFilter.cpp"
>
</File>
<File
RelativePath=".\Platform.cpp"
>
</File>
<Filter
Name="Common"
>
<File
RelativePath="..\..\Common\Crc.c"
>
</File>
<File
RelativePath="..\..\Common\Crypto.c"
>
</File>
<File
RelativePath="..\..\Common\Endian.c"
>
</File>
<File
RelativePath="..\..\Common\Pkcs5.c"
>
</File>
<File
RelativePath="..\..\Common\Volumes.c"
>
</File>
<File
RelativePath="..\..\Common\Xts.c"
>
</File>
</Filter>
<Filter
Name="Crypto"
>
<File
RelativePath="..\..\Crypto\Aes_hw_cpu.asm"
>
</File>
<File
RelativePath="..\..\Crypto\AesSmall.c"
>
</File>
<File
RelativePath="..\..\Crypto\AesSmall_x86.asm"
>
</File>
<File
RelativePath="..\..\Crypto\Rmd160.c"
>
</File>
<File
RelativePath="..\..\Crypto\Serpent.c"
>
</File>
<File
RelativePath="..\..\Crypto\Sha2Small.c"
>
</File>
<File
RelativePath="..\..\Crypto\Twofish.c"
>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\Bios.h"
>
</File>
<File
RelativePath=".\BootCommon.h"
>
</File>
<File
RelativePath=".\BootConfig.h"
>
</File>
<File
RelativePath=".\BootConsoleIo.h"
>
</File>
<File
RelativePath=".\BootDebug.h"
>
</File>
<File
RelativePath=".\BootDefs.h"
>
</File>
<File
RelativePath=".\BootDiskIo.h"
>
</File>
<File
RelativePath=".\BootEncryptedIo.h"
>
</File>
<File
RelativePath=".\BootMain.h"
>
</File>
<File
RelativePath=".\BootMemory.h"
>
</File>
<File
RelativePath=".\BootStrings.h"
>
</File>
<File
RelativePath=".\IntFilter.h"
>
</File>
<File
RelativePath=".\Platform.h"
>
</File>
</Filter>
<Filter
Name="Build Files"
>
<File
RelativePath=".\Makefile"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="Boot"
ProjectGUID="{8B7F059F-E4C7-4E11-88F5-EE8B8433072E}"
RootNamespace="Boot"
Keyword="MakeFileProj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1&#x0D;&#x0A;&#x0D;&#x0A;md Release_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Release_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES&#x0D;&#x0A;&#x0D;&#x0A;md Release_AES_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Release_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT&#x0D;&#x0A;&#x0D;&#x0A;md Release_Serpent_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Release_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH&#x0D;&#x0A;&#x0D;&#x0A;md Release_Twofish_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Release_Camellia 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA&#x0D;&#x0A;&#x0D;&#x0A;md Release_Camellia_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Rescue 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_AES_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_Serpent_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_Twofish_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_Camellia 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;md Rescue_Camellia_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1 SINGLE_PRF=SHA2"
ReBuildCommandLine="del /q /s Release &gt;NUL:&#x0D;&#x0A;md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_SHA2 &gt;NUL:&#x0D;&#x0A;md Release_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_AES &gt;NUL:&#x0D;&#x0A;md Release_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_AES_SHA2 &gt;NUL:&#x0D;&#x0A;md Release_AES_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Serpent &gt;NUL:&#x0D;&#x0A;md Release_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Serpent_SHA2 &gt;NUL:&#x0D;&#x0A;md Release_Serpent_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Twofish &gt;NUL:&#x0D;&#x0A;md Release_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Twofish_SHA2 &gt;NUL:&#x0D;&#x0A;md Release_Twofish_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Camellia &gt;NUL:&#x0D;&#x0A;md Release_Camellia 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Camellia_SHA2 &gt;NUL:&#x0D;&#x0A;md Release_Camellia_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue &gt;NUL:&#x0D;&#x0A;md Rescue 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_SHA2 &gt;NUL:&#x0D;&#x0A;md Rescue_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_AES &gt;NUL:&#x0D;&#x0A;md Rescue_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_AES_SHA2 &gt;NUL:&#x0D;&#x0A;md Rescue_AES_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_Serpent &gt;NUL:&#x0D;&#x0A;md Rescue_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_Serpent_SHA2 &gt;NUL:&#x0D;&#x0A;md Rescue_Serpent_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_Twofish &gt;NUL:&#x0D;&#x0A;md Rescue_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_Twofish_SHA2 &gt;NUL:&#x0D;&#x0A;md Rescue_Twofish_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1 SINGLE_PRF=SHA2&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_Camellia &gt;NUL:&#x0D;&#x0A;md Rescue_Camellia 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Rescue_Camellia_SHA2 &gt;NUL:&#x0D;&#x0A;md Rescue_Camellia_SHA2 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1 SINGLE_PRF=SHA2"
CleanCommandLine="del /q /s Release Release_AES Release_Serpent Release_Twofish Release_Camellia Rescue Rescue_AES Rescue_Serpent Rescue_Twofish Rescue_Camellia &gt;NUL:&#x0D;&#x0A;del /q /s Release_SHA2 Release_AES_SHA2 Release_Serpent_SHA2 Release_Twofish_SHA2 Release_Camellia_SHA2 Rescue_SHA2 Rescue_AES_SHA2 Rescue_Serpent_SHA2 Rescue_Twofish_SHA2 Rescue_Camellia_SHA2 &gt;NUL:&#x0D;&#x0A;"
Output="Release\BootLoader.com"
PreprocessorDefinitions="WIN32;NDEBUG"
IncludeSearchPath="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)\Common&quot;;&quot;$(SolutionDir)\Crypto&quot;;&quot;$(MSVC16_ROOT)\Include&quot;"
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="Release Loader|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1&#x0D;&#x0A;&#x0D;&#x0A;md Release_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES&#x0D;&#x0A;&#x0D;&#x0A;md Release_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT&#x0D;&#x0A;&#x0D;&#x0A;md Release_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH"
ReBuildCommandLine="del /q /s Release &gt;NUL:&#x0D;&#x0A;md Release 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_AES &gt;NUL:&#x0D;&#x0A;md Release_AES 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Serpent &gt;NUL:&#x0D;&#x0A;md Release_Serpent 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT&#x0D;&#x0A;&#x0D;&#x0A;del /q /s Release_Twofish &gt;NUL:&#x0D;&#x0A;md Release_Twofish 2&gt;NUL:&#x0D;&#x0A;nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH"
CleanCommandLine="del /q /s Release Release_AES Release_Serpent Release_Twofish &gt;NUL:"
Output="Release\BootLoader.com"
PreprocessorDefinitions="WIN32;NDEBUG"
IncludeSearchPath="&quot;$(SolutionDir)&quot;;&quot;$(SolutionDir)\Common&quot;;&quot;$(SolutionDir)\Crypto&quot;;&quot;$(MSVC16_ROOT)\Include&quot;"
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\BootConfig.cpp"
>
</File>
<File
RelativePath=".\BootConsoleIo.cpp"
>
</File>
<File
RelativePath=".\BootCrt.asm"
>
</File>
<File
RelativePath=".\BootDebug.cpp"
>
</File>
<File
RelativePath=".\BootDiskIo.cpp"
>
</File>
<File
RelativePath=".\BootEncryptedIo.cpp"
>
</File>
<File
RelativePath=".\BootMain.cpp"
>
</File>
<File
RelativePath=".\BootMemory.cpp"
>
</File>
<File
RelativePath=".\BootSector.asm"
>
</File>
<File
RelativePath=".\Decompressor.c"
>
</File>
<File
RelativePath=".\IntFilter.cpp"
>
</File>
<File
RelativePath=".\Platform.cpp"
>
</File>
<Filter
Name="Common"
>
<File
RelativePath="..\..\Common\Crc.c"
>
</File>
<File
RelativePath="..\..\Common\Crypto.c"
>
</File>
<File
RelativePath="..\..\Common\Endian.c"
>
</File>
<File
RelativePath="..\..\Common\Pkcs5.c"
>
</File>
<File
RelativePath="..\..\Common\Volumes.c"
>
</File>
<File
RelativePath="..\..\Common\Xts.c"
>
</File>
</Filter>
<Filter
Name="Crypto"
>
<File
RelativePath="..\..\Crypto\Aes_hw_cpu.asm"
>
</File>
<File
RelativePath="..\..\Crypto\AesSmall.c"
>
</File>
<File
RelativePath="..\..\Crypto\AesSmall_x86.asm"
>
</File>
<File
RelativePath="..\..\Crypto\CamelliaSmall.c"
>
</File>
<File
RelativePath="..\..\Crypto\Rmd160.c"
>
</File>
<File
RelativePath="..\..\Crypto\Serpent.c"
>
</File>
<File
RelativePath="..\..\Crypto\Sha2Small.c"
>
</File>
<File
RelativePath="..\..\Crypto\Twofish.c"
>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\Bios.h"
>
</File>
<File
RelativePath=".\BootCommon.h"
>
</File>
<File
RelativePath=".\BootConfig.h"
>
</File>
<File
RelativePath=".\BootConsoleIo.h"
>
</File>
<File
RelativePath=".\BootDebug.h"
>
</File>
<File
RelativePath=".\BootDefs.h"
>
</File>
<File
RelativePath=".\BootDiskIo.h"
>
</File>
<File
RelativePath=".\BootEncryptedIo.h"
>
</File>
<File
RelativePath=".\BootMain.h"
>
</File>
<File
RelativePath=".\BootMemory.h"
>
</File>
<File
RelativePath=".\BootStrings.h"
>
</File>
<File
RelativePath=".\IntFilter.h"
>
</File>
<File
RelativePath=".\Platform.h"
>
</File>
</Filter>
<Filter
Name="Build Files"
>
<File
RelativePath=".\Makefile"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
+273
View File
@@ -0,0 +1,273 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release Loader|Win32">
<Configuration>Release Loader</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{8B7F059F-E4C7-4E11-88F5-EE8B8433072E}</ProjectGuid>
<RootNamespace>Boot</RootNamespace>
<Keyword>MakeFileProj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">md Release 2&gt;NUL:
nmake.exe /nologo RELEASE=1
md Release_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_PRF=SHA2
md Release_AES 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES
md Release_AES_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES SINGLE_PRF=SHA2
md Release_Serpent 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT
md Release_Serpent_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT SINGLE_PRF=SHA2
md Release_Twofish 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH
md Release_Twofish_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH SINGLE_PRF=SHA2
md Release_Camellia 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA
md Release_Camellia_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA SINGLE_PRF=SHA2
md Rescue 2&gt;NUL:
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1
md Rescue_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1 SINGLE_PRF=SHA2
md Rescue_AES 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1
md Rescue_AES_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1 SINGLE_PRF=SHA2
md Rescue_Serpent 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1
md Rescue_Serpent_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1 SINGLE_PRF=SHA2
md Rescue_Twofish 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1
md Rescue_Twofish_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1 SINGLE_PRF=SHA2
md Rescue_Camellia 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1
md Rescue_Camellia_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1 SINGLE_PRF=SHA2</NMakeBuildCommandLine>
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">del /q /s Release &gt;NUL:
md Release 2&gt;NUL:
nmake.exe /nologo RELEASE=1
del /q /s Release_SHA2 &gt;NUL:
md Release_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_PRF=SHA2
del /q /s Release_AES &gt;NUL:
md Release_AES 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES
del /q /s Release_AES_SHA2 &gt;NUL:
md Release_AES_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES SINGLE_PRF=SHA2
del /q /s Release_Serpent &gt;NUL:
md Release_Serpent 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT
del /q /s Release_Serpent_SHA2 &gt;NUL:
md Release_Serpent_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT SINGLE_PRF=SHA2
del /q /s Release_Twofish &gt;NUL:
md Release_Twofish 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH
del /q /s Release_Twofish_SHA2 &gt;NUL:
md Release_Twofish_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH SINGLE_PRF=SHA2
del /q /s Release_Camellia &gt;NUL:
md Release_Camellia 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA
del /q /s Release_Camellia_SHA2 &gt;NUL:
md Release_Camellia_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA SINGLE_PRF=SHA2
del /q /s Rescue &gt;NUL:
md Rescue 2&gt;NUL:
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1
del /q /s Rescue_SHA2 &gt;NUL:
md Rescue_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1 SINGLE_PRF=SHA2
del /q /s Rescue_AES &gt;NUL:
md Rescue_AES 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1
del /q /s Rescue_AES_SHA2 &gt;NUL:
md Rescue_AES_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1 SINGLE_PRF=SHA2
del /q /s Rescue_Serpent &gt;NUL:
md Rescue_Serpent 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1
del /q /s Rescue_Serpent_SHA2 &gt;NUL:
md Rescue_Serpent_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1 SINGLE_PRF=SHA2
del /q /s Rescue_Twofish &gt;NUL:
md Rescue_Twofish 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1
del /q /s Rescue_Twofish_SHA2 &gt;NUL:
md Rescue_Twofish_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1 SINGLE_PRF=SHA2
del /q /s Rescue_Camellia &gt;NUL:
md Rescue_Camellia 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1
del /q /s Rescue_Camellia_SHA2 &gt;NUL:
md Rescue_Camellia_SHA2 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1 SINGLE_PRF=SHA2</NMakeReBuildCommandLine>
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">del /q /s Release Release_AES Release_Serpent Release_Twofish Release_Camellia Rescue Rescue_AES Rescue_Serpent Rescue_Twofish Rescue_Camellia &gt;NUL:
del /q /s Release_SHA2 Release_AES_SHA2 Release_Serpent_SHA2 Release_Twofish_SHA2 Release_Camellia_SHA2 Rescue_SHA2 Rescue_AES_SHA2 Rescue_Serpent_SHA2 Rescue_Twofish_SHA2 Rescue_Camellia_SHA2 &gt;NUL:
</NMakeCleanCommandLine>
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\BootLoader.com</NMakeOutput>
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WIN32;NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir);$(SolutionDir)\Common;$(SolutionDir)\Crypto;$(MSVC16_ROOT)\Include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'">$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'">$(Configuration)\</IntDir>
<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'">md Release 2&gt;NUL:
nmake.exe /nologo RELEASE=1
md Release_AES 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES
md Release_Serpent 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT
md Release_Twofish 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH</NMakeBuildCommandLine>
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'">del /q /s Release &gt;NUL:
md Release 2&gt;NUL:
nmake.exe /nologo RELEASE=1
del /q /s Release_AES &gt;NUL:
md Release_AES 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES
del /q /s Release_Serpent &gt;NUL:
md Release_Serpent 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT
del /q /s Release_Twofish &gt;NUL:
md Release_Twofish 2&gt;NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH</NMakeReBuildCommandLine>
<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'">del /q /s Release Release_AES Release_Serpent Release_Twofish &gt;NUL:</NMakeCleanCommandLine>
<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'">Release\BootLoader.com</NMakeOutput>
<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'">WIN32;NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'">$(SolutionDir);$(SolutionDir)\Common;$(SolutionDir)\Crypto;$(MSVC16_ROOT)\Include;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath>
<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
</PropertyGroup>
<ItemDefinitionGroup>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="BootConfig.cpp" />
<ClCompile Include="BootConsoleIo.cpp" />
<ClCompile Include="BootDebug.cpp" />
<ClCompile Include="BootDiskIo.cpp" />
<ClCompile Include="BootEncryptedIo.cpp" />
<ClCompile Include="BootMain.cpp" />
<ClCompile Include="BootMemory.cpp" />
<ClCompile Include="Decompressor.c" />
<ClCompile Include="IntFilter.cpp" />
<ClCompile Include="Platform.cpp" />
<ClCompile Include="..\..\Common\Crc.c" />
<ClCompile Include="..\..\Common\Crypto.c" />
<ClCompile Include="..\..\Common\Endian.c" />
<ClCompile Include="..\..\Common\Pkcs5.c" />
<ClCompile Include="..\..\Common\Volumes.c" />
<ClCompile Include="..\..\Common\Xts.c" />
<ClCompile Include="..\..\Crypto\AesSmall.c" />
<ClCompile Include="..\..\Crypto\CamelliaSmall.c" />
<ClCompile Include="..\..\Crypto\Rmd160.c" />
<ClCompile Include="..\..\Crypto\Serpent.c" />
<ClCompile Include="..\..\Crypto\Sha2Small.c" />
<ClCompile Include="..\..\Crypto\Twofish.c" />
</ItemGroup>
<ItemGroup>
<None Include="BootCrt.asm" />
<None Include="BootSector.asm" />
<None Include="..\..\Crypto\Aes_hw_cpu.asm" />
<None Include="..\..\Crypto\AesSmall_x86.asm" />
<None Include="Makefile" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Bios.h" />
<ClInclude Include="BootCommon.h" />
<ClInclude Include="BootConfig.h" />
<ClInclude Include="BootConsoleIo.h" />
<ClInclude Include="BootDebug.h" />
<ClInclude Include="BootDefs.h" />
<ClInclude Include="BootDiskIo.h" />
<ClInclude Include="BootEncryptedIo.h" />
<ClInclude Include="BootMain.h" />
<ClInclude Include="BootMemory.h" />
<ClInclude Include="BootStrings.h" />
<ClInclude Include="IntFilter.h" />
<ClInclude Include="Platform.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+148
View File
@@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Source Files\Common">
<UniqueIdentifier>{851ac58e-36e0-4dfa-a208-6da2330f5959}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Crypto">
<UniqueIdentifier>{76da5bdb-fe11-430a-8667-2fe7f9ac3667}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Build Files">
<UniqueIdentifier>{732efef1-4474-4845-aa74-17b852cc0f2e}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="BootConfig.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BootConsoleIo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BootDebug.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BootDiskIo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BootEncryptedIo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BootMain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BootMemory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Decompressor.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="IntFilter.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Platform.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\Crc.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\Crypto.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\Endian.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\Pkcs5.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\Volumes.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\Xts.c">
<Filter>Source Files\Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Crypto\AesSmall.c">
<Filter>Source Files\Crypto</Filter>
</ClCompile>
<ClCompile Include="..\..\Crypto\CamelliaSmall.c">
<Filter>Source Files\Crypto</Filter>
</ClCompile>
<ClCompile Include="..\..\Crypto\Rmd160.c">
<Filter>Source Files\Crypto</Filter>
</ClCompile>
<ClCompile Include="..\..\Crypto\Serpent.c">
<Filter>Source Files\Crypto</Filter>
</ClCompile>
<ClCompile Include="..\..\Crypto\Sha2Small.c">
<Filter>Source Files\Crypto</Filter>
</ClCompile>
<ClCompile Include="..\..\Crypto\Twofish.c">
<Filter>Source Files\Crypto</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="BootCrt.asm">
<Filter>Source Files</Filter>
</None>
<None Include="BootSector.asm">
<Filter>Source Files</Filter>
</None>
<None Include="..\..\Crypto\Aes_hw_cpu.asm">
<Filter>Source Files\Crypto</Filter>
</None>
<None Include="..\..\Crypto\AesSmall_x86.asm">
<Filter>Source Files\Crypto</Filter>
</None>
<None Include="Makefile">
<Filter>Build Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Bios.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BootCommon.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BootConfig.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BootConsoleIo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BootDebug.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BootDefs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BootDiskIo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BootEncryptedIo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BootMain.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BootMemory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BootStrings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="IntFilter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Platform.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
+3
View File
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>
+214 -82
View File
@@ -1,82 +1,214 @@
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootCommon
#define TC_HEADER_Boot_BootCommon
#include "Common/Password.h"
#include "BootDefs.h"
// The user will be advised to upgrade the rescue disk if upgrading from the following or any previous version
#define TC_RESCUE_DISK_UPGRADE_NOTICE_MAX_VERSION 0x0116
#define TC_BOOT_LOADER_AREA_SIZE (TC_BOOT_LOADER_AREA_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS)
#define TC_BOOT_VOLUME_HEADER_SECTOR (TC_BOOT_LOADER_AREA_SECTOR_COUNT - 1)
#define TC_BOOT_VOLUME_HEADER_SECTOR_OFFSET (TC_BOOT_VOLUME_HEADER_SECTOR * TC_SECTOR_SIZE_BIOS)
#define TC_CD_BOOTSECTOR_OFFSET 0xd000
#define TC_CD_BOOT_LOADER_SECTOR 26
#define TC_ORIG_BOOT_LOADER_BACKUP_SECTOR TC_BOOT_LOADER_AREA_SECTOR_COUNT
#define TC_ORIG_BOOT_LOADER_BACKUP_SECTOR_OFFSET (TC_ORIG_BOOT_LOADER_BACKUP_SECTOR * TC_SECTOR_SIZE_BIOS)
#define TC_BOOT_LOADER_BACKUP_RESCUE_DISK_SECTOR (TC_ORIG_BOOT_LOADER_BACKUP_SECTOR + TC_BOOT_LOADER_AREA_SECTOR_COUNT)
#define TC_BOOT_LOADER_BACKUP_RESCUE_DISK_SECTOR_OFFSET (TC_BOOT_LOADER_BACKUP_RESCUE_DISK_SECTOR * TC_SECTOR_SIZE_BIOS)
#define TC_MBR_SECTOR 0
#define TC_MAX_MBR_BOOT_CODE_SIZE 440
#define TC_MAX_EXTRA_BOOT_PARTITION_SIZE (512UL * 1024UL * 1024UL)
#pragma pack (1)
typedef struct
{
byte Flags;
} BootSectorConfiguration;
// Modifying this value can introduce incompatibility with previous versions
#define TC_BOOT_LOADER_ARGS_OFFSET 0x10
typedef struct
{
// Modifying this structure can introduce incompatibility with previous versions
char Signature[8];
uint16 BootLoaderVersion;
uint16 CryptoInfoOffset;
uint16 CryptoInfoLength;
uint32 HeaderSaltCrc32;
Password BootPassword;
uint64 HiddenSystemPartitionStart;
uint64 DecoySystemPartitionStart;
uint32 Flags;
uint32 BootDriveSignature;
uint32 BootArgumentsCrc32;
} BootArguments;
// Modifying these values can introduce incompatibility with previous versions
#define TC_BOOT_ARGS_FLAG_EXTRA_BOOT_PARTITION 0x1
#pragma pack ()
// Boot arguments signature should not be defined as a static string
// Modifying these values can introduce incompatibility with previous versions
#define TC_SET_BOOT_ARGUMENTS_SIGNATURE(SG) do { SG[0] = 'T'; SG[1] = 'R'; SG[2] = 'U'; SG[3] = 'E'; SG[4] = 0x11; SG[5] = 0x23; SG[6] = 0x45; SG[7] = 0x66; } while (FALSE)
#define TC_IS_BOOT_ARGUMENTS_SIGNATURE(SG) (SG[0] == 'T' && SG[1] == 'R' && SG[2] == 'U' && SG[3] == 'E' && SG[4] == 0x11 && SG[5] == 0x23 && SG[6] == 0x45 && SG[7] == 0x66)
#endif // TC_HEADER_Boot_BootCommon
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootCommon
#define TC_HEADER_Boot_BootCommon
#include "Common/Password.h"
#include "BootDefs.h"
// The user will be advised to upgrade the rescue disk if upgrading from the following or any previous version
#define TC_RESCUE_DISK_UPGRADE_NOTICE_MAX_VERSION 0x0117
#define TC_BOOT_LOADER_AREA_SIZE (TC_BOOT_LOADER_AREA_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS)
#define TC_BOOT_VOLUME_HEADER_SECTOR (TC_BOOT_LOADER_AREA_SECTOR_COUNT - 1)
#define TC_BOOT_VOLUME_HEADER_SECTOR_OFFSET (TC_BOOT_VOLUME_HEADER_SECTOR * TC_SECTOR_SIZE_BIOS)
#define TC_CD_BOOTSECTOR_OFFSET 0xd000
#define TC_CD_BOOT_LOADER_SECTOR 26
#define TC_ORIG_BOOT_LOADER_BACKUP_SECTOR TC_BOOT_LOADER_AREA_SECTOR_COUNT
#define TC_ORIG_BOOT_LOADER_BACKUP_SECTOR_OFFSET (TC_ORIG_BOOT_LOADER_BACKUP_SECTOR * TC_SECTOR_SIZE_BIOS)
#define TC_BOOT_LOADER_BACKUP_RESCUE_DISK_SECTOR (TC_ORIG_BOOT_LOADER_BACKUP_SECTOR + TC_BOOT_LOADER_AREA_SECTOR_COUNT)
#define TC_BOOT_LOADER_BACKUP_RESCUE_DISK_SECTOR_OFFSET (TC_BOOT_LOADER_BACKUP_RESCUE_DISK_SECTOR * TC_SECTOR_SIZE_BIOS)
#define TC_MBR_SECTOR 0
#define TC_MAX_MBR_BOOT_CODE_SIZE 440
#define TC_MAX_EXTRA_BOOT_PARTITION_SIZE (512UL * 1024UL * 1024UL)
#pragma pack (1)
typedef struct
{
byte Flags;
} BootSectorConfiguration;
// Modifying this value can introduce incompatibility with previous versions
#define TC_BOOT_LOADER_ARGS_OFFSET 0x10
typedef struct
{
// Modifying this structure can introduce incompatibility with previous versions
char Signature[8];
uint16 BootLoaderVersion;
uint16 CryptoInfoOffset;
uint16 CryptoInfoLength;
uint32 HeaderSaltCrc32;
Password BootPassword;
uint64 HiddenSystemPartitionStart;
uint64 DecoySystemPartitionStart;
uint32 Flags;
uint32 BootDriveSignature;
uint32 BootArgumentsCrc32;
} BootArguments;
// Modifying these values can introduce incompatibility with previous versions
#define TC_BOOT_ARGS_FLAG_EXTRA_BOOT_PARTITION 0x1
#pragma pack ()
// Boot arguments signature should not be defined as a static string
// Modifying these values can introduce incompatibility with previous versions
#define TC_SET_BOOT_ARGUMENTS_SIGNATURE(SG) do { SG[0] = 'T'; SG[1] = 'R'; SG[2] = 'U'; SG[3] = 'E'; SG[4] = 0x11; SG[5] = 0x23; SG[6] = 0x45; SG[7] = 0x66; } while (FALSE)
#define TC_IS_BOOT_ARGUMENTS_SIGNATURE(SG) (SG[0] == 'T' && SG[1] == 'R' && SG[2] == 'U' && SG[3] == 'E' && SG[4] == 0x11 && SG[5] == 0x23 && SG[6] == 0x45 && SG[7] == 0x66)
#if !defined(TC_WINDOWS_BOOT)
#define DCS_DISK_ENTRY_LIST_HEADER_SIGN SIGNATURE_64 ('D','C','S','D','E','L','S','T')
#define DE_IDX_CRYPTOHEADER 0
#define DE_IDX_LIST 1
#define DE_IDX_DISKID 2
#define DE_IDX_MAINGPTHDR 3
#define DE_IDX_MAINGPTENTRYS 4
#define DE_IDX_ALTGPTHDR 5
#define DE_IDX_ALTGPTENTRYS 6
#define DE_IDX_EXEC 7
#define DE_IDX_PWDCACHE 8
#define DE_IDX_RND 9
#define DE_IDX_TOTAL 10
static_assert(DE_IDX_TOTAL <= 15, "DE_IDX_TOTAL too big");
enum DcsDiskEntryTypes {
DE_Unused = 0,
DE_Sectors,
DE_List,
DE_DISKID,
DE_ExecParams,
DE_PwdCache,
DE_Rnd
};
#pragma pack(1)
typedef struct _SECREGION_BOOT_PARAMS {
uint64 Ptr;
uint32 Size;
uint32 Crc;
} SECREGION_BOOT_PARAMS;
typedef struct {
uint32 Data1;
uint16 Data2;
uint16 Data3;
byte Data4[8];
} DCS_GUID;
// DE types
typedef struct _DCS_DISK_ENTRY_SECTORS {
uint32 Type;
uint32 Offset; // Offset in memory
uint64 Reserved;
uint64 Start; // Start on disk (byte)
uint64 Length; // length on disk (byte)
} DCS_DISK_ENTRY_SECTORS;
static_assert(sizeof(DCS_DISK_ENTRY_SECTORS) == 32, "Wrong size DCS_DISK_ENTRY_SECTORS");
typedef struct _DCS_DISK_ENTRY_PARAMS {
uint32 Type;
uint32 Offset;
uint64 Reserved[2];
uint64 Length; // size of data
} DCS_DISK_ENTRY_PARAMS;
static_assert(sizeof(DCS_DISK_ENTRY_PARAMS) == 32, "Wrong size DCS_DISK_ENTRY_PARAMS");
typedef struct _DCS_DISK_ENTRY_DISKID {
uint32 Type;
uint32 MbrID;
uint64 ReservedDiskId;
DCS_GUID GptID;
} DCS_DISK_ENTRY_DISKID;
static_assert(sizeof(DCS_DISK_ENTRY_DISKID) == 32, "Wrong size DCS_DISK_ENTRY_DISKID");
#pragma warning(disable:4201)
typedef struct _DCS_DISK_ENTRY {
union {
struct {
uint32 Type;
uint32 Offset;
byte reserved[16];
uint64 Length; // size of structure at Offset
};
DCS_DISK_ENTRY_SECTORS Sectors;
DCS_DISK_ENTRY_DISKID DiskId;
DCS_DISK_ENTRY_PARAMS Prm;
};
} DCS_DISK_ENTRY;
#pragma warning(default:4201)
static_assert(sizeof(DCS_DISK_ENTRY) == 32, "Wrong size DCS_DISK_ENTRY");
// Static compile time checks field offsets
#ifndef FIELD_OFFSET
#define FIELD_OFFSET(t, f) ((UINTN)(&((t*)0)->f))
#endif
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Type) == FIELD_OFFSET(DCS_DISK_ENTRY_SECTORS, Type), "Wrong Type offset");
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Type) == FIELD_OFFSET(DCS_DISK_ENTRY_DISKID, Type), "Wrong Type offset");
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Type) == FIELD_OFFSET(DCS_DISK_ENTRY_PARAMS, Type), "Wrong Type offset");
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Length) == FIELD_OFFSET(DCS_DISK_ENTRY_SECTORS, Length), "Wrong Length offset");
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Length) == FIELD_OFFSET(DCS_DISK_ENTRY_PARAMS, Length), "Wrong Length offset");
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Offset) == FIELD_OFFSET(DCS_DISK_ENTRY_SECTORS, Offset), "Wrong Offset offset");
static_assert(FIELD_OFFSET(DCS_DISK_ENTRY, Offset) == FIELD_OFFSET(DCS_DISK_ENTRY_PARAMS, Offset), "Wrong Offset offset");
// DE type specific data
// DE List
typedef struct _DCS_DISK_ENTRY_LIST {
// EFI_TABLE_HEADER
uint64 Signature;
uint32 Revision;
uint32 HeaderSize; //< The size, in bytes, of the entire table including the EFI_TABLE_HEADER.
uint32 CRC32; //< The 32-bit CRC for the entire table. This value is computed by setting this field to 0, and computing the 32-bit CRC for HeaderSize bytes.
uint32 Reserved; //< Reserved field that must be set to 0.
//
uint32 Count;
uint32 DataSize;
//
DCS_DISK_ENTRY DE[15];
} DCS_DISK_ENTRY_LIST;
static_assert(sizeof(DCS_DISK_ENTRY_LIST) == 512, "Wrong size DCS_DISK_ENTRY_LIST");
typedef struct _DCS_DEP_EXEC {
DCS_GUID ExecPartGuid;
uint16 ExecCmd[248];
} DCS_DEP_EXEC;
static_assert(sizeof(DCS_DEP_EXEC) == 512, "Wrong size DCS_DEP_EXEC");
#define DCS_DEP_PWD_CACHE_SIGN SIGNATURE_64 ('P','W','D','C','A','C','H','E')
typedef struct _DCS_DEP_PWD_CACHE {
uint64 Sign;
uint32 CRC;
uint32 Count;
Password Pwd[4];
int32 Pim[4];
byte pad[512 - 8 - 4 - 4 - (sizeof(Password) + 4) * 4];
} DCS_DEP_PWD_CACHE;
static_assert(sizeof(DCS_DEP_PWD_CACHE) == 512, "Wrong size DCS_DEP_PWD_CACHE");
#pragma pack()
#endif // #if !defined(TC_WINDOWS_BOOT)
#endif // TC_HEADER_Boot_BootCommon
+102 -94
View File
@@ -1,94 +1,102 @@
/*
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.
Modifications and 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.
*/
#include "BootConfig.h"
byte BootSectorFlags;
byte BootLoaderDrive;
byte BootDrive;
bool BootDriveGeometryValid = false;
bool PreventNormalSystemBoot = false;
bool PreventBootMenu = false;
char CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1];
uint32 OuterVolumeBackupHeaderCrc;
bool BootStarted = false;
DriveGeometry BootDriveGeometry;
CRYPTO_INFO *BootCryptoInfo;
Partition EncryptedVirtualPartition;
Partition ActivePartition;
Partition PartitionFollowingActive;
bool ExtraBootPartitionPresent = false;
uint64 HiddenVolumeStartUnitNo;
uint64 HiddenVolumeStartSector;
#ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
void ReadBootSectorUserConfiguration ()
{
byte userConfig;
AcquireSectorBuffer();
if (ReadWriteMBR (false, BootLoaderDrive, true) != BiosResultSuccess)
goto ret;
userConfig = SectorBuffer[TC_BOOT_SECTOR_USER_CONFIG_OFFSET];
#ifdef TC_WINDOWS_BOOT_AES
EnableHwEncryption (!(userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION));
#endif
PreventBootMenu = (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_ESC);
memcpy (CustomUserMessage, SectorBuffer + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET, TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH);
CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH] = 0;
if (userConfig & TC_BOOT_USER_CFG_FLAG_SILENT_MODE)
{
if (CustomUserMessage[0])
{
InitVideoMode();
Print (CustomUserMessage);
}
DisableScreenOutput();
}
OuterVolumeBackupHeaderCrc = *(uint32 *) (SectorBuffer + TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET);
ret:
ReleaseSectorBuffer();
}
BiosResult UpdateBootSectorConfiguration (byte drive)
{
AcquireSectorBuffer();
BiosResult result = ReadWriteMBR (false, drive);
if (result != BiosResultSuccess)
goto ret;
SectorBuffer[TC_BOOT_SECTOR_CONFIG_OFFSET] = BootSectorFlags;
result = ReadWriteMBR (true, drive);
ret:
ReleaseSectorBuffer();
return result;
}
#endif // !TC_WINDOWS_BOOT_RESCUE_DISK_MODE
/*
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.
Modifications and 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.
*/
#include "BootConfig.h"
byte BootSectorFlags;
byte BootLoaderDrive;
byte BootDrive;
bool BootDriveGeometryValid = false;
bool PreventNormalSystemBoot = false;
bool PreventBootMenu = false;
char CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1];
uint32 OuterVolumeBackupHeaderCrc;
bool BootStarted = false;
DriveGeometry BootDriveGeometry;
CRYPTO_INFO *BootCryptoInfo;
Partition EncryptedVirtualPartition;
Partition ActivePartition;
Partition PartitionFollowingActive;
bool ExtraBootPartitionPresent = false;
uint64 PimValueOrHiddenVolumeStartUnitNo; // reuse this variable for stored PIM value to reduce memory usage
uint64 HiddenVolumeStartSector;
#ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
void ReadBootSectorUserConfiguration ()
{
byte userConfig;
AcquireSectorBuffer();
if (ReadWriteMBR (false, BootLoaderDrive, true) != BiosResultSuccess)
goto ret;
userConfig = SectorBuffer[TC_BOOT_SECTOR_USER_CONFIG_OFFSET];
#ifdef TC_WINDOWS_BOOT_AES
EnableHwEncryption (!(userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION));
#endif
PreventBootMenu = (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_ESC);
memcpy (CustomUserMessage, SectorBuffer + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET, TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH);
CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH] = 0;
if (userConfig & TC_BOOT_USER_CFG_FLAG_SILENT_MODE)
{
if (CustomUserMessage[0])
{
InitVideoMode();
Print (CustomUserMessage);
}
DisableScreenOutput();
}
if (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_PIM)
{
PimValueOrHiddenVolumeStartUnitNo.LowPart = 0;
memcpy (&PimValueOrHiddenVolumeStartUnitNo.LowPart, SectorBuffer + TC_BOOT_SECTOR_PIM_VALUE_OFFSET, TC_BOOT_SECTOR_PIM_VALUE_SIZE);
}
else
PimValueOrHiddenVolumeStartUnitNo.LowPart = -1;
OuterVolumeBackupHeaderCrc = *(uint32 *) (SectorBuffer + TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET);
ret:
ReleaseSectorBuffer();
}
BiosResult UpdateBootSectorConfiguration (byte drive)
{
AcquireSectorBuffer();
BiosResult result = ReadWriteMBR (false, drive);
if (result != BiosResultSuccess)
goto ret;
SectorBuffer[TC_BOOT_SECTOR_CONFIG_OFFSET] = BootSectorFlags;
result = ReadWriteMBR (true, drive);
ret:
ReleaseSectorBuffer();
return result;
}
#endif // !TC_WINDOWS_BOOT_RESCUE_DISK_MODE
+46 -46
View File
@@ -1,46 +1,46 @@
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootConfig
#define TC_HEADER_Boot_BootConfig
#include "Crypto.h"
#include "Platform.h"
#include "BootDiskIo.h"
extern byte BootSectorFlags;
extern byte BootLoaderDrive;
extern byte BootDrive;
extern bool BootDriveGeometryValid;
extern DriveGeometry BootDriveGeometry;
extern bool PreventNormalSystemBoot;
extern bool PreventBootMenu;
extern char CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1];
extern uint32 OuterVolumeBackupHeaderCrc;
extern bool BootStarted;
extern CRYPTO_INFO *BootCryptoInfo;
extern Partition EncryptedVirtualPartition;
extern Partition ActivePartition;
extern Partition PartitionFollowingActive;
extern bool ExtraBootPartitionPresent;
extern uint64 HiddenVolumeStartUnitNo;
extern uint64 HiddenVolumeStartSector;
void ReadBootSectorUserConfiguration ();
BiosResult UpdateBootSectorConfiguration (byte drive);
#endif // TC_HEADER_Boot_BootConfig
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootConfig
#define TC_HEADER_Boot_BootConfig
#include "Crypto.h"
#include "Platform.h"
#include "BootDiskIo.h"
extern byte BootSectorFlags;
extern byte BootLoaderDrive;
extern byte BootDrive;
extern bool BootDriveGeometryValid;
extern DriveGeometry BootDriveGeometry;
extern bool PreventNormalSystemBoot;
extern bool PreventBootMenu;
extern char CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1];
extern uint32 OuterVolumeBackupHeaderCrc;
extern bool BootStarted;
extern CRYPTO_INFO *BootCryptoInfo;
extern Partition EncryptedVirtualPartition;
extern Partition ActivePartition;
extern Partition PartitionFollowingActive;
extern bool ExtraBootPartitionPresent;
extern uint64 PimValueOrHiddenVolumeStartUnitNo; // reuse this variable for stored PIM value to reduce memory usage
extern uint64 HiddenVolumeStartSector;
void ReadBootSectorUserConfiguration ();
BiosResult UpdateBootSectorConfiguration (byte drive);
#endif // TC_HEADER_Boot_BootConfig
+339 -339
View File
@@ -1,339 +1,339 @@
/*
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.
Modifications and 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.
*/
#include "Platform.h"
#include "Bios.h"
#include "BootConsoleIo.h"
#include "BootDebug.h"
#include "BootStrings.h"
static int ScreenOutputDisabled = 0;
void DisableScreenOutput ()
{
++ScreenOutputDisabled;
}
void EnableScreenOutput ()
{
--ScreenOutputDisabled;
}
void PrintChar (char c)
{
#ifdef TC_BOOT_TRACING_ENABLED
WriteDebugPort (c);
#endif
if (ScreenOutputDisabled)
return;
__asm
{
mov bx, 7
mov al, c
mov ah, 0xe
int 0x10
}
}
void PrintCharAtCursor (char c)
{
if (ScreenOutputDisabled)
return;
__asm
{
mov bx, 7
mov al, c
mov cx, 1
mov ah, 0xa
int 0x10
}
}
void Print (const char *str)
{
char c;
while (c = *str++)
PrintChar (c);
}
void Print (uint32 number)
{
char str[12];
int pos = 0;
while (number >= 10)
{
str[pos++] = (char) (number % 10) + '0';
number /= 10;
}
str[pos] = (char) (number % 10) + '0';
while (pos >= 0)
PrintChar (str[pos--]);
}
void Print (const uint64 &number)
{
if (number.HighPart == 0)
Print (number.LowPart);
else
PrintHex (number);
}
void PrintHex (byte b)
{
PrintChar (((b >> 4) >= 0xA ? 'A' - 0xA : '0') + (b >> 4));
PrintChar (((b & 0xF) >= 0xA ? 'A' - 0xA : '0') + (b & 0xF));
}
void PrintHex (uint16 data)
{
PrintHex (byte (data >> 8));
PrintHex (byte (data));
}
void PrintHex (uint32 data)
{
PrintHex (uint16 (data >> 16));
PrintHex (uint16 (data));
}
void PrintHex (const uint64 &data)
{
PrintHex (data.HighPart);
PrintHex (data.LowPart);
}
void PrintRepeatedChar (char c, int n)
{
while (n-- > 0)
PrintChar (c);
}
void PrintEndl ()
{
Print ("\r\n");
}
void PrintEndl (int cnt)
{
while (cnt-- > 0)
PrintEndl ();
}
void Beep ()
{
PrintChar (7);
}
void InitVideoMode ()
{
if (ScreenOutputDisabled)
return;
__asm
{
// Text mode 80x25
mov ax, 3
int 0x10
// Page 0
mov ax, 0x500
int 0x10
}
}
void ClearScreen ()
{
if (ScreenOutputDisabled)
return;
__asm
{
// White text on black
mov bh, 7
xor cx, cx
mov dx, 0x184f
mov ax, 0x600
int 0x10
// Cursor at 0,0
xor bh, bh
xor dx, dx
mov ah, 2
int 0x10
}
}
void PrintBackspace ()
{
PrintChar (TC_BIOS_CHAR_BACKSPACE);
PrintCharAtCursor (' ');
}
void PrintError (const char *message)
{
Print (TC_BOOT_STR_ERROR);
Print (message);
PrintEndl();
Beep();
}
void PrintErrorNoEndl (const char *message)
{
Print (TC_BOOT_STR_ERROR);
Print (message);
Beep();
}
byte GetShiftFlags ()
{
byte flags;
__asm
{
mov ah, 2
int 0x16
mov flags, al
}
return flags;
}
byte GetKeyboardChar ()
{
return GetKeyboardChar (nullptr);
}
byte GetKeyboardChar (byte *scanCode)
{
// Work around potential BIOS bugs (Windows boot manager polls the keystroke buffer)
while (!IsKeyboardCharAvailable());
byte asciiCode;
byte scan;
__asm
{
mov ah, 0
int 0x16
mov asciiCode, al
mov scan, ah
}
if (scanCode)
*scanCode = scan;
return asciiCode;
}
bool IsKeyboardCharAvailable ()
{
bool available = false;
__asm
{
mov ah, 1
int 0x16
jz not_avail
mov available, true
not_avail:
}
return available;
}
bool EscKeyPressed ()
{
if (IsKeyboardCharAvailable ())
{
byte keyScanCode;
GetKeyboardChar (&keyScanCode);
return keyScanCode == TC_BIOS_KEY_ESC;
}
return false;
}
void ClearBiosKeystrokeBuffer ()
{
__asm
{
push es
xor ax, ax
mov es, ax
mov di, 0x41e
mov cx, 32
cld
rep stosb
pop es
}
}
bool IsPrintable (char c)
{
return c >= ' ' && c <= '~';
}
bool IsDigit (char c)
{
return c >= '0' && c <= '9';
}
int GetString (char *buffer, size_t bufferSize)
{
byte c;
byte scanCode;
size_t pos = 0;
while (pos < bufferSize)
{
c = GetKeyboardChar (&scanCode);
if (scanCode == TC_BIOS_KEY_ENTER)
break;
if (scanCode == TC_BIOS_KEY_ESC)
return 0;
buffer[pos++] = c;
PrintChar (IsPrintable (c) ? c : ' ');
}
return pos;
}
/*
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.
Modifications and 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.
*/
#include "Platform.h"
#include "Bios.h"
#include "BootConsoleIo.h"
#include "BootDebug.h"
#include "BootStrings.h"
static int ScreenOutputDisabled = 0;
void DisableScreenOutput ()
{
++ScreenOutputDisabled;
}
void EnableScreenOutput ()
{
--ScreenOutputDisabled;
}
void PrintChar (char c)
{
#ifdef TC_BOOT_TRACING_ENABLED
WriteDebugPort (c);
#endif
if (ScreenOutputDisabled)
return;
__asm
{
mov bx, 7
mov al, c
mov ah, 0xe
int 0x10
}
}
void PrintCharAtCursor (char c)
{
if (ScreenOutputDisabled)
return;
__asm
{
mov bx, 7
mov al, c
mov cx, 1
mov ah, 0xa
int 0x10
}
}
void Print (const char *str)
{
char c;
while (c = *str++)
PrintChar (c);
}
void Print (uint32 number)
{
char str[12];
int pos = 0;
while (number >= 10)
{
str[pos++] = (char) (number % 10) + '0';
number /= 10;
}
str[pos] = (char) (number % 10) + '0';
while (pos >= 0)
PrintChar (str[pos--]);
}
void Print (const uint64 &number)
{
if (number.HighPart == 0)
Print (number.LowPart);
else
PrintHex (number);
}
void PrintHex (byte b)
{
PrintChar (((b >> 4) >= 0xA ? 'A' - 0xA : '0') + (b >> 4));
PrintChar (((b & 0xF) >= 0xA ? 'A' - 0xA : '0') + (b & 0xF));
}
void PrintHex (uint16 data)
{
PrintHex (byte (data >> 8));
PrintHex (byte (data));
}
void PrintHex (uint32 data)
{
PrintHex (uint16 (data >> 16));
PrintHex (uint16 (data));
}
void PrintHex (const uint64 &data)
{
PrintHex (data.HighPart);
PrintHex (data.LowPart);
}
void PrintRepeatedChar (char c, int n)
{
while (n-- > 0)
PrintChar (c);
}
void PrintEndl ()
{
Print ("\r\n");
}
void PrintEndl (int cnt)
{
while (cnt-- > 0)
PrintEndl ();
}
void Beep ()
{
PrintChar (7);
}
void InitVideoMode ()
{
if (ScreenOutputDisabled)
return;
__asm
{
// Text mode 80x25
mov ax, 3
int 0x10
// Page 0
mov ax, 0x500
int 0x10
}
}
void ClearScreen ()
{
if (ScreenOutputDisabled)
return;
__asm
{
// White text on black
mov bh, 7
xor cx, cx
mov dx, 0x184f
mov ax, 0x600
int 0x10
// Cursor at 0,0
xor bh, bh
xor dx, dx
mov ah, 2
int 0x10
}
}
void PrintBackspace ()
{
PrintChar (TC_BIOS_CHAR_BACKSPACE);
PrintCharAtCursor (' ');
}
void PrintError (const char *message)
{
Print (TC_BOOT_STR_ERROR);
Print (message);
PrintEndl();
Beep();
}
void PrintErrorNoEndl (const char *message)
{
Print (TC_BOOT_STR_ERROR);
Print (message);
Beep();
}
byte GetShiftFlags ()
{
byte flags;
__asm
{
mov ah, 2
int 0x16
mov flags, al
}
return flags;
}
byte GetKeyboardChar ()
{
return GetKeyboardChar (nullptr);
}
byte GetKeyboardChar (byte *scanCode)
{
// Work around potential BIOS bugs (Windows boot manager polls the keystroke buffer)
while (!IsKeyboardCharAvailable());
byte asciiCode;
byte scan;
__asm
{
mov ah, 0
int 0x16
mov asciiCode, al
mov scan, ah
}
if (scanCode)
*scanCode = scan;
return asciiCode;
}
bool IsKeyboardCharAvailable ()
{
bool available = false;
__asm
{
mov ah, 1
int 0x16
jz not_avail
mov available, true
not_avail:
}
return available;
}
bool EscKeyPressed ()
{
if (IsKeyboardCharAvailable ())
{
byte keyScanCode;
GetKeyboardChar (&keyScanCode);
return keyScanCode == TC_BIOS_KEY_ESC;
}
return false;
}
void ClearBiosKeystrokeBuffer ()
{
__asm
{
push es
xor ax, ax
mov es, ax
mov di, 0x41e
mov cx, 32
cld
rep stosb
pop es
}
}
bool IsPrintable (char c)
{
return c >= ' ' && c <= '~';
}
bool IsDigit (char c)
{
return c >= '0' && c <= '9';
}
int GetString (char *buffer, size_t bufferSize)
{
byte c;
byte scanCode;
size_t pos = 0;
while (pos < bufferSize)
{
c = GetKeyboardChar (&scanCode);
if (scanCode == TC_BIOS_KEY_ENTER)
break;
if (scanCode == TC_BIOS_KEY_ESC)
return 0;
buffer[pos++] = c;
PrintChar (IsPrintable (c) ? c : ' ');
}
return pos;
}
+72 -72
View File
@@ -1,72 +1,72 @@
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootConsoleIo
#define TC_HEADER_Boot_BootConsoleIo
#include "Platform.h"
#define TC_DEBUG_PORT 0
#define TC_BIOS_KEY_ESC 1
#define TC_BIOS_KEY_BACKSPACE 14
#define TC_BIOS_KEY_ENTER 28
#define TC_BIOS_KEY_F1 0x3b
#define TC_BIOS_KEY_F2 0x3c
#define TC_BIOS_KEY_F3 0x3d
#define TC_BIOS_KEY_F4 0x3e
#define TC_BIOS_KEY_F5 0x3f
#define TC_BIOS_KEY_F6 0x40
#define TC_BIOS_KEY_F7 0x41
#define TC_BIOS_KEY_F8 0x42
#define TC_BIOS_KEY_F9 0x43
#define TC_BIOS_KEY_F10 0x44
#define TC_BIOS_SHIFTMASK_CAPSLOCK (1 << 6)
#define TC_BIOS_SHIFTMASK_LSHIFT (1 << 1)
#define TC_BIOS_SHIFTMASK_RSHIFT (1 << 0)
#define TC_BIOS_CHAR_BACKSPACE 8
#define TC_BIOS_MAX_CHARS_PER_LINE 80
void Beep ();
void ClearBiosKeystrokeBuffer ();
void ClearScreen ();
void DisableScreenOutput ();
void EnableScreenOutput ();
bool EscKeyPressed ();
byte GetKeyboardChar ();
byte GetKeyboardChar (byte *scanCode);
byte GetShiftFlags ();
int GetString (char *buffer, size_t bufferSize);
void InitVideoMode ();
bool IsKeyboardCharAvailable ();
bool IsPrintable (char c);
bool IsDigit (char c);
void Print (const char *str);
void Print (uint32 number);
void Print (const uint64 &number);
void PrintBackspace ();
void PrintChar (char c);
void PrintCharAtCursor (char c);
void PrintEndl ();
void PrintEndl (int cnt);
void PrintRepeatedChar (char c, int n);
void PrintError (const char *message);
void PrintErrorNoEndl (const char *message);
void PrintHex (byte b);
void PrintHex (uint16 data);
void PrintHex (uint32 data);
void PrintHex (const uint64 &data);
#endif // TC_HEADER_Boot_BootConsoleIo
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootConsoleIo
#define TC_HEADER_Boot_BootConsoleIo
#include "Platform.h"
#define TC_DEBUG_PORT 0
#define TC_BIOS_KEY_ESC 1
#define TC_BIOS_KEY_BACKSPACE 14
#define TC_BIOS_KEY_ENTER 28
#define TC_BIOS_KEY_F1 0x3b
#define TC_BIOS_KEY_F2 0x3c
#define TC_BIOS_KEY_F3 0x3d
#define TC_BIOS_KEY_F4 0x3e
#define TC_BIOS_KEY_F5 0x3f
#define TC_BIOS_KEY_F6 0x40
#define TC_BIOS_KEY_F7 0x41
#define TC_BIOS_KEY_F8 0x42
#define TC_BIOS_KEY_F9 0x43
#define TC_BIOS_KEY_F10 0x44
#define TC_BIOS_SHIFTMASK_CAPSLOCK (1 << 6)
#define TC_BIOS_SHIFTMASK_LSHIFT (1 << 1)
#define TC_BIOS_SHIFTMASK_RSHIFT (1 << 0)
#define TC_BIOS_CHAR_BACKSPACE 8
#define TC_BIOS_MAX_CHARS_PER_LINE 80
void Beep ();
void ClearBiosKeystrokeBuffer ();
void ClearScreen ();
void DisableScreenOutput ();
void EnableScreenOutput ();
bool EscKeyPressed ();
byte GetKeyboardChar ();
byte GetKeyboardChar (byte *scanCode);
byte GetShiftFlags ();
int GetString (char *buffer, size_t bufferSize);
void InitVideoMode ();
bool IsKeyboardCharAvailable ();
bool IsPrintable (char c);
bool IsDigit (char c);
void Print (const char *str);
void Print (uint32 number);
void Print (const uint64 &number);
void PrintBackspace ();
void PrintChar (char c);
void PrintCharAtCursor (char c);
void PrintEndl ();
void PrintEndl (int cnt);
void PrintRepeatedChar (char c, int n);
void PrintError (const char *message);
void PrintErrorNoEndl (const char *message);
void PrintHex (byte b);
void PrintHex (uint16 data);
void PrintHex (uint32 data);
void PrintHex (const uint64 &data);
#endif // TC_HEADER_Boot_BootConsoleIo
+27 -27
View File
@@ -1,27 +1,27 @@
;
; 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.
;
; Modifications and 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.
;
.MODEL tiny, C
.386
INCLUDE BootDefs.i
EXTERNDEF main:NEAR
_TEXT SEGMENT
ORG TC_COM_EXECUTABLE_OFFSET
start:
jmp main
_TEXT ENDS
END start
;
; 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.
;
; Modifications and 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.
;
.MODEL tiny, C
.386
INCLUDE BootDefs.i
EXTERNDEF main:NEAR
_TEXT SEGMENT
ORG TC_COM_EXECUTABLE_OFFSET
start:
jmp main
_TEXT ENDS
END start
+181 -181
View File
@@ -1,181 +1,181 @@
/*
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.
Modifications and 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.
*/
#include "Platform.h"
#include "Bios.h"
#include "BootConsoleIo.h"
#include "BootDefs.h"
#include "BootDiskIo.h"
#include "BootDebug.h"
#ifdef TC_BOOT_TRACING_ENABLED
void InitDebugPort ()
{
__asm
{
mov dx, TC_DEBUG_PORT
mov ah, 1
int 0x17
mov dx, TC_DEBUG_PORT
mov ah, 0xe2
int 0x17
}
}
void WriteDebugPort (byte dataByte)
{
__asm
{
mov al, dataByte
mov dx, TC_DEBUG_PORT
mov ah, 0
int 0x17
}
}
#endif // TC_BOOT_TRACING_ENABLED
#ifdef TC_BOOT_DEBUG_ENABLED
extern "C" void PrintDebug (uint32 debugVal)
{
Print (debugVal);
PrintEndl();
}
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();
}
void PrintVal (const char *message, const uint64 &value, bool newLine, bool hex)
{
Print (message);
Print (": ");
PrintHex (value);
if (newLine)
PrintEndl();
}
void PrintHexDump (byte *mem, size_t size, uint16 *memSegment)
{
const size_t width = 16;
for (size_t pos = 0; pos < size; )
{
for (int pass = 1; pass <= 2; ++pass)
{
size_t i;
for (i = 0; i < width && pos < size; ++i)
{
byte dataByte;
if (memSegment)
{
__asm
{
push es
mov si, ss:memSegment
mov es, ss:[si]
mov si, ss:mem
add si, pos
mov al, es:[si]
mov dataByte, al
pop es
}
pos++;
}
else
dataByte = mem[pos++];
if (pass == 1)
{
PrintHex (dataByte);
PrintChar (' ');
}
else
PrintChar (IsPrintable (dataByte) ? dataByte : '.');
}
if (pass == 1)
{
pos -= i;
PrintChar (' ');
}
}
PrintEndl ();
}
}
void PrintHexDump (uint16 memSegment, uint16 memOffset, size_t size)
{
PrintHexDump ((byte *) memOffset, size, &memSegment);
}
#endif // TC_BOOT_DEBUG_ENABLED
#ifdef TC_BOOT_STACK_CHECKING_ENABLED
extern "C" char end[];
static void PrintStackInfo ()
{
uint16 spReg;
__asm mov spReg, sp
Print ("Stack: "); Print (TC_BOOT_LOADER_STACK_TOP - spReg);
Print ("/"); Print (TC_BOOT_LOADER_STACK_TOP - (uint16) end);
}
void CheckStack ()
{
uint16 spReg;
__asm mov spReg, sp
if (*(uint32 *) end != 0x12345678UL || spReg < (uint16) end)
{
__asm cli
__asm mov sp, TC_BOOT_LOADER_STACK_TOP
PrintError ("Stack overflow");
TC_THROW_FATAL_EXCEPTION;
}
}
void InitStackChecker ()
{
*(uint32 *) end = 0x12345678UL;
PrintStackInfo();
PrintEndl();
}
#endif // TC_BOOT_STACK_CHECKING_ENABLED
/*
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.
Modifications and 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.
*/
#include "Platform.h"
#include "Bios.h"
#include "BootConsoleIo.h"
#include "BootDefs.h"
#include "BootDiskIo.h"
#include "BootDebug.h"
#ifdef TC_BOOT_TRACING_ENABLED
void InitDebugPort ()
{
__asm
{
mov dx, TC_DEBUG_PORT
mov ah, 1
int 0x17
mov dx, TC_DEBUG_PORT
mov ah, 0xe2
int 0x17
}
}
void WriteDebugPort (byte dataByte)
{
__asm
{
mov al, dataByte
mov dx, TC_DEBUG_PORT
mov ah, 0
int 0x17
}
}
#endif // TC_BOOT_TRACING_ENABLED
#ifdef TC_BOOT_DEBUG_ENABLED
extern "C" void PrintDebug (uint32 debugVal)
{
Print (debugVal);
PrintEndl();
}
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();
}
void PrintVal (const char *message, const uint64 &value, bool newLine, bool hex)
{
Print (message);
Print (": ");
PrintHex (value);
if (newLine)
PrintEndl();
}
void PrintHexDump (byte *mem, size_t size, uint16 *memSegment)
{
const size_t width = 16;
for (size_t pos = 0; pos < size; )
{
for (int pass = 1; pass <= 2; ++pass)
{
size_t i;
for (i = 0; i < width && pos < size; ++i)
{
byte dataByte;
if (memSegment)
{
__asm
{
push es
mov si, ss:memSegment
mov es, ss:[si]
mov si, ss:mem
add si, pos
mov al, es:[si]
mov dataByte, al
pop es
}
pos++;
}
else
dataByte = mem[pos++];
if (pass == 1)
{
PrintHex (dataByte);
PrintChar (' ');
}
else
PrintChar (IsPrintable (dataByte) ? dataByte : '.');
}
if (pass == 1)
{
pos -= i;
PrintChar (' ');
}
}
PrintEndl ();
}
}
void PrintHexDump (uint16 memSegment, uint16 memOffset, size_t size)
{
PrintHexDump ((byte *) memOffset, size, &memSegment);
}
#endif // TC_BOOT_DEBUG_ENABLED
#ifdef TC_BOOT_STACK_CHECKING_ENABLED
extern "C" char end[];
static void PrintStackInfo ()
{
uint16 spReg;
__asm mov spReg, sp
Print ("Stack: "); Print (TC_BOOT_LOADER_STACK_TOP - spReg);
Print ("/"); Print (TC_BOOT_LOADER_STACK_TOP - (uint16) end);
}
void CheckStack ()
{
uint16 spReg;
__asm mov spReg, sp
if (*(uint32 *) end != 0x12345678UL || spReg < (uint16) end)
{
__asm cli
__asm mov sp, TC_BOOT_LOADER_STACK_TOP
PrintError ("Stack overflow");
TC_THROW_FATAL_EXCEPTION;
}
}
void InitStackChecker ()
{
*(uint32 *) end = 0x12345678UL;
PrintStackInfo();
PrintEndl();
}
#endif // TC_BOOT_STACK_CHECKING_ENABLED
+60 -60
View File
@@ -1,60 +1,60 @@
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootDebug
#define TC_HEADER_Boot_BootDebug
#include "Platform.h"
#include "BootConsoleIo.h"
#if 0
# define TC_BOOT_DEBUG_ENABLED
#endif
#if 0 || defined (TC_BOOT_DEBUG_ENABLED)
# define TC_BOOT_STACK_CHECKING_ENABLED
extern "C" void CheckStack ();
#else
# define CheckStack()
#endif
#if 0
# define TC_BOOT_TRACING_ENABLED
# if 1
# define TC_TRACE_INT13
# endif
# if 0
# define TC_TRACE_INT15
# endif
#endif
#ifdef TC_BOOT_DEBUG_ENABLED
# define trace_point do { Print(__FILE__); PrintChar (':'); Print (TC_TO_STRING (__LINE__)); PrintEndl(); } while (false)
# define trace_val(VAL) PrintVal (#VAL, VAL);
# define trace_hex(VAL) do { Print (#VAL), PrintChar (':'); PrintHex (VAL); PrintEndl(); } while (false)
# define assert(COND) do { if (!(COND)) { trace_point; __asm jmp $ } } while (false)
#else
# define trace_point
# define trace_val(VAL)
# define trace_hex(VAL)
# define assert(COND)
#endif
void InitDebugPort ();
void InitStackChecker ();
void WriteDebugPort (byte dataByte);
void PrintHexDump (byte *mem, size_t size, uint16 *memSegment = nullptr);
void PrintHexDump (uint16 memSegment, uint16 memOffset, size_t size);
void PrintVal (const char *message, const uint32 value, bool newLine = true, bool hex = false);
void PrintVal (const char *message, const uint64 &value, bool newLine = true, bool hex = false);
#endif // TC_HEADER_Boot_BootDebug
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootDebug
#define TC_HEADER_Boot_BootDebug
#include "Platform.h"
#include "BootConsoleIo.h"
#if 0
# define TC_BOOT_DEBUG_ENABLED
#endif
#if 0 || defined (TC_BOOT_DEBUG_ENABLED)
# define TC_BOOT_STACK_CHECKING_ENABLED
extern "C" void CheckStack ();
#else
# define CheckStack()
#endif
#if 0
# define TC_BOOT_TRACING_ENABLED
# if 1
# define TC_TRACE_INT13
# endif
# if 0
# define TC_TRACE_INT15
# endif
#endif
#ifdef TC_BOOT_DEBUG_ENABLED
# define trace_point do { Print(__FILE__); PrintChar (':'); Print (TC_TO_STRING (__LINE__)); PrintEndl(); } while (false)
# define trace_val(VAL) PrintVal (#VAL, VAL);
# define trace_hex(VAL) do { Print (#VAL), PrintChar (':'); PrintHex (VAL); PrintEndl(); } while (false)
# define assert(COND) do { if (!(COND)) { trace_point; __asm jmp $ } } while (false)
#else
# define trace_point
# define trace_val(VAL)
# define trace_hex(VAL)
# define assert(COND)
#endif
void InitDebugPort ();
void InitStackChecker ();
void WriteDebugPort (byte dataByte);
void PrintHexDump (byte *mem, size_t size, uint16 *memSegment = nullptr);
void PrintHexDump (uint16 memSegment, uint16 memOffset, size_t size);
void PrintVal (const char *message, const uint32 value, bool newLine = true, bool hex = false);
void PrintVal (const char *message, const uint64 &value, bool newLine = true, bool hex = false);
#endif // TC_HEADER_Boot_BootDebug
+210 -196
View File
@@ -1,196 +1,210 @@
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootDefs
#define TC_HEADER_Boot_BootDefs
// Total memory required (CODE + DATA + BSS + STACK + 0x100) in KBytes - determined from linker map.
#ifdef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
#define TC__BOOT_MEMORY_REQUIRED 44
#else
#define TC__BOOT_MEMORY_REQUIRED 42
#endif
#ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
# undef TC__BOOT_MEMORY_REQUIRED
# ifdef TC_WINDOWS_BOOT_AES
# ifdef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
# define TC__BOOT_MEMORY_REQUIRED 30
# else
# define TC__BOOT_MEMORY_REQUIRED 28
# endif
# elif defined (TC_WINDOWS_BOOT_SERPENT)
# define TC__BOOT_MEMORY_REQUIRED 32
# elif defined (TC_WINDOWS_BOOT_TWOFISH)
# define TC__BOOT_MEMORY_REQUIRED 40
# endif
#if 0
# undef TC__BOOT_MEMORY_REQUIRED
# define TC__BOOT_MEMORY_REQUIRED 60
#endif
#endif
// Modifying this value can introduce incompatibility with previous versions
#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)
#else
# define TC__BOOT_LOADER_SEGMENT_LOW (TC__BOOT_LOADER_SEGMENT - 64 * 1024 / 16)
#endif
#define TC__COM_EXECUTABLE_OFFSET TC_HEX (100)
#define TC__BOOT_LOADER_LOWMEM_SEGMENT TC_HEX (2000)
#define TC__BOOT_LOADER_BUFFER_SEGMENT TC_HEX (4000)
#define TC__BOOT_LOADER_ALT_SEGMENT TC_HEX (6000)
#define TC__BOOT_LOADER_STACK_TOP (TC_BOOT_MEMORY_REQUIRED * TC_UNSIGNED (1024) - 4)
#define TC__LB_SIZE 512
#define TC__BOOT_LOADER_AREA_SECTOR_COUNT 63
#define TC__BOOT_SECTOR_VERSION_OFFSET 430
#define TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET 432
#define TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET 434
#define TC__BOOT_SECTOR_USER_CONFIG_OFFSET 438
#define TC__BOOT_SECTOR_CONFIG_OFFSET 439 // The last byte that is reserved for the boot loader
#define TC__BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH 24
#define TC__BOOT_SECTOR_USER_MESSAGE_OFFSET (TC__BOOT_SECTOR_VERSION_OFFSET - TC__BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH)
#define TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE 4
#define TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET (TC__BOOT_SECTOR_USER_MESSAGE_OFFSET - TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE)
#define TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR 2
#define TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT 4
#define TC__BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE 32768
#define TC__BOOT_LOADER_COMPRESSED_BUFFER_OFFSET (TC_COM_EXECUTABLE_OFFSET + 3072)
#define TC__BOOT_LOADER_START_SECTOR (TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR + TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT)
#define TC__MAX_BOOT_LOADER_SECTOR_COUNT (TC_BOOT_LOADER_AREA_SECTOR_COUNT - TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT - 2)
#define TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE ((TC_BOOT_LOADER_AREA_SECTOR_COUNT - 2) * TC_LB_SIZE)
#define TC__BOOT_LOADER_BACKUP_SECTOR_COUNT 30
#define TC__GZIP_HEADER_SIZE 10
#define TC__BOOT_CFG_FLAG_AREA_SIZE 1 // In bytes
// If you add more flags, revise TC__BOOT_CFG_FLAG_AREA_SIZE
#define TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE TC_HEX (02)
#define TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER TC_HEX (04)
#define TC__BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION TC_HEX (10)
#define TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER TC_HEX (20)
#define TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE (TC_HEX (40) + TC_HEX (80))
// Modifying the following values can introduce incompatibility with previous versions
#define TC__BOOT_USER_CFG_FLAG_SILENT_MODE TC_HEX (01)
#define TC__BOOT_USER_CFG_FLAG_DISABLE_ESC TC_HEX (02)
#define TC__BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION TC_HEX (04)
// The following items are treated as a 2-bit value (apply TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE to obtain the value)
#define TC__HIDDEN_OS_CREATION_PHASE_NONE 0
#define TC__HIDDEN_OS_CREATION_PHASE_CLONING TC_HEX (40) // The boot loader is to copy the content of the system partition to the hidden volume
#define TC__HIDDEN_OS_CREATION_PHASE_WIPING TC_HEX (80) // The boot loader has successfully copied the content of the system partition to the hidden volume. The original OS is to be wiped now.
#define TC__HIDDEN_OS_CREATION_PHASE_WIPED (TC_HEX (40) + TC_HEX (80)) // The original OS has been wiped. The user is required to install a new OS (decoy OS) on the system partition now.
#ifdef TC_ASM_PREPROCESS
#define TC_HEX(N) 0##N##h
#define TC_UNSIGNED(N) N
TC_BOOT_MEMORY_REQUIRED = TC__BOOT_MEMORY_REQUIRED
TC_BOOT_LOADER_SEGMENT = TC__BOOT_LOADER_SEGMENT
TC_BOOT_LOADER_SEGMENT_LOW = TC__BOOT_LOADER_SEGMENT_LOW
TC_COM_EXECUTABLE_OFFSET = TC__COM_EXECUTABLE_OFFSET
TC_BOOT_LOADER_LOWMEM_SEGMENT = TC__BOOT_LOADER_LOWMEM_SEGMENT
TC_BOOT_LOADER_BUFFER_SEGMENT = TC__BOOT_LOADER_BUFFER_SEGMENT
TC_BOOT_LOADER_ALT_SEGMENT = TC__BOOT_LOADER_ALT_SEGMENT
TC_BOOT_LOADER_STACK_TOP = TC__BOOT_LOADER_STACK_TOP
TC_LB_SIZE = TC__LB_SIZE
TC_BOOT_LOADER_AREA_SECTOR_COUNT = TC__BOOT_LOADER_AREA_SECTOR_COUNT
TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET = TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET
TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET = TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET
TC_BOOT_SECTOR_CONFIG_OFFSET = TC__BOOT_SECTOR_CONFIG_OFFSET
TC_BOOT_SECTOR_USER_CONFIG_OFFSET = TC__BOOT_SECTOR_USER_CONFIG_OFFSET
TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR = TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR
TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT = TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE = TC__BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE
TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET = TC__BOOT_LOADER_COMPRESSED_BUFFER_OFFSET
TC_BOOT_LOADER_START_SECTOR = TC__BOOT_LOADER_START_SECTOR
TC_MAX_BOOT_LOADER_SECTOR_COUNT = TC__MAX_BOOT_LOADER_SECTOR_COUNT
TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE = TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE
TC_BOOT_LOADER_BACKUP_SECTOR_COUNT = TC__BOOT_LOADER_BACKUP_SECTOR_COUNT
TC_GZIP_HEADER_SIZE = TC__GZIP_HEADER_SIZE
TC_BOOT_CFG_FLAG_AREA_SIZE = TC__BOOT_CFG_FLAG_AREA_SIZE
TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE = TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE
TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER = TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER
TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER = TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER
TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE = TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE
TC_BOOT_USER_CFG_FLAG_SILENT_MODE = TC__BOOT_USER_CFG_FLAG_SILENT_MODE
TC_HIDDEN_OS_CREATION_PHASE_NONE = TC__HIDDEN_OS_CREATION_PHASE_NONE
TC_HIDDEN_OS_CREATION_PHASE_CLONING = TC__HIDDEN_OS_CREATION_PHASE_CLONING
TC_HIDDEN_OS_CREATION_PHASE_WIPING = TC__HIDDEN_OS_CREATION_PHASE_WIPING
TC_HIDDEN_OS_CREATION_PHASE_WIPED = TC__HIDDEN_OS_CREATION_PHASE_WIPED
#else // TC_ASM_PREPROCESS
#define TC_HEX(N) 0x##N
#define TC_UNSIGNED(N) N##U
#define TC_BOOT_MEMORY_REQUIRED TC__BOOT_MEMORY_REQUIRED
#define TC_BOOT_LOADER_SEGMENT TC__BOOT_LOADER_SEGMENT
#define TC_COM_EXECUTABLE_OFFSET TC__COM_EXECUTABLE_OFFSET
#define TC_BOOT_LOADER_LOWMEM_SEGMENT TC__BOOT_LOADER_LOWMEM_SEGMENT
#define TC_BOOT_LOADER_BUFFER_SEGMENT TC__BOOT_LOADER_BUFFER_SEGMENT
#define TC_BOOT_LOADER_ALT_SEGMENT TC__BOOT_LOADER_ALT_SEGMENT
#define TC_BOOT_LOADER_STACK_TOP (TC__BOOT_LOADER_STACK_TOP)
#define TC_BOOT_LOADER_AREA_SECTOR_COUNT TC__BOOT_LOADER_AREA_SECTOR_COUNT
#define TC_BOOT_SECTOR_USER_MESSAGE_OFFSET TC__BOOT_SECTOR_USER_MESSAGE_OFFSET
#define TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE
#define TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET
#define TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH TC__BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH
#define TC_BOOT_SECTOR_VERSION_OFFSET TC__BOOT_SECTOR_VERSION_OFFSET
#define TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET
#define TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET
#define TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR
#define TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
#define TC_BOOT_SECTOR_CONFIG_OFFSET TC__BOOT_SECTOR_CONFIG_OFFSET
#define TC_BOOT_SECTOR_USER_CONFIG_OFFSET TC__BOOT_SECTOR_USER_CONFIG_OFFSET
#define TC_BOOT_LOADER_START_SECTOR TC__BOOT_LOADER_START_SECTOR
#define TC_LB_SIZE TC__LB_SIZE
#define TC_MAX_BOOT_LOADER_SECTOR_COUNT TC__MAX_BOOT_LOADER_SECTOR_COUNT
#define TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE
#define TC_BOOT_LOADER_BACKUP_SECTOR_COUNT TC__BOOT_LOADER_BACKUP_SECTOR_COUNT
#define TC_GZIP_HEADER_SIZE TC__GZIP_HEADER_SIZE
#define TC_BOOT_CFG_FLAG_AREA_SIZE TC__BOOT_CFG_FLAG_AREA_SIZE
#define TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE
#define TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER
#define TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER
#define TC_BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION TC__BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION
#define TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE
#define TC_BOOT_USER_CFG_FLAG_SILENT_MODE TC__BOOT_USER_CFG_FLAG_SILENT_MODE
#define TC_BOOT_USER_CFG_FLAG_DISABLE_ESC TC__BOOT_USER_CFG_FLAG_DISABLE_ESC
#define TC_BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION TC__BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION
#define TC_HIDDEN_OS_CREATION_PHASE_NONE TC__HIDDEN_OS_CREATION_PHASE_NONE
#define TC_HIDDEN_OS_CREATION_PHASE_CLONING TC__HIDDEN_OS_CREATION_PHASE_CLONING
#define TC_HIDDEN_OS_CREATION_PHASE_WIPING TC__HIDDEN_OS_CREATION_PHASE_WIPING
#define TC_HIDDEN_OS_CREATION_PHASE_WIPED TC__HIDDEN_OS_CREATION_PHASE_WIPED
#endif // TC_ASM_PREPROCESS
#endif // TC_HEADER_Boot_BootDefs
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootDefs
#define TC_HEADER_Boot_BootDefs
// Total memory required (CODE + DATA + BSS + STACK + 0x100) in KBytes - determined from linker map.
#define TC__BOOT_MEMORY_REQUIRED 43
#ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
# undef TC__BOOT_MEMORY_REQUIRED
# ifdef TC_WINDOWS_BOOT_AES
# ifdef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
# define TC__BOOT_MEMORY_REQUIRED 31
# else
# define TC__BOOT_MEMORY_REQUIRED 29
# endif
# elif defined (TC_WINDOWS_BOOT_SERPENT)
# define TC__BOOT_MEMORY_REQUIRED 33
# elif defined (TC_WINDOWS_BOOT_TWOFISH)
# define TC__BOOT_MEMORY_REQUIRED 41
# elif defined (TC_WINDOWS_BOOT_CAMELLIA)
# define TC__BOOT_MEMORY_REQUIRED 31
# endif
#if 0
# undef TC__BOOT_MEMORY_REQUIRED
# define TC__BOOT_MEMORY_REQUIRED 60
#endif
#endif
// Modifying this value can introduce incompatibility with previous versions
#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)
#else
# define TC__BOOT_LOADER_SEGMENT_LOW (TC__BOOT_LOADER_SEGMENT - 64 * 1024 / 16)
#endif
#define TC__COM_EXECUTABLE_OFFSET TC_HEX (100)
#define TC__BOOT_LOADER_LOWMEM_SEGMENT TC_HEX (2000)
#define TC__BOOT_LOADER_BUFFER_SEGMENT TC_HEX (4000)
#define TC__BOOT_LOADER_ALT_SEGMENT TC_HEX (6000)
#define TC__BOOT_LOADER_STACK_TOP (TC_BOOT_MEMORY_REQUIRED * TC_UNSIGNED (1024) - 4)
#define TC__LB_SIZE 512
#define TC__BOOT_LOADER_AREA_SECTOR_COUNT 63
#define TC__BOOT_SECTOR_VERSION_OFFSET 430
#define TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET 432
#define TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET 434
#define TC__BOOT_SECTOR_USER_CONFIG_OFFSET 438
#define TC__BOOT_SECTOR_CONFIG_OFFSET 439 // The last byte that is reserved for the boot loader
#define TC__BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH 24
#define TC__BOOT_SECTOR_USER_MESSAGE_OFFSET (TC__BOOT_SECTOR_VERSION_OFFSET - TC__BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH)
#define TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE 4
#define TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET (TC__BOOT_SECTOR_USER_MESSAGE_OFFSET - TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE)
#define TC__BOOT_SECTOR_PIM_VALUE_SIZE 2
#define TC__BOOT_SECTOR_PIM_VALUE_OFFSET (TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET - TC__BOOT_SECTOR_PIM_VALUE_SIZE)
#define TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR 2
#define TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT 4
#define TC__BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE 32768
#define TC__BOOT_LOADER_COMPRESSED_BUFFER_OFFSET (TC_COM_EXECUTABLE_OFFSET + 3072)
#define TC__BOOT_LOADER_START_SECTOR (TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR + TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT)
#define TC__MAX_BOOT_LOADER_SECTOR_COUNT (TC_BOOT_LOADER_AREA_SECTOR_COUNT - TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT - 2)
#define TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE ((TC_BOOT_LOADER_AREA_SECTOR_COUNT - 2) * TC_LB_SIZE)
#define TC__BOOT_LOADER_BACKUP_SECTOR_COUNT 30
#define TC__GZIP_HEADER_SIZE 10
#define TC__BOOT_CFG_FLAG_AREA_SIZE 1 // In bytes
// If you add more flags, revise TC__BOOT_CFG_FLAG_AREA_SIZE
#define TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE TC_HEX (02)
#define TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER TC_HEX (04)
#define TC__BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION TC_HEX (10)
#define TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER TC_HEX (20)
#define TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE (TC_HEX (40) + TC_HEX (80))
// Modifying the following values can introduce incompatibility with previous versions
#define TC__BOOT_USER_CFG_FLAG_SILENT_MODE TC_HEX (01)
#define TC__BOOT_USER_CFG_FLAG_DISABLE_ESC TC_HEX (02)
#define TC__BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION TC_HEX (04)
#define TC__BOOT_USER_CFG_FLAG_DISABLE_PIM TC_HEX (08)
#define TC__BOOT_USER_CFG_FLAG_STORE_HASH TC_HEX (10)
// The following items are treated as a 2-bit value (apply TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE to obtain the value)
#define TC__HIDDEN_OS_CREATION_PHASE_NONE 0
#define TC__HIDDEN_OS_CREATION_PHASE_CLONING TC_HEX (40) // The boot loader is to copy the content of the system partition to the hidden volume
#define TC__HIDDEN_OS_CREATION_PHASE_WIPING TC_HEX (80) // The boot loader has successfully copied the content of the system partition to the hidden volume. The original OS is to be wiped now.
#define TC__HIDDEN_OS_CREATION_PHASE_WIPED (TC_HEX (40) + TC_HEX (80)) // The original OS has been wiped. The user is required to install a new OS (decoy OS) on the system partition now.
#ifdef TC_ASM_PREPROCESS
#define TC_HEX(N) 0##N##h
#define TC_UNSIGNED(N) N
TC_BOOT_MEMORY_REQUIRED = TC__BOOT_MEMORY_REQUIRED
TC_BOOT_LOADER_SEGMENT = TC__BOOT_LOADER_SEGMENT
TC_BOOT_LOADER_SEGMENT_LOW = TC__BOOT_LOADER_SEGMENT_LOW
TC_COM_EXECUTABLE_OFFSET = TC__COM_EXECUTABLE_OFFSET
TC_BOOT_LOADER_LOWMEM_SEGMENT = TC__BOOT_LOADER_LOWMEM_SEGMENT
TC_BOOT_LOADER_BUFFER_SEGMENT = TC__BOOT_LOADER_BUFFER_SEGMENT
TC_BOOT_LOADER_ALT_SEGMENT = TC__BOOT_LOADER_ALT_SEGMENT
TC_BOOT_LOADER_STACK_TOP = TC__BOOT_LOADER_STACK_TOP
TC_LB_SIZE = TC__LB_SIZE
TC_BOOT_LOADER_AREA_SECTOR_COUNT = TC__BOOT_LOADER_AREA_SECTOR_COUNT
TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET = TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET
TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET = TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET
TC_BOOT_SECTOR_CONFIG_OFFSET = TC__BOOT_SECTOR_CONFIG_OFFSET
TC_BOOT_SECTOR_USER_CONFIG_OFFSET = TC__BOOT_SECTOR_USER_CONFIG_OFFSET
TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR = TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR
TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT = TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE = TC__BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE
TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET = TC__BOOT_LOADER_COMPRESSED_BUFFER_OFFSET
TC_BOOT_LOADER_START_SECTOR = TC__BOOT_LOADER_START_SECTOR
TC_MAX_BOOT_LOADER_SECTOR_COUNT = TC__MAX_BOOT_LOADER_SECTOR_COUNT
TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE = TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE
TC_BOOT_LOADER_BACKUP_SECTOR_COUNT = TC__BOOT_LOADER_BACKUP_SECTOR_COUNT
TC_GZIP_HEADER_SIZE = TC__GZIP_HEADER_SIZE
TC_BOOT_CFG_FLAG_AREA_SIZE = TC__BOOT_CFG_FLAG_AREA_SIZE
TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE = TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE
TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER = TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER
TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER = TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER
TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE = TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE
TC_BOOT_USER_CFG_FLAG_SILENT_MODE = TC__BOOT_USER_CFG_FLAG_SILENT_MODE
TC_HIDDEN_OS_CREATION_PHASE_NONE = TC__HIDDEN_OS_CREATION_PHASE_NONE
TC_HIDDEN_OS_CREATION_PHASE_CLONING = TC__HIDDEN_OS_CREATION_PHASE_CLONING
TC_HIDDEN_OS_CREATION_PHASE_WIPING = TC__HIDDEN_OS_CREATION_PHASE_WIPING
TC_HIDDEN_OS_CREATION_PHASE_WIPED = TC__HIDDEN_OS_CREATION_PHASE_WIPED
#else // TC_ASM_PREPROCESS
#define TC_HEX(N) 0x##N
#define TC_UNSIGNED(N) N##U
#define TC_BOOT_MEMORY_REQUIRED TC__BOOT_MEMORY_REQUIRED
#define TC_BOOT_LOADER_SEGMENT TC__BOOT_LOADER_SEGMENT
#define TC_COM_EXECUTABLE_OFFSET TC__COM_EXECUTABLE_OFFSET
#define TC_BOOT_LOADER_LOWMEM_SEGMENT TC__BOOT_LOADER_LOWMEM_SEGMENT
#define TC_BOOT_LOADER_BUFFER_SEGMENT TC__BOOT_LOADER_BUFFER_SEGMENT
#define TC_BOOT_LOADER_ALT_SEGMENT TC__BOOT_LOADER_ALT_SEGMENT
#define TC_BOOT_LOADER_STACK_TOP (TC__BOOT_LOADER_STACK_TOP)
#define TC_BOOT_LOADER_AREA_SECTOR_COUNT TC__BOOT_LOADER_AREA_SECTOR_COUNT
#define TC_BOOT_SECTOR_USER_MESSAGE_OFFSET TC__BOOT_SECTOR_USER_MESSAGE_OFFSET
#define TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE
#define TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET
#define TC_BOOT_SECTOR_PIM_VALUE_SIZE TC__BOOT_SECTOR_PIM_VALUE_SIZE
#define TC_BOOT_SECTOR_PIM_VALUE_OFFSET TC__BOOT_SECTOR_PIM_VALUE_OFFSET
#define TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH TC__BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH
#define TC_BOOT_SECTOR_VERSION_OFFSET TC__BOOT_SECTOR_VERSION_OFFSET
#define TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET
#define TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET
#define TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR
#define TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
#define TC_BOOT_SECTOR_CONFIG_OFFSET TC__BOOT_SECTOR_CONFIG_OFFSET
#define TC_BOOT_SECTOR_USER_CONFIG_OFFSET TC__BOOT_SECTOR_USER_CONFIG_OFFSET
#define TC_BOOT_LOADER_START_SECTOR TC__BOOT_LOADER_START_SECTOR
#define TC_LB_SIZE TC__LB_SIZE
#define TC_MAX_BOOT_LOADER_SECTOR_COUNT TC__MAX_BOOT_LOADER_SECTOR_COUNT
#define TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE
#define TC_BOOT_LOADER_BACKUP_SECTOR_COUNT TC__BOOT_LOADER_BACKUP_SECTOR_COUNT
#define TC_GZIP_HEADER_SIZE TC__GZIP_HEADER_SIZE
#define TC_BOOT_CFG_FLAG_AREA_SIZE TC__BOOT_CFG_FLAG_AREA_SIZE
#define TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE
#define TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER
#define TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER
#define TC_BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION TC__BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION
#define TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE
#define TC_BOOT_USER_CFG_FLAG_SILENT_MODE TC__BOOT_USER_CFG_FLAG_SILENT_MODE
#define TC_BOOT_USER_CFG_FLAG_DISABLE_ESC TC__BOOT_USER_CFG_FLAG_DISABLE_ESC
#define TC_BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION TC__BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION
#define TC_BOOT_USER_CFG_FLAG_DISABLE_PIM TC__BOOT_USER_CFG_FLAG_DISABLE_PIM
#define TC_BOOT_USER_CFG_FLAG_STORE_HASH TC__BOOT_USER_CFG_FLAG_STORE_HASH
#define TC_HIDDEN_OS_CREATION_PHASE_NONE TC__HIDDEN_OS_CREATION_PHASE_NONE
#define TC_HIDDEN_OS_CREATION_PHASE_CLONING TC__HIDDEN_OS_CREATION_PHASE_CLONING
#define TC_HIDDEN_OS_CREATION_PHASE_WIPING TC__HIDDEN_OS_CREATION_PHASE_WIPING
#define TC_HIDDEN_OS_CREATION_PHASE_WIPED TC__HIDDEN_OS_CREATION_PHASE_WIPED
#endif // TC_ASM_PREPROCESS
#define EFI_BOOTARGS_REGIONS_LOW 0x90000, 0x88000, 0x80000
#define EFI_BOOTARGS_REGIONS_HIGH \
0x100000, 0x200000, 0x300000, 0x400000, 0x500000, 0x600000, 0x700000, 0x800000, \
0x900000, 0xA00000, 0xB00000, 0xC00000, 0xD00000, 0xE00000, 0xF00000, 0x1000000
#define EFI_BOOTARGS_REGIONS EFI_BOOTARGS_REGIONS_LOW, EFI_BOOTARGS_REGIONS_HIGH
#endif // TC_HEADER_Boot_BootDefs
+491 -491
View File
@@ -1,491 +1,491 @@
/*
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.
Modifications and 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.
*/
#include "Bios.h"
#include "BootConsoleIo.h"
#include "BootConfig.h"
#include "BootDebug.h"
#include "BootDefs.h"
#include "BootDiskIo.h"
#include "BootStrings.h"
byte SectorBuffer[TC_LB_SIZE];
#ifdef TC_BOOT_DEBUG_ENABLED
static bool SectorBufferInUse = false;
void AcquireSectorBuffer ()
{
if (SectorBufferInUse)
TC_THROW_FATAL_EXCEPTION;
SectorBufferInUse = true;
}
void ReleaseSectorBuffer ()
{
SectorBufferInUse = false;
}
#endif
bool IsLbaSupported (byte drive)
{
static byte CachedDrive = TC_INVALID_BIOS_DRIVE;
static bool CachedStatus;
uint16 result = 0;
if (CachedDrive == drive)
goto ret;
__asm
{
mov bx, 0x55aa
mov dl, drive
mov ah, 0x41
int 0x13
jc err
mov result, bx
err:
}
CachedDrive = drive;
CachedStatus = (result == 0xaa55);
ret:
return CachedStatus;
}
void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs)
{
PrintEndl();
Print (write ? "Write" : "Read"); Print (" error:");
Print (error);
Print (" Drive:");
Print (drive ^ 0x80);
if (sector)
{
Print (" Sector:");
Print (*sector);
}
if (chs)
{
Print (" CHS:");
Print (*chs);
}
PrintEndl();
Beep();
}
void Print (const ChsAddress &chs)
{
Print (chs.Cylinder);
PrintChar ('/');
Print (chs.Head);
PrintChar ('/');
Print (chs.Sector);
}
void PrintSectorCountInMB (const uint64 &sectorCount)
{
Print (sectorCount >> (TC_LB_SIZE_BIT_SHIFT_DIVISOR + 2)); Print (" MB ");
}
BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
{
CheckStack();
byte cylinderLow = (byte) chs.Cylinder;
byte sector = chs.Sector;
sector |= byte (chs.Cylinder >> 2) & 0xc0;
byte function = write ? 0x03 : 0x02;
BiosResult result;
byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
do
{
result = BiosResultSuccess;
__asm
{
push es
mov ax, bufferSegment
mov es, ax
mov bx, bufferOffset
mov dl, drive
mov ch, cylinderLow
mov si, chs
mov dh, [si].Head
mov cl, sector
mov al, sectorCount
mov ah, function
int 0x13
jnc ok // If CF=0, ignore AH to prevent issues caused by potential bugs in BIOSes
mov result, ah
ok:
pop es
}
if (result == BiosResultEccCorrected)
result = BiosResultSuccess;
// Some BIOSes report I/O errors prematurely in some cases
} while (result != BiosResultSuccess && --tryCount != 0);
if (!silent && result != BiosResultSuccess)
PrintDiskError (result, write, drive, nullptr, &chs);
return result;
}
BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
{
uint16 codeSeg;
__asm mov codeSeg, cs
return ReadWriteSectors (write, codeSeg, (uint16) buffer, drive, chs, sectorCount, silent);
}
BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
{
return ReadWriteSectors (false, buffer, drive, chs, sectorCount, silent);
}
BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
{
return ReadWriteSectors (true, buffer, drive, chs, sectorCount, silent);
}
static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
CheckStack();
if (!IsLbaSupported (drive))
{
DriveGeometry geometry;
BiosResult result = GetDriveGeometry (drive, geometry, silent);
if (result != BiosResultSuccess)
return result;
ChsAddress chs;
LbaToChs (geometry, sector, chs);
return ReadWriteSectors (write, (uint16) (dapPacket.Buffer >> 16), (uint16) dapPacket.Buffer, drive, chs, sectorCount, silent);
}
dapPacket.Size = sizeof (dapPacket);
dapPacket.Reserved = 0;
dapPacket.SectorCount = sectorCount;
dapPacket.Sector = sector;
byte function = write ? 0x43 : 0x42;
BiosResult result;
byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
do
{
result = BiosResultSuccess;
__asm
{
mov bx, 0x55aa
mov dl, drive
mov si, [dapPacket]
mov ah, function
xor al, al
int 0x13
jnc ok // If CF=0, ignore AH to prevent issues caused by potential bugs in BIOSes
mov result, ah
ok:
}
if (result == BiosResultEccCorrected)
result = BiosResultSuccess;
// Some BIOSes report I/O errors prematurely in some cases
} while (result != BiosResultSuccess && --tryCount != 0);
if (!silent && result != BiosResultSuccess)
PrintDiskError (result, write, drive, &sector);
return result;
}
static BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
BiosLbaPacket dapPacket;
dapPacket.Buffer = (uint32) buffer;
return ReadWriteSectors (write, dapPacket, drive, sector, sectorCount, silent);
}
BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
BiosLbaPacket dapPacket;
dapPacket.Buffer = ((uint32) bufferSegment << 16) | bufferOffset;
return ReadWriteSectors (write, dapPacket, drive, sector, sectorCount, silent);
}
BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
return ReadWriteSectors (false, bufferSegment, bufferOffset, drive, sector, sectorCount, silent);
}
BiosResult ReadSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
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
if (!BootStarted)
CopyMemory (TC_BOOT_LOADER_ALT_SEGMENT, (uint16) buffer, buffer, sectorCount * TC_LB_SIZE);
return result;
}
BiosResult WriteSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
return ReadWriteSectors (true, buffer, drive, sector, sectorCount, silent);
}
BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent)
{
CheckStack();
byte maxCylinderLow, maxHead, maxSector;
BiosResult result;
__asm
{
push es
mov dl, drive
mov ah, 0x08
int 0x13
mov result, ah
mov maxCylinderLow, ch
mov maxSector, cl
mov maxHead, dh
pop es
}
if (result == BiosResultSuccess)
{
geometry.Cylinders = (maxCylinderLow | (uint16 (maxSector & 0xc0) << 2)) + 1;
geometry.Heads = maxHead + 1;
geometry.Sectors = maxSector & ~0xc0;
}
else if (!silent)
{
Print ("Drive ");
Print (drive ^ 0x80);
Print (" not found: ");
PrintErrorNoEndl ("");
Print (result);
PrintEndl();
}
return result;
}
void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba)
{
lba.HighPart = 0;
lba.LowPart = (uint32 (chs.Cylinder) * geometry.Heads + chs.Head) * geometry.Sectors + chs.Sector - 1;
}
void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs)
{
chs.Sector = (byte) ((lba.LowPart % geometry.Sectors) + 1);
uint32 ch = lba.LowPart / geometry.Sectors;
chs.Head = (byte) (ch % geometry.Heads);
chs.Cylinder = (uint16) (ch / geometry.Heads);
}
void PartitionEntryMBRToPartition (const PartitionEntryMBR &partEntry, Partition &partition)
{
partition.Active = partEntry.BootIndicator == 0x80;
partition.EndSector.HighPart = 0;
partition.EndSector.LowPart = partEntry.StartLBA + partEntry.SectorCountLBA - 1;
partition.SectorCount.HighPart = 0;
partition.SectorCount.LowPart = partEntry.SectorCountLBA;
partition.StartSector.HighPart = 0;
partition.StartSector.LowPart = partEntry.StartLBA;
partition.Type = partEntry.Type;
}
BiosResult ReadWriteMBR (bool write, byte drive, bool silent)
{
uint64 mbrSector;
mbrSector.HighPart = 0;
mbrSector.LowPart = 0;
if (write)
return WriteSectors (SectorBuffer, drive, mbrSector, 1, silent);
return ReadSectors (SectorBuffer, drive, mbrSector, 1, silent); // Uses alternative segment
}
BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly, Partition *findPartitionFollowingThis, bool silent)
{
Partition *followingPartition;
Partition tmpPartition;
if (findPartitionFollowingThis)
{
assert (partitionArrayCapacity == 1);
partitionArrayCapacity = 0xff;
followingPartition = partitionArray;
partitionArray = &tmpPartition;
followingPartition->Drive = TC_INVALID_BIOS_DRIVE;
followingPartition->StartSector.LowPart = 0xFFFFffffUL;
}
AcquireSectorBuffer();
BiosResult result = ReadWriteMBR (false, drive, silent);
ReleaseSectorBuffer();
partitionCount = 0;
MBR *mbr = (MBR *) SectorBuffer;
if (result != BiosResultSuccess || mbr->Signature != 0xaa55)
return result;
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];
PartitionEntryMBRToPartition (partEntry, partition);
if (activeOnly && !partition.Active)
continue;
partition.Drive = drive;
partition.Number = partitionArrayPos;
if (partEntry.Type == 0x5 || partEntry.Type == 0xf) // Extended partition
{
if (IsLbaSupported (drive))
{
// Find all extended partitions
uint64 firstExtStartLBA = partition.StartSector;
uint64 extStartLBA = partition.StartSector;
MBR *extMbr = (MBR *) SectorBuffer;
while (partitionArrayPos < partitionArrayCapacity &&
(result = ReadSectors ((byte *) extMbr, drive, extStartLBA, 1, silent)) == BiosResultSuccess
&& extMbr->Signature == 0xaa55)
{
if (extMbr->Partitions[0].SectorCountLBA > 0)
{
Partition &logPart = partitionArray[partitionArrayPos];
PartitionEntryMBRToPartition (extMbr->Partitions[0], logPart);
logPart.Drive = drive;
logPart.Number = partitionArrayPos;
logPart.Primary = false;
logPart.StartSector.LowPart += extStartLBA.LowPart;
logPart.EndSector.LowPart += extStartLBA.LowPart;
if (findPartitionFollowingThis)
{
if (logPart.StartSector.LowPart > findPartitionFollowingThis->EndSector.LowPart
&& logPart.StartSector.LowPart < followingPartition->StartSector.LowPart)
{
*followingPartition = logPart;
}
}
else
++partitionArrayPos;
}
// Secondary extended
if (extMbr->Partitions[1].Type != 0x5 && extMbr->Partitions[1].Type == 0xf
|| extMbr->Partitions[1].SectorCountLBA == 0)
break;
extStartLBA.LowPart = extMbr->Partitions[1].StartLBA + firstExtStartLBA.LowPart;
}
}
}
else
{
partition.Primary = true;
if (findPartitionFollowingThis)
{
if (partition.StartSector.LowPart > findPartitionFollowingThis->EndSector.LowPart
&& partition.StartSector.LowPart < followingPartition->StartSector.LowPart)
{
*followingPartition = partition;
}
}
else
++partitionArrayPos;
}
}
}
partitionCount = partitionArrayPos;
return result;
}
bool GetActivePartition (byte drive)
{
size_t partCount;
if (GetDrivePartitions (drive, &ActivePartition, 1, partCount, true) != BiosResultSuccess || partCount < 1)
{
ActivePartition.Drive = TC_INVALID_BIOS_DRIVE;
PrintError (TC_BOOT_STR_NO_BOOT_PARTITION);
return false;
}
return true;
}
/*
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.
Modifications and 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.
*/
#include "Bios.h"
#include "BootConsoleIo.h"
#include "BootConfig.h"
#include "BootDebug.h"
#include "BootDefs.h"
#include "BootDiskIo.h"
#include "BootStrings.h"
byte SectorBuffer[TC_LB_SIZE];
#ifdef TC_BOOT_DEBUG_ENABLED
static bool SectorBufferInUse = false;
void AcquireSectorBuffer ()
{
if (SectorBufferInUse)
TC_THROW_FATAL_EXCEPTION;
SectorBufferInUse = true;
}
void ReleaseSectorBuffer ()
{
SectorBufferInUse = false;
}
#endif
bool IsLbaSupported (byte drive)
{
static byte CachedDrive = TC_INVALID_BIOS_DRIVE;
static bool CachedStatus;
uint16 result = 0;
if (CachedDrive == drive)
goto ret;
__asm
{
mov bx, 0x55aa
mov dl, drive
mov ah, 0x41
int 0x13
jc err
mov result, bx
err:
}
CachedDrive = drive;
CachedStatus = (result == 0xaa55);
ret:
return CachedStatus;
}
void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs)
{
PrintEndl();
Print (write ? "Write" : "Read"); Print (" error:");
Print (error);
Print (" Drive:");
Print (drive ^ 0x80);
if (sector)
{
Print (" Sector:");
Print (*sector);
}
if (chs)
{
Print (" CHS:");
Print (*chs);
}
PrintEndl();
Beep();
}
void Print (const ChsAddress &chs)
{
Print (chs.Cylinder);
PrintChar ('/');
Print (chs.Head);
PrintChar ('/');
Print (chs.Sector);
}
void PrintSectorCountInMB (const uint64 &sectorCount)
{
Print (sectorCount >> (TC_LB_SIZE_BIT_SHIFT_DIVISOR + 2)); Print (" MB ");
}
BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
{
CheckStack();
byte cylinderLow = (byte) chs.Cylinder;
byte sector = chs.Sector;
sector |= byte (chs.Cylinder >> 2) & 0xc0;
byte function = write ? 0x03 : 0x02;
BiosResult result;
byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
do
{
result = BiosResultSuccess;
__asm
{
push es
mov ax, bufferSegment
mov es, ax
mov bx, bufferOffset
mov dl, drive
mov ch, cylinderLow
mov si, chs
mov dh, [si].Head
mov cl, sector
mov al, sectorCount
mov ah, function
int 0x13
jnc ok // If CF=0, ignore AH to prevent issues caused by potential bugs in BIOSes
mov result, ah
ok:
pop es
}
if (result == BiosResultEccCorrected)
result = BiosResultSuccess;
// Some BIOSes report I/O errors prematurely in some cases
} while (result != BiosResultSuccess && --tryCount != 0);
if (!silent && result != BiosResultSuccess)
PrintDiskError (result, write, drive, nullptr, &chs);
return result;
}
BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
{
uint16 codeSeg;
__asm mov codeSeg, cs
return ReadWriteSectors (write, codeSeg, (uint16) buffer, drive, chs, sectorCount, silent);
}
BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
{
return ReadWriteSectors (false, buffer, drive, chs, sectorCount, silent);
}
BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
{
return ReadWriteSectors (true, buffer, drive, chs, sectorCount, silent);
}
static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
CheckStack();
if (!IsLbaSupported (drive))
{
DriveGeometry geometry;
BiosResult result = GetDriveGeometry (drive, geometry, silent);
if (result != BiosResultSuccess)
return result;
ChsAddress chs;
LbaToChs (geometry, sector, chs);
return ReadWriteSectors (write, (uint16) (dapPacket.Buffer >> 16), (uint16) dapPacket.Buffer, drive, chs, sectorCount, silent);
}
dapPacket.Size = sizeof (dapPacket);
dapPacket.Reserved = 0;
dapPacket.SectorCount = sectorCount;
dapPacket.Sector = sector;
byte function = write ? 0x43 : 0x42;
BiosResult result;
byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
do
{
result = BiosResultSuccess;
__asm
{
mov bx, 0x55aa
mov dl, drive
mov si, [dapPacket]
mov ah, function
xor al, al
int 0x13
jnc ok // If CF=0, ignore AH to prevent issues caused by potential bugs in BIOSes
mov result, ah
ok:
}
if (result == BiosResultEccCorrected)
result = BiosResultSuccess;
// Some BIOSes report I/O errors prematurely in some cases
} while (result != BiosResultSuccess && --tryCount != 0);
if (!silent && result != BiosResultSuccess)
PrintDiskError (result, write, drive, &sector);
return result;
}
static BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
BiosLbaPacket dapPacket;
dapPacket.Buffer = (uint32) buffer;
return ReadWriteSectors (write, dapPacket, drive, sector, sectorCount, silent);
}
BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
BiosLbaPacket dapPacket;
dapPacket.Buffer = ((uint32) bufferSegment << 16) | bufferOffset;
return ReadWriteSectors (write, dapPacket, drive, sector, sectorCount, silent);
}
BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
return ReadWriteSectors (false, bufferSegment, bufferOffset, drive, sector, sectorCount, silent);
}
BiosResult ReadSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
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
if (!BootStarted)
CopyMemory (TC_BOOT_LOADER_ALT_SEGMENT, (uint16) buffer, buffer, sectorCount * TC_LB_SIZE);
return result;
}
BiosResult WriteSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent)
{
return ReadWriteSectors (true, buffer, drive, sector, sectorCount, silent);
}
BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent)
{
CheckStack();
byte maxCylinderLow, maxHead, maxSector;
BiosResult result;
__asm
{
push es
mov dl, drive
mov ah, 0x08
int 0x13
mov result, ah
mov maxCylinderLow, ch
mov maxSector, cl
mov maxHead, dh
pop es
}
if (result == BiosResultSuccess)
{
geometry.Cylinders = (maxCylinderLow | (uint16 (maxSector & 0xc0) << 2)) + 1;
geometry.Heads = maxHead + 1;
geometry.Sectors = maxSector & ~0xc0;
}
else if (!silent)
{
Print ("Drive ");
Print (drive ^ 0x80);
Print (" not found: ");
PrintErrorNoEndl ("");
Print (result);
PrintEndl();
}
return result;
}
void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba)
{
lba.HighPart = 0;
lba.LowPart = (uint32 (chs.Cylinder) * geometry.Heads + chs.Head) * geometry.Sectors + chs.Sector - 1;
}
void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs)
{
chs.Sector = (byte) ((lba.LowPart % geometry.Sectors) + 1);
uint32 ch = lba.LowPart / geometry.Sectors;
chs.Head = (byte) (ch % geometry.Heads);
chs.Cylinder = (uint16) (ch / geometry.Heads);
}
void PartitionEntryMBRToPartition (const PartitionEntryMBR &partEntry, Partition &partition)
{
partition.Active = partEntry.BootIndicator == 0x80;
partition.EndSector.HighPart = 0;
partition.EndSector.LowPart = partEntry.StartLBA + partEntry.SectorCountLBA - 1;
partition.SectorCount.HighPart = 0;
partition.SectorCount.LowPart = partEntry.SectorCountLBA;
partition.StartSector.HighPart = 0;
partition.StartSector.LowPart = partEntry.StartLBA;
partition.Type = partEntry.Type;
}
BiosResult ReadWriteMBR (bool write, byte drive, bool silent)
{
uint64 mbrSector;
mbrSector.HighPart = 0;
mbrSector.LowPart = 0;
if (write)
return WriteSectors (SectorBuffer, drive, mbrSector, 1, silent);
return ReadSectors (SectorBuffer, drive, mbrSector, 1, silent); // Uses alternative segment
}
BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly, Partition *findPartitionFollowingThis, bool silent)
{
Partition *followingPartition;
Partition tmpPartition;
if (findPartitionFollowingThis)
{
assert (partitionArrayCapacity == 1);
partitionArrayCapacity = 0xff;
followingPartition = partitionArray;
partitionArray = &tmpPartition;
followingPartition->Drive = TC_INVALID_BIOS_DRIVE;
followingPartition->StartSector.LowPart = 0xFFFFffffUL;
}
AcquireSectorBuffer();
BiosResult result = ReadWriteMBR (false, drive, silent);
ReleaseSectorBuffer();
partitionCount = 0;
MBR *mbr = (MBR *) SectorBuffer;
if (result != BiosResultSuccess || mbr->Signature != 0xaa55)
return result;
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];
PartitionEntryMBRToPartition (partEntry, partition);
if (activeOnly && !partition.Active)
continue;
partition.Drive = drive;
partition.Number = partitionArrayPos;
if (partEntry.Type == 0x5 || partEntry.Type == 0xf) // Extended partition
{
if (IsLbaSupported (drive))
{
// Find all extended partitions
uint64 firstExtStartLBA = partition.StartSector;
uint64 extStartLBA = partition.StartSector;
MBR *extMbr = (MBR *) SectorBuffer;
while (partitionArrayPos < partitionArrayCapacity &&
(result = ReadSectors ((byte *) extMbr, drive, extStartLBA, 1, silent)) == BiosResultSuccess
&& extMbr->Signature == 0xaa55)
{
if (extMbr->Partitions[0].SectorCountLBA > 0)
{
Partition &logPart = partitionArray[partitionArrayPos];
PartitionEntryMBRToPartition (extMbr->Partitions[0], logPart);
logPart.Drive = drive;
logPart.Number = partitionArrayPos;
logPart.Primary = false;
logPart.StartSector.LowPart += extStartLBA.LowPart;
logPart.EndSector.LowPart += extStartLBA.LowPart;
if (findPartitionFollowingThis)
{
if (logPart.StartSector.LowPart > findPartitionFollowingThis->EndSector.LowPart
&& logPart.StartSector.LowPart < followingPartition->StartSector.LowPart)
{
*followingPartition = logPart;
}
}
else
++partitionArrayPos;
}
// Secondary extended
if (extMbr->Partitions[1].Type != 0x5 && extMbr->Partitions[1].Type == 0xf
|| extMbr->Partitions[1].SectorCountLBA == 0)
break;
extStartLBA.LowPart = extMbr->Partitions[1].StartLBA + firstExtStartLBA.LowPart;
}
}
}
else
{
partition.Primary = true;
if (findPartitionFollowingThis)
{
if (partition.StartSector.LowPart > findPartitionFollowingThis->EndSector.LowPart
&& partition.StartSector.LowPart < followingPartition->StartSector.LowPart)
{
*followingPartition = partition;
}
}
else
++partitionArrayPos;
}
}
}
partitionCount = partitionArrayPos;
return result;
}
bool GetActivePartition (byte drive)
{
size_t partCount;
if (GetDrivePartitions (drive, &ActivePartition, 1, partCount, true) != BiosResultSuccess || partCount < 1)
{
ActivePartition.Drive = TC_INVALID_BIOS_DRIVE;
PrintError (TC_BOOT_STR_NO_BOOT_PARTITION);
return false;
}
return true;
}
+120 -120
View File
@@ -1,120 +1,120 @@
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootDiskIo
#define TC_HEADER_Boot_BootDiskIo
#include "Bios.h"
#include "BootDebug.h"
#include "BootDefs.h"
#define TC_MAX_BIOS_DISK_IO_RETRIES 5
enum
{
BiosResultEccCorrected = 0x11
};
#pragma pack(1)
struct PartitionEntryMBR
{
byte BootIndicator;
byte StartHead;
byte StartCylSector;
byte StartCylinder;
byte Type;
byte EndHead;
byte EndSector;
byte EndCylinder;
uint32 StartLBA;
uint32 SectorCountLBA;
};
struct MBR
{
byte Code[446];
PartitionEntryMBR Partitions[4];
uint16 Signature;
};
struct BiosLbaPacket
{
byte Size;
byte Reserved;
uint16 SectorCount;
uint32 Buffer;
uint64 Sector;
};
#pragma pack()
struct ChsAddress
{
uint16 Cylinder;
byte Head;
byte Sector;
};
struct Partition
{
byte Number;
byte Drive;
bool Active;
uint64 EndSector;
bool Primary;
uint64 SectorCount;
uint64 StartSector;
byte Type;
};
struct DriveGeometry
{
uint16 Cylinders;
byte Heads;
byte Sectors;
};
#ifdef TC_BOOT_DEBUG_ENABLED
void AcquireSectorBuffer ();
void ReleaseSectorBuffer ();
#else
# define AcquireSectorBuffer()
# define ReleaseSectorBuffer()
#endif
void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba);
bool GetActivePartition (byte drive);
BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent = false);
BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly = false, Partition *findPartitionFollowingThis = nullptr, bool silent = false);
bool IsLbaSupported (byte drive);
void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs);
void Print (const ChsAddress &chs);
void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs = nullptr);
void PrintSectorCountInMB (const uint64 &sectorCount);
BiosResult ReadWriteMBR (bool write, byte drive, bool silent = false);
BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
BiosResult ReadSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent);
BiosResult WriteSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
extern byte SectorBuffer[TC_LB_SIZE];
#endif // TC_HEADER_Boot_BootDiskIo
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootDiskIo
#define TC_HEADER_Boot_BootDiskIo
#include "Bios.h"
#include "BootDebug.h"
#include "BootDefs.h"
#define TC_MAX_BIOS_DISK_IO_RETRIES 5
enum
{
BiosResultEccCorrected = 0x11
};
#pragma pack(1)
struct PartitionEntryMBR
{
byte BootIndicator;
byte StartHead;
byte StartCylSector;
byte StartCylinder;
byte Type;
byte EndHead;
byte EndSector;
byte EndCylinder;
uint32 StartLBA;
uint32 SectorCountLBA;
};
struct MBR
{
byte Code[446];
PartitionEntryMBR Partitions[4];
uint16 Signature;
};
struct BiosLbaPacket
{
byte Size;
byte Reserved;
uint16 SectorCount;
uint32 Buffer;
uint64 Sector;
};
#pragma pack()
struct ChsAddress
{
uint16 Cylinder;
byte Head;
byte Sector;
};
struct Partition
{
byte Number;
byte Drive;
bool Active;
uint64 EndSector;
bool Primary;
uint64 SectorCount;
uint64 StartSector;
byte Type;
};
struct DriveGeometry
{
uint16 Cylinders;
byte Heads;
byte Sectors;
};
#ifdef TC_BOOT_DEBUG_ENABLED
void AcquireSectorBuffer ();
void ReleaseSectorBuffer ();
#else
# define AcquireSectorBuffer()
# define ReleaseSectorBuffer()
#endif
void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba);
bool GetActivePartition (byte drive);
BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent = false);
BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly = false, Partition *findPartitionFollowingThis = nullptr, bool silent = false);
bool IsLbaSupported (byte drive);
void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs);
void Print (const ChsAddress &chs);
void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs = nullptr);
void PrintSectorCountInMB (const uint64 &sectorCount);
BiosResult ReadWriteMBR (bool write, byte drive, bool silent = false);
BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
BiosResult ReadSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent);
BiosResult WriteSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
extern byte SectorBuffer[TC_LB_SIZE];
#endif // TC_HEADER_Boot_BootDiskIo
+132 -132
View File
@@ -1,132 +1,132 @@
/*
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.
Modifications and 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.
*/
#include "Crypto.h"
#include "Platform.h"
#include "BootConfig.h"
#include "BootDebug.h"
#include "BootDefs.h"
#include "BootDiskIo.h"
#include "BootEncryptedIo.h"
BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte drive, uint64 sector, uint16 sectorCount)
{
BiosResult result;
bool decrypt = true;
if (BootCryptoInfo->hiddenVolume)
{
if (ReadWritePartiallyCoversEncryptedArea (sector, sectorCount))
return BiosResultInvalidFunction;
if (sector >= EncryptedVirtualPartition.StartSector && sector <= EncryptedVirtualPartition.EndSector)
{
// Remap the request to the hidden volume
sector -= EncryptedVirtualPartition.StartSector;
sector += HiddenVolumeStartSector;
}
else
decrypt = false;
}
result = ReadSectors (destSegment, destOffset, drive, sector, sectorCount);
if (result != BiosResultSuccess || !decrypt)
return result;
if (BootCryptoInfo->hiddenVolume)
{
// Convert sector number to data unit number of the hidden volume
sector -= HiddenVolumeStartSector;
sector += HiddenVolumeStartUnitNo;
}
if (drive == EncryptedVirtualPartition.Drive)
{
while (sectorCount-- > 0)
{
if (BootCryptoInfo->hiddenVolume
|| (sector >= EncryptedVirtualPartition.StartSector && sector <= EncryptedVirtualPartition.EndSector))
{
AcquireSectorBuffer();
CopyMemory (destSegment, destOffset, SectorBuffer, TC_LB_SIZE);
DecryptDataUnits (SectorBuffer, &sector, 1, BootCryptoInfo);
CopyMemory (SectorBuffer, destSegment, destOffset, TC_LB_SIZE);
ReleaseSectorBuffer();
}
++sector;
destOffset += TC_LB_SIZE;
}
}
return result;
}
BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byte drive, uint64 sector, uint16 sectorCount)
{
BiosResult result = BiosResultSuccess;
AcquireSectorBuffer();
uint64 dataUnitNo;
uint64 writeOffset;
dataUnitNo = sector;
writeOffset.HighPart = 0;
writeOffset.LowPart = 0;
if (BootCryptoInfo->hiddenVolume)
{
if (ReadWritePartiallyCoversEncryptedArea (sector, sectorCount))
return BiosResultInvalidFunction;
// Remap the request to the hidden volume
writeOffset = HiddenVolumeStartSector;
writeOffset -= EncryptedVirtualPartition.StartSector;
dataUnitNo -= EncryptedVirtualPartition.StartSector;
dataUnitNo += HiddenVolumeStartUnitNo;
}
while (sectorCount-- > 0)
{
CopyMemory (sourceSegment, sourceOffset, SectorBuffer, TC_LB_SIZE);
if (drive == EncryptedVirtualPartition.Drive && sector >= EncryptedVirtualPartition.StartSector && sector <= EncryptedVirtualPartition.EndSector)
{
EncryptDataUnits (SectorBuffer, &dataUnitNo, 1, BootCryptoInfo);
}
result = WriteSectors (SectorBuffer, drive, sector + writeOffset, 1);
if (result != BiosResultSuccess)
break;
++sector;
++dataUnitNo;
sourceOffset += TC_LB_SIZE;
}
ReleaseSectorBuffer();
return result;
}
static bool ReadWritePartiallyCoversEncryptedArea (const uint64 &sector, uint16 sectorCount)
{
uint64 readWriteEnd = sector + --sectorCount;
return ((sector < EncryptedVirtualPartition.StartSector && readWriteEnd >= EncryptedVirtualPartition.StartSector)
|| (sector >= EncryptedVirtualPartition.StartSector && readWriteEnd > EncryptedVirtualPartition.EndSector));
}
/*
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.
Modifications and 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.
*/
#include "Crypto.h"
#include "Platform.h"
#include "BootConfig.h"
#include "BootDebug.h"
#include "BootDefs.h"
#include "BootDiskIo.h"
#include "BootEncryptedIo.h"
BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte drive, uint64 sector, uint16 sectorCount)
{
BiosResult result;
bool decrypt = true;
if (BootCryptoInfo->hiddenVolume)
{
if (ReadWritePartiallyCoversEncryptedArea (sector, sectorCount))
return BiosResultInvalidFunction;
if (sector >= EncryptedVirtualPartition.StartSector && sector <= EncryptedVirtualPartition.EndSector)
{
// Remap the request to the hidden volume
sector -= EncryptedVirtualPartition.StartSector;
sector += HiddenVolumeStartSector;
}
else
decrypt = false;
}
result = ReadSectors (destSegment, destOffset, drive, sector, sectorCount);
if (result != BiosResultSuccess || !decrypt)
return result;
if (BootCryptoInfo->hiddenVolume)
{
// Convert sector number to data unit number of the hidden volume
sector -= HiddenVolumeStartSector;
sector += PimValueOrHiddenVolumeStartUnitNo;
}
if (drive == EncryptedVirtualPartition.Drive)
{
while (sectorCount-- > 0)
{
if (BootCryptoInfo->hiddenVolume
|| (sector >= EncryptedVirtualPartition.StartSector && sector <= EncryptedVirtualPartition.EndSector))
{
AcquireSectorBuffer();
CopyMemory (destSegment, destOffset, SectorBuffer, TC_LB_SIZE);
DecryptDataUnits (SectorBuffer, &sector, 1, BootCryptoInfo);
CopyMemory (SectorBuffer, destSegment, destOffset, TC_LB_SIZE);
ReleaseSectorBuffer();
}
++sector;
destOffset += TC_LB_SIZE;
}
}
return result;
}
BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byte drive, uint64 sector, uint16 sectorCount)
{
BiosResult result = BiosResultSuccess;
AcquireSectorBuffer();
uint64 dataUnitNo;
uint64 writeOffset;
dataUnitNo = sector;
writeOffset.HighPart = 0;
writeOffset.LowPart = 0;
if (BootCryptoInfo->hiddenVolume)
{
if (ReadWritePartiallyCoversEncryptedArea (sector, sectorCount))
return BiosResultInvalidFunction;
// Remap the request to the hidden volume
writeOffset = HiddenVolumeStartSector;
writeOffset -= EncryptedVirtualPartition.StartSector;
dataUnitNo -= EncryptedVirtualPartition.StartSector;
dataUnitNo += PimValueOrHiddenVolumeStartUnitNo;
}
while (sectorCount-- > 0)
{
CopyMemory (sourceSegment, sourceOffset, SectorBuffer, TC_LB_SIZE);
if (drive == EncryptedVirtualPartition.Drive && sector >= EncryptedVirtualPartition.StartSector && sector <= EncryptedVirtualPartition.EndSector)
{
EncryptDataUnits (SectorBuffer, &dataUnitNo, 1, BootCryptoInfo);
}
result = WriteSectors (SectorBuffer, drive, sector + writeOffset, 1);
if (result != BiosResultSuccess)
break;
++sector;
++dataUnitNo;
sourceOffset += TC_LB_SIZE;
}
ReleaseSectorBuffer();
return result;
}
static bool ReadWritePartiallyCoversEncryptedArea (const uint64 &sector, uint16 sectorCount)
{
uint64 readWriteEnd = sector + --sectorCount;
return ((sector < EncryptedVirtualPartition.StartSector && readWriteEnd >= EncryptedVirtualPartition.StartSector)
|| (sector >= EncryptedVirtualPartition.StartSector && readWriteEnd > EncryptedVirtualPartition.EndSector));
}
+22 -22
View File
@@ -1,22 +1,22 @@
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootEncryptionIo
#define TC_HEADER_Boot_BootEncryptionIo
#include "Platform.h"
BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte drive, uint64 sector, uint16 sectorCount);
BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byte drive, uint64 sector, uint16 sectorCount);
static bool ReadWritePartiallyCoversEncryptedArea (const uint64 &sector, uint16 sectorCount);
#endif // TC_HEADER_Boot_BootEncryptionIo
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootEncryptionIo
#define TC_HEADER_Boot_BootEncryptionIo
#include "Platform.h"
BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte drive, uint64 sector, uint16 sectorCount);
BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byte drive, uint64 sector, uint16 sectorCount);
static bool ReadWritePartiallyCoversEncryptedArea (const uint64 &sector, uint16 sectorCount);
#endif // TC_HEADER_Boot_BootEncryptionIo
+1269 -1257
View File
File diff suppressed because it is too large Load Diff
+34 -34
View File
@@ -1,34 +1,34 @@
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootMain
#define TC_HEADER_Boot_BootMain
#include "TCdefs.h"
#include "Platform.h"
static byte AskPassword (Password &password, int& pim);
static int AskSelection (const char *options[], size_t optionCount);
static bool AskYesNo (const char *message);
static byte BootEncryptedDrive ();
static void BootMenu ();
static void ExecuteBootSector (byte drive, byte *sectorBuffer);
static void InitScreen ();
static bool IsMenuKey (byte scanCode);
static bool MountVolume (byte drive, byte &exitKey);
static bool OpenVolume (byte drive, Password &password, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32 = nullptr, bool skipNormal = false, bool skipHidden = false);
static void PrintMainMenu ();
static void RepairMenu ();
#define TC_MENU_KEY_REPAIR TC_BIOS_KEY_F8
#endif // TC_HEADER_Boot_BootMain
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootMain
#define TC_HEADER_Boot_BootMain
#include "TCdefs.h"
#include "Platform.h"
static byte AskPassword (Password &password, int& pim);
static int AskSelection (const char *options[], size_t optionCount);
static bool AskYesNo (const char *message);
static byte BootEncryptedDrive ();
static void BootMenu ();
static void ExecuteBootSector (byte drive, byte *sectorBuffer);
static void InitScreen ();
static bool IsMenuKey (byte scanCode);
static bool MountVolume (byte drive, byte &exitKey);
static bool OpenVolume (byte drive, Password &password, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32 = nullptr, bool skipNormal = false, bool skipHidden = false);
static void PrintMainMenu ();
static void RepairMenu ();
#define TC_MENU_KEY_REPAIR TC_BIOS_KEY_F8
#endif // TC_HEADER_Boot_BootMain
+86 -86
View File
@@ -1,86 +1,86 @@
/*
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.
Modifications and 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.
*/
#include "BootDefs.h"
#include "BootMemory.h"
static uint32 MemoryMapContValue;
static bool GetMemoryMapEntry (BiosMemoryMapEntry &entry)
{
static const uint32 function = 0x0000E820UL;
static const uint32 magic = 0x534D4150UL;
static const uint32 bufferSize = sizeof (BiosMemoryMapEntry);
bool carry = false;
uint32 resultMagic;
uint32 resultSize;
__asm
{
push es
lea di, function
TC_ASM_MOV_EAX_DI
lea di, MemoryMapContValue
TC_ASM_MOV_EBX_DI
lea di, bufferSize
TC_ASM_MOV_ECX_DI
lea di, magic
TC_ASM_MOV_EDX_DI
lea di, MemoryMapContValue
TC_ASM_MOV_DI_ECX
// Use alternative segment to prevent memory corruption caused by buggy BIOSes
push TC_BOOT_LOADER_ALT_SEGMENT
pop es
mov di, 0
int 0x15
jnc no_carry
mov carry, true
no_carry:
lea di, resultMagic
TC_ASM_MOV_DI_EAX
lea di, MemoryMapContValue
TC_ASM_MOV_DI_EBX
lea di, resultSize
TC_ASM_MOV_DI_ECX
pop es
}
CopyMemory (TC_BOOT_LOADER_ALT_SEGMENT, 0, &entry, sizeof (entry));
// BIOS may set CF at the end of the list
if (carry)
MemoryMapContValue = 0;
return resultMagic == magic && resultSize == bufferSize;
}
bool GetFirstBiosMemoryMapEntry (BiosMemoryMapEntry &entry)
{
MemoryMapContValue = 0;
return GetMemoryMapEntry (entry);
}
bool GetNextBiosMemoryMapEntry (BiosMemoryMapEntry &entry)
{
if (MemoryMapContValue == 0)
return false;
return GetMemoryMapEntry (entry);
}
/*
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.
Modifications and 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.
*/
#include "BootDefs.h"
#include "BootMemory.h"
static uint32 MemoryMapContValue;
static bool GetMemoryMapEntry (BiosMemoryMapEntry &entry)
{
static const uint32 function = 0x0000E820UL;
static const uint32 magic = 0x534D4150UL;
static const uint32 bufferSize = sizeof (BiosMemoryMapEntry);
bool carry = false;
uint32 resultMagic;
uint32 resultSize;
__asm
{
push es
lea di, function
TC_ASM_MOV_EAX_DI
lea di, MemoryMapContValue
TC_ASM_MOV_EBX_DI
lea di, bufferSize
TC_ASM_MOV_ECX_DI
lea di, magic
TC_ASM_MOV_EDX_DI
lea di, MemoryMapContValue
TC_ASM_MOV_DI_ECX
// Use alternative segment to prevent memory corruption caused by buggy BIOSes
push TC_BOOT_LOADER_ALT_SEGMENT
pop es
mov di, 0
int 0x15
jnc no_carry
mov carry, true
no_carry:
lea di, resultMagic
TC_ASM_MOV_DI_EAX
lea di, MemoryMapContValue
TC_ASM_MOV_DI_EBX
lea di, resultSize
TC_ASM_MOV_DI_ECX
pop es
}
CopyMemory (TC_BOOT_LOADER_ALT_SEGMENT, 0, &entry, sizeof (entry));
// BIOS may set CF at the end of the list
if (carry)
MemoryMapContValue = 0;
return resultMagic == magic && resultSize == bufferSize;
}
bool GetFirstBiosMemoryMapEntry (BiosMemoryMapEntry &entry)
{
MemoryMapContValue = 0;
return GetMemoryMapEntry (entry);
}
bool GetNextBiosMemoryMapEntry (BiosMemoryMapEntry &entry)
{
if (MemoryMapContValue == 0)
return false;
return GetMemoryMapEntry (entry);
}
+28 -28
View File
@@ -1,28 +1,28 @@
/*
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.
Modifications and 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.
*/
#include "Platform.h"
#include "Bios.h"
#pragma pack(1)
struct BiosMemoryMapEntry
{
uint64 BaseAddress;
uint64 Length;
uint32 Type;
};
#pragma pack()
bool GetFirstBiosMemoryMapEntry (BiosMemoryMapEntry &entry);
bool GetNextBiosMemoryMapEntry (BiosMemoryMapEntry &entry);
/*
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.
Modifications and 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.
*/
#include "Platform.h"
#include "Bios.h"
#pragma pack(1)
struct BiosMemoryMapEntry
{
uint64 BaseAddress;
uint64 Length;
uint32 Type;
};
#pragma pack()
bool GetFirstBiosMemoryMapEntry (BiosMemoryMapEntry &entry);
bool GetNextBiosMemoryMapEntry (BiosMemoryMapEntry &entry);
+244 -244
View File
@@ -1,244 +1,244 @@
;
; 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.
;
; Modifications and 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.
;
.MODEL tiny
.386
_TEXT SEGMENT USE16
INCLUDE BootDefs.i
ORG 7C00h ; Standard boot sector offset
start:
; BIOS executes boot sector from 0:7C00 or 7C0:0000 (default CD boot loader address).
; Far jump to the next instruction sets IP to the standard offset 7C00.
db 0EAh ; jmp 0:main
dw main, 0
loader_name_msg:
db ' VeraCrypt Boot Loader', 13, 10, 0
main:
cli
xor ax, ax
mov ds, ax
mov ss, ax
mov sp, 7C00h
sti
; Display boot loader name
test byte ptr [start + TC_BOOT_SECTOR_USER_CONFIG_OFFSET], TC_BOOT_USER_CFG_FLAG_SILENT_MODE
jnz skip_loader_name_msg
lea si, loader_name_msg
call print
skip_loader_name_msg:
; Determine boot loader segment
mov ax, TC_BOOT_LOADER_SEGMENT
; 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
memory_ok:
mov es, ax
; Clear BSS section
xor al, al
mov di, TC_COM_EXECUTABLE_OFFSET
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:
mov al, TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
mov bx, TC_COM_EXECUTABLE_OFFSET
call read_sectors
; Decompressor checksum
xor ebx, ebx
mov si, TC_COM_EXECUTABLE_OFFSET
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
; Boot loader checksum
pop ebx
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]
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
lea si, loader_name_msg
call print
jmp $
checksum_ok:
; Set up decompressor segment
mov ax, es
mov ds, ax
cli
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
push cx ; Compressed data size
push TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET + TC_GZIP_HEADER_SIZE ; Compressed data
push TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE ; Output buffer size
push TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE + TC_COM_EXECUTABLE_OFFSET ; Output buffer
push cs
push decompressor_ret
push es
push TC_COM_EXECUTABLE_OFFSET
retf
decompressor_ret:
add sp, 8
pop dx
; Restore boot sector segment
push cs
pop ds
; Check decompression result
test ax, ax
jz decompression_ok
lea si, loader_damaged_msg
call print
jmp $
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
mov es, ax
mov ds, ax
cli
mov ss, ax
mov sp, TC_BOOT_LOADER_STACK_TOP
sti
; Execute boot loader
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
print_end:
ret
; Read sectors of the first cylinder
read_sectors:
mov ch, 0 ; Cylinder
mov dh, 0 ; Head
; DL = drive number passed from BIOS
mov ah, 2
int 13h
jnc read_ok
lea si, disk_error_msg
call print
read_ok:
ret
; Calculate checksum
checksum:
push ds
push es
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
ORG 7C00h + 510
dw 0AA55h ; Boot sector signature
_TEXT ENDS
END start
;
; 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.
;
; Modifications and 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.
;
.MODEL tiny
.386
_TEXT SEGMENT USE16
INCLUDE BootDefs.i
ORG 7C00h ; Standard boot sector offset
start:
; BIOS executes boot sector from 0:7C00 or 7C0:0000 (default CD boot loader address).
; Far jump to the next instruction sets IP to the standard offset 7C00.
db 0EAh ; jmp 0:main
dw main, 0
loader_name_msg:
db ' VeraCrypt Boot Loader', 13, 10, 0
main:
cli
xor ax, ax
mov ds, ax
mov ss, ax
mov sp, 7C00h
sti
; Display boot loader name
test byte ptr [start + TC_BOOT_SECTOR_USER_CONFIG_OFFSET], TC_BOOT_USER_CFG_FLAG_SILENT_MODE
jnz skip_loader_name_msg
lea si, loader_name_msg
call print
skip_loader_name_msg:
; Determine boot loader segment
mov ax, TC_BOOT_LOADER_SEGMENT
; 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
memory_ok:
mov es, ax
; Clear BSS section
xor al, al
mov di, TC_COM_EXECUTABLE_OFFSET
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:
mov al, TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
mov bx, TC_COM_EXECUTABLE_OFFSET
call read_sectors
; Decompressor checksum
xor ebx, ebx
mov si, TC_COM_EXECUTABLE_OFFSET
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
; Boot loader checksum
pop ebx
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]
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
lea si, loader_name_msg
call print
jmp $
checksum_ok:
; Set up decompressor segment
mov ax, es
mov ds, ax
cli
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
push cx ; Compressed data size
push TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET + TC_GZIP_HEADER_SIZE ; Compressed data
push TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE ; Output buffer size
push TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE + TC_COM_EXECUTABLE_OFFSET ; Output buffer
push cs
push decompressor_ret
push es
push TC_COM_EXECUTABLE_OFFSET
retf
decompressor_ret:
add sp, 8
pop dx
; Restore boot sector segment
push cs
pop ds
; Check decompression result
test ax, ax
jz decompression_ok
lea si, loader_damaged_msg
call print
jmp $
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
mov es, ax
mov ds, ax
cli
mov ss, ax
mov sp, TC_BOOT_LOADER_STACK_TOP
sti
; Execute boot loader
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
print_end:
ret
; Read sectors of the first cylinder
read_sectors:
mov ch, 0 ; Cylinder
mov dh, 0 ; Head
; DL = drive number passed from BIOS
mov ah, 2
int 13h
jnc read_ok
lea si, disk_error_msg
call print
read_ok:
ret
; Calculate checksum
checksum:
push ds
push es
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
ORG 7C00h + 510
dw 0AA55h ; Boot sector signature
_TEXT ENDS
END start
+20 -20
View File
@@ -1,20 +1,20 @@
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootStrings
#define TC_HEADER_Boot_BootStrings
#define TC_BOOT_STR_ERROR "Error: "
#define TC_BOOT_STR_NO_BOOT_PARTITION "No bootable partition found"
#define TC_BOOT_STR_UPGRADE_BIOS "- Upgrade BIOS\r\n- Use a different motherboard model/brand\r\n"
#endif // TC_HEADER_Boot_BootStrings
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_BootStrings
#define TC_HEADER_Boot_BootStrings
#define TC_BOOT_STR_ERROR "Error: "
#define TC_BOOT_STR_NO_BOOT_PARTITION "No bootable partition found"
#define TC_BOOT_STR_UPGRADE_BIOS "- Upgrade BIOS\r\n- Use a different motherboard model/brand\r\n"
#endif // TC_HEADER_Boot_BootStrings
+65 -65
View File
@@ -83,7 +83,7 @@ local int stored(struct state *s)
s->bitbuf = 0;
s->bitcnt = 0;
if (s->incnt + 4 > s->inlen)
if (s->incnt + 4 > s->inlen)
return 2; /* not enough input */
/* get length and check against its one's complement */
@@ -93,7 +93,7 @@ local int stored(struct state *s)
s->in[s->incnt++] != ((~len >> 8) & 0xff))
return -2; /* didn't match complement! */
if (s->incnt + len > s->inlen)
if (s->incnt + len > s->inlen)
return 2; /* not enough input */
/* copy len bytes from in to out */
@@ -379,21 +379,21 @@ local int dynamic(struct state *s)
lengths[index++] = symbol;
else { /* repeat instruction */
len = 0; /* assume repeating zeros */
switch(symbol)
{
case 16: { /* repeat last length 3..6 times */
if (index == 0) return -5; /* no last length! */
len = lengths[index - 1]; /* last length */
symbol = 3 + bits(s, 2);
break;
}
case 17: /* repeat zero 3..10 times */
symbol = 3 + bits(s, 3);
break;
default: /* == 18, repeat zero 11..138 times */
symbol = 11 + bits(s, 7);
break;
}
switch(symbol)
{
case 16: { /* repeat last length 3..6 times */
if (index == 0) return -5; /* no last length! */
len = lengths[index - 1]; /* last length */
symbol = 3 + bits(s, 2);
break;
}
case 17: /* repeat zero 3..10 times */
symbol = 3 + bits(s, 3);
break;
default: /* == 18, repeat zero 11..138 times */
symbol = 11 + bits(s, 7);
break;
}
if ((index + symbol > nlen + ndist))
return -6; /* too many lengths! */
while (symbol--) /* repeat last or zero symbol times */
@@ -401,8 +401,8 @@ local int dynamic(struct state *s)
}
}
/* check for end-of-block code -- there better be one! */
if (lengths[256] == 0)
/* check for end-of-block code -- there better be one! */
if (lengths[256] == 0)
return -9;
/* build huffman table for literal/length codes */
@@ -423,50 +423,50 @@ local int dynamic(struct state *s)
void _acrtused () { }
// Decompress deflated data
int far main (
unsigned char *dest, /* pointer to destination pointer */
unsigned int destlen, /* amount of output space */
unsigned char *source, /* pointer to source data pointer */
unsigned int sourcelen)
{
struct state s; /* input/output state */
int last, type; /* block information */
int err; /* return value */
/* initialize output state */
s.out = dest;
s.outlen = destlen; /* ignored if dest is NIL */
s.outcnt = 0;
/* initialize input state */
s.in = source;
s.inlen = sourcelen;
s.incnt = 0;
s.bitbuf = 0;
s.bitcnt = 0;
/* process blocks until last block or error */
do {
last = bits(&s, 1); /* one if last block */
type = bits(&s, 2); /* block type 0..3 */
switch(type)
{
case 0:
err = stored(&s);
break;
case 1:
err = fixed(&s);
break;
case 2:
err = dynamic(&s);
break;
default:
err = -1; /* type == 3, invalid */
break;
}
if (err != 0) break; /* return with error */
} while (!last);
return err;
int far main (
unsigned char *dest, /* pointer to destination pointer */
unsigned int destlen, /* amount of output space */
unsigned char *source, /* pointer to source data pointer */
unsigned int sourcelen)
{
struct state s; /* input/output state */
int last, type; /* block information */
int err; /* return value */
/* initialize output state */
s.out = dest;
s.outlen = destlen; /* ignored if dest is NIL */
s.outcnt = 0;
/* initialize input state */
s.in = source;
s.inlen = sourcelen;
s.incnt = 0;
s.bitbuf = 0;
s.bitcnt = 0;
/* process blocks until last block or error */
do {
last = bits(&s, 1); /* one if last block */
type = bits(&s, 2); /* block type 0..3 */
switch(type)
{
case 0:
err = stored(&s);
break;
case 1:
err = fixed(&s);
break;
case 2:
err = dynamic(&s);
break;
default:
err = -1; /* type == 3, invalid */
break;
}
if (err != 0) break; /* return with error */
} while (!last);
return err;
}
File diff suppressed because it is too large Load Diff
+20 -20
View File
@@ -1,20 +1,20 @@
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_IntFilter
#define TC_HEADER_Boot_IntFilter
#include "Platform.h"
bool InstallInterruptFilters ();
#endif TC_HEADER_Boot_IntFilter
/*
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.
Modifications and 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.
*/
#ifndef TC_HEADER_Boot_IntFilter
#define TC_HEADER_Boot_IntFilter
#include "Platform.h"
bool InstallInterruptFilters ();
#endif TC_HEADER_Boot_IntFilter
+205 -202
View File
@@ -1,202 +1,205 @@
#
# 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.
#
# Modifications and 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.
PROJ = BootLoader
.SILENT:
!ifndef MSVC16_ROOT
!error Environment variable MSVC16_ROOT must point to the installation directory of MS Visual C++ 1.5
!endif
ENVPATH = $(PATH)
CC = $(MSVC16_ROOT)\bin\cl.exe
LD = $(MSVC16_ROOT)\bin\link.exe
AFLAGS = /nologo /omf
CFLAGS = /nologo /W3 /Fc /I "$(MSVC16_ROOT)\Include" /I"..\..\.." /I"..\..\..\Common" /I"..\..\..\Crypto"
CFLAGS = $(CFLAGS) /D __int8=char /D __int16=int /D __int32=long /D BOOL=char /D FALSE=0 /D TRUE=1
CFLAGS = $(CFLAGS) /D LITTLE_ENDIAN=1234 /D BYTE_ORDER=1234 /D TC_WINDOWS_BOOT /D TC_MINIMIZE_CODE_SIZE /D TC_NO_COMPILER_INT64
CFLAGS = $(CFLAGS) /D malloc=malloc_NA
LFLAGS = /NOLOGO /ONERROR:NOEXE /NOI /BATCH
OBJDIR = Release
!ifdef RESCUE_DISK
OBJDIR = Rescue
CFLAGS = $(CFLAGS) /D TC_WINDOWS_BOOT_RESCUE_DISK_MODE
!endif
!ifdef SINGLE_CIPHER
OBJDIR = $(OBJDIR)_$(SINGLE_CIPHER)
CFLAGS = $(CFLAGS) /D TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE /D TC_WINDOWS_BOOT_$(SINGLE_CIPHER)
!endif
!ifdef SINGLE_PRF
OBJDIR = $(OBJDIR)_$(SINGLE_PRF)
CFLAGS = $(CFLAGS) /D TC_WINDOWS_BOOT_$(SINGLE_PRF)
!else
CFLAGS = $(CFLAGS) /D TC_WINDOWS_BOOT_RIPEMD160
!endif
OUTDIR = $(OBJDIR)
TARGETEXT = com
TARGETS = $(OUTDIR)\BootDefs.i $(OUTDIR)\BootSector.bin $(OUTDIR)\Decompressor.com
CFLAGS = $(CFLAGS) /AT /Zl /f- /G3 /Oe /Os /Ob1 /OV0 /Gs /Gf /Gy /D NDEBUG
LFLAGS = $(LFLAGS) /NOD /NOE /TINY
OBJS = $(OUTDIR)\BootCrt.obj
LIBS = slibce
!if 1
SRCDIR = ..
!else
SRCDIR = $(MAKEDIR)
!endif
TARGETS = $(TARGETS) $(OUTDIR)\$(PROJ).$(TARGETEXT)
OBJS = $(OBJS) $(OUTDIR)\BootConfig.obj
OBJS = $(OBJS) $(OUTDIR)\BootConsoleIo.obj
OBJS = $(OBJS) $(OUTDIR)\BootDebug.obj
OBJS = $(OBJS) $(OUTDIR)\BootDiskIo.obj
OBJS = $(OBJS) $(OUTDIR)\BootEncryptedIo.obj
OBJS = $(OBJS) $(OUTDIR)\BootMain.obj
OBJS = $(OBJS) $(OUTDIR)\BootMemory.obj
OBJS = $(OBJS) $(OUTDIR)\IntFilter.obj
OBJS = $(OBJS) $(OUTDIR)\Platform.obj
OBJS = $(OBJS) $(OUTDIR)\Crc.obj
OBJS = $(OBJS) $(OUTDIR)\Crypto.obj
OBJS = $(OBJS) $(OUTDIR)\Endian.obj
OBJS = $(OBJS) $(OUTDIR)\Pkcs5.obj
OBJS = $(OBJS) $(OUTDIR)\Volumes.obj
OBJS = $(OBJS) $(OUTDIR)\Xts.obj
!if "$(SINGLE_PRF)" == "SHA2"
OBJS = $(OBJS) $(OUTDIR)\Sha2Small.obj
!else
OBJS = $(OBJS) $(OUTDIR)\Rmd160.obj
!endif
!if !DEFINED (SINGLE_CIPHER)
OBJS = $(OBJS) $(OUTDIR)\AesSmall.obj
!else if "$(SINGLE_CIPHER)" == "AES"
OBJS = $(OBJS) $(OUTDIR)\Aes_hw_cpu.obj
OBJS = $(OBJS) $(OUTDIR)\AesSmall_x86.obj
OBJS = $(OBJS) $(OUTDIR)\Aestab.obj
!endif
!if !DEFINED (SINGLE_CIPHER) || "$(SINGLE_CIPHER)" == "SERPENT"
OBJS = $(OBJS) $(OUTDIR)\Serpent.obj
!endif
!if !DEFINED (SINGLE_CIPHER) || "$(SINGLE_CIPHER)" == "TWOFISH"
OBJS = $(OBJS) $(OUTDIR)\Twofish.obj
!endif
all: env $(TARGETS)
env:
set INCLUDE=.
set LIB=.
set LIBPATH=.
clean:
-del /q /s $(OBJDIR) >NUL:
.asm{$(OUTDIR)}.obj:
cd $(OBJDIR)
$(AS) $(AFLAGS) /c "$(SRCDIR)\$<"
cd ..
{..\..\Crypto}.asm{$(OUTDIR)}.obj:
cd $(OBJDIR)
echo $(<F)
nasm.exe -Xvc -f obj -Ox -o "$(<B).obj" -l "$(<B).lst" "$(SRCDIR)\$<"
cd ..
{..\..\Crypto}.c{$(OUTDIR)}.obj:
cd $(OBJDIR)
set PATH=.
$(CC) $(CFLAGS) /c "$(SRCDIR)\$<"
set PATH=$(ENVPATH)
cd ..
{..\..\Common}.c{$(OUTDIR)}.obj:
cd $(OBJDIR)
set PATH=.
$(CC) $(CFLAGS) /c "$(SRCDIR)\$<"
set PATH=$(ENVPATH)
cd ..
.c{$(OUTDIR)}.obj:
cd $(OBJDIR)
set PATH=.
$(CC) $(CFLAGS) /c "$(SRCDIR)\$<"
set PATH=$(ENVPATH)
cd ..
.cpp{$(OUTDIR)}.obj:
cd $(OBJDIR)
set PATH=.
$(CC) $(CFLAGS) /c "$(SRCDIR)\$<"
set PATH=$(ENVPATH)
cd ..
$(OUTDIR)\BootDefs.i: BootDefs.h
cd $(OBJDIR)
set PATH=.
$(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:
-dd.exe conv=notrunc bs=512 if=BootSector.bin of=$(PROJ).flp 2>NUL:
cd ..
$(OUTDIR)\Decompressor.com: $(OUTDIR)\BootCrt.obj $(OUTDIR)\Decompressor.obj
cd $(OBJDIR)
$(LD) $(LFLAGS) BootCrt.obj Decompressor.obj,Decompressor.com,Decompressor.map,$(MSVC16_ROOT)\lib\+slibce,,
-dd.exe conv=notrunc,sync bs=512 seek=1 if=Decompressor.com of=$(PROJ).flp 2>NUL:
cd ..
$(OUTDIR)\$(PROJ).$(TARGETEXT): $(OBJS)
@echo Linking...
cd $(OBJDIR)
echo >NUL: @<<$(PROJ).crf2
$(PROJ).$(TARGETEXT)
$(PROJ).map
$(MSVC16_ROOT)\lib\+
$(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
# Compress the Rescue Disk botloader for Cascades and Serpent since it is too big (size > 31232 bytes)
!if DEFINED(RESCUE_DISK) && (!DEFINED (SINGLE_CIPHER) || ("$(SINGLE_CIPHER)" == "SERPENT"))
upx $(PROJ).$(TARGETEXT)
!endif
gzip.exe -c -n --best $(PROJ).$(TARGETEXT) >$(PROJ).$(TARGETEXT).gz
-dd.exe conv=notrunc,sync bs=512 seek=5 if=$(PROJ).$(TARGETEXT).gz of=$(PROJ).flp 2>NUL:
cd ..
#
# 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.
#
# Modifications and 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.
PROJ = BootLoader
.SILENT:
!ifndef MSVC16_ROOT
!error Environment variable MSVC16_ROOT must point to the installation directory of MS Visual C++ 1.5
!endif
ENVPATH = $(PATH)
CC = $(MSVC16_ROOT)\bin\cl.exe
LD = $(MSVC16_ROOT)\bin\link.exe
AFLAGS = /nologo /omf
CFLAGS = /nologo /W3 /Fc /I "$(MSVC16_ROOT)\Include" /I"..\..\.." /I"..\..\..\Common" /I"..\..\..\Crypto"
CFLAGS = $(CFLAGS) /D __int8=char /D __int16=int /D __int32=long /D BOOL=char /D FALSE=0 /D TRUE=1
CFLAGS = $(CFLAGS) /D LITTLE_ENDIAN=1234 /D BYTE_ORDER=1234 /D TC_WINDOWS_BOOT /D TC_MINIMIZE_CODE_SIZE /D TC_NO_COMPILER_INT64
CFLAGS = $(CFLAGS) /D malloc=malloc_NA
LFLAGS = /NOLOGO /ONERROR:NOEXE /NOI /BATCH
OBJDIR = Release
!ifdef RESCUE_DISK
OBJDIR = Rescue
CFLAGS = $(CFLAGS) /D TC_WINDOWS_BOOT_RESCUE_DISK_MODE
!endif
!ifdef SINGLE_CIPHER
OBJDIR = $(OBJDIR)_$(SINGLE_CIPHER)
CFLAGS = $(CFLAGS) /D TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE /D TC_WINDOWS_BOOT_$(SINGLE_CIPHER)
!endif
!ifdef SINGLE_PRF
OBJDIR = $(OBJDIR)_$(SINGLE_PRF)
CFLAGS = $(CFLAGS) /D TC_WINDOWS_BOOT_$(SINGLE_PRF)
!else
CFLAGS = $(CFLAGS) /D TC_WINDOWS_BOOT_RIPEMD160
!endif
OUTDIR = $(OBJDIR)
TARGETEXT = com
TARGETS = $(OUTDIR)\BootDefs.i $(OUTDIR)\BootSector.bin $(OUTDIR)\Decompressor.com
CFLAGS = $(CFLAGS) /AT /Zl /f- /G3 /Oe /Os /Ob1 /OV0 /Gs /Gf /Gy /D NDEBUG
LFLAGS = $(LFLAGS) /NOD /NOE /TINY
OBJS = $(OUTDIR)\BootCrt.obj
LIBS = slibce
!if 1
SRCDIR = ..
!else
SRCDIR = $(MAKEDIR)
!endif
TARGETS = $(TARGETS) $(OUTDIR)\$(PROJ).$(TARGETEXT)
OBJS = $(OBJS) $(OUTDIR)\BootConfig.obj
OBJS = $(OBJS) $(OUTDIR)\BootConsoleIo.obj
OBJS = $(OBJS) $(OUTDIR)\BootDebug.obj
OBJS = $(OBJS) $(OUTDIR)\BootDiskIo.obj
OBJS = $(OBJS) $(OUTDIR)\BootEncryptedIo.obj
OBJS = $(OBJS) $(OUTDIR)\BootMain.obj
OBJS = $(OBJS) $(OUTDIR)\BootMemory.obj
OBJS = $(OBJS) $(OUTDIR)\IntFilter.obj
OBJS = $(OBJS) $(OUTDIR)\Platform.obj
OBJS = $(OBJS) $(OUTDIR)\Crc.obj
OBJS = $(OBJS) $(OUTDIR)\Crypto.obj
OBJS = $(OBJS) $(OUTDIR)\Endian.obj
OBJS = $(OBJS) $(OUTDIR)\Pkcs5.obj
OBJS = $(OBJS) $(OUTDIR)\Volumes.obj
OBJS = $(OBJS) $(OUTDIR)\Xts.obj
!if "$(SINGLE_PRF)" == "SHA2"
OBJS = $(OBJS) $(OUTDIR)\Sha2Small.obj
!else
OBJS = $(OBJS) $(OUTDIR)\Rmd160.obj
!endif
!if !DEFINED (SINGLE_CIPHER)
OBJS = $(OBJS) $(OUTDIR)\AesSmall.obj
!else if "$(SINGLE_CIPHER)" == "AES"
OBJS = $(OBJS) $(OUTDIR)\Aes_hw_cpu.obj
OBJS = $(OBJS) $(OUTDIR)\AesSmall_x86.obj
OBJS = $(OBJS) $(OUTDIR)\Aestab.obj
!endif
!if !DEFINED (SINGLE_CIPHER) || "$(SINGLE_CIPHER)" == "SERPENT"
OBJS = $(OBJS) $(OUTDIR)\Serpent.obj
!endif
!if !DEFINED (SINGLE_CIPHER) || "$(SINGLE_CIPHER)" == "TWOFISH"
OBJS = $(OBJS) $(OUTDIR)\Twofish.obj
!endif
!if "$(SINGLE_CIPHER)" == "CAMELLIA"
OBJS = $(OBJS) $(OUTDIR)\CamelliaSmall.obj
!endif
all: env $(TARGETS)
env:
set INCLUDE=.
set LIB=.
set LIBPATH=.
clean:
-del /q /s $(OBJDIR) >NUL:
.asm{$(OUTDIR)}.obj:
cd $(OBJDIR)
$(AS) $(AFLAGS) /c "$(SRCDIR)\$<"
cd ..
{..\..\Crypto}.asm{$(OUTDIR)}.obj:
cd $(OBJDIR)
echo $(<F)
nasm.exe -Xvc -f obj -Ox -o "$(<B).obj" -l "$(<B).lst" "$(SRCDIR)\$<"
cd ..
{..\..\Crypto}.c{$(OUTDIR)}.obj:
cd $(OBJDIR)
set PATH=.
$(CC) $(CFLAGS) /c "$(SRCDIR)\$<"
set PATH=$(ENVPATH)
cd ..
{..\..\Common}.c{$(OUTDIR)}.obj:
cd $(OBJDIR)
set PATH=.
$(CC) $(CFLAGS) /c "$(SRCDIR)\$<"
set PATH=$(ENVPATH)
cd ..
.c{$(OUTDIR)}.obj:
cd $(OBJDIR)
set PATH=.
$(CC) $(CFLAGS) /c "$(SRCDIR)\$<"
set PATH=$(ENVPATH)
cd ..
.cpp{$(OUTDIR)}.obj:
cd $(OBJDIR)
set PATH=.
$(CC) $(CFLAGS) /c "$(SRCDIR)\$<"
set PATH=$(ENVPATH)
cd ..
$(OUTDIR)\BootDefs.i: BootDefs.h
cd $(OBJDIR)
set PATH=.
$(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:
-dd.exe conv=notrunc bs=512 if=BootSector.bin of=$(PROJ).flp 2>NUL:
cd ..
$(OUTDIR)\Decompressor.com: $(OUTDIR)\BootCrt.obj $(OUTDIR)\Decompressor.obj
cd $(OBJDIR)
$(LD) $(LFLAGS) BootCrt.obj Decompressor.obj,Decompressor.com,Decompressor.map,$(MSVC16_ROOT)\lib\+slibce,,
-dd.exe conv=notrunc,sync bs=512 seek=1 if=Decompressor.com of=$(PROJ).flp 2>NUL:
cd ..
$(OUTDIR)\$(PROJ).$(TARGETEXT): $(OBJS)
@echo Linking...
cd $(OBJDIR)
echo >NUL: @<<$(PROJ).crf2
$(PROJ).$(TARGETEXT)
$(PROJ).map
$(MSVC16_ROOT)\lib\+
$(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
# Compress the Rescue Disk botloader for Cascades and Serpent since it is too big (size > 31232 bytes)
!if DEFINED(RESCUE_DISK) && (!DEFINED (SINGLE_CIPHER) || ("$(SINGLE_CIPHER)" == "SERPENT"))
upx $(PROJ).$(TARGETEXT)
!endif
gzip.exe -c -n --best $(PROJ).$(TARGETEXT) >$(PROJ).$(TARGETEXT).gz
-dd.exe conv=notrunc,sync bs=512 seek=5 if=$(PROJ).$(TARGETEXT).gz of=$(PROJ).flp 2>NUL:
cd ..
+230 -230
View File
@@ -1,230 +1,230 @@
/*
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.
Modifications and 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.
*/
#include "Platform.h"
#include "BootConsoleIo.h"
uint64 operator+ (const uint64 &a, const uint64 &b)
{
int carry = 0;
uint64 r;
r.LowPart = a.LowPart + b.LowPart;
__asm
{
jnc nocarry
mov carry, 1
nocarry:
}
r.HighPart = a.HighPart + b.HighPart + carry;
return r;
}
uint64 operator+ (const uint64 &a, uint32 b)
{
uint64 b64;
b64.HighPart = 0;
b64.LowPart = b;
return a + b64;
}
uint64 &operator+= (uint64 &a, const uint64 &b)
{
return a = a + b;
}
uint64 operator- (const uint64 &a, const uint64 &b)
{
int carry = 0;
uint64 r;
r.LowPart = a.LowPart - b.LowPart;
__asm
{
jnc nocarry
mov carry, 1
nocarry:
}
r.HighPart = a.HighPart - b.HighPart - carry;
return r;
}
uint64 operator- (const uint64 &a, uint32 b)
{
uint64 b64;
b64.HighPart = 0;
b64.LowPart = b;
return a - b64;
}
uint64 &operator-= (uint64 &a, const uint64 &b)
{
return a = a - b;
}
uint64 operator>> (const uint64 &a, int shiftCount)
{
uint64 r = a;
while (shiftCount--)
{
r.LowPart >>= 1;
if ((byte) r.HighPart & 1)
r.LowPart |= 0x80000000UL;
r.HighPart >>= 1;
}
return r;
}
uint64 operator<< (const uint64 &a, int shiftCount)
{
uint64 r = a;
while (shiftCount--)
r += r;
return r;
}
uint64 &operator++ (uint64 &a)
{
uint64 b;
b.HighPart = 0;
b.LowPart = 1;
return a += b;
}
bool operator== (const uint64 &a, const uint64 &b)
{
return a.HighPart == b.HighPart && a.LowPart == b.LowPart;
}
bool operator> (const uint64 &a, const uint64 &b)
{
return (a.HighPart > b.HighPart) || (a.HighPart == b.HighPart && a.LowPart > b.LowPart);
}
bool operator< (const uint64 &a, const uint64 &b)
{
return (a.HighPart < b.HighPart) || (a.HighPart == b.HighPart && a.LowPart < b.LowPart);
}
bool operator>= (const uint64 &a, const uint64 &b)
{
return a > b || a == b;
}
bool operator<= (const uint64 &a, const uint64 &b)
{
return a < b || a == b;
}
bool TestInt64 ()
{
uint64 a, b, c;
a.HighPart = 0x00112233UL;
a.LowPart = 0xabcd1234UL;
b.HighPart = 0x00ffeeddUL;
b.LowPart = 0xffffFFFFUL;
a += b;
a -= b;
++a;
b = b + (uint32) 1UL;
c = (a - ((a + b) >> 32) - (uint32) 1UL);
if (c.HighPart != 0x112233UL || c.LowPart != 0xAABC0123UL)
return false;
c = c << 9;
return c.HighPart == 0x22446755UL && c.LowPart == 0x78024600UL;
}
void CopyMemory (void *source, uint16 destSegment, uint16 destOffset, uint16 blockSize)
{
__asm
{
push es
mov si, ss:source
mov es, ss:destSegment
mov di, ss:destOffset
mov cx, ss:blockSize
cld
rep movsb
pop es
}
}
void CopyMemory (uint16 sourceSegment, uint16 sourceOffset, void *destination, uint16 blockSize)
{
__asm
{
push ds
push es
mov ax, ds
mov es, ax
mov di, ss:destination
mov si, ss:sourceOffset
mov cx, ss:blockSize
mov ds, ss:sourceSegment
cld
rep movsb
pop es
pop ds
}
}
void EraseMemory (void *memory, int size)
{
memset (memory, 0, size);
}
uint32 GetLinearAddress (uint16 segment, uint16 offset)
{
return (uint32 (segment) << 4) + offset;
}
bool RegionsIntersect (const uint64 &start1, uint32 length1, const uint64 &start2, const uint64 &end2)
{
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;
}
void ThrowFatalException (int line)
{
PrintChar ('#'); Print (line);
while (1);
}
/*
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.
Modifications and 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.
*/
#include "Platform.h"
#include "BootConsoleIo.h"
uint64 operator+ (const uint64 &a, const uint64 &b)
{
int carry = 0;
uint64 r;
r.LowPart = a.LowPart + b.LowPart;
__asm
{
jnc nocarry
mov carry, 1
nocarry:
}
r.HighPart = a.HighPart + b.HighPart + carry;
return r;
}
uint64 operator+ (const uint64 &a, uint32 b)
{
uint64 b64;
b64.HighPart = 0;
b64.LowPart = b;
return a + b64;
}
uint64 &operator+= (uint64 &a, const uint64 &b)
{
return a = a + b;
}
uint64 operator- (const uint64 &a, const uint64 &b)
{
int carry = 0;
uint64 r;
r.LowPart = a.LowPart - b.LowPart;
__asm
{
jnc nocarry
mov carry, 1
nocarry:
}
r.HighPart = a.HighPart - b.HighPart - carry;
return r;
}
uint64 operator- (const uint64 &a, uint32 b)
{
uint64 b64;
b64.HighPart = 0;
b64.LowPart = b;
return a - b64;
}
uint64 &operator-= (uint64 &a, const uint64 &b)
{
return a = a - b;
}
uint64 operator>> (const uint64 &a, int shiftCount)
{
uint64 r = a;
while (shiftCount--)
{
r.LowPart >>= 1;
if ((byte) r.HighPart & 1)
r.LowPart |= 0x80000000UL;
r.HighPart >>= 1;
}
return r;
}
uint64 operator<< (const uint64 &a, int shiftCount)
{
uint64 r = a;
while (shiftCount--)
r += r;
return r;
}
uint64 &operator++ (uint64 &a)
{
uint64 b;
b.HighPart = 0;
b.LowPart = 1;
return a += b;
}
bool operator== (const uint64 &a, const uint64 &b)
{
return a.HighPart == b.HighPart && a.LowPart == b.LowPart;
}
bool operator> (const uint64 &a, const uint64 &b)
{
return (a.HighPart > b.HighPart) || (a.HighPart == b.HighPart && a.LowPart > b.LowPart);
}
bool operator< (const uint64 &a, const uint64 &b)
{
return (a.HighPart < b.HighPart) || (a.HighPart == b.HighPart && a.LowPart < b.LowPart);
}
bool operator>= (const uint64 &a, const uint64 &b)
{
return a > b || a == b;
}
bool operator<= (const uint64 &a, const uint64 &b)
{
return a < b || a == b;
}
bool TestInt64 ()
{
uint64 a, b, c;
a.HighPart = 0x00112233UL;
a.LowPart = 0xabcd1234UL;
b.HighPart = 0x00ffeeddUL;
b.LowPart = 0xffffFFFFUL;
a += b;
a -= b;
++a;
b = b + (uint32) 1UL;
c = (a - ((a + b) >> 32) - (uint32) 1UL);
if (c.HighPart != 0x112233UL || c.LowPart != 0xAABC0123UL)
return false;
c = c << 9;
return c.HighPart == 0x22446755UL && c.LowPart == 0x78024600UL;
}
void CopyMemory (void *source, uint16 destSegment, uint16 destOffset, uint16 blockSize)
{
__asm
{
push es
mov si, ss:source
mov es, ss:destSegment
mov di, ss:destOffset
mov cx, ss:blockSize
cld
rep movsb
pop es
}
}
void CopyMemory (uint16 sourceSegment, uint16 sourceOffset, void *destination, uint16 blockSize)
{
__asm
{
push ds
push es
mov ax, ds
mov es, ax
mov di, ss:destination
mov si, ss:sourceOffset
mov cx, ss:blockSize
mov ds, ss:sourceSegment
cld
rep movsb
pop es
pop ds
}
}
void EraseMemory (void *memory, int size)
{
memset (memory, 0, size);
}
uint32 GetLinearAddress (uint16 segment, uint16 offset)
{
return (uint32 (segment) << 4) + offset;
}
bool RegionsIntersect (const uint64 &start1, uint32 length1, const uint64 &start2, const uint64 &end2)
{
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;
}
void ThrowFatalException (int line)
{
PrintChar ('#'); Print (line);
while (1);
}

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