truecrypt - 如何在Windows上构建TrueCrypt?

标签 truecrypt

我正在尝试编译TrueCrypt。我正在使用https://github.com/syglug/truecrypt中的说明。

我设置了3个环境变量(pkcsddkMSVC16_ROOT)并在msvc2008中打开了项目。这不是说明中的内容,但是我需要安装NASM,所以我安装了它并将NASM放入PATH。现在,当我建立时,我得到以下内容。即使IDE可以选择cancel build,它仍会结束,编译器没有执行任何操作,并且系统处于空闲状态。

此步骤之后Crypto.lib确实存在

1>------ Build started: Project: Crypto, Configuration: Release Win32 ------
2>------ Build started: Project: Boot, Configuration: Release Win32 ------
3>------ Build started: Project: Driver, Configuration: Release Win32 ------
2>Performing Makefile project actions
3>Performing Makefile project actions
1>Performing Custom Build Step
3>------ Building truecrypt.sys: Release x86 ------
1>Aes_hw_cpu.asm 
2>Microsoft (R) C/C++ Optimizing Compiler Version 8.00c    
2>Copyright (c) Microsoft Corp 1984-1993. All rights reserved.
3>The syntax of the command is incorrect.
3>Project : error PRJ0002 : Error result 255 returned from 'C:\Windows\SysWow64\cmd.exe'.
3>Build log was saved at "file://c:\unzipped\tc\Driver\Release\BuildLog.htm"
3>Driver - 1 error(s), 0 warning(s)
1>Performing Custom Build Step
1>Aes_x86.asm 
1>Compiling...
1>Whirlpool.c
1>Twofish.c
1>Sha2.c
1>Sha1.c
1>Serpent.c
1>Rmd160.c
1>Des.c
1>Cast.c
1>Blowfish.c
1>Aestab.c
1>Aeskey.c
1>Generating Code...
1>Creating library...
1>Build log was saved at "file://c:\unzipped\tc\Crypto\Release\BuildLog.htm"
1>Crypto - 0 error(s), 0 warning(s)


它只是挂了。它没有使用任何CPU,IDE似乎不知道它已失败或已停止。当再次运行我得到这个

1>------ Build started: Project: Boot, Configuration: Release Win32 ------
2>------ Build started: Project: Driver, Configuration: Release Win32 ------
1>Performing Makefile project actions
2>Performing Makefile project actions
2>------ Building truecrypt.sys: Release x86 ------
1>Microsoft (R) C/C++ Optimizing Compiler Version 8.00c    
1>Copyright (c) Microsoft Corp 1984-1993. All rights reserved.
2>The syntax of the command is incorrect.


我已经安装了msvc2012,所以我也尝试过。我遇到同样的问题

1>------ Build started: Project: Crypto, Configuration: Release Win32 ------
2>------ Build started: Project: Boot, Configuration: Release Win32 ------
3>------ Build started: Project: Driver, Configuration: Release Win32 ------
1>  Performing Custom Build Tools
1>  Aes_hw_cpu.asm 
3>  ------ Building truecrypt.sys: Release x86 ------
2>  Microsoft (R) C/C++ Optimizing Compiler Version 8.00c    
2>  Copyright (c) Microsoft Corp 1984-1993. All rights reserved.
2>  
3>  The syntax of the command is incorrect.
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "echo ------ Building truecrypt.sys: Release x86 ------
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: cmd.exe /c BuildDriver.cmd -build -release -x86 "C:\unzipped\tc\\Common" "C:\unzipped\tc\\Crypto" "C:\unzipped\tc\Driver\"
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: if errorlevel 1 exit %errorlevel%
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: echo.
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: echo ------ Building truecrypt.sys: Release x64 ------
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: BuildDriver.cmd -build -release -x64 "C:\unzipped\tc\\Common" "C:\unzipped\tc\\Crypto" "C:\unzipped\tc\Driver\"" exited with code 255.
1>  Performing Custom Build Tools
1>  Aes_x86.asm 
1>  Aeskey.c
1>  Aestab.c
1>  Blowfish.c
1>  Cast.c
1>  Des.c
1>  Rmd160.c
1>  Serpent.c
1>  Sha1.c
1>  Sha2.c
1>  Twofish.c
1>  Whirlpool.c
1>  Generating Code...
1>  Crypto.vcxproj -> C:\unzipped\tc\Crypto\Release\Crypto.lib


当我再次取消/构建时,我得到以下内容

1>------ Build started: Project: Boot, Configuration: Release Win32 ------
2>------ Build started: Project: Driver, Configuration: Release Win32 ------
2>  ------ Building truecrypt.sys: Release x86 ------
2>  The syntax of the command is incorrect.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "echo ------ Building truecrypt.sys: Release x86 ------
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: cmd.exe /c BuildDriver.cmd -build -release -x86 "C:\unzipped\tc\\Common" "C:\unzipped\tc\\Crypto" "C:\unzipped\tc\Driver\"
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: if errorlevel 1 exit %errorlevel%
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: echo.
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: echo ------ Building truecrypt.sys: Release x64 ------
2>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.MakeFile.Targets(38,5): error MSB3073: BuildDriver.cmd -build -release -x64 "C:\unzipped\tc\\Common" "C:\unzipped\tc\\Crypto" "C:\unzipped\tc\Driver\"" exited with code 255.
1>  Microsoft (R) C/C++ Optimizing Compiler Version 8.00c    
1>  Copyright (c) Microsoft Corp 1984-1993. All rights reserved.
1>  


怎么了如何建立TrueCrypt?我正在运行Windows 7 64位

最佳答案

我可以从https://github.com/syglug/truecrypt成功构建所有项目。我主要遵循readme.txt中的说明。由于该说明不够详细,因此我在下面描述了所执行的所有步骤。如果您对某些步骤还有其他疑问,我将提供其他详细信息。

我使用了Windows 7 X64上安装的Visual Studio 2008。如果需要,我可以使用Visual Studio 2010或2012复制相同的内容。


我从MSDN(我已订阅)下载了Visual C ++ 1.52:en_vc152.exe。它是自解压的EXE文件。为了使路径大部分保持简短,并且目录名称中没有空格,我直接在MSVC15中提取了C:\。因此,例如,我在C:\MSVC15\BIN中有16位VC编译器的旧二进制文件。
我将所有从ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20下载的文件放在C:\PKCS-11目录中。像所有依赖文件一样,文件C:\PKCS-11\pkcs11.h将位于同一目录C:\PKCS-11
我从NASM下载了当前版本的http://www.nasm.us/pub/nasm/releasebuilds/2.10.05/ 2.10.05。我在C:\nasm-2.10.05目录中提取了nasm-2.10.05-win32.zip。这样就可以在nasm.exe中找到C:\nasm-2.10.05
我下载了BinariesGzip for Windows。我将gzip-1.3.12-1-bin.zip提取到C:\gzip-1.3.12-1-bin。这样C:\gzip-1.3.12-1-bin\bin包含gzip.exe
我之前已经在目录C:\WinDDK\7600.16385.1中安装了Windows DDK。
我从truecrypt-master.zip下载了https://github.com/syglug/truecrypt。我将其提取到C:\truecrypt-master目录中。这样就可以在Crypto.vcproj目录中找到C:\truecrypt-master\Crypto


因为我不想修改全局环境变量,所以创建了以下批处理文件:

SET MSVC16_ROOT=C:\MSVC15
SET PKCS11_INC=C:\PKCS-11
PATH=C:\nasm-2.10.05;C:\gzip-1.3.12-1-bin\bin;%PATH%
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"


在批处理文件的最后一行,将启动Visual Studio 2008(devenv.exe)。它继承了CMD.EXE(启动Visual Studio 2008的父进程)中设置的所有环境变量。

readme中描述的解决方案文件'TrueCrypt.sln'不包含在github中的源代码中。因此,我打开了在C:\truecrypt-master子目录中找到的每个Project文件,并对其进行了编译。它是Crypto.vcproj(来自C:\truecrypt-master\Crypto),Boot.vcproj(来自C:\truecrypt-master\Boot\Windows),Driver.vcproj(来自C:\truecrypt-master\Driver),Format.vcproj(来自C:\truecrypt-master\Format)和Mount.vcproj(来自C:\truecrypt-master\Mount )。

我可以成功编译所有项目。唯一的小问题是在构建Format.vcprojMount.sln的过程中。文件Format.tlbMount.tlb存在于子目录中。因此,我修复了在C:\truecrypt-master\Format\Format.rcC:\truecrypt-master\Mount\Mount.rc中引用TLB文件的行,

IDR_FORMAT_TLB          TYPELIB                 ".\\Format\\Format.tlb"




IDR_MOUNT_TLB           TYPELIB                 ".\\Mount\\Mount.tlb"


稍后,我将以Pull Request的形式发布与https://github.com/syglug/truecrypt相对应的修复程序。

更新:必须在文件BuildDriver.cmd中更改该行

set TC_BUILD_ARCH=x64 WNET




set TC_BUILD_ARCH=x64


才能构建驱动程序。

另外,应该使用正确的路径(例如"$(SolutionDir)..\Crypto""$(SolutionDir)..\Common")来构建行(请参见Visual Studio中的nmake选项)。如果使用TrueCrypt.sln中的C:\TrueCrypt7.1a,则不需要。

更新2:编译项目后,您将在C:\TrueCrypt7.1a\Release\Setup FilesC:\truecrypt-master\Release\Setup Files文件中看到



文件TrueCrypt Setup.exe仅存在于C:\TrueCrypt7.1a中(从您稍后在评论中发布的链接www.truecrypt.org下载)。正如我在评论中提到的那样,您需要将Visual Studio 2008配置为使用Windows SDK 7而不是默认6.0a才能成功编译安装程序项目。

未编译的驱动程序未使用Microsoft签名进行数字签名。因此,默认情况下Windows 7将不信任驱动程序。因此,要验证驱动程序是否正常运行,您必须在计算机启动期间按F8键并禁用驱动程序签名:



之后,您将能够执行TrueCrypt.exe(例如,从C:\TrueCrypt7.1a\Release\Setup Files目录)。您会得到警告



但是TrueCrypt.exe可以正常工作,您会看到

关于truecrypt - 如何在Windows上构建TrueCrypt?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13379644/

相关文章:

ubuntu - 在 Ubuntu 中登录时挂载 TrueCrypt 卷

linux - 使用 Ansible 自动设置加密分区

security - 多少长度的密码等于 256 位熵

c# - truecrypt 命令提示符命令的问题

javascript - Angular2 通过选择器传递对象

security - 带有 API 的 TrueCrypt 替代方案

linux - Git/Veracrypt EOL hell - 无法丢弃修改过的文件

c# - 是否可以通过其他应用程序使用 TrueCrypt? (C#)

visual-studio - Truecrypt 7.0 版本