mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-08-29 20:27:16 +00:00
Compare commits
352
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53902284b1 | ||
|
|
7f63d57f67 | ||
|
|
2ddc374164 | ||
|
|
78d9e5fc3b | ||
|
|
ac8d212ce7 | ||
|
|
3685ceceae | ||
|
|
45d642d4e1 | ||
|
|
2cfb896827 | ||
|
|
ea2d8ded53 | ||
|
|
620133002c | ||
|
|
15b6c7d3b7 | ||
|
|
2edd12fe22 | ||
|
|
a2b008c747 | ||
|
|
0f7ef7dcd7 | ||
|
|
f96eb0c5ec | ||
|
|
ea5902514a | ||
|
|
d5e3488894 | ||
|
|
233d18d351 | ||
|
|
7f53fd41f8 | ||
|
|
5547a605bd | ||
|
|
0ac4009720 | ||
|
|
2a10640f42 | ||
|
|
6e94286b39 | ||
|
|
041bc9dc0b | ||
|
|
e5a9e9239b | ||
|
|
7ff3c5d108 | ||
|
|
e8626ca74a | ||
|
|
34f3c055ed | ||
|
|
8e2c5ca45e | ||
|
|
7d6347f468 | ||
|
|
e362d804b0 | ||
|
|
3bad079d75 | ||
|
|
57ce7aab7b | ||
|
|
3e029b0dde | ||
|
|
5dfdc1b4a5 | ||
|
|
eb3e923091 | ||
|
|
4a435870f6 | ||
|
|
f40755fd7c | ||
|
|
3c09765208 | ||
|
|
b65eabe23d | ||
|
|
d18ecc1a37 | ||
|
|
69c8c9d6c6 | ||
|
|
77d070fe73 | ||
|
|
183cbc087a | ||
|
|
194b641ebd | ||
|
|
7c154a3f26 | ||
|
|
b81ec7d7e0 | ||
|
|
479925f403 | ||
|
|
17eeaa43cf | ||
|
|
9b1c447df1 | ||
|
|
4dacedd9cc | ||
|
|
66891638d5 | ||
|
|
c4a68500cc | ||
|
|
335f17b72f | ||
|
|
735657a254 | ||
|
|
83d3948bc8 | ||
|
|
7fac2e89b3 | ||
|
|
e5bb77e378 | ||
|
|
8209a30a6b | ||
|
|
22e4a8a252 | ||
|
|
c70f370bac | ||
|
|
49a8ff59dc | ||
|
|
d076bb5133 | ||
|
|
a63ae58596 | ||
|
|
7ad75a81ca | ||
|
|
f84dc7b78f | ||
|
|
882525b879 | ||
|
|
24e233ea2e | ||
|
|
c6d5b30704 | ||
|
|
0dc3cb7cd1 | ||
|
|
d4192bf863 | ||
|
|
8c963356cb | ||
|
|
20c723e242 | ||
|
|
3ddb499280 | ||
|
|
b56e8c5c4b | ||
|
|
d8a7de8ffb | ||
|
|
7695b8ada0 | ||
|
|
a72c7bcd6a | ||
|
|
2780ac962e | ||
|
|
e47f94cb43 | ||
|
|
625259d226 | ||
|
|
2fef14ff76 | ||
|
|
ce76957a10 | ||
|
|
1bf219b0dc | ||
|
|
a7056a6ac3 | ||
|
|
bba8a5be32 | ||
|
|
1e429d1fbf | ||
|
|
5d5a645083 | ||
|
|
1506916487 | ||
|
|
2db742f465 | ||
|
|
8bc8f7c66e | ||
|
|
99d5145c24 | ||
|
|
24560eae1d | ||
|
|
67031da928 | ||
|
|
87ee61bcb1 | ||
|
|
83885c1ebb | ||
|
|
2d72e42c6c | ||
|
|
71a38563ae | ||
|
|
4cf9db9f95 | ||
|
|
c4d4ade9d0 | ||
|
|
d127393897 | ||
|
|
b51d8f5386 | ||
|
|
b146e235f8 | ||
|
|
07ee8c1069 | ||
|
|
246233c402 | ||
|
|
58cff70724 | ||
|
|
e90e24b30b | ||
|
|
0b2c8b09c6 | ||
|
|
460f552a41 | ||
|
|
9bfe4780d4 | ||
|
|
f26ce59fb5 | ||
|
|
f32f65d4f7 | ||
|
|
5b381ce7d7 | ||
|
|
3fb2eedab8 | ||
|
|
fe31cf5b83 | ||
|
|
2389561406 | ||
|
|
a7f1ba05b4 | ||
|
|
3aaf5c7045 | ||
|
|
73703095b2 | ||
|
|
0fca588275 | ||
|
|
2dbf366184 | ||
|
|
ed81267291 | ||
|
|
1a8ce8a611 | ||
|
|
c5b766969a | ||
|
|
00eb49443a | ||
|
|
45617a3285 | ||
|
|
85cab3b85f | ||
|
|
e4efd6820a | ||
|
|
2faa1290c0 | ||
|
|
bdc5782f16 | ||
|
|
42373efcfd | ||
|
|
6ae982cccf | ||
|
|
842dce0e1b | ||
|
|
27b53c6ff4 | ||
|
|
aeb4e8a13a | ||
|
|
c7756befee | ||
|
|
21d567f731 | ||
|
|
d4e95293d9 | ||
|
|
76d3bc631e | ||
|
|
99c4031d89 | ||
|
|
a0d8b8a3b7 | ||
|
|
3f806010d2 | ||
|
|
94fdcdf18b | ||
|
|
2bb419f92c | ||
|
|
635c3b7af7 | ||
|
|
6954b7c3ef | ||
|
|
2bb0cbe16e | ||
|
|
cdaeef20ce | ||
|
|
ec4a0af41c | ||
|
|
37d7c75db8 | ||
|
|
1ad1c293a3 | ||
|
|
085ab96abd | ||
|
|
438753522e | ||
|
|
fc69e2541e | ||
|
|
942cf1635a | ||
|
|
bf47711ee7 | ||
|
|
723768137b | ||
|
|
268ef2d8e9 | ||
|
|
5f47d8b6f1 | ||
|
|
11716ed2da | ||
|
|
1910751558 | ||
|
|
fc37cc4a02 | ||
|
|
98b04198c6 | ||
|
|
6d61f06a53 | ||
|
|
53aabf3f14 | ||
|
|
fb9a49cb1a | ||
|
|
fede2cfa18 | ||
|
|
fc89bf6e2c | ||
|
|
b261177b8f | ||
|
|
0b914c8f5d | ||
|
|
650d913f51 | ||
|
|
faea63cb3c | ||
|
|
0c51cfa5f6 | ||
|
|
570645a845 | ||
|
|
275ac8622a | ||
|
|
99de8a6dcd | ||
|
|
91e3843732 | ||
|
|
32b42cff14 | ||
|
|
0163dfdcab | ||
|
|
1396269d57 | ||
|
|
bd9105794b | ||
|
|
e51aafb499 | ||
|
|
133afdc9e6 | ||
|
|
f5606a44a6 | ||
|
|
60575d9a49 | ||
|
|
409c0f79be | ||
|
|
09b22c175b | ||
|
|
af327b49aa | ||
|
|
7d7c09e718 | ||
|
|
39eae0e4c3 | ||
|
|
dc1593d60f | ||
|
|
1e204da223 | ||
|
|
ece26c7481 | ||
|
|
6738cba617 | ||
|
|
1290e7836f | ||
|
|
646679da4d | ||
|
|
fd26f49958 | ||
|
|
8bfc7f1caa | ||
|
|
8580464e51 | ||
|
|
fffb3bde7a | ||
|
|
facfda73eb | ||
|
|
50f85b4512 | ||
|
|
e175adcd46 | ||
|
|
0c0ea60b77 | ||
|
|
87df2fd2fc | ||
|
|
faf00ca1e0 | ||
|
|
b331668c06 | ||
|
|
8e8e273e11 | ||
|
|
6452fb3693 | ||
|
|
348a45132b | ||
|
|
3c87c095c3 | ||
|
|
2724d7880d | ||
|
|
26e2d22d62 | ||
|
|
a144e2167d | ||
|
|
2b4003cc81 | ||
|
|
1f87e64127 | ||
|
|
d7d4c98775 | ||
|
|
89d238bb32 | ||
|
|
7fee9a04c4 | ||
|
|
39fb2edc25 | ||
|
|
0863924483 | ||
|
|
8e2793085e | ||
|
|
8518d55834 | ||
|
|
ae7ec4802a | ||
|
|
229bd668f4 | ||
|
|
13a0473cf9 | ||
|
|
49d61632f9 | ||
|
|
4a7a9f4dd2 | ||
|
|
ce8a9becdf | ||
|
|
5aec655b8b | ||
|
|
2c0776e987 | ||
|
|
203c7aa015 | ||
|
|
fe234e08ee | ||
|
|
77885de85e | ||
|
|
b407512248 | ||
|
|
dde3dcf14d | ||
|
|
926721d54e | ||
|
|
24b2dfc0d5 | ||
|
|
ef0906bc83 | ||
|
|
90def2ee5a | ||
|
|
1ca60754b2 | ||
|
|
f63e34e0f9 | ||
|
|
dcb8390bb2 | ||
|
|
9f5b5445d7 | ||
|
|
d53b48bdf0 | ||
|
|
84ee7076d9 | ||
|
|
5a555deb74 | ||
|
|
b8a2e808c6 | ||
|
|
e9d3ba0b11 | ||
|
|
c86697f51b | ||
|
|
5a09d17c45 | ||
|
|
c95940cfc6 | ||
|
|
b12e8b6943 | ||
|
|
cd65f78a62 | ||
|
|
bda7a1d0bd | ||
|
|
43f5fae2ee | ||
|
|
f9fa0191ec | ||
|
|
8a2d9c4120 | ||
|
|
90957cd9d9 | ||
|
|
3cda204626 | ||
|
|
59afc2c4d9 | ||
|
|
dd1e62ebcd | ||
|
|
a6c6c3dc4a | ||
|
|
66a5671e3b | ||
|
|
e858d93a8e | ||
|
|
e40774f546 | ||
|
|
fe38d6f52c | ||
|
|
8586c51016 | ||
|
|
fb430c403b | ||
|
|
5597a1e390 | ||
|
|
3b1eebbfad | ||
|
|
80ba722497 | ||
|
|
52d9838978 | ||
|
|
7a15ff2083 | ||
|
|
0600ae7d1c | ||
|
|
29d46b749d | ||
|
|
ea8e8e517e | ||
|
|
723fcfa64d | ||
|
|
6e1f5cfe4b | ||
|
|
5872be28a2 | ||
|
|
6cb1eefc49 | ||
|
|
4181283f29 | ||
|
|
bb66dac8e6 | ||
|
|
0c2c0a846d | ||
|
|
d462806ea9 | ||
|
|
859c111d01 | ||
|
|
82f372ef4f | ||
|
|
5a2c8af7ec | ||
|
|
2e9c630ab1 | ||
|
|
2fd699cc66 | ||
|
|
fcfcd1a2c4 | ||
|
|
8f6c08330a | ||
|
|
7832d712fd | ||
|
|
3610d2c2ec | ||
|
|
9a39164ed5 | ||
|
|
4f17e0cfe9 | ||
|
|
c1f1c643ff | ||
|
|
8e56e138cc | ||
|
|
1cf826dbad | ||
|
|
13c6f2948e | ||
|
|
533b7e1eb8 | ||
|
|
3a9db8d98c | ||
|
|
613ea66c95 | ||
|
|
efa436974d | ||
|
|
cfadb231d2 | ||
|
|
2d4781be24 | ||
|
|
e0408eee74 | ||
|
|
96d8c65ab4 | ||
|
|
9666dda282 | ||
|
|
2408edb239 | ||
|
|
10d77be0d2 | ||
|
|
59611b8b37 | ||
|
|
90bd57fe40 | ||
|
|
ec7d96fcb7 | ||
|
|
c53fd7ef0c | ||
|
|
d40eedeaaf | ||
|
|
1c55894e1d | ||
|
|
7322ebbc83 | ||
|
|
c69bd27f78 | ||
|
|
6691cc0c06 | ||
|
|
3eb383d4a5 | ||
|
|
14eaa9006c | ||
|
|
4a09511372 | ||
|
|
ebbbde8964 | ||
|
|
62de77e2c8 | ||
|
|
c863f3769e | ||
|
|
1d844c4557 | ||
|
|
908fa17e0f | ||
|
|
01fda292e6 | ||
|
|
4ff727d702 | ||
|
|
97701eb2e9 | ||
|
|
0a69062c6b | ||
|
|
d5e7426181 | ||
|
|
41819270bb | ||
|
|
8342d0d616 | ||
|
|
19483d2097 | ||
|
|
225acf4a22 | ||
|
|
fb67b54787 | ||
|
|
23b69537a5 | ||
|
|
ee3fa19ed9 | ||
|
|
f274f5bdc5 | ||
|
|
5a8eee91c3 | ||
|
|
647a7e047a | ||
|
|
dadfebc6c3 | ||
|
|
8748013f7d | ||
|
|
63091cd29c | ||
|
|
9a6fc789eb | ||
|
|
f3c91cb05c | ||
|
|
13058fd638 | ||
|
|
c94f8c9b63 | ||
|
|
ea451c7241 | ||
|
|
4682f9b235 |
@@ -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
|
||||||
+744
-503
File diff suppressed because it is too large
Load Diff
@@ -18,15 +18,15 @@ Contents
|
|||||||
========
|
========
|
||||||
|
|
||||||
I. Windows
|
I. Windows
|
||||||
Requirements for Building VeraCrypt for Windows
|
Requirements for Building VeraCrypt for Windows
|
||||||
Instructions for Building VeraCrypt for Windows
|
Instructions for Building VeraCrypt for Windows
|
||||||
Instructions for Signing and Packaging VeraCrypt for Windows
|
Instructions for Signing and Packaging VeraCrypt for Windows
|
||||||
|
|
||||||
II. Linux and Mac OS X
|
II. Linux and Mac OS X
|
||||||
Requirements for Building VeraCrypt for Linux and Mac OS X
|
Requirements for Building VeraCrypt for Linux and Mac OS X
|
||||||
Instructions for Building VeraCrypt for Linux and Mac OS X
|
Instructions for Building VeraCrypt for Linux and Mac OS X
|
||||||
Mac OS X specifics
|
Mac OS X specifics
|
||||||
|
|
||||||
III. FreeBSD and OpenSolaris
|
III. FreeBSD and OpenSolaris
|
||||||
|
|
||||||
IV. Third-Party Developers (Contributors)
|
IV. Third-Party Developers (Contributors)
|
||||||
@@ -43,14 +43,14 @@ I. Windows
|
|||||||
Requirements for Building VeraCrypt for Windows:
|
Requirements for Building VeraCrypt for Windows:
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|
||||||
- Microsoft Visual C++ 2008 SP1 (Professional Edition or compatible)
|
- Microsoft Visual C++ 2010 SP1 (Professional Edition or compatible)
|
||||||
- Microsoft Visual C++ 1.52 (available from MSDN Subscriber Downloads)
|
- 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 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)
|
- 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
|
- NASM assembler 2.08 or compatible
|
||||||
- gzip compressor
|
- gzip compressor
|
||||||
|
- upx packer (available at http://upx.sourceforge.net/)
|
||||||
|
|
||||||
IMPORTANT:
|
IMPORTANT:
|
||||||
|
|
||||||
@@ -59,11 +59,12 @@ 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.
|
allow the VeraCrypt driver to run without an appropriate digital signature.
|
||||||
Therefore, all .sys files in official VeraCrypt binary packages are digitally
|
Therefore, all .sys files in official VeraCrypt binary packages are digitally
|
||||||
signed with the digital certificate of the IDRIX, which was
|
signed with the digital certificate of the IDRIX, which was
|
||||||
issued by Thawt certification authority. At the end of each official .exe and
|
issued by Thawte certification authority. At the end of each official .exe and
|
||||||
.sys file, there are embedded digital signatures and all related certificates
|
.sys file, there are embedded digital signatures and all related certificates
|
||||||
(i.e. all certificates in the relevant certification chain, such as the
|
(i.e. all certificates in the relevant certification chain, such as the
|
||||||
certification authority certificates, CA-MS cross-certificate, and the
|
certification authority certificates, CA-MS cross-certificate, and the
|
||||||
IDRIX certificate). Keep this in mind if you compile VeraCrypt
|
IDRIX certificate).
|
||||||
|
Keep this in mind if you compile VeraCrypt
|
||||||
and compare your binaries with the official binaries. If your binaries are
|
and compare your binaries with the official binaries. If your binaries are
|
||||||
unsigned, the sizes of the official binaries will usually be approximately
|
unsigned, the sizes of the official binaries will usually be approximately
|
||||||
10 KB greater than sizes of your binaries (there may be further differences
|
10 KB greater than sizes of your binaries (there may be further differences
|
||||||
@@ -87,30 +88,36 @@ Instructions for Building VeraCrypt for Windows:
|
|||||||
directory than '%SYSTEMDRIVE%\WinDDK', create an environment variable
|
directory than '%SYSTEMDRIVE%\WinDDK', create an environment variable
|
||||||
'WINDDK_ROOT' pointing to the DDK installation directory.
|
'WINDDK_ROOT' pointing to the DDK installation directory.
|
||||||
|
|
||||||
3) Copy the PKCS #11 header files to a standard include path or create an
|
3) Open the solution file 'VeraCrypt.sln' in Microsoft Visual Studio 2010.
|
||||||
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.
|
4) Select 'All' as the active solution configuration.
|
||||||
|
|
||||||
5) Select 'All' as the active solution configuration.
|
5) Build the solution.
|
||||||
|
|
||||||
6) Build the solution.
|
6) If successful, there should be newly built VeraCrypt binaries in the
|
||||||
|
|
||||||
7) If successful, there should be newly built VeraCrypt binaries in the
|
|
||||||
'Release' folder.
|
'Release' folder.
|
||||||
|
|
||||||
Instructions for Signing VeraCrypt for Windows:
|
Instructions for Signing and Packaging VeraCrypt for Windows:
|
||||||
------------------------------------------------
|
-------------------------------------------------------------
|
||||||
|
|
||||||
The folder "Signing" contains a batch file (sign.bat) that will sign all
|
First, create an environment variable 'WSDK81' pointing to the Windows SDK
|
||||||
VeraCrypt components using a code signing certificate present on the
|
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.
|
certificate store and also build the final installation setup.
|
||||||
The batch file suppose that the code signing certificate is issued by Thawt.
|
The batch file suppose that the code signing certificate is issued by Thawt.
|
||||||
This is the case for IDRIX's certificate. If yours is issued by another CA,
|
This is the case for IDRIX's certificate. If yours is issued by another CA,
|
||||||
then you should put the Root and Intermediate certificates in the "Signing"
|
then you should put the Root and Intermediate certificates in the "Signing"
|
||||||
folder and then modify sign.bat accordingly.
|
folder and then modify sign.bat accordingly.
|
||||||
|
|
||||||
|
VeraCrypt EFI Boot Loader:
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
VeraCrypt source code contains pre-built EFI binaries under src\Boot\EFI.
|
||||||
|
The source code of VeraCrypt EFI Boot Loader is licensed under LGPL and
|
||||||
|
it is available at https://github.com/veracrypt/VeraCrypt-DCS.
|
||||||
|
For build instructions, please refer to the file src\Boot\EFI\Readme.txt.
|
||||||
|
|
||||||
|
|
||||||
II. Linux and Mac OS X
|
II. Linux and Mac OS X
|
||||||
======================
|
======================
|
||||||
@@ -126,12 +133,8 @@ Requirements for Building VeraCrypt for Linux and Mac OS X:
|
|||||||
- makeself (Linux only)
|
- makeself (Linux only)
|
||||||
- wxWidgets 3.0 shared library and header files installed or
|
- wxWidgets 3.0 shared library and header files installed or
|
||||||
wxWidgets 3.0 library source code (available at http://www.wxwidgets.org)
|
wxWidgets 3.0 library source code (available at http://www.wxwidgets.org)
|
||||||
- FUSE library and header files (available at http://fuse.sourceforge.net
|
- FUSE library and header files (available at https://github.com/libfuse/libfuse
|
||||||
and https://osxfuse.github.io/)
|
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:
|
Instructions for Building VeraCrypt for Linux and Mac OS X:
|
||||||
@@ -141,7 +144,7 @@ Instructions for Building VeraCrypt for Linux and Mac OS X:
|
|||||||
|
|
||||||
2) If you have no wxWidgets shared library installed, run the following
|
2) If you have no wxWidgets shared library installed, run the following
|
||||||
command to configure the wxWidgets static library for VeraCrypt and to
|
command to configure the wxWidgets static library for VeraCrypt and to
|
||||||
build it:
|
build it:
|
||||||
|
|
||||||
$ make WXSTATIC=1 WX_ROOT=/usr/src/wxWidgets wxbuild
|
$ make WXSTATIC=1 WX_ROOT=/usr/src/wxWidgets wxbuild
|
||||||
|
|
||||||
@@ -154,7 +157,7 @@ Instructions for Building VeraCrypt for Linux and Mac OS X:
|
|||||||
$ make
|
$ make
|
||||||
|
|
||||||
or if you have no wxWidgets shared library installed:
|
or if you have no wxWidgets shared library installed:
|
||||||
|
|
||||||
$ make WXSTATIC=1
|
$ make WXSTATIC=1
|
||||||
|
|
||||||
4) If successful, the VeraCrypt executable should be located in the directory
|
4) If successful, the VeraCrypt executable should be located in the directory
|
||||||
@@ -167,21 +170,21 @@ built using the 'NOGUI' parameter:
|
|||||||
|
|
||||||
$ make NOGUI=1 WXSTATIC=1 WX_ROOT=/usr/src/wxWidgets wxbuild
|
$ make NOGUI=1 WXSTATIC=1 WX_ROOT=/usr/src/wxWidgets wxbuild
|
||||||
$ make NOGUI=1 WXSTATIC=1
|
$ make NOGUI=1 WXSTATIC=1
|
||||||
|
|
||||||
On MacOSX, building a console-only executable is not supported.
|
On MacOSX, building a console-only executable is not supported.
|
||||||
|
|
||||||
Mac OS X specifics:
|
Mac OS X specifics:
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
|
||||||
Under MacOSX, the SDK for OSX 10.7 is used by default. To use another version
|
Under MacOSX, the SDK for OSX 10.7 is used by default. To use another version
|
||||||
of the SDK (e.i. 10.6), you can export the environment variable VC_OSX_TARGET :
|
of the SDK (i.e. 10.6), you can export the environment variable VC_OSX_TARGET:
|
||||||
|
|
||||||
$ export VC_OSX_TARGET=10.6
|
$ export VC_OSX_TARGET=10.6
|
||||||
|
|
||||||
|
|
||||||
Before building under MacOSX, pkg-config must be installed if not yet available.
|
Before building under MacOSX, pkg-config must be installed if not yet available.
|
||||||
Get it from http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz and
|
Get it from http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz and
|
||||||
compile using the following commands :
|
compile using the following commands :
|
||||||
|
|
||||||
$ ./configure --with-internal-glib
|
$ ./configure --with-internal-glib
|
||||||
$ make
|
$ make
|
||||||
@@ -190,11 +193,11 @@ compile using the following commands :
|
|||||||
After making sure pkg-config is available, download and install OSXFuse from
|
After making sure pkg-config is available, download and install OSXFuse from
|
||||||
https://osxfuse.github.io/ (MacFUSE compatibility layer must selected)
|
https://osxfuse.github.io/ (MacFUSE compatibility layer must selected)
|
||||||
|
|
||||||
The script build_veracrypt_macosx.sh available under "src/Build" performs the
|
The script build_veracrypt_macosx.sh available under "src/Build" performs the
|
||||||
full build of VeraCrypt including the creation of the installer pkg. It expects
|
full build of VeraCrypt including the creation of the installer pkg. It expects
|
||||||
to find the wxWidgets 3.0.2 sources at the same level as where you put
|
to find the wxWidgets 3.0.2 sources at the same level as where you put
|
||||||
VeraCrypt sources (e.i. if "src" path is "/Users/joe/Projects/VeraCrypt/src"
|
VeraCrypt sources (i.e. if "src" path is "/Users/joe/Projects/VeraCrypt/src"
|
||||||
then wxWidgets should be at "/Users/joe/Projects/wxWidgets-wxWidgets-3.0.2")
|
then wxWidgets should be at "/Users/joe/Projects/wxWidgets-3.0.2")
|
||||||
|
|
||||||
The build process uses Code Signing certificates whose ID is specified in
|
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
|
src/Main/Main.make (lines 167 & 169). You'll have to modify these lines to put
|
||||||
@@ -235,20 +238,25 @@ Copyright Information
|
|||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
This software as a whole:
|
This software as a whole:
|
||||||
Copyright (c) 2013-2015 IDRIX. All rights reserved.
|
Copyright (c) 2013-2016 IDRIX. All rights reserved.
|
||||||
|
|
||||||
Portions of this software:
|
Portions of this software:
|
||||||
|
Copyright (c) 2013-2016 IDRIX. All rights reserved.
|
||||||
Copyright (c) 2003-2012 TrueCrypt Developers Association. All rights reserved.
|
Copyright (c) 2003-2012 TrueCrypt Developers Association. All rights reserved.
|
||||||
Copyright (c) 1998-2000 Paul Le Roux. 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) 1998-2008 Brian Gladman, Worcester, UK. All rights reserved.
|
||||||
Copyright (c) 2002-2004 Mark Adler. All rights reserved.
|
Copyright (c) 1995-2013 Jean-loup Gailly and Mark Adler.
|
||||||
|
Copyright (c) 2016 Disk Cryptography Services for EFI (DCS), Alex Kolotnikov
|
||||||
|
Copyright (c) Dieter Baron and Thomas Klausner.
|
||||||
|
Copyright (c) 2013, Alexey Degtyarev. All rights reserved.
|
||||||
|
|
||||||
For more information, please see the legal notices attached to parts of the
|
For more information, please see the legal notices attached to parts of the
|
||||||
source code.
|
source code.
|
||||||
|
|
||||||
Trademark Information
|
Trademark Information
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
Any trademarks contained in the source code, binaries, and/or in the
|
Any trademarks contained in the source code, binaries, and/or in the
|
||||||
documentation, are the sole property of their respective owners.
|
documentation, are the sole property of their respective owners.
|
||||||
|
|
||||||
|
|
||||||
@@ -257,4 +265,3 @@ VI. Further Information
|
|||||||
=======================
|
=======================
|
||||||
|
|
||||||
http://www.veracrypt.fr
|
http://www.veracrypt.fr
|
||||||
|
|
||||||
|
|||||||
+321
-286
@@ -1,286 +1,321 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
setlocal
|
setlocal
|
||||||
|
|
||||||
call :freedrive mydriveletter && goto :cont
|
call :freedrive mydriveletter && goto :cont
|
||||||
echo ERROR: No free drive letter found.
|
echo ERROR: No free drive letter found.
|
||||||
goto :exit
|
goto :exit
|
||||||
:cont
|
:cont
|
||||||
|
|
||||||
echo Using drive letter %mydriveletter%: for our tests
|
echo Using drive letter %mydriveletter%: for our tests
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
rem Get start time:
|
IF NOT EXIST test.sha512.hc GOTO :whirlpool
|
||||||
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 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 Mount SHA-512 container (Normal)
|
||||||
rem Get end time:
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha512.hc /hash sha512 /l %mydriveletter% /password test /q /silent /m ro
|
||||||
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 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 Get elapsed time:
|
||||||
rem Show elapsed time:
|
set /A elapsed=end-start
|
||||||
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%
|
rem Show elapsed time:
|
||||||
if %mm% lss 10 set mm=0%mm%
|
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 %ss% lss 10 set ss=0%ss%
|
if %hh% lss 10 set hh=0%hh%
|
||||||
if %cc% lss 10 set cc=0%cc%
|
if %mm% lss 10 set mm=0%mm%
|
||||||
echo SHA-512 (Normal) = %hh%:%mm%:%ss%,%cc%
|
if %ss% lss 10 set ss=0%ss%
|
||||||
|
if %cc% lss 10 set cc=0%cc%
|
||||||
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
echo SHA-512 (Normal) = %hh%:%mm%:%ss%,%cc%
|
||||||
|
|
||||||
rem Get start time:
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
||||||
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 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 Mount SHA-512 container (Hidden)
|
||||||
rem Get end time:
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha512.hc /hash sha512 /l %mydriveletter% /password testhidden /q /silent /m ro
|
||||||
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 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 Get elapsed time:
|
||||||
rem Show elapsed time:
|
set /A elapsed=end-start
|
||||||
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%
|
rem Show elapsed time:
|
||||||
if %mm% lss 10 set mm=0%mm%
|
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 %ss% lss 10 set ss=0%ss%
|
if %hh% lss 10 set hh=0%hh%
|
||||||
if %cc% lss 10 set cc=0%cc%
|
if %mm% lss 10 set mm=0%mm%
|
||||||
echo SHA-512 (Hidden) = %hh%:%mm%:%ss%,%cc%
|
if %ss% lss 10 set ss=0%ss%
|
||||||
echo.
|
if %cc% lss 10 set cc=0%cc%
|
||||||
|
echo SHA-512 (Hidden) = %hh%:%mm%:%ss%,%cc%
|
||||||
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
echo.
|
||||||
|
|
||||||
rem Get start time:
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
||||||
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"
|
:whirlpool
|
||||||
)
|
|
||||||
|
IF NOT EXIST test.whirlpool.hc GOTO :sha256
|
||||||
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 start time:
|
||||||
|
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
||||||
rem Get end time:
|
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||||
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 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 elapsed time:
|
|
||||||
set /A elapsed=end-start
|
rem Get end time:
|
||||||
|
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
||||||
rem Show elapsed time:
|
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||||
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%
|
rem Get elapsed time:
|
||||||
if %ss% lss 10 set ss=0%ss%
|
set /A elapsed=end-start
|
||||||
if %cc% lss 10 set cc=0%cc%
|
|
||||||
echo Whirlpool (Normal) = %hh%:%mm%:%ss%,%cc%
|
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
|
||||||
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
if %hh% lss 10 set hh=0%hh%
|
||||||
|
if %mm% lss 10 set mm=0%mm%
|
||||||
rem Get start time:
|
if %ss% lss 10 set ss=0%ss%
|
||||||
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
if %cc% lss 10 set cc=0%cc%
|
||||||
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
echo Whirlpool (Normal) = %hh%:%mm%:%ss%,%cc%
|
||||||
)
|
|
||||||
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
||||||
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 start time:
|
||||||
|
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
||||||
rem Get end time:
|
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||||
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 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 elapsed time:
|
|
||||||
set /A elapsed=end-start
|
rem Get end time:
|
||||||
|
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
||||||
rem Show elapsed time:
|
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||||
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%
|
rem Get elapsed time:
|
||||||
if %ss% lss 10 set ss=0%ss%
|
set /A elapsed=end-start
|
||||||
if %cc% lss 10 set cc=0%cc%
|
|
||||||
echo Whirlpool (Hidden) = %hh%:%mm%:%ss%,%cc%
|
rem Show elapsed time:
|
||||||
echo.
|
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%
|
||||||
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
if %mm% lss 10 set mm=0%mm%
|
||||||
|
if %ss% lss 10 set ss=0%ss%
|
||||||
rem Get start time:
|
if %cc% lss 10 set cc=0%cc%
|
||||||
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
echo Whirlpool (Hidden) = %hh%:%mm%:%ss%,%cc%
|
||||||
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
echo.
|
||||||
)
|
|
||||||
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
||||||
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
|
:sha256
|
||||||
|
|
||||||
rem Get end time:
|
IF NOT EXIST test.sha256.hc GOTO :ripemd160
|
||||||
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 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 Get elapsed time:
|
)
|
||||||
set /A elapsed=end-start
|
|
||||||
|
rem Mount SHA-256 container (Normal)
|
||||||
rem Show elapsed time:
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha256.hc /hash sha256 /l %mydriveletter% /password test /q /silent /m ro
|
||||||
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%
|
rem Get end time:
|
||||||
if %mm% lss 10 set mm=0%mm%
|
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
||||||
if %ss% lss 10 set ss=0%ss%
|
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||||
if %cc% lss 10 set cc=0%cc%
|
)
|
||||||
echo SHA-256 (Normal) = %hh%:%mm%:%ss%,%cc%
|
|
||||||
|
rem Get elapsed time:
|
||||||
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
set /A elapsed=end-start
|
||||||
|
|
||||||
rem Get start time:
|
rem Show elapsed time:
|
||||||
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
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
|
||||||
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 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%
|
||||||
rem Mount SHA-256 container (Hidden)
|
if %cc% lss 10 set cc=0%cc%
|
||||||
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha256.hc /hash sha256 /l %mydriveletter% /password testhidden /q /silent /m ro
|
echo SHA-256 (Normal) = %hh%:%mm%:%ss%,%cc%
|
||||||
|
|
||||||
rem Get end time:
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
||||||
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 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 Get elapsed time:
|
)
|
||||||
set /A elapsed=end-start
|
|
||||||
|
rem Mount SHA-256 container (Hidden)
|
||||||
rem Show elapsed time:
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha256.hc /hash sha256 /l %mydriveletter% /password testhidden /q /silent /m ro
|
||||||
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%
|
rem Get end time:
|
||||||
if %mm% lss 10 set mm=0%mm%
|
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
||||||
if %ss% lss 10 set ss=0%ss%
|
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||||
if %cc% lss 10 set cc=0%cc%
|
)
|
||||||
echo SHA-256 (Hidden) = %hh%:%mm%:%ss%,%cc%
|
|
||||||
echo.
|
rem Get elapsed time:
|
||||||
|
set /A elapsed=end-start
|
||||||
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
|
||||||
|
rem Show elapsed time:
|
||||||
rem Get start 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
|
||||||
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
if %hh% lss 10 set hh=0%hh%
|
||||||
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
if %mm% lss 10 set mm=0%mm%
|
||||||
)
|
if %ss% lss 10 set ss=0%ss%
|
||||||
|
if %cc% lss 10 set cc=0%cc%
|
||||||
rem Mount RIPEMD-160 container (Normal)
|
echo SHA-256 (Hidden) = %hh%:%mm%:%ss%,%cc%
|
||||||
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.ripemd160.hc /hash ripemd160 /l %mydriveletter% /password test /q /silent /m ro
|
echo.
|
||||||
|
|
||||||
rem Get end time:
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
||||||
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"
|
:ripemd160
|
||||||
)
|
|
||||||
|
IF NOT EXIST test.ripemd160.hc GOTO :autodetect
|
||||||
rem Get elapsed time:
|
|
||||||
set /A elapsed=end-start
|
rem Get start time:
|
||||||
|
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
||||||
rem Show elapsed time:
|
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||||
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%
|
rem Mount RIPEMD-160 container (Normal)
|
||||||
if %ss% lss 10 set ss=0%ss%
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.ripemd160.hc /hash ripemd160 /l %mydriveletter% /password test /q /silent /m ro
|
||||||
if %cc% lss 10 set cc=0%cc%
|
|
||||||
echo RIPEMD-160 (Normal) = %hh%:%mm%:%ss%,%cc%
|
rem Get end time:
|
||||||
|
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
||||||
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||||
|
)
|
||||||
rem Get start time:
|
|
||||||
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
rem Get elapsed time:
|
||||||
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
set /A elapsed=end-start
|
||||||
)
|
|
||||||
|
rem Show elapsed time:
|
||||||
rem Mount RIPEMD-160 container (Hidden)
|
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
|
||||||
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.ripemd160.hc /hash ripemd160 /l %mydriveletter% /password testhidden /q /silent /m ro
|
if %hh% lss 10 set hh=0%hh%
|
||||||
|
if %mm% lss 10 set mm=0%mm%
|
||||||
rem Get end time:
|
if %ss% lss 10 set ss=0%ss%
|
||||||
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
if %cc% lss 10 set cc=0%cc%
|
||||||
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
echo RIPEMD-160 (Normal) = %hh%:%mm%:%ss%,%cc%
|
||||||
)
|
|
||||||
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
||||||
rem Get elapsed time:
|
|
||||||
set /A elapsed=end-start
|
rem Get start time:
|
||||||
|
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
||||||
rem Show elapsed time:
|
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||||
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%
|
rem Mount RIPEMD-160 container (Hidden)
|
||||||
if %ss% lss 10 set ss=0%ss%
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.ripemd160.hc /hash ripemd160 /l %mydriveletter% /password testhidden /q /silent /m ro
|
||||||
if %cc% lss 10 set cc=0%cc%
|
|
||||||
echo RIPEMD-160 (Hidden) = %hh%:%mm%:%ss%,%cc%
|
rem Get end time:
|
||||||
echo.
|
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"
|
||||||
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
)
|
||||||
|
|
||||||
rem Get start time:
|
rem Get elapsed time:
|
||||||
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
set /A elapsed=end-start
|
||||||
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
|
||||||
)
|
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
|
||||||
rem Try to mount with a wrong password and PRF autodetection
|
if %hh% lss 10 set hh=0%hh%
|
||||||
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume test.sha512.hc /l %mydriveletter% /password wrongpassword /q /silent /m ro
|
if %mm% lss 10 set mm=0%mm%
|
||||||
|
if %ss% lss 10 set ss=0%ss%
|
||||||
rem Get end time:
|
if %cc% lss 10 set cc=0%cc%
|
||||||
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
echo RIPEMD-160 (Hidden) = %hh%:%mm%:%ss%,%cc%
|
||||||
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
echo.
|
||||||
)
|
|
||||||
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /dismount %mydriveletter% /silent /q
|
||||||
rem Get elapsed time:
|
|
||||||
set /A elapsed=end-start
|
:autodetect
|
||||||
|
|
||||||
rem Show elapsed time:
|
call :availablevolume testvolume && goto :contautodetect
|
||||||
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
|
goto :exit
|
||||||
if %hh% lss 10 set hh=0%hh%
|
:contautodetect
|
||||||
if %mm% lss 10 set mm=0%mm%
|
|
||||||
if %ss% lss 10 set ss=0%ss%
|
rem Get start time:
|
||||||
if %cc% lss 10 set cc=0%cc%
|
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
||||||
echo Wrong Password (PRF Auto-detection)= %hh%:%mm%:%ss%,%cc%
|
set /A "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||||
echo.
|
)
|
||||||
|
|
||||||
|
rem Try to mount with a wrong password and PRF autodetection
|
||||||
goto :exit
|
"c:\Program Files\VeraCrypt\veracrypt.exe" /volume %testvolume% /l %mydriveletter% /password wrongpassword /q /silent /m ro
|
||||||
|
|
||||||
rem Finds a free drive letter.
|
rem Get end time:
|
||||||
rem
|
for /F "tokens=1-4 delims=:.," %%a in ("%time%") do (
|
||||||
rem Parameters:
|
set /A "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"
|
||||||
rem %1 = Output variable name.
|
)
|
||||||
rem
|
|
||||||
rem Example:
|
rem Get elapsed time:
|
||||||
rem call :freedrive mydriveletter && goto :cont
|
set /A elapsed=end-start
|
||||||
rem echo ERROR: No free drive letter found.
|
|
||||||
rem goto :EOF
|
rem Show elapsed time:
|
||||||
rem :cont
|
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
|
||||||
rem echo Found drive letter: %mydriveletter%
|
if %hh% lss 10 set hh=0%hh%
|
||||||
:freedrive
|
if %mm% lss 10 set mm=0%mm%
|
||||||
setlocal EnableDelayedExpansion
|
if %ss% lss 10 set ss=0%ss%
|
||||||
set exitcode=0
|
if %cc% lss 10 set cc=0%cc%
|
||||||
set "output_var=%~1"
|
echo Wrong Password (PRF Auto-detection)= %hh%:%mm%:%ss%,%cc%
|
||||||
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 (
|
echo.
|
||||||
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
|
goto :exit
|
||||||
rem letter but no media in them, a case that goes undetected when
|
|
||||||
rem using 'if exist'.
|
rem Finds a free drive letter.
|
||||||
subst !drive! %SystemDrive%\ >nul
|
rem
|
||||||
if !errorlevel! == 0 (
|
rem Parameters:
|
||||||
subst !drive! /d >nul
|
rem %1 = Output variable name.
|
||||||
set "drive=%%i"
|
rem
|
||||||
goto :freedrive0
|
rem Example:
|
||||||
)
|
rem call :freedrive mydriveletter && goto :cont
|
||||||
)
|
rem echo ERROR: No free drive letter found.
|
||||||
set exitcode=1
|
rem goto :EOF
|
||||||
set drive=
|
rem :cont
|
||||||
:freedrive0
|
rem echo Found drive letter: %mydriveletter%
|
||||||
endlocal & set "%output_var%=%drive%" & exit /b %exitcode%
|
:freedrive
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
:exit
|
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
-1431
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1470
-1430
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1470
-1430
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1470
-1433
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1472
-1433
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1470
-1432
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1465
-1426
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1468
-1429
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1470
-1431
File diff suppressed because it is too large
Load Diff
+1469
-1430
File diff suppressed because it is too large
Load Diff
+1469
-1428
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,35 @@
|
|||||||
|
The source code for VeraCrypt EFI bootloader files is available at: https://github.com/veracrypt/VeraCrypt-DCS
|
||||||
|
Use tag "VeraCrypt_1.18" to extract the sources that were used when building VeraCrypt 1.18.
|
||||||
|
|
||||||
|
VeraCrypt-DCS uses EDK II as its UEFI development environement.
|
||||||
|
|
||||||
|
VeraCrypt-DCS is licensed under LGPL: https://github.com/veracrypt/VeraCrypt-DCS/blob/master/LICENSE
|
||||||
|
|
||||||
|
Here the steps to build VeraCrypt-DCS (Visual Studio 2010 SP1 should be installed)
|
||||||
|
* Clone EDK: git clone https://github.com/tianocore/tianocore.github.io.git edk2
|
||||||
|
* Switch to UDK2015 branche: git checkout UDK2015
|
||||||
|
* Clone VeraCrypt-DCS as DcsPkg inside edk2 folder: git clone https://github.com/veracrypt/VeraCrypt-DCS.git DcsPkg
|
||||||
|
* Switch to VeraCrypt_1.18 branche: git checkout VeraCrypt_1.18
|
||||||
|
* Setup EDK by typing edksetup.bat at the root of folder edk2
|
||||||
|
* change directoty to DcsPkg and then type setenv.bat.
|
||||||
|
* change directory to DcsPkg\Library\VeraCryptLib and then type mklinks_src.bat: you will be asked to provide the path to VeraCrypt src folder.
|
||||||
|
* change directory to DcsPkg and then type dcs_bld.bat X64Rel
|
||||||
|
* After the build is finished, EFI bootloader files will be present at edk2\Build\DcsPkg\RELEASE_VS2010x86\X64
|
||||||
|
|
||||||
|
Secure Boot:
|
||||||
|
In order to allow VeraCrypt EFI bootloader to run when EFI Secure Boot is enabled, VeraCrypt EFI bootloader files are signed
|
||||||
|
using a custom key whose public part can be loader into Secure Boot to allow the verification of VeraCrypt EFI files.
|
||||||
|
|
||||||
|
below are instruction 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.
@@ -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
|
||||||
@@ -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.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+32
-32
@@ -1,32 +1,32 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TC_HEADER_Boot_Bios
|
#ifndef TC_HEADER_Boot_Bios
|
||||||
#define TC_HEADER_Boot_Bios
|
#define TC_HEADER_Boot_Bios
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
#define TC_LB_SIZE_BIT_SHIFT_DIVISOR 9
|
#define TC_LB_SIZE_BIT_SHIFT_DIVISOR 9
|
||||||
|
|
||||||
#define TC_FIRST_BIOS_DRIVE 0x80
|
#define TC_FIRST_BIOS_DRIVE 0x80
|
||||||
#define TC_LAST_BIOS_DRIVE 0x8f
|
#define TC_LAST_BIOS_DRIVE 0x8f
|
||||||
#define TC_INVALID_BIOS_DRIVE (TC_FIRST_BIOS_DRIVE - 1)
|
#define TC_INVALID_BIOS_DRIVE (TC_FIRST_BIOS_DRIVE - 1)
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
BiosResultSuccess = 0x00,
|
BiosResultSuccess = 0x00,
|
||||||
BiosResultInvalidFunction = 0x01
|
BiosResultInvalidFunction = 0x01
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef byte BiosResult;
|
typedef byte BiosResult;
|
||||||
|
|
||||||
#endif // TC_HEADER_Boot_Bios
|
#endif // TC_HEADER_Boot_Bios
|
||||||
|
|||||||
+250
-246
@@ -1,246 +1,250 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
<VisualStudioProject
|
<VisualStudioProject
|
||||||
ProjectType="Visual C++"
|
ProjectType="Visual C++"
|
||||||
Version="9.00"
|
Version="9.00"
|
||||||
Name="Boot"
|
Name="Boot"
|
||||||
ProjectGUID="{8B7F059F-E4C7-4E11-88F5-EE8B8433072E}"
|
ProjectGUID="{8B7F059F-E4C7-4E11-88F5-EE8B8433072E}"
|
||||||
RootNamespace="Boot"
|
RootNamespace="Boot"
|
||||||
Keyword="MakeFileProj"
|
Keyword="MakeFileProj"
|
||||||
TargetFrameworkVersion="131072"
|
TargetFrameworkVersion="131072"
|
||||||
>
|
>
|
||||||
<Platforms>
|
<Platforms>
|
||||||
<Platform
|
<Platform
|
||||||
Name="Win32"
|
Name="Win32"
|
||||||
/>
|
/>
|
||||||
</Platforms>
|
</Platforms>
|
||||||
<ToolFiles>
|
<ToolFiles>
|
||||||
</ToolFiles>
|
</ToolFiles>
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="$(ConfigurationName)"
|
OutputDirectory="$(ConfigurationName)"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="0"
|
ConfigurationType="0"
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCNMakeTool"
|
Name="VCNMakeTool"
|
||||||
BuildCommandLine="md Release 2>NUL:
nmake.exe /nologo RELEASE=1

