Skip to contentSkip to conversation

package/tpm2sh: new package tpm2sh 0.17.2

PATCH In review Jarkko Sakkinen via buildroot 1 participant 3 messages Jun 11 – Aug 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/tpm2sh: new package tpm2sh 0.17.2

tpm2sh is a TPM 2.0 command-line shell and troubleshooting tool for Linux with low dependencies. It communicates directly with /dev/tpm{rm}0. It is most useful in kernel testing.

Among other things it can be used to query and manipulate the chip memory:

~ main
❯ tpm2sh memory

HANDLE     CLASS      DETAILS
01c00002   nv-index   rsa-2048:sha256
01c0000a   nv-index   ecc-nist-p256:sha256

~ main
❯ tpm2sh memory 01c0000a
-----BEGIN CERTIFICATE-----
[CENSORED]
-----END CERTIFICATE-----

And all this makes it also sort of useful embedded debugging tool too.

---
Sorry if I missed some detail. Tried to check but this is my first Rust package for BR2 so anything is possible.

 package/Config.in          |  1 +
 package/tpm2sh/Config.in   | 18 ++++++++++++++++++
 package/tpm2sh/tpm2sh.hash |  2 ++
 package/tpm2sh/tpm2sh.mk   | 14 ++++++++++++++
 4 files changed, 35 insertions(+)
 create mode 100644 package/tpm2sh/Config.in
 create mode 100644 package/tpm2sh/tpm2sh.hash
 create mode 100644 package/tpm2sh/tpm2sh.mk
package/Config.in +1 -0
index 630662477b..05b5060651 100644
@@ -2888,6 +2888,7 @@ menu "System tools"
 	source "package/tpm-tools/Config.in"
 	source "package/tpm2-abrmd/Config.in"
 	source "package/tpm2-tools/Config.in"
+	source "package/tpm2sh/Config.in"
 	source "package/tpm2-totp/Config.in"
 	source "package/ugetty/Config.in"
 	source "package/unscd/Config.in"
package/tpm2sh/Config.in new file +18 -0
new file mode 100644
index 0000000000..5268d0df6e
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_TPM2SH
+	bool "tpm2sh"
+	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+	select BR2_PACKAGE_HOST_RUSTC
+	select BR2_PACKAGE_HOST_PKGCONF
+	select BR2_PACKAGE_OPENSSL
+	select BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL
+	select BR2_PACKAGE_LIBOPENSSL
+	help
+	  TPM 2.0 command-line interface.
+
+	  tpm2sh is a command-line interface for interacting with TPM 2.0 chips
+	  directly through /dev/tpm0 or /dev/tpmrm0.
+
+	  https://gitlab.com/tpm-protocol/tpm2sh
+
+comment "tpm2sh needs a toolchain with Rust support"
+	depends on !BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
package/tpm2sh/tpm2sh.hash new file +2 -0
new file mode 100644
index 0000000000..567a7751f9
@@ -0,0 +1,2 @@
+sha256  90b557b6d6a6a8f8e2bf946edf5db18cd33b09245c11d38e8543ff0f486f6a40  tpm2sh-0.17.2-git4-cargo5.tar.gz
+sha256  3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986  LICENSE
package/tpm2sh/tpm2sh.mk new file +14 -0
new file mode 100644
index 0000000000..573eb88ad5
@@ -0,0 +1,14 @@
+################################################################################
+#
+# tpm2sh
+#
+################################################################################
+
+TPM2SH_VERSION = 0.17.2
+TPM2SH_SITE = https://gitlab.com/tpm-protocol/tpm2sh
+TPM2SH_SITE_METHOD = git
+TPM2SH_LICENSE = GPL-3.0-or-later
+TPM2SH_LICENSE_FILES = LICENSE
+TPM2SH_DEPENDENCIES = host-pkgconf openssl
+
+$(eval $(cargo-package))
Signature · 6 lines
2.47.3

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

Hi Jarkko!

Am 11.06.26 um 12:54 schrieb Jarkko Sakkinen via buildroot:

Quoted 19 lines

tpm2sh is a TPM 2.0 command-line shell and troubleshooting tool for Linux with low dependencies. It communicates directly with /dev/tpm{rm}0. It is most useful in kernel testing.

Among other things it can be used to query and manipulate the chip memory:

~ main
❯ tpm2sh memory

HANDLE     CLASS      DETAILS
01c00002   nv-index   rsa-2048:sha256
01c0000a   nv-index   ecc-nist-p256:sha256

~ main
❯ tpm2sh memory 01c0000a
-----BEGIN CERTIFICATE-----
[CENSORED]
-----END CERTIFICATE-----

Quoted 6 lines

And all this makes it also sort of useful embedded debugging tool too.

