Skip to contentSkip to conversation

swtpm and libtpms host packages

PATCH Superseded Jarkko Sakkinen 2 participants 7 messages May 17, 2024

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v2 cover swtpm and libtpms host packages

Add swtpm and libtpms host packages.

Testing:

git clone https://gitlab.com/jarkkojs/linux-tpmdd-test.git
cd linux-tpmdd-test
cmake -Bbuild && make -Cbuild buildroot-prepare make -Cbuild/buildroot/build build/buildroot/build/images/run-tests.sh

Jarkko Sakkinen (3):
package/json-glib: add host build
package/libtpms: add host package
package/swtpm: add host package

 DEVELOPERS                     |  2 ++
 package/Config.in              |  1 +
 package/Config.in.host         |  1 +
 package/json-glib/Config.in    |  9 +++++++++
 package/json-glib/json-glib.mk |  5 +++++
 package/libtpms/Config.in      | 19 +++++++++++++++++++
 package/libtpms/libtpms.hash   |  2 ++
 package/libtpms/libtpms.mk     | 17 +++++++++++++++++
 package/swtpm/Config.in.host   | 12 ++++++++++++
 package/swtpm/swtpm.hash       |  2 ++
 package/swtpm/swtpm.mk         | 23 +++++++++++++++++++++++
 11 files changed, 93 insertions(+)
 create mode 100644 package/libtpms/Config.in
 create mode 100644 package/libtpms/libtpms.hash
 create mode 100644 package/libtpms/libtpms.mk
 create mode 100644 package/swtpm/Config.in.host
 create mode 100644 package/swtpm/swtpm.hash
 create mode 100644 package/swtpm/swtpm.mk

--
2.45.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#1 lore raw

PATCH v2 1/3 package/json-glib: add host build

---
v2:
- Disable GOI and NLS for the host.
- Add the missing host config.

---
 package/json-glib/Config.in    | 9 +++++++++
 package/json-glib/json-glib.mk | 5 +++++
 2 files changed, 14 insertions(+)
package/json-glib/Config.in +9 -0
index 9df03d924a..ebf697bc64 100644
@@ -11,6 +11,15 @@ config BR2_PACKAGE_JSON_GLIB
 
 	  https://live.gnome.org/JsonGlib/
 
+config BR2_HOST_PACKAGE_JSON_GLIB
+	bool "json-glib"
+	help
+	  JSON-GLib is a library providing serialization and
+	  deserialization support for the JavaScript Object Notation
+	  (JSON) format described by RFC 4627.
+
+	  https://live.gnome.org/JsonGlib/
+
 comment "json-glib needs a toolchain w/ wchar, threads"
 	depends on BR2_USE_MMU
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
package/json-glib/json-glib.mk +5 -0
index cd53f24cee..a6bc53b823 100644
@@ -18,6 +18,10 @@ JSON_GLIB_DEPENDENCIES = \
 	host-pkgconf \
 	libglib2
 
+HOST_JSON_GLIB_DEPENDENCIES = \
+	host-pkgconf \
+	host-libglib2
+
 ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
 JSON_GLIB_CONF_OPTS += -Dintrospection=enabled
 JSON_GLIB_DEPENDENCIES += gobject-introspection
@@ -34,3 +38,4 @@ endif
 JSON_GLIB_LDFLAGS = $(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)
 
 $(eval $(meson-package))
+$(eval $(host-meson-package))

--
2.45.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Re: [Buildroot] [PATCH v2 1/3] package/json-glib: add host build

Jarkko, All,

On 2024-05-17 20:31 +0300, Jarkko Sakkinen spake thusly:

Quoted 4 lines

---
v2:
- Disable GOI and NLS for the host.

I think your forgot the GOI part [0]...

Quoted 1 line

- Add the missing host config.

Err, I was probably not explicit enough in my previous review: there is no need for a Kconfig option for host packages, when they only provide a library.

Also see below...

Quoted 10 lines
---
 package/json-glib/Config.in    | 9 +++++++++
 package/json-glib/json-glib.mk | 5 +++++
 2 files changed, 14 insertions(+)
package/json-glib/Config.in +0 -0
index 9df03d924a..ebf697bc64 100644

package/json-glib/Config.in config BR2_PACKAGE_JSON_GLIB · line 14

Quoted 4 lines
package/json-glib/Config.in +1 -0
@@ -11,6 +11,15 @@ config BR2_PACKAGE_JSON_GLIB
 
 	  https://live.gnome.org/JsonGlib/
 
