summaryrefslogtreecommitdiff
path: root/app-crypt/tpm-emulator
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-09-15 17:37:09 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-09-15 17:37:09 +0100
commit586819755b4dbfdffdc8a725ab7c0f86095b8489 (patch)
treed6790c838cfe9607c996e4913fdf11bad5fdd528 /app-crypt/tpm-emulator
parent3f71901f8c228f4de570abed1831ce3ee425343e (diff)
gentoo resync : 15.09.2018
Diffstat (limited to 'app-crypt/tpm-emulator')
-rw-r--r--app-crypt/tpm-emulator/Manifest9
-rw-r--r--app-crypt/tpm-emulator/files/tpm-emulator-0.7.4-build.patch100
-rw-r--r--app-crypt/tpm-emulator/files/tpm-emulator-0.7.4-cmake.patch120
-rw-r--r--app-crypt/tpm-emulator/files/tpm-emulator.confd-r21
-rw-r--r--app-crypt/tpm-emulator/files/tpm-emulator.initd-r246
-rw-r--r--app-crypt/tpm-emulator/metadata.xml3
-rw-r--r--app-crypt/tpm-emulator/tpm-emulator-0.7.4-r1.ebuild4
-rw-r--r--app-crypt/tpm-emulator/tpm-emulator-0.7.4-r2.ebuild85
8 files changed, 366 insertions, 2 deletions
diff --git a/app-crypt/tpm-emulator/Manifest b/app-crypt/tpm-emulator/Manifest
index 9c29df35b675..723e3eedd01d 100644
--- a/app-crypt/tpm-emulator/Manifest
+++ b/app-crypt/tpm-emulator/Manifest
@@ -1,5 +1,10 @@
+AUX tpm-emulator-0.7.4-build.patch 3995 BLAKE2B 23a0c34f3d34c3cf154b22a2cf6c79216e580d298a31657f2d247b58ebdeadd00923340656885931c86777385916cc5df3e55c05704d9c213a46673ca5999483 SHA512 852d7fc90c558c37dec6409e09cbe6e94494cba023d7de38702e475e698f9210ff2cb937f51751b25ea48015421c556d1fe71dafdcb6764d2e6fe938d61f4a4b
+AUX tpm-emulator-0.7.4-cmake.patch 3358 BLAKE2B 27c1fbe5cd55f5838f9010c2d38f2037492f562553c5ed99eb3bcbea41dc2d899d42fef73b7f86b7c1cac12a9a5a43273e97834d5c3b4b9436157e7292d876ef SHA512 3d46f18957ab569e927ade7c3b08aa94f01beeafbe80a2cf3601f07492355bb354f060b8e3f9aeb52de8aa2f2db7f26faec635191b00b9d5adc33c5d7caeada1
AUX tpm-emulator.confd-0.7.4 34 BLAKE2B 39d858219bf12309c361bd65070df3a941de10d073e3014e0196bc3f100c605a7be1700c1e25d46fa94a27778c453732e9102be3fe11260f6b3bf617c47bb5ec SHA512 61b5145d3fa5b778ba09e66a25ea183165fafbdafe54aa77d171aed2a87f6b5febc918d33603a9bf58320e9ff3f79e3ec58d03d4674562d31c1c90b942faf504
+AUX tpm-emulator.confd-r2 20 BLAKE2B 13dd9f09a0a4efb9a039bfeababb5f00b8b2c3c1777e60c531e874ef6f3b4d00319d7962bd321f8530289c797ea110f6cde91bc6af338e38be7d96f71f6474cb SHA512 824d35e037f1036d53353bd0e2bf9136cd94d07a71df9ebdf32a513ff53a47b25e38e3b760e58c18909559f1adbea2faae615c25f2cf9f1df03eef8582648bcc
AUX tpm-emulator.initd-0.7.4 1100 BLAKE2B 19736ff8ad067390adb951f4b3f30656bf7345f36cba51b5a96114f3acc069391f3c4e7ecbb563f2ad6fbb25263b950b907c130b5dd0a6523a607a264de61469 SHA512 5fab6f4c9b7057fa1bf23b179747d125ec77729a1a69b762735c429824ce6dfee3033012b027a44e5c731ec86a4e78b8b64c44d27b207867a26a9663382a84f9
+AUX tpm-emulator.initd-r2 776 BLAKE2B 0daa0247396d1b5f1c9542b28f825899a5cc45bd748b6b7e2328440fd466fd6b461e32487a955816a79827bf350cfb33bd71a6b197a8e67dbf5509750098cb59 SHA512 22d7b163dc6f567c1900a275ae545c4421b2d459ba535a24f48d7ad2609f5df36533849aa781d4dd704961db102eea08c99b79c01d0e3981fb46d2eb4e39d6fe
DIST tpm_emulator-0.7.4.tar.gz 214145 BLAKE2B b8bbd53ecfb90e87f1306c03d2c65a472819d23d10bd63fa966bfadef4776c3876c2f6fc03cc878ece670bdfcd22c9f403ef4bc7f4593a0a6c7f8d17051ac3ba SHA512 4928b5b82f57645be9408362706ff2c4d9baa635b21b0d41b1c82930e8c60a759b1ea4fa74d7e6c7cae1b7692d006aa5cb72df0c3b88bf049779aa2b566f9d35
-EBUILD tpm-emulator-0.7.4-r1.ebuild 1737 BLAKE2B a8ff1382b655c0ea570b6556cbd75b28861c134137cd445275fe2179267489f3a3d186147de12b9202cb7a1c2d739d41858a794c002a8ec85760d0f143ce1d0a SHA512 47949e2e597729de90b51559d554054d791b54cf4c7d50fd81e44f3e0c71cf79de6b690bf88616cc08c80c094add93849440f248327a0c4df8fe9a50c09164a8
-MISC metadata.xml 322 BLAKE2B c136948fea0130f683bd8ff1c52e03707b801a446859dd4e03ee34965ccf5babd69f28c437f5b568a6f9e308669b23c49127a3592ef702fa06323f368f1fd8fc SHA512 59ca2140630f6c408c51176a30ad8357ecaf8c1a3b37b495176b25cf2b1cb259882dded5072440cfbfe2d16741520a0b30b41384db89c794ec183b318419b578
+EBUILD tpm-emulator-0.7.4-r1.ebuild 1782 BLAKE2B 766796e9f5db7c701066ff52467e2b8449734ce31315425347771f9184bf28d2670b76f792467cfac0f4f222c50cdc708a11b9116ac0869696614e3d4a1798aa SHA512 ba22734b8c2f1fbe625b286c7fb2e08ebf2df3e201d5b9a2d30ea55a29284ecdf57f016e0b16b61f9d470021536cd5938da134f68380da458bbfc3bb7987f145
+EBUILD tpm-emulator-0.7.4-r2.ebuild 1920 BLAKE2B 415390b4a1f31e8b12fd9504afab57fd53890228862a5d0285a6519612b07e86001a0ad3f2c33d0754414bc2430fb8eafe04a5d6d3c2d4668a116c409ff2d748 SHA512 f1d93be8e078e8232f58e82ccc1da9ad3262982c930299484fd09d9fe059e616448ff459b10ea9aa76de1a41eb2d6ac466323548e3f7830b2458486a769cb889
+MISC metadata.xml 395 BLAKE2B 053fec93e12819e95abadca4f2e9f871589c21ce8a7369092cfb04cb593a4fa687956458dfc2c7249b6951bb3b7c45f6c38fac1448d9e5d250ed8256f92df327 SHA512 dd69f6a31ebaa3971c316d967bd643654d11465bb0de20059ea82a4851691b605c42deb4846614627ae9c8b2b30075e6c44e53f9810999839ceaf2e9ee9aada8
diff --git a/app-crypt/tpm-emulator/files/tpm-emulator-0.7.4-build.patch b/app-crypt/tpm-emulator/files/tpm-emulator-0.7.4-build.patch
new file mode 100644
index 000000000000..ada748f7129a
--- /dev/null
+++ b/app-crypt/tpm-emulator/files/tpm-emulator-0.7.4-build.patch
@@ -0,0 +1,100 @@
+From ca99fe81c8aee204c1a8b7f3ca264130e54d9418 Mon Sep 17 00:00:00 2001
+From: Alon Bar-Lev <alon.barlev@gmail.com>
+Date: Sat, 1 Sep 2018 21:32:07 +0300
+Subject: [PATCH] tpm: tpm_deprecated.c fix compare
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+tpm/tpm_deprecated.c:437:7: error: ‘__builtin_memcmp_eq’ reading 20 bytes from a region of size 8 [-Werror=stringop-overflow=]
+ if (memcmp(&b1, &newAuthLink, sizeof(TPM_HMAC))) {
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+cc1: all warnings being treated as errors
+
+Bug: https://bugs.gentoo.org/show_bug.cgi?id=664198
+---
+ tpm/tpm_deprecated.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tpm/tpm_deprecated.c b/tpm/tpm_deprecated.c
+index c362b56..4c49f54 100644
+--- a/tpm/tpm_deprecated.c
++++ b/tpm/tpm_deprecated.c
+@@ -434,7 +434,7 @@ TPM_RESULT TPM_ChangeAuthAsymFinish(TPM_KEY_HANDLE parentHandle,
+ tpm_hmac_final(&hmac_ctx, b1.digest);
+ /* 6. The TPM SHALL compare b1 with newAuthLink. The TPM SHALL
+ indicate a failure if the values do not match. */
+- if (memcmp(&b1, &newAuthLink, sizeof(TPM_HMAC))) {
++ if (memcmp(&b1, newAuthLink, sizeof(TPM_HMAC))) {
+ debug("TPM_ChangeAuthAsymFinish(): newAuthLink value does not match.");
+ return TPM_FAIL;
+ }
+From 035af1df2b18afd695150c6f9e426133b775c0a1 Mon Sep 17 00:00:00 2001
+From: Florian Larysch <fl@n621.de>
+Date: Tue, 24 Oct 2017 19:33:00 +0200
+Subject: [PATCH] tpm_command_handler: fix switch fallthrough
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Compiling with a recent GCC fails as follows:
+
+ tpm-emulator/tpm/tpm_cmd_handler.c: In function ‘tpm_setup_rsp_auth’:
+ tpm-emulator/tpm/tpm_cmd_handler.c:3332:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
+ tpm_hmac_final(&hmac, rsp->auth2->auth);
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ tpm-emulator/tpm/tpm_cmd_handler.c:3333:5: note: here
+ case TPM_TAG_RSP_AUTH1_COMMAND:
+
+Looking at the code, this does indeed seem unintentional. Add a break
+state in the appropriate place.
+---
+ tpm/tpm_cmd_handler.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tpm/tpm_cmd_handler.c b/tpm/tpm_cmd_handler.c
+index 288d1ce..5aea4e7 100644
+--- a/tpm/tpm_cmd_handler.c
++++ b/tpm/tpm_cmd_handler.c
+@@ -3330,6 +3330,7 @@ static void tpm_setup_rsp_auth(TPM_COMMAND_CODE ordinal, TPM_RESPONSE *rsp)
+ sizeof(rsp->auth2->nonceOdd.nonce));
+ tpm_hmac_update(&hmac, (BYTE*)&rsp->auth2->continueAuthSession, 1);
+ tpm_hmac_final(&hmac, rsp->auth2->auth);
++ break;
+ case TPM_TAG_RSP_AUTH1_COMMAND:
+ tpm_hmac_init(&hmac, rsp->auth1->secret, sizeof(rsp->auth1->secret));
+ tpm_hmac_update(&hmac, rsp->auth1->digest, sizeof(rsp->auth1->digest));
+--
+2.16.4
+
+From 0f4579e913aeb3a893631a3caee420a0e9803683 Mon Sep 17 00:00:00 2001
+From: Peter Huewe <peterhuewe@gmx.de>
+Date: Mon, 26 Jun 2017 00:25:43 +0200
+Subject: [PATCH] Workaround wrong fallthrough case by returning TPM_FAIL
+
+The spec says that the number of verified PCRs should be returned - which it currently does not and breaks compilation with gcc7
+See #26
+Since this code is probably unused anyway, we now simply return TPM_FAIL until someone comes up with a solution.
+
+Spec:
+https://www.trustedcomputinggroup.org/wp-content/uploads/Revision_7.02-_29April2010-tcg-mobile-trusted-module-1.0.pdf
+---
+ mtm/mtm_capability.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/mtm/mtm_capability.c b/mtm/mtm_capability.c
+index a09b116..4046de5 100644
+--- a/mtm/mtm_capability.c
++++ b/mtm/mtm_capability.c
+@@ -87,6 +87,8 @@ static TPM_RESULT cap_mtm_permanent_data(UINT32 subCapSize, BYTE *subCap,
+ tpm_free(*resp);
+ return TPM_FAIL;
+ }
++ error("[TPM_CAP_MTM_PERMANENT_DATA] SubCap 2 not Implemented");
++ return TPM_FAIL; // TODO not implemented.
+
+ case 3:
+ return return_UINT32(respSize, resp,
+--
+2.16.4
+
diff --git a/app-crypt/tpm-emulator/files/tpm-emulator-0.7.4-cmake.patch b/app-crypt/tpm-emulator/files/tpm-emulator-0.7.4-cmake.patch
new file mode 100644
index 000000000000..7fd775139b2d
--- /dev/null
+++ b/app-crypt/tpm-emulator/files/tpm-emulator-0.7.4-cmake.patch
@@ -0,0 +1,120 @@
+
+Pull request:
+https://github.com/PeterHuewe/tpm-emulator/pull/37
+
+
+From 694b7c24ac09e0ec1e54ab71eb9c82a8d4f41d33 Mon Sep 17 00:00:00 2001
+From: Alon Bar-Lev <alon.barlev@gmail.com>
+Date: Tue, 11 Sep 2018 14:08:49 +0300
+Subject: [PATCH 1/3] build: use GNUInstallDirs to allow override install
+ directories
+
+Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
+---
+ CMakeLists.txt | 1 +
+ tddl/CMakeLists.txt | 6 +++---
+ tpmd/unix/CMakeLists.txt | 2 +-
+ 3 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f362298..d047ce3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,7 @@
+ project(TPM_Emulator C)
+
+ cmake_minimum_required(VERSION 2.4)
++include(GNUInstallDirs)
+ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
+ if(COMMAND cmake_policy)
+ cmake_policy(SET CMP0003 NEW)
+diff --git a/tddl/CMakeLists.txt b/tddl/CMakeLists.txt
+index 0be3281..6cc63b3 100644
+--- a/tddl/CMakeLists.txt
++++ b/tddl/CMakeLists.txt
+@@ -15,9 +15,9 @@ elseif(WIN32)
+ set_target_properties(tddl PROPERTIES PREFIX "")
+ endif()
+
+-install(TARGETS tddl DESTINATION lib)
+-install(TARGETS tddl_static DESTINATION lib)
+-install(FILES "tddl.h" DESTINATION include)
++install(TARGETS tddl DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(TARGETS tddl_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(FILES "tddl.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+ add_executable(test_tddl test_tddl.c)
+diff --git a/tpmd/unix/CMakeLists.txt b/tpmd/unix/CMakeLists.txt
+index 40c436b..c5c394a 100644
+--- a/tpmd/unix/CMakeLists.txt
++++ b/tpmd/unix/CMakeLists.txt
+@@ -13,5 +13,5 @@ target_link_libraries(tpmd mtm tpm tpm_crypto)
+ else()
+ target_link_libraries(tpmd tpm tpm_crypto)
+ endif()
+-install(TARGETS tpmd RUNTIME DESTINATION bin)
++install(TARGETS tpmd RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+--
+2.16.4
+
+From 89bf733368dda265040cf44ff8be69a15ab66712 Mon Sep 17 00:00:00 2001
+From: Alon Bar-Lev <alon.barlev@gmail.com>
+Date: Tue, 11 Sep 2018 16:36:12 +0300
+Subject: [PATCH 2/3] build: do not build mtm unless enabled
+
+Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
+---
+ CMakeLists.txt | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d047ce3..b8b68a3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -67,7 +67,9 @@ include_directories(${CMAKE_BINARY_DIR})
+
+ # add internal libraries
+ add_subdirectory(tpm)
+-add_subdirectory(mtm)
++if(MTM_EMULATOR)
++ add_subdirectory(mtm)
++endif()
+ add_subdirectory(crypto)
+
+ # add TDDL
+--
+2.16.4
+
+From 24bbf683de0b0b24f0ec81d093c03e1f6a9570f2 Mon Sep 17 00:00:00 2001
+From: Alon Bar-Lev <alon.barlev@gmail.com>
+Date: Tue, 11 Sep 2018 14:20:19 +0300
+Subject: [PATCH 3/3] build: support BUILD_DEV to disable device build
+
+Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
+---
+ CMakeLists.txt | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b8b68a3..9ae6562 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -76,7 +76,12 @@ add_subdirectory(crypto)
+ add_subdirectory(tddl)
+
+ # add kernel modules
+-add_subdirectory(tpmd_dev)
++if(NOT DEFINED BUILD_DEV)
++ set(BUILD_DEV ON)
++endif()
++if(BUILD_DEV)
++ add_subdirectory(tpmd_dev)
++endif()
+
+ # add executables
+ add_subdirectory(tpmd)
+--
+2.16.4
+
diff --git a/app-crypt/tpm-emulator/files/tpm-emulator.confd-r2 b/app-crypt/tpm-emulator/files/tpm-emulator.confd-r2
new file mode 100644
index 000000000000..985fa4e774ca
--- /dev/null
+++ b/app-crypt/tpm-emulator/files/tpm-emulator.confd-r2
@@ -0,0 +1 @@
+STARTUP_MODE="save"
diff --git a/app-crypt/tpm-emulator/files/tpm-emulator.initd-r2 b/app-crypt/tpm-emulator/files/tpm-emulator.initd-r2
new file mode 100644
index 000000000000..abfbef900d00
--- /dev/null
+++ b/app-crypt/tpm-emulator/files/tpm-emulator.initd-r2
@@ -0,0 +1,46 @@
+#!/sbin/openrc-run
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+STARTUP_MODE="${STARTUP_MODE:-save}";
+
+extra_started_commands="clear save deactivated"
+description="TPM emulator"
+command="/usr/bin/tpmd"
+my_command_args="-f"
+command_background=1
+command_user="tss:tss"
+pidfile="/var/run/${RC_SVCNAME}.pid"
+
+depend() {
+ use logger
+ after coldplug
+}
+
+start_pre() {
+ checkpath -d -m 0775 -o tss /var/run/tpm
+ service_set_value STARTUP_MODE "${STARTUP_MODE}"
+}
+
+start() {
+ command_args="${my_command_args} $(service_get_value STARTUP_MODE)"
+ default_start
+}
+
+_doit() {
+ service_set_value STARTUP_MODE "$1"
+ stop
+ start
+}
+
+clear() {
+ _doit clear
+}
+
+save() {
+ _doit save
+}
+
+deactivated() {
+ _doit deactivated
+}
diff --git a/app-crypt/tpm-emulator/metadata.xml b/app-crypt/tpm-emulator/metadata.xml
index e3da96029705..401103a0692f 100644
--- a/app-crypt/tpm-emulator/metadata.xml
+++ b/app-crypt/tpm-emulator/metadata.xml
@@ -8,4 +8,7 @@
<upstream>
<remote-id type="sourceforge">tpm-emulator</remote-id>
</upstream>
+ <use>
+ <flag name="mtm-emulator">Build the MTM emulator</flag>
+ </use>
</pkgmetadata>
diff --git a/app-crypt/tpm-emulator/tpm-emulator-0.7.4-r1.ebuild b/app-crypt/tpm-emulator/tpm-emulator-0.7.4-r1.ebuild
index 0192de92e2f6..6fc770390fcf 100644
--- a/app-crypt/tpm-emulator/tpm-emulator-0.7.4-r1.ebuild
+++ b/app-crypt/tpm-emulator/tpm-emulator-0.7.4-r1.ebuild
@@ -24,6 +24,10 @@ DEPEND="${RDEPEND}
S=${WORKDIR}/${P/-/_}
+PATCHES=(
+ "${FILESDIR}/${P}-build.patch"
+)
+
pkg_setup() {
enewgroup tss
enewuser tss -1 -1 /var/lib/tpm tss
diff --git a/app-crypt/tpm-emulator/tpm-emulator-0.7.4-r2.ebuild b/app-crypt/tpm-emulator/tpm-emulator-0.7.4-r2.ebuild
new file mode 100644
index 000000000000..9c7003c115f7
--- /dev/null
+++ b/app-crypt/tpm-emulator/tpm-emulator-0.7.4-r2.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+MODULES_OPTIONAL_USE="modules"
+inherit flag-o-matic user linux-mod cmake-utils udev
+
+MY_P=${P/-/_}
+DESCRIPTION="Emulator driver for tpm"
+HOMEPAGE="https://sourceforge.net/projects/tpm-emulator.berlios/"
+SRC_URI="mirror://sourceforge/tpm-emulator/${MY_P}.tar.gz"
+LICENSE="GPL-2"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+IUSE="libressl mtm-emulator ssl"
+RDEPEND="ssl? (
+ !libressl? ( dev-libs/openssl:0= )
+ libressl? ( dev-libs/libressl:0= )
+ )"
+DEPEND="${RDEPEND}
+ !ssl? ( dev-libs/gmp )"
+
+S=${WORKDIR}/${P/-/_}
+
+PATCHES=(
+ "${FILESDIR}/${P}-build.patch"
+ "${FILESDIR}/${P}-cmake.patch"
+)
+
+pkg_setup() {
+ enewgroup tss
+ enewuser tss -1 -1 /var/lib/tpm tss
+ if use modules; then
+ CONFIG_CHECK="MODULES"
+ MODULE_NAMES="tpmd_dev(extra:tpmd_dev/linux:)"
+ BUILD_TARGETS="all tpmd_dev.rules"
+ BUILD_PARAMS="KERNEL_BUILD=${KERNEL_DIR}"
+ linux-mod_pkg_setup
+ fi
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DUSE_OPENSSL=$(usex ssl ON OFF)
+ -DMTM_EMULATOR=$(usex mtm-emulator ON OFF)
+ -DBUILD_DEV=OFF
+ )
+ cmake-utils_src_configure
+
+ use modules && ln -s "${BUILD_DIR}/config.h" tpmd_dev/linux
+}
+
+src_compile() {
+ cmake-utils_src_compile
+ use modules && linux-mod_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+ if use modules; then
+ linux-mod_src_install
+ udev_newrules "tpmd_dev/linux/tpmd_dev.rules" 60-tpmd_dev.rules
+ fi
+
+ newinitd "${FILESDIR}/${PN}.initd-r2" "${PN}"
+ newconfd "${FILESDIR}/${PN}.confd-r2" "${PN}"
+
+ keepdir /var/log/tpm
+ fowners tss:tss /var/log/tpm
+}
+
+pkg_postinst() {
+ if use modules; then
+ linux-mod_pkg_postinst
+
+ ewarn ""
+ ewarn "The new init.d script does not load the tpmd_dev any more as it is optional."
+ ewarn "If you use the tpmd_dev, please load it explicitly in /etc/conf.d/modules"
+ ewarn ""
+ fi
+
+ einfo "tpmd socket is located at /var/run/tpm/tpmd_socket:0"
+}