---
Sorry if I missed some detail. Tried to check but this is my first Rust package for BR2 so anything is possible.

Looks mostly good, three comments below. Also, when adding a new package, please add yourself to DEVELOPERS for that package. :-)

Quoted 14 lines
  package/Config.in          |  1 +
  package/tpm2sh/Config.in   | 18 ++++++++++++++++++
  package/tpm2sh/tpm2sh.hash |  2 ++
  package/tpm2sh/tpm2sh.mk   | 14 ++++++++++++++
  4 files changed, 35 insertions(+)

create mode 100644 package/tpm2sh/Config.in
create mode 100644 package/tpm2sh/tpm2sh.hash
create mode 100644 package/tpm2sh/tpm2sh.mk

package/Config.in +0 -0
index 630662477b..05b5060651 100644

package/Config.in menu "System tools" · line 2891

Quoted 4 lines
package/Config.in +1 -0
@@ -2888,6 +2888,7 @@ menu "System tools"
  	source "package/tpm-tools/Config.in"
  	source "package/tpm2-abrmd/Config.in"
  	source "package/tpm2-tools/Config.in"
+	source "package/tpm2sh/Config.in"

This should go after package/tpm2-totp to keep the alphabetical ordering.

Quoted 33 lines
package/Config.in +0 -0
  	source "package/tpm2-totp/Config.in"
  	source "package/ugetty/Config.in"
  	source "package/unscd/Config.in"
package/tpm2sh/Config.in new file +18 -0
new file mode 100644
index 0000000000..5268d0df6e
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_TPM2SH
+	bool "tpm2sh"
+	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+	select BR2_PACKAGE_HOST_RUSTC
+	select BR2_PACKAGE_HOST_PKGCONF
+	select BR2_PACKAGE_OPENSSL
+	select BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL
+	select BR2_PACKAGE_LIBOPENSSL
+	help
+	  TPM 2.0 command-line interface.
+
+	  tpm2sh is a command-line interface for interacting with TPM 2.0 chips
+	  directly through /dev/tpm0 or /dev/tpmrm0.
+
+	  https://gitlab.com/tpm-protocol/tpm2sh
+
+comment "tpm2sh needs a toolchain with Rust support"
+	depends on !BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
package/tpm2sh/tpm2sh.hash new file +0 -0
new file mode 100644
index 0000000000..567a7751f9

package/tpm2sh/tpm2sh.hash line 1

Quoted 1 line
package/tpm2sh/tpm2sh.hash new file +1 -0
@@ -0,0 +1,2 @@
+sha256  90b557b6d6a6a8f8e2bf946edf5db18cd33b09245c11d38e8543ff0f486f6a40  tpm2sh-0.17.2-git4-cargo5.tar.gz

Two days after you sent this patch, Rust was updated to 1.97.0 (commit e8c8bd9bc56a827db90c3bb2e71e4613a5a2c730) switching to cargo6 format, so you'll need to update for that.

Quoted 7 lines
package/tpm2sh/tpm2sh.hash new file +1 -0
+sha256  3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986  LICENSE
package/tpm2sh/tpm2sh.mk new file +0 -0
new file mode 100644
index 0000000000..573eb88ad5

package/tpm2sh/tpm2sh.mk line 7

Quoted 7 lines
package/tpm2sh/tpm2sh.mk new file +7 -0
@@ -0,0 +1,14 @@
+################################################################################
+#
+# tpm2sh
+#
+################################################################################
+
+TPM2SH_VERSION = 0.17.2

I see you've released an 1.0.0 since sending this patch, I suppose updating while fixing the other issues would make sense?

Best regards,
Fiona

package/tpm2sh/tpm2sh.mk line 14

Quoted 7 lines
package/tpm2sh/tpm2sh.mk new file +7 -0
+TPM2SH_SITE = https://gitlab.com/tpm-protocol/tpm2sh
+TPM2SH_SITE_METHOD = git
+TPM2SH_LICENSE = GPL-3.0-or-later
+TPM2SH_LICENSE_FILES = LICENSE
+TPM2SH_DEPENDENCIES = host-pkgconf openssl
+
+$(eval $(cargo-package))

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

#2 lore raw
Quoted 101 lines · Fiona Klute

Hi Jarkko!

Am 11.06.26 um 12:54 schrieb Jarkko Sakkinen via buildroot:

Quoted 19 lines

tpm2sh is a TPM 2.0 command-line shell and troubleshooting tool for Linux with low dependencies. It communicates directly with /dev/tpm{rm}0. It is most useful in kernel testing.

Among other things it can be used to query and manipulate the chip memory:

~ main
❯ tpm2sh memory

HANDLE     CLASS      DETAILS
01c00002   nv-index   rsa-2048:sha256
01c0000a   nv-index   ecc-nist-p256:sha256

