diff options
4 files changed, 32 insertions, 97 deletions
diff --git a/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools.inc b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools.inc new file mode 100644 index 0000000..8f74e85 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools.inc | |||
@@ -0,0 +1,11 @@ | |||
1 | SUMMARY = "Tools for TPM2" | ||
2 | DESCRIPTION = "This project builds a set of command-line tools for \ | ||
3 | interacting with a TPM (Trusted Platform Module) 2." | ||
4 | HOMEPAGE = "https://github.com/tpm2-software/tpm2-tools" | ||
5 | SECTION = "security/tpm" | ||
6 | LICENSE = "BSD" | ||
7 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=91b7c548d73ea16537799e8060cea819" | ||
8 | |||
9 | DEPENDS = "tpm2-abrmd tpm2-tss openssl curl autoconf-archive-native" | ||
10 | |||
11 | inherit autotools pkgconfig | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch deleted file mode 100644 index 0333089..0000000 --- a/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | From 1c29c5206be61edb9ebb165f5e4ae2f5eceb5608 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jia Zhang <zhang.jia@linux.alibaba.com> | ||
3 | Date: Fri, 16 Feb 2018 20:31:58 -0500 | ||
4 | Subject: [PATCH] tpm2-tools: use dynamic linkage with tpm2-abrmd | ||
5 | |||
6 | tpm2-abrmd has huge dependencies and they are not necessary to be involved | ||
7 | in initramfs. | ||
8 | |||
9 | Signed-off-by: Jia Zhang <zhang.jia@linux.alibaba.com> | ||
10 | --- | ||
11 | lib/tcti/tpm2_tools_tcti_abrmd.c | 21 +++++++++++++++++++-- | ||
12 | 1 file changed, 19 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/lib/tcti/tpm2_tools_tcti_abrmd.c b/lib/tcti/tpm2_tools_tcti_abrmd.c | ||
15 | index 5e50288..48e0df6 100644 | ||
16 | --- a/lib/tcti/tpm2_tools_tcti_abrmd.c | ||
17 | +++ b/lib/tcti/tpm2_tools_tcti_abrmd.c | ||
18 | @@ -30,6 +30,7 @@ | ||
19 | //**********************************************************************; | ||
20 | #include <inttypes.h> | ||
21 | #include <stdlib.h> | ||
22 | +#include <dlfcn.h> | ||
23 | #include <tcti/tcti-tabrmd.h> | ||
24 | |||
25 | #include <sapi/tpm20.h> | ||
26 | @@ -42,8 +43,24 @@ TSS2_TCTI_CONTEXT *tpm2_tools_tcti_abrmd_init(char *opts) { | ||
27 | |||
28 | UNUSED(opts); | ||
29 | |||
30 | + /* | ||
31 | + * Intend to "forget" the handle in order to make sure libtcti-tabrmd | ||
32 | + * is unloaded along with the deconstructed functions. | ||
33 | + */ | ||
34 | + void *tabrmd_handle; | ||
35 | + tabrmd_handle = dlopen("libtcti-tabrmd.so.0", RTLD_LAZY); | ||
36 | + if (!tabrmd_handle) { | ||
37 | + LOG_ERR ("Unable to find out the tabrmd tcti library"); | ||
38 | + return NULL; | ||
39 | + } | ||
40 | + | ||
41 | + TSS2_RC (*init)(TSS2_TCTI_CONTEXT *, size_t *); | ||
42 | + init = dlsym(tabrmd_handle, "tss2_tcti_tabrmd_init"); | ||
43 | + if (!init) | ||
44 | + return NULL; | ||
45 | + | ||
46 | size_t size; | ||
47 | - TSS2_RC rc = tss2_tcti_tabrmd_init(NULL, &size); | ||
48 | + TSS2_RC rc = init(NULL, &size); | ||
49 | if (rc != TSS2_RC_SUCCESS) { | ||
50 | LOG_ERR("Failed to get size for TABRMD TCTI context: 0x%" PRIx32, rc); | ||
51 | return NULL; | ||
52 | @@ -55,7 +72,7 @@ TSS2_TCTI_CONTEXT *tpm2_tools_tcti_abrmd_init(char *opts) { | ||
53 | return NULL; | ||
54 | } | ||
55 | |||
56 | - rc = tss2_tcti_tabrmd_init(tcti_ctx, &size); | ||
57 | + rc = init(tcti_ctx, &size); | ||
58 | if (rc != TSS2_RC_SUCCESS) { | ||
59 | LOG_ERR ("Failed to initialize TABRMD TCTI context: 0x%" PRIx32, rc); | ||
60 | free(tcti_ctx); | ||
61 | -- | ||
62 | 2.14.1 | ||
63 | |||
diff --git a/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_3.0.4.bb b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_3.0.4.bb new file mode 100644 index 0000000..f4850a7 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_3.0.4.bb | |||
@@ -0,0 +1,7 @@ | |||
1 | include ${BPN}.inc | ||
2 | |||
3 | SRC_URI = "https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz" | ||
4 | SRC_URI[md5sum] = "f7a962c6e3d2997efe8949ac7aec8283" | ||
5 | SRC_URI[sha256sum] = "ac05028347a9fa1da79b5d53b998193de0c3a76000badb961c3feb8b8a0e8e8e" | ||
6 | |||
7 | S = "${WORKDIR}/${BPN}-${PV}" | ||
diff --git a/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb index b592882..c566526 100644 --- a/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb +++ b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb | |||
@@ -1,42 +1,22 @@ | |||
1 | SUMMARY = "Tools for TPM2." | 1 | include ${BPN}.inc |
2 | DESCRIPTION = "tpm2-tools" | ||
3 | SECTION = "security/tpm" | ||
4 | 2 | ||
5 | LICENSE = "BSD" | 3 | DEFAULT_PREFERENCE = "-1" |
6 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=91b7c548d73ea16537799e8060cea819" | ||
7 | 4 | ||
8 | DEPENDS += "tpm2-tss tpm2-abrmd openssl curl autoconf-archive pkgconfig" | 5 | DEPENDS += "libtss2 libtss2-mu libtss2-tcti-device libtss2-tcti-mssim" |
9 | 6 | ||
10 | PV = "3.0.3+git${SRCPV}" | 7 | PVBASE := "${PV}" |
8 | PV = "${PVBASE}.${SRCPV}" | ||
11 | 9 | ||
12 | SRC_URI = "\ | 10 | SRC_URI = "git://github.com/tpm2-software/${BPN}.git;protocol=git;branch=master;name=${BPN};destsuffix=${BPN}" |
13 | git://github.com/tpm2-software/tpm2-tools.git;branch=3.X \ | ||
14 | file://0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch \ | ||
15 | " | ||
16 | SRCREV = "6b4385f098bd5d39e1cfc6cd2b038b68c960413f" | ||
17 | 11 | ||
18 | S = "${WORKDIR}/git" | 12 | SRCREV = "${AUTOREV}" |
19 | 13 | ||
20 | inherit autotools pkgconfig | 14 | S = "${WORKDIR}/${BPN}" |
21 | 15 | ||
22 | EXTRA_OECONF += "\ | 16 | do_configure_prepend () { |
23 | --with-tcti-device \ | 17 | # execute the bootstrap script |
24 | --without-tcti-socket \ | 18 | currentdir=$(pwd) |
25 | --with-tcti-tabrmd \ | 19 | cd ${S} |
26 | " | 20 | AUTORECONF=true ./bootstrap |
27 | 21 | cd ${currentdir} | |
28 | EXTRA_OEMAKE += "\ | ||
29 | CFLAGS="${CFLAGS} -Wno-implicit-fallthrough" \ | ||
30 | LIBS=-ldl \ | ||
31 | " | ||
32 | |||
33 | do_configure_prepend() { | ||
34 | # execute the bootstrap script | ||
35 | currentdir="$(pwd)" | ||
36 | cd "${S}" | ||
37 | ACLOCAL="aclocal --system-acdir=${STAGING_DATADIR}/aclocal" \ | ||
38 | ./bootstrap | ||
39 | cd "${currentdir}" | ||
40 | } | 22 | } |
41 | |||
42 | RDEPENDS_${PN} += "libtss2 libtctidevice" | ||