From 4b2c94fb642c0e2c65878125b5fc8508f173e105 Mon Sep 17 00:00:00 2001 From: Trevor Woerner Date: Tue, 29 May 2018 10:04:44 -0400 Subject: tpm2.0-tools: rename -> tpm2-tools Unify how the TPM2 recipes are named. Signed-off-by: Trevor Woerner --- .../recipes-tpm/cryptfs-tpm2/cryptfs-tpm2_git.bb | 4 +- .../packagegroups/packagegroup-tpm2.bb | 2 +- ...tools-use-dynamic-linkage-with-tpm2-abrmd.patch | 63 ++++++++++++++++++++++ meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb | 42 +++++++++++++++ ...tools-use-dynamic-linkage-with-tpm2-abrmd.patch | 63 ---------------------- .../recipes-tpm/tpm2.0-tools/tpm2.0-tools_git.bb | 42 --------------- 6 files changed, 108 insertions(+), 108 deletions(-) create mode 100644 meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch create mode 100644 meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb delete mode 100644 meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch delete mode 100644 meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools_git.bb diff --git a/meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2_git.bb b/meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2_git.bb index e753112..a94ee5d 100644 --- a/meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2_git.bb +++ b/meta-encrypted-storage/recipes-tpm/cryptfs-tpm2/cryptfs-tpm2_git.bb @@ -66,7 +66,7 @@ FILES_${PN}-initramfs = "\ # @grep: grep # @procps: pkill, pgrep # @cryptsetup: cryptsetup -# @tpm2.0-tools: tpm2_* +# @tpm2-tools: tpm2_* # @tpm2-abrmd: optional RDEPENDS_${PN} += "\ libtss2 \ @@ -77,7 +77,7 @@ RDEPENDS_${PN} += "\ grep \ procps \ cryptsetup \ - tpm2.0-tools \ + tpm2-tools \ " # For init.cryptfs diff --git a/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2.bb b/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2.bb index 96cddd3..eb096e0 100644 --- a/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2.bb +++ b/meta-tpm2/recipes-base/packagegroups/packagegroup-tpm2.bb @@ -2,7 +2,7 @@ require packagegroup-tpm2.inc RDEPENDS_${PN} += "\ tpm2-abrmd \ - tpm2.0-tools \ + tpm2-tools \ rng-tools \ " 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 new file mode 100644 index 0000000..0333089 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch @@ -0,0 +1,63 @@ +From 1c29c5206be61edb9ebb165f5e4ae2f5eceb5608 Mon Sep 17 00:00:00 2001 +From: Jia Zhang +Date: Fri, 16 Feb 2018 20:31:58 -0500 +Subject: [PATCH] tpm2-tools: use dynamic linkage with tpm2-abrmd + +tpm2-abrmd has huge dependencies and they are not necessary to be involved +in initramfs. + +Signed-off-by: Jia Zhang +--- + lib/tcti/tpm2_tools_tcti_abrmd.c | 21 +++++++++++++++++++-- + 1 file changed, 19 insertions(+), 2 deletions(-) + +diff --git a/lib/tcti/tpm2_tools_tcti_abrmd.c b/lib/tcti/tpm2_tools_tcti_abrmd.c +index 5e50288..48e0df6 100644 +--- a/lib/tcti/tpm2_tools_tcti_abrmd.c ++++ b/lib/tcti/tpm2_tools_tcti_abrmd.c +@@ -30,6 +30,7 @@ + //**********************************************************************; + #include + #include ++#include + #include + + #include +@@ -42,8 +43,24 @@ TSS2_TCTI_CONTEXT *tpm2_tools_tcti_abrmd_init(char *opts) { + + UNUSED(opts); + ++ /* ++ * Intend to "forget" the handle in order to make sure libtcti-tabrmd ++ * is unloaded along with the deconstructed functions. ++ */ ++ void *tabrmd_handle; ++ tabrmd_handle = dlopen("libtcti-tabrmd.so.0", RTLD_LAZY); ++ if (!tabrmd_handle) { ++ LOG_ERR ("Unable to find out the tabrmd tcti library"); ++ return NULL; ++ } ++ ++ TSS2_RC (*init)(TSS2_TCTI_CONTEXT *, size_t *); ++ init = dlsym(tabrmd_handle, "tss2_tcti_tabrmd_init"); ++ if (!init) ++ return NULL; ++ + size_t size; +- TSS2_RC rc = tss2_tcti_tabrmd_init(NULL, &size); ++ TSS2_RC rc = init(NULL, &size); + if (rc != TSS2_RC_SUCCESS) { + LOG_ERR("Failed to get size for TABRMD TCTI context: 0x%" PRIx32, rc); + return NULL; +@@ -55,7 +72,7 @@ TSS2_TCTI_CONTEXT *tpm2_tools_tcti_abrmd_init(char *opts) { + return NULL; + } + +- rc = tss2_tcti_tabrmd_init(tcti_ctx, &size); ++ rc = init(tcti_ctx, &size); + if (rc != TSS2_RC_SUCCESS) { + LOG_ERR ("Failed to initialize TABRMD TCTI context: 0x%" PRIx32, rc); + free(tcti_ctx); +-- +2.14.1 + diff --git a/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb new file mode 100644 index 0000000..a8244de --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_git.bb @@ -0,0 +1,42 @@ +SUMMARY = "Tools for TPM2." +DESCRIPTION = "tpm2-tools" +SECTION = "security/tpm" + +LICENSE = "BSD" +LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=91b7c548d73ea16537799e8060cea819" + +DEPENDS += "tpm2.0-tss tpm2-abrmd openssl curl autoconf-archive pkgconfig" + +PV = "3.0.3+git${SRCPV}" + +SRC_URI = "\ + git://github.com/tpm2-software/tpm2-tools.git;branch=3.X \ + file://0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch \ +" +SRCREV = "6b4385f098bd5d39e1cfc6cd2b038b68c960413f" + +S = "${WORKDIR}/git" + +inherit autotools pkgconfig + +EXTRA_OECONF += "\ + --with-tcti-device \ + --without-tcti-socket \ + --with-tcti-tabrmd \ +" + +EXTRA_OEMAKE += "\ + CFLAGS="${CFLAGS} -Wno-implicit-fallthrough" \ + LIBS=-ldl \ +" + +do_configure_prepend() { + # execute the bootstrap script + currentdir="$(pwd)" + cd "${S}" + ACLOCAL="aclocal --system-acdir=${STAGING_DATADIR}/aclocal" \ + ./bootstrap + cd "${currentdir}" +} + +RDEPENDS_${PN} += "libtss2 libtctidevice" diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch deleted file mode 100644 index 0333089..0000000 --- a/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools/0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 1c29c5206be61edb9ebb165f5e4ae2f5eceb5608 Mon Sep 17 00:00:00 2001 -From: Jia Zhang -Date: Fri, 16 Feb 2018 20:31:58 -0500 -Subject: [PATCH] tpm2-tools: use dynamic linkage with tpm2-abrmd - -tpm2-abrmd has huge dependencies and they are not necessary to be involved -in initramfs. - -Signed-off-by: Jia Zhang ---- - lib/tcti/tpm2_tools_tcti_abrmd.c | 21 +++++++++++++++++++-- - 1 file changed, 19 insertions(+), 2 deletions(-) - -diff --git a/lib/tcti/tpm2_tools_tcti_abrmd.c b/lib/tcti/tpm2_tools_tcti_abrmd.c -index 5e50288..48e0df6 100644 ---- a/lib/tcti/tpm2_tools_tcti_abrmd.c -+++ b/lib/tcti/tpm2_tools_tcti_abrmd.c -@@ -30,6 +30,7 @@ - //**********************************************************************; - #include - #include -+#include - #include - - #include -@@ -42,8 +43,24 @@ TSS2_TCTI_CONTEXT *tpm2_tools_tcti_abrmd_init(char *opts) { - - UNUSED(opts); - -+ /* -+ * Intend to "forget" the handle in order to make sure libtcti-tabrmd -+ * is unloaded along with the deconstructed functions. -+ */ -+ void *tabrmd_handle; -+ tabrmd_handle = dlopen("libtcti-tabrmd.so.0", RTLD_LAZY); -+ if (!tabrmd_handle) { -+ LOG_ERR ("Unable to find out the tabrmd tcti library"); -+ return NULL; -+ } -+ -+ TSS2_RC (*init)(TSS2_TCTI_CONTEXT *, size_t *); -+ init = dlsym(tabrmd_handle, "tss2_tcti_tabrmd_init"); -+ if (!init) -+ return NULL; -+ - size_t size; -- TSS2_RC rc = tss2_tcti_tabrmd_init(NULL, &size); -+ TSS2_RC rc = init(NULL, &size); - if (rc != TSS2_RC_SUCCESS) { - LOG_ERR("Failed to get size for TABRMD TCTI context: 0x%" PRIx32, rc); - return NULL; -@@ -55,7 +72,7 @@ TSS2_TCTI_CONTEXT *tpm2_tools_tcti_abrmd_init(char *opts) { - return NULL; - } - -- rc = tss2_tcti_tabrmd_init(tcti_ctx, &size); -+ rc = init(tcti_ctx, &size); - if (rc != TSS2_RC_SUCCESS) { - LOG_ERR ("Failed to initialize TABRMD TCTI context: 0x%" PRIx32, rc); - free(tcti_ctx); --- -2.14.1 - diff --git a/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools_git.bb b/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools_git.bb deleted file mode 100644 index e832214..0000000 --- a/meta-tpm2/recipes-tpm/tpm2.0-tools/tpm2.0-tools_git.bb +++ /dev/null @@ -1,42 +0,0 @@ -SUMMARY = "Tools for TPM2." -DESCRIPTION = "tpm2.0-tools" -SECTION = "security/tpm" - -LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=91b7c548d73ea16537799e8060cea819" - -DEPENDS += "tpm2.0-tss tpm2-abrmd openssl curl autoconf-archive pkgconfig" - -PV = "3.0.3+git${SRCPV}" - -SRC_URI = "\ - git://github.com/tpm2-software/tpm2-tools.git;branch=3.X \ - file://0001-tpm2-tools-use-dynamic-linkage-with-tpm2-abrmd.patch \ -" -SRCREV = "6b4385f098bd5d39e1cfc6cd2b038b68c960413f" - -S = "${WORKDIR}/git" - -inherit autotools pkgconfig - -EXTRA_OECONF += "\ - --with-tcti-device \ - --without-tcti-socket \ - --with-tcti-tabrmd \ -" - -EXTRA_OEMAKE += "\ - CFLAGS="${CFLAGS} -Wno-implicit-fallthrough" \ - LIBS=-ldl \ -" - -do_configure_prepend() { - # execute the bootstrap script - currentdir="$(pwd)" - cd "${S}" - ACLOCAL="aclocal --system-acdir=${STAGING_DATADIR}/aclocal" \ - ./bootstrap - cd "${currentdir}" -} - -RDEPENDS_${PN} += "libtss2 libtctidevice" -- cgit v1.2.3-54-g00ecf