[yocto] [meta-security][PATCH v2 4/9] swtpm: enable native and nativesdk flavors
Patrick Ohly
patrick.ohly at intel.com
Fri Feb 3 00:46:09 PST 2017
For use with qemu-tpm as described in the swtpm main README, swtpm
must be compiled natively. nativesdk is added just in case that
someone wants to add this to an SDK.
The fix_lib_search_path.patch was recently removed during the version
update, but it is still needed when building natively. Here's a
version that applies cleanly again.
Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
---
recipes-tpm/swtpm/files/fix_lib_search_path.patch | 64 ++++++++++++++++-
recipes-tpm/swtpm/swtpm_1.0.bb | 3 +-
2 files changed, 67 insertions(+)
create mode 100644 recipes-tpm/swtpm/files/fix_lib_search_path.patch
diff --git a/recipes-tpm/swtpm/files/fix_lib_search_path.patch b/recipes-tpm/swtpm/files/fix_lib_search_path.patch
new file mode 100644
index 0000000..28aca4a
--- /dev/null
+++ b/recipes-tpm/swtpm/files/fix_lib_search_path.patch
@@ -0,0 +1,64 @@
+From 85706ceb6877ade3b589d3c390abf5b3492bb718 Mon Sep 17 00:00:00 2001
+From: Armin Kuster <akuster808 at gmail.com>
+Date: Thu, 13 Oct 2016 02:03:56 -0700
+Subject: [PATCH] swtpm: add new package
+
+Upstream-Status: Inappropriate [OE config]
+
+Signed-off-by: Armin Kuster <akuster808 at gmail.com>
+
+Rebased to current tip.
+
+Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
+
+---
+ configure.ac | 32 ++++++++++----------------------
+ 1 file changed, 10 insertions(+), 22 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index c4a9c6d..6267f64 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -395,29 +395,17 @@ CFLAGS="$CFLAGS -Wformat -Wformat-security"
+ dnl We have to make sure libtpms is using the same crypto library
+ dnl to avoid problems
+ AC_MSG_CHECKING([the crypto library libtpms is using])
+-dirs=$($CC $CFLAGS -Xlinker --verbose 2>/dev/null | \
+- sed -n '/SEARCH_DIR/p' | \
+- sed 's/SEARCH_DIR("=\?\(@<:@^"@:>@\+\)"); */\1\n/g')
+-for dir in $dirs $LIBRARY_PATH; do
+- if test -r $dir/libtpms.so; then
+- if test -n "`ldd $dir/libtpms.so | grep libcrypto.so`"; then
+- libtpms_cryptolib="openssl"
+- break
+- fi
+- if test -n "`ldd $dir/libtpms.so | grep libnss3.so`"; then
+- libtpms_cryptolib="freebl"
+- break
+- fi
++dir="$SEARCH_DIR"
++if test -r $dir/libtpms.so; then
++ if test -n "`ldd $dir/libtpms.so | grep libcrypto.so`"; then
++ libtpms_cryptolib="openssl"
++ break
+ fi
+- case $host_os in
+- cygwin)
+- if test -r $dir/libtpms.a; then
+- if test -n "$(nm $dir/libtpms.a | grep "U AES_encrypt")"; then
+- libtpms_cryptolib="openssl"
+- fi
+- fi
+- esac
+-done
++ if test -n "`ldd $dir/libtpms.so | grep libnss3.so`"; then
++ libtpms_cryptolib="freebl"
++ break
++ fi
++fi
+
+ if test -z "$libtpms_cryptolib"; then
+ AC_MSG_ERROR([Could not determine libtpms crypto library.])
+--
+2.1.4
+
diff --git a/recipes-tpm/swtpm/swtpm_1.0.bb b/recipes-tpm/swtpm/swtpm_1.0.bb
index 27b4b8c..d5a2a58 100644
--- a/recipes-tpm/swtpm/swtpm_1.0.bb
+++ b/recipes-tpm/swtpm/swtpm_1.0.bb
@@ -9,6 +9,7 @@ SRCREV = "ca906a02124d0ed8b6194e845d272d23ee394a34"
SRC_URI = " \
git://github.com/stefanberger/swtpm.git \
file://fix_signed_issue.patch \
+ file://fix_lib_search_path.patch \
"
S = "${WORKDIR}/git"
@@ -45,3 +46,5 @@ USERADD_PARAM_${PN} = "--system -g ${TSS_GROUP} --home-dir \
--no-create-home --shell /bin/false ${BPN}"
RDEPENDS_${PN} = "libtpm expect socat bash"
+
+BBCLASSEXTEND = "native nativesdk"
--
git-series 0.9.1
More information about the yocto
mailing list