+config BR2_HOST_PACKAGE_JSON_GLIB

The actual Kconfig symbol should be BR2_PACKAGE_HOST_JSON_GLIB (note the inversion between PACKAGE and HOST). You can catch such mis-naming by running the basic sanity checks:

    $ ./utils/docker-run make check-package
    package/json-glib/Config.in:14: BR2_HOST_PACKAGE_JSON_GLIB defined but not referenced

Also, Kconfig entries for host packages should be in a separate Config.in.host.

But in this case, there is no need for a Kconfig symbol, because json-glib only provides a library, so you only need the changes in json-glib.mk.

Quoted 16 lines
package/json-glib/Config.in +8 -0
+	bool "json-glib"
+	help
+	  JSON-GLib is a library providing serialization and
+	  deserialization support for the JavaScript Object Notation
+	  (JSON) format described by RFC 4627.
+
+	  https://live.gnome.org/JsonGlib/
+
 comment "json-glib needs a toolchain w/ wchar, threads"
 	depends on BR2_USE_MMU
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS
package/json-glib/json-glib.mk +0 -0
index cd53f24cee..a6bc53b823 100644

package/json-glib/json-glib.mk JSON_GLIB_DEPENDENCIES = \ · line 23

Quoted 6 lines
package/json-glib/json-glib.mk +3 -0
@@ -18,6 +18,10 @@ JSON_GLIB_DEPENDENCIES = \
 	host-pkgconf \
 	libglib2
 
+HOST_JSON_GLIB_DEPENDENCIES = \
+	host-pkgconf \
+	host-libglib2

...[0] I think you forgot:

HOST_JSON_GLIB_CONF_OPTS = -Dintrospection=diabled

Regards,
Yann E. MORIN.

Quoted 15 lines
package/json-glib/json-glib.mk +1 -1
 ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
 JSON_GLIB_CONF_OPTS += -Dintrospection=enabled
 JSON_GLIB_DEPENDENCIES += gobject-introspection
@@ -34,3 +38,4 @@ endif
 JSON_GLIB_LDFLAGS = $(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)
 
 $(eval $(meson-package))
+$(eval $(host-meson-package))
--

2.45.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

PATCH v2 2/3 package/libtpms: add host package

In reply to Jarkko Sakkinen

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.

---
v2:
- Use host packages in package/libtpms/Config.in.
- Select BR2_HOST_PACKAGE_LIBOPENSSL.

---
 DEVELOPERS                   |  1 +
 package/Config.in            |  1 +
 package/libtpms/Config.in    | 19 +++++++++++++++++++
 package/libtpms/libtpms.hash |  2 ++
 package/libtpms/libtpms.mk   | 17 +++++++++++++++++
 5 files changed, 40 insertions(+)
 create mode 100644 package/libtpms/Config.in
 create mode 100644 package/libtpms/libtpms.hash
 create mode 100644 package/libtpms/libtpms.mk
DEVELOPERS +1 -0
index 52c9b84a9d..db0dc702a8 100644
@@ -1519,6 +1519,7 @@ N:	Jared Bents <[email protected]>
 F:	package/libvirt/
 
 N:	Jarkko Sakkinen <[email protected]>
+F:	package/libtpms/
 F:	package/quota/
 
 N:	Jason Pruitt <[email protected]>
package/Config.in +1 -0
index 1b6a5b0dab..30b76349ec 100644
@@ -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"
package/libtpms/Config.in new file +19 -0
new file mode 100644
index 0000000000..9308458248
@@ -0,0 +1,19 @@
+config BR2_HOST_PACKAGE_LIBTPMS
+	bool "libtpms"
+	select BR2_HOST_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
package/libtpms/libtpms.hash new file +2 -0
new file mode 100644
index 0000000000..1026aaa4f4
@@ -0,0 +1,2 @@
+sha256  2807466f1563ebe45fdd12dd26e501e8a0c4fbb99c7c428fbb508789efd221c0  libtpms-0.9.6.tar.gz
+sha256  82f1e6bae374bb6a9d4f4596767fd33e499718d560de140fd9f3d402cc5e41fb  LICENSE
package/libtpms/libtpms.mk new file +17 -0
new file mode 100644
index 0000000000..c588b2892c
@@ -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))

--
2.45.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Re: [Buildroot] [PATCH v2 2/3] package/libtpms: add host package

Jarkko, All,

On 2024-05-17 20:31 +0300, Jarkko Sakkinen spake thusly:

Quoted 10 lines

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.