md Release_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_PRF=SHA2

md Release_AES 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES

md Release_AES_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES SINGLE_PRF=SHA2

md Release_Serpent 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT

md Release_Serpent_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT SINGLE_PRF=SHA2

md Release_Twofish 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH

md Release_Twofish_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH SINGLE_PRF=SHA2

md Rescue 2>NUL:
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1

md Rescue_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1 SINGLE_PRF=SHA2

md Rescue_AES 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1

md Rescue_AES_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1 SINGLE_PRF=SHA2

md Rescue_Serpent 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1

md Rescue_Serpent_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1 SINGLE_PRF=SHA2

md Rescue_Twofish 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1

md Rescue_Twofish_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1 SINGLE_PRF=SHA2"
|
BuildCommandLine="md Release 2>NUL:
nmake.exe /nologo RELEASE=1

md Release_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_PRF=SHA2

md Release_AES 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES

md Release_AES_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES SINGLE_PRF=SHA2

md Release_Serpent 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT

md Release_Serpent_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT SINGLE_PRF=SHA2

md Release_Twofish 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH

md Release_Twofish_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH SINGLE_PRF=SHA2

md Release_Camellia 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA

md Release_Camellia_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA SINGLE_PRF=SHA2

md Rescue 2>NUL:
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1

md Rescue_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1 SINGLE_PRF=SHA2

md Rescue_AES 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1

md Rescue_AES_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1 SINGLE_PRF=SHA2

md Rescue_Serpent 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1

md Rescue_Serpent_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1 SINGLE_PRF=SHA2

md Rescue_Twofish 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1

md Rescue_Twofish_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1 SINGLE_PRF=SHA2

md Rescue_Camellia 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1

md Rescue_Camellia_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1 SINGLE_PRF=SHA2"
|
||||||
ReBuildCommandLine="del /q /s Release >NUL:
md Release 2>NUL:
nmake.exe /nologo RELEASE=1

del /q /s Release_SHA2 >NUL:
md Release_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_PRF=SHA2

del /q /s Release_AES >NUL:
md Release_AES 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES

del /q /s Release_AES_SHA2 >NUL:
md Release_AES_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES SINGLE_PRF=SHA2

del /q /s Release_Serpent >NUL:
md Release_Serpent 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT

del /q /s Release_Serpent_SHA2 >NUL:
md Release_Serpent_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT SINGLE_PRF=SHA2

del /q /s Release_Twofish >NUL:
md Release_Twofish 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH

del /q /s Release_Twofish_SHA2 >NUL:
md Release_Twofish_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH SINGLE_PRF=SHA2

del /q /s Rescue >NUL:
md Rescue 2>NUL:
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1

del /q /s Rescue_SHA2 >NUL:
md Rescue_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1 SINGLE_PRF=SHA2

del /q /s Rescue_AES >NUL:
md Rescue_AES 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1

del /q /s Rescue_AES_SHA2 >NUL:
md Rescue_AES_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1 SINGLE_PRF=SHA2

del /q /s Rescue_Serpent >NUL:
md Rescue_Serpent 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1

