diff mbox series

[v4,2/3] package/libtpms: add host package

Message ID 20240521103154.32660-3-jarkko@kernel.org
State Superseded
Headers show
Series swtpm and libtpms host packages | expand

Commit Message

Jarkko Sakkinen May 21, 2024, 10:31 a.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.

Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
---
v4:
- Changed in libtpms.mk to purely HOST_*.
v3:
- Use package deps in Kconfig as this just a library.
- DEPENDENCIES and CONF_OPTS for the host build
v2:
- Use host packages in package/libtpms/Config.in.
- Select BR2_HOST_PACKAGE_LIBOPENSSL.
---
 DEVELOPERS                   |  1 +
 package/Config.in            |  1 +
 package/libtpms/Config.in    | 20 ++++++++++++++++++++
 package/libtpms/libtpms.hash |  2 ++
 package/libtpms/libtpms.mk   | 18 ++++++++++++++++++
 5 files changed, 42 insertions(+)
 create mode 100644 package/libtpms/Config.in
 create mode 100644 package/libtpms/libtpms.hash
 create mode 100644 package/libtpms/libtpms.mk

--
2.45.1

Comments

Baruch Siach May 21, 2024, 10:39 a.m. UTC | #1
Hi Jarkko,

On Tue, May 21 2024, Jarkko Sakkinen wrote:
> 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..335a5bc7b6
> --- /dev/null
> +++ b/package/libtpms/Config.in
> @@ -0,0 +1,20 @@
> +config BR2_PACKAGE_LIBTPMS

You are not adding a target package, right? So this config symbol
doesn't do anything.

baruch

> +	bool "libtpms"
> +	select BR2_PACKAGE_LIBTOOL
> +	select BR2_PACKAGE_OPENSSL
> +	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
Jarkko Sakkinen May 21, 2024, 10:47 a.m. UTC | #2
On Tue May 21, 2024 at 1:39 PM EEST, Baruch Siach wrote:
> Hi Jarkko,
>
> On Tue, May 21 2024, Jarkko Sakkinen wrote:
> > 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..335a5bc7b6
> > --- /dev/null
> > +++ b/package/libtpms/Config.in
> > @@ -0,0 +1,20 @@
> > +config BR2_PACKAGE_LIBTPMS
>
> You are not adding a target package, right? So this config symbol
> doesn't do anything.

Ugh, right. Now I need to do a check before I roll out a new version.

I think this is what I should actually do, right (diff below)? Sorry
learning the process :-)

diff --git a/package/Config.in b/package/Config.in
index 30b76349ec..1b6a5b0dab 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1569,7 +1569,6 @@ 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/Config.in.host b/package/Config.in.host
index 0cf9dc3897..4e0dab0504 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -57,6 +57,7 @@ menu "Host utilities"
        source "package/jsmin/Config.in.host"
        source "package/kmod/Config.in.host"
        source "package/libp11/Config.in.host"
+       source "package/libtpms/Config.in.host"
        source "package/llvm-project/lld/Config.in.host"
        source "package/lpc3250loader/Config.in.host"
        source "package/lttng-babeltrace/Config.in.host"
diff --git a/package/libtpms/Config.in b/package/libtpms/Config.in.host
similarity index 89%
rename from package/libtpms/Config.in
rename to package/libtpms/Config.in.host
index 335a5bc7b6..7a477d21a7 100644
--- a/package/libtpms/Config.in
+++ b/package/libtpms/Config.in.host
@@ -1,7 +1,5 @@
-config BR2_PACKAGE_LIBTPMS
+config BR2_HOST_PACKAGE_LIBTPMS
        bool "libtpms"
-       select BR2_PACKAGE_LIBTOOL
-       select BR2_PACKAGE_OPENSSL
        help
          Libtpms is a library that targets the integration of TPM
          functionality into hypervisors, primarily into Qemu. Libtpms

BR, Jarkko
Baruch Siach May 21, 2024, 11:15 a.m. UTC | #3
Hi Jarkko,

[ Sorry for the dup again ]

On Tue, May 21 2024, Jarkko Sakkinen wrote:
> On Tue May 21, 2024 at 1:39 PM EEST, Baruch Siach wrote:
>> Hi Jarkko,
>>
>> On Tue, May 21 2024, Jarkko Sakkinen wrote:
>> > 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..335a5bc7b6
>> > --- /dev/null
>> > +++ b/package/libtpms/Config.in
>> > @@ -0,0 +1,20 @@
>> > +config BR2_PACKAGE_LIBTPMS
>>
>> You are not adding a target package, right? So this config symbol
>> doesn't do anything.
>
> Ugh, right. Now I need to do a check before I roll out a new version.
>
> I think this is what I should actually do, right (diff below)? Sorry
> learning the process :-)

We usually don't provide config symbols for host packages that are only
used as dependencies of other packages. So the right thing to do is drop
Config.in entirely.

baruch

> diff --git a/package/Config.in b/package/Config.in
> index 30b76349ec..1b6a5b0dab 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -1569,7 +1569,6 @@ 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/Config.in.host b/package/Config.in.host
> index 0cf9dc3897..4e0dab0504 100644
> --- a/package/Config.in.host
> +++ b/package/Config.in.host
> @@ -57,6 +57,7 @@ menu "Host utilities"
>         source "package/jsmin/Config.in.host"
>         source "package/kmod/Config.in.host"
>         source "package/libp11/Config.in.host"
> +       source "package/libtpms/Config.in.host"
>         source "package/llvm-project/lld/Config.in.host"
>         source "package/lpc3250loader/Config.in.host"
>         source "package/lttng-babeltrace/Config.in.host"
> diff --git a/package/libtpms/Config.in b/package/libtpms/Config.in.host
> similarity index 89%
> rename from package/libtpms/Config.in
> rename to package/libtpms/Config.in.host
> index 335a5bc7b6..7a477d21a7 100644
> --- a/package/libtpms/Config.in
> +++ b/package/libtpms/Config.in.host
> @@ -1,7 +1,5 @@
> -config BR2_PACKAGE_LIBTPMS
> +config BR2_HOST_PACKAGE_LIBTPMS
>         bool "libtpms"
> -       select BR2_PACKAGE_LIBTOOL
> -       select BR2_PACKAGE_OPENSSL
>         help
>           Libtpms is a library that targets the integration of TPM
>           functionality into hypervisors, primarily into Qemu. Libtpms
>
> BR, Jarkko
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..335a5bc7b6
--- /dev/null
+++ b/package/libtpms/Config.in
@@ -0,0 +1,20 @@ 
+config BR2_PACKAGE_LIBTPMS
+	bool "libtpms"
+	select BR2_PACKAGE_LIBTOOL
+	select BR2_PACKAGE_OPENSSL
+	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..68be1f6b44
--- /dev/null
+++ b/package/libtpms/libtpms.mk
@@ -0,0 +1,18 @@ 
+################################################################################
+#
+# 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
+
+# Straight from the git repository:
+HOST_LIBTPMS_AUTORECONF = YES
+HOST_LIBTPMS_DEPENDENCIES = host-pkgconf host-openssl
+HOST_LIBTPMS_CONF_OPTS = --with-openssl  -with-tpm2
+
+$(eval $(host-autotools-package))