---
v2:
- Use host packages in package/libtpms/Config.in.
- Select BR2_HOST_PACKAGE_LIBOPENSSL.

s/HOST_PACKAGE/PACKAGE_HOST/

However [0]...

[--SNIP--]

package/libtpms/Config.in line 1

Quoted 7 lines
package/libtpms/Config.in new file +1 -0
new file mode 100644
index 0000000000..9308458248
@@ -0,0 +1,19 @@
+config BR2_HOST_PACKAGE_LIBTPMS

s/HOST_PACKAGE/PACKAGE_HOST/

package/libtpms/Config.in line 3

Quoted 2 lines
package/libtpms/Config.in new file +2 -0
+	bool "libtpms"
+	select BR2_HOST_PACKAGE_LIBTOOL

[0]... here you select libtool instead of openssl.

And we can't select libopenssl; instead we select openssl:

    $ git grep 'select BR2_PACKAGE_LIBOPENSSL\>'
    [nada, naught, zilch]
    $ git grep 'select BR2_PACKAGE_OPENSSL\>'
    [156 results]

And anyway, in this case again there is no need for a Kconfig xymbo, as libtpms only provides a library, so there is only the need for libtpms.mk (and the hash file too).

[--SNIP--]

Quoted 8 lines
package/libtpms/libtpms.mk new file +2 -0
new file mode 100644
index 0000000000..c588b2892c
@@ -0,0 +1,17 @@
+################################################################################
+#

package/libtpms/libtpms.mk line 12

Quoted 10 lines
package/libtpms/libtpms.mk new file +10 -0
+# 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

Sorry, I missed that in my previous review, but we usually add a little comment why autoreconf is needed:

# Straight from the git repository
LIBTPMS_AUTORECONF = YES

Regards,
Yann E. MORIN.

Quoted 11 lines
package/libtpms/libtpms.mk new file +4 -1
+HOST_LIBTPMS_DEPENDENCIES = host-libtool host-pkgconf host-libopenssl
+HOST_LIBTPMS_CONF_OPTS = --with-openssl  -with-tpm2
+
+$(eval $(host-autotools-package))
--

2.45.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

PATCH v2 3/3 package/swtpm: add host package

In reply to Jarkko Sakkinen

The SWTPM package provides TPM emulators with different front-end interfaces to libtpms. TPM emulators provide socket interfaces (TCP/IP and Unix) and the Linux CUSE interface for the creation of multiple native /dev/vtpm* devices.

---
v2:
- Remove libraries from Config.host.in.
- Put deps line-by-line.

---
 DEVELOPERS                   |  1 +
 package/Config.in.host       |  1 +
 package/swtpm/Config.in.host | 12 ++++++++++++
 package/swtpm/swtpm.hash     |  2 ++
 package/swtpm/swtpm.mk       | 23 +++++++++++++++++++++++
 5 files changed, 39 insertions(+)
 create mode 100644 package/swtpm/Config.in.host
 create mode 100644 package/swtpm/swtpm.hash
 create mode 100644 package/swtpm/swtpm.mk
DEVELOPERS +1 -0
index db0dc702a8..732002f85b 100644
@@ -1521,6 +1521,7 @@ F:	package/libvirt/
 N:	Jarkko Sakkinen <[email protected]>
 F:	package/libtpms/
 F:	package/quota/
+F:	package/swtpm/
 
 N:	Jason Pruitt <[email protected]>
 F:	package/librtlsdr/
package/Config.in.host +1 -0
index 986b2854d0..0cf9dc3897 100644
@@ -110,6 +110,7 @@ menu "Host utilities"
 	source "package/starfive-spltool/Config.in.host"
 	source "package/sunxi-tools/Config.in.host"
 	source "package/swig/Config.in.host"
+	source "package/swtpm/Config.in.host"
 	source "package/swugenerator/Config.in.host"
 	source "package/systemd/Config.in.host"
 	source "package/tegrarcm/Config.in.host"
