Computer and Network Security Group |
|
TORSEC
TrouSerS for Windows
|
|
|
TrouSerS for Windows Vista and Windows 7
The open source TCG Software Stack (TSS) ... now for Windows Vista and Windows 7!
The lack of an open source TSS for Windows is a pain for many developers and researchers.
In order to fill this gap, we ported TrouSerS to Windows.
Currently it is only a partial porting which runs on Windows Vista and Windows 7.
We were able to compile it natively under Windows using Microsoft Visual Studio and to cross-compile it from a Fedora Linux using MinGW.
We are working to enhance it for full compatibility with upstream TrouSerS.
Download
This work is released with the same licence as TrouSerS.
Download the Windows installer (see instructions below)
Download the source:
Changelog
(20111017) improved description on building TrouSerS using MS Visual Studio
(20101105) patch for TrouSerS 0.3.6
- tcsd can be executed either as a Windows service or from command line
- solved a file lock issue
- tcsd log written in the file C:\Trousers\tcsd_log.txt
- fixed random nonce generation
- Windows-specific code moved to the new folder src/win32
- added support for the emulator for Windows
- TSP DLL is now created by MinGW
(20100916) patch for TrouSerS 0.3.4
- multi-thread support
- tcsd can act as a Windows service
Current Limitations
Currently this porting has the following limitations:
TrouSerS for Windows is tested on Windows Vista and Windows 7.
Previous versions of Windows are not supported because this work is based on the TPM Base Services.
Windows Installer
- download and run the Windows installer Setup.exe
- run a sample
- click on Start
- click on All Programs
- click on TrouSerS for Windows
- click on Samples
- run a sample program between createkey.exe, loadkey.exe, rand.exe, takeown.exe
Working with the patch
- download the patch trousers-0.3.6-windows.patch
- download the source from TrouSerS site trousers-0.3.6.tar.gz
- unpack the source, apply the patch and run autoreconf. Note some files in TrouSerS end lines with CRLF and for this our patch fails to apply. We consider this a TrouSerS bug and we suggest to run dos2unix to fix (at least) these files. Our tarball does not contain any CRLF.
- tar -xvzf trousers-0.3.6.tar.gz
- cd trousers-0.3.6
- dos2unix src/include/tss/*
- patch -p1 < /path/to/trousers-0.3.6-windows.patch
- skip the patch for files man/man3/Tspi_TPM_Quote2.3 and include/tss/TSP.idl because they are not present in the released tarball
- autoreconf --install
- compile as usual (or refer to VS or MinGW instructions below)
- ./configure
- make
- ...
MS Visual Studio
Prerequisites
In order to build this software with MS Visual Studio you will need:
If anyone succeeds to run it on other versions of the software and libraries, feel free to report.
Building TrouSerS for Windows (with Visual Studio)
For building TrouSerS using MS Visual Studio:
- run Visual Studio
- click on File -> Open -> Project / Solution
- select the downloaded project file
- click on Build -> Build Solution
Testing TrouSerS for Windows
For testing TrouSerS:
- copy pthreadVC2.ddl, libiconv2.dll and libcharset1.dll into C:\Windows\System32
- install the tcsd service using InstallService.exe
- use the MS Service Management Console to start the TCSD service
- run the example program provided with the pack
- have fun with your new TPM under Windows
MinGW
Building TrouSerS for Windows (with MinGW)
TODO
Cross-compiling TrouSerS for Windows from Linux
We tested it on Fedora Core 12 and installed the following packages:
- mingw32-binutils
- mingw32-cpp
- mingw32-dlfcn
- mingw32-expath
- mingw32-filesystem
- mingw32-gcc
- mingw32-gcc-c++
- mingw32-gettext
- mingw32-gtk2
- mingw32-iconv
- mingw32-libgcrypt
- mingw32-libltdl
- mingw32-pthreads
- mingw32-runtime
- mingw32-w32api
(OK, some of them may be not necessary. If you find which are the strictly necessary ones, please report it ;-)
You also need tbs.lib in the path /path/to/mingw/sys-root/mingw/bin (distributed with Visual Studio and MSDN SDK).
In order to obtain this file without installing the SDK you must follow these steps:
- extract all the content for our distributed tarball in the working directory WORKINGDIR;
- pick the file tbs.dll from C:\Windows\System32 in your Windows partition and copy it in WORKINGDIR; (be sure to obtain the 32 bit version of the DLL)
- execute: cd WORKINGDIR
- execute: cp trouserswin/dist/tbs.def .
- execute: /path/to/mingw/bin/dlltool -U --export-all-symbols -d tbs.def -D tbs.dll -l tbs.lib
- execute: cp tbs.lib /path/to/mingw/sys-root/mingw/lib
- execute: cp trouserswin/dist/tbs.h /path/to/mingw/sys-root/mingw/include
At this point you are ready to start the cross-compilation procedure.
First, you must cross-compile OpenSSL for Windows:
- Follow the instructions in file openssl/INSTALL.W32 for MinGW ;-)
Then, you can cross-compile TrouSerS for Windows:
- cd WORKINGDIR/trouserswin
- mingw32-configure [--enable-debug] [--prefix=/path/to/mingw/sys-root/mingw]
- mingw32-make
- mingw32-make install (mainly needed for installing libraries for future application cross-compilation)
After the procedure is done you have obtained the TSP interface library libtspi.dll.a which is located in /path/to/mingw/sys-root/mingw/lib
and the TSP DLL libtspi-1.dll which is located in /path/to/mingw/sys-root/mingw/bin.
The file libtspi-1.dll must be placed in your Windows partition in C:\Windows\System32 or in the same directory you will run the compiled application.
Finally, if you want to cross-compile an application for Windows using TrouSerS, you must use the following command:
/usr/bin/i686-pc-mingw32-gcc -o yourapp.exe yourapp.c -ltspi [additional LDFLAGS].
Testing TrouSerS for Windows
- copy tcsd.exe from src/tcsd/.libs/ to Windows partition
- copy pthreadGC2.dll and libeay32.dll from /path/to/mingw/bin to Windows partition (same directory as tcsd.exe or C:\Windows\System32
- run tcsd.exe as administrator
- run the example program provided with the pack
- alternatively you can connect from a remote tsp (experimental)
- have fun with your new TPM under Windows
Feedback
For any feedback or comment, please write us at the following addresses:
- giovanni dot cabiddu at polito dot it
- emanuele dot cesena at polito dot it
- roberto dot sassu at polito dot it
- davide dot vernizzi at polito dot it
Last modified on Monday, 17-Oct-2011 16:11:02