del /q /s Rescue_Serpent_SHA2 >NUL:
md Rescue_Serpent_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1 SINGLE_PRF=SHA2

del /q /s Rescue_Twofish >NUL:
md Rescue_Twofish 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1

del /q /s Rescue_Twofish_SHA2 >NUL:
md Rescue_Twofish_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1 SINGLE_PRF=SHA2"
|
ReBuildCommandLine="del /q /s Release >NUL:
md Release 2>NUL:
nmake.exe /nologo RELEASE=1

del /q /s Release_SHA2 >NUL:
md Release_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_PRF=SHA2

del /q /s Release_AES >NUL:
md Release_AES 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES

del /q /s Release_AES_SHA2 >NUL:
md Release_AES_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES SINGLE_PRF=SHA2

del /q /s Release_Serpent >NUL:
md Release_Serpent 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT

del /q /s Release_Serpent_SHA2 >NUL:
md Release_Serpent_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT SINGLE_PRF=SHA2

del /q /s Release_Twofish >NUL:
md Release_Twofish 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH

del /q /s Release_Twofish_SHA2 >NUL:
md Release_Twofish_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH SINGLE_PRF=SHA2

del /q /s Release_Camellia >NUL:
md Release_Camellia 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA

del /q /s Release_Camellia_SHA2 >NUL:
md Release_Camellia_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA SINGLE_PRF=SHA2

del /q /s Rescue >NUL:
md Rescue 2>NUL:
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1

del /q /s Rescue_SHA2 >NUL:
md Rescue_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1 SINGLE_PRF=SHA2

del /q /s Rescue_AES >NUL:
md Rescue_AES 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1

del /q /s Rescue_AES_SHA2 >NUL:
md Rescue_AES_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1 SINGLE_PRF=SHA2

del /q /s Rescue_Serpent >NUL:
md Rescue_Serpent 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1

del /q /s Rescue_Serpent_SHA2 >NUL:
md Rescue_Serpent_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1 SINGLE_PRF=SHA2

del /q /s Rescue_Twofish >NUL:
md Rescue_Twofish 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1

del /q /s Rescue_Twofish_SHA2 >NUL:
md Rescue_Twofish_SHA2 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1 SINGLE_PRF=SHA2

del /q /s Rescue_Camellia >NUL:
md Rescue_Camellia 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1

del /q /s Rescue_Camellia_SHA2 >NUL:
md Rescue_Camellia_SHA2 2>NUL:
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 Rescue Rescue_AES Rescue_Serpent Rescue_Twofish >NUL:
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 >NUL:
"
|
CleanCommandLine="del /q /s Release Release_AES Release_Serpent Release_Twofish Release_Camellia Rescue Rescue_AES Rescue_Serpent Rescue_Twofish Rescue_Camellia >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 >NUL:
"
|
||||||
Output="Release\BootLoader.com"
|
Output="Release\BootLoader.com"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG"
|
PreprocessorDefinitions="WIN32;NDEBUG"
|
||||||
IncludeSearchPath=""$(SolutionDir)";"$(SolutionDir)\Common";"$(SolutionDir)\Crypto";"$(MSVC16_ROOT)\Include""
|
IncludeSearchPath=""$(SolutionDir)";"$(SolutionDir)\Common";"$(SolutionDir)\Crypto";"$(MSVC16_ROOT)\Include""
|
||||||
ForcedIncludes=""
|
ForcedIncludes=""
|
||||||
AssemblySearchPath=""
|
AssemblySearchPath=""
|
||||||
ForcedUsingAssemblies=""
|
ForcedUsingAssemblies=""
|
||||||
CompileAsManaged=""
|
CompileAsManaged=""
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release Loader|Win32"
|
Name="Release Loader|Win32"
|
||||||
OutputDirectory="$(ConfigurationName)"
|
OutputDirectory="$(ConfigurationName)"
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="0"
|
ConfigurationType="0"
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCNMakeTool"
|
Name="VCNMakeTool"
|
||||||
BuildCommandLine="md Release 2>NUL:
nmake.exe /nologo RELEASE=1

md Release_AES 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES

md Release_Serpent 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT

md Release_Twofish 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH"
|
BuildCommandLine="md Release 2>NUL:
nmake.exe /nologo RELEASE=1

md Release_AES 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES

md Release_Serpent 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT

md Release_Twofish 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH"
|
||||||
ReBuildCommandLine="del /q /s Release >NUL:
md Release 2>NUL:
nmake.exe /nologo RELEASE=1

del /q /s Release_AES >NUL:
md Release_AES 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES

del /q /s Release_Serpent >NUL:
md Release_Serpent 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT

del /q /s Release_Twofish >NUL:
md Release_Twofish 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH"
|
ReBuildCommandLine="del /q /s Release >NUL:
md Release 2>NUL:
nmake.exe /nologo RELEASE=1

del /q /s Release_AES >NUL:
md Release_AES 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES

del /q /s Release_Serpent >NUL:
md Release_Serpent 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT

del /q /s Release_Twofish >NUL:
md Release_Twofish 2>NUL:
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH"
|
||||||
CleanCommandLine="del /q /s Release Release_AES Release_Serpent Release_Twofish >NUL:"
|
CleanCommandLine="del /q /s Release Release_AES Release_Serpent Release_Twofish >NUL:"
|
||||||
Output="Release\BootLoader.com"
|
Output="Release\BootLoader.com"
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG"
|
PreprocessorDefinitions="WIN32;NDEBUG"
|
||||||
IncludeSearchPath=""$(SolutionDir)";"$(SolutionDir)\Common";"$(SolutionDir)\Crypto";"$(MSVC16_ROOT)\Include""
|
IncludeSearchPath=""$(SolutionDir)";"$(SolutionDir)\Common";"$(SolutionDir)\Crypto";"$(MSVC16_ROOT)\Include""
|
||||||
ForcedIncludes=""
|
ForcedIncludes=""
|
||||||
AssemblySearchPath=""
|
AssemblySearchPath=""
|
||||||
ForcedUsingAssemblies=""
|
ForcedUsingAssemblies=""
|
||||||
CompileAsManaged=""
|
CompileAsManaged=""
|
||||||
/>
|
/>
|
||||||
</Configuration>
|
</Configuration>
|
||||||
</Configurations>
|
</Configurations>
|
||||||
<References>
|
<References>
|
||||||
</References>
|
</References>
|
||||||
<Files>
|
<Files>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Source Files"
|
Name="Source Files"
|
||||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
>
|
>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootConfig.cpp"
|
RelativePath=".\BootConfig.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootConsoleIo.cpp"
|
RelativePath=".\BootConsoleIo.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootCrt.asm"
|
RelativePath=".\BootCrt.asm"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootDebug.cpp"
|
RelativePath=".\BootDebug.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootDiskIo.cpp"
|
RelativePath=".\BootDiskIo.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootEncryptedIo.cpp"
|
RelativePath=".\BootEncryptedIo.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootMain.cpp"
|
RelativePath=".\BootMain.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootMemory.cpp"
|
RelativePath=".\BootMemory.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootSector.asm"
|
RelativePath=".\BootSector.asm"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Decompressor.c"
|
RelativePath=".\Decompressor.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\IntFilter.cpp"
|
RelativePath=".\IntFilter.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Platform.cpp"
|
RelativePath=".\Platform.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Common"
|
Name="Common"
|
||||||
>
|
>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Common\Crc.c"
|
RelativePath="..\..\Common\Crc.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Common\Crypto.c"
|
RelativePath="..\..\Common\Crypto.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Common\Endian.c"
|
RelativePath="..\..\Common\Endian.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Common\Pkcs5.c"
|
RelativePath="..\..\Common\Pkcs5.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Common\Volumes.c"
|
RelativePath="..\..\Common\Volumes.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Common\Xts.c"
|
RelativePath="..\..\Common\Xts.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Crypto"
|
Name="Crypto"
|
||||||
>
|
>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Crypto\Aes_hw_cpu.asm"
|
RelativePath="..\..\Crypto\Aes_hw_cpu.asm"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Crypto\AesSmall.c"
|
RelativePath="..\..\Crypto\AesSmall.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Crypto\AesSmall_x86.asm"
|
RelativePath="..\..\Crypto\AesSmall_x86.asm"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Crypto\Rmd160.c"
|
RelativePath="..\..\Crypto\CamelliaSmall.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Crypto\Serpent.c"
|
RelativePath="..\..\Crypto\Rmd160.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Crypto\Sha2Small.c"
|
RelativePath="..\..\Crypto\Serpent.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\Crypto\Twofish.c"
|
RelativePath="..\..\Crypto\Sha2Small.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
<File
|
||||||
</Filter>
|
RelativePath="..\..\Crypto\Twofish.c"
|
||||||
<Filter
|
>
|
||||||
Name="Header Files"
|
</File>
|
||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
</Filter>
|
||||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
</Filter>
|
||||||
>
|
<Filter
|
||||||
<File
|
Name="Header Files"
|
||||||
RelativePath=".\Bios.h"
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
>
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
</File>
|
>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootCommon.h"
|
RelativePath=".\Bios.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootConfig.h"
|
RelativePath=".\BootCommon.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootConsoleIo.h"
|
RelativePath=".\BootConfig.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootDebug.h"
|
RelativePath=".\BootConsoleIo.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootDefs.h"
|
RelativePath=".\BootDebug.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootDiskIo.h"
|
RelativePath=".\BootDefs.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootEncryptedIo.h"
|
RelativePath=".\BootDiskIo.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootMain.h"
|
RelativePath=".\BootEncryptedIo.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootMemory.h"
|
RelativePath=".\BootMain.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\BootStrings.h"
|
RelativePath=".\BootMemory.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\IntFilter.h"
|
RelativePath=".\BootStrings.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Platform.h"
|
RelativePath=".\IntFilter.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
<File
|
||||||
<Filter
|
RelativePath=".\Platform.h"
|
||||||
Name="Build Files"
|
>
|
||||||
>
|
</File>
|
||||||
<File
|
</Filter>
|
||||||
RelativePath=".\Makefile"
|
<Filter
|
||||||
>
|
Name="Build Files"
|
||||||
</File>
|
>
|
||||||
</Filter>
|
<File
|
||||||
</Files>
|
RelativePath=".\Makefile"
|
||||||
<Globals>
|
>
|
||||||
</Globals>
|
</File>
|
||||||
</VisualStudioProject>
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
||||||
|
|||||||
@@ -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>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1
|
||||||
|
|
||||||
|
md Release_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
md Release_AES 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES
|
||||||
|
|
||||||
|
md Release_AES_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
md Release_Serpent 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT
|
||||||
|
|
||||||
|
md Release_Serpent_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
md Release_Twofish 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH
|
||||||
|
|
||||||
|
md Release_Twofish_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
md Release_Camellia 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA
|
||||||
|
|
||||||
|
md Release_Camellia_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
md Rescue 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1
|
||||||
|
|
||||||
|
md Rescue_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1 SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
md Rescue_AES 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1
|
||||||
|
|
||||||
|
md Rescue_AES_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1 SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
md Rescue_Serpent 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1
|
||||||
|
|
||||||
|
md Rescue_Serpent_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1 SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
md Rescue_Twofish 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1
|
||||||
|
|
||||||
|
md Rescue_Twofish_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1 SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
md Rescue_Camellia 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1
|
||||||
|
|
||||||
|
md Rescue_Camellia_SHA2 2>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 >NUL:
|
||||||
|
md Release 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1
|
||||||
|
|
||||||
|
del /q /s Release_SHA2 >NUL:
|
||||||
|
md Release_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
del /q /s Release_AES >NUL:
|
||||||
|
md Release_AES 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES
|
||||||
|
|
||||||
|
del /q /s Release_AES_SHA2 >NUL:
|
||||||
|
md Release_AES_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
del /q /s Release_Serpent >NUL:
|
||||||
|
md Release_Serpent 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT
|
||||||
|
|
||||||
|
del /q /s Release_Serpent_SHA2 >NUL:
|
||||||
|
md Release_Serpent_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
del /q /s Release_Twofish >NUL:
|
||||||
|
md Release_Twofish 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH
|
||||||
|
|
||||||
|
del /q /s Release_Twofish_SHA2 >NUL:
|
||||||
|
md Release_Twofish_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
del /q /s Release_Camellia >NUL:
|
||||||
|
md Release_Camellia 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA
|
||||||
|
|
||||||
|
del /q /s Release_Camellia_SHA2 >NUL:
|
||||||
|
md Release_Camellia_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
del /q /s Rescue >NUL:
|
||||||
|
md Rescue 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1
|
||||||
|
|
||||||
|
del /q /s Rescue_SHA2 >NUL:
|
||||||
|
md Rescue_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 RESCUE_DISK=1 SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
del /q /s Rescue_AES >NUL:
|
||||||
|
md Rescue_AES 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1
|
||||||
|
|
||||||
|
del /q /s Rescue_AES_SHA2 >NUL:
|
||||||
|
md Rescue_AES_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES RESCUE_DISK=1 SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
del /q /s Rescue_Serpent >NUL:
|
||||||
|
md Rescue_Serpent 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1
|
||||||
|
|
||||||
|
del /q /s Rescue_Serpent_SHA2 >NUL:
|
||||||
|
md Rescue_Serpent_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT RESCUE_DISK=1 SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
del /q /s Rescue_Twofish >NUL:
|
||||||
|
md Rescue_Twofish 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1
|
||||||
|
|
||||||
|
del /q /s Rescue_Twofish_SHA2 >NUL:
|
||||||
|
md Rescue_Twofish_SHA2 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH RESCUE_DISK=1 SINGLE_PRF=SHA2
|
||||||
|
|
||||||
|
del /q /s Rescue_Camellia >NUL:
|
||||||
|
md Rescue_Camellia 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=CAMELLIA RESCUE_DISK=1
|
||||||
|
|
||||||
|
del /q /s Rescue_Camellia_SHA2 >NUL:
|
||||||
|
md Rescue_Camellia_SHA2 2>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 >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 >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>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1
|
||||||
|
|
||||||
|
md Release_AES 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES
|
||||||
|
|
||||||
|
md Release_Serpent 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT
|
||||||
|
|
||||||
|
md Release_Twofish 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=TWOFISH</NMakeBuildCommandLine>
|
||||||
|
<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release Loader|Win32'">del /q /s Release >NUL:
|
||||||
|
md Release 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1
|
||||||
|
|
||||||
|
del /q /s Release_AES >NUL:
|
||||||
|
md Release_AES 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=AES
|
||||||
|
|
||||||
|
del /q /s Release_Serpent >NUL:
|
||||||
|
md Release_Serpent 2>NUL:
|
||||||
|
nmake.exe /nologo RELEASE=1 SINGLE_CIPHER=SERPENT
|
||||||
|
|
||||||
|
del /q /s Release_Twofish >NUL:
|
||||||
|
md Release_Twofish 2>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 >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>
|
||||||
@@ -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>
|
||||||
@@ -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
@@ -1,82 +1,214 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TC_HEADER_Boot_BootCommon
|
#ifndef TC_HEADER_Boot_BootCommon
|
||||||
#define TC_HEADER_Boot_BootCommon
|
#define TC_HEADER_Boot_BootCommon
|
||||||
|
|
||||||
#include "Common/Password.h"
|
#include "Common/Password.h"
|
||||||
#include "BootDefs.h"
|
#include "BootDefs.h"
|
||||||
|
|
||||||
// The user will be advised to upgrade the rescue disk if upgrading from the following or any previous version
|
// 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 0x0113
|
#define TC_RESCUE_DISK_UPGRADE_NOTICE_MAX_VERSION 0x0118
|
||||||
|
|
||||||
#define TC_BOOT_LOADER_AREA_SIZE (TC_BOOT_LOADER_AREA_SECTOR_COUNT * TC_SECTOR_SIZE_BIOS)
|
#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 (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_BOOT_VOLUME_HEADER_SECTOR_OFFSET (TC_BOOT_VOLUME_HEADER_SECTOR * TC_SECTOR_SIZE_BIOS)
|
||||||
|
|
||||||
#define TC_CD_BOOTSECTOR_OFFSET 0xd000
|
#define TC_CD_BOOTSECTOR_OFFSET 0xd000
|
||||||
#define TC_CD_BOOT_LOADER_SECTOR 26
|
#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 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_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 (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_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_MBR_SECTOR 0
|
||||||
#define TC_MAX_MBR_BOOT_CODE_SIZE 440
|
#define TC_MAX_MBR_BOOT_CODE_SIZE 440
|
||||||
|
|
||||||
#define TC_MAX_EXTRA_BOOT_PARTITION_SIZE (512UL * 1024UL * 1024UL)
|
#define TC_MAX_EXTRA_BOOT_PARTITION_SIZE (512UL * 1024UL * 1024UL)
|
||||||
|
|
||||||
|
|
||||||
#pragma pack (1)
|
#pragma pack (1)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
byte Flags;
|
byte Flags;
|
||||||
} BootSectorConfiguration;
|
} BootSectorConfiguration;
|
||||||
|
|
||||||
|
|
||||||
// Modifying this value can introduce incompatibility with previous versions
|
// Modifying this value can introduce incompatibility with previous versions
|
||||||
#define TC_BOOT_LOADER_ARGS_OFFSET 0x10
|
#define TC_BOOT_LOADER_ARGS_OFFSET 0x10
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// Modifying this structure can introduce incompatibility with previous versions
|
// Modifying this structure can introduce incompatibility with previous versions
|
||||||
char Signature[8];
|
char Signature[8];
|
||||||
uint16 BootLoaderVersion;
|
uint16 BootLoaderVersion;
|
||||||
uint16 CryptoInfoOffset;
|
uint16 CryptoInfoOffset;
|
||||||
uint16 CryptoInfoLength;
|
uint16 CryptoInfoLength;
|
||||||
uint32 HeaderSaltCrc32;
|
uint32 HeaderSaltCrc32;
|
||||||
Password BootPassword;
|
Password BootPassword;
|
||||||
uint64 HiddenSystemPartitionStart;
|
uint64 HiddenSystemPartitionStart;
|
||||||
uint64 DecoySystemPartitionStart;
|
uint64 DecoySystemPartitionStart;
|
||||||
uint32 Flags;
|
uint32 Flags;
|
||||||
uint32 BootDriveSignature;
|
uint32 BootDriveSignature;
|
||||||
|
|
||||||
uint32 BootArgumentsCrc32;
|
uint32 BootArgumentsCrc32;
|
||||||
|
|
||||||
} BootArguments;
|
} BootArguments;
|
||||||
|
|
||||||
// Modifying these values can introduce incompatibility with previous versions
|
// Modifying these values can introduce incompatibility with previous versions
|
||||||
#define TC_BOOT_ARGS_FLAG_EXTRA_BOOT_PARTITION 0x1
|
#define TC_BOOT_ARGS_FLAG_EXTRA_BOOT_PARTITION 0x1
|
||||||
|
|
||||||
#pragma pack ()
|
#pragma pack ()
|
||||||
|
|
||||||
// Boot arguments signature should not be defined as a static string
|
// Boot arguments signature should not be defined as a static string
|
||||||
// Modifying these values can introduce incompatibility with previous versions
|
// 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_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)
|
#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(_MSC_VER) && !defined(TC_WINDOWS_BOOT)
|
||||||
#endif // TC_HEADER_Boot_BootCommon
|
|
||||||
|
#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
@@ -1,94 +1,102 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "BootConfig.h"
|
#include "BootConfig.h"
|
||||||
|
|
||||||
byte BootSectorFlags;
|
byte BootSectorFlags;
|
||||||
|
|
||||||
byte BootLoaderDrive;
|
byte BootLoaderDrive;
|
||||||
byte BootDrive;
|
byte BootDrive;
|
||||||
bool BootDriveGeometryValid = false;
|
bool BootDriveGeometryValid = false;
|
||||||
bool PreventNormalSystemBoot = false;
|
bool PreventNormalSystemBoot = false;
|
||||||
bool PreventBootMenu = false;
|
bool PreventBootMenu = false;
|
||||||
char CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1];
|
char CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1];
|
||||||
uint32 OuterVolumeBackupHeaderCrc;
|
uint32 OuterVolumeBackupHeaderCrc;
|
||||||
|
|
||||||
bool BootStarted = false;
|
bool BootStarted = false;
|
||||||
|
|
||||||
DriveGeometry BootDriveGeometry;
|
DriveGeometry BootDriveGeometry;
|
||||||
|
|
||||||
CRYPTO_INFO *BootCryptoInfo;
|
CRYPTO_INFO *BootCryptoInfo;
|
||||||
Partition EncryptedVirtualPartition;
|
Partition EncryptedVirtualPartition;
|
||||||
|
|
||||||
Partition ActivePartition;
|
Partition ActivePartition;
|
||||||
Partition PartitionFollowingActive;
|
Partition PartitionFollowingActive;
|
||||||
bool ExtraBootPartitionPresent = false;
|
bool ExtraBootPartitionPresent = false;
|
||||||
uint64 HiddenVolumeStartUnitNo;
|
uint64 PimValueOrHiddenVolumeStartUnitNo; // reuse this variable for stored PIM value to reduce memory usage
|
||||||
uint64 HiddenVolumeStartSector;
|
uint64 HiddenVolumeStartSector;
|
||||||
|
|
||||||
#ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
|
#ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
|
||||||
|
|
||||||
void ReadBootSectorUserConfiguration ()
|
void ReadBootSectorUserConfiguration ()
|
||||||
{
|
{
|
||||||
byte userConfig;
|
byte userConfig;
|
||||||
|
|
||||||
AcquireSectorBuffer();
|
AcquireSectorBuffer();
|
||||||
|
|
||||||
if (ReadWriteMBR (false, BootLoaderDrive, true) != BiosResultSuccess)
|
if (ReadWriteMBR (false, BootLoaderDrive, true) != BiosResultSuccess)
|
||||||
goto ret;
|
goto ret;
|
||||||
|
|
||||||
userConfig = SectorBuffer[TC_BOOT_SECTOR_USER_CONFIG_OFFSET];
|
userConfig = SectorBuffer[TC_BOOT_SECTOR_USER_CONFIG_OFFSET];
|
||||||
|
|
||||||
#ifdef TC_WINDOWS_BOOT_AES
|
#ifdef TC_WINDOWS_BOOT_AES
|
||||||
EnableHwEncryption (!(userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION));
|
EnableHwEncryption (!(userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PreventBootMenu = (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_ESC);
|
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);
|
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;
|
CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH] = 0;
|
||||||
|
|
||||||
if (userConfig & TC_BOOT_USER_CFG_FLAG_SILENT_MODE)
|
if (userConfig & TC_BOOT_USER_CFG_FLAG_SILENT_MODE)
|
||||||
{
|
{
|
||||||
if (CustomUserMessage[0])
|
if (CustomUserMessage[0])
|
||||||
{
|
{
|
||||||
InitVideoMode();
|
InitVideoMode();
|
||||||
Print (CustomUserMessage);
|
Print (CustomUserMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
DisableScreenOutput();
|
DisableScreenOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
OuterVolumeBackupHeaderCrc = *(uint32 *) (SectorBuffer + TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET);
|
if (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_PIM)
|
||||||
|
{
|
||||||
ret:
|
PimValueOrHiddenVolumeStartUnitNo.LowPart = 0;
|
||||||
ReleaseSectorBuffer();
|
memcpy (&PimValueOrHiddenVolumeStartUnitNo.LowPart, SectorBuffer + TC_BOOT_SECTOR_PIM_VALUE_OFFSET, TC_BOOT_SECTOR_PIM_VALUE_SIZE);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
PimValueOrHiddenVolumeStartUnitNo.LowPart = -1;
|
||||||
BiosResult UpdateBootSectorConfiguration (byte drive)
|
|
||||||
{
|
OuterVolumeBackupHeaderCrc = *(uint32 *) (SectorBuffer + TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET);
|
||||||
AcquireSectorBuffer();
|
|
||||||
|
ret:
|
||||||
BiosResult result = ReadWriteMBR (false, drive);
|
ReleaseSectorBuffer();
|
||||||
if (result != BiosResultSuccess)
|
}
|
||||||
goto ret;
|
|
||||||
|
|
||||||
SectorBuffer[TC_BOOT_SECTOR_CONFIG_OFFSET] = BootSectorFlags;
|
BiosResult UpdateBootSectorConfiguration (byte drive)
|
||||||
result = ReadWriteMBR (true, drive);
|
{
|
||||||
|
AcquireSectorBuffer();
|
||||||
ret:
|
|
||||||
ReleaseSectorBuffer();
|
BiosResult result = ReadWriteMBR (false, drive);
|
||||||
return result;
|
if (result != BiosResultSuccess)
|
||||||
}
|
goto ret;
|
||||||
|
|
||||||
#endif // !TC_WINDOWS_BOOT_RESCUE_DISK_MODE
|
SectorBuffer[TC_BOOT_SECTOR_CONFIG_OFFSET] = BootSectorFlags;
|
||||||
|
result = ReadWriteMBR (true, drive);
|
||||||
|
|
||||||
|
ret:
|
||||||
|
ReleaseSectorBuffer();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !TC_WINDOWS_BOOT_RESCUE_DISK_MODE
|
||||||
|
|||||||
@@ -1,46 +1,46 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TC_HEADER_Boot_BootConfig
|
#ifndef TC_HEADER_Boot_BootConfig
|
||||||
#define TC_HEADER_Boot_BootConfig
|
#define TC_HEADER_Boot_BootConfig
|
||||||
|
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "BootDiskIo.h"
|
#include "BootDiskIo.h"
|
||||||
|
|
||||||
extern byte BootSectorFlags;
|
extern byte BootSectorFlags;
|
||||||
|
|
||||||
extern byte BootLoaderDrive;
|
extern byte BootLoaderDrive;
|
||||||
extern byte BootDrive;
|
extern byte BootDrive;
|
||||||
extern bool BootDriveGeometryValid;
|
extern bool BootDriveGeometryValid;
|
||||||
extern DriveGeometry BootDriveGeometry;
|
extern DriveGeometry BootDriveGeometry;
|
||||||
extern bool PreventNormalSystemBoot;
|
extern bool PreventNormalSystemBoot;
|
||||||
extern bool PreventBootMenu;
|
extern bool PreventBootMenu;
|
||||||
extern char CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1];
|
extern char CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1];
|
||||||
extern uint32 OuterVolumeBackupHeaderCrc;
|
extern uint32 OuterVolumeBackupHeaderCrc;
|
||||||
|
|
||||||
extern bool BootStarted;
|
extern bool BootStarted;
|
||||||
|
|
||||||
extern CRYPTO_INFO *BootCryptoInfo;
|
extern CRYPTO_INFO *BootCryptoInfo;
|
||||||
extern Partition EncryptedVirtualPartition;
|
extern Partition EncryptedVirtualPartition;
|
||||||
|
|
||||||
extern Partition ActivePartition;
|
extern Partition ActivePartition;
|
||||||
extern Partition PartitionFollowingActive;
|
extern Partition PartitionFollowingActive;
|
||||||
extern bool ExtraBootPartitionPresent;
|
extern bool ExtraBootPartitionPresent;
|
||||||
extern uint64 HiddenVolumeStartUnitNo;
|
extern uint64 PimValueOrHiddenVolumeStartUnitNo; // reuse this variable for stored PIM value to reduce memory usage
|
||||||
extern uint64 HiddenVolumeStartSector;
|
extern uint64 HiddenVolumeStartSector;
|
||||||
|
|
||||||
|
|
||||||
void ReadBootSectorUserConfiguration ();
|
void ReadBootSectorUserConfiguration ();
|
||||||
BiosResult UpdateBootSectorConfiguration (byte drive);
|
BiosResult UpdateBootSectorConfiguration (byte drive);
|
||||||
|
|
||||||
#endif // TC_HEADER_Boot_BootConfig
|
#endif // TC_HEADER_Boot_BootConfig
|
||||||
|
|||||||
+345
-339
@@ -1,339 +1,345 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Bios.h"
|
#include "Bios.h"
|
||||||
#include "BootConsoleIo.h"
|
#include "BootConsoleIo.h"
|
||||||
#include "BootDebug.h"
|
#include "BootDebug.h"
|
||||||
#include "BootStrings.h"
|
#include "BootStrings.h"
|
||||||
|
|
||||||
|
|
||||||
static int ScreenOutputDisabled = 0;
|
static int ScreenOutputDisabled = 0;
|
||||||
|
|
||||||
void DisableScreenOutput ()
|
void DisableScreenOutput ()
|
||||||
{
|
{
|
||||||
++ScreenOutputDisabled;
|
++ScreenOutputDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EnableScreenOutput ()
|
void EnableScreenOutput ()
|
||||||
{
|
{
|
||||||
--ScreenOutputDisabled;
|
--ScreenOutputDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintChar (char c)
|
void PrintChar (char c)
|
||||||
{
|
{
|
||||||
#ifdef TC_BOOT_TRACING_ENABLED
|
#ifdef TC_BOOT_TRACING_ENABLED
|
||||||
WriteDebugPort (c);
|
WriteDebugPort (c);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ScreenOutputDisabled)
|
if (ScreenOutputDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov bx, 7
|
mov bx, 7
|
||||||
mov al, c
|
mov al, c
|
||||||
mov ah, 0xe
|
mov ah, 0xe
|
||||||
int 0x10
|
int 0x10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintCharAtCursor (char c)
|
void PrintCharAtCursor (char c)
|
||||||
{
|
{
|
||||||
if (ScreenOutputDisabled)
|
if (ScreenOutputDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov bx, 7
|
mov bx, 7
|
||||||
mov al, c
|
mov al, c
|
||||||
mov cx, 1
|
mov cx, 1
|
||||||
mov ah, 0xa
|
mov ah, 0xa
|
||||||
int 0x10
|
int 0x10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Print (const char *str)
|
void Print (const char *str)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
while (c = *str++)
|
while (c = *str++)
|
||||||
PrintChar (c);
|
PrintChar (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Print (uint32 number)
|
void Print (uint32 number)
|
||||||
{
|
{
|
||||||
char str[12];
|
char str[12];
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
while (number >= 10)
|
while (number >= 10)
|
||||||
{
|
{
|
||||||
str[pos++] = (char) (number % 10) + '0';
|
str[pos++] = (char) (number % 10) + '0';
|
||||||
number /= 10;
|
number /= 10;
|
||||||
}
|
}
|
||||||
str[pos] = (char) (number % 10) + '0';
|
str[pos] = (char) (number % 10) + '0';
|
||||||
|
|
||||||
while (pos >= 0)
|
while (pos >= 0)
|
||||||
PrintChar (str[pos--]);
|
PrintChar (str[pos--]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Print (const uint64 &number)
|
void Print (const uint64 &number)
|
||||||
{
|
{
|
||||||
if (number.HighPart == 0)
|
if (number.HighPart == 0)
|
||||||
Print (number.LowPart);
|
Print (number.LowPart);
|
||||||
else
|
else
|
||||||
PrintHex (number);
|
PrintHex (number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintHex (byte b)
|
void PrintHex (byte b)
|
||||||
{
|
{
|
||||||
PrintChar (((b >> 4) >= 0xA ? 'A' - 0xA : '0') + (b >> 4));
|
PrintChar (((b >> 4) >= 0xA ? 'A' - 0xA : '0') + (b >> 4));
|
||||||
PrintChar (((b & 0xF) >= 0xA ? 'A' - 0xA : '0') + (b & 0xF));
|
PrintChar (((b & 0xF) >= 0xA ? 'A' - 0xA : '0') + (b & 0xF));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintHex (uint16 data)
|
void PrintHex (uint16 data)
|
||||||
{
|
{
|
||||||
PrintHex (byte (data >> 8));
|
PrintHex (byte (data >> 8));
|
||||||
PrintHex (byte (data));
|
PrintHex (byte (data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintHex (uint32 data)
|
void PrintHex (uint32 data)
|
||||||
{
|
{
|
||||||
PrintHex (uint16 (data >> 16));
|
PrintHex (uint16 (data >> 16));
|
||||||
PrintHex (uint16 (data));
|
PrintHex (uint16 (data));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintHex (const uint64 &data)
|
void PrintHex (const uint64 &data)
|
||||||
{
|
{
|
||||||
PrintHex (data.HighPart);
|
PrintHex (data.HighPart);
|
||||||
PrintHex (data.LowPart);
|
PrintHex (data.LowPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintRepeatedChar (char c, int n)
|
void PrintRepeatedChar (char c, int n)
|
||||||
{
|
{
|
||||||
while (n-- > 0)
|
while (n-- > 0)
|
||||||
PrintChar (c);
|
PrintChar (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintEndl ()
|
void PrintEndl ()
|
||||||
{
|
{
|
||||||
Print ("\r\n");
|
Print ("\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintEndl (int cnt)
|
void PrintEndl (int cnt)
|
||||||
{
|
{
|
||||||
while (cnt-- > 0)
|
while (cnt-- > 0)
|
||||||
PrintEndl ();
|
PrintEndl ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Beep ()
|
void Beep ()
|
||||||
{
|
{
|
||||||
PrintChar (7);
|
PrintChar (7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InitVideoMode ()
|
void InitVideoMode ()
|
||||||
{
|
{
|
||||||
if (ScreenOutputDisabled)
|
if (ScreenOutputDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
// Text mode 80x25
|
// Text mode 80x25
|
||||||
mov ax, 3
|
mov ax, 3
|
||||||
int 0x10
|
int 0x10
|
||||||
|
|
||||||
// Page 0
|
// Page 0
|
||||||
mov ax, 0x500
|
mov ax, 0x500
|
||||||
int 0x10
|
int 0x10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClearScreen ()
|
void ClearScreen ()
|
||||||
{
|
{
|
||||||
if (ScreenOutputDisabled)
|
if (ScreenOutputDisabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
// White text on black
|
// White text on black
|
||||||
mov bh, 7
|
mov bh, 7
|
||||||
xor cx, cx
|
xor cx, cx
|
||||||
mov dx, 0x184f
|
mov dx, 0x184f
|
||||||
mov ax, 0x600
|
mov ax, 0x600
|
||||||
int 0x10
|
int 0x10
|
||||||
|
|
||||||
// Cursor at 0,0
|
// Cursor at 0,0
|
||||||
xor bh, bh
|
xor bh, bh
|
||||||
xor dx, dx
|
xor dx, dx
|
||||||
mov ah, 2
|
mov ah, 2
|
||||||
int 0x10
|
int 0x10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintBackspace ()
|
void PrintBackspace ()
|
||||||
{
|
{
|
||||||
PrintChar (TC_BIOS_CHAR_BACKSPACE);
|
PrintChar (TC_BIOS_CHAR_BACKSPACE);
|
||||||
PrintCharAtCursor (' ');
|
PrintCharAtCursor (' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintError (const char *message)
|
void PrintError (const char *message)
|
||||||
{
|
{
|
||||||
Print (TC_BOOT_STR_ERROR);
|
Print (TC_BOOT_STR_ERROR);
|
||||||
Print (message);
|
Print (message);
|
||||||
PrintEndl();
|
PrintEndl();
|
||||||
Beep();
|
Beep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintErrorNoEndl (const char *message)
|
void PrintErrorNoEndl (const char *message)
|
||||||
{
|
{
|
||||||
Print (TC_BOOT_STR_ERROR);
|
Print (TC_BOOT_STR_ERROR);
|
||||||
Print (message);
|
Print (message);
|
||||||
Beep();
|
Beep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
byte GetShiftFlags ()
|
byte GetShiftFlags ()
|
||||||
{
|
{
|
||||||
byte flags;
|
byte flags;
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov ah, 2
|
mov ah, 2
|
||||||
int 0x16
|
int 0x16
|
||||||
mov flags, al
|
mov flags, al
|
||||||
}
|
}
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
byte GetKeyboardChar ()
|
byte GetKeyboardChar ()
|
||||||
{
|
{
|
||||||
return GetKeyboardChar (nullptr);
|
return GetKeyboardChar (nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
byte GetKeyboardChar (byte *scanCode)
|
byte GetKeyboardChar (byte *scanCode)
|
||||||
{
|
{
|
||||||
// Work around potential BIOS bugs (Windows boot manager polls the keystroke buffer)
|
// Work around potential BIOS bugs (Windows boot manager polls the keystroke buffer)
|
||||||
while (!IsKeyboardCharAvailable());
|
while (!IsKeyboardCharAvailable());
|
||||||
|
|
||||||
byte asciiCode;
|
byte asciiCode;
|
||||||
byte scan;
|
byte scan;
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov ah, 0
|
mov ah, 0
|
||||||
int 0x16
|
int 0x16
|
||||||
mov asciiCode, al
|
mov asciiCode, al
|
||||||
mov scan, ah
|
mov scan, ah
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scanCode)
|
if (scanCode)
|
||||||
*scanCode = scan;
|
*scanCode = scan;
|
||||||
|
|
||||||
return asciiCode;
|
return asciiCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool IsKeyboardCharAvailable ()
|
bool IsKeyboardCharAvailable ()
|
||||||
{
|
{
|
||||||
bool available = false;
|
bool available = false;
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov ah, 1
|
mov ah, 1
|
||||||
int 0x16
|
int 0x16
|
||||||
jz not_avail
|
jz not_avail
|
||||||
mov available, true
|
mov available, true
|
||||||
not_avail:
|
not_avail:
|
||||||
}
|
}
|
||||||
|
|
||||||
return available;
|
return available;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EscKeyPressed ()
|
bool EscKeyPressed ()
|
||||||
{
|
{
|
||||||
if (IsKeyboardCharAvailable ())
|
if (IsKeyboardCharAvailable ())
|
||||||
{
|
{
|
||||||
byte keyScanCode;
|
byte keyScanCode;
|
||||||
GetKeyboardChar (&keyScanCode);
|
GetKeyboardChar (&keyScanCode);
|
||||||
return keyScanCode == TC_BIOS_KEY_ESC;
|
return keyScanCode == TC_BIOS_KEY_ESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClearBiosKeystrokeBuffer ()
|
void ClearBiosKeystrokeBuffer ()
|
||||||
{
|
{
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
push es
|
push es
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
mov es, ax
|
mov es, ax
|
||||||
mov di, 0x41e
|
mov di, 0x41e
|
||||||
mov cx, 32
|
mov cx, 32
|
||||||
cld
|
cld
|
||||||
rep stosb
|
rep stosb
|
||||||
pop es
|
|
||||||
}
|
// reset position pointers at 0x41A and 0x41C to the begining
|
||||||
}
|
// of keyboard buffer to avoid revealing password/PIM length
|
||||||
|
mov ax, 0x001e
|
||||||
|
mov es:[0x41a], ax
|
||||||
bool IsPrintable (char c)
|
mov es:[0x41c], ax
|
||||||
{
|
pop es
|
||||||
return c >= ' ' && c <= '~';
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsDigit (char c)
|
|
||||||
{
|
bool IsPrintable (char c)
|
||||||
return c >= '0' && c <= '9';
|
{
|
||||||
}
|
return c >= ' ' && c <= '~';
|
||||||
|
}
|
||||||
|
|
||||||
int GetString (char *buffer, size_t bufferSize)
|
bool IsDigit (char c)
|
||||||
{
|
{
|
||||||
byte c;
|
return c >= '0' && c <= '9';
|
||||||
byte scanCode;
|
}
|
||||||
size_t pos = 0;
|
|
||||||
|
|
||||||
while (pos < bufferSize)
|
int GetString (char *buffer, size_t bufferSize)
|
||||||
{
|
{
|
||||||
c = GetKeyboardChar (&scanCode);
|
byte c;
|
||||||
|
byte scanCode;
|
||||||
if (scanCode == TC_BIOS_KEY_ENTER)
|
size_t pos = 0;
|
||||||
break;
|
|
||||||
|
while (pos < bufferSize)
|
||||||
if (scanCode == TC_BIOS_KEY_ESC)
|
{
|
||||||
return 0;
|
c = GetKeyboardChar (&scanCode);
|
||||||
|
|
||||||
buffer[pos++] = c;
|
if (scanCode == TC_BIOS_KEY_ENTER)
|
||||||
PrintChar (IsPrintable (c) ? c : ' ');
|
break;
|
||||||
}
|
|
||||||
|
if (scanCode == TC_BIOS_KEY_ESC)
|
||||||
return pos;
|
return 0;
|
||||||
}
|
|
||||||
|
buffer[pos++] = c;
|
||||||
|
PrintChar (IsPrintable (c) ? c : ' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,72 +1,72 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TC_HEADER_Boot_BootConsoleIo
|
#ifndef TC_HEADER_Boot_BootConsoleIo
|
||||||
#define TC_HEADER_Boot_BootConsoleIo
|
#define TC_HEADER_Boot_BootConsoleIo
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
#define TC_DEBUG_PORT 0
|
#define TC_DEBUG_PORT 0
|
||||||
|
|
||||||
#define TC_BIOS_KEY_ESC 1
|
#define TC_BIOS_KEY_ESC 1
|
||||||
#define TC_BIOS_KEY_BACKSPACE 14
|
#define TC_BIOS_KEY_BACKSPACE 14
|
||||||
#define TC_BIOS_KEY_ENTER 28
|
#define TC_BIOS_KEY_ENTER 28
|
||||||
#define TC_BIOS_KEY_F1 0x3b
|
#define TC_BIOS_KEY_F1 0x3b
|
||||||
#define TC_BIOS_KEY_F2 0x3c
|
#define TC_BIOS_KEY_F2 0x3c
|
||||||
#define TC_BIOS_KEY_F3 0x3d
|
#define TC_BIOS_KEY_F3 0x3d
|
||||||
#define TC_BIOS_KEY_F4 0x3e
|
#define TC_BIOS_KEY_F4 0x3e
|
||||||
#define TC_BIOS_KEY_F5 0x3f
|
#define TC_BIOS_KEY_F5 0x3f
|
||||||
#define TC_BIOS_KEY_F6 0x40
|
#define TC_BIOS_KEY_F6 0x40
|
||||||
#define TC_BIOS_KEY_F7 0x41
|
#define TC_BIOS_KEY_F7 0x41
|
||||||
#define TC_BIOS_KEY_F8 0x42
|
#define TC_BIOS_KEY_F8 0x42
|
||||||
#define TC_BIOS_KEY_F9 0x43
|
#define TC_BIOS_KEY_F9 0x43
|
||||||
#define TC_BIOS_KEY_F10 0x44
|
#define TC_BIOS_KEY_F10 0x44
|
||||||
|
|
||||||
#define TC_BIOS_SHIFTMASK_CAPSLOCK (1 << 6)
|
#define TC_BIOS_SHIFTMASK_CAPSLOCK (1 << 6)
|
||||||
#define TC_BIOS_SHIFTMASK_LSHIFT (1 << 1)
|
#define TC_BIOS_SHIFTMASK_LSHIFT (1 << 1)
|
||||||
#define TC_BIOS_SHIFTMASK_RSHIFT (1 << 0)
|
#define TC_BIOS_SHIFTMASK_RSHIFT (1 << 0)
|
||||||
|
|
||||||
#define TC_BIOS_CHAR_BACKSPACE 8
|
#define TC_BIOS_CHAR_BACKSPACE 8
|
||||||
|
|
||||||
#define TC_BIOS_MAX_CHARS_PER_LINE 80
|
#define TC_BIOS_MAX_CHARS_PER_LINE 80
|
||||||
|
|
||||||
void Beep ();
|
void Beep ();
|
||||||
void ClearBiosKeystrokeBuffer ();
|
void ClearBiosKeystrokeBuffer ();
|
||||||
void ClearScreen ();
|
void ClearScreen ();
|
||||||
void DisableScreenOutput ();
|
void DisableScreenOutput ();
|
||||||
void EnableScreenOutput ();
|
void EnableScreenOutput ();
|
||||||
bool EscKeyPressed ();
|
bool EscKeyPressed ();
|
||||||
byte GetKeyboardChar ();
|
byte GetKeyboardChar ();
|
||||||
byte GetKeyboardChar (byte *scanCode);
|
byte GetKeyboardChar (byte *scanCode);
|
||||||
byte GetShiftFlags ();
|
byte GetShiftFlags ();
|
||||||
int GetString (char *buffer, size_t bufferSize);
|
int GetString (char *buffer, size_t bufferSize);
|
||||||
void InitVideoMode ();
|
void InitVideoMode ();
|
||||||
bool IsKeyboardCharAvailable ();
|
bool IsKeyboardCharAvailable ();
|
||||||
bool IsPrintable (char c);
|
bool IsPrintable (char c);
|
||||||
bool IsDigit (char c);
|
bool IsDigit (char c);
|
||||||
void Print (const char *str);
|
void Print (const char *str);
|
||||||
void Print (uint32 number);
|
void Print (uint32 number);
|
||||||
void Print (const uint64 &number);
|
void Print (const uint64 &number);
|
||||||
void PrintBackspace ();
|
void PrintBackspace ();
|
||||||
void PrintChar (char c);
|
void PrintChar (char c);
|
||||||
void PrintCharAtCursor (char c);
|
void PrintCharAtCursor (char c);
|
||||||
void PrintEndl ();
|
void PrintEndl ();
|
||||||
void PrintEndl (int cnt);
|
void PrintEndl (int cnt);
|
||||||
void PrintRepeatedChar (char c, int n);
|
void PrintRepeatedChar (char c, int n);
|
||||||
void PrintError (const char *message);
|
void PrintError (const char *message);
|
||||||
void PrintErrorNoEndl (const char *message);
|
void PrintErrorNoEndl (const char *message);
|
||||||
void PrintHex (byte b);
|
void PrintHex (byte b);
|
||||||
void PrintHex (uint16 data);
|
void PrintHex (uint16 data);
|
||||||
void PrintHex (uint32 data);
|
void PrintHex (uint32 data);
|
||||||
void PrintHex (const uint64 &data);
|
void PrintHex (const uint64 &data);
|
||||||
|
|
||||||
#endif // TC_HEADER_Boot_BootConsoleIo
|
#endif // TC_HEADER_Boot_BootConsoleIo
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
;
|
;
|
||||||
; Derived from source code of TrueCrypt 7.1a, which is
|
; Derived from source code of TrueCrypt 7.1a, which is
|
||||||
; Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
; Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
; by the TrueCrypt License 3.0.
|
; by the TrueCrypt License 3.0.
|
||||||
;
|
;
|
||||||
; Modifications and additions to the original source code (contained in this file)
|
; Modifications and additions to the original source code (contained in this file)
|
||||||
; and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
; and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
; and are governed by the Apache License 2.0 the full text of which is
|
; and are governed by the Apache License 2.0 the full text of which is
|
||||||
; contained in the file License.txt included in VeraCrypt binary and source
|
; contained in the file License.txt included in VeraCrypt binary and source
|
||||||
; code distribution packages.
|
; code distribution packages.
|
||||||
;
|
;
|
||||||
|
|
||||||
.MODEL tiny, C
|
.MODEL tiny, C
|
||||||
.386
|
.386
|
||||||
|
|
||||||
INCLUDE BootDefs.i
|
INCLUDE BootDefs.i
|
||||||
|
|
||||||
EXTERNDEF main:NEAR
|
EXTERNDEF main:NEAR
|
||||||
|
|
||||||
_TEXT SEGMENT
|
_TEXT SEGMENT
|
||||||
ORG TC_COM_EXECUTABLE_OFFSET
|
ORG TC_COM_EXECUTABLE_OFFSET
|
||||||
|
|
||||||
start:
|
start:
|
||||||
jmp main
|
jmp main
|
||||||
|
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
END start
|
END start
|
||||||
|
|||||||
+181
-181
@@ -1,181 +1,181 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Bios.h"
|
#include "Bios.h"
|
||||||
#include "BootConsoleIo.h"
|
#include "BootConsoleIo.h"
|
||||||
#include "BootDefs.h"
|
#include "BootDefs.h"
|
||||||
#include "BootDiskIo.h"
|
#include "BootDiskIo.h"
|
||||||
#include "BootDebug.h"
|
#include "BootDebug.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef TC_BOOT_TRACING_ENABLED
|
#ifdef TC_BOOT_TRACING_ENABLED
|
||||||
|
|
||||||
void InitDebugPort ()
|
void InitDebugPort ()
|
||||||
{
|
{
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov dx, TC_DEBUG_PORT
|
mov dx, TC_DEBUG_PORT
|
||||||
mov ah, 1
|
mov ah, 1
|
||||||
int 0x17
|
int 0x17
|
||||||
mov dx, TC_DEBUG_PORT
|
mov dx, TC_DEBUG_PORT
|
||||||
mov ah, 0xe2
|
mov ah, 0xe2
|
||||||
int 0x17
|
int 0x17
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WriteDebugPort (byte dataByte)
|
void WriteDebugPort (byte dataByte)
|
||||||
{
|
{
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov al, dataByte
|
mov al, dataByte
|
||||||
mov dx, TC_DEBUG_PORT
|
mov dx, TC_DEBUG_PORT
|
||||||
mov ah, 0
|
mov ah, 0
|
||||||
int 0x17
|
int 0x17
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TC_BOOT_TRACING_ENABLED
|
#endif // TC_BOOT_TRACING_ENABLED
|
||||||
|
|
||||||
|
|
||||||
#ifdef TC_BOOT_DEBUG_ENABLED
|
#ifdef TC_BOOT_DEBUG_ENABLED
|
||||||
|
|
||||||
extern "C" void PrintDebug (uint32 debugVal)
|
extern "C" void PrintDebug (uint32 debugVal)
|
||||||
{
|
{
|
||||||
Print (debugVal);
|
Print (debugVal);
|
||||||
PrintEndl();
|
PrintEndl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintVal (const char *message, const uint32 value, bool newLine, bool hex)
|
void PrintVal (const char *message, const uint32 value, bool newLine, bool hex)
|
||||||
{
|
{
|
||||||
Print (message);
|
Print (message);
|
||||||
Print (": ");
|
Print (": ");
|
||||||
|
|
||||||
if (hex)
|
if (hex)
|
||||||
PrintHex (value);
|
PrintHex (value);
|
||||||
else
|
else
|
||||||
Print (value);
|
Print (value);
|
||||||
|
|
||||||
if (newLine)
|
if (newLine)
|
||||||
PrintEndl();
|
PrintEndl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintVal (const char *message, const uint64 &value, bool newLine, bool hex)
|
void PrintVal (const char *message, const uint64 &value, bool newLine, bool hex)
|
||||||
{
|
{
|
||||||
Print (message);
|
Print (message);
|
||||||
Print (": ");
|
Print (": ");
|
||||||
PrintHex (value);
|
PrintHex (value);
|
||||||
if (newLine)
|
if (newLine)
|
||||||
PrintEndl();
|
PrintEndl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintHexDump (byte *mem, size_t size, uint16 *memSegment)
|
void PrintHexDump (byte *mem, size_t size, uint16 *memSegment)
|
||||||
{
|
{
|
||||||
const size_t width = 16;
|
const size_t width = 16;
|
||||||
for (size_t pos = 0; pos < size; )
|
for (size_t pos = 0; pos < size; )
|
||||||
{
|
{
|
||||||
for (int pass = 1; pass <= 2; ++pass)
|
for (int pass = 1; pass <= 2; ++pass)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < width && pos < size; ++i)
|
for (i = 0; i < width && pos < size; ++i)
|
||||||
{
|
{
|
||||||
byte dataByte;
|
byte dataByte;
|
||||||
if (memSegment)
|
if (memSegment)
|
||||||
{
|
{
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
push es
|
push es
|
||||||
mov si, ss:memSegment
|
mov si, ss:memSegment
|
||||||
mov es, ss:[si]
|
mov es, ss:[si]
|
||||||
mov si, ss:mem
|
mov si, ss:mem
|
||||||
add si, pos
|
add si, pos
|
||||||
mov al, es:[si]
|
mov al, es:[si]
|
||||||
mov dataByte, al
|
mov dataByte, al
|
||||||
pop es
|
pop es
|
||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dataByte = mem[pos++];
|
dataByte = mem[pos++];
|
||||||
|
|
||||||
if (pass == 1)
|
if (pass == 1)
|
||||||
{
|
{
|
||||||
PrintHex (dataByte);
|
PrintHex (dataByte);
|
||||||
PrintChar (' ');
|
PrintChar (' ');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
PrintChar (IsPrintable (dataByte) ? dataByte : '.');
|
PrintChar (IsPrintable (dataByte) ? dataByte : '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pass == 1)
|
if (pass == 1)
|
||||||
{
|
{
|
||||||
pos -= i;
|
pos -= i;
|
||||||
PrintChar (' ');
|
PrintChar (' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintEndl ();
|
PrintEndl ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintHexDump (uint16 memSegment, uint16 memOffset, size_t size)
|
void PrintHexDump (uint16 memSegment, uint16 memOffset, size_t size)
|
||||||
{
|
{
|
||||||
PrintHexDump ((byte *) memOffset, size, &memSegment);
|
PrintHexDump ((byte *) memOffset, size, &memSegment);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TC_BOOT_DEBUG_ENABLED
|
#endif // TC_BOOT_DEBUG_ENABLED
|
||||||
|
|
||||||
|
|
||||||
#ifdef TC_BOOT_STACK_CHECKING_ENABLED
|
#ifdef TC_BOOT_STACK_CHECKING_ENABLED
|
||||||
|
|
||||||
extern "C" char end[];
|
extern "C" char end[];
|
||||||
|
|
||||||
static void PrintStackInfo ()
|
static void PrintStackInfo ()
|
||||||
{
|
{
|
||||||
uint16 spReg;
|
uint16 spReg;
|
||||||
__asm mov spReg, sp
|
__asm mov spReg, sp
|
||||||
|
|
||||||
Print ("Stack: "); Print (TC_BOOT_LOADER_STACK_TOP - spReg);
|
Print ("Stack: "); Print (TC_BOOT_LOADER_STACK_TOP - spReg);
|
||||||
Print ("/"); Print (TC_BOOT_LOADER_STACK_TOP - (uint16) end);
|
Print ("/"); Print (TC_BOOT_LOADER_STACK_TOP - (uint16) end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CheckStack ()
|
void CheckStack ()
|
||||||
{
|
{
|
||||||
uint16 spReg;
|
uint16 spReg;
|
||||||
__asm mov spReg, sp
|
__asm mov spReg, sp
|
||||||
|
|
||||||
if (*(uint32 *) end != 0x12345678UL || spReg < (uint16) end)
|
if (*(uint32 *) end != 0x12345678UL || spReg < (uint16) end)
|
||||||
{
|
{
|
||||||
__asm cli
|
__asm cli
|
||||||
__asm mov sp, TC_BOOT_LOADER_STACK_TOP
|
__asm mov sp, TC_BOOT_LOADER_STACK_TOP
|
||||||
|
|
||||||
PrintError ("Stack overflow");
|
PrintError ("Stack overflow");
|
||||||
TC_THROW_FATAL_EXCEPTION;
|
TC_THROW_FATAL_EXCEPTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InitStackChecker ()
|
void InitStackChecker ()
|
||||||
{
|
{
|
||||||
*(uint32 *) end = 0x12345678UL;
|
*(uint32 *) end = 0x12345678UL;
|
||||||
|
|
||||||
PrintStackInfo();
|
PrintStackInfo();
|
||||||
PrintEndl();
|
PrintEndl();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TC_BOOT_STACK_CHECKING_ENABLED
|
#endif // TC_BOOT_STACK_CHECKING_ENABLED
|
||||||
|
|||||||
@@ -1,60 +1,60 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TC_HEADER_Boot_BootDebug
|
#ifndef TC_HEADER_Boot_BootDebug
|
||||||
#define TC_HEADER_Boot_BootDebug
|
#define TC_HEADER_Boot_BootDebug
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "BootConsoleIo.h"
|
#include "BootConsoleIo.h"
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
# define TC_BOOT_DEBUG_ENABLED
|
# define TC_BOOT_DEBUG_ENABLED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 || defined (TC_BOOT_DEBUG_ENABLED)
|
#if 0 || defined (TC_BOOT_DEBUG_ENABLED)
|
||||||
# define TC_BOOT_STACK_CHECKING_ENABLED
|
# define TC_BOOT_STACK_CHECKING_ENABLED
|
||||||
extern "C" void CheckStack ();
|
extern "C" void CheckStack ();
|
||||||
#else
|
#else
|
||||||
# define CheckStack()
|
# define CheckStack()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
# define TC_BOOT_TRACING_ENABLED
|
# define TC_BOOT_TRACING_ENABLED
|
||||||
# if 1
|
# if 1
|
||||||
# define TC_TRACE_INT13
|
# define TC_TRACE_INT13
|
||||||
# endif
|
# endif
|
||||||
# if 0
|
# if 0
|
||||||
# define TC_TRACE_INT15
|
# define TC_TRACE_INT15
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TC_BOOT_DEBUG_ENABLED
|
#ifdef TC_BOOT_DEBUG_ENABLED
|
||||||
# define trace_point do { Print(__FILE__); PrintChar (':'); Print (TC_TO_STRING (__LINE__)); PrintEndl(); } while (false)
|
# define trace_point do { Print(__FILE__); PrintChar (':'); Print (TC_TO_STRING (__LINE__)); PrintEndl(); } while (false)
|
||||||
# define trace_val(VAL) PrintVal (#VAL, VAL);
|
# define trace_val(VAL) PrintVal (#VAL, VAL);
|
||||||
# define trace_hex(VAL) do { Print (#VAL), PrintChar (':'); PrintHex (VAL); PrintEndl(); } while (false)
|
# 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)
|
# define assert(COND) do { if (!(COND)) { trace_point; __asm jmp $ } } while (false)
|
||||||
#else
|
#else
|
||||||
# define trace_point
|
# define trace_point
|
||||||
# define trace_val(VAL)
|
# define trace_val(VAL)
|
||||||
# define trace_hex(VAL)
|
# define trace_hex(VAL)
|
||||||
# define assert(COND)
|
# define assert(COND)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void InitDebugPort ();
|
void InitDebugPort ();
|
||||||
void InitStackChecker ();
|
void InitStackChecker ();
|
||||||
void WriteDebugPort (byte dataByte);
|
void WriteDebugPort (byte dataByte);
|
||||||
void PrintHexDump (byte *mem, size_t size, uint16 *memSegment = nullptr);
|
void PrintHexDump (byte *mem, size_t size, uint16 *memSegment = nullptr);
|
||||||
void PrintHexDump (uint16 memSegment, uint16 memOffset, size_t size);
|
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 uint32 value, bool newLine = true, bool hex = false);
|
||||||
void PrintVal (const char *message, const uint64 &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
|
#endif // TC_HEADER_Boot_BootDebug
|
||||||
|
|||||||
+210
-196
@@ -1,196 +1,210 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TC_HEADER_Boot_BootDefs
|
#ifndef TC_HEADER_Boot_BootDefs
|
||||||
#define TC_HEADER_Boot_BootDefs
|
#define TC_HEADER_Boot_BootDefs
|
||||||
|
|
||||||
// Total memory required (CODE + DATA + BSS + STACK + 0x100) in KBytes - determined from linker map.
|
// 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 43
|
||||||
#define TC__BOOT_MEMORY_REQUIRED 44
|
|
||||||
#else
|
#ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
|
||||||
#define TC__BOOT_MEMORY_REQUIRED 42
|
# undef TC__BOOT_MEMORY_REQUIRED
|
||||||
#endif
|
|
||||||
|
# ifdef TC_WINDOWS_BOOT_AES
|
||||||
#ifdef TC_WINDOWS_BOOT_SINGLE_CIPHER_MODE
|
# ifdef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
|
||||||
# undef TC__BOOT_MEMORY_REQUIRED
|
# define TC__BOOT_MEMORY_REQUIRED 31
|
||||||
|
# else
|
||||||
# ifdef TC_WINDOWS_BOOT_AES
|
# define TC__BOOT_MEMORY_REQUIRED 29
|
||||||
# ifdef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
|
# endif
|
||||||
# define TC__BOOT_MEMORY_REQUIRED 30
|
# elif defined (TC_WINDOWS_BOOT_SERPENT)
|
||||||
# else
|
# define TC__BOOT_MEMORY_REQUIRED 33
|
||||||
# define TC__BOOT_MEMORY_REQUIRED 28
|
# elif defined (TC_WINDOWS_BOOT_TWOFISH)
|
||||||
# endif
|
# define TC__BOOT_MEMORY_REQUIRED 41
|
||||||
# elif defined (TC_WINDOWS_BOOT_SERPENT)
|
# elif defined (TC_WINDOWS_BOOT_CAMELLIA)
|
||||||
# define TC__BOOT_MEMORY_REQUIRED 32
|
# define TC__BOOT_MEMORY_REQUIRED 31
|
||||||
# elif defined (TC_WINDOWS_BOOT_TWOFISH)
|
# endif
|
||||||
# define TC__BOOT_MEMORY_REQUIRED 40
|
|
||||||
# endif
|
#if 0
|
||||||
|
# undef TC__BOOT_MEMORY_REQUIRED
|
||||||
#if 0
|
# define TC__BOOT_MEMORY_REQUIRED 60
|
||||||
# undef TC__BOOT_MEMORY_REQUIRED
|
#endif
|
||||||
# define TC__BOOT_MEMORY_REQUIRED 60
|
|
||||||
#endif
|
#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
|
||||||
// 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)
|
||||||
#if TC__BOOT_MEMORY_REQUIRED <= 32
|
#else
|
||||||
# define TC__BOOT_LOADER_SEGMENT_LOW (TC__BOOT_LOADER_SEGMENT - 32 * 1024 / 16)
|
# define TC__BOOT_LOADER_SEGMENT_LOW (TC__BOOT_LOADER_SEGMENT - 64 * 1024 / 16)
|
||||||
#else
|
#endif
|
||||||
# define TC__BOOT_LOADER_SEGMENT_LOW (TC__BOOT_LOADER_SEGMENT - 64 * 1024 / 16)
|
|
||||||
#endif
|
#define TC__COM_EXECUTABLE_OFFSET TC_HEX (100)
|
||||||
|
|
||||||
#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_LOWMEM_SEGMENT TC_HEX (2000)
|
#define TC__BOOT_LOADER_ALT_SEGMENT TC_HEX (6000)
|
||||||
#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__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__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_VERSION_OFFSET 430
|
#define TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET 434
|
||||||
#define TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET 432
|
#define TC__BOOT_SECTOR_USER_CONFIG_OFFSET 438
|
||||||
#define TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET 434
|
#define TC__BOOT_SECTOR_CONFIG_OFFSET 439 // The last byte that is reserved for the boot loader
|
||||||
#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_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_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_START_SECTOR 2
|
||||||
#define TC__BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE 32768
|
#define TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT 4
|
||||||
#define TC__BOOT_LOADER_COMPRESSED_BUFFER_OFFSET (TC_COM_EXECUTABLE_OFFSET + 3072)
|
#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__BOOT_LOADER_START_SECTOR (TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR + TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT)
|
||||||
#define TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE ((TC_BOOT_LOADER_AREA_SECTOR_COUNT - 2) * TC_LB_SIZE)
|
#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__BOOT_LOADER_BACKUP_SECTOR_COUNT 30
|
||||||
#define TC__GZIP_HEADER_SIZE 10
|
|
||||||
|
#define TC__GZIP_HEADER_SIZE 10
|
||||||
#define TC__BOOT_CFG_FLAG_AREA_SIZE 1 // In bytes
|
|
||||||
|
#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)
|
// If you add more flags, revise TC__BOOT_CFG_FLAG_AREA_SIZE
|
||||||
#define TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER TC_HEX (04)
|
#define TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE TC_HEX (02)
|
||||||
#define TC__BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION TC_HEX (10)
|
#define TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER TC_HEX (04)
|
||||||
#define TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER TC_HEX (20)
|
#define TC__BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION TC_HEX (10)
|
||||||
#define TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE (TC_HEX (40) + TC_HEX (80))
|
#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)
|
// Modifying the following values can introduce incompatibility with previous versions
|
||||||
#define TC__BOOT_USER_CFG_FLAG_DISABLE_ESC TC_HEX (02)
|
#define TC__BOOT_USER_CFG_FLAG_SILENT_MODE TC_HEX (01)
|
||||||
#define TC__BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION TC_HEX (04)
|
#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__BOOT_USER_CFG_FLAG_DISABLE_PIM TC_HEX (08)
|
||||||
#define TC__HIDDEN_OS_CREATION_PHASE_NONE 0
|
#define TC__BOOT_USER_CFG_FLAG_STORE_HASH TC_HEX (10)
|
||||||
#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.
|
// 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_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.
|
#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.
|
||||||
#ifdef TC_ASM_PREPROCESS
|
#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.
|
||||||
|
|
||||||
#define TC_HEX(N) 0##N##h
|
|
||||||
#define TC_UNSIGNED(N) N
|
#ifdef TC_ASM_PREPROCESS
|
||||||
|
|
||||||
TC_BOOT_MEMORY_REQUIRED = TC__BOOT_MEMORY_REQUIRED
|
#define TC_HEX(N) 0##N##h
|
||||||
TC_BOOT_LOADER_SEGMENT = TC__BOOT_LOADER_SEGMENT
|
#define TC_UNSIGNED(N) N
|
||||||
TC_BOOT_LOADER_SEGMENT_LOW = TC__BOOT_LOADER_SEGMENT_LOW
|
|
||||||
TC_COM_EXECUTABLE_OFFSET = TC__COM_EXECUTABLE_OFFSET
|
TC_BOOT_MEMORY_REQUIRED = TC__BOOT_MEMORY_REQUIRED
|
||||||
TC_BOOT_LOADER_LOWMEM_SEGMENT = TC__BOOT_LOADER_LOWMEM_SEGMENT
|
TC_BOOT_LOADER_SEGMENT = TC__BOOT_LOADER_SEGMENT
|
||||||
TC_BOOT_LOADER_BUFFER_SEGMENT = TC__BOOT_LOADER_BUFFER_SEGMENT
|
TC_BOOT_LOADER_SEGMENT_LOW = TC__BOOT_LOADER_SEGMENT_LOW
|
||||||
TC_BOOT_LOADER_ALT_SEGMENT = TC__BOOT_LOADER_ALT_SEGMENT
|
TC_COM_EXECUTABLE_OFFSET = TC__COM_EXECUTABLE_OFFSET
|
||||||
TC_BOOT_LOADER_STACK_TOP = TC__BOOT_LOADER_STACK_TOP
|
TC_BOOT_LOADER_LOWMEM_SEGMENT = TC__BOOT_LOADER_LOWMEM_SEGMENT
|
||||||
TC_LB_SIZE = TC__LB_SIZE
|
TC_BOOT_LOADER_BUFFER_SEGMENT = TC__BOOT_LOADER_BUFFER_SEGMENT
|
||||||
TC_BOOT_LOADER_AREA_SECTOR_COUNT = TC__BOOT_LOADER_AREA_SECTOR_COUNT
|
TC_BOOT_LOADER_ALT_SEGMENT = TC__BOOT_LOADER_ALT_SEGMENT
|
||||||
TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET = TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET
|
TC_BOOT_LOADER_STACK_TOP = TC__BOOT_LOADER_STACK_TOP
|
||||||
TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET = TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET
|
TC_LB_SIZE = TC__LB_SIZE
|
||||||
TC_BOOT_SECTOR_CONFIG_OFFSET = TC__BOOT_SECTOR_CONFIG_OFFSET
|
TC_BOOT_LOADER_AREA_SECTOR_COUNT = TC__BOOT_LOADER_AREA_SECTOR_COUNT
|
||||||
TC_BOOT_SECTOR_USER_CONFIG_OFFSET = TC__BOOT_SECTOR_USER_CONFIG_OFFSET
|
TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET = TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET
|
||||||
TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR = TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR
|
TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET = TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET
|
||||||
TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT = TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
|
TC_BOOT_SECTOR_CONFIG_OFFSET = TC__BOOT_SECTOR_CONFIG_OFFSET
|
||||||
TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE = TC__BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE
|
TC_BOOT_SECTOR_USER_CONFIG_OFFSET = TC__BOOT_SECTOR_USER_CONFIG_OFFSET
|
||||||
TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET = TC__BOOT_LOADER_COMPRESSED_BUFFER_OFFSET
|
TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR = TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR
|
||||||
TC_BOOT_LOADER_START_SECTOR = TC__BOOT_LOADER_START_SECTOR
|
TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT = TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
|
||||||
TC_MAX_BOOT_LOADER_SECTOR_COUNT = TC__MAX_BOOT_LOADER_SECTOR_COUNT
|
TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE = TC__BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE
|
||||||
TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE = TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE
|
TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET = TC__BOOT_LOADER_COMPRESSED_BUFFER_OFFSET
|
||||||
TC_BOOT_LOADER_BACKUP_SECTOR_COUNT = TC__BOOT_LOADER_BACKUP_SECTOR_COUNT
|
TC_BOOT_LOADER_START_SECTOR = TC__BOOT_LOADER_START_SECTOR
|
||||||
TC_GZIP_HEADER_SIZE = TC__GZIP_HEADER_SIZE
|
TC_MAX_BOOT_LOADER_SECTOR_COUNT = TC__MAX_BOOT_LOADER_SECTOR_COUNT
|
||||||
TC_BOOT_CFG_FLAG_AREA_SIZE = TC__BOOT_CFG_FLAG_AREA_SIZE
|
TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE = TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE
|
||||||
TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE = TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE
|
TC_BOOT_LOADER_BACKUP_SECTOR_COUNT = TC__BOOT_LOADER_BACKUP_SECTOR_COUNT
|
||||||
TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER = TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER
|
TC_GZIP_HEADER_SIZE = TC__GZIP_HEADER_SIZE
|
||||||
TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER = TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER
|
TC_BOOT_CFG_FLAG_AREA_SIZE = TC__BOOT_CFG_FLAG_AREA_SIZE
|
||||||
TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE = TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE
|
TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE = TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE
|
||||||
TC_BOOT_USER_CFG_FLAG_SILENT_MODE = TC__BOOT_USER_CFG_FLAG_SILENT_MODE
|
TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER = TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER
|
||||||
TC_HIDDEN_OS_CREATION_PHASE_NONE = TC__HIDDEN_OS_CREATION_PHASE_NONE
|
TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER = TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER
|
||||||
TC_HIDDEN_OS_CREATION_PHASE_CLONING = TC__HIDDEN_OS_CREATION_PHASE_CLONING
|
TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE = TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE
|
||||||
TC_HIDDEN_OS_CREATION_PHASE_WIPING = TC__HIDDEN_OS_CREATION_PHASE_WIPING
|
TC_BOOT_USER_CFG_FLAG_SILENT_MODE = TC__BOOT_USER_CFG_FLAG_SILENT_MODE
|
||||||
TC_HIDDEN_OS_CREATION_PHASE_WIPED = TC__HIDDEN_OS_CREATION_PHASE_WIPED
|
TC_HIDDEN_OS_CREATION_PHASE_NONE = TC__HIDDEN_OS_CREATION_PHASE_NONE
|
||||||
|
TC_HIDDEN_OS_CREATION_PHASE_CLONING = TC__HIDDEN_OS_CREATION_PHASE_CLONING
|
||||||
#else // TC_ASM_PREPROCESS
|
TC_HIDDEN_OS_CREATION_PHASE_WIPING = TC__HIDDEN_OS_CREATION_PHASE_WIPING
|
||||||
|
TC_HIDDEN_OS_CREATION_PHASE_WIPED = TC__HIDDEN_OS_CREATION_PHASE_WIPED
|
||||||
#define TC_HEX(N) 0x##N
|
|
||||||
#define TC_UNSIGNED(N) N##U
|
#else // TC_ASM_PREPROCESS
|
||||||
|
|
||||||
#define TC_BOOT_MEMORY_REQUIRED TC__BOOT_MEMORY_REQUIRED
|
#define TC_HEX(N) 0x##N
|
||||||
#define TC_BOOT_LOADER_SEGMENT TC__BOOT_LOADER_SEGMENT
|
#define TC_UNSIGNED(N) N##U
|
||||||
#define TC_COM_EXECUTABLE_OFFSET TC__COM_EXECUTABLE_OFFSET
|
|
||||||
#define TC_BOOT_LOADER_LOWMEM_SEGMENT TC__BOOT_LOADER_LOWMEM_SEGMENT
|
#define TC_BOOT_MEMORY_REQUIRED TC__BOOT_MEMORY_REQUIRED
|
||||||
#define TC_BOOT_LOADER_BUFFER_SEGMENT TC__BOOT_LOADER_BUFFER_SEGMENT
|
#define TC_BOOT_LOADER_SEGMENT TC__BOOT_LOADER_SEGMENT
|
||||||
#define TC_BOOT_LOADER_ALT_SEGMENT TC__BOOT_LOADER_ALT_SEGMENT
|
#define TC_COM_EXECUTABLE_OFFSET TC__COM_EXECUTABLE_OFFSET
|
||||||
#define TC_BOOT_LOADER_STACK_TOP (TC__BOOT_LOADER_STACK_TOP)
|
#define TC_BOOT_LOADER_LOWMEM_SEGMENT TC__BOOT_LOADER_LOWMEM_SEGMENT
|
||||||
#define TC_BOOT_LOADER_AREA_SECTOR_COUNT TC__BOOT_LOADER_AREA_SECTOR_COUNT
|
#define TC_BOOT_LOADER_BUFFER_SEGMENT TC__BOOT_LOADER_BUFFER_SEGMENT
|
||||||
#define TC_BOOT_SECTOR_USER_MESSAGE_OFFSET TC__BOOT_SECTOR_USER_MESSAGE_OFFSET
|
#define TC_BOOT_LOADER_ALT_SEGMENT TC__BOOT_LOADER_ALT_SEGMENT
|
||||||
#define TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE
|
#define TC_BOOT_LOADER_STACK_TOP (TC__BOOT_LOADER_STACK_TOP)
|
||||||
#define TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET
|
#define TC_BOOT_LOADER_AREA_SECTOR_COUNT TC__BOOT_LOADER_AREA_SECTOR_COUNT
|
||||||
#define TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH TC__BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH
|
#define TC_BOOT_SECTOR_USER_MESSAGE_OFFSET TC__BOOT_SECTOR_USER_MESSAGE_OFFSET
|
||||||
#define TC_BOOT_SECTOR_VERSION_OFFSET TC__BOOT_SECTOR_VERSION_OFFSET
|
#define TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_SIZE
|
||||||
#define TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET
|
#define TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET TC__BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET
|
||||||
#define TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET
|
#define TC_BOOT_SECTOR_PIM_VALUE_SIZE TC__BOOT_SECTOR_PIM_VALUE_SIZE
|
||||||
#define TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR
|
#define TC_BOOT_SECTOR_PIM_VALUE_OFFSET TC__BOOT_SECTOR_PIM_VALUE_OFFSET
|
||||||
#define TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
|
#define TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH TC__BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH
|
||||||
#define TC_BOOT_SECTOR_CONFIG_OFFSET TC__BOOT_SECTOR_CONFIG_OFFSET
|
#define TC_BOOT_SECTOR_VERSION_OFFSET TC__BOOT_SECTOR_VERSION_OFFSET
|
||||||
#define TC_BOOT_SECTOR_USER_CONFIG_OFFSET TC__BOOT_SECTOR_USER_CONFIG_OFFSET
|
#define TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET TC__BOOT_SECTOR_LOADER_LENGTH_OFFSET
|
||||||
#define TC_BOOT_LOADER_START_SECTOR TC__BOOT_LOADER_START_SECTOR
|
#define TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET TC__BOOT_SECTOR_LOADER_CHECKSUM_OFFSET
|
||||||
#define TC_LB_SIZE TC__LB_SIZE
|
#define TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR TC__BOOT_LOADER_DECOMPRESSOR_START_SECTOR
|
||||||
#define TC_MAX_BOOT_LOADER_SECTOR_COUNT TC__MAX_BOOT_LOADER_SECTOR_COUNT
|
#define TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT TC__BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
|
||||||
#define TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE
|
#define TC_BOOT_SECTOR_CONFIG_OFFSET TC__BOOT_SECTOR_CONFIG_OFFSET
|
||||||
#define TC_BOOT_LOADER_BACKUP_SECTOR_COUNT TC__BOOT_LOADER_BACKUP_SECTOR_COUNT
|
#define TC_BOOT_SECTOR_USER_CONFIG_OFFSET TC__BOOT_SECTOR_USER_CONFIG_OFFSET
|
||||||
#define TC_GZIP_HEADER_SIZE TC__GZIP_HEADER_SIZE
|
#define TC_BOOT_LOADER_START_SECTOR TC__BOOT_LOADER_START_SECTOR
|
||||||
#define TC_BOOT_CFG_FLAG_AREA_SIZE TC__BOOT_CFG_FLAG_AREA_SIZE
|
#define TC_LB_SIZE TC__LB_SIZE
|
||||||
#define TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE
|
#define TC_MAX_BOOT_LOADER_SECTOR_COUNT TC__MAX_BOOT_LOADER_SECTOR_COUNT
|
||||||
#define TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER
|
#define TC_MAX_BOOT_LOADER_DECOMPRESSED_SIZE TC__MAX_BOOT_LOADER_DECOMPRESSED_SIZE
|
||||||
#define TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER
|
#define TC_BOOT_LOADER_BACKUP_SECTOR_COUNT TC__BOOT_LOADER_BACKUP_SECTOR_COUNT
|
||||||
#define TC_BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION TC__BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION
|
#define TC_GZIP_HEADER_SIZE TC__GZIP_HEADER_SIZE
|
||||||
#define TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE
|
#define TC_BOOT_CFG_FLAG_AREA_SIZE TC__BOOT_CFG_FLAG_AREA_SIZE
|
||||||
#define TC_BOOT_USER_CFG_FLAG_SILENT_MODE TC__BOOT_USER_CFG_FLAG_SILENT_MODE
|
#define TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE TC__BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE
|
||||||
#define TC_BOOT_USER_CFG_FLAG_DISABLE_ESC TC__BOOT_USER_CFG_FLAG_DISABLE_ESC
|
#define TC_BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER TC__BOOT_CFG_FLAG_WINDOWS_VISTA_OR_LATER
|
||||||
#define TC_BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION TC__BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION
|
#define TC_BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER TC__BOOT_CFG_FLAG_RESCUE_DISK_ORIG_SYS_LOADER
|
||||||
#define TC_HIDDEN_OS_CREATION_PHASE_NONE TC__HIDDEN_OS_CREATION_PHASE_NONE
|
#define TC_BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION TC__BOOT_CFG_FLAG_RESCUE_DISABLE_HW_ENCRYPTION
|
||||||
#define TC_HIDDEN_OS_CREATION_PHASE_CLONING TC__HIDDEN_OS_CREATION_PHASE_CLONING
|
#define TC_BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE TC__BOOT_CFG_MASK_HIDDEN_OS_CREATION_PHASE
|
||||||
#define TC_HIDDEN_OS_CREATION_PHASE_WIPING TC__HIDDEN_OS_CREATION_PHASE_WIPING
|
#define TC_BOOT_USER_CFG_FLAG_SILENT_MODE TC__BOOT_USER_CFG_FLAG_SILENT_MODE
|
||||||
#define TC_HIDDEN_OS_CREATION_PHASE_WIPED TC__HIDDEN_OS_CREATION_PHASE_WIPED
|
#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
|
||||||
#endif // TC_ASM_PREPROCESS
|
#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
|
||||||
#endif // TC_HEADER_Boot_BootDefs
|
#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
@@ -1,491 +1,491 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Bios.h"
|
#include "Bios.h"
|
||||||
#include "BootConsoleIo.h"
|
#include "BootConsoleIo.h"
|
||||||
#include "BootConfig.h"
|
#include "BootConfig.h"
|
||||||
#include "BootDebug.h"
|
#include "BootDebug.h"
|
||||||
#include "BootDefs.h"
|
#include "BootDefs.h"
|
||||||
#include "BootDiskIo.h"
|
#include "BootDiskIo.h"
|
||||||
#include "BootStrings.h"
|
#include "BootStrings.h"
|
||||||
|
|
||||||
|
|
||||||
byte SectorBuffer[TC_LB_SIZE];
|
byte SectorBuffer[TC_LB_SIZE];
|
||||||
|
|
||||||
#ifdef TC_BOOT_DEBUG_ENABLED
|
#ifdef TC_BOOT_DEBUG_ENABLED
|
||||||
static bool SectorBufferInUse = false;
|
static bool SectorBufferInUse = false;
|
||||||
|
|
||||||
void AcquireSectorBuffer ()
|
void AcquireSectorBuffer ()
|
||||||
{
|
{
|
||||||
if (SectorBufferInUse)
|
if (SectorBufferInUse)
|
||||||
TC_THROW_FATAL_EXCEPTION;
|
TC_THROW_FATAL_EXCEPTION;
|
||||||
|
|
||||||
SectorBufferInUse = true;
|
SectorBufferInUse = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ReleaseSectorBuffer ()
|
void ReleaseSectorBuffer ()
|
||||||
{
|
{
|
||||||
SectorBufferInUse = false;
|
SectorBufferInUse = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool IsLbaSupported (byte drive)
|
bool IsLbaSupported (byte drive)
|
||||||
{
|
{
|
||||||
static byte CachedDrive = TC_INVALID_BIOS_DRIVE;
|
static byte CachedDrive = TC_INVALID_BIOS_DRIVE;
|
||||||
static bool CachedStatus;
|
static bool CachedStatus;
|
||||||
uint16 result = 0;
|
uint16 result = 0;
|
||||||
|
|
||||||
if (CachedDrive == drive)
|
if (CachedDrive == drive)
|
||||||
goto ret;
|
goto ret;
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov bx, 0x55aa
|
mov bx, 0x55aa
|
||||||
mov dl, drive
|
mov dl, drive
|
||||||
mov ah, 0x41
|
mov ah, 0x41
|
||||||
int 0x13
|
int 0x13
|
||||||
jc err
|
jc err
|
||||||
mov result, bx
|
mov result, bx
|
||||||
err:
|
err:
|
||||||
}
|
}
|
||||||
|
|
||||||
CachedDrive = drive;
|
CachedDrive = drive;
|
||||||
CachedStatus = (result == 0xaa55);
|
CachedStatus = (result == 0xaa55);
|
||||||
ret:
|
ret:
|
||||||
return CachedStatus;
|
return CachedStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs)
|
void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs)
|
||||||
{
|
{
|
||||||
PrintEndl();
|
PrintEndl();
|
||||||
Print (write ? "Write" : "Read"); Print (" error:");
|
Print (write ? "Write" : "Read"); Print (" error:");
|
||||||
Print (error);
|
Print (error);
|
||||||
Print (" Drive:");
|
Print (" Drive:");
|
||||||
Print (drive ^ 0x80);
|
Print (drive ^ 0x80);
|
||||||
|
|
||||||
if (sector)
|
if (sector)
|
||||||
{
|
{
|
||||||
Print (" Sector:");
|
Print (" Sector:");
|
||||||
Print (*sector);
|
Print (*sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chs)
|
if (chs)
|
||||||
{
|
{
|
||||||
Print (" CHS:");
|
Print (" CHS:");
|
||||||
Print (*chs);
|
Print (*chs);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintEndl();
|
PrintEndl();
|
||||||
Beep();
|
Beep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Print (const ChsAddress &chs)
|
void Print (const ChsAddress &chs)
|
||||||
{
|
{
|
||||||
Print (chs.Cylinder);
|
Print (chs.Cylinder);
|
||||||
PrintChar ('/');
|
PrintChar ('/');
|
||||||
Print (chs.Head);
|
Print (chs.Head);
|
||||||
PrintChar ('/');
|
PrintChar ('/');
|
||||||
Print (chs.Sector);
|
Print (chs.Sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PrintSectorCountInMB (const uint64 §orCount)
|
void PrintSectorCountInMB (const uint64 §orCount)
|
||||||
{
|
{
|
||||||
Print (sectorCount >> (TC_LB_SIZE_BIT_SHIFT_DIVISOR + 2)); Print (" MB ");
|
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)
|
BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
|
||||||
{
|
{
|
||||||
CheckStack();
|
CheckStack();
|
||||||
|
|
||||||
byte cylinderLow = (byte) chs.Cylinder;
|
byte cylinderLow = (byte) chs.Cylinder;
|
||||||
byte sector = chs.Sector;
|
byte sector = chs.Sector;
|
||||||
sector |= byte (chs.Cylinder >> 2) & 0xc0;
|
sector |= byte (chs.Cylinder >> 2) & 0xc0;
|
||||||
byte function = write ? 0x03 : 0x02;
|
byte function = write ? 0x03 : 0x02;
|
||||||
|
|
||||||
BiosResult result;
|
BiosResult result;
|
||||||
byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
|
byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
result = BiosResultSuccess;
|
result = BiosResultSuccess;
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
push es
|
push es
|
||||||
mov ax, bufferSegment
|
mov ax, bufferSegment
|
||||||
mov es, ax
|
mov es, ax
|
||||||
mov bx, bufferOffset
|
mov bx, bufferOffset
|
||||||
mov dl, drive
|
mov dl, drive
|
||||||
mov ch, cylinderLow
|
mov ch, cylinderLow
|
||||||
mov si, chs
|
mov si, chs
|
||||||
mov dh, [si].Head
|
mov dh, [si].Head
|
||||||
mov cl, sector
|
mov cl, sector
|
||||||
mov al, sectorCount
|
mov al, sectorCount
|
||||||
mov ah, function
|
mov ah, function
|
||||||
int 0x13
|
int 0x13
|
||||||
jnc ok // If CF=0, ignore AH to prevent issues caused by potential bugs in BIOSes
|
jnc ok // If CF=0, ignore AH to prevent issues caused by potential bugs in BIOSes
|
||||||
mov result, ah
|
mov result, ah
|
||||||
ok:
|
ok:
|
||||||
pop es
|
pop es
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == BiosResultEccCorrected)
|
if (result == BiosResultEccCorrected)
|
||||||
result = BiosResultSuccess;
|
result = BiosResultSuccess;
|
||||||
|
|
||||||
// Some BIOSes report I/O errors prematurely in some cases
|
// Some BIOSes report I/O errors prematurely in some cases
|
||||||
} while (result != BiosResultSuccess && --tryCount != 0);
|
} while (result != BiosResultSuccess && --tryCount != 0);
|
||||||
|
|
||||||
if (!silent && result != BiosResultSuccess)
|
if (!silent && result != BiosResultSuccess)
|
||||||
PrintDiskError (result, write, drive, nullptr, &chs);
|
PrintDiskError (result, write, drive, nullptr, &chs);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
|
BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
|
||||||
{
|
{
|
||||||
uint16 codeSeg;
|
uint16 codeSeg;
|
||||||
__asm mov codeSeg, cs
|
__asm mov codeSeg, cs
|
||||||
return ReadWriteSectors (write, codeSeg, (uint16) buffer, drive, chs, sectorCount, silent);
|
return ReadWriteSectors (write, codeSeg, (uint16) buffer, drive, chs, sectorCount, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
|
BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
|
||||||
{
|
{
|
||||||
return ReadWriteSectors (false, buffer, drive, chs, sectorCount, silent);
|
return ReadWriteSectors (false, buffer, drive, chs, sectorCount, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
|
BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent)
|
||||||
{
|
{
|
||||||
return ReadWriteSectors (true, buffer, drive, chs, sectorCount, silent);
|
return ReadWriteSectors (true, buffer, drive, chs, sectorCount, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
static BiosResult ReadWriteSectors (bool write, BiosLbaPacket &dapPacket, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
||||||
{
|
{
|
||||||
CheckStack();
|
CheckStack();
|
||||||
|
|
||||||
if (!IsLbaSupported (drive))
|
if (!IsLbaSupported (drive))
|
||||||
{
|
{
|
||||||
DriveGeometry geometry;
|
DriveGeometry geometry;
|
||||||
|
|
||||||
BiosResult result = GetDriveGeometry (drive, geometry, silent);
|
BiosResult result = GetDriveGeometry (drive, geometry, silent);
|
||||||
if (result != BiosResultSuccess)
|
if (result != BiosResultSuccess)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
ChsAddress chs;
|
ChsAddress chs;
|
||||||
LbaToChs (geometry, sector, chs);
|
LbaToChs (geometry, sector, chs);
|
||||||
return ReadWriteSectors (write, (uint16) (dapPacket.Buffer >> 16), (uint16) dapPacket.Buffer, drive, chs, sectorCount, silent);
|
return ReadWriteSectors (write, (uint16) (dapPacket.Buffer >> 16), (uint16) dapPacket.Buffer, drive, chs, sectorCount, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
dapPacket.Size = sizeof (dapPacket);
|
dapPacket.Size = sizeof (dapPacket);
|
||||||
dapPacket.Reserved = 0;
|
dapPacket.Reserved = 0;
|
||||||
dapPacket.SectorCount = sectorCount;
|
dapPacket.SectorCount = sectorCount;
|
||||||
dapPacket.Sector = sector;
|
dapPacket.Sector = sector;
|
||||||
|
|
||||||
byte function = write ? 0x43 : 0x42;
|
byte function = write ? 0x43 : 0x42;
|
||||||
|
|
||||||
BiosResult result;
|
BiosResult result;
|
||||||
byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
|
byte tryCount = TC_MAX_BIOS_DISK_IO_RETRIES;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
result = BiosResultSuccess;
|
result = BiosResultSuccess;
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
mov bx, 0x55aa
|
mov bx, 0x55aa
|
||||||
mov dl, drive
|
mov dl, drive
|
||||||
mov si, [dapPacket]
|
mov si, [dapPacket]
|
||||||
mov ah, function
|
mov ah, function
|
||||||
xor al, al
|
xor al, al
|
||||||
int 0x13
|
int 0x13
|
||||||
jnc ok // If CF=0, ignore AH to prevent issues caused by potential bugs in BIOSes
|
jnc ok // If CF=0, ignore AH to prevent issues caused by potential bugs in BIOSes
|
||||||
mov result, ah
|
mov result, ah
|
||||||
ok:
|
ok:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == BiosResultEccCorrected)
|
if (result == BiosResultEccCorrected)
|
||||||
result = BiosResultSuccess;
|
result = BiosResultSuccess;
|
||||||
|
|
||||||
// Some BIOSes report I/O errors prematurely in some cases
|
// Some BIOSes report I/O errors prematurely in some cases
|
||||||
} while (result != BiosResultSuccess && --tryCount != 0);
|
} while (result != BiosResultSuccess && --tryCount != 0);
|
||||||
|
|
||||||
if (!silent && result != BiosResultSuccess)
|
if (!silent && result != BiosResultSuccess)
|
||||||
PrintDiskError (result, write, drive, §or);
|
PrintDiskError (result, write, drive, §or);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
static BiosResult ReadWriteSectors (bool write, byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
||||||
{
|
{
|
||||||
BiosLbaPacket dapPacket;
|
BiosLbaPacket dapPacket;
|
||||||
dapPacket.Buffer = (uint32) buffer;
|
dapPacket.Buffer = (uint32) buffer;
|
||||||
return ReadWriteSectors (write, dapPacket, drive, sector, sectorCount, silent);
|
return ReadWriteSectors (write, dapPacket, drive, sector, sectorCount, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
||||||
{
|
{
|
||||||
BiosLbaPacket dapPacket;
|
BiosLbaPacket dapPacket;
|
||||||
dapPacket.Buffer = ((uint32) bufferSegment << 16) | bufferOffset;
|
dapPacket.Buffer = ((uint32) bufferSegment << 16) | bufferOffset;
|
||||||
return ReadWriteSectors (write, dapPacket, drive, sector, sectorCount, silent);
|
return ReadWriteSectors (write, dapPacket, drive, sector, sectorCount, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
||||||
{
|
{
|
||||||
return ReadWriteSectors (false, bufferSegment, bufferOffset, drive, sector, sectorCount, silent);
|
return ReadWriteSectors (false, bufferSegment, bufferOffset, drive, sector, sectorCount, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BiosResult ReadSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
BiosResult ReadSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
||||||
{
|
{
|
||||||
BiosResult result;
|
BiosResult result;
|
||||||
uint16 codeSeg;
|
uint16 codeSeg;
|
||||||
__asm mov codeSeg, cs
|
__asm mov codeSeg, cs
|
||||||
|
|
||||||
result = ReadSectors (BootStarted ? codeSeg : TC_BOOT_LOADER_ALT_SEGMENT, (uint16) buffer, drive, sector, sectorCount, silent);
|
result = ReadSectors (BootStarted ? codeSeg : TC_BOOT_LOADER_ALT_SEGMENT, (uint16) buffer, drive, sector, sectorCount, silent);
|
||||||
|
|
||||||
// Alternative segment is used to prevent memory corruption caused by buggy BIOSes
|
// Alternative segment is used to prevent memory corruption caused by buggy BIOSes
|
||||||
if (!BootStarted)
|
if (!BootStarted)
|
||||||
CopyMemory (TC_BOOT_LOADER_ALT_SEGMENT, (uint16) buffer, buffer, sectorCount * TC_LB_SIZE);
|
CopyMemory (TC_BOOT_LOADER_ALT_SEGMENT, (uint16) buffer, buffer, sectorCount * TC_LB_SIZE);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BiosResult WriteSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
BiosResult WriteSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent)
|
||||||
{
|
{
|
||||||
return ReadWriteSectors (true, buffer, drive, sector, sectorCount, silent);
|
return ReadWriteSectors (true, buffer, drive, sector, sectorCount, silent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent)
|
BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent)
|
||||||
{
|
{
|
||||||
CheckStack();
|
CheckStack();
|
||||||
|
|
||||||
byte maxCylinderLow, maxHead, maxSector;
|
byte maxCylinderLow, maxHead, maxSector;
|
||||||
BiosResult result;
|
BiosResult result;
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
push es
|
push es
|
||||||
mov dl, drive
|
mov dl, drive
|
||||||
mov ah, 0x08
|
mov ah, 0x08
|
||||||
int 0x13
|
int 0x13
|
||||||
|
|
||||||
mov result, ah
|
mov result, ah
|
||||||
mov maxCylinderLow, ch
|
mov maxCylinderLow, ch
|
||||||
mov maxSector, cl
|
mov maxSector, cl
|
||||||
mov maxHead, dh
|
mov maxHead, dh
|
||||||
pop es
|
pop es
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == BiosResultSuccess)
|
if (result == BiosResultSuccess)
|
||||||
{
|
{
|
||||||
geometry.Cylinders = (maxCylinderLow | (uint16 (maxSector & 0xc0) << 2)) + 1;
|
geometry.Cylinders = (maxCylinderLow | (uint16 (maxSector & 0xc0) << 2)) + 1;
|
||||||
geometry.Heads = maxHead + 1;
|
geometry.Heads = maxHead + 1;
|
||||||
geometry.Sectors = maxSector & ~0xc0;
|
geometry.Sectors = maxSector & ~0xc0;
|
||||||
}
|
}
|
||||||
else if (!silent)
|
else if (!silent)
|
||||||
{
|
{
|
||||||
Print ("Drive ");
|
Print ("Drive ");
|
||||||
Print (drive ^ 0x80);
|
Print (drive ^ 0x80);
|
||||||
Print (" not found: ");
|
Print (" not found: ");
|
||||||
PrintErrorNoEndl ("");
|
PrintErrorNoEndl ("");
|
||||||
Print (result);
|
Print (result);
|
||||||
PrintEndl();
|
PrintEndl();
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba)
|
void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba)
|
||||||
{
|
{
|
||||||
lba.HighPart = 0;
|
lba.HighPart = 0;
|
||||||
lba.LowPart = (uint32 (chs.Cylinder) * geometry.Heads + chs.Head) * geometry.Sectors + chs.Sector - 1;
|
lba.LowPart = (uint32 (chs.Cylinder) * geometry.Heads + chs.Head) * geometry.Sectors + chs.Sector - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs)
|
void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs)
|
||||||
{
|
{
|
||||||
chs.Sector = (byte) ((lba.LowPart % geometry.Sectors) + 1);
|
chs.Sector = (byte) ((lba.LowPart % geometry.Sectors) + 1);
|
||||||
uint32 ch = lba.LowPart / geometry.Sectors;
|
uint32 ch = lba.LowPart / geometry.Sectors;
|
||||||
chs.Head = (byte) (ch % geometry.Heads);
|
chs.Head = (byte) (ch % geometry.Heads);
|
||||||
chs.Cylinder = (uint16) (ch / geometry.Heads);
|
chs.Cylinder = (uint16) (ch / geometry.Heads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PartitionEntryMBRToPartition (const PartitionEntryMBR &partEntry, Partition &partition)
|
void PartitionEntryMBRToPartition (const PartitionEntryMBR &partEntry, Partition &partition)
|
||||||
{
|
{
|
||||||
partition.Active = partEntry.BootIndicator == 0x80;
|
partition.Active = partEntry.BootIndicator == 0x80;
|
||||||
partition.EndSector.HighPart = 0;
|
partition.EndSector.HighPart = 0;
|
||||||
partition.EndSector.LowPart = partEntry.StartLBA + partEntry.SectorCountLBA - 1;
|
partition.EndSector.LowPart = partEntry.StartLBA + partEntry.SectorCountLBA - 1;
|
||||||
partition.SectorCount.HighPart = 0;
|
partition.SectorCount.HighPart = 0;
|
||||||
partition.SectorCount.LowPart = partEntry.SectorCountLBA;
|
partition.SectorCount.LowPart = partEntry.SectorCountLBA;
|
||||||
partition.StartSector.HighPart = 0;
|
partition.StartSector.HighPart = 0;
|
||||||
partition.StartSector.LowPart = partEntry.StartLBA;
|
partition.StartSector.LowPart = partEntry.StartLBA;
|
||||||
partition.Type = partEntry.Type;
|
partition.Type = partEntry.Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BiosResult ReadWriteMBR (bool write, byte drive, bool silent)
|
BiosResult ReadWriteMBR (bool write, byte drive, bool silent)
|
||||||
{
|
{
|
||||||
uint64 mbrSector;
|
uint64 mbrSector;
|
||||||
mbrSector.HighPart = 0;
|
mbrSector.HighPart = 0;
|
||||||
mbrSector.LowPart = 0;
|
mbrSector.LowPart = 0;
|
||||||
|
|
||||||
if (write)
|
if (write)
|
||||||
return WriteSectors (SectorBuffer, drive, mbrSector, 1, silent);
|
return WriteSectors (SectorBuffer, drive, mbrSector, 1, silent);
|
||||||
|
|
||||||
return ReadSectors (SectorBuffer, drive, mbrSector, 1, silent); // Uses alternative segment
|
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)
|
BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly, Partition *findPartitionFollowingThis, bool silent)
|
||||||
{
|
{
|
||||||
Partition *followingPartition;
|
Partition *followingPartition;
|
||||||
Partition tmpPartition;
|
Partition tmpPartition;
|
||||||
|
|
||||||
if (findPartitionFollowingThis)
|
if (findPartitionFollowingThis)
|
||||||
{
|
{
|
||||||
assert (partitionArrayCapacity == 1);
|
assert (partitionArrayCapacity == 1);
|
||||||
partitionArrayCapacity = 0xff;
|
partitionArrayCapacity = 0xff;
|
||||||
followingPartition = partitionArray;
|
followingPartition = partitionArray;
|
||||||
partitionArray = &tmpPartition;
|
partitionArray = &tmpPartition;
|
||||||
|
|
||||||
followingPartition->Drive = TC_INVALID_BIOS_DRIVE;
|
followingPartition->Drive = TC_INVALID_BIOS_DRIVE;
|
||||||
followingPartition->StartSector.LowPart = 0xFFFFffffUL;
|
followingPartition->StartSector.LowPart = 0xFFFFffffUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
AcquireSectorBuffer();
|
AcquireSectorBuffer();
|
||||||
BiosResult result = ReadWriteMBR (false, drive, silent);
|
BiosResult result = ReadWriteMBR (false, drive, silent);
|
||||||
ReleaseSectorBuffer();
|
ReleaseSectorBuffer();
|
||||||
|
|
||||||
partitionCount = 0;
|
partitionCount = 0;
|
||||||
|
|
||||||
MBR *mbr = (MBR *) SectorBuffer;
|
MBR *mbr = (MBR *) SectorBuffer;
|
||||||
if (result != BiosResultSuccess || mbr->Signature != 0xaa55)
|
if (result != BiosResultSuccess || mbr->Signature != 0xaa55)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
PartitionEntryMBR mbrPartitions[4];
|
PartitionEntryMBR mbrPartitions[4];
|
||||||
memcpy (mbrPartitions, mbr->Partitions, sizeof (mbrPartitions));
|
memcpy (mbrPartitions, mbr->Partitions, sizeof (mbrPartitions));
|
||||||
size_t partitionArrayPos = 0, partitionNumber;
|
size_t partitionArrayPos = 0, partitionNumber;
|
||||||
|
|
||||||
for (partitionNumber = 0;
|
for (partitionNumber = 0;
|
||||||
partitionNumber < array_capacity (mbrPartitions) && partitionArrayPos < partitionArrayCapacity;
|
partitionNumber < array_capacity (mbrPartitions) && partitionArrayPos < partitionArrayCapacity;
|
||||||
++partitionNumber)
|
++partitionNumber)
|
||||||
{
|
{
|
||||||
const PartitionEntryMBR &partEntry = mbrPartitions[partitionNumber];
|
const PartitionEntryMBR &partEntry = mbrPartitions[partitionNumber];
|
||||||
|
|
||||||
if (partEntry.SectorCountLBA > 0)
|
if (partEntry.SectorCountLBA > 0)
|
||||||
{
|
{
|
||||||
Partition &partition = partitionArray[partitionArrayPos];
|
Partition &partition = partitionArray[partitionArrayPos];
|
||||||
PartitionEntryMBRToPartition (partEntry, partition);
|
PartitionEntryMBRToPartition (partEntry, partition);
|
||||||
|
|
||||||
if (activeOnly && !partition.Active)
|
if (activeOnly && !partition.Active)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
partition.Drive = drive;
|
partition.Drive = drive;
|
||||||
partition.Number = partitionArrayPos;
|
partition.Number = partitionArrayPos;
|
||||||
|
|
||||||
if (partEntry.Type == 0x5 || partEntry.Type == 0xf) // Extended partition
|
if (partEntry.Type == 0x5 || partEntry.Type == 0xf) // Extended partition
|
||||||
{
|
{
|
||||||
if (IsLbaSupported (drive))
|
if (IsLbaSupported (drive))
|
||||||
{
|
{
|
||||||
// Find all extended partitions
|
// Find all extended partitions
|
||||||
uint64 firstExtStartLBA = partition.StartSector;
|
uint64 firstExtStartLBA = partition.StartSector;
|
||||||
uint64 extStartLBA = partition.StartSector;
|
uint64 extStartLBA = partition.StartSector;
|
||||||
MBR *extMbr = (MBR *) SectorBuffer;
|
MBR *extMbr = (MBR *) SectorBuffer;
|
||||||
|
|
||||||
while (partitionArrayPos < partitionArrayCapacity &&
|
while (partitionArrayPos < partitionArrayCapacity &&
|
||||||
(result = ReadSectors ((byte *) extMbr, drive, extStartLBA, 1, silent)) == BiosResultSuccess
|
(result = ReadSectors ((byte *) extMbr, drive, extStartLBA, 1, silent)) == BiosResultSuccess
|
||||||
&& extMbr->Signature == 0xaa55)
|
&& extMbr->Signature == 0xaa55)
|
||||||
{
|
{
|
||||||
if (extMbr->Partitions[0].SectorCountLBA > 0)
|
if (extMbr->Partitions[0].SectorCountLBA > 0)
|
||||||
{
|
{
|
||||||
Partition &logPart = partitionArray[partitionArrayPos];
|
Partition &logPart = partitionArray[partitionArrayPos];
|
||||||
PartitionEntryMBRToPartition (extMbr->Partitions[0], logPart);
|
PartitionEntryMBRToPartition (extMbr->Partitions[0], logPart);
|
||||||
logPart.Drive = drive;
|
logPart.Drive = drive;
|
||||||
|
|
||||||
logPart.Number = partitionArrayPos;
|
logPart.Number = partitionArrayPos;
|
||||||
logPart.Primary = false;
|
logPart.Primary = false;
|
||||||
|
|
||||||
logPart.StartSector.LowPart += extStartLBA.LowPart;
|
logPart.StartSector.LowPart += extStartLBA.LowPart;
|
||||||
logPart.EndSector.LowPart += extStartLBA.LowPart;
|
logPart.EndSector.LowPart += extStartLBA.LowPart;
|
||||||
|
|
||||||
if (findPartitionFollowingThis)
|
if (findPartitionFollowingThis)
|
||||||
{
|
{
|
||||||
if (logPart.StartSector.LowPart > findPartitionFollowingThis->EndSector.LowPart
|
if (logPart.StartSector.LowPart > findPartitionFollowingThis->EndSector.LowPart
|
||||||
&& logPart.StartSector.LowPart < followingPartition->StartSector.LowPart)
|
&& logPart.StartSector.LowPart < followingPartition->StartSector.LowPart)
|
||||||
{
|
{
|
||||||
*followingPartition = logPart;
|
*followingPartition = logPart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++partitionArrayPos;
|
++partitionArrayPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Secondary extended
|
// Secondary extended
|
||||||
if (extMbr->Partitions[1].Type != 0x5 && extMbr->Partitions[1].Type == 0xf
|
if (extMbr->Partitions[1].Type != 0x5 && extMbr->Partitions[1].Type == 0xf
|
||||||
|| extMbr->Partitions[1].SectorCountLBA == 0)
|
|| extMbr->Partitions[1].SectorCountLBA == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
extStartLBA.LowPart = extMbr->Partitions[1].StartLBA + firstExtStartLBA.LowPart;
|
extStartLBA.LowPart = extMbr->Partitions[1].StartLBA + firstExtStartLBA.LowPart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
partition.Primary = true;
|
partition.Primary = true;
|
||||||
|
|
||||||
if (findPartitionFollowingThis)
|
if (findPartitionFollowingThis)
|
||||||
{
|
{
|
||||||
if (partition.StartSector.LowPart > findPartitionFollowingThis->EndSector.LowPart
|
if (partition.StartSector.LowPart > findPartitionFollowingThis->EndSector.LowPart
|
||||||
&& partition.StartSector.LowPart < followingPartition->StartSector.LowPart)
|
&& partition.StartSector.LowPart < followingPartition->StartSector.LowPart)
|
||||||
{
|
{
|
||||||
*followingPartition = partition;
|
*followingPartition = partition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
++partitionArrayPos;
|
++partitionArrayPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
partitionCount = partitionArrayPos;
|
partitionCount = partitionArrayPos;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GetActivePartition (byte drive)
|
bool GetActivePartition (byte drive)
|
||||||
{
|
{
|
||||||
size_t partCount;
|
size_t partCount;
|
||||||
|
|
||||||
if (GetDrivePartitions (drive, &ActivePartition, 1, partCount, true) != BiosResultSuccess || partCount < 1)
|
if (GetDrivePartitions (drive, &ActivePartition, 1, partCount, true) != BiosResultSuccess || partCount < 1)
|
||||||
{
|
{
|
||||||
ActivePartition.Drive = TC_INVALID_BIOS_DRIVE;
|
ActivePartition.Drive = TC_INVALID_BIOS_DRIVE;
|
||||||
PrintError (TC_BOOT_STR_NO_BOOT_PARTITION);
|
PrintError (TC_BOOT_STR_NO_BOOT_PARTITION);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+120
-120
@@ -1,120 +1,120 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TC_HEADER_Boot_BootDiskIo
|
#ifndef TC_HEADER_Boot_BootDiskIo
|
||||||
#define TC_HEADER_Boot_BootDiskIo
|
#define TC_HEADER_Boot_BootDiskIo
|
||||||
|
|
||||||
#include "Bios.h"
|
#include "Bios.h"
|
||||||
#include "BootDebug.h"
|
#include "BootDebug.h"
|
||||||
#include "BootDefs.h"
|
#include "BootDefs.h"
|
||||||
|
|
||||||
#define TC_MAX_BIOS_DISK_IO_RETRIES 5
|
#define TC_MAX_BIOS_DISK_IO_RETRIES 5
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
BiosResultEccCorrected = 0x11
|
BiosResultEccCorrected = 0x11
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
struct PartitionEntryMBR
|
struct PartitionEntryMBR
|
||||||
{
|
{
|
||||||
byte BootIndicator;
|
byte BootIndicator;
|
||||||
|
|
||||||
byte StartHead;
|
byte StartHead;
|
||||||
byte StartCylSector;
|
byte StartCylSector;
|
||||||
byte StartCylinder;
|
byte StartCylinder;
|
||||||
|
|
||||||
byte Type;
|
byte Type;
|
||||||
|
|
||||||
byte EndHead;
|
byte EndHead;
|
||||||
byte EndSector;
|
byte EndSector;
|
||||||
byte EndCylinder;
|
byte EndCylinder;
|
||||||
|
|
||||||
uint32 StartLBA;
|
uint32 StartLBA;
|
||||||
uint32 SectorCountLBA;
|
uint32 SectorCountLBA;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MBR
|
struct MBR
|
||||||
{
|
{
|
||||||
byte Code[446];
|
byte Code[446];
|
||||||
PartitionEntryMBR Partitions[4];
|
PartitionEntryMBR Partitions[4];
|
||||||
uint16 Signature;
|
uint16 Signature;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BiosLbaPacket
|
struct BiosLbaPacket
|
||||||
{
|
{
|
||||||
byte Size;
|
byte Size;
|
||||||
byte Reserved;
|
byte Reserved;
|
||||||
uint16 SectorCount;
|
uint16 SectorCount;
|
||||||
uint32 Buffer;
|
uint32 Buffer;
|
||||||
uint64 Sector;
|
uint64 Sector;
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
|
|
||||||
struct ChsAddress
|
struct ChsAddress
|
||||||
{
|
{
|
||||||
uint16 Cylinder;
|
uint16 Cylinder;
|
||||||
byte Head;
|
byte Head;
|
||||||
byte Sector;
|
byte Sector;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Partition
|
struct Partition
|
||||||
{
|
{
|
||||||
byte Number;
|
byte Number;
|
||||||
byte Drive;
|
byte Drive;
|
||||||
bool Active;
|
bool Active;
|
||||||
uint64 EndSector;
|
uint64 EndSector;
|
||||||
bool Primary;
|
bool Primary;
|
||||||
uint64 SectorCount;
|
uint64 SectorCount;
|
||||||
uint64 StartSector;
|
uint64 StartSector;
|
||||||
byte Type;
|
byte Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DriveGeometry
|
struct DriveGeometry
|
||||||
{
|
{
|
||||||
uint16 Cylinders;
|
uint16 Cylinders;
|
||||||
byte Heads;
|
byte Heads;
|
||||||
byte Sectors;
|
byte Sectors;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef TC_BOOT_DEBUG_ENABLED
|
#ifdef TC_BOOT_DEBUG_ENABLED
|
||||||
void AcquireSectorBuffer ();
|
void AcquireSectorBuffer ();
|
||||||
void ReleaseSectorBuffer ();
|
void ReleaseSectorBuffer ();
|
||||||
#else
|
#else
|
||||||
# define AcquireSectorBuffer()
|
# define AcquireSectorBuffer()
|
||||||
# define ReleaseSectorBuffer()
|
# define ReleaseSectorBuffer()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba);
|
void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba);
|
||||||
bool GetActivePartition (byte drive);
|
bool GetActivePartition (byte drive);
|
||||||
BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent = false);
|
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);
|
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);
|
bool IsLbaSupported (byte drive);
|
||||||
void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs);
|
void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs);
|
||||||
void Print (const ChsAddress &chs);
|
void Print (const ChsAddress &chs);
|
||||||
void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs = nullptr);
|
void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs = nullptr);
|
||||||
void PrintSectorCountInMB (const uint64 §orCount);
|
void PrintSectorCountInMB (const uint64 §orCount);
|
||||||
BiosResult ReadWriteMBR (bool write, byte drive, bool silent = false);
|
BiosResult ReadWriteMBR (bool write, byte drive, bool silent = false);
|
||||||
BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 §or, uint16 sectorCount, bool silent = false);
|
BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 §or, uint16 sectorCount, bool silent = false);
|
||||||
BiosResult ReadSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent = false);
|
BiosResult ReadSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent = false);
|
||||||
BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte 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 §or, uint16 sectorCount, bool silent);
|
BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 §or, uint16 sectorCount, bool silent);
|
||||||
BiosResult WriteSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent = false);
|
BiosResult WriteSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent = false);
|
||||||
BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
|
BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
|
||||||
|
|
||||||
extern byte SectorBuffer[TC_LB_SIZE];
|
extern byte SectorBuffer[TC_LB_SIZE];
|
||||||
|
|
||||||
#endif // TC_HEADER_Boot_BootDiskIo
|
#endif // TC_HEADER_Boot_BootDiskIo
|
||||||
|
|||||||
@@ -1,132 +1,132 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Crypto.h"
|
#include "Crypto.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "BootConfig.h"
|
#include "BootConfig.h"
|
||||||
#include "BootDebug.h"
|
#include "BootDebug.h"
|
||||||
#include "BootDefs.h"
|
#include "BootDefs.h"
|
||||||
#include "BootDiskIo.h"
|
#include "BootDiskIo.h"
|
||||||
#include "BootEncryptedIo.h"
|
#include "BootEncryptedIo.h"
|
||||||
|
|
||||||
|
|
||||||
BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte drive, uint64 sector, uint16 sectorCount)
|
BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte drive, uint64 sector, uint16 sectorCount)
|
||||||
{
|
{
|
||||||
BiosResult result;
|
BiosResult result;
|
||||||
bool decrypt = true;
|
bool decrypt = true;
|
||||||
|
|
||||||
if (BootCryptoInfo->hiddenVolume)
|
if (BootCryptoInfo->hiddenVolume)
|
||||||
{
|
{
|
||||||
if (ReadWritePartiallyCoversEncryptedArea (sector, sectorCount))
|
if (ReadWritePartiallyCoversEncryptedArea (sector, sectorCount))
|
||||||
return BiosResultInvalidFunction;
|
return BiosResultInvalidFunction;
|
||||||
|
|
||||||
if (sector >= EncryptedVirtualPartition.StartSector && sector <= EncryptedVirtualPartition.EndSector)
|
if (sector >= EncryptedVirtualPartition.StartSector && sector <= EncryptedVirtualPartition.EndSector)
|
||||||
{
|
{
|
||||||
// Remap the request to the hidden volume
|
// Remap the request to the hidden volume
|
||||||
sector -= EncryptedVirtualPartition.StartSector;
|
sector -= EncryptedVirtualPartition.StartSector;
|
||||||
sector += HiddenVolumeStartSector;
|
sector += HiddenVolumeStartSector;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
decrypt = false;
|
decrypt = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ReadSectors (destSegment, destOffset, drive, sector, sectorCount);
|
result = ReadSectors (destSegment, destOffset, drive, sector, sectorCount);
|
||||||
|
|
||||||
if (result != BiosResultSuccess || !decrypt)
|
if (result != BiosResultSuccess || !decrypt)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if (BootCryptoInfo->hiddenVolume)
|
if (BootCryptoInfo->hiddenVolume)
|
||||||
{
|
{
|
||||||
// Convert sector number to data unit number of the hidden volume
|
// Convert sector number to data unit number of the hidden volume
|
||||||
sector -= HiddenVolumeStartSector;
|
sector -= HiddenVolumeStartSector;
|
||||||
sector += HiddenVolumeStartUnitNo;
|
sector += PimValueOrHiddenVolumeStartUnitNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drive == EncryptedVirtualPartition.Drive)
|
if (drive == EncryptedVirtualPartition.Drive)
|
||||||
{
|
{
|
||||||
while (sectorCount-- > 0)
|
while (sectorCount-- > 0)
|
||||||
{
|
{
|
||||||
if (BootCryptoInfo->hiddenVolume
|
if (BootCryptoInfo->hiddenVolume
|
||||||
|| (sector >= EncryptedVirtualPartition.StartSector && sector <= EncryptedVirtualPartition.EndSector))
|
|| (sector >= EncryptedVirtualPartition.StartSector && sector <= EncryptedVirtualPartition.EndSector))
|
||||||
{
|
{
|
||||||
AcquireSectorBuffer();
|
AcquireSectorBuffer();
|
||||||
CopyMemory (destSegment, destOffset, SectorBuffer, TC_LB_SIZE);
|
CopyMemory (destSegment, destOffset, SectorBuffer, TC_LB_SIZE);
|
||||||
|
|
||||||
DecryptDataUnits (SectorBuffer, §or, 1, BootCryptoInfo);
|
DecryptDataUnits (SectorBuffer, §or, 1, BootCryptoInfo);
|
||||||
|
|
||||||
CopyMemory (SectorBuffer, destSegment, destOffset, TC_LB_SIZE);
|
CopyMemory (SectorBuffer, destSegment, destOffset, TC_LB_SIZE);
|
||||||
ReleaseSectorBuffer();
|
ReleaseSectorBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
++sector;
|
++sector;
|
||||||
destOffset += TC_LB_SIZE;
|
destOffset += TC_LB_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byte drive, uint64 sector, uint16 sectorCount)
|
BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byte drive, uint64 sector, uint16 sectorCount)
|
||||||
{
|
{
|
||||||
BiosResult result = BiosResultSuccess;
|
BiosResult result = BiosResultSuccess;
|
||||||
AcquireSectorBuffer();
|
AcquireSectorBuffer();
|
||||||
uint64 dataUnitNo;
|
uint64 dataUnitNo;
|
||||||
uint64 writeOffset;
|
uint64 writeOffset;
|
||||||
|
|
||||||
dataUnitNo = sector;
|
dataUnitNo = sector;
|
||||||
writeOffset.HighPart = 0;
|
writeOffset.HighPart = 0;
|
||||||
writeOffset.LowPart = 0;
|
writeOffset.LowPart = 0;
|
||||||
|
|
||||||
if (BootCryptoInfo->hiddenVolume)
|
if (BootCryptoInfo->hiddenVolume)
|
||||||
{
|
{
|
||||||
if (ReadWritePartiallyCoversEncryptedArea (sector, sectorCount))
|
if (ReadWritePartiallyCoversEncryptedArea (sector, sectorCount))
|
||||||
return BiosResultInvalidFunction;
|
return BiosResultInvalidFunction;
|
||||||
|
|
||||||
// Remap the request to the hidden volume
|
// Remap the request to the hidden volume
|
||||||
writeOffset = HiddenVolumeStartSector;
|
writeOffset = HiddenVolumeStartSector;
|
||||||
writeOffset -= EncryptedVirtualPartition.StartSector;
|
writeOffset -= EncryptedVirtualPartition.StartSector;
|
||||||
dataUnitNo -= EncryptedVirtualPartition.StartSector;
|
dataUnitNo -= EncryptedVirtualPartition.StartSector;
|
||||||
dataUnitNo += HiddenVolumeStartUnitNo;
|
dataUnitNo += PimValueOrHiddenVolumeStartUnitNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (sectorCount-- > 0)
|
while (sectorCount-- > 0)
|
||||||
{
|
{
|
||||||
CopyMemory (sourceSegment, sourceOffset, SectorBuffer, TC_LB_SIZE);
|
CopyMemory (sourceSegment, sourceOffset, SectorBuffer, TC_LB_SIZE);
|
||||||
|
|
||||||
if (drive == EncryptedVirtualPartition.Drive && sector >= EncryptedVirtualPartition.StartSector && sector <= EncryptedVirtualPartition.EndSector)
|
if (drive == EncryptedVirtualPartition.Drive && sector >= EncryptedVirtualPartition.StartSector && sector <= EncryptedVirtualPartition.EndSector)
|
||||||
{
|
{
|
||||||
EncryptDataUnits (SectorBuffer, &dataUnitNo, 1, BootCryptoInfo);
|
EncryptDataUnits (SectorBuffer, &dataUnitNo, 1, BootCryptoInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = WriteSectors (SectorBuffer, drive, sector + writeOffset, 1);
|
result = WriteSectors (SectorBuffer, drive, sector + writeOffset, 1);
|
||||||
|
|
||||||
if (result != BiosResultSuccess)
|
if (result != BiosResultSuccess)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
++sector;
|
++sector;
|
||||||
++dataUnitNo;
|
++dataUnitNo;
|
||||||
sourceOffset += TC_LB_SIZE;
|
sourceOffset += TC_LB_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReleaseSectorBuffer();
|
ReleaseSectorBuffer();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool ReadWritePartiallyCoversEncryptedArea (const uint64 §or, uint16 sectorCount)
|
static bool ReadWritePartiallyCoversEncryptedArea (const uint64 §or, uint16 sectorCount)
|
||||||
{
|
{
|
||||||
uint64 readWriteEnd = sector + --sectorCount;
|
uint64 readWriteEnd = sector + --sectorCount;
|
||||||
|
|
||||||
return ((sector < EncryptedVirtualPartition.StartSector && readWriteEnd >= EncryptedVirtualPartition.StartSector)
|
return ((sector < EncryptedVirtualPartition.StartSector && readWriteEnd >= EncryptedVirtualPartition.StartSector)
|
||||||
|| (sector >= EncryptedVirtualPartition.StartSector && readWriteEnd > EncryptedVirtualPartition.EndSector));
|
|| (sector >= EncryptedVirtualPartition.StartSector && readWriteEnd > EncryptedVirtualPartition.EndSector));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TC_HEADER_Boot_BootEncryptionIo
|
#ifndef TC_HEADER_Boot_BootEncryptionIo
|
||||||
#define TC_HEADER_Boot_BootEncryptionIo
|
#define TC_HEADER_Boot_BootEncryptionIo
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte drive, uint64 sector, uint16 sectorCount);
|
BiosResult ReadEncryptedSectors (uint16 destSegment, uint16 destOffset, byte drive, uint64 sector, uint16 sectorCount);
|
||||||
BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byte drive, uint64 sector, uint16 sectorCount);
|
BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byte drive, uint64 sector, uint16 sectorCount);
|
||||||
static bool ReadWritePartiallyCoversEncryptedArea (const uint64 §or, uint16 sectorCount);
|
static bool ReadWritePartiallyCoversEncryptedArea (const uint64 §or, uint16 sectorCount);
|
||||||
|
|
||||||
#endif // TC_HEADER_Boot_BootEncryptionIo
|
#endif // TC_HEADER_Boot_BootEncryptionIo
|
||||||
|
|||||||
+1272
-1232
File diff suppressed because it is too large
Load Diff
+34
-34
@@ -1,34 +1,34 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef TC_HEADER_Boot_BootMain
|
#ifndef TC_HEADER_Boot_BootMain
|
||||||
#define TC_HEADER_Boot_BootMain
|
#define TC_HEADER_Boot_BootMain
|
||||||
|
|
||||||
#include "TCdefs.h"
|
#include "TCdefs.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
|
||||||
static byte AskPassword (Password &password, int& pim);
|
static byte AskPassword (Password &password, int& pim);
|
||||||
static int AskSelection (const char *options[], size_t optionCount);
|
static int AskSelection (const char *options[], size_t optionCount);
|
||||||
static bool AskYesNo (const char *message);
|
static bool AskYesNo (const char *message);
|
||||||
static byte BootEncryptedDrive ();
|
static byte BootEncryptedDrive ();
|
||||||
static void BootMenu ();
|
static void BootMenu ();
|
||||||
static void ExecuteBootSector (byte drive, byte *sectorBuffer);
|
static void ExecuteBootSector (byte drive, byte *sectorBuffer);
|
||||||
static void InitScreen ();
|
static void InitScreen ();
|
||||||
static bool IsMenuKey (byte scanCode);
|
static bool IsMenuKey (byte scanCode);
|
||||||
static bool MountVolume (byte drive, byte &exitKey);
|
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 bool OpenVolume (byte drive, Password &password, CRYPTO_INFO **cryptoInfo, uint32 *headerSaltCrc32 = nullptr, bool skipNormal = false, bool skipHidden = false);
|
||||||
static void PrintMainMenu ();
|
static void PrintMainMenu ();
|
||||||
static void RepairMenu ();
|
static void RepairMenu ();
|
||||||
|
|
||||||
#define TC_MENU_KEY_REPAIR TC_BIOS_KEY_F8
|
#define TC_MENU_KEY_REPAIR TC_BIOS_KEY_F8
|
||||||
|
|
||||||
#endif // TC_HEADER_Boot_BootMain
|
#endif // TC_HEADER_Boot_BootMain
|
||||||
|
|||||||
@@ -1,86 +1,86 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "BootDefs.h"
|
#include "BootDefs.h"
|
||||||
#include "BootMemory.h"
|
#include "BootMemory.h"
|
||||||
|
|
||||||
static uint32 MemoryMapContValue;
|
static uint32 MemoryMapContValue;
|
||||||
|
|
||||||
static bool GetMemoryMapEntry (BiosMemoryMapEntry &entry)
|
static bool GetMemoryMapEntry (BiosMemoryMapEntry &entry)
|
||||||
{
|
{
|
||||||
static const uint32 function = 0x0000E820UL;
|
static const uint32 function = 0x0000E820UL;
|
||||||
static const uint32 magic = 0x534D4150UL;
|
static const uint32 magic = 0x534D4150UL;
|
||||||
static const uint32 bufferSize = sizeof (BiosMemoryMapEntry);
|
static const uint32 bufferSize = sizeof (BiosMemoryMapEntry);
|
||||||
|
|
||||||
bool carry = false;
|
bool carry = false;
|
||||||
uint32 resultMagic;
|
uint32 resultMagic;
|
||||||
uint32 resultSize;
|
uint32 resultSize;
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
push es
|
push es
|
||||||
|
|
||||||
lea di, function
|
lea di, function
|
||||||
TC_ASM_MOV_EAX_DI
|
TC_ASM_MOV_EAX_DI
|
||||||
lea di, MemoryMapContValue
|
lea di, MemoryMapContValue
|
||||||
TC_ASM_MOV_EBX_DI
|
TC_ASM_MOV_EBX_DI
|
||||||
lea di, bufferSize
|
lea di, bufferSize
|
||||||
TC_ASM_MOV_ECX_DI
|
TC_ASM_MOV_ECX_DI
|
||||||
lea di, magic
|
lea di, magic
|
||||||
TC_ASM_MOV_EDX_DI
|
TC_ASM_MOV_EDX_DI
|
||||||
lea di, MemoryMapContValue
|
lea di, MemoryMapContValue
|
||||||
TC_ASM_MOV_DI_ECX
|
TC_ASM_MOV_DI_ECX
|
||||||
|
|
||||||
// Use alternative segment to prevent memory corruption caused by buggy BIOSes
|
// Use alternative segment to prevent memory corruption caused by buggy BIOSes
|
||||||
push TC_BOOT_LOADER_ALT_SEGMENT
|
push TC_BOOT_LOADER_ALT_SEGMENT
|
||||||
pop es
|
pop es
|
||||||
mov di, 0
|
mov di, 0
|
||||||
|
|
||||||
int 0x15
|
int 0x15
|
||||||
jnc no_carry
|
jnc no_carry
|
||||||
mov carry, true
|
mov carry, true
|
||||||
no_carry:
|
no_carry:
|
||||||
|
|
||||||
lea di, resultMagic
|
lea di, resultMagic
|
||||||
TC_ASM_MOV_DI_EAX
|
TC_ASM_MOV_DI_EAX
|
||||||
lea di, MemoryMapContValue
|
lea di, MemoryMapContValue
|
||||||
TC_ASM_MOV_DI_EBX
|
TC_ASM_MOV_DI_EBX
|
||||||
lea di, resultSize
|
lea di, resultSize
|
||||||
TC_ASM_MOV_DI_ECX
|
TC_ASM_MOV_DI_ECX
|
||||||
|
|
||||||
pop es
|
pop es
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMemory (TC_BOOT_LOADER_ALT_SEGMENT, 0, &entry, sizeof (entry));
|
CopyMemory (TC_BOOT_LOADER_ALT_SEGMENT, 0, &entry, sizeof (entry));
|
||||||
|
|
||||||
// BIOS may set CF at the end of the list
|
// BIOS may set CF at the end of the list
|
||||||
if (carry)
|
if (carry)
|
||||||
MemoryMapContValue = 0;
|
MemoryMapContValue = 0;
|
||||||
|
|
||||||
return resultMagic == magic && resultSize == bufferSize;
|
return resultMagic == magic && resultSize == bufferSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GetFirstBiosMemoryMapEntry (BiosMemoryMapEntry &entry)
|
bool GetFirstBiosMemoryMapEntry (BiosMemoryMapEntry &entry)
|
||||||
{
|
{
|
||||||
MemoryMapContValue = 0;
|
MemoryMapContValue = 0;
|
||||||
return GetMemoryMapEntry (entry);
|
return GetMemoryMapEntry (entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GetNextBiosMemoryMapEntry (BiosMemoryMapEntry &entry)
|
bool GetNextBiosMemoryMapEntry (BiosMemoryMapEntry &entry)
|
||||||
{
|
{
|
||||||
if (MemoryMapContValue == 0)
|
if (MemoryMapContValue == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return GetMemoryMapEntry (entry);
|
return GetMemoryMapEntry (entry);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
Derived from source code of TrueCrypt 7.1a, which is
|
Derived from source code of TrueCrypt 7.1a, which is
|
||||||
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
by the TrueCrypt License 3.0.
|
by the TrueCrypt License 3.0.
|
||||||
|
|
||||||
Modifications and additions to the original source code (contained in this file)
|
Modifications and additions to the original source code (contained in this file)
|
||||||
and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
and are governed by the Apache License 2.0 the full text of which is
|
and are governed by the Apache License 2.0 the full text of which is
|
||||||
contained in the file License.txt included in VeraCrypt binary and source
|
contained in the file License.txt included in VeraCrypt binary and source
|
||||||
code distribution packages.
|
code distribution packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Bios.h"
|
#include "Bios.h"
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
struct BiosMemoryMapEntry
|
struct BiosMemoryMapEntry
|
||||||
{
|
{
|
||||||
uint64 BaseAddress;
|
uint64 BaseAddress;
|
||||||
uint64 Length;
|
uint64 Length;
|
||||||
uint32 Type;
|
uint32 Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
|
||||||
bool GetFirstBiosMemoryMapEntry (BiosMemoryMapEntry &entry);
|
bool GetFirstBiosMemoryMapEntry (BiosMemoryMapEntry &entry);
|
||||||
bool GetNextBiosMemoryMapEntry (BiosMemoryMapEntry &entry);
|
bool GetNextBiosMemoryMapEntry (BiosMemoryMapEntry &entry);
|
||||||
|
|||||||
+244
-244
@@ -1,244 +1,244 @@
|
|||||||
;
|
;
|
||||||
; Derived from source code of TrueCrypt 7.1a, which is
|
; Derived from source code of TrueCrypt 7.1a, which is
|
||||||
; Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
; Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
|
||||||
; by the TrueCrypt License 3.0.
|
; by the TrueCrypt License 3.0.
|
||||||
;
|
;
|
||||||
; Modifications and additions to the original source code (contained in this file)
|
; Modifications and additions to the original source code (contained in this file)
|
||||||
; and all other portions of this file are Copyright (c) 2013-2015 IDRIX
|
; and all other portions of this file are Copyright (c) 2013-2016 IDRIX
|
||||||
; and are governed by the Apache License 2.0 the full text of which is
|
; and are governed by the Apache License 2.0 the full text of which is
|
||||||
; contained in the file License.txt included in VeraCrypt binary and source
|
; contained in the file License.txt included in VeraCrypt binary and source
|
||||||
; code distribution packages.
|
; code distribution packages.
|
||||||
;
|
;
|
||||||
|
|
||||||
.MODEL tiny
|
.MODEL tiny
|
||||||
.386
|
.386
|
||||||
_TEXT SEGMENT USE16
|
_TEXT SEGMENT USE16
|
||||||
|
|
||||||
INCLUDE BootDefs.i
|
INCLUDE BootDefs.i
|
||||||
|
|
||||||
ORG 7C00h ; Standard boot sector offset
|
ORG 7C00h ; Standard boot sector offset
|
||||||
|
|
||||||
start:
|
start:
|
||||||
; BIOS executes boot sector from 0:7C00 or 7C0:0000 (default CD boot loader address).
|
; 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.
|
; Far jump to the next instruction sets IP to the standard offset 7C00.
|
||||||
db 0EAh ; jmp 0:main
|
db 0EAh ; jmp 0:main
|
||||||
dw main, 0
|
dw main, 0
|
||||||
|
|
||||||
loader_name_msg:
|
loader_name_msg:
|
||||||
db ' VeraCrypt Boot Loader', 13, 10, 0
|
db ' VeraCrypt Boot Loader', 13, 10, 0
|
||||||
|
|
||||||
main:
|
main:
|
||||||
cli
|
cli
|
||||||
xor ax, ax
|
xor ax, ax
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
mov ss, ax
|
mov ss, ax
|
||||||
mov sp, 7C00h
|
mov sp, 7C00h
|
||||||
sti
|
sti
|
||||||
|
|
||||||
; Display boot loader name
|
; Display boot loader name
|
||||||
test byte ptr [start + TC_BOOT_SECTOR_USER_CONFIG_OFFSET], TC_BOOT_USER_CFG_FLAG_SILENT_MODE
|
test byte ptr [start + TC_BOOT_SECTOR_USER_CONFIG_OFFSET], TC_BOOT_USER_CFG_FLAG_SILENT_MODE
|
||||||
jnz skip_loader_name_msg
|
jnz skip_loader_name_msg
|
||||||
|
|
||||||
lea si, loader_name_msg
|
lea si, loader_name_msg
|
||||||
call print
|
call print
|
||||||
skip_loader_name_msg:
|
skip_loader_name_msg:
|
||||||
|
|
||||||
; Determine boot loader segment
|
; Determine boot loader segment
|
||||||
mov ax, TC_BOOT_LOADER_SEGMENT
|
mov ax, TC_BOOT_LOADER_SEGMENT
|
||||||
|
|
||||||
; Check available memory
|
; Check available memory
|
||||||
cmp word ptr [ds:413h], TC_BOOT_LOADER_SEGMENT / 1024 * 16 + TC_BOOT_MEMORY_REQUIRED
|
cmp word ptr [ds:413h], TC_BOOT_LOADER_SEGMENT / 1024 * 16 + TC_BOOT_MEMORY_REQUIRED
|
||||||
jge memory_ok
|
jge memory_ok
|
||||||
|
|
||||||
mov ax, TC_BOOT_LOADER_SEGMENT_LOW
|
mov ax, TC_BOOT_LOADER_SEGMENT_LOW
|
||||||
|
|
||||||
cmp word ptr [ds:413h], TC_BOOT_LOADER_SEGMENT_LOW / 1024 * 16 + TC_BOOT_MEMORY_REQUIRED
|
cmp word ptr [ds:413h], TC_BOOT_LOADER_SEGMENT_LOW / 1024 * 16 + TC_BOOT_MEMORY_REQUIRED
|
||||||
jge memory_ok
|
jge memory_ok
|
||||||
|
|
||||||
; Insufficient memory
|
; Insufficient memory
|
||||||
mov ax, TC_BOOT_LOADER_LOWMEM_SEGMENT
|
mov ax, TC_BOOT_LOADER_LOWMEM_SEGMENT
|
||||||
|
|
||||||
memory_ok:
|
memory_ok:
|
||||||
mov es, ax
|
mov es, ax
|
||||||
|
|
||||||
; Clear BSS section
|
; Clear BSS section
|
||||||
xor al, al
|
xor al, al
|
||||||
mov di, TC_COM_EXECUTABLE_OFFSET
|
mov di, TC_COM_EXECUTABLE_OFFSET
|
||||||
mov cx, TC_BOOT_MEMORY_REQUIRED * 1024 - TC_COM_EXECUTABLE_OFFSET - 1
|
mov cx, TC_BOOT_MEMORY_REQUIRED * 1024 - TC_COM_EXECUTABLE_OFFSET - 1
|
||||||
cld
|
cld
|
||||||
rep stosb
|
rep stosb
|
||||||
|
|
||||||
mov ax, es
|
mov ax, es
|
||||||
sub ax, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE / 16 ; Decompressor segment
|
sub ax, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE / 16 ; Decompressor segment
|
||||||
mov es, ax
|
mov es, ax
|
||||||
|
|
||||||
; Load decompressor
|
; Load decompressor
|
||||||
mov cl, TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR
|
mov cl, TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR
|
||||||
retry_backup:
|
retry_backup:
|
||||||
mov al, TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
|
mov al, TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
|
||||||
mov bx, TC_COM_EXECUTABLE_OFFSET
|
mov bx, TC_COM_EXECUTABLE_OFFSET
|
||||||
call read_sectors
|
call read_sectors
|
||||||
|
|
||||||
; Decompressor checksum
|
; Decompressor checksum
|
||||||
xor ebx, ebx
|
xor ebx, ebx
|
||||||
mov si, TC_COM_EXECUTABLE_OFFSET
|
mov si, TC_COM_EXECUTABLE_OFFSET
|
||||||
mov cx, TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT * TC_LB_SIZE
|
mov cx, TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT * TC_LB_SIZE
|
||||||
call checksum
|
call checksum
|
||||||
push ebx
|
push ebx
|
||||||
|
|
||||||
; Load compressed boot loader
|
; Load compressed boot loader
|
||||||
mov bx, TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET
|
mov bx, TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET
|
||||||
mov cl, TC_BOOT_LOADER_START_SECTOR
|
mov cl, TC_BOOT_LOADER_START_SECTOR
|
||||||
mov al, TC_MAX_BOOT_LOADER_SECTOR_COUNT
|
mov al, TC_MAX_BOOT_LOADER_SECTOR_COUNT
|
||||||
|
|
||||||
test backup_loader_used, 1
|
test backup_loader_used, 1
|
||||||
jz non_backup
|
jz non_backup
|
||||||
mov al, TC_BOOT_LOADER_BACKUP_SECTOR_COUNT - TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
|
mov al, TC_BOOT_LOADER_BACKUP_SECTOR_COUNT - TC_BOOT_LOADER_DECOMPRESSOR_SECTOR_COUNT
|
||||||
mov cl, TC_BOOT_LOADER_START_SECTOR + TC_BOOT_LOADER_BACKUP_SECTOR_COUNT
|
mov cl, TC_BOOT_LOADER_START_SECTOR + TC_BOOT_LOADER_BACKUP_SECTOR_COUNT
|
||||||
|
|
||||||
non_backup:
|
non_backup:
|
||||||
call read_sectors
|
call read_sectors
|
||||||
|
|
||||||
; Boot loader checksum
|
; Boot loader checksum
|
||||||
pop ebx
|
pop ebx
|
||||||
mov si, TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET
|
mov si, TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET
|
||||||
mov cx, word ptr [start + TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET]
|
mov cx, word ptr [start + TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET]
|
||||||
call checksum
|
call checksum
|
||||||
|
|
||||||
; Verify checksum
|
; Verify checksum
|
||||||
cmp ebx, dword ptr [start + TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET]
|
cmp ebx, dword ptr [start + TC_BOOT_SECTOR_LOADER_CHECKSUM_OFFSET]
|
||||||
je checksum_ok
|
je checksum_ok
|
||||||
|
|
||||||
; Checksum incorrect - try using backup if available
|
; Checksum incorrect - try using backup if available
|
||||||
test backup_loader_used, 1
|
test backup_loader_used, 1
|
||||||
jnz loader_damaged
|
jnz loader_damaged
|
||||||
|
|
||||||
mov backup_loader_used, 1
|
mov backup_loader_used, 1
|
||||||
mov cl, TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR + TC_BOOT_LOADER_BACKUP_SECTOR_COUNT
|
mov cl, TC_BOOT_LOADER_DECOMPRESSOR_START_SECTOR + TC_BOOT_LOADER_BACKUP_SECTOR_COUNT
|
||||||
|
|
||||||
test TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE, byte ptr [start + TC_BOOT_SECTOR_CONFIG_OFFSET]
|
test TC_BOOT_CFG_FLAG_BACKUP_LOADER_AVAILABLE, byte ptr [start + TC_BOOT_SECTOR_CONFIG_OFFSET]
|
||||||
jnz retry_backup
|
jnz retry_backup
|
||||||
|
|
||||||
loader_damaged:
|
loader_damaged:
|
||||||
lea si, loader_damaged_msg
|
lea si, loader_damaged_msg
|
||||||
call print
|
call print
|
||||||
lea si, loader_name_msg
|
lea si, loader_name_msg
|
||||||
call print
|
call print
|
||||||
jmp $
|
jmp $
|
||||||
checksum_ok:
|
checksum_ok:
|
||||||
|
|
||||||
; Set up decompressor segment
|
; Set up decompressor segment
|
||||||
mov ax, es
|
mov ax, es
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
cli
|
cli
|
||||||
mov ss, ax
|
mov ss, ax
|
||||||
mov sp, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE
|
mov sp, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE
|
||||||
sti
|
sti
|
||||||
|
|
||||||
push dx
|
push dx
|
||||||
|
|
||||||
; Decompress boot loader
|
; Decompress boot loader
|
||||||
mov cx, word ptr [start + TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET]
|
mov cx, word ptr [start + TC_BOOT_SECTOR_LOADER_LENGTH_OFFSET]
|
||||||
sub cx, TC_GZIP_HEADER_SIZE
|
sub cx, TC_GZIP_HEADER_SIZE
|
||||||
push cx ; Compressed data size
|
push cx ; Compressed data size
|
||||||
push TC_BOOT_LOADER_COMPRESSED_BUFFER_OFFSET + TC_GZIP_HEADER_SIZE ; Compressed data
|
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_MAX_BOOT_LOADER_DECOMPRESSED_SIZE ; Output buffer size
|
||||||
push TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE + TC_COM_EXECUTABLE_OFFSET ; Output buffer
|
push TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE + TC_COM_EXECUTABLE_OFFSET ; Output buffer
|
||||||
|
|
||||||
push cs
|
push cs
|
||||||
push decompressor_ret
|
push decompressor_ret
|
||||||
push es
|
push es
|
||||||
push TC_COM_EXECUTABLE_OFFSET
|
push TC_COM_EXECUTABLE_OFFSET
|
||||||
retf
|
retf
|
||||||
decompressor_ret:
|
decompressor_ret:
|
||||||
|
|
||||||
add sp, 8
|
add sp, 8
|
||||||
pop dx
|
pop dx
|
||||||
|
|
||||||
; Restore boot sector segment
|
; Restore boot sector segment
|
||||||
push cs
|
push cs
|
||||||
pop ds
|
pop ds
|
||||||
|
|
||||||
; Check decompression result
|
; Check decompression result
|
||||||
test ax, ax
|
test ax, ax
|
||||||
jz decompression_ok
|
jz decompression_ok
|
||||||
|
|
||||||
lea si, loader_damaged_msg
|
lea si, loader_damaged_msg
|
||||||
call print
|
call print
|
||||||
jmp $
|
jmp $
|
||||||
decompression_ok:
|
decompression_ok:
|
||||||
|
|
||||||
; DH = boot sector flags
|
; DH = boot sector flags
|
||||||
mov dh, byte ptr [start + TC_BOOT_SECTOR_CONFIG_OFFSET]
|
mov dh, byte ptr [start + TC_BOOT_SECTOR_CONFIG_OFFSET]
|
||||||
|
|
||||||
; Set up boot loader segment
|
; Set up boot loader segment
|
||||||
mov ax, es
|
mov ax, es
|
||||||
add ax, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE / 16
|
add ax, TC_BOOT_LOADER_DECOMPRESSOR_MEMORY_SIZE / 16
|
||||||
mov es, ax
|
mov es, ax
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
cli
|
cli
|
||||||
mov ss, ax
|
mov ss, ax
|
||||||
mov sp, TC_BOOT_LOADER_STACK_TOP
|
mov sp, TC_BOOT_LOADER_STACK_TOP
|
||||||
sti
|
sti
|
||||||
|
|
||||||
; Execute boot loader
|
; Execute boot loader
|
||||||
push es
|
push es
|
||||||
push TC_COM_EXECUTABLE_OFFSET
|
push TC_COM_EXECUTABLE_OFFSET
|
||||||
retf
|
retf
|
||||||
|
|
||||||
; Print string
|
; Print string
|
||||||
print:
|
print:
|
||||||
xor bx, bx
|
xor bx, bx
|
||||||
mov ah, 0eh
|
mov ah, 0eh
|
||||||
cld
|
cld
|
||||||
|
|
||||||
@@: lodsb
|
@@: lodsb
|
||||||
test al, al
|
test al, al
|
||||||
jz print_end
|
jz print_end
|
||||||
|
|
||||||
int 10h
|
int 10h
|
||||||
jmp @B
|
jmp @B
|
||||||
|
|
||||||
print_end:
|
print_end:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; Read sectors of the first cylinder
|
; Read sectors of the first cylinder
|
||||||
read_sectors:
|
read_sectors:
|
||||||
mov ch, 0 ; Cylinder
|
mov ch, 0 ; Cylinder
|
||||||
mov dh, 0 ; Head
|
mov dh, 0 ; Head
|
||||||
; DL = drive number passed from BIOS
|
; DL = drive number passed from BIOS
|
||||||
mov ah, 2
|
mov ah, 2
|
||||||
int 13h
|
int 13h
|
||||||
jnc read_ok
|
jnc read_ok
|
||||||
|
|
||||||
lea si, disk_error_msg
|
lea si, disk_error_msg
|
||||||
call print
|
call print
|
||||||
read_ok:
|
read_ok:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; Calculate checksum
|
; Calculate checksum
|
||||||
checksum:
|
checksum:
|
||||||
push ds
|
push ds
|
||||||
push es
|
push es
|
||||||
pop ds
|
pop ds
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
cld
|
cld
|
||||||
|
|
||||||
@@: lodsb
|
@@: lodsb
|
||||||
add ebx, eax
|
add ebx, eax
|
||||||
rol ebx, 1
|
rol ebx, 1
|
||||||
loop @B
|
loop @B
|
||||||
|
|
||||||
pop ds
|
pop ds
|
||||||
ret
|
ret
|
||||||
|
|
||||||
backup_loader_used db 0
|
backup_loader_used db 0
|
||||||
|
|
||||||
disk_error_msg db 'Disk error', 13, 10, 7, 0
|
disk_error_msg db 'Disk error', 13, 10, 7, 0
|
||||||
loader_damaged_msg db 7, 'Loader damaged! Repair with Rescue Disk', 0
|
loader_damaged_msg db 7, 'Loader damaged! Repair with Rescue Disk', 0
|
||||||
|
|
||||||
ORG 7C00h + 510
|
ORG 7C00h + 510
|
||||||
dw 0AA55h ; Boot sector signature
|
dw 0AA55h ; Boot sector signature
|
||||||
|
|
||||||
_TEXT ENDS
|
_TEXT ENDS
|
||||||
END start
|
END start
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user