package/swtpm/Config.in.host new file +12 -0
new file mode 100644
index 0000000000..79a9aa28af
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_HOST_SWTPM
+	bool "host swtpm"
+	select BR2_PACKAGE_LIBTOOL
+	help
+	  Compiles SWTPM software TPM emulator for the host.
+
+	  The SWTPM package provides TPM emulators with different
+	  front-end interfaces to libtpms. TPM emulators provide socket
+	  interfaces (TCP/IP and Unix) and the Linux CUSE interface for
+	  the creation of multiple native /dev/vtpm* devices.
+
+	  https://github.com/stefanberger/swtpm/wiki
package/swtpm/swtpm.hash new file +2 -0
new file mode 100644
index 0000000000..934d3b6ee0
@@ -0,0 +1,2 @@
+sha256  b281b4e8c39f68e1928675f788abc70072e4081152e129144359a8c5c304c06b  swtpm-0.8.2.tar.gz
+sha256  19d27d6e96d07022e5e688f75c974f1ceb9aae9e90e0fccae68666d02099cc4b  LICENSE
package/swtpm/swtpm.mk new file +23 -0
new file mode 100644
index 0000000000..1d42d72e71
@@ -0,0 +1,23 @@
+################################################################################
+#
+# swtpm
+#
+################################################################################
+
+SWTPM_VERSION = 0.8.2
+SWTPM_SITE = $(call github,stefanberger,swtpm,v$(SWTPM_VERSION))
+SWTPM_LICENSE = BSD-4-Clause
+SWTPM_LICENSE_FILES = LICENSE
+SWTPM_AUTORECONF = YES
+
+HOST_SWTPM_DEPENDENCIES = \
+	host-json-glib \
+	host-libopenssl \
+	host-libtasn1 \
+	host-libtool \
+	host-libtpms \
+	host-pkgconf
+
+HOST_SWTPM_CONF_OPTS = --with-openssl --without-seccomp
+
+$(eval $(host-autotools-package))

--
2.45.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw

Re: [Buildroot] [PATCH v2 3/3] package/swtpm: add host package

Jarkko, All,

On 2024-05-17 20:31 +0300, Jarkko Sakkinen spake thusly:

Quoted 7 lines

The SWTPM package provides TPM emulators with different front-end interfaces to libtpms. TPM emulators provide socket interfaces (TCP/IP and Unix) and the Linux CUSE interface for the creation of multiple native /dev/vtpm* devices.

---

[--SNIP--]

package/swtpm/Config.in.host line 3

Quoted 9 lines
package/swtpm/Config.in.host new file +3 -0
new file mode 100644
index 0000000000..79a9aa28af
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_HOST_SWTPM
+	bool "host swtpm"
+	select BR2_PACKAGE_LIBTOOL

host-swtpm is a host package, so it should not select target packages, like libtool. And the host variant for libtool has no Kconfig symbol.

Quoted 24 lines
package/swtpm/Config.in.host new file +9 -0
+	help
+	  Compiles SWTPM software TPM emulator for the host.
+
+	  The SWTPM package provides TPM emulators with different
+	  front-end interfaces to libtpms. TPM emulators provide socket
+	  interfaces (TCP/IP and Unix) and the Linux CUSE interface for
+	  the creation of multiple native /dev/vtpm* devices.
+
+	  https://github.com/stefanberger/swtpm/wiki
package/swtpm/swtpm.hash new file +2 -0
new file mode 100644
index 0000000000..934d3b6ee0
@@ -0,0 +1,2 @@
+sha256  b281b4e8c39f68e1928675f788abc70072e4081152e129144359a8c5c304c06b  swtpm-0.8.2.tar.gz
+sha256  19d27d6e96d07022e5e688f75c974f1ceb9aae9e90e0fccae68666d02099cc4b  LICENSE
package/swtpm/swtpm.mk new file +1 -0
new file mode 100644
index 0000000000..1d42d72e71
@@ -0,0 +1,23 @@
+################################################################################

package/swtpm/swtpm.mk line 11

Quoted 10 lines
package/swtpm/swtpm.mk new file +10 -0
+#
+# swtpm
+#
+################################################################################
+
+SWTPM_VERSION = 0.8.2
+SWTPM_SITE = $(call github,stefanberger,swtpm,v$(SWTPM_VERSION))
+SWTPM_LICENSE = BSD-4-Clause
+SWTPM_LICENSE_FILES = LICENSE
+SWTPM_AUTORECONF = YES

# Straight out of the git repository
SWTPM_AUTORECONF = YES

Almost there! ;-)

Regards,
Yann E. MORIN.

Quoted 18 lines
package/swtpm/swtpm.mk new file +11 -1
+HOST_SWTPM_DEPENDENCIES = \
+	host-json-glib \
+	host-libopenssl \
+	host-libtasn1 \
+	host-libtool \
+	host-libtpms \
+	host-pkgconf
+
+HOST_SWTPM_CONF_OPTS = --with-openssl --without-seccomp
+
+$(eval $(host-autotools-package))
--

2.45.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot