osunix / osunix-overlay (http://osunix.org/)

This is all the build scripts, patches and misc bits for the osunix build tree. Please file any bug reports @ http://bugs.osunix.org

Clone this repository (size: 4.6 MB): HTTPS / SSH
$ hg clone http://hg.pathscale.com/osunix-overlay
commit 247: 892349c9df7d
parent 246: a211947ed6b9
branch: default
# Added the tpm trousers dep
ro...@crash
16 months ago

Changed (Δ61.8 KB):

raw changeset »

app-crypt/trousers/ChangeLog (115 lines added, 0 lines removed)

app-crypt/trousers/Manifest (9 lines added, 0 lines removed)

app-crypt/trousers/files/Makefile.in.patch (127 lines added, 0 lines removed)

app-crypt/trousers/files/configure.in.patch (83 lines added, 0 lines removed)

app-crypt/trousers/files/dist-no-useradd-Makefile.am.patch (20 lines added, 0 lines removed)

app-crypt/trousers/files/dist-no-useradd-Makefile.in.patch (10 lines added, 0 lines removed)

app-crypt/trousers/files/hosttable.c.patch (17 lines added, 0 lines removed)

app-crypt/trousers/files/platform.c.patch (51 lines added, 0 lines removed)

app-crypt/trousers/files/ps_utils.c.patch (36 lines added, 0 lines removed)

app-crypt/trousers/files/ssl_ui.c.patch (94 lines added, 0 lines removed)

app-crypt/trousers/files/svrside.c.patch (164 lines added, 0 lines removed)

app-crypt/trousers/files/symmetric.c.patch (14 lines added, 0 lines removed)

app-crypt/trousers/files/tcs_auth_mgr.c.patch (76 lines added, 0 lines removed)

app-crypt/trousers/files/tcs_key_mem_cache.c.patch (27 lines added, 0 lines removed)

app-crypt/trousers/files/tcs_pbg.c.patch (61 lines added, 0 lines removed)

app-crypt/trousers/files/tcsd.8.in.patch (104 lines added, 0 lines removed)

app-crypt/trousers/files/tcsd.h.patch (28 lines added, 0 lines removed)

app-crypt/trousers/files/tcsd_conf.c.patch (126 lines added, 0 lines removed)

app-crypt/trousers/files/tcslog.h.patch (15 lines added, 0 lines removed)

app-crypt/trousers/files/tcsps.c.patch (141 lines added, 0 lines removed)

app-crypt/trousers/files/tcsps.h.patch (21 lines added, 0 lines removed)

app-crypt/trousers/files/tddl.c.patch (79 lines added, 0 lines removed)

app-crypt/trousers/files/trousers.c.patch (36 lines added, 0 lines removed)

app-crypt/trousers/files/tsp_auth.c.patch (47 lines added, 0 lines removed)

app-crypt/trousers/files/tsp_policy.c.patch (85 lines added, 0 lines removed)

app-crypt/trousers/files/tsp_ps.c.patch (14 lines added, 0 lines removed)

app-crypt/trousers/files/tspi_Makefile.in.patch (19 lines added, 0 lines removed)

app-crypt/trousers/files/tspi_aik.c.patch (14 lines added, 0 lines removed)

app-crypt/trousers/files/tspi_delegate.c.patch (86 lines added, 0 lines removed)

app-crypt/trousers/files/tspi_makefile.am.patch (15 lines added, 0 lines removed)

app-crypt/trousers/files/tspps.c.patch (278 lines added, 0 lines removed)

app-crypt/trousers/files/tspps.h.patch (35 lines added, 0 lines removed)

app-crypt/trousers/metadata.xml (9 lines added, 0 lines removed)

app-crypt/trousers/trousers-0.3.1.ebuild (102 lines added, 0 lines removed)

Up to file-list app-crypt/trousers/ChangeLog:

1
# ChangeLog for app-crypt/trousers
2
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
3
# $Header: /var/cvsroot/gentoo-x86/app-crypt/trousers/ChangeLog,v 1.21 2009/03/29 15:19:32 arfrever Exp $
4
5
  29 Mar 2009; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
6
  trousers-0.3.1.ebuild:
7
  Add ~amd64 keyword.
8
9
  22 Mar 2009; Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org>
10
  trousers-0.3.1.ebuild:
11
  Don't use -Werror (bug #260873).
12
13
  20 Feb 2009; Daniel Black <dragonheart@gentoo.org> trousers-0.3.1.ebuild:
14
  app-crypt/tpm-module being purged
15
16
  23 Jul 2008; Peter Alfredsen <loki_val@gentoo.org>
17
  files/trousers-0.2.3-nouseradd.patch, +files/trousers-0.3.1-gcc43.patch,
18
  trousers-0.3.1.ebuild:
19
  Fix for gcc-4.3, tidy up ebuild. Bug #232521. Thanks to Shvetsov Alexey
20
  <alexxyum@gmail.com>
21
22
  07 Jun 2008; Diego Pettenò <flameeyes@gentoo.org> trousers-0.3.1.ebuild:
23
  Remove unused inherits that were used to patch and re-autotools before.
24
25
  24 Nov 2007; Alon Bar-Lev <alonbl@gentoo.org>
26
  +files/trousers-0.3.1-qa.patch, trousers-0.3.1.ebuild:
27
  Fix 64bit issue, bug#200218, thanks to dev-zero
28
29
*trousers-0.3.1 (10 Nov 2007)
30
31
  10 Nov 2007; Alon Bar-Lev <alonbl@gentoo.org>
32
  -files/trousers-0.2.1-nouseradd.patch, -files/trousers-0.2.3-ldadd.patch,
33
  -files/trousers-0.2.6-as-needed.patch, -trousers-0.2.1.ebuild,
34
  -trousers-0.2.3.ebuild, -trousers-0.2.5.ebuild, -trousers-0.2.6.ebuild,
35
  -trousers-0.2.8.ebuild, +trousers-0.3.1.ebuild:
36
  Version bump, cleanup
37
38
  24 Jan 2007; Marius Mauch <genone@gentoo.org> trousers-0.2.1.ebuild,
39
  trousers-0.2.3.ebuild, trousers-0.2.5.ebuild, trousers-0.2.6.ebuild,
40
  trousers-0.2.8.ebuild:
41
  Replacing einfo with elog
42
43
  12 Jan 2007; Alon Bar-Lev <alonbl@gentoo.org> trousers-0.2.8.ebuild:
44
  Remove WANT_AUTO*
45
46
*trousers-0.2.8 (06 Jan 2007)
47
48
  06 Jan 2007; Alon Bar-Lev <alonbl@gentoo.org> +trousers-0.2.8.ebuild:
49
  Version bump
50
51
*trousers-0.2.6 (06 May 2006)
52
53
  06 May 2006; Daniel Black <dragonheart@gentoo.org>
54
  +files/trousers-0.2.6-as-needed.patch, +trousers-0.2.6.ebuild:
55
  version bump
56
57
  27 Apr 2006; Alec Warner <antarus@gentoo.org> files/digest-trousers-0.2.1,
58
  files/digest-trousers-0.2.3, Manifest:
59
  Fixing duff SHA256 digests: Bug # 131293
60
61
*trousers-0.2.5 (02 Feb 2006)
62
63
  02 Feb 2006; Daniel Black <dragonheart@gentoo.org> +trousers-0.2.5.ebuild:
64
  version bump
65
66
*trousers-0.2.3 (17 Sep 2005)
67
68
  17 Sep 2005; Daniel Black <dragonheart@gentoo.org>
69
  -files/trousers-0.2.0-nouseradd.patch, +files/trousers-0.2.3-ldadd.patch,
70
  +files/trousers-0.2.3-nouseradd.patch, -trousers-0.1.11-r1.ebuild,
71
  -trousers-0.2.0.ebuild, +trousers-0.2.3.ebuild:
72
  version bump. remove old versions - inspiried by bug #105799 thanks to Felix
73
  Dorner
74
75
  23 Aug 2005; Daniel Black <dragonheart@gentoo.org>
76
  trousers-0.1.11-r1.ebuild, trousers-0.2.0.ebuild, trousers-0.2.1.ebuild:
77
  QA fix removing /bin/false from enewuser - bug #103421
78
79
*trousers-0.2.1 (30 Jul 2005)
80
81
  30 Jul 2005; Daniel Black <dragonheart@gentoo.org>
82
  +files/trousers-0.2.1-nouseradd.patch, +trousers-0.2.1.ebuild:
83
  version bump
84
85
*trousers-0.2.0 (06 Jul 2005)
86
87
  06 Jul 2005; Daniel Black <dragonheart@gentoo.org>
88
  +files/trousers-0.2.0-nouseradd.patch, +trousers-0.2.0.ebuild:
89
  version bump. tpm udev is now part of udev-060
90
91
  23 Jun 2005; Daniel Black <dragonheart@gentoo.org>
92
  trousers-0.1.11-r1.ebuild:
93
  udev fix thanks to latexer
94
95
*trousers-0.1.11-r1 (23 Jun 2005)
96
97
  23 Jun 2005; Daniel Black <dragonheart@gentoo.org>
98
  -files/0.1.7-makefile-statedir.patch, files/tcsd.initd,
99
  -trousers-0.1.7.ebuild, -trousers-0.1.11.ebuild,
100
  +trousers-0.1.11-r1.ebuild:
101
  added udev permissions. Added tpm-emulator as optional dependancy. script
102
  file fixes and old version cleanout
103
104
*trousers-0.1.11 (19 Jun 2005)
105
106
  19 Jun 2005; Daniel Black <dragonheart@gentoo.org> +files/tcsd.confd,
107
  +files/tcsd.initd, +trousers-0.1.11.ebuild:
108
  Version bump as per bug #95764. Thankyou TGL
109
110
*trousers-0.1.7 (06 Feb 2005)
111
112
  06 Feb 2005; Daniel Black <dragonheart@gentoo.org> +metadata.xml,
113
  +files/0.1.7-makefile-statedir.patch, +trousers-0.1.7.ebuild:
114
  Initial import
115

Up to file-list app-crypt/trousers/Manifest:

1
AUX tcsd.confd 372 RMD160 d265222136e80a0fe0cdb535abba0e07078f08c2 SHA1 05a81dc90a2df80b3c0ea7a8cefc3c59098aadd8 SHA256 5a1f9150ce0d8cc3e9e80971e073ee0b1db018ec3af6809087a7c626b9ffa327
2
AUX tcsd.initd 958 RMD160 f90e6d4ec4d2dd0bd8218b3b2ef28328461d50b6 SHA1 34ab9b7cbf60e58b1f7b732891d30e053f2039a1 SHA256 388cef25be74c6263b9cb0e5de3bd08fbc0613e1a9fef958b006c571e4b691c8
3
AUX trousers-0.2.3-nouseradd.patch 1008 RMD160 dc1d81d6ceaf18d8464c5d7418b6733fae5fb6ab SHA1 404467a26d2e736ac3853969678d47a881579aec SHA256 5fa359ba96ac0c3e6130af1c9269f26fb28551ac6c0b76a4796aa0dfb1ce6dc2
4
AUX trousers-0.3.1-gcc43.patch 852 RMD160 9392a7ef5f24dfeb0a7af78e83a7e738891b44cd SHA1 0c65705193adc4153f0e57b91ab98b3c73ca44fe SHA256 fe937a9dd111f60614c53308937a037c57ec22a96a9bdcf2c65c996cffad09ed
5
AUX trousers-0.3.1-qa.patch 568 RMD160 918120a32124e3bf1b9a677698da1a6fb6a9e38f SHA1 27e7f1d1d3cbd23d63800e0e0f0a086fbeb83137 SHA256 518f14dc01c225b02f009cbfa34ff07f9fee91a9ad510f751acc929a13afdb6c
6
DIST trousers-0.3.1.tar.gz 1306672 RMD160 1dc088249b4fc4aaf354caa216ffe25c8cecc9aa SHA1 0598efbb2282556a5edf0ce8c074175a33573951 SHA256 79d190a214584ceedd3900b4bc7484244d6e0d74289de5a38adcc7415cde3500
7
EBUILD trousers-0.3.1.ebuild 2457 RMD160 4c6dcf919e773e07f59eda581ca367ad66bf6121 SHA1 206c1617eab865371be3e63c68989808239b02b3 SHA256 f0bfb0fd6766b12df4e9d6ee421c62eb1008529f8623f127c7728f7fd045b2b6
8
MISC ChangeLog 4116 RMD160 da96d43390f7c7bb61e29e2b927dbebbe29ed308 SHA1 53cb9da8edca27f5a4c6910d738021f617c74b14 SHA256 6fe914dc1ae947d92f85eef34863df1703b5c36886fb797e876f1891bc18fb3c
9
MISC metadata.xml 251 RMD160 9c13ff790c7419d4e0d2d370036b7f4e4594ea4f SHA1 563aa19984b291a6cade6d6487dbf4a2a17e6874 SHA256 1739a4e8833a2a5b9501182eb830cbd3e26014ccef5e9ae1b4d7a0686c665c1b

Up to file-list app-crypt/trousers/files/Makefile.in.patch:

1
*** src/tcsd/Makefile.in.old	Mon Dec 22 14:59:00 2008
2
--- src/tcsd/Makefile.in	Mon Dec 22 14:59:26 2008
3
***************
4
*** 50,56 ****
5
  	$(ACLOCAL_M4)
6
  mkinstalldirs = $(install_sh) -d
7
  CONFIG_CLEAN_FILES =
8
! am__installdirs = "$(DESTDIR)$(sbindir)"
9
  sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
10
  PROGRAMS = $(sbin_PROGRAMS)
11
  am_tcsd_OBJECTS = tcsd-svrside.$(OBJEXT) tcsd-tcsd_conf.$(OBJEXT) \
12
--- 50,56 ----
13
  	$(ACLOCAL_M4)
14
  mkinstalldirs = $(install_sh) -d
15
  CONFIG_CLEAN_FILES =
16
! am__installdirs = "$(DESTDIR)$(libdir)"
17
  sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
18
  PROGRAMS = $(sbin_PROGRAMS)
19
  am_tcsd_OBJECTS = tcsd-svrside.$(OBJEXT) tcsd-tcsd_conf.$(OBJEXT) \
20
***************
21
*** 281,287 ****
22
  target_vendor = @target_vendor@
23
  tcsd_CFLAGS = -DAPPID=\"TCSD\" -DVAR_PREFIX=\"@localstatedir@\" \
24
  	-DETC_PREFIX=\"@sysconfdir@\" $(am__append_1) $(am__append_2)
25
! tcsd_LDADD = ../tcs/libtcs.a ../tddl/libtddl.a -lpthread @CRYPTOLIB@
26
  tcsd_SOURCES = svrside.c tcsd_conf.c tcsd_threads.c platform.c
27
  all: all-am
28
  
29
--- 281,287 ----
30
  target_vendor = @target_vendor@
31
  tcsd_CFLAGS = -DAPPID=\"TCSD\" -DVAR_PREFIX=\"@localstatedir@\" \
32
  	-DETC_PREFIX=\"@sysconfdir@\" $(am__append_1) $(am__append_2)
33
! tcsd_LDADD = ../tcs/libtcs.a ../tddl/libtddl.a -lpthread -lscf -lresolv @CRYPTOLIB@
34
  tcsd_SOURCES = svrside.c tcsd_conf.c tcsd_threads.c platform.c
35
  all: all-am
36
  
37
***************
38
*** 318,324 ****
39
  	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
40
  install-sbinPROGRAMS: $(sbin_PROGRAMS)
41
  	@$(NORMAL_INSTALL)
42
! 	test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)"
43
  	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
44
  	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
45
  	  if test -f $$p \
46
--- 318,324 ----
47
  	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
48
  install-sbinPROGRAMS: $(sbin_PROGRAMS)
49
  	@$(NORMAL_INSTALL)
50
! 	test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
51
  	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
52
  	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
53
  	  if test -f $$p \
54
***************
55
*** 325,332 ****
56
  	     || test -f $$p1 \
57
  	  ; then \
58
  	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
59
! 	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
60
! 	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
61
  	  else :; fi; \
62
  	done
63
  
64
--- 325,332 ----
65
  	     || test -f $$p1 \
66
  	  ; then \
67
  	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
68
! 	   echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
69
! 	   $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(libdir)/$$f" || exit 1; \
70
  	  else :; fi; \
71
  	done
72
  
73
***************
74
*** 334,341 ****
75
  	@$(NORMAL_UNINSTALL)
76
  	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
77
  	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
78
! 	  echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
79
! 	  rm -f "$(DESTDIR)$(sbindir)/$$f"; \
80
  	done
81
  
82
  clean-sbinPROGRAMS:
83
--- 334,341 ----
84
  	@$(NORMAL_UNINSTALL)
85
  	@list='$(sbin_PROGRAMS)'; for p in $$list; do \
86
  	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
87
! 	  echo " rm -f '$(DESTDIR)$(libdir)/$$f'"; \
88
! 	  rm -f "$(DESTDIR)$(libdir)/$$f"; \
89
  	done
90
  
91
  clean-sbinPROGRAMS:
92
***************
93
*** 525,531 ****
94
  check: check-am
95
  all-am: Makefile $(PROGRAMS)
96
  installdirs:
97
! 	for dir in "$(DESTDIR)$(sbindir)"; do \
98
  	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
99
  	done
100
  install: install-am
101
--- 525,531 ----
102
  check: check-am
103
  all-am: Makefile $(PROGRAMS)
104
  installdirs:
105
! 	for dir in "$(DESTDIR)$(libdir)"; do \
106
  	  test -z "$$dir" || $(mkdir_p) "$$dir"; \
107
  	done
108
  install: install-am
109
*** src/tcsd/Makefile.am.old	Tue Feb 17 07:49:16 2009
110
--- src/tcsd/Makefile.am	Tue Feb 17 07:49:30 2009
111
***************
112
*** 1,7 ****
113
  sbin_PROGRAMS=tcsd
114
  
115
  tcsd_CFLAGS=-DAPPID=\"TCSD\" -DVAR_PREFIX=\"@localstatedir@\" -DETC_PREFIX=\"@sysconfdir@\"
116
! tcsd_LDADD=../tcs/libtcs.a ../tddl/libtddl.a -lpthread @CRYPTOLIB@
117
  
118
  tcsd_SOURCES=svrside.c tcsd_conf.c tcsd_threads.c platform.c
119
  
120
--- 1,7 ----
121
  sbin_PROGRAMS=tcsd
122
  
123
  tcsd_CFLAGS=-DAPPID=\"TCSD\" -DVAR_PREFIX=\"@localstatedir@\" -DETC_PREFIX=\"@sysconfdir@\"
124
! tcsd_LDADD=../tcs/libtcs.a ../tddl/libtddl.a -lpthread -lscf -lresolv @CRYPTOLIB@
125
  
126
  tcsd_SOURCES=svrside.c tcsd_conf.c tcsd_threads.c platform.c
127
  

Up to file-list app-crypt/trousers/files/configure.in.patch:

1
*** configure.in.old	Fri Nov  2 14:55:35 2007
2
--- configure.in	Wed Dec 17 11:11:17 2008
3
***************
4
*** 100,106 ****
5
  esac
6
  CFLAGS="$CFLAGS -D$MATH_DEFINE"
7
  
8
! GUI=gtk
9
  AC_ARG_WITH(gui,
10
  	    [AC_HELP_STRING([--with-gui], [type of gui popup (gtk/none) [default=gtk]])],
11
  	    [GUI=$withval],
12
--- 100,106 ----
13
  esac
14
  CFLAGS="$CFLAGS -D$MATH_DEFINE"
15
  
16
! GUI=openssl
17
  AC_ARG_WITH(gui,
18
  	    [AC_HELP_STRING([--with-gui], [type of gui popup (gtk/none) [default=gtk]])],
19
  	    [GUI=$withval],
20
***************
21
*** 113,121 ****
22
  		[$pkg_modules],
23
  		AM_CONDITIONAL(HAVE_GTK, true),
24
  		[AM_CONDITIONAL(HAVE_GTK, false)
25
! 		AC_MSG_ERROR([GTK libs are currently the only supported GUI library for trousers. Please install the gtk2-devel package for your distro.]) ])
26
  	AC_SUBST(GTK_CFLAGS)
27
  	AC_SUBST(GTK_LIBS)
28
  elif test "x$GUI" == "xnone"; then
29
  	if test $SPEC_COMP -eq 1; then
30
  		AC_MSG_ERROR([Popups must be enabled in strict spec compliance mode])
31
--- 113,127 ----
32
  		[$pkg_modules],
33
  		AM_CONDITIONAL(HAVE_GTK, true),
34
  		[AM_CONDITIONAL(HAVE_GTK, false)
35
! 		AC_MSG_ERROR([Please install the gtk2-devel package for your distro or select another gui option.]) ]
36
! 		[AM_CONDITIONAL(OPENSSL_UI, false)]
37
! )
38
  	AC_SUBST(GTK_CFLAGS)
39
  	AC_SUBST(GTK_LIBS)
40
+ elif test "x$GUI" = "xopenssl"; then
41
+ 	# We know we have OpenSSL
42
+ 	AM_CONDITIONAL(OPENSSL_UI, true)
43
+ 	AM_CONDITIONAL(HAVE_GTK, false)
44
  elif test "x$GUI" == "xnone"; then
45
  	if test $SPEC_COMP -eq 1; then
46
  		AC_MSG_ERROR([Popups must be enabled in strict spec compliance mode])
47
***************
48
*** 124,131 ****
49
  	AC_MSG_RESULT([*** WARNING: This may break apps! ***])
50
  	CFLAGS="$CFLAGS -DTSS_NO_GUI"
51
  	AM_CONDITIONAL(HAVE_GTK, false)
52
  else
53
! 	AC_MSG_ERROR(["gtk" and "none" are the only supported gui options for trousers])
54
  fi
55
  
56
  #
57
--- 130,138 ----
58
  	AC_MSG_RESULT([*** WARNING: This may break apps! ***])
59
  	CFLAGS="$CFLAGS -DTSS_NO_GUI"
60
  	AM_CONDITIONAL(HAVE_GTK, false)
61
+ 	AM_CONDITIONAL(OPENSSL_UI, false)
62
  else
63
! 	AC_MSG_ERROR(["gtk", "openssl" and "none" are the only supported gui options for trousers])
64
  fi
65
  
66
  #
67
***************
68
*** 337,343 ****
69
  AC_PROG_CC
70
  AC_PROG_LIBTOOL
71
  
72
! CFLAGS="$CFLAGS -I../include -W -Wall -Werror -Wno-unused-parameter \
73
  	-DTCSD_DEFAULT_PORT=${TCSD_DEFAULT_PORT} -DTSS_VER_MAJOR=${TSS_VER_MAJOR} \
74
  	-DTSS_VER_MINOR=${TSS_VER_MINOR} -DTSS_SPEC_MAJOR=${TSS_SPEC_MAJOR} \
75
  	-DTSS_SPEC_MINOR=${TSS_SPEC_MINOR}"
76
--- 344,350 ----
77
  AC_PROG_CC
78
  AC_PROG_LIBTOOL
79
  
80
! CFLAGS="$CFLAGS -I../include -errwarn=%none \
81
  	-DTCSD_DEFAULT_PORT=${TCSD_DEFAULT_PORT} -DTSS_VER_MAJOR=${TSS_VER_MAJOR} \
82
  	-DTSS_VER_MINOR=${TSS_VER_MINOR} -DTSS_SPEC_MAJOR=${TSS_SPEC_MAJOR} \
83
  	-DTSS_SPEC_MINOR=${TSS_SPEC_MINOR}"

Up to file-list app-crypt/trousers/files/dist-no-useradd-Makefile.am.patch:

1
--- dist/Makefile.am.old	2009-05-16 01:17:21.210063257 -0700
2
+++ dist/Makefile.am	2009-05-16 01:18:10.097439702 -0700
3
@@ -1,17 +1,7 @@
4
 
5
 install: install-exec-hook
6
 	if test ! -e ${DESTDIR}/@sysconfdir@/tcsd.conf; then mkdir -p ${DESTDIR}/@sysconfdir@ && cp tcsd.conf ${DESTDIR}/@sysconfdir@; fi
7
-	/bin/chown tss:tss ${DESTDIR}/@sysconfdir@/tcsd.conf
8
-	/bin/chmod 0600 ${DESTDIR}/@sysconfdir@/tcsd.conf
9
 
10
 install-exec-hook:
11
-	/usr/sbin/groupadd tss || true
12
-	/usr/sbin/useradd -r tss -g tss || true
13
-	/bin/chown tss:tss ${DESTDIR}/@sbindir@/tcsd
14
-	/bin/sh -c 'if [ ! -e ${DESTDIR}/@localstatedir@/lib/tpm ];then mkdir -p ${DESTDIR}/@localstatedir@/lib/tpm; fi'
15
-	/bin/chown tss:tss ${DESTDIR}/@localstatedir@/lib/tpm
16
-	/bin/chmod 0700 ${DESTDIR}/@localstatedir@/lib/tpm
17
 
18
 uninstall-hook:
19
-	/usr/sbin/userdel tss
20
-	/usr/sbin/groupdel tss

Up to file-list app-crypt/trousers/files/dist-no-useradd-Makefile.in.patch:

1
--- dist/Makefile.in.old	2009-05-16 01:12:53.731934702 -0700
2
+++ dist/Makefile.in	2009-05-16 01:13:05.419662448 -0700
3
@@ -291,7 +291,6 @@
4
 
5
 install-exec-am:
6
 	@$(NORMAL_INSTALL)
7
-	$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
8
 
9
 install-html: install-html-am
10
 

Up to file-list app-crypt/trousers/files/hosttable.c.patch:

1
*** src/tspi/rpc/hosttable.c.old	Wed Dec 17 14:31:33 2008
2
--- src/tspi/rpc/hosttable.c	Wed Dec 17 14:30:57 2008
3
***************
4
*** 35,41 ****
5
--- 35,46 ----
6
  	return TSS_SUCCESS;
7
  }
8
  
9
+ #ifdef SOLARIS
10
+ #pragma init(_init)
11
+ void _init(void)
12
+ #else
13
  void __attribute__ ((constructor)) my_init(void)
14
+ #endif
15
  {
16
  	host_table_init();
17
  	obj_list_init();

Up to file-list app-crypt/trousers/files/platform.c.patch:

1
*** src/tcsd/platform.c.old	Tue Jul 17 11:29:14 2007
2
--- src/tcsd/platform.c	Fri Dec  5 09:10:52 2008
3
***************
4
*** 30,36 ****
5
--- 30,40 ----
6
  {
7
  	char runlevel;
8
  	struct utmp ut, save, *next = NULL;
9
+ #ifdef SOLARIS
10
+ 	time_t tv = 0;
11
+ #else
12
  	struct timeval tv;
13
+ #endif /* SOLARIS */
14
  	int flag = 0, counter = 0;
15
  
16
  	MUTEX_LOCK(utmp_lock);
17
***************
18
*** 37,43 ****
19
--- 41,49 ----
20
  
21
  	memset(&ut, 0, sizeof(struct utmp));
22
  	memset(&save, 0, sizeof(struct utmp));
23
+ #ifndef SOLARIS
24
  	memset(&tv, 0, sizeof(struct timeval));
25
+ #endif
26
  
27
  	ut.ut_type = RUN_LVL;
28
  
29
***************
30
*** 44,57 ****
31
--- 50,69 ----
32
  	next = getutid(&ut);
33
  
34
  	while (next != NULL) {
35
+ #ifdef SOLARIS
36
+ 		if (next->ut_time >= tv) {
37
+ #else
38
  		if (next->ut_tv.tv_sec > tv.tv_sec) {
39
+ #endif
40
  			memcpy(&save, next, sizeof(*next));
41
  			flag = 1;
42
+ #ifndef SOLARIS
43
  		} else if (next->ut_tv.tv_sec == tv.tv_sec) {
44
  			if (next->ut_tv.tv_usec > tv.tv_usec) {
45
  				memcpy(&save, next, sizeof(*next));
46
  				flag = 1;
47
  			}
48
+ #endif /* SOLARIS */
49
  		}
50
  
51
  		counter++;

Up to file-list app-crypt/trousers/files/ps_utils.c.patch:

1
*** src/tcs/ps/ps_utils.c.old	Wed Aug 29 14:10:43 2007
2
--- src/tcs/ps/ps_utils.c	Wed Dec 17 12:27:21 2008
3
***************
4
*** 31,37 ****
5
  struct key_disk_cache *key_disk_cache_head = NULL;
6
  
7
  
8
! inline TSS_RESULT
9
  read_data(int fd, void *data, UINT32 size)
10
  {
11
  	int rc;
12
--- 31,37 ----
13
  struct key_disk_cache *key_disk_cache_head = NULL;
14
  
15
  
16
! TSS_RESULT
17
  read_data(int fd, void *data, UINT32 size)
18
  {
19
  	int rc;
20
***************
21
*** 49,55 ****
22
  }
23
  
24
  
25
! inline TSS_RESULT
26
  write_data(int fd, void *data, UINT32 size)
27
  {
28
  	int rc;
29
--- 49,55 ----
30
  }
31
  
32
  
33
! TSS_RESULT
34
  write_data(int fd, void *data, UINT32 size)
35
  {
36
  	int rc;

Up to file-list app-crypt/trousers/files/ssl_ui.c.patch:

1
*** /dev/null	Mon Dec 22 18:27:36 2008
2
--- src/tspi/ssl_ui.c	Mon Dec 22 18:26:44 2008
3
***************
4
*** 0 ****
5
--- 1,89 ----
6
+ #include <sys/types.h>
7
+ #include <string.h>
8
+ 
9
+ #include <openssl/ui.h>
10
+ 
11
+ #include "trousers/tss.h"
12
+ #include "spi_utils.h"
13
+ 
14
+ static TSS_RESULT do_ui(BYTE *string, UINT32 *string_len, BYTE *popup, int verify)
15
+ {
16
+ 	char pin_buf[UI_MAX_SECRET_STRING_LENGTH];
17
+ 	char verify_buf[UI_MAX_SECRET_STRING_LENGTH];
18
+ 	char *popup_nl;
19
+ 	UI *ui;
20
+ 	int len;
21
+ 	BYTE *unicode;
22
+ 	TSS_RESULT ret = TSS_E_FAIL;
23
+ 
24
+ 	len = strlen((char *)popup) + 2;
25
+ 	popup_nl = malloc(len);
26
+ 	if (!popup_nl)
27
+ 		return TSS_E_OUTOFMEMORY;
28
+ 
29
+ 	ui = UI_new();
30
+ 	if (!ui)
31
+ 		goto no_ui;
32
+ 
33
+ 	snprintf(popup_nl, len, "%s\n", (char *)popup);
34
+ 	if (!UI_add_info_string(ui, popup_nl)) {
35
+ 		printf("add info fail\n");
36
+ 		goto out;
37
+ 	}
38
+ 
39
+ 	if (!UI_add_input_string(ui, "Enter PIN:",
40
+ 	    0, pin_buf, 1, UI_MAX_SECRET_STRING_LENGTH)) {
41
+ 		printf("add input fail\n");
42
+ 		goto out;
43
+ 	}
44
+ 
45
+ 	if (verify &&
46
+ 	    !UI_add_verify_string(ui, "Verify PIN:", 0,
47
+ 		verify_buf, 1, UI_MAX_SECRET_STRING_LENGTH, pin_buf)) {
48
+ 		printf("Add verify fail\n");
49
+ 		goto out;
50
+ 	}
51
+ 
52
+ 	if (UI_process(ui))
53
+ 		goto out;
54
+ 
55
+ 	ret = TSS_SUCCESS;
56
+ 
57
+ 	unicode = Trspi_Native_To_UNICODE((BYTE *)pin_buf, string_len);
58
+ 	memset(string, 0, UI_MAX_SECRET_STRING_LENGTH);
59
+ 	memcpy(string, unicode, *string_len);
60
+ out:
61
+ 	UI_free(ui);
62
+ no_ui:
63
+ 	free(popup_nl);
64
+ 	return ret;
65
+ }
66
+ 
67
+ /*
68
+  * DisplayPINWindow()
69
+  *
70
+  * Popup the dialog to collect an existing password.
71
+  *
72
+  * string - buffer that the password will be passed back to caller in
73
+  * popup - UTF-8 string to be displayed in the title bar of the dialog box
74
+  *
75
+  */
76
+ TSS_RESULT DisplayPINWindow(BYTE *string, UINT32 *string_len, BYTE *popup)
77
+ {
78
+ 	return do_ui(string, string_len, popup, 0);
79
+ }
80
+ 
81
+ /*
82
+  * DisplayNewPINWindow()
83
+  *
84
+  * Popup the dialog to collect a new password.
85
+  *
86
+  * string - buffer that the password will be passed back to caller in
87
+  * popup - UTF-8 string to be displayed in the title bar of the dialog box
88
+  *
89
+  */
90
+ TSS_RESULT DisplayNewPINWindow(BYTE *string, UINT32 *string_len, BYTE *popup)
91
+ {
92
+ 	return do_ui(string, string_len, popup, 1);
93
+ }
94
+ 

Up to file-list app-crypt/trousers/files/svrside.c.patch:

1
*** src/tcsd/svrside.c.old	Wed Aug 29 14:11:13 2007
2
--- src/tcsd/svrside.c	Mon Dec 22 13:46:50 2008
3
***************
4
*** 23,28 ****
5
--- 23,32 ----
6
  #include <arpa/inet.h>
7
  #include <errno.h>
8
  #include <getopt.h>
9
+ #ifdef SOLARIS
10
+ #include <fcntl.h>
11
+ #include <priv.h>
12
+ #endif /* SOLARIS */
13
  
14
  #include "trousers/tss.h"
15
  #include "trousers_types.h"
16
***************
17
*** 210,221 ****
18
  	fprintf(stderr, "\n");
19
  }
20
  
21
  int
22
  main(int argc, char **argv)
23
  {
24
  	struct sockaddr_in serv_addr, client_addr;
25
  	TSS_RESULT result;
26
! 	int sd, newsd, c, option_index = 0;
27
  	unsigned client_len;
28
  	char *hostname = NULL;
29
  	struct hostent *client_hostent = NULL;
30
--- 214,304 ----
31
  	fprintf(stderr, "\n");
32
  }
33
  
34
+ #ifdef SOLARIS
35
+ 
36
+ /*
37
+  * For Solaris, make the tcsd privilege aware and drop
38
+  * risky privileges if they are not needed.
39
+  */
40
+ static int
41
+ drop_privs()
42
+ {
43
+ 	priv_set_t *myprivs;
44
+ 	int rv;
45
+ 
46
+ 	/*
47
+ 	 * Drop unneeded privs such as fork/exec.
48
+ 	 *
49
+ 	 * Get "basic" privs and remove the ones we don't want.
50
+ 	 */
51
+ 	if ((myprivs = priv_str_to_set("basic", ",", NULL)) == NULL) {
52
+ 		LogError("priv_str_to_set failed: %s", strerror(errno));
53
+ 		return (1);
54
+ 	} else {
55
+ 		(void) priv_delset(myprivs, PRIV_PROC_EXEC);
56
+ 		(void) priv_delset(myprivs, PRIV_PROC_FORK);
57
+ 		(void) priv_delset(myprivs, PRIV_FILE_LINK_ANY);
58
+ 		(void) priv_delset(myprivs, PRIV_PROC_INFO);
59
+ 		(void) priv_delset(myprivs, PRIV_PROC_SESSION);
60
+ 		(void) priv_delset(myprivs, PRIV_PROC_SETID);
61
+ 
62
+ 		/* for BSM auditing */
63
+ 		(void) priv_addset(myprivs, PRIV_PROC_AUDIT);
64
+ 
65
+ 		if ((rv = setppriv(PRIV_SET, PRIV_PERMITTED, myprivs)))
66
+ 			return (rv);
67
+ 		if ((rv = setppriv(PRIV_SET, PRIV_LIMIT, myprivs)))
68
+ 			return (rv);
69
+ 		if ((rv = setppriv(PRIV_SET, PRIV_INHERITABLE, myprivs)))
70
+ 			return (rv);
71
+ 
72
+ 		(void) priv_freeset(myprivs);
73
+ 	}
74
+ 	return (0);
75
+ }
76
+ 
77
+ static int
78
+ daemon(int nochdir, int noclose) {
79
+ 	int rv, fd;
80
+ 
81
+ 	switch (fork()) {
82
+ 		case -1:
83
+ 			return (-1);
84
+ 		case 0:
85
+ 			break;
86
+ 		default:
87
+ 		exit (0);
88
+ 	}
89
+ 	/*
90
+ 	 * Run TCSD as root:sys on Solaris so it can
91
+ 	 * perform auditing if necessary, but drop privileges
92
+ 	 * for extra protection.
93
+ 	 */
94
+ 	rv = drop_privs();
95
+ 	if (rv)
96
+ 		return (rv);
97
+ 
98
+ 	if (setsid() == -1)
99
+ 		return (-1);
100
+ 	if (!nochdir)
101
+ 		(void) chdir("/");
102
+ 	if (!noclose && (fd = open("/dev/null", O_RDWR, 0)) != -1) {
103
+ 		(void) dup2(fd, STDIN_FILENO);
104
+ 		(void) dup2(fd, STDOUT_FILENO);
105
+ 		(void) dup2(fd, STDERR_FILENO);
106
+ 		if (fd > 2)
107
+ 			(void)close (fd);
108
+ 	}
109
+ 	return (0);
110
+ }
111
+ #endif /* SOLARIS */
112
+ 
113
  int
114
  main(int argc, char **argv)
115
  {
116
  	struct sockaddr_in serv_addr, client_addr;
117
  	TSS_RESULT result;
118
! 	int sd, newsd, c, rv, option_index = 0;
119
  	unsigned client_len;
120
  	char *hostname = NULL;
121
  	struct hostent *client_hostent = NULL;
122
***************
123
*** 225,231 ****
124
  		{0, 0, 0, 0}
125
  	};
126
  
127
- 
128
  	while ((c = getopt_long(argc, argv, "fh", long_options, &option_index)) != -1) {
129
  		switch (c) {
130
  			case 'f':
131
--- 308,313 ----
132
***************
133
*** 249,255 ****
134
--- 331,347 ----
135
  			tcsd_shutdown();
136
  			return -1;
137
  		}
138
+ #ifndef SOLARIS
139
  	}
140
+ #else
141
+ 	/* For Solaris, drop privileges in foreground mode */
142
+ 	} else {
143
+ 		
144
+ 		rv = drop_privs();
145
+ 		if (rv)
146
+ 			return (rv);
147
+ 	}
148
+ #endif /* SOLARIS */
149
  
150
  	sd = socket(AF_INET, SOCK_STREAM, 0);
151
  	if (sd < 0) {
152
***************
153
*** 268,273 ****
154
--- 360,369 ----
155
  	else
156
  		serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
157
  
158
+ 	c = 1;
159
+ 	if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &c, sizeof (c)) < 0)
160
+ 		perror("Error setting REUSEADDR option");
161
+ 
162
  	if (bind(sd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) < 0) {
163
  		LogError("Failed bind: %s", strerror(errno));
164
  		return -1;

Up to file-list app-crypt/trousers/files/symmetric.c.patch:

1
*** src/trspi/crypto/openssl/symmetric.c.old	Tue Jul 17 14:25:24 2007
2
--- src/trspi/crypto/openssl/symmetric.c	Tue Sep  2 11:03:30 2008
3
***************
4
*** 16,21 ****
5
--- 16,24 ----
6
   */
7
  
8
  #include <string.h>
9
+ #ifdef SOLARIS
10
+ #include <limits.h>
11
+ #endif
12
  
13
  #include <openssl/evp.h>
14
  #include <openssl/err.h>

Up to file-list app-crypt/trousers/files/tcs_auth_mgr.c.patch:

1
*** src/tcs/tcs_auth_mgr.c.old	Tue Jul 17 11:19:23 2007
2
--- src/tcs/tcs_auth_mgr.c	Mon Feb  9 07:39:31 2009
3
***************
4
*** 169,177 ****
5
  	TSS_RESULT result;
6
  
7
  	for (i = 0; i < auth_mgr.auth_mapper_size; i++) {
8
! 		if (auth_mgr.auth_mapper[i].full == TRUE &&
9
! 		    auth_mgr.auth_mapper[i].tcs_ctx == tcs_handle) {
10
! 			result = internal_TerminateHandle(auth_mgr.auth_mapper[i].tpm_handle);
11
  			if (result == TCPA_E_INVALID_AUTHHANDLE) {
12
  				LogDebug("Tried to close an invalid auth handle: %x",
13
  					 auth_mgr.auth_mapper[i].tpm_handle);
14
--- 169,179 ----
15
  	TSS_RESULT result;
16
  
17
  	for (i = 0; i < auth_mgr.auth_mapper_size; i++) {
18
! 		if (auth_mgr.auth_mapper[i].tcs_ctx == tcs_handle) {
19
! 			/* Only termininate when still in use */
20
! 			/* Use FlushSpecific - TerminateHandle is deprecated */
21
! 			result = TCSP_FlushSpecific_Common(auth_mgr.auth_mapper[i].tpm_handle,
22
! 				TPM_RT_AUTH);
23
  			if (result == TCPA_E_INVALID_AUTHHANDLE) {
24
  				LogDebug("Tried to close an invalid auth handle: %x",
25
  					 auth_mgr.auth_mapper[i].tpm_handle);
26
***************
27
*** 178,185 ****
28
  			} else if (result != TCPA_SUCCESS) {
29
  				LogDebug("TPM_TerminateHandle returned %d", result);
30
  			}
31
! 			auth_mgr.open_auth_sessions--;
32
! 			auth_mgr.auth_mapper[i].full = FALSE;
33
  			LogDebug("released auth for TCS %x TPM %x", tcs_handle,
34
  				 auth_mgr.auth_mapper[i].tpm_handle);
35
  			auth_mgr_swap_in();
36
--- 180,189 ----
37
  			} else if (result != TCPA_SUCCESS) {
38
  				LogDebug("TPM_TerminateHandle returned %d", result);
39
  			}
40
! 			if (auth_mgr.auth_mapper[i].full) {
41
! 				auth_mgr.open_auth_sessions--;
42
! 				auth_mgr.auth_mapper[i].full = FALSE;
43
! 			}
44
  			LogDebug("released auth for TCS %x TPM %x", tcs_handle,
45
  				 auth_mgr.auth_mapper[i].tpm_handle);
46
  			auth_mgr_swap_in();
47
***************
48
*** 215,227 ****
49
  		    auth_mgr.auth_mapper[i].tcs_ctx == tcs_handle) {
50
  			if (cont) {
51
  				/* Only termininate when still in use */
52
! 				result = internal_TerminateHandle(
53
! 								auth_mgr.auth_mapper[i].tpm_handle);
54
  				if (result == TCPA_E_INVALID_AUTHHANDLE) {
55
  					LogDebug("Tried to close an invalid auth handle: %x",
56
  						 auth_mgr.auth_mapper[i].tpm_handle);
57
  				} else if (result != TCPA_SUCCESS) {
58
! 					LogDebug("TPM_TerminateHandle returned %d", result);
59
  				}
60
  			}
61
  			auth_mgr.open_auth_sessions--;
62
--- 219,232 ----
63
  		    auth_mgr.auth_mapper[i].tcs_ctx == tcs_handle) {
64
  			if (cont) {
65
  				/* Only termininate when still in use */
66
! 				/* Use FlushSpecific - TerminateHandle is deprecated */
67
! 				result = TCSP_FlushSpecific_Common(tpm_auth_handle,
68
! 					TPM_RT_AUTH);
69
  				if (result == TCPA_E_INVALID_AUTHHANDLE) {
70
  					LogDebug("Tried to close an invalid auth handle: %x",
71
  						 auth_mgr.auth_mapper[i].tpm_handle);
72
  				} else if (result != TCPA_SUCCESS) {
73
! 					LogDebug("TPM_FlushSpecific returned %d", result);
74
  				}
75
  			}
76
  			auth_mgr.open_auth_sessions--;

Up to file-list app-crypt/trousers/files/tcs_key_mem_cache.c.patch:

1
*** src/tcs/tcs_key_mem_cache.c.old	Sat Dec 13 11:44:35 2008
2
--- src/tcs/tcs_key_mem_cache.c	Sat Dec 13 11:45:37 2008
3
***************
4
*** 1080,1088 ****
5
  
6
  		LoadBlob_UINT32(&offset, keyList.handle[i], (BYTE *)&keyHandle);
7
  		/* get the ownerEvict flag for this key handle */
8
! 		if ((result = TCSP_GetCapability_Internal(InternalContext, TPM_CAP_KEY_STATUS,
9
  							  sizeof(UINT32), (BYTE *)&keyHandle,
10
! 							  &respDataSize, &respData))) {
11
  			free(keyList.handle);
12
  			return result;
13
  		}
14
--- 1080,1092 ----
15
  
16
  		LoadBlob_UINT32(&offset, keyList.handle[i], (BYTE *)&keyHandle);
17
  		/* get the ownerEvict flag for this key handle */
18
! 		result = TCSP_GetCapability_Internal(InternalContext, TPM_CAP_KEY_STATUS,
19
  							  sizeof(UINT32), (BYTE *)&keyHandle,
20
! 							  &respDataSize, &respData);
21
! 		/* special case, invalid keys are automatically evicted later */
22
! 		if (result == TPM_E_INVALID_KEYHANDLE)
23
! 			continue;
24
! 		if (result != TSS_SUCCESS) {
25
  			free(keyList.handle);
26
  			return result;
27
  		}

Up to file-list app-crypt/trousers/files/tcs_pbg.c.patch:

1
*** src/tcs/tcs_pbg.c.old	Thu Dec 18 20:37:19 2008
2
--- src/tcs/tcs_pbg.c	Fri Dec 19 06:09:43 2008
3
***************
4
*** 17,22 ****
5
--- 17,23 ----
6
  #include <sys/types.h>
7
  #include <sys/stat.h>
8
  #include <sys/mman.h>
9
+ #include <sys/varargs.h>
10
  #include <fcntl.h>
11
  #include <errno.h>
12
  
13
***************
14
*** 587,593 ****
15
  	case TPM_ORD_DAA_Sign:
16
  	case TPM_ORD_ChangeAuth:
17
  	case TPM_ORD_GetCapability:
18
- 	case TPM_ORD_UnBind:
19
  	case TPM_ORD_LoadMaintenanceArchive:
20
  	case TPM_ORD_ConvertMigrationBlob:
21
  	case TPM_ORD_NV_ReadValue:
22
--- 588,593 ----
23
***************
24
*** 622,627 ****
25
--- 622,657 ----
26
  		}
27
  
28
  		offset1 = TSS_TPM_TXBLOB_HDR_LEN;
29
+ 		UnloadBlob_UINT32(&offset1, data_len, b);
30
+ 		if ((*data = malloc(*data_len)) == NULL) {
31
+ 			LogError("malloc of %u bytes failed", *data_len);
32
+ 			return TCSERR(TSS_E_OUTOFMEMORY);
33
+ 		}
34
+ 
35
+ 		UnloadBlob(&offset1, *data_len, b, *data);
36
+ 		break;
37
+ 	}
38
+ 	/* TPM BLOB: 1 UINT32, 1 BLOB, 1 optional AUTH
39
+ 	 * return: UINT32 *, BYTE**, 1 optional AUTH*/
40
+ 	case TPM_ORD_UnBind:
41
+ 	{
42
+ 		UINT32 *data_len = va_arg(ap, UINT32 *);
43
+ 		BYTE **data = va_arg(ap, BYTE **);
44
+ 		TPM_AUTH *auth1 = va_arg(ap, TPM_AUTH *);
45
+ 		TPM_AUTH *auth2 = va_arg(ap, TPM_AUTH *);
46
+ 		va_end(ap);
47
+ 
48
+ 		if (!data || !data_len) {
49
+ 			LogError("Internal error for ordinal 0x%x", ordinal);
50
+ 			return TCSERR(TSS_E_INTERNAL_ERROR);
51
+ 		}
52
+ 
53
+ 		if (auth1) {
54
+ 			offset1 = len - TSS_TPM_RSP_BLOB_AUTH_LEN;
55
+ 			UnloadBlob_Auth(&offset1, b, auth1);
56
+ 		} 
57
+ 
58
+ 		offset1 = TSS_TPM_TXBLOB_HDR_LEN;
59
  		UnloadBlob_UINT32(&offset1, data_len, b);
60
  		if ((*data = malloc(*data_len)) == NULL) {
61
  			LogError("malloc of %u bytes failed", *data_len);

Up to file-list app-crypt/trousers/files/tcsd.8.in.patch:

1
*** man/man8/tcsd.8.in.old	Thu Dec 18 07:09:04 2008
2
--- man/man8/tcsd.8.in	Thu Dec 18 07:37:35 2008
3
***************
4
*** 74,85 ****
5
  the TCS and stays valid across application lifetimes, \fBtcsd\fR restarts and 
6
  system resets. Data registered in system PS stays valid until an application 
7
  requests that it be removed. User PS files are by default stored as 
8
! /var/tpm/user.{pid} and the system PS file by default is /var/tpm/system.data. 
9
  The system PS file is initially created when ownership of the TPM is first 
10
  taken.
11
  
12
  .SH "CONFIGURATION"
13
! \fBtcsd\fR configuration is stored by default in /etc/tcsd.conf
14
  
15
  .SH "DEBUG OUTPUT"
16
  If TrouSerS has been compiled with debugging enabled, the debugging output
17
--- 74,105 ----
18
  the TCS and stays valid across application lifetimes, \fBtcsd\fR restarts and 
19
  system resets. Data registered in system PS stays valid until an application 
20
  requests that it be removed. User PS files are by default stored as 
21
! $HOME/.trousers/user.data and the system PS file by default is /var/tpm/system/system.data. 
22
  The system PS file is initially created when ownership of the TPM is first 
23
  taken.
24
+ .PP
25
+ \fB/var/tpm/system/system.data\fR
26
+ .ad
27
+ .RS 4n
28
+ Contains the system PS (persistent storage) data controlled by the TCS.  By default,
29
+ the SRK key is installed in PS and does not require owner authorization to use.  If the
30
+ TPM has previously been provisioned and owner-auth is required to load the SRK,
31
+ then the /var/tpm/system/system.data.auth file should be moved to 
32
+ /var/tpm/system/system.data before starting the TCS (See NOTES).
33
+ .RE
34
+ .sp
35
+ .PP
36
+ \fB/var/tpm/system/system.data.auth\fR
37
+ .ad
38
+ .RS 4n
39
+ This is the default PS data file to use if the TPM has been previously 
40
+ configured to require owner-auth to access the SRK.  Copy this file 
41
+ to /var/tpm/system/system.data prior to starting the TCS if owner-auth is
42
+ needed, otherwise this file can be ignored.
43
+ .RE
44
  
45
  .SH "CONFIGURATION"
46
! \fBtcsd\fR configuration is stored by default in /etc/security/tcsd.conf
47
  
48
  .SH "DEBUG OUTPUT"
49
  If TrouSerS has been compiled with debugging enabled, the debugging output
50
***************
51
*** 88,95 ****
52
  .SH "DEVICE DRIVERS"
53
  .PP
54
  \fBtcsd\fR is compatible with the IBM Research TPM device driver available
55
! from http://www.research.ibm.com/gsal/tcpa and the TPM device driver available
56
! from http://sf.net/projects/tmpdd
57
  
58
  .SH "CONFORMING TO"
59
  .PP
60
--- 108,116 ----
61
  .SH "DEVICE DRIVERS"
62
  .PP
63
  \fBtcsd\fR is compatible with the IBM Research TPM device driver available
64
! from http://www.research.ibm.com/gsal/tcpa and the TPM device driver for 
65
! Linux available from http://sf.net/projects/tmpdd.  It is also compatible 
66
! with the TPM device driver for Solaris which is available in the SUNWtpm package.
67
  
68
  .SH "CONFORMING TO"
69
  .PP
70
***************
71
*** 98,105 ****
72
  
73
  .SH "SEE ALSO"
74
  .PP
75
! \fBtcsd.conf\fR(5)
76
  
77
  .SH "AUTHOR"
78
  Kent Yoder
79
  
80
--- 119,142 ----
81
  
82
  .SH "SEE ALSO"
83
  .PP
84
! \fBtcsd.conf\fR(5), \fBsvcadm\fR(1M), \fBsmf\fR(5)
85
  
86
+ .SH "NOTES"
87
+ .sp
88
+ .LP
89
+ The \fBtcsd\fR service is managed by the service management facility, \fBsmf\fR(5), under
90
+ the service identifier:
91
+ .sp
92
+ .in +2
93
+ .nf
94
+ svc:/application/security/tcsd:default
95
+ .fi
96
+ .in -2
97
+ .sp
98
+ .LP
99
+ Administrative actions on this service, such as enabling, disabling, or requesting restart, can be
100
+ performed using \fBsvcadm\fR(1M). The service's status can be queried using the \fBsvcs\fR(1) command.
101
+ 
102
  .SH "AUTHOR"
103
  Kent Yoder
104
  

Up to file-list app-crypt/trousers/files/tcsd.h.patch:

1
*** src/include/tcsd.h.old	Fri Dec  5 07:47:11 2008
2
--- src/include/tcsd.h	Fri Dec  5 07:48:44 2008
3
***************
4
*** 48,61 ****
5
--- 48,70 ----
6
  							of this TCS System */
7
  };
8
  
9
+ #ifdef SOLARIS
10
+ #define TCSD_CONFIG_FILE	"/etc/security/tcsd.conf"
11
+ #else
12
  #define TCSD_CONFIG_FILE	ETC_PREFIX "/tcsd.conf"
13
+ #endif
14
  
15
  #define TSS_USER_NAME		"tss"
16
  #define TSS_GROUP_NAME		"tss"
17
  
18
  #define TCSD_DEFAULT_MAX_THREADS	10
19
+ #ifdef SOLARIS
20
+ #define TCSD_DEFAULT_SYSTEM_PS_FILE	"/var/tpm/system/system.data"
21
+ #define TCSD_DEFAULT_SYSTEM_PS_DIR	"/var/tpm/system"
22
+ #else
23
  #define TCSD_DEFAULT_SYSTEM_PS_FILE	VAR_PREFIX "/lib/tpm/system.data"
24
  #define TCSD_DEFAULT_SYSTEM_PS_DIR	VAR_PREFIX "/lib/tpm"
25
+ #endif /* SOLARIS */
26
  #define TCSD_DEFAULT_FIRMWARE_LOG_FILE	"/sys/kernel/security/tpm0/binary_bios_measurements"
27
  #define TCSD_DEFAULT_KERNEL_LOG_FILE	"/sys/kernel/security/ima/binary_runtime_measurements"
28
  #define TCSD_DEFAULT_FIRMWARE_PCRS	0x00000000

Up to file-list app-crypt/trousers/files/tcsd_conf.c.patch:

1
*** src/tcsd/tcsd_conf.c.old	Thu Aug 30 14:57:42 2007
2
--- src/tcsd/tcsd_conf.c	Mon Dec 22 14:33:03 2008
3
***************
4
*** 21,26 ****
5
--- 21,30 ----
6
  #include <grp.h>
7
  #include <stdlib.h>
8
  
9
+ #ifdef SOLARIS
10
+ #include <libscf.h>
11
+ #endif
12
+ 
13
  #include "trousers/tss.h"
14
  #include "trousers_types.h"
15
  #include "tcs_tsp.h"
16
***************
17
*** 674,691 ****
18
--- 678,728 ----
19
  	free_platform_lists(conf->all_platform_classes);
20
  }
21
  
22
+ #ifdef SOLARIS
23
+ static int
24
+ get_smf_prop(const char *var, boolean_t def_val)
25
+ {
26
+ 	scf_simple_prop_t *prop;
27
+ 	uint8_t *val;
28
+ 	boolean_t res = def_val;
29
+ 	prop = scf_simple_prop_get(NULL, "svc:/application/security/tcsd:default",
30
+ 		"config", var);
31
+ 	if (prop) {
32
+ 		if ((val = scf_simple_prop_next_boolean(prop)) != NULL)
33
+ 			res = (*val == 0) ? B_FALSE : B_TRUE;
34
+ 		scf_simple_prop_free(prop);
35
+ 	}
36
+ 	if (prop == NULL || val == NULL) {
37
+ 		syslog(LOG_ALERT, "no value for config/%s (%s). "
38
+ 		    "Using default \"%s\"", var, scf_strerror(scf_error()),
39
+ 		    def_val ? "true" : "false");
40
+ 	}
41
+ 	return (res);
42
+ }
43
+ #endif
44
+ 
45
  TSS_RESULT
46
  conf_file_init(struct tcsd_config *conf)
47
  {
48
  	FILE *f = NULL;
49
  	struct stat stat_buf;
50
+ #ifndef SOLARIS
51
  	struct group *grp;
52
  	struct passwd *pw;
53
  	mode_t mode = (S_IRUSR|S_IWUSR);
54
+ #endif /* SOLARIS */
55
  	TSS_RESULT result;
56
  
57
  	init_tcsd_config(conf);
58
  
59
+ #ifdef SOLARIS
60
+ 	/*
61
+ 	 * Solaris runs as root:sys but with reduced privileges
62
+ 	 * so we don't need to create a new user/group and also so
63
+ 	 * we can have auditing support.  The permissions on
64
+ 	 * the tcsd configuration file are not checked on Solaris.
65
+ 	 */
66
+ #endif
67
  	/* look for a config file, create if it doesn't exist */
68
  	if (stat(TCSD_CONFIG_FILE, &stat_buf) == -1) {
69
  		if (errno == ENOENT) {
70
***************
71
*** 699,704 ****
72
--- 736,742 ----
73
  		}
74
  	}
75
  
76
+ #ifndef SOLARIS
77
  	/* find the gid that owns the conf file */
78
  	errno = 0;
79
  	grp = getgrnam(TSS_GROUP_NAME);
80
***************
81
*** 736,741 ****
82
--- 774,780 ----
83
  		LogError("TCSD config file (%s) must be mode 0600", TCSD_CONFIG_FILE);
84
  		return TCSERR(TSS_E_INTERNAL_ERROR);
85
  	}
86
+ #endif /* SOLARIS */
87
  
88
  	if ((f = fopen(TCSD_CONFIG_FILE, "r")) == NULL) {
89
  		LogError("fopen(%s): %s", TCSD_CONFIG_FILE, strerror(errno));
90
***************
91
*** 748,753 ****
92
--- 787,803 ----
93
  	/* fill out any uninitialized options */
94
  	config_set_defaults(conf);
95
  
96
+ #ifdef SOLARIS
97
+ 	/*
98
+ 	 * The SMF value for "local_only" overrides the config file and
99
+ 	 * disables all remote operations.
100
+ 	 */
101
+ 	if (get_smf_prop("local_only", B_TRUE)) {
102
+ 		(void) memset(conf->remote_ops, 0, sizeof(conf->remote_ops));
103
+ 		conf->unset |= TCSD_OPTION_REMOTE_OPS;
104
+ 		
105
+ 	}
106
+ #endif
107
  	return result;
108
  }
109
  
110
***************
111
*** 789,795 ****
112
  	} else if (((stat_buf.st_mode & 0777) ^ mode) != 0) {
113
  		/* This path is likely to be hit since open &'s mode with ~umask */
114
  		LogInfo("resetting mode of %s from %o to: %o", tcsd_options.system_ps_dir,
115
! 			stat_buf.st_mode, mode);
116
  		if (chmod(tcsd_options.system_ps_dir, mode) == -1) {
117
  			LogError("chmod(%s) failed: %s", tcsd_options.system_ps_dir,
118
  				 strerror(errno));
119
--- 839,845 ----
120
  	} else if (((stat_buf.st_mode & 0777) ^ mode) != 0) {
121
  		/* This path is likely to be hit since open &'s mode with ~umask */
122
  		LogInfo("resetting mode of %s from %o to: %o", tcsd_options.system_ps_dir,
123
! 			(unsigned int)stat_buf.st_mode, (unsigned int)mode);
124
  		if (chmod(tcsd_options.system_ps_dir, mode) == -1) {
125
  			LogError("chmod(%s) failed: %s", tcsd_options.system_ps_dir,
126
  				 strerror(errno));

Up to file-list app-crypt/trousers/files/tcslog.h.patch:

1
*** src/include/tcslog.h.old	Wed Aug 22 13:08:35 2007
2
--- src/include/tcslog.h	Wed Dec 17 11:30:35 2008
3
***************
4
*** 20,25 ****
5
--- 20,29 ----
6
  /* log to syslog -- change your syslog destination here */
7
  #define TSS_SYSLOG_LVL	LOG_LOCAL5
8
  
9
+ #ifndef __FUNCTION__
10
+ #define __FUNCTION__ __func__
11
+ #endif
12
+ 
13
  #define LogMessage(dest, priority, layer, fmt, ...) \
14
          do { \
15
  		if (foreground) { \

Up to file-list app-crypt/trousers/files/tcsps.c.patch:

1
*** src/tcs/ps/tcsps.c.old	Wed Aug 22 11:21:05 2007
2
--- src/tcs/ps/tcsps.c	Wed Dec 10 09:00:27 2008
3
***************
4
*** 18,23 ****
5
--- 18,27 ----
6
  #include <sys/file.h>
7
  #include <sys/stat.h>
8
  #include <assert.h>
9
+ #ifdef SOLARIS
10
+ #include <fcntl.h>
11
+ #include <limits.h>
12
+ #endif
13
  
14
  #include "trousers/tss.h"
15
  #include "trousers_types.h"
16
***************
17
*** 32,48 ****
18
  int system_ps_fd = -1;
19
  MUTEX_DECLARE(disk_cache_lock);
20
  
21
  int
22
  get_file()
23
  {
24
! 	int rc = 0;
25
! 
26
  	/* check the global file handle first.  If it exists, lock it and return */
27
  	if (system_ps_fd != -1) {
28
  		if ((rc = flock(system_ps_fd, LOCK_EX))) {
29
  			LogError("failed to get system PS lock: %s", strerror(errno));
30
  			return -1;
31
  		}
32
  
33
  		return system_ps_fd;
34
  	}
35
--- 36,72 ----
36
  int system_ps_fd = -1;
37
  MUTEX_DECLARE(disk_cache_lock);
38
  
39
+ #ifdef SOLARIS
40
+ static struct flock fl = {
41
+ 	0,	/* l_type */
42
+ 	0,	/* l_whence */
43
+ 	0,	/* l_start */
44
+ 	0,	/* l_len */
45
+ 	0,	/* l_sysid */
46
+ 	0,	/* l_pid */
47
+ 	{0,0,0,0}
48
+ 	};
49
+ #endif
50
+ 
51
  int
52
  get_file()
53
  {
54
! 	int rc;
55
  	/* check the global file handle first.  If it exists, lock it and return */
56
  	if (system_ps_fd != -1) {
57
+ 		int rc = 0;
58
+ #ifdef SOLARIS
59
+ 		fl.l_type = F_WRLCK;
60
+ 		if ((rc = fcntl(system_ps_fd, F_SETLKW, &fl))) {
61
+ 			LogError("failed to get system PS lock: %s", strerror(errno));
62
+ 			return -1;
63
+ 		}
64
+ #else
65
  		if ((rc = flock(system_ps_fd, LOCK_EX))) {
66
  			LogError("failed to get system PS lock: %s", strerror(errno));
67
  			return -1;
68
  		}
69
+ #endif /* SOLARIS */
70
  
71
  		return system_ps_fd;
72
  	}
73
***************
74
*** 55,65 ****
75
  		return -1;
76
  	}
77
  
78
  	if ((rc = flock(system_ps_fd, LOCK_EX))) {
79
  		LogError("failed to get system PS lock of file %s: %s",
80
! 				tcsd_options.system_ps_file, strerror(errno));
81
  		return -1;
82
  	}
83
  
84
  	return system_ps_fd;
85
  }
86
--- 79,98 ----
87
  		return -1;
88
  	}
89
  
90
+ #ifdef SOLARIS
91
+ 	fl.l_type = F_WRLCK;
92
+ 	if ((rc = fcntl(system_ps_fd, F_SETLKW, &fl))) {
93
+ 		LogError("failed to get system PS lock of file %s: %s",
94
+ 			tcsd_options.system_ps_file, strerror(errno));
95
+ 		return -1;
96
+ 	}
97
+ #else
98
  	if ((rc = flock(system_ps_fd, LOCK_EX))) {
99
  		LogError("failed to get system PS lock of file %s: %s",
100
! 			tcsd_options.system_ps_file, strerror(errno));
101
  		return -1;
102
  	}
103
+ #endif /* SOLARIS */
104
  
105
  	return system_ps_fd;
106
  }
107
***************
108
*** 68,79 ****
109
  put_file(int fd)
110
  {
111
  	int rc = 0;
112
- 
113
  	/* release the file lock */
114
  	if ((rc = flock(fd, LOCK_UN))) {
115
  		LogError("failed to unlock system PS file: %s", strerror(errno));
116
  		return -1;
117
  	}
118
  
119
  	return rc;
120
  }
121
--- 101,120 ----
122
  put_file(int fd)
123
  {
124
  	int rc = 0;
125
  	/* release the file lock */
126
+ #ifdef SOLARIS
127
+ 	fl.l_type = F_UNLCK;
128
+ 	if ((rc = fcntl(fd, F_SETLKW, &fl))) {
129
+ 		LogError("failed to unlock system PS file: %s",
130
+ 			strerror(errno));
131
+ 		return -1;
132
+ 	}
133
+ #else
134
  	if ((rc = flock(fd, LOCK_UN))) {
135
  		LogError("failed to unlock system PS file: %s", strerror(errno));
136
  		return -1;
137
  	}
138
+ #endif /* SOLARIS */
139
  
140
  	return rc;
141
  }

Up to file-list app-crypt/trousers/files/tcsps.h.patch:

1
*** src/include/tcsps.h.old	Wed Aug 22 11:21:04 2007
2
--- src/include/tcsps.h		Wed Dec 17 12:23:29 2008
3
***************
4
*** 23,30 ****
5
  int		   put_file(int);
6
  void		   close_file(int);
7
  void		   ps_destroy();
8
! inline TSS_RESULT  read_data(int, void *, UINT32);
9
! inline TSS_RESULT  write_data(int, void *, UINT32);
10
  int		   write_key_init(int, UINT32, UINT32, UINT32);
11
  TSS_RESULT	   cache_key(UINT32, UINT16, TSS_UUID *, TSS_UUID *, UINT16, UINT32, UINT32);
12
  TSS_RESULT	   UnloadBlob_KEY_PS(UINT16 *, BYTE *, TSS_KEY *);
13
--- 23,30 ----
14
  int		   put_file(int);
15
  void		   close_file(int);
16
  void		   ps_destroy();
17
! TSS_RESULT         read_data(int, void *, UINT32);
18
! TSS_RESULT         write_data(int, void *, UINT32);
19
  int		   write_key_init(int, UINT32, UINT32, UINT32);
20
  TSS_RESULT	   cache_key(UINT32, UINT16, TSS_UUID *, TSS_UUID *, UINT16, UINT32, UINT32);
21
  TSS_RESULT	   UnloadBlob_KEY_PS(UINT16 *, BYTE *, TSS_KEY *);

Up to file-list app-crypt/trousers/files/tddl.c.patch:

1
*** src/tddl/tddl.c.old	Fri Dec  5 08:13:11 2008
2
--- src/tddl/tddl.c	Fri Dec  5 08:16:20 2008
3
***************
4
*** 18,30 ****
5
--- 18,34 ----
6
  
7
  #include "trousers/tss.h"
8
  #include "trousers_types.h"
9
+ #ifndef SOLARIS
10
  #include "linux/tpm.h"
11
+ #endif
12
  #include "tcslog.h"
13
  #include "tddl.h"
14
  
15
  struct tpm_device_node tpm_device_nodes[] = {
16
+ #ifndef SOLARIS
17
  	{"/dev/tpm0", TDDL_UNDEF, TDDL_UNDEF},
18
  	{"/udev/tpm0", TDDL_UNDEF, TDDL_UNDEF},
19
+ #endif
20
  	{"/dev/tpm", TDDL_UNDEF, TDDL_UNDEF},
21
  	{NULL, 0, 0}
22
  };
23
***************
24
*** 41,48 ****
25
  	/* tpm_device_paths is filled out in tddl.h */
26
  	for (i = 0; tpm_device_nodes[i].path != NULL; i++) {
27
  		errno = 0;
28
! 		if ((tpm_device_nodes[i].fd = open(tpm_device_nodes[i].path, O_RDWR)) < 0)
29
  			continue;
30
  
31
  		opened_device = &(tpm_device_nodes[i]);
32
  		return opened_device->fd;
33
--- 45,55 ----
34
  	/* tpm_device_paths is filled out in tddl.h */
35
  	for (i = 0; tpm_device_nodes[i].path != NULL; i++) {
36
  		errno = 0;
37
! 		if ((tpm_device_nodes[i].fd = open(tpm_device_nodes[i].path, O_RDWR)) < 0) {
38
! 			fprintf(stderr, "Error opening %s: %s\n",
39
! 				tpm_device_nodes[i].path, strerror(errno));
40
  			continue;
41
+ 		}	
42
  
43
  		opened_device = &(tpm_device_nodes[i]);
44
  		return opened_device->fd;
45
***************
46
*** 109,119 ****
47
--- 116,128 ----
48
  			/* fall through */
49
  		case TDDL_TRANSMIT_IOCTL:
50
  			errno = 0;
51
+ #ifndef SOLARIS
52
  			if ((sizeResult = ioctl(opened_device->fd, TPMIOC_TRANSMIT, txBuffer)) != -1) {
53
  				opened_device->transmit = TDDL_TRANSMIT_IOCTL;
54
  				break;
55
  			}
56
  			LogWarn("ioctl: (%d) %s", errno, strerror(errno));
57
+ #endif
58
  			LogInfo("Falling back to Read/Write device support.");
59
  			/* fall through */
60
  		case TDDL_TRANSMIT_RW:
61
***************
62
*** 183,188 ****
63
--- 192,198 ----
64
  
65
  TSS_RESULT Tddli_Cancel(void)
66
  {
67
+ #ifndef SOLARIS
68
  	int rc;
69
  
70
  	if (opened_device->transmit == TDDL_TRANSMIT_IOCTL) {
71
***************
72
*** 198,201 ****
73
--- 208,213 ----
74
  	} else {
75
  		return TDDLERR(TSS_E_NOTIMPL);
76
  	}
77
+ #endif /* SOLARIS */
78
+ 	return TDDLERR(TSS_E_NOTIMPL);
79
  }

Up to file-list app-crypt/trousers/files/trousers.c.patch:

1
*** src/trspi/trousers.c.old	Fri Oct 26 16:34:31 2007
2
--- src/trspi/trousers.c	Mon Oct 27 12:13:18 2008
3
***************
4
*** 1538,1544 ****
5
  		ptr = (char *)string;
6
  		errno = 0;
7
  
8
! 		rc = iconv(cd, &ptr, &inbytesleft, &outbuf, &outbytesleft);
9
  	} while (rc == (size_t)-1 && errno == E2BIG);
10
  
11
  	if (len > MAX_BUF_SIZE) {
12
--- 1538,1544 ----
13
  		ptr = (char *)string;
14
  		errno = 0;
15
  
16
! 		rc = iconv(cd, (const char **)&ptr, &inbytesleft, &outbuf, &outbytesleft);
17
  	} while (rc == (size_t)-1 && errno == E2BIG);
18
  
19
  	if (len > MAX_BUF_SIZE) {
20
***************
21
*** 1599,1605 ****
22
  		ptr = (char *)string;
23
  		errno = 0;
24
  
25
! 		rc = iconv(cd, &ptr, &inbytesleft, &outbuf, &outbytesleft);
26
  	} while (rc == (size_t)-1 && errno == E2BIG);
27
  
28
  	/* add terminating bytes of the correct width */
29
--- 1599,1605 ----
30
  		ptr = (char *)string;
31
  		errno = 0;
32
  
33
! 		rc = iconv(cd, (const char **)&ptr, &inbytesleft, &outbuf, &outbytesleft);
34
  	} while (rc == (size_t)-1 && errno == E2BIG);
35
  
36
  	/* add terminating bytes of the correct width */

Up to file-list app-crypt/trousers/files/tsp_auth.c.patch:

1
*** src/tspi/tsp_auth.c.old	Tue Feb  3 12:46:07 2009
2
--- src/tspi/tsp_auth.c	Thu Feb  5 11:01:42 2009
3
***************
4
*** 359,365 ****
5
  	memcpy(digest, &auth->HMAC, 20);
6
  	HMAC_Auth(secret, hash, auth);
7
  
8
! 	return (TSS_BOOL) memcmp(digest, &auth->HMAC, 20);
9
  }
10
  
11
  void
12
--- 359,365 ----
13
  	memcpy(digest, &auth->HMAC, 20);
14
  	HMAC_Auth(secret, hash, auth);
15
  
16
! 	return ((TSS_BOOL) memcmp(digest, &auth->HMAC, 20) != 0);
17
  }
18
  
19
  void
20
***************
21
*** 753,758 ****
22
--- 753,760 ----
23
  		Trspi_HMAC(TSS_HASH_SHA1, ulSizeDigestHmac, sess->sharedSecret.digest, offset, Blob,
24
  			   hmacVerify.digest);
25
  		result = memcmp(rgbHmacData, hmacVerify.digest, ulSizeDigestHmac);
26
+ 		if (result)
27
+ 			result = TPM_E_AUTHFAIL;
28
  	}
29
  
30
  	return result;
31
***************
32
*** 906,912 ****
33
  			/* According to the spec, we must fall back on the TSP context's policy for
34
  			 * auth if none is set in the NV object */
35
  			if (!sess->hUsageChild) {
36
! 				if ((result = obj_context_get_policy(obj_child, TSS_POLICY_USAGE,
37
  								     &sess->hUsageChild)))
38
  					goto error;
39
  			}
40
--- 908,914 ----
41
  			/* According to the spec, we must fall back on the TSP context's policy for
42
  			 * auth if none is set in the NV object */
43
  			if (!sess->hUsageChild) {
44
! 				if ((result = obj_context_get_policy(tspContext, TSS_POLICY_USAGE,
45
  								     &sess->hUsageChild)))
46
  					goto error;
47
  			}

Up to file-list app-crypt/trousers/files/tsp_policy.c.patch:

1
*** src/tspi/tsp_policy.c.old	Wed Mar 18 08:06:00 2009
2
--- src/tspi/tsp_policy.c	Thu Mar 19 14:46:10 2009
3
***************
4
*** 50,56 ****
5
  		popup_str = dflt;
6
  
7
  	/* pin the area where the secret will be put in memory */
8
! 	if (pin_mem(&secret, UI_MAX_SECRET_STRING_LENGTH)) {
9
  		LogError("Failed to pin secret in memory.");
10
  		return TSPERR(TSS_E_INTERNAL_ERROR);
11
  	}
12
--- 50,56 ----
13
  		popup_str = dflt;
14
  
15
  	/* pin the area where the secret will be put in memory */
16
! 	if (pin_mem(secret, UI_MAX_SECRET_STRING_LENGTH)) {
17
  		LogError("Failed to pin secret in memory.");
18
  		return TSPERR(TSS_E_INTERNAL_ERROR);
19
  	}
20
***************
21
*** 61,67 ****
22
  		DisplayPINWindow(secret, &secret_len, popup_str);
23
  
24
  	if (!secret_len) {
25
! 		unpin_mem(&secret, UI_MAX_SECRET_STRING_LENGTH);
26
  		return TSPERR(TSS_E_POLICY_NO_SECRET);
27
  	}
28
  
29
--- 61,67 ----
30
  		DisplayPINWindow(secret, &secret_len, popup_str);
31
  
32
  	if (!secret_len) {
33
! 		unpin_mem(secret, UI_MAX_SECRET_STRING_LENGTH);
34
  		return TSPERR(TSS_E_POLICY_NO_SECRET);
35
  	}
36
  
37
***************
38
*** 74,80 ****
39
  
40
  	/* zero, then unpin the memory */
41
  	memset(secret, 0, secret_len);
42
! 	unpin_mem(&secret, UI_MAX_SECRET_STRING_LENGTH);
43
  
44
  	return result;
45
  }
46
--- 74,80 ----
47
  
48
  	/* zero, then unpin the memory */
49
  	memset(secret, 0, secret_len);
50
! 	unpin_mem(secret, UI_MAX_SECRET_STRING_LENGTH);
51
  
52
  	return result;
53
  }
54
***************
55
*** 88,93 ****
56
--- 88,96 ----
57
  		return 0;
58
  	}
59
  
60
+ 	len += (uintptr_t)addr & PAGEOFFSET;
61
+ 	addr = (void *)((uintptr_t)addr & PAGEMASK);
62
+ 
63
  	if (mlock(addr, len) == -1) {
64
  		LogError("mlock: %s", strerror(errno));
65
  		return 1;
66
***************
67
*** 99,109 ****
68
--- 102,118 ----
69
  int
70
  unpin_mem(void *addr, size_t len)
71
  {
72
+ 	caddr_t addr1;
73
+ 	size_t  len1;
74
+ 
75
  	/* only root can lock pages into RAM */
76
  	if (getuid() != (uid_t)0) {
77
  		return 0;
78
  	}
79
  
80
+ 	len += (uintptr_t)addr & PAGEOFFSET;
81
+ 	addr = (void *)((uintptr_t)addr & PAGEMASK);
82
+ 
83
  	if (munlock(addr, len) == -1) {
84
  		LogError("mlock: %s", strerror(errno));
85
  		return 1;

Up to file-list app-crypt/trousers/files/tsp_ps.c.patch:

1
*** src/tspi/tsp_ps.c.old	Thu Jul 19 14:00:05 2007
2
--- src/tspi/tsp_ps.c	Tue Sep  2 11:23:33 2008
3
***************
4
*** 15,20 ****
5
--- 15,23 ----
6
  #include <string.h>
7
  #include <unistd.h>
8
  #include <stdio.h>
9
+ #ifdef SOLARIS
10
+ #include <limits.h>
11
+ #endif
12
  
13
  #include "trousers/tss.h"
14
  #include "trousers/trousers.h"

Up to file-list app-crypt/trousers/files/tspi_Makefile.in.patch:

1
*** src/tspi/Makefile.in.old	Wed Dec 17 14:28:57 2008
2
--- src/tspi/Makefile.in	Wed Dec 17 14:29:43 2008
3
***************
4
*** 372,378 ****
5
  	$(AM_CFLAGS) $(CFLAGS)
6
  CCLD = $(CC)
7
  LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
8
! 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
9
  SOURCES = $(libtspi_la_SOURCES)
10
  DIST_SOURCES = $(am__libtspi_la_SOURCES_DIST)
11
  ETAGS = etags
12
--- 372,378 ----
13
  	$(AM_CFLAGS) $(CFLAGS)
14
  CCLD = $(CC)
15
  LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
16
! 	$(AM_LDFLAGS) $(LDFLAGS) -z initarray=_init -o $@
17
  SOURCES = $(libtspi_la_SOURCES)
18
  DIST_SOURCES = $(am__libtspi_la_SOURCES_DIST)
19
  ETAGS = etags

Up to file-list app-crypt/trousers/files/tspi_aik.c.patch:

1
*** src/tspi/tspi_aik.c.old	Tue Sep 25 14:57:58 2007
2
--- src/tspi/tspi_aik.c	Tue Sep  2 11:23:56 2008
3
***************
4
*** 12,17 ****
5
--- 12,20 ----
6
  #include <stdio.h>
7
  #include <string.h>
8
  #include <inttypes.h>
9
+ #ifdef SOLARIS
10
+ #include <limits.h>
11
+ #endif
12
  
13
  #include "trousers/tss.h"
14
  #include "trousers/trousers.h"

Up to file-list app-crypt/trousers/files/tspi_delegate.c.patch:

1
*** src/tspi/tspi_delegate.c.old	Wed Feb 18 16:02:47 2009
2
--- src/tspi/tspi_delegate.c	Thu Feb 19 13:27:32 2009
3
***************
4
*** 348,353 ****
5
--- 348,354 ----
6
  	UINT64 tpmOffset;
7
  	UINT64 tssOffset;
8
  	TSS_RESULT result;
9
+ 	int i = 0;
10
  
11
  	if (!pulFamilyTableSize || !ppFamilyTable || !pulDelegateTableSize || !ppDelegateTable)
12
  		return TSPERR(TSS_E_BAD_PARAMETER);
13
***************
14
*** 376,382 ****
15
  			result = TSPERR(TSS_E_OUTOFMEMORY);
16
  			goto done;
17
  		}
18
! 		for (tpmOffset = 0, tssOffset = 0; tpmOffset < tpmFamilyTableSize; tssFamilyTableSize++) {
19
  			Trspi_UnloadBlob_TPM_FAMILY_TABLE_ENTRY(&tpmOffset, tpmFamilyTable,
20
  				&tpmFamilyEntry);
21
  
22
--- 377,383 ----
23
  			result = TSPERR(TSS_E_OUTOFMEMORY);
24
  			goto done;
25
  		}
26
! 		for (i = 0, tpmOffset = 0; tpmOffset < tpmFamilyTableSize; tssFamilyTableSize++, i++) {
27
  			Trspi_UnloadBlob_TPM_FAMILY_TABLE_ENTRY(&tpmOffset, tpmFamilyTable,
28
  				&tpmFamilyEntry);
29
  
30
***************
31
*** 387,394 ****
32
  				(tpmFamilyEntry.flags & TPM_FAMFLAG_ENABLE) ? TRUE : FALSE;
33
  			tssFamilyEntry.locked =
34
  				(tpmFamilyEntry.flags & TPM_FAMFLAG_DELEGATE_ADMIN_LOCK) ? TRUE : FALSE;
35
! 			Trspi_LoadBlob_TSS_FAMILY_TABLE_ENTRY(&tssOffset, (BYTE *)tssFamilyTable,
36
! 				&tssFamilyEntry);
37
  		}
38
  	}
39
  
40
--- 388,395 ----
41
  				(tpmFamilyEntry.flags & TPM_FAMFLAG_ENABLE) ? TRUE : FALSE;
42
  			tssFamilyEntry.locked =
43
  				(tpmFamilyEntry.flags & TPM_FAMFLAG_DELEGATE_ADMIN_LOCK) ? TRUE : FALSE;
44
! 
45
! 			tssFamilyTable[i] = tssFamilyEntry;
46
  		}
47
  	}
48
  
49
***************
50
*** 424,430 ****
51
  			result = TSPERR(TSS_E_OUTOFMEMORY);
52
  			goto done;
53
  		}
54
! 		for (tpmOffset = 0, tssOffset = 0; tpmOffset < tpmDelegateTableSize; tssDelegateTableSize++) {
55
  			Trspi_UnloadBlob_UINT32(&tpmOffset, &tableIndex, tpmDelegateTable);
56
  			if ((result = Trspi_UnloadBlob_TPM_DELEGATE_PUBLIC(&tpmOffset,
57
  					tpmDelegateTable, &tpmDelegatePublic))) {
58
--- 425,431 ----
59
  			result = TSPERR(TSS_E_OUTOFMEMORY);
60
  			goto done;
61
  		}
62
! 		for (i =0, tpmOffset = 0; tpmOffset < tpmDelegateTableSize; tssDelegateTableSize++, i++) {
63
  			Trspi_UnloadBlob_UINT32(&tpmOffset, &tableIndex, tpmDelegateTable);
64
  			if ((result = Trspi_UnloadBlob_TPM_DELEGATE_PUBLIC(&tpmOffset,
65
  					tpmDelegateTable, &tpmDelegatePublic))) {
66
***************
67
*** 449,457 ****
68
  			tssDelegateEntry.per2 = tpmDelegatePublic.permissions.per2;
69
  			tssDelegateEntry.familyID = tpmDelegatePublic.familyID;
70
  			tssDelegateEntry.verificationCount = tpmDelegatePublic.verificationCount;
71
- 			Trspi_LoadBlob_TSS_DELEGATION_TABLE_ENTRY(&tssOffset,
72
- 				(BYTE *)tssDelegateTable, &tssDelegateEntry);
73
  
74
  			free(tpmDelegatePublic.pcrInfo.pcrSelection.pcrSelect);
75
  		}
76
  	}
77
--- 450,458 ----
78
  			tssDelegateEntry.per2 = tpmDelegatePublic.permissions.per2;
79
  			tssDelegateEntry.familyID = tpmDelegatePublic.familyID;
80
  			tssDelegateEntry.verificationCount = tpmDelegatePublic.verificationCount;
81
  
82
+ 			tssDelegateTable[i] = tssDelegateEntry;
83
+ 
84
  			free(tpmDelegatePublic.pcrInfo.pcrSelection.pcrSelect);
85
  		}
86
  	}

Up to file-list app-crypt/trousers/files/tspi_makefile.am.patch:

1
*** src/tspi/Makefile.am.old	Tue Sep 25 18:15:01 2007
2
--- src/tspi/Makefile.am	Mon Oct 27 13:46:45 2008
3
***************
4
*** 215,220 ****
5
--- 215,224 ----
6
  libtspi_la_LDFLAGS+=@GTK_LIBS@
7
  libtspi_la_SOURCES+=gtk/main.c gtk/support.c gtk/interface.c gtk/callbacks.c
8
  endif
9
+ if OPENSSL_UI
10
+ libtspi_la_LDFLAGS+=
11
+ libtspi_la_SOURCES+=ssl_ui.c
12
+ endif
13
  
14
  if TSS_BUILD_NV
15
  libtspi_la_SOURCES+=tspi_nv.c obj_nv.c tsp_nv.c rpc/@RPC@/rpc_nv.c

Up to file-list app-crypt/trousers/files/tspps.c.patch:

1
*** src/tspi/ps/tspps.c.old	Thu Dec 18 08:37:58 2008
2
--- src/tspi/ps/tspps.c	Thu Dec 18 08:56:13 2008
3
***************
4
*** 19,24 ****
5
--- 19,29 ----
6
  #include <sys/file.h>
7
  #include <sys/stat.h>
8
  #include <assert.h>
9
+ #ifdef SOLARIS
10
+ #include <fcntl.h>
11
+ #include <limits.h>
12
+ #include <netdb.h>
13
+ #endif
14
  
15
  #include "trousers/tss.h"
16
  #include "trousers/trousers.h"
17
***************
18
*** 30,35 ****
19
--- 35,51 ----
20
  
21
  static int user_ps_fd = -1;
22
  static MUTEX_DECLARE_INIT(user_ps_lock);
23
+ #ifdef SOLARIS
24
+ static struct flock fl = {
25
+ 	0,
26
+ 	0,
27
+ 	0,
28
+ 	0,
29
+ 	0,
30
+ 	0,
31
+ 	{0, 0, 0, 0}
32
+ 	};
33
+ #endif
34
  
35
  /*
36
   * Determine the default path to the persistent storage file and create it if it doesn't exist.
37
***************
38
*** 38,47 ****
39
  get_user_ps_path(char **file)
40
  {
41
  	TSS_RESULT result = TSPERR(TSS_E_INTERNAL_ERROR);
42
! 	char *file_name = NULL, *home_dir = NULL;
43
  	struct passwd pw, *pwp;
44
  	struct stat stat_buf;
45
  	char buf[PASSWD_BUFSIZE];
46
  	uid_t euid;
47
  	int rc;
48
  
49
--- 54,64 ----
50
  get_user_ps_path(char **file)
51
  {
52
  	TSS_RESULT result = TSPERR(TSS_E_INTERNAL_ERROR);
53
! 	char *file_name = NULL, *psdir = NULL;
54
  	struct passwd pw, *pwp;
55
  	struct stat stat_buf;
56
  	char buf[PASSWD_BUFSIZE];
57
+ 	char hostname[MAXHOSTNAMELEN];
58
  	uid_t euid;
59
  	int rc;
60
  
61
***************
62
*** 49,80 ****
63
  		*file = strdup(file_name);
64
  		return (*file) ? TSS_SUCCESS : TSPERR(TSS_E_OUTOFMEMORY);
65
  	}
66
- 
67
  	euid = geteuid();
68
! 
69
  	setpwent();
70
  	while (1) {
71
  		rc = getpwent_r(&pw, buf, PASSWD_BUFSIZE, &pwp);
72
  		if (rc) {
73
! 			LogDebugFn("USER PS: Error getting path to home directory: getpwent_r: %s",
74
  				   strerror(rc));
75
! 			endpwent();
76
! 			return TSPERR(TSS_E_INTERNAL_ERROR);
77
! 		}
78
  
79
! 		if (euid == pwp->pw_uid) {
80
! 			home_dir = strdup(pwp->pw_dir);
81
! 			break;
82
  		}
83
  	}
84
  	endpwent();
85
! 
86
! 	if (!home_dir)
87
  		return TSPERR(TSS_E_OUTOFMEMORY);
88
  
89
! 	/* Tack on TSS_USER_PS_DIR and see if it exists */
90
! 	rc = snprintf(buf, PASSWD_BUFSIZE, "%s/%s", home_dir, TSS_USER_PS_DIR);
91
! 	if (rc == PASSWD_BUFSIZE) {
92
  		LogDebugFn("USER PS: Path to file too long! (> %d bytes)", PASSWD_BUFSIZE);
93
  		goto done;
94
  	}
95
--- 66,108 ----
96
  		*file = strdup(file_name);
97
  		return (*file) ? TSS_SUCCESS : TSPERR(TSS_E_OUTOFMEMORY);
98
  	}
99
  	euid = geteuid();
100
! #ifdef SOLARIS
101
! 	/*
102
! 	 * Solaris keeps user PS in a local directory to avoid NFS problems	
103
! 	 * and potential conflicts when sharing the same PS file among
104
! 	 * multiple machines with different TPMs.
105
! 	 *
106
! 	 * The directory path is /var/tpm/userps/[EUID]/
107
! 	 */
108
! 	rc = snprintf(buf, sizeof (buf), "%s/%d", TSS_USER_PS_DIR, euid);
109
! #else
110
  	setpwent();
111
  	while (1) {
112
  		rc = getpwent_r(&pw, buf, PASSWD_BUFSIZE, &pwp);
113
  		if (rc) {
114
! 			pwp = getpwent_r(&pw, buf, PASSWD_BUFSIZE);
115
! 			if (pwp == NULL) {
116
! 				LogDebugFn("USER PS: Error getting path to home directory: getpwent_r: %s",
117
  				   strerror(rc));
118
! 				endpwent();
119
! 				return TSPERR(TSS_E_INTERNAL_ERROR);
120
! 			}
121
  
122
! 			if (euid == pwp->pw_uid) {
123
! 				psdir = strdup(pwp->pw_dir);
124
! 				break;
125
! 			}
126
  		}
127
  	}
128
  	endpwent();
129
! 	if (!psdir)
130
  		return TSPERR(TSS_E_OUTOFMEMORY);
131
  
132
! 	rc = snprintf(buf, sizeof (buf), "%s/%s", psdir, TSS_USER_PS_DIR);
133
! #endif /* SOLARIS */
134
! 
135
! 	if (rc == sizeof (buf)) {
136
  		LogDebugFn("USER PS: Path to file too long! (> %d bytes)", PASSWD_BUFSIZE);
137
  		goto done;
138
  	}
139
***************
140
*** 83,89 ****
141
  	if ((rc = stat(buf, &stat_buf)) == -1) {
142
  		if (errno == ENOENT) {
143
  			errno = 0;
144
! 			/* Create the base directory, $HOME/.trousers */
145
  			if ((rc = mkdir(buf, 0700)) == -1) {
146
  				LogDebugFn("USER PS: Error creating dir: %s: %s", buf,
147
  					   strerror(errno));
148
--- 111,117 ----
149
  	if ((rc = stat(buf, &stat_buf)) == -1) {
150
  		if (errno == ENOENT) {
151
  			errno = 0;
152
! 			/* Create the user's ps directory if it is not there. */
153
  			if ((rc = mkdir(buf, 0700)) == -1) {
154
  				LogDebugFn("USER PS: Error creating dir: %s: %s", buf,
155
  					   strerror(errno));
156
***************
157
*** 90,103 ****
158
  				goto done;
159
  			}
160
  		} else {
161
! 			LogDebugFn("USER PS: Error stating dir: %s: %s", buf, strerror(errno));
162
  			goto done;
163
  		}
164
  	}
165
  
166
  	/* Directory exists or has been created, return the path to the file */
167
! 	rc = snprintf(buf, PASSWD_BUFSIZE, "%s/%s/%s", home_dir, TSS_USER_PS_DIR,
168
  		      TSS_USER_PS_FILE);
169
  	if (rc == PASSWD_BUFSIZE) {
170
  		LogDebugFn("USER PS: Path to file too long! (> %d bytes)", PASSWD_BUFSIZE);
171
  	} else
172
--- 118,137 ----
173
  				goto done;
174
  			}
175
  		} else {
176
! 			LogDebugFn("USER PS: Error stating dir: %s: %s",
177
! 			    buf, strerror(errno));
178
  			goto done;
179
  		}
180
  	}
181
  
182
  	/* Directory exists or has been created, return the path to the file */
183
! #ifdef SOLARIS
184
! 	rc = snprintf(buf, sizeof(buf), "%s/%d/%s", TSS_USER_PS_DIR, euid,
185
  		      TSS_USER_PS_FILE);
186
+ #else
187
+ 	rc = snprintf(buf, sizeof(buf), "%s/%s/%s", psdir, TSS_USER_PS_DIR,
188
+ 		      TSS_USER_PS_FILE);
189
+ #endif
190
  	if (rc == PASSWD_BUFSIZE) {
191
  		LogDebugFn("USER PS: Path to file too long! (> %d bytes)", PASSWD_BUFSIZE);
192
  	} else
193
***************
194
*** 105,111 ****
195
  
196
  	result = (*file) ? TSS_SUCCESS : TSPERR(TSS_E_OUTOFMEMORY);
197
  done:
198
! 	free(home_dir);
199
  	return result;
200
  }
201
  
202
--- 139,145 ----
203
  
204
  	result = (*file) ? TSS_SUCCESS : TSPERR(TSS_E_OUTOFMEMORY);
205
  done:
206
! 	free(psdir);
207
  	return result;
208
  }
209
  
210
***************
211
*** 120,131 ****
212
  
213
  	/* check the global file handle first.  If it exists, lock it and return */
214
  	if (user_ps_fd != -1) {
215
  		if ((rc = flock(user_ps_fd, LOCK_EX))) {
216
  			LogDebug("USER PS: failed to lock file: %s", strerror(errno));
217
  			MUTEX_UNLOCK(user_ps_lock);
218
  			return TSPERR(TSS_E_INTERNAL_ERROR);
219
  		}
220
- 
221
  		*fd = user_ps_fd;
222
  		return TSS_SUCCESS;
223
  	}
224
--- 154,169 ----
225
  
226
  	/* check the global file handle first.  If it exists, lock it and return */
227
  	if (user_ps_fd != -1) {
228
+ #ifdef SOLARIS
229
+ 		fl.l_type = F_WRLCK;
230
+ 		if ((rc = fcntl(user_ps_fd, F_SETLKW, &fl))) {
231
+ #else
232
  		if ((rc = flock(user_ps_fd, LOCK_EX))) {
233
+ #endif /* SOLARIS */
234
  			LogDebug("USER PS: failed to lock file: %s", strerror(errno));
235
  			MUTEX_UNLOCK(user_ps_lock);
236
  			return TSPERR(TSS_E_INTERNAL_ERROR);
237
  		}
238
  		*fd = user_ps_fd;
239
  		return TSS_SUCCESS;
240
  	}
241
***************
242
*** 144,151 ****
243
  		MUTEX_UNLOCK(user_ps_lock);
244
  		return TSPERR(TSS_E_INTERNAL_ERROR);
245
  	}
246
! 
247
  	if ((rc = flock(user_ps_fd, LOCK_EX))) {
248
  		LogDebug("USER PS: failed to get lock of %s: %s", file_name, strerror(errno));
249
  		free(file_name);
250
  		close(user_ps_fd);
251
--- 182,193 ----
252
  		MUTEX_UNLOCK(user_ps_lock);
253
  		return TSPERR(TSS_E_INTERNAL_ERROR);
254
  	}
255
! #ifdef SOLARIS
256
! 	fl.l_type = F_WRLCK;
257
! 	if ((rc = fcntl(user_ps_fd, F_SETLKW, &fl))) {
258
! #else
259
  	if ((rc = flock(user_ps_fd, LOCK_EX))) {
260
+ #endif /* SOLARIS */
261
  		LogDebug("USER PS: failed to get lock of %s: %s", file_name, strerror(errno));
262
  		free(file_name);
263
  		close(user_ps_fd);
264
***************
265
*** 167,173 ****
266
--- 209,220 ----
267
  	fsync(fd);
268
  
269
  	/* release the file lock */
270
+ #ifdef SOLARIS
271
+ 	fl.l_type = F_UNLCK;
272
+ 	if ((rc = fcntl(fd, F_SETLKW, &fl))) {
273
+ #else
274
  	if ((rc = flock(fd, LOCK_UN))) {
275
+ #endif /* SOLARIS */
276
  		LogDebug("USER PS: failed to unlock file: %s", strerror(errno));
277
  		rc = -1;
278
  	}

Up to file-list app-crypt/trousers/files/tspps.h.patch:

1
*** src/include/tspps.h.old	Thu Dec 18 08:40:21 2008
2
--- src/include/tspps.h	Thu Dec 18 08:41:51 2008
3
***************
4
*** 13,25 ****
5
  
6
  #define PASSWD_BUFSIZE		4096
7
  
8
  #define TSS_USER_PS_DIR		".trousers"
9
  #define TSS_USER_PS_FILE	"user.data"
10
  
11
  TSS_RESULT	   get_file(int *);
12
  int		   put_file(int);
13
! inline TSS_RESULT  read_data(int, void *, UINT32);
14
! inline TSS_RESULT  write_data(int, void *, UINT32);
15
  UINT32		   psfile_get_num_keys(int);
16
  TSS_RESULT	   psfile_get_parent_uuid_by_uuid(int, TSS_UUID *, TSS_UUID *);
17
  TSS_RESULT	   psfile_remove_key_by_uuid(int, TSS_UUID *);
18
--- 13,29 ----
19
  
20
  #define PASSWD_BUFSIZE		4096
21
  
22
+ #ifdef SOLARIS
23
+ #define TSS_USER_PS_DIR		"/var/tpm/userps"
24
+ #else
25
  #define TSS_USER_PS_DIR		".trousers"
26
+ #endif
27
  #define TSS_USER_PS_FILE	"user.data"
28
  
29
  TSS_RESULT	   get_file(int *);
30
  int		   put_file(int);
31
! TSS_RESULT         read_data(int, void *, UINT32);
32
! TSS_RESULT         write_data(int, void *, UINT32);
33
  UINT32		   psfile_get_num_keys(int);
34
  TSS_RESULT	   psfile_get_parent_uuid_by_uuid(int, TSS_UUID *, TSS_UUID *);
35
  TSS_RESULT	   psfile_remove_key_by_uuid(int, TSS_UUID *);

Up to file-list app-crypt/trousers/metadata.xml:

1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
3
<pkgmetadata>
4
	<herd>crypto</herd>
5
	<maintainer>
6
		<email>crypto@gentoo.org</email>
7
		<name>Crypto Herd</name>
8
	</maintainer>
9
</pkgmetadata>

Up to file-list app-crypt/trousers/trousers-0.3.1.ebuild:

1
# Copyright 1999-2009 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
3
# $Header: /var/cvsroot/gentoo-x86/app-crypt/trousers/trousers-0.3.1.ebuild,v 1.7 2009/03/29 15:19:32 arfrever Exp $
4
5
inherit autotools base eutils flag-o-matic
6
#linux-info
7
8
DESCRIPTION="An open-source TCG Software Stack (TSS) v1.1 implementation"
9
HOMEPAGE="http://trousers.sf.net"
10
SRC_URI="mirror://sourceforge/trousers/${P}.tar.gz"
11
LICENSE="CPL-1.0"
12
SLOT="0"
13
KEYWORDS="~amd64 ~x86"
14
IUSE="doc"
15
# >=dev-libs/glib-2
16
RDEPEND="
17
	>=dev-libs/openssl-0.9.7"
18
19
DEPEND="${RDEPEND}
20
	dev-util/pkgconfig"
21
22
#PATCHES=(	"${FILESDIR}/${PN}-0.2.3-nouseradd.patch"
23
#		"${FILESDIR}/${P}-qa.patch"
24
#		"${FILESDIR}/${P}-gcc43.patch"	)
25
26
PATCHES=(
27
"${FILESDIR}/Makefile.in.patch"
28
"${FILESDIR}/configure.in.patch"
29
"${FILESDIR}/hosttable.c.patch"
30
"${FILESDIR}/platform.c.patch"
31
"${FILESDIR}/ps_utils.c.patch"
32
"${FILESDIR}/ssl_ui.c.patch"
33
"${FILESDIR}/svrside.c.patch"
34
"${FILESDIR}/tcs_auth_mgr.c.patch"
35
"${FILESDIR}/tcs_key_mem_cache.c.patch"
36
"${FILESDIR}/tcs_pbg.c.patch"
37
"${FILESDIR}/tcsd.8.in.patch"
38
"${FILESDIR}/tcsd.h.patch"
39
"${FILESDIR}/tcsd_conf.c.patch"
40
"${FILESDIR}/tcslog.h.patch"
41
"${FILESDIR}/tcsps.c.patch"
42
"${FILESDIR}/tcsps.h.patch"
43
"${FILESDIR}/tddl.c.patch"
44
"${FILESDIR}/trousers.c.patch"
45
"${FILESDIR}/tsp_auth.c.patch"
46
"${FILESDIR}/tsp_policy.c.patch"
47
"${FILESDIR}/tsp_ps.c.patch"
48
"${FILESDIR}/tspi_Makefile.in.patch"
49
"${FILESDIR}/tspi_aik.c.patch"
50
"${FILESDIR}/tspi_delegate.c.patch"
51
"${FILESDIR}/tspi_makefile.am.patch"
52
"${FILESDIR}/tspps.c.patch"
53
"${FILESDIR}/tspps.h.patch"
54
"${FILESDIR}/symmetric.c.patch"
55
"${FILESDIR}/dist-no-useradd-Makefile.am.patch"
56
)
57
58
#pkg_setup() {
59
	#enewgroup tss
60
	#enewuser tss -1 -1 /var/lib/tpm tss
61
#}
62
63
src_unpack() {
64
	base_src_unpack
65
66
	#sed -e "s/-Werror //" -i configure.in
67
	#eautoreconf
68
	cd ${WORKDIR}/${P}/src/include/ || die 
69
	for f in `ls *.h` ;  do
70
        /usr/bin/dos2unix $f $f
71
	done
72
	cd ${WORKDIR}/${P}/src/include/tss || die
73
	for f in `ls *.h` ;  do
74
        /usr/bin/dos2unix $f $f
75
	done
76
	cd ${WORKDIR}/${P}/src/include/trousers || die
77
	for f in `ls *.h` ;  do
78
        /usr/bin/dos2unix $f $f
79
	done
80
81
}
82
83
src_compile() {
84
	aclocal
85
	automake
86
	autoreconf
87
	append-cflags -DSOLARIS
88
	econf \
89
		--with-gui=none \
90
		LIBS='-lnsl -lsocket' \
91
		| die "configure failed"
92
	emake | die
93
}
94
95
src_install() {
96
	keepdir /var/lib/tpm
97
	make DESTDIR="${D}" install || die
98
	dodoc AUTHORS ChangeLog NICETOHAVES README TODO
99
	use doc && dodoc doc/*
100
#	newinitd "${FILESDIR}/tcsd.initd" tcsd
101
#	newconfd "${FILESDIR}/tcsd.confd" tcsd
102
}