diff mbox series

[3/4] package/libtpms: add host package

Message ID 20240517132039.7124-4-jarkko@kernel.org
State Changes Requested
Headers show
Series swtpm and libtpms host packages | expand

Commit Message

Jarkko Sakkinen May 17, 2024, 1:20 p.m. UTC
Libtpms is a library that targets the integration of TPM functionality
into hypervisors, primarily into Qemu. Libtpms provides a very narrow
public API for this purpose so that integration is possible. Only the
minimum of necessary APIs are made publicly available.

Link: https://github.com/stefanberger/libtpms
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
---
 DEVELOPERS                   |  1 +
 package/Config.in            |  1 +
 package/libtpms/Config.in    | 20 ++++++++++++++++++++
 package/libtpms/libtpms.hash |  2 ++
 package/libtpms/libtpms.mk   | 17 +++++++++++++++++
 5 files changed, 41 insertions(+)
 create mode 100644 package/libtpms/Config.in
 create mode 100644 package/libtpms/libtpms.hash
 create mode 100644 package/libtpms/libtpms.mk

Comments

Yann E. MORIN May 17, 2024, 1:44 p.m. UTC | #1
Jarkko, All,

On 2024-05-17 16:20 +0300, Jarkko Sakkinen spake thusly:
> Libtpms is a library that targets the integration of TPM functionality
> into hypervisors, primarily into Qemu. Libtpms provides a very narrow
> public API for this purpose so that integration is possible. Only the
> minimum of necessary APIs are made publicly available.
> 
> Link: https://github.com/stefanberger/libtpms
> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
> ---
[--SNIP--]
> diff --git a/package/libtpms/Config.in b/package/libtpms/Config.in
> new file mode 100644
> index 0000000000..d5ae47375a
> --- /dev/null
> +++ b/package/libtpms/Config.in
> @@ -0,0 +1,20 @@
> +config BR2_PACKAGE_LIBTPMS

BR2_PACKAGE_LIBTPMS is for target package; for the host variant, you'd
have to name it BR2_PACKAGE_HOST_LIBTPMS.

The Config.in is sourced from ackage/Config.in, too, which is for target
packages.

> +	bool "libtpms"
> +	select BR2_PACKAGE_LIBOPENSSL
> +	select BR2_PACKAGE_LIBTOOL

It even selects target packages.

However [0]...

[--SNIP--]
> diff --git a/package/libtpms/libtpms.mk b/package/libtpms/libtpms.mk
> new file mode 100644
> index 0000000000..c588b2892c
> --- /dev/null
> +++ b/package/libtpms/libtpms.mk
> @@ -0,0 +1,17 @@
> +################################################################################
> +#
> +# libtpms
> +#
> +################################################################################
> +
> +LIBTPMS_VERSION = 0.9.6
> +LIBTPMS_SITE = $(call github,stefanberger,libtpms,v$(LIBTPMS_VERSION))
> +LIBTPMS_LICENSE = BSD-4-Clause
> +LIBTPMS_LICENSE_FILES = LICENSE
> +LIBTPMS_INSTALL_STAGING = YES
> +LIBTPMS_AUTORECONF = YES
> +
> +HOST_LIBTPMS_DEPENDENCIES = host-libtool host-pkgconf host-libopenssl
> +HOST_LIBTPMS_CONF_OPTS = --with-openssl  -with-tpm2
> +
> +$(eval $(host-autotools-package))

[0]... you've made it a host-only package.

So it means that if one enable BR2_PACKAGE_LIBTPMS in the menuconfig,
there will be no libtpms available in the target.

For host packages that only provide a library used by other host
packages, we usually do not add a Kconfig symbol at all, and just rely
on the _DEPENDENCIES to bring in the library.

Regards,
Yann E. MORIN.

> -- 
> 2.45.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 52c9b84a9d..db0dc702a8 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1519,6 +1519,7 @@  N:	Jared Bents <jared.bents@rockwellcollins.com>
 F:	package/libvirt/
 
 N:	Jarkko Sakkinen <jarkko@kernel.org>
+F:	package/libtpms/
 F:	package/quota/
 
 N:	Jason Pruitt <jrspruitt@gmail.com>
diff --git a/package/Config.in b/package/Config.in
index 1b6a5b0dab..30b76349ec 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1569,6 +1569,7 @@  menu "Crypto"
 	source "package/libssh/Config.in"
 	source "package/libssh2/Config.in"
 	source "package/libtomcrypt/Config.in"
+	source "package/libtpms/Config.in"
 	source "package/libuecc/Config.in"
 	source "package/libxcrypt/Config.in"
 	source "package/mbedtls/Config.in"
diff --git a/package/libtpms/Config.in b/package/libtpms/Config.in
new file mode 100644
index 0000000000..d5ae47375a
--- /dev/null
+++ b/package/libtpms/Config.in
@@ -0,0 +1,20 @@ 
+config BR2_PACKAGE_LIBTPMS
+	bool "libtpms"
+	select BR2_PACKAGE_LIBOPENSSL
+	select BR2_PACKAGE_LIBTOOL
+	help
+	  Libtpms is a library that targets the integration of TPM
+	  functionality into hypervisors, primarily into Qemu. Libtpms
+	  provides a very narrow public API for this purpose so that
+	  integration is possible. Only the minimum of necessary APIs
+	  are made publicly available.
+
+	  It is assumed that the user of libtpms is familiar with the
+	  concepts of the Trusted Platform Module (TPM). For the
+	  interaction with libtpms it is necessary to know how to
+	  construct valid TPM commands and to be able to parse their
+	  results. It is not within the scope of libtpms's documentation
+	  to provide background on this. See the section on references
+	  below.
+
+	  https://github.com/stefanberger/libtpms/wiki
diff --git a/package/libtpms/libtpms.hash b/package/libtpms/libtpms.hash
new file mode 100644
index 0000000000..1026aaa4f4
--- /dev/null
+++ b/package/libtpms/libtpms.hash
@@ -0,0 +1,2 @@ 
+sha256  2807466f1563ebe45fdd12dd26e501e8a0c4fbb99c7c428fbb508789efd221c0  libtpms-0.9.6.tar.gz
+sha256  82f1e6bae374bb6a9d4f4596767fd33e499718d560de140fd9f3d402cc5e41fb  LICENSE
diff --git a/package/libtpms/libtpms.mk b/package/libtpms/libtpms.mk
new file mode 100644
index 0000000000..c588b2892c
--- /dev/null
+++ b/package/libtpms/libtpms.mk
@@ -0,0 +1,17 @@ 
+################################################################################
+#
+# libtpms
+#
+################################################################################
+
+LIBTPMS_VERSION = 0.9.6
+LIBTPMS_SITE = $(call github,stefanberger,libtpms,v$(LIBTPMS_VERSION))
+LIBTPMS_LICENSE = BSD-4-Clause
+LIBTPMS_LICENSE_FILES = LICENSE
+LIBTPMS_INSTALL_STAGING = YES
+LIBTPMS_AUTORECONF = YES
+
+HOST_LIBTPMS_DEPENDENCIES = host-libtool host-pkgconf host-libopenssl
+HOST_LIBTPMS_CONF_OPTS = --with-openssl  -with-tpm2
+
+$(eval $(host-autotools-package))