summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2016-03-30 16:26:16 -0700
committerArmin Kuster <akuster808@gmail.com>2016-04-23 08:03:42 -0700
commitf2f70c2de96c6ba6f120c249833d22b8776f58a9 (patch)
tree82d94dd99600f08c2ea99ee74dc1f73c910a2ca2
parentae256956d8037532c6d7ed3f752c2707053687a5 (diff)
downloadmeta-security-f2f70c2de96c6ba6f120c249833d22b8776f58a9.tar.gz
trousers: add package
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--recipes-tpm/trousers/files/07-read_data-not-inline.patch65
-rw-r--r--recipes-tpm/trousers/files/tcsd.service10
-rw-r--r--recipes-tpm/trousers/files/trousers-udev.rules2
-rw-r--r--recipes-tpm/trousers/files/trousers.init.sh65
-rw-r--r--recipes-tpm/trousers/trousers_0.3.13.bb112
5 files changed, 254 insertions, 0 deletions
diff --git a/recipes-tpm/trousers/files/07-read_data-not-inline.patch b/recipes-tpm/trousers/files/07-read_data-not-inline.patch
new file mode 100644
index 0000000..76ba98a
--- /dev/null
+++ b/recipes-tpm/trousers/files/07-read_data-not-inline.patch
@@ -0,0 +1,65 @@
1Title: Remove inline keyword for read_data and write_data
2Date: 2015-06-28
3Origin: https://chromium.googlesource.com/chromiumos%2Fthird_party%2Ftrousers/+/c9c7cd50640c2d8882a04f59f1bcb383a88b19e9
4Bug-Debian: http://bugs.debian.org/778149
5Index: trousers/src/include/tcsps.h
6===================================================================
7--- trousers.orig/src/include/tcsps.h
8+++ trousers/src/include/tcsps.h
9@@ -23,13 +23,6 @@ int get_file();
10 int put_file(int);
11 void close_file(int);
12 void ps_destroy();
13-#ifdef SOLARIS
14-TSS_RESULT read_data(int, void *, UINT32);
15-TSS_RESULT write_data(int, void *, UINT32);
16-#else
17-inline TSS_RESULT read_data(int, void *, UINT32);
18-inline TSS_RESULT write_data(int, void *, UINT32);
19-#endif
20 int write_key_init(int, UINT32, UINT32, UINT32);
21 TSS_RESULT cache_key(UINT32, UINT16, TSS_UUID *, TSS_UUID *, UINT16, UINT32, UINT32);
22 TSS_RESULT UnloadBlob_KEY_PS(UINT16 *, BYTE *, TSS_KEY *);
23Index: trousers/src/include/tspps.h
24===================================================================
25--- trousers.orig/src/include/tspps.h
26+++ trousers/src/include/tspps.h
27@@ -18,8 +18,8 @@
28
29 TSS_RESULT get_file(int *);
30 int put_file(int);
31-inline TSS_RESULT read_data(int, void *, UINT32);
32-inline TSS_RESULT write_data(int, void *, UINT32);
33+TSS_RESULT read_data(int, void *, UINT32);
34+TSS_RESULT write_data(int, void *, UINT32);
35 UINT32 psfile_get_num_keys(int);
36 TSS_RESULT psfile_get_parent_uuid_by_uuid(int, TSS_UUID *, TSS_UUID *);
37 TSS_RESULT psfile_remove_key_by_uuid(int, TSS_UUID *);
38Index: trousers/src/tcs/ps/ps_utils.c
39===================================================================
40--- trousers.orig/src/tcs/ps/ps_utils.c
41+++ trousers/src/tcs/ps/ps_utils.c
42@@ -42,11 +42,7 @@
43 struct key_disk_cache *key_disk_cache_head = NULL;
44
45
46-#ifdef SOLARIS
47 TSS_RESULT
48-#else
49-inline TSS_RESULT
50-#endif
51 read_data(int fd, void *data, UINT32 size)
52 {
53 int rc;
54@@ -64,11 +60,7 @@ read_data(int fd, void *data, UINT32 siz
55 }
56
57
58-#ifdef SOLARIS
59 TSS_RESULT
60-#else
61-inline TSS_RESULT
62-#endif
63 write_data(int fd, void *data, UINT32 size)
64 {
65 int rc;
diff --git a/recipes-tpm/trousers/files/tcsd.service b/recipes-tpm/trousers/files/tcsd.service
new file mode 100644
index 0000000..787d4e9
--- /dev/null
+++ b/recipes-tpm/trousers/files/tcsd.service
@@ -0,0 +1,10 @@
1[Unit]
2Description=TCG Core Services Daemon
3After=syslog.target
4
5[Service]
6Type=forking
7ExecStart=@SBINDIR@/tcsd
8
9[Install]
10WantedBy=multi-user.target
diff --git a/recipes-tpm/trousers/files/trousers-udev.rules b/recipes-tpm/trousers/files/trousers-udev.rules
new file mode 100644
index 0000000..256babd
--- /dev/null
+++ b/recipes-tpm/trousers/files/trousers-udev.rules
@@ -0,0 +1,2 @@
1# trousers daemon expects tpm device to be owned by tss user & group
2KERNEL=="tpm[0-9]*", MODE="0600", OWNER="tss", GROUP="tss"
diff --git a/recipes-tpm/trousers/files/trousers.init.sh b/recipes-tpm/trousers/files/trousers.init.sh
new file mode 100644
index 0000000..0ecf7cc
--- /dev/null
+++ b/recipes-tpm/trousers/files/trousers.init.sh
@@ -0,0 +1,65 @@
1#!/bin/sh
2
3### BEGIN INIT INFO
4# Provides: tcsd trousers
5# Required-Start: $local_fs $remote_fs $network
6# Required-Stop: $local_fs $remote_fs $network
7# Should-Start:
8# Should-Stop:
9# Default-Start: 2 3 4 5
10# Default-Stop: 0 1 6
11# Short-Description: starts tcsd
12# Description: tcsd belongs to the TrouSerS TCG Software Stack
13### END INIT INFO
14
15PATH=/sbin:/bin:/usr/sbin:/usr/bin
16DAEMON=/usr/sbin/tcsd
17NAME=tcsd
18DESC="Trusted Computing daemon"
19USER="tss"
20
21test -x "${DAEMON}" || exit 0
22
23# Read configuration variable file if it is present
24[ -r /etc/default/$NAME ] && . /etc/default/$NAME
25
26case "${1}" in
27 start)
28 echo "Starting $DESC: "
29
30 if [ ! -e /dev/tpm* ]
31 then
32 echo "device driver not loaded, skipping."
33 exit 0
34 fi
35
36 start-stop-daemon --start --quiet --oknodo --pidfile /var/run/${NAME}.pid --user ${USER} --chuid ${USER} --exec ${DAEMON} -- ${DAEMON_OPTS}
37 RETVAL="$?"
38 echo "$NAME."
39 [ "$RETVAL" = 0 ] && pidof $DAEMON > /var/run/${NAME}.pid
40 exit $RETVAL
41 ;;
42
43 stop)
44 echo "Stopping $DESC: "
45
46 start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/${NAME}.pid --user ${USER} --exec ${DAEMON}
47 RETVAL="$?"
48 echo "$NAME."
49 rm -f /var/run/${NAME}.pid
50 exit $RETVAL
51 ;;
52
53 restart|force-reload)
54 "${0}" stop
55 sleep 1
56 "${0}" start
57 exit $?
58 ;;
59 *)
60 echo "Usage: ${NAME} {start|stop|restart|force-reload|status}" >&2
61 exit 3
62 ;;
63esac
64
65exit 0
diff --git a/recipes-tpm/trousers/trousers_0.3.13.bb b/recipes-tpm/trousers/trousers_0.3.13.bb
new file mode 100644
index 0000000..7001788
--- /dev/null
+++ b/recipes-tpm/trousers/trousers_0.3.13.bb
@@ -0,0 +1,112 @@
1SUMMARY = "TrouSerS - An open-source TCG Software Stack implementation."
2LICENSE = "BSD"
3HOMEPAGE = "http://sourceforge.net/projects/trousers/"
4LIC_FILES_CHKSUM = "file://README;startline=3;endline=4;md5=2af28fbed0832e4d83a9e6dd68bb4413"
5SECTION = "security/tpm"
6
7DEPENDS = "openssl"
8
9SRC_URI = "http://sourceforge.net/projects/trousers/files/${BPN}/${PV}/${BPN}-${PV}.tar.gz \
10 file://07-read_data-not-inline.patch \
11 file://trousers.init.sh \
12 file://trousers-udev.rules \
13 file://tcsd.service \
14 "
15
16SRC_URI[md5sum] = "ad508f97b406f6e48cd90e85d78e7ca8"
17SRC_URI[sha256sum] = "bb908e4a3c88a17b247a4fc8e0fff3419d8a13170fe7bdfbe0e2c5c082a276d3"
18
19inherit autotools pkgconfig useradd update-rc.d
20inherit ${@base_contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','', d)}
21
22PACKAGECONFIG ?= "gmp "
23PACKAGECONFIG[gmp] = "--with-gmp, --with-gmp=no, gmp"
24PACKAGECONFIG[gtk] = "--with-gui=gtk, --with-gui=none, gtk+"
25
26do_install () {
27 oe_runmake DESTDIR=${D} install
28}
29
30do_install_append() {
31 install -d ${D}${sysconfdir}/init.d
32 install -m 0755 ${WORKDIR}/trousers.init.sh ${D}${sysconfdir}/init.d/trousers
33 install -d ${D}${sysconfdir}/udev/rules.d
34 install -m 0644 ${WORKDIR}/trousers-udev.rules ${D}${sysconfdir}/udev/rules.d/45-trousers.rules
35
36 if ${@base_contains('DISTRO_FEATURES','systemd','true','false',d)}; then
37 install -d ${D}${systemd_unitdir}/system
38 install -m 0644 ${WORKDIR}/tcsd.service ${D}${systemd_unitdir}/system/
39 sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/tcsd.service
40 fi
41 chown -R root:root ${D}${sysconfdir}/tcsd.conf
42}
43
44CONFFILES_${PN} += "${sysconfig}/tcsd.conf"
45
46PROVIDES = "${PACKAGES}"
47PACKAGES = " \
48 libtspi \
49 libtspi-dbg \
50 libtspi-dev \
51 libtspi-doc \
52 libtspi-staticdev \
53 trousers \
54 trousers-dbg \
55 trousers-doc \
56 "
57
58FILES_libtspi = " \
59 ${libdir}/*.so.1.2.0 \
60 "
61FILES_libtspi-dbg = " \
62 ${libdir}/.debug \
63 ${prefix}/src/debug/${PN}/${PV}-${PR}/${PN}-${PV}/src/tspi \
64 ${prefix}/src/debug/${PN}/${PV}-${PR}/${PN}-${PV}/src/trspi \
65 ${prefix}/src/debug/${PN}/${PV}-${PR}/${PN}-${PV}/src/include/*.h \
66 ${prefix}/src/debug/${PN}/${PV}-${PR}/${PN}-${PV}/src/include/tss \
67 "
68FILES_libtspi-dev = " \
69 ${includedir} \
70 ${libdir}/*.so \
71 ${libdir}/*.so.1 \
72 "
73FILES_libtspi-doc = " \
74 ${mandir}/man3 \
75 "
76FILES_libtspi-staticdev = " \
77 ${libdir}/*.la \
78 ${libdir}/*.a \
79 "
80FILES_${PN} = " \
81 ${sbindir}/tcsd \
82 ${sysconfdir} \
83 ${localstatedir} \
84 "
85
86FILES_${PN}-dev += "${libdir}/trousers"
87
88FILES_${PN}-dbg = " \
89 ${sbindir}/.debug \
90 ${prefix}/src/debug/${PN}/${PV}-${PR}/${PN}-${PV}/src/tcs \
91 ${prefix}/src/debug/${PN}/${PV}-${PR}/${PN}-${PV}/src/tcsd \
92 ${prefix}/src/debug/${PN}/${PV}-${PR}/${PN}-${PV}/src/tddl \
93 ${prefix}/src/debug/${PN}/${PV}-${PR}/${PN}-${PV}/src/trousers \
94 ${prefix}/src/debug/${PN}/${PV}-${PR}/${PN}-${PV}/src/include/trousers \
95 "
96FILES_${PN}-doc = " \
97 ${mandir}/man5 \
98 ${mandir}/man8 \
99 "
100
101INITSCRIPT_NAME = "trousers"
102INITSCRIPT_PARAMS = "start 99 2 3 4 5 . stop 19 0 1 6 ."
103
104USERADD_PACKAGES = "${PN}"
105GROUPADD_PARAM_${PN} = "tss"
106USERADD_PARAM_${PN} = "-M -d /var/lib/tpm -s /bin/false -g tss tss"
107
108SYSTEMD_PACKAGES = "${PN}"
109SYSTEMD_SERVICE_${PN} = "tcsd.service"
110SYSTEMD_AUTO_ENABLE = "disable"
111
112BBCLASSEXTEND = "native"