~ main
❯ tpm2sh memory 01c0000a
-----BEGIN CERTIFICATE-----
[CENSORED]
-----END CERTIFICATE-----

Quoted 6 lines

And all this makes it also sort of useful embedded debugging tool too.

---
Sorry if I missed some detail. Tried to check but this is my first Rust package for BR2 so anything is possible.

Looks mostly good, three comments below. Also, when adding a new package, please add yourself to DEVELOPERS for that package. :-)

Quoted 14 lines
  package/Config.in          |  1 +
  package/tpm2sh/Config.in   | 18 ++++++++++++++++++
  package/tpm2sh/tpm2sh.hash |  2 ++
  package/tpm2sh/tpm2sh.mk   | 14 ++++++++++++++
  4 files changed, 35 insertions(+)

create mode 100644 package/tpm2sh/Config.in
create mode 100644 package/tpm2sh/tpm2sh.hash
create mode 100644 package/tpm2sh/tpm2sh.mk

package/Config.in +0 -0
index 630662477b..05b5060651 100644

package/Config.in menu "System tools" · line 2891

Quoted 4 lines
package/Config.in +1 -0
@@ -2888,6 +2888,7 @@ menu "System tools"
  	source "package/tpm-tools/Config.in"
  	source "package/tpm2-abrmd/Config.in"
  	source "package/tpm2-tools/Config.in"
+	source "package/tpm2sh/Config.in"

This should go after package/tpm2-totp to keep the alphabetical ordering.

Quoted 33 lines
package/Config.in +0 -0
  	source "package/tpm2-totp/Config.in"
  	source "package/ugetty/Config.in"
  	source "package/unscd/Config.in"
package/tpm2sh/Config.in new file +18 -0
new file mode 100644
index 0000000000..5268d0df6e
@@ -0,0 +1,18 @@
+config BR2_PACKAGE_TPM2SH
+	bool "tpm2sh"
+	depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
+	select BR2_PACKAGE_HOST_RUSTC
+	select BR2_PACKAGE_HOST_PKGCONF
+	select BR2_PACKAGE_OPENSSL
+	select BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL
+	select BR2_PACKAGE_LIBOPENSSL
+	help
+	  TPM 2.0 command-line interface.
+
+	  tpm2sh is a command-line interface for interacting with TPM 2.0 chips
+	  directly through /dev/tpm0 or /dev/tpmrm0.
+
+	  https://gitlab.com/tpm-protocol/tpm2sh
+
+comment "tpm2sh needs a toolchain with Rust support"
+	depends on !BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS
package/tpm2sh/tpm2sh.hash new file +0 -0
new file mode 100644
index 0000000000..567a7751f9

package/tpm2sh/tpm2sh.hash line 1

Quoted 1 line
package/tpm2sh/tpm2sh.hash new file +1 -0
@@ -0,0 +1,2 @@
+sha256  90b557b6d6a6a8f8e2bf946edf5db18cd33b09245c11d38e8543ff0f486f6a40  tpm2sh-0.17.2-git4-cargo5.tar.gz

Two days after you sent this patch, Rust was updated to 1.97.0 (commit e8c8bd9bc56a827db90c3bb2e71e4613a5a2c730) switching to cargo6 format, so you'll need to update for that.

Quoted 9 lines
package/tpm2sh/tpm2sh.hash new file +1 -0
+sha256  3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986  LICENSE
package/tpm2sh/tpm2sh.mk new file +2 -0
new file mode 100644
index 0000000000..573eb88ad5
@@ -0,0 +1,14 @@
+################################################################################
+#
Quoted 8 lines

package/tpm2sh/tpm2sh.mk line 7

Quoted 5 lines
package/tpm2sh/tpm2sh.mk new file +5 -0
+# tpm2sh
+#
+################################################################################
+
+TPM2SH_VERSION = 0.17.2

I see you've released an 1.0.0 since sending this patch, I suppose updating while fixing the other issues would make sense?

Yes, it does. Thanks for the review. It will take some time but I'll fix the issues, upgrade to 1.0 and put this to shape.

Why this is useful in general for Buildroot is that in general for any peace of hardware, "stackless" testing tool is useful :-)

Quoted 4 lines

Best regards,
Fiona

Quoted 8 lines

package/tpm2sh/tpm2sh.mk line 14

Quoted 7 lines
package/tpm2sh/tpm2sh.mk new file +7 -0
+TPM2SH_SITE = https://gitlab.com/tpm-protocol/tpm2sh
+TPM2SH_SITE_METHOD = git
+TPM2SH_LICENSE = GPL-3.0-or-later
+TPM2SH_LICENSE_FILES = LICENSE
+TPM2SH_DEPENDENCIES = host-pkgconf openssl
+
+$(eval $(cargo-package))

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