1 1.1 christos trousers README 2 1.1 christos 3 1.1 christos Trousers is an open-source TCG Software Stack (TSS), released under 4 1.1.1.2 christos the BSD License. Trousers aims to be compliant with the 5 1.1 christos 1.1b and 1.2 TSS specifications available from the Trusted Computing 6 1.1 christos Group website: 7 1.1 christos 8 1.1 christos http://www.trustedcomputinggroup.org 9 1.1 christos 10 1.1 christos 11 1.1 christos CONTACT 12 1.1 christos 13 1.1 christos For information on the TrouSerS project, please send mail to the 14 1.1 christos following lists: 15 1.1 christos 16 1.1 christos Use of the TSS API and TrouSerS: 17 1.1 christos trousers-users (a] lists.sf.net 18 1.1 christos 19 1.1 christos Discussion of the internals of the TrouSerS implementation: 20 1.1 christos trousers-tech (a] lists.sf.net 21 1.1 christos 22 1.1 christos Possibly sensitive security related bugs: 23 1.1.1.2 christos Hon Ching(Vicky) Lo <honclo (a] linux.vnet.ibm.com> 24 1.1 christos 25 1.1 christos Run-of-the-mill bug reports should use the TrouSerS bug tracker: 26 1.1 christos http://sourceforge.net/tracker/?group_id=126012&atid=704358 27 1.1 christos 28 1.1 christos 29 1.1 christos BUILD REQUIREMENTS 30 1.1 christos 31 1.1 christos Packages needed to build: 32 1.1 christos 33 1.1 christos automake > 1.4 34 1.1 christos autoconf > 1.4 35 1.1 christos pkgconfig 36 1.1 christos libtool 37 1.1 christos gtk2-devel 38 1.1 christos openssl-devel >= 0.9.7 39 1.1 christos pthreads library (glibc-devel) 40 1.1 christos 41 1.1 christos 42 1.1 christos BUILDING the TSS 32-bit 43 1.1 christos 44 1.1 christos Build and install the latest TPM device driver from 45 1.1 christos sf.net/projects/tpmdd either compiled in or loaded as a 46 1.1 christos module. UPDATE: This driver is now included in the vanilla 2.6.12 47 1.1 christos kernel! If you are doing this, trousers should just work after a 48 1.1 christos vanilla build. Follow the build instructions below and read 49 1.1 christos RUNNING the TSS, below. 50 1.1 christos 51 1.1 christos To build trousers after you have the device driver installed: 52 1.1 christos 53 1.1 christos $ sh bootstrap.sh 54 1.1 christos $ ./configure [--enable-debug] [--enable-gprof] [--enable-gcov] 55 1.1 christos $ make 56 1.1 christos # make install 57 1.1 christos 58 1.1 christos Here are the default locations of files that trousers installs: 59 1.1 christos 60 1.1 christos /usr/local/sbin/tcsd 61 1.1 christos /usr/local/etc/tcsd.conf 62 1.1 christos /usr/local/lib/libtspi.so.0.0.X 63 1.1 christos /usr/local/lib/libtspi.so.0 -> libtspi.so.0.0.X 64 1.1 christos /usr/local/lib/libtspi.so -> libtspi.so.0.0.X 65 1.1 christos /usr/local/lib/libtspi.la 66 1.1 christos /usr/local/lib/libtddl.a 67 1.1 christos /usr/local/var/lib/tpm 68 1.1 christos 69 1.1 christos By default the build will place everything in /usr/local. To install 70 1.1 christos in a slightly more predictable place, use `./configure --prefix=/usr`. 71 1.1 christos 72 1.1 christos 'make install' will run ldconfig, but if /usr/local/lib is not in 73 1.1 christos your /etc/ld.so.conf, this won't make a difference. You may need to 74 1.1 christos manually add it and run ldconfig as root to allow your apps to link at 75 1.1 christos run time to libtspi.so. 76 1.1 christos 77 1.1 christos 78 1.1 christos BUILDING the TSS 64-bit 79 1.1 christos 80 1.1 christos TrouSerS has been built and tested on ppc64 and x86_64, so please 81 1.1 christos don't hesitate to report bugs on these platforms. Building everything 82 1.1 christos 64-bit will require a few more flags than are necessary for a 32-bit 83 1.1 christos platform. Here are some example instructions for ppc64: 84 1.1 christos 85 1.1 christos $ sh bootstrap.sh 86 1.1 christos $ export PKG_CONFIG_PATH=/usr/lib64/pkgconfig 87 1.1 christos $ CFLAGS="-L/usr/lib64 -L/opt/gnome/lib64" LDFLAGS="-L/usr/lib64 \ 88 1.1 christos -L/opt/gnome/lib64" ./configure --libdir="/usr/local/lib64" 89 1.1 christos $ make 90 1.1 christos # make install 91 1.1 christos 92 1.1 christos Hopefully the above example will get you going on building in your 93 1.1 christos 64-bit environment. If you need to do anything special, please send 94 1.1 christos your build steps to trousers-users (a] lists.sf.net and I'll include it 95 1.1 christos here. 96 1.1 christos 97 1.1 christos 98 1.1 christos USING TROUSERS ON AN ALREADY OWNED TPM 99 1.1 christos 100 1.1 christos If you've already taken ownership of your TPM using a TSS under another 101 1.1 christos operating system, there are a few issues you should be aware of. 102 1.1 christos 103 1.1 christos Auth vs No-Auth SRK: In order to trick trousers into thinking it has taken 104 1.1 christos ownership of the TPM it's running on, you will need to create a persistent 105 1.1 christos storage file for trousers to use. Normally trousers would create this file 106 1.1 christos itself at the time ownership is taken. If your SRK has been given an 107 1.1 christos authorization password by the non-Linux OS, you will need to move the file 108 1.1 christos dist/system.data.auth to /usr/local/var/lib/tpm/system.data. If you've 109 1.1 christos taken ownership of your TPM without issuing a password, move 110 1.1 christos dist/system.data.noauth to /usr/local/var/lib/tpm/system.data. 111 1.1 christos 112 1.1 christos Passwords: When entering passwords for keys you'd like to use in both 113 1.1 christos Linux and other OS's, you'll need to take note of how you entered those 114 1.1 christos passwords. The TSS spec states that when a password is entered through a 115 1.1 christos GUI popup dialog box provided by the TSS library, the password should be 116 1.1 christos converted to the UTF-16 encoding and then hashed using SHA-1, including 117 1.1 christos the UTF-16 null terminator in the hash calculation. 118 1.1 christos 119 1.1 christos In order to work around this problem, specify the -u option to the 120 1.1 christos tpm-tools command line to convert the password to UTF-16 before hashing. 121 1.1 christos This, however, unfolds yet another problem... 122 1.1 christos 123 1.1 christos Some TSS stacks aren't compliant with the TSS spec, in that they hash 124 1.1 christos their passwords without including the terminating null character. This 125 1.1 christos means that there are effectively two versions of any password set through 126 1.1 christos a popup dialog box. Trousers will include the terminating null character 127 1.1 christos in its hashes of UTF-16 data. 128 1.1 christos 129 1.1 christos We'll do our best to track other TSS software and how it behaves. Please 130 1.1 christos see the trousers FAQ at http://trousers.sf.net for more information. 131 1.1 christos 132 1.1 christos 133 1.1 christos ARCHITECTURE 134 1.1 christos 135 1.1 christos This TSS implementation has several components. 136 1.1 christos 137 1.1 christos A) The TCS Daemon - A user space daemon that should be (according to 138 1.1 christos the TSS spec) the only portal to the TPM device driver. At boot 139 1.1 christos time, the TCS Daemon should be started, it should open the TPM 140 1.1 christos device driver and from that point on, all requests to the TPM 141 1.1 christos should go through the TSS stack. The TCSD manages TPM resources 142 1.1 christos and handles requests from TSP's both local and remote. 143 1.1 christos 144 1.1 christos B) The TSP shared library - The TSP (TCG Service Provider) is a 145 1.1 christos shared library that enables applications to talk to TCSD's both 146 1.1 christos locally and remotely. The TSP also manages resources used in 147 1.1 christos commicating with the application and the TCSD and transparently 148 1.1 christos contacts the TCSD whenever necessary. 149 1.1 christos 150 1.1 christos C) Persistent Storage (PS) files - TSS's have 2 different kinds of 151 1.1 christos PS for keys. PS can be thought of as a database for keys, with 152 1.1 christos each key in the database indexed by a UUID. 153 1.1 christos 154 1.1 christos 'User' persistent storage is maintained by the application's TSP 155 1.1 christos library. Upon writing the first key to User PS, the TSP library 156 1.1 christos creates a new file at ~/.trousers/user.data, using the effective 157 1.1 christos user id of the process executing the call to find ~. An environment 158 1.1 christos variable, TSS_USER_PS_FILE, can also be set to point the TSP library 159 1.1 christos to a different location for the User PS. This environment variable 160 1.1 christos has the lifetime of the TSP context, so to store 2 keys in 2 161 1.1 christos different files, you will need to call Tspi_Context_Close, set the 162 1.1 christos new location, and open the context again. 163 1.1 christos 164 1.1 christos 'System' persistent storage is controlled by the TCS and stays 165 1.1 christos valid across all application lifetimes, TCSD restarts and system 166 1.1 christos resets. Data registered in system PS stays valid until an application 167 1.1 christos requests that it be removed. The System PS file by default is 168 1.1 christos /usr/local/var/lib/tpm/system.data. The system PS file is initially 169 1.1 christos created when ownership of the TPM is first taken. 170 1.1 christos 171 1.1 christos D) A config file. By default located in /usr/local/etc/tcsd.conf. 172 1.1 christos 173 1.1 christos 174 1.1 christos RUNNING the TSS 175 1.1 christos 176 1.1 christos By default, the TCS daemon is not reachable over the internet, so if 177 1.1 christos you just plan to access it locally, running it as root with a root owned 178 1.1 christos device node is probably ok. Just make sure your device driver is loaded 179 1.1 christos and start the tcsd as root. 180 1.1 christos 181 1.1 christos If you would like to run the TCS daemon as an unprivleged user, 182 1.1 christos please follow these instructions: 183 1.1 christos 184 1.1 christos If you're using the device driver from a linux 2.6.12+ kernel and have 185 1.1 christos udev enabled, you need to add the following line to your 186 1.1 christos udev.permissions file (usually in /etc/udev somewhere): 187 1.1 christos 188 1.1 christos tpm[0-9]:tss:tss:0600 189 1.1 christos 190 1.1 christos and then just load the device driver with: 191 1.1 christos # modprobe tpm_atmel 192 1.1 christos or, 193 1.1 christos # modprobe tpm_natl 194 1.1 christos 195 1.1 christos start the TCS Core Services daemon, by default /usr/local/sbin/tcsd. 196 1.1 christos # /usr/local/sbin/tcsd 197 1.1 christos 198 1.1 christos If you're attempting to make the TCS Core Services daemon communicate with a 199 1.1 christos softwware TPM through TCP, you must call it using the -e option. 200 1.1 christos 201 1.1 christos # /usr/local/sbin/tcsd -e 202 1.1 christos 203 1.1 christos The default values for hostname, port and UN socket device path are "localhost", 204 1.1 christos "6545" and "/var/run/tpm/tpmd_socket:0". It will search for the IN socket device, 205 1.1 christos then for an UN socket one, and then for the real TPM in this order. 206 1.1 christos The default values match with the current open source project required values, if 207 1.1 christos for instance case you need to set values of your choice, the environment variables 208 1.1 christos for them are TCSD_TCP_DEVICE_HOSTNAME, TCSD_TCP_DEVICE_PORT if using an IN socket 209 1.1 christos and TCSD_UN_SOCKET_DEVICE_PATH if running an UN socket. 210 1.1 christos 211 1.1 christos 212 1.1 christos DEBUGGING 213 1.1 christos 214 1.1 christos If you've compiled trousers with './configure --enable-debug' and would like 215 1.1 christos to turn debugging output off at run-time, set the environment variable 216 1.1 christos TSS_DEBUG_OFF to any value. 217 1.1 christos 218 1.1 christos 219 1.1 christos BUILDING a TSS RPM 220 1.1 christos 221 1.1 christos # sh bootstrap.sh 222 1.1 christos # ./configure 223 1.1 christos # cd .. 224 1.1 christos # mv trousers trousers-${version} 225 1.1 christos # tar zcvf /usr/src/packages/SOURCES/trousers-${version}.tar.gz \ 226 1.1 christos trousers-${version} 227 1.1 christos # rpmbuild -bb trousers-${version}/dist/trousers.spec 228 1.1 christos 229 1.1 christos EOF 230