How to compile truecrypt source code

Source: Internet
Author: User
Tags gzip download studio vc truecrypt download

Related Configuration
  • Intel x86 Core 2 duo
  • Windows 7 Ultimate x86 version
  • Windows Driver Develop Kit 7600.16385.0
  • Truecrypt 6.3a source.zip
  • Microsoft Visual Studio 2008 SP1 (VC ++ 2008)
  • Microsoft Visual Studio VC +++ 1.52
  • NASM version 2.07 compiled on Jul 19 2009
  • Gzip 1.2.4 Win32 (02 Dec 97)
  • ......



Configure truecrypt

  1. Download msvc ++ 1.52 and install it on drive c: \ msvc
  2. Download NASM and install it on drive c: \ NASM.
    Http://www.nasm.us/pub/nasm/releasebuilds/2.07/win32/
  3. Download gzip and install it on drive c: \ gzip.
  4. Download and install winddk and http://www.microsoft.com/whdc/DevTools/WDK/WDKpkg.mspx
    I will install them on drive D, path: D: \ winddk
  5. Set system variables (win7) Control Panel \ All control panel items \ System \ Advanced System settings \ environment variables): In system variables, add:
    Variable 1: msvc16_root value: C: \ msvc
    Variable 2: winddk_root value: D: \ winddk \ 7600.16385.0
    7600.16385.0 is the second-level directory name of winddk, and is also the version number. 7600 is the release version number of Windows 7.
    Double-click the variable: path and add c: \ NASM; C: \ gzip at the end of the value.
    The purpose is to allow us to use NASM and gzip as command lines directly on the command line.
  6. Download pkcs11, three files, right-click and save.
    Http://svn.openvpn.net/projects/openvpn/test/time/openvpn/pkcs11-headers/
    Put the three files (pkcs11.h, pkcs11f. h. pkcs11t. h) copy to the common folder under the source code. Put the source code in the root directory of drive D, and put the three source codes in the "D: \ truecrypt \ common" folder.
  7. Compilation, two errors will be found.
    Ckr_new_pin_mode and ckr_next_otp are not defined. Just define them.
    In the D: \ truecrypt \ common \ pkcs11t. h file (copy according to your own path)
    Here they are set:
    # Define ckr_new_pin_mode 0x000001b0
    # Define ckr_next_otp 0x000001b1

    My method is to find similar statements near the useful statements, find the same definition, and add it below.
    For example:
    Tc_token_err (ckr_mutex_not_locked)
    Tc_token_err (ckr_new_pin_mode)
    Tc_token_err (ckr_next_otp)

    These three sentences are put together, and the last two sentences have a problem, but the first sentence is normal, search for the location where ckr_mutex_not_locked is stored, and add the above two sentences below it. The defined values refer
    Bytes.

  8. Compile again and you may encounter some warnings:
    1. Nasm.exe is stopping. Because the execution is not properly executed, the "Fatal error lnk1136: Invalid or invalid upt file" error occurs.
      This may be because your NASM is trying to compile the ase_amdx64.asm file, while NASM may not make much sense to you for 64-bit ASM compilation, at least for me, so, I will convert it into compiling the X86 architecture. Maybe it is because of parameter configuration problems. You can try another solution. If it is better, please let me know.
      Here I search for: x64, ASM, and other keywords. Modify the D: \ truecrypt \ crypto \ makefile. inc file as follows:
      Line 1! If "$ (tc_arch)" = "x86"
      Row 2 tc_obj_format = Win32
      Row 3! Else
      Row 4 # tc_obj_format = win64
      Row 5 # edit by gocool, if the x64 system need the nasm.exe use the x64 format parameters for executing.
      Row 6 # abort the x64 system here for building.
      Row 7 #2009/12/23
      Row 8 tc_obj_format = Win32
      Row 9 tc_arch = x86
      Line 10! Endif
      Row 11
      Row 12 "$ (obj_path) \ $ (o) \ AES _ $ (tc_arch). OBJ": AES _ $ (tc_arch). ASM
      Row 13 nasm.exe-xvc-F $ (tc_obj_format)-ox-D dll_export-o "$ @"-l "$ (obj_path) \ $ (o) \ AES _ $ (tc_arch ). lst "AES _ $ (tc_arch ). ASM

      To reduce the number of changes and facilitate future recovery, I will also define non-x86 situations as x86 situations in line 4-7 behavior annotations, 8th and 9, in this way, the following 13th rows of statements will be executed with the x86 system as the structure, and such settings are usually correct.

    2. Fatal error lnk1000: Internal error during incrbuildimage
      It is said to be a bug in Microsoft Visual Studio 2008. Http://blog.csdn.net/just_one_two/archive/2009/10/05/4634391.aspx
      I have heard that there are two methods. One is method 1. I didn't try to download the patch. The second method is successful by modifying the configuration. The steps are as follows:
      Method: choose Project> Properties> linker> enable incremental Link under general, and change "Yes (/Incremental)" to "no (/Incremental: No )".
      However, this introduces another warning: 3> formatcom. OBJ: Warning lnk4075: Ignore "/editandcontinue" (due to the "/Incremental: No" Specification)
      Select a project, Properties> Configuration Properties> C/C ++, and change "debugging information format" to "program database (/Zi.
    3. Warning the following environment variables are not found
      4> Project: Warning prj0018: The following environment variables are not found:
      4> $ (pkcs11_inc)

      Because the "$ (pkcs11_inc)" directory is added to the project property, the pkcs11_inc project will be searched for in the system variable during compilation. If the pkcs11_inc project cannot be found, a warning will be given. Therefore, we need to manually add this item. In step 5, add a variable pkcs11_inc with the value D: \ truecrypt \ common. The value is the three files we copied before (pkcs11.h, pkcs11f. h. pkcs11t. h.

    4. If nothing happens, you may also get an error with a declaration that uses pkey_appusermodel_id undefined. This is the unique identifier used to identify user-State applications. You can define/* --- region add by GC --- */in the setup. h file ---*/
      # Include "wtypes. H"
      Const propertykey pkey_appusermodel_id = {
      {
      (Unsigned long) 2009,/* unsigned long data1 ;*/
      (Unsigned short) 12,/* unsigned short data2 ;*/
      (Unsigned short) 23,/* unsigned short data3 ;*/
      0x44,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55
      },/* Guid fmtid ;*/
      (DWORD) pid_first_usable/* dword pid ;*/
      };
      /* --- Endregion ---*/

      The struct is composed of guid and PID.

Download link
  • Truecrypt download: http://www.sfr-fresh.com/windows/misc/TrueCrypt-6.2a-Source.zip:a/Boot/Windows/Makefile
  • Winddk download
  • Pkcs11 download: http://svn.openvpn.net/projects/openvpn/test/time/openvpn/pkcs11-headers/
  • Gzip download: http://www.gzip.org/or http://www.gzip.org/gz124src.zip
  • NASM download: http://www.nasm.us/pub/nasm/releasebuilds/2.07/win32/
  • Msvc1.52 download: http://download.csdn.net/source/620960 (15.02 MB) (it seems that many people on the Internet are looking for 1.52 (the last VC compiler that can compile 16 bit programs), but there is no public download link on the official website, it's really depressing. I subscribe to and download from msdn (67.6 MB for free). If you cannot find the download or 15.02mb is unavailable, contact me.

    Reference
    • Http://blog.csdn.net/skyremember/archive/2009/09/17/4562090.aspx
    • Http://blog.sina.com.cn/s/blog_4758691d0100d8mc.html
    • Http://lll332.blog.163.com/blog/static/1553692220093404635752/
    • Http://msdn.microsoft.com/en-us/library/aa373931%28VS.85%29.aspx
    • Http://hi.baidu.com/hhacker/blog/item/2fc5b3fb0b24132a4f4aea1d.html
    • Http://blog.csdn.net/just_one_two/archive/2009/10/05/4634391.aspx
    • Http://blog.csdn.net/liufei_learning/archive/2009/12/21/5047632.aspx
    • Http://msdn.microsoft.com/zh-cn/library/958x11bc%28VS.80%29.aspx
    • Http://bbs.xiakexing.com/cgi-bin/topic.cgi? Forum = 22 & topic = 498
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.