Skip to contentSkip to conversation

package/wolftpm: new package, wolfTPM library for TPM2.0

PATCH In review Dimi Tomov 2 participants 12 messages May 8, 2022 – Jun 2, 2022

lore
Share & tools
lore

Dimi Tomov

author
#0 lore raw

PATCH 1/1 package/wolftpm: new package, wolfTPM library for TPM2.0

From: Dimitar Tomov <[email protected]>

wolfTPM is an open-source TPM 2.0 stack with backward API compatibility, designed for embedded use. It is highly portable, and has native support for Linux. wolfTPM has a compact code size with low resource usage.

---
 package/Config.in            |  1 +
 package/wolftpm/Config.in    | 14 ++++++++++++++
 package/wolftpm/wolftpm.hash |  2 ++
 package/wolftpm/wolftpm.mk   | 29 +++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+)
 create mode 100644 package/wolftpm/Config.in
 create mode 100644 package/wolftpm/wolftpm.hash
 create mode 100644 package/wolftpm/wolftpm.mk
package/Config.in +1 -0
index 8892134133..2a8bf18699 100644
@@ -1432,6 +1432,7 @@ menu "Crypto"
 	source "package/trousers/Config.in"
 	source "package/ustream-ssl/Config.in"
 	source "package/wolfssl/Config.in"
+	source "package/wolftpm/Config.in"
 endmenu
 
 menu "Database"
package/wolftpm/Config.in new file +14 -0
new file mode 100644
index 0000000000..497f5ae6e9
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_WOLFTPM
+	bool "wolftpm"
+	depends on BR2_PACKAGE_WOLFSSL
+    select BR2_PACKAGE_WOLFSSL_ALL
+	help
+	  wolfTPM is a portable, open-source TPM 2.0 stack with
+	  backward API compatibility, designed for embedded use.
+	  No external dependencies, compact code size with low
+	  resource usage.
+
+	  https://www.wolfssl.com/
+
+comment "wolfTPM needs the wolfSSL cryptographic library"
+	depends on !BR2_PACKAGE_WOLFSSL
package/wolftpm/wolftpm.hash new file +2 -0
new file mode 100644
index 0000000000..871e3e2d1d
@@ -0,0 +1,2 @@
+# Hash from https://github.com/wolfSSL/wolfTPM/archive/refs/tags/v2.3.1.tar.gz
+sha256  f0d7c095491ac2cc9e44aa4ac3c22febf15942ef080431d8b43a9d0312ca6567  wolfTPM-2.3.1.tar.gz
package/wolftpm/wolftpm.mk new file +29 -0
new file mode 100644
index 0000000000..33cfdef6af
@@ -0,0 +1,29 @@
+################################################################################
+#
+# wolftpm
+#
+################################################################################
+
+WOLFTPM_VERSION = 2.3.1
+WOLFTPM_SITE = $(call github,wolfSSL,wolfTPM,v$(WOLFTPM_VERSION))
+WOLFTPM_INSTALL_STAGING = YES
+
+WOLFTPM_LICENSE = GPL-2.0+
+WOLFTPM_LICENSE_FILES = LICENSE
+WOLFTPM_CPE_ID_VENDOR = wolfssl
+
+WOLFTPM_DEPENDENCIES = host-pkgconf
+
+# wolfTPM's source code is released without a configure script,
+# therefore we need autoreconf
+WOLFTPM_AUTORECONF = YES
+
+WOLFTPM_CONF_OPTS = --disable-examples --enable-devtpm --with-wolfcrypt=$(TARGET_DIR)/usr/
+
+define WOLFTPM_CONFIG_RPATH
+    touch $(@D)/build-aux/config.rpath
+endef
+# Fix for autoconf bug with config.rconf
+WOLFTPM_PRE_CONFIGURE_HOOKS += WOLFTPM_CONFIG_RPATH
+
+$(eval $(autotools-package))
Signature · 6 lines
2.27.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author
#1 lore raw
Quoted 86 lines · Dimi Tomov

From: Dimitar Tomov <[email protected]>

wolfTPM is an open-source TPM 2.0 stack with backward API compatibility, designed for embedded use. It is highly portable, and has native support for Linux. wolfTPM has a compact code size with low resource usage.

---
 package/Config.in            |  1 +
 package/wolftpm/Config.in    | 14 ++++++++++++++
 package/wolftpm/wolftpm.hash |  2 ++
 package/wolftpm/wolftpm.mk   | 29 +++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+)
 create mode 100644 package/wolftpm/Config.in
 create mode 100644 package/wolftpm/wolftpm.hash
 create mode 100644 package/wolftpm/wolftpm.mk
package/Config.in +1 -0
index 8892134133..2a8bf18699 100644
@@ -1432,6 +1432,7 @@ menu "Crypto"
 	source "package/trousers/Config.in"
 	source "package/ustream-ssl/Config.in"
 	source "package/wolfssl/Config.in"
+	source "package/wolftpm/Config.in"
 endmenu
 
 menu "Database"
package/wolftpm/Config.in new file +14 -0
new file mode 100644
index 0000000000..497f5ae6e9
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_WOLFTPM
+	bool "wolftpm"
+	depends on BR2_PACKAGE_WOLFSSL
+    select BR2_PACKAGE_WOLFSSL_ALL
+	help
+	  wolfTPM is a portable, open-source TPM 2.0 stack with
+	  backward API compatibility, designed for embedded use.
+	  No external dependencies, compact code size with low
+	  resource usage.
+
+	  https://www.wolfssl.com/
+
+comment "wolfTPM needs the wolfSSL cryptographic library"
+	depends on !BR2_PACKAGE_WOLFSSL
package/wolftpm/wolftpm.hash new file +1 -0
new file mode 100644
index 0000000000..871e3e2d1d
@@ -0,0 +1,2 @@
+# Hash from 

https://github.com/wolfSSL/wolfTPM/archive/refs/tags/v2.3.1.tar.gz
+sha256 f0d7c095491ac2cc9e44aa4ac3c22febf15942ef080431d8b43a9d0312ca6567 wolfTPM-2.3.1.tar.gz

package/wolftpm/wolftpm.mk new file +20 -0
new file mode 100644
index 0000000000..33cfdef6af
@@ -0,0 +1,29 @@
+################################################################################
+#
+# wolftpm
+#
+################################################################################
+
+WOLFTPM_VERSION = 2.3.1
+WOLFTPM_SITE = $(call github,wolfSSL,wolfTPM,v$(WOLFTPM_VERSION))
+WOLFTPM_INSTALL_STAGING = YES
+
+WOLFTPM_LICENSE = GPL-2.0+
+WOLFTPM_LICENSE_FILES = LICENSE
+WOLFTPM_CPE_ID_VENDOR = wolfssl
+
+WOLFTPM_DEPENDENCIES = host-pkgconf
+
+# wolfTPM's source code is released without a configure script,
+# therefore we need autoreconf
+WOLFTPM_AUTORECONF = YES
+

package/wolftpm/wolftpm.mk line 29

Quoted 10 lines
package/wolftpm/wolftpm.mk new file +9 -1
+WOLFTPM_CONF_OPTS = --disable-examples --enable-devtpm
--with-wolfcrypt=$(TARGET_DIR)/usr/
+
+define WOLFTPM_CONFIG_RPATH
+    touch $(@D)/build-aux/config.rpath
+endef
+# Fix for autoconf bug with config.rconf
+WOLFTPM_PRE_CONFIGURE_HOOKS += WOLFTPM_CONFIG_RPATH
+
+$(eval $(autotools-package))

Hi Thomas,

Could you please take a look at this contribution?

Regards,

Dimi
--
Founder of TPM.dev
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

author
#2 lore raw

PATCH 1/2 package/wolftpm: new package, wolfTPM library for TPM2.0

In reply to Dimi Tomov

From: Dimitar Tomov <[email protected]>

wolfTPM is an open-source TPM 2.0 stack with backward API compatibility, designed for embedded use. It is highly portable, and has native support for Linux. wolfTPM has a compact code size with low resource usage.

---
 package/Config.in            |  1 +
 package/wolftpm/Config.in    | 14 ++++++++++++++
 package/wolftpm/wolftpm.hash |  2 ++
 package/wolftpm/wolftpm.mk   | 29 +++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+)
 create mode 100644 package/wolftpm/Config.in
 create mode 100644 package/wolftpm/wolftpm.hash
 create mode 100644 package/wolftpm/wolftpm.mk
package/Config.in +1 -0
index 00f061015f..b287c5a94d 100644
@@ -1431,6 +1431,7 @@ menu "Crypto"
 	source "package/trousers/Config.in"
 	source "package/ustream-ssl/Config.in"
 	source "package/wolfssl/Config.in"
+	source "package/wolftpm/Config.in"
 endmenu
 
 menu "Database"
package/wolftpm/Config.in new file +14 -0
new file mode 100644
index 0000000000..497f5ae6e9
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_WOLFTPM
+	bool "wolftpm"
+	depends on BR2_PACKAGE_WOLFSSL
+    select BR2_PACKAGE_WOLFSSL_ALL
+	help
+	  wolfTPM is a portable, open-source TPM 2.0 stack with
+	  backward API compatibility, designed for embedded use.
+	  No external dependencies, compact code size with low
+	  resource usage.
+
+	  https://www.wolfssl.com/
+
+comment "wolfTPM needs the wolfSSL cryptographic library"
+	depends on !BR2_PACKAGE_WOLFSSL
package/wolftpm/wolftpm.hash new file +2 -0
new file mode 100644
index 0000000000..871e3e2d1d
@@ -0,0 +1,2 @@
+# Hash from https://github.com/wolfSSL/wolfTPM/archive/refs/tags/v2.3.1.tar.gz
+sha256  f0d7c095491ac2cc9e44aa4ac3c22febf15942ef080431d8b43a9d0312ca6567  wolfTPM-2.3.1.tar.gz
package/wolftpm/wolftpm.mk new file +29 -0
new file mode 100644
index 0000000000..33cfdef6af
@@ -0,0 +1,29 @@
+################################################################################
+#
+# wolftpm
+#
+################################################################################
+
+WOLFTPM_VERSION = 2.3.1
+WOLFTPM_SITE = $(call github,wolfSSL,wolfTPM,v$(WOLFTPM_VERSION))
+WOLFTPM_INSTALL_STAGING = YES
+
+WOLFTPM_LICENSE = GPL-2.0+
+WOLFTPM_LICENSE_FILES = LICENSE
+WOLFTPM_CPE_ID_VENDOR = wolfssl
+
+WOLFTPM_DEPENDENCIES = host-pkgconf
+
+# wolfTPM's source code is released without a configure script,
+# therefore we need autoreconf
+WOLFTPM_AUTORECONF = YES
+
+WOLFTPM_CONF_OPTS = --disable-examples --enable-devtpm --with-wolfcrypt=$(TARGET_DIR)/usr/
+
+define WOLFTPM_CONFIG_RPATH
+    touch $(@D)/build-aux/config.rpath
+endef
+# Fix for autoconf bug with config.rconf
+WOLFTPM_PRE_CONFIGURE_HOOKS += WOLFTPM_CONFIG_RPATH
+
+$(eval $(autotools-package))
Signature · 6 lines
2.27.0

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

PATCH 2/2 v2: Fix typo in the hash file and create path before using touch

From: Dimitar Tomov <[email protected]>

---
 package/wolftpm/wolftpm.hash | 2 +-
 package/wolftpm/wolftpm.mk   | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
package/wolftpm/wolftpm.hash +1 -1
index 871e3e2d1d..6dbf143ffe 100644
@@ -1,2 +1,2 @@
 # Hash from https://github.com/wolfSSL/wolfTPM/archive/refs/tags/v2.3.1.tar.gz
-sha256  f0d7c095491ac2cc9e44aa4ac3c22febf15942ef080431d8b43a9d0312ca6567  wolfTPM-2.3.1.tar.gz
+sha256  f0d7c095491ac2cc9e44aa4ac3c22febf15942ef080431d8b43a9d0312ca6567  wolftpm-2.3.1.tar.gz
package/wolftpm/wolftpm.mk +1 -0
index 33cfdef6af..8d11fd1299 100644
@@ -21,6 +21,7 @@ WOLFTPM_AUTORECONF = YES
 WOLFTPM_CONF_OPTS = --disable-examples --enable-devtpm --with-wolfcrypt=$(TARGET_DIR)/usr/
 
 define WOLFTPM_CONFIG_RPATH
+    mkdir $(@D)/build-aux
     touch $(@D)/build-aux/config.rpath
 endef
 # Fix for autoconf bug with config.rconf
Signature · 6 lines
2.27.0

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

Re: [Buildroot] [PATCH 2/2] v2: Fix typo in the hash file and create path before using touch

Hello,

Quoted 3 lines · On Mon, 30 May 2022 23:30:01 +0300 Dimi Tomov <[email protected]> wrote:

From: Dimitar Tomov <[email protected]>

This should be squashed into PATCH 1/2. Have a look at "git rebase -i" (named "git interactive rebase") to squash your commits.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw
In reply to Dimi Tomov

Hello,

The commit title should be just:

package/wolftpm: new package

See below for more comments.

Quoted 5 lines · On Mon, 30 May 2022 23:30:00 +0300 Dimi Tomov <[email protected]> wrote:
 package/Config.in            |  1 +
 package/wolftpm/Config.in    | 14 ++++++++++++++
 package/wolftpm/wolftpm.hash |  2 ++
 package/wolftpm/wolftpm.mk   | 29 +++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+)

An entry in the DEVELOPERS file is missing.

package/wolftpm/Config.in line 3

Quoted 9 lines
package/wolftpm/Config.in new file +3 -0
new file mode 100644
index 0000000000..497f5ae6e9
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_WOLFTPM
+	bool "wolftpm"
+	depends on BR2_PACKAGE_WOLFSSL

This should be a "select", and you need to propagate the "depends on BR2_TOOLCHAIN_HAS_THREADS" from wolfssl.

package/wolftpm/Config.in line 4

Quoted 1 line
package/wolftpm/Config.in new file +1 -0
+    select BR2_PACKAGE_WOLFSSL_ALL

Indentation is incorrect here, it should be intended with one tab.

package/wolftpm/Config.in line 14

Quoted 10 lines
package/wolftpm/Config.in new file +10 -0
+	help
+	  wolfTPM is a portable, open-source TPM 2.0 stack with
+	  backward API compatibility, designed for embedded use.
+	  No external dependencies, compact code size with low
+	  resource usage.
+
+	  https://www.wolfssl.com/
+
+comment "wolfTPM needs the wolfSSL cryptographic library"
+	depends on !BR2_PACKAGE_WOLFSSL

Replace this with:

comment "wolftpm needs a toolchain w/ threads"
depends on !BR2_TOOLCHAIN_HAS_THREADS

package/wolftpm/Config.in

Quoted 4 lines
package/wolftpm/Config.in new file +4 -0
+WOLFTPM_VERSION = 2.3.1
+WOLFTPM_SITE = $(call github,wolfSSL,wolfTPM,v$(WOLFTPM_VERSION))
+WOLFTPM_INSTALL_STAGING = YES
+

Empty line not needed.

package/wolftpm/Config.in

Quoted 11 lines
package/wolftpm/Config.in new file +11 -0
+WOLFTPM_LICENSE = GPL-2.0+
+WOLFTPM_LICENSE_FILES = LICENSE
+WOLFTPM_CPE_ID_VENDOR = wolfssl
+
+WOLFTPM_DEPENDENCIES = host-pkgconf
+
+# wolfTPM's source code is released without a configure script,
+# therefore we need autoreconf
+WOLFTPM_AUTORECONF = YES
+
+WOLFTPM_CONF_OPTS = --disable-examples --enable-devtpm --with-wolfcrypt=$(TARGET_DIR)/usr/

This --with-wolfcrypt option value looks suspicious. What is this option meant for?

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author
#6 lore raw

PATCH 1/1 package/wolftpm: new package

In reply to Dimi Tomov

From: Dimitar Tomov <[email protected]>

wolfTPM is an open-source TPM 2.0 stack with backward API compatibility, designed for embedded use. It is highly portable, and has native support for Linux. wolfTPM has a compact code size with low resource usage.

---
Changes v2 -> v3:
- Applied feedback from the maintainer, list of changes below
- Added new entry to the DEVELOPERS file
- Replaced depends with select for BR2_PACKAGE_WOLFSSL
- Added missing depends for BR2_TOOLCHAIN_HAS_THREADS
- Removed redundant --with-wolfcrypt option
Changes v1 -> v2:
- Fix typo in the hash file and create path before using touch

---
 DEVELOPERS                   |  3 +++
 package/Config.in            |  1 +
 package/wolftpm/Config.in    | 15 +++++++++++++++
 package/wolftpm/wolftpm.hash |  2 ++
 package/wolftpm/wolftpm.mk   | 29 +++++++++++++++++++++++++++++
 5 files changed, 50 insertions(+)
 create mode 100644 package/wolftpm/Config.in
 create mode 100644 package/wolftpm/wolftpm.hash
 create mode 100644 package/wolftpm/wolftpm.mk
DEVELOPERS +3 -0
index 71cc3da6d7..c123d1b915 100644
@@ -3072,3 +3072,6 @@ F:	package/quazip/
 F:	package/shapelib/
 F:	package/simple-mail/
 F:	package/tinc/
+
+N:	Dimi Tomov <[email protected]>
+F:	package/wolftpm/
package/Config.in +1 -0
index 00f061015f..b287c5a94d 100644
@@ -1431,6 +1431,7 @@ menu "Crypto"
 	source "package/trousers/Config.in"
 	source "package/ustream-ssl/Config.in"
 	source "package/wolfssl/Config.in"
+	source "package/wolftpm/Config.in"
 endmenu
 
 menu "Database"
package/wolftpm/Config.in new file +15 -0
new file mode 100644
index 0000000000..23932a4170
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_WOLFTPM
+	bool "wolftpm"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	select on BR2_PACKAGE_WOLFSSL
+	select on BR2_PACKAGE_WOLFSSL_ALL
+	help
+	  wolfTPM is a portable, open-source TPM 2.0 stack with
+	  backward API compatibility, designed for embedded use.
+	  No external dependencies, compact code size with low
+	  resource usage.
+
+	  https://www.wolfssl.com/
+
+comment "wolftpm needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/wolftpm/wolftpm.hash new file +2 -0
new file mode 100644
index 0000000000..6dbf143ffe
@@ -0,0 +1,2 @@
+# Hash from https://github.com/wolfSSL/wolfTPM/archive/refs/tags/v2.3.1.tar.gz
+sha256  f0d7c095491ac2cc9e44aa4ac3c22febf15942ef080431d8b43a9d0312ca6567  wolftpm-2.3.1.tar.gz
package/wolftpm/wolftpm.mk new file +29 -0
new file mode 100644
index 0000000000..1e1ddc13e3
@@ -0,0 +1,29 @@
+################################################################################
+#
+# wolftpm
+#
+################################################################################
+
+WOLFTPM_VERSION = 2.3.1
+WOLFTPM_SITE = $(call github,wolfSSL,wolfTPM,v$(WOLFTPM_VERSION))
+WOLFTPM_INSTALL_STAGING = YES
+WOLFTPM_LICENSE = GPL-2.0+
+WOLFTPM_LICENSE_FILES = LICENSE
+WOLFTPM_CPE_ID_VENDOR = wolfssl
+
+WOLFTPM_DEPENDENCIES = host-pkgconf
+
+# wolfTPM's source code is released without a configure script,
+# therefore we need autoreconf
+WOLFTPM_AUTORECONF = YES
+
+WOLFTPM_CONF_OPTS = --disable-examples --enable-devtpm
+
+define WOLFTPM_CONFIG_RPATH
+    mkdir $(@D)/build-aux
+    touch $(@D)/build-aux/config.rpath
+endef
+# Fix for autoconf bug with config.rconf
+WOLFTPM_PRE_CONFIGURE_HOOKS += WOLFTPM_CONFIG_RPATH
+
+$(eval $(autotools-package))
Signature · 6 lines
2.27.0

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

Re: [Buildroot] [PATCH 1/1] package/wolftpm: new package

Hi Thomas,

I have taken all your feedback. Please review v3 of this patch series.

ps: for some reason git send-email has ignored my --subject-prefix="PATCH v3"

Regards,
Dimi

Quoted 117 lines · Dimi Tomov

From: Dimitar Tomov <[email protected]>

wolfTPM is an open-source TPM 2.0 stack with backward API compatibility, designed for embedded use. It is highly portable, and has native support for Linux. wolfTPM has a compact code size with low resource usage.

---
Changes v2 -> v3:
- Applied feedback from the maintainer, list of changes below
- Added new entry to the DEVELOPERS file
- Replaced depends with select for BR2_PACKAGE_WOLFSSL
- Added missing depends for BR2_TOOLCHAIN_HAS_THREADS
- Removed redundant --with-wolfcrypt option
Changes v1 -> v2:
- Fix typo in the hash file and create path before using touch

---
 DEVELOPERS                   |  3 +++
 package/Config.in            |  1 +
 package/wolftpm/Config.in    | 15 +++++++++++++++
 package/wolftpm/wolftpm.hash |  2 ++
 package/wolftpm/wolftpm.mk   | 29 +++++++++++++++++++++++++++++
 5 files changed, 50 insertions(+)
 create mode 100644 package/wolftpm/Config.in
 create mode 100644 package/wolftpm/wolftpm.hash
 create mode 100644 package/wolftpm/wolftpm.mk
DEVELOPERS +3 -0
index 71cc3da6d7..c123d1b915 100644
@@ -3072,3 +3072,6 @@ F:	package/quazip/
 F:	package/shapelib/
 F:	package/simple-mail/
 F:	package/tinc/
+
+N:	Dimi Tomov <[email protected]>
+F:	package/wolftpm/
package/Config.in +1 -0
index 00f061015f..b287c5a94d 100644
@@ -1431,6 +1431,7 @@ menu "Crypto"
 	source "package/trousers/Config.in"
 	source "package/ustream-ssl/Config.in"
 	source "package/wolfssl/Config.in"
+	source "package/wolftpm/Config.in"
 endmenu
 
 menu "Database"
package/wolftpm/Config.in new file +15 -0
new file mode 100644
index 0000000000..23932a4170
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_WOLFTPM
+	bool "wolftpm"
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	select on BR2_PACKAGE_WOLFSSL
+	select on BR2_PACKAGE_WOLFSSL_ALL
+	help
+	  wolfTPM is a portable, open-source TPM 2.0 stack with
+	  backward API compatibility, designed for embedded use.
+	  No external dependencies, compact code size with low
+	  resource usage.
+
+	  https://www.wolfssl.com/
+
+comment "wolftpm needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/wolftpm/wolftpm.hash new file +1 -0
new file mode 100644
index 0000000000..6dbf143ffe
@@ -0,0 +1,2 @@
+# Hash from 

https://github.com/wolfSSL/wolfTPM/archive/refs/tags/v2.3.1.tar.gz
+sha256 f0d7c095491ac2cc9e44aa4ac3c22febf15942ef080431d8b43a9d0312ca6567 wolftpm-2.3.1.tar.gz

package/wolftpm/wolftpm.mk new file +29 -0
new file mode 100644
index 0000000000..1e1ddc13e3
@@ -0,0 +1,29 @@
+################################################################################
+#
+# wolftpm
+#
+################################################################################
+
+WOLFTPM_VERSION = 2.3.1
+WOLFTPM_SITE = $(call github,wolfSSL,wolfTPM,v$(WOLFTPM_VERSION))
+WOLFTPM_INSTALL_STAGING = YES
+WOLFTPM_LICENSE = GPL-2.0+
+WOLFTPM_LICENSE_FILES = LICENSE
+WOLFTPM_CPE_ID_VENDOR = wolfssl
+
+WOLFTPM_DEPENDENCIES = host-pkgconf
+
+# wolfTPM's source code is released without a configure script,
+# therefore we need autoreconf
+WOLFTPM_AUTORECONF = YES
+
+WOLFTPM_CONF_OPTS = --disable-examples --enable-devtpm
+
+define WOLFTPM_CONFIG_RPATH
+    mkdir $(@D)/build-aux
+    touch $(@D)/build-aux/config.rpath
+endef
+# Fix for autoconf bug with config.rconf
+WOLFTPM_PRE_CONFIGURE_HOOKS += WOLFTPM_CONFIG_RPATH
+
+$(eval $(autotools-package))
Signature · 5 lines
Founder of TPM.dev
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

Re: [Buildroot] [PATCH 1/1] package/wolftpm: new package

In reply to Dimi Tomov

Hello Dimitar,

Quoted 7 lines · On Wed, 1 Jun 2022 22:47:46 +0300 Dimi Tomov <[email protected]> wrote:

From: Dimitar Tomov <[email protected]>

wolfTPM is an open-source TPM 2.0 stack with backward API compatibility, designed for embedded use. It is highly portable, and has native support for Linux. wolfTPM has a compact code size with low resource usage.

I've applied to our next branch, but after doing several additional fixes. Also, there is something to be fixed upstream, see below.

DEVELOPERS F: package/quazip/ · line 3077

Quoted 11 lines
DEVELOPERS +3 -0
index 71cc3da6d7..c123d1b915 100644
@@ -3072,3 +3072,6 @@ F:	package/quazip/
 F:	package/shapelib/
 F:	package/simple-mail/
 F:	package/tinc/
+
+N:	Dimi Tomov <[email protected]>
+F:	package/wolftpm/

Entries in this file are alphabetically sorted, so you shouldn't have added yourself at the end, but at the "right" place.

package/wolftpm/Config.in line 3

Quoted 9 lines
package/wolftpm/Config.in new file +3 -0
new file mode 100644
index 0000000000..23932a4170
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_WOLFTPM
+	bool "wolftpm"
+	depends on BR2_TOOLCHAIN_HAS_THREADS

You forgot:

depends on !BR2_STATIC_LIBS

which you need to replicate because you select BR2_PACKAGE_WOLFSSL_ALL.

package/wolftpm/Config.in line 5

Quoted 2 lines
package/wolftpm/Config.in new file +2 -0
+	select on BR2_PACKAGE_WOLFSSL
+	select on BR2_PACKAGE_WOLFSSL_ALL

I'm wondering if you tested this, because "select on" doesn't exist in Kconfig. It's either "select" or "depends on", but not a mix of both.

package/wolftpm/Config.in line 15

Quoted 10 lines
package/wolftpm/Config.in new file +10 -0
+	help
+	  wolfTPM is a portable, open-source TPM 2.0 stack with
+	  backward API compatibility, designed for embedded use.
+	  No external dependencies, compact code size with low
+	  resource usage.
+
+	  https://www.wolfssl.com/
+
+comment "wolftpm needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS

The comment had to be adjusted due to the !BR2_STATIC_LIBS dependency.

package/wolftpm/wolftpm.hash line 2

Quoted 8 lines
package/wolftpm/wolftpm.hash new file +2 -0
new file mode 100644
index 0000000000..6dbf143ffe
@@ -0,0 +1,2 @@
+# Hash from https://github.com/wolfSSL/wolfTPM/archive/refs/tags/v2.3.1.tar.gz
+sha256  f0d7c095491ac2cc9e44aa4ac3c22febf15942ef080431d8b43a9d0312ca6567  wolftpm-2.3.1.tar.gz

Gaah, I'm noticing now that the hash of the LICENSE file is missing, and I didn't realize before applying. I will fix this up.

Quoted 10 lines
package/wolftpm/wolftpm.mk new file +4 -0
new file mode 100644
index 0000000000..1e1ddc13e3
@@ -0,0 +1,29 @@
+################################################################################
+#
+# wolftpm
+#

package/wolftpm/wolftpm.mk line 14

Quoted 10 lines
package/wolftpm/wolftpm.mk new file +10 -0
+################################################################################
+
+WOLFTPM_VERSION = 2.3.1
+WOLFTPM_SITE = $(call github,wolfSSL,wolfTPM,v$(WOLFTPM_VERSION))
+WOLFTPM_INSTALL_STAGING = YES
+WOLFTPM_LICENSE = GPL-2.0+
+WOLFTPM_LICENSE_FILES = LICENSE
+WOLFTPM_CPE_ID_VENDOR = wolfssl
+
+WOLFTPM_DEPENDENCIES = host-pkgconf

I've added:

WOLFTPM_CONFIG_SCRIPTS = wolftpm-config

so that the wolftpm-config script installed in $(STAGING_DIR)/usr/bin returns correct results.

package/wolftpm/wolftpm.mk line 20

Quoted 5 lines
package/wolftpm/wolftpm.mk new file +5 -0
+# wolfTPM's source code is released without a configure script,
+# therefore we need autoreconf
+WOLFTPM_AUTORECONF = YES
+
+WOLFTPM_CONF_OPTS = --disable-examples --enable-devtpm

With just this, the build was failing for me, as wolftpm couldn't find wolfssl. I had to add:

        --with-wolfcrypt=$(STAGING_DIR)/usr

package/wolftpm/wolftpm.mk line 22

Quoted 1 line
package/wolftpm/wolftpm.mk new file +1 -0
+define WOLFTPM_CONFIG_RPATH

I renamed the hook to WOLFTPM_TOUCH_CONFIG_RPATH

package/wolftpm/wolftpm.mk line 23

Quoted 1 line
package/wolftpm/wolftpm.mk new file +1 -0
+    mkdir $(@D)/build-aux

Changed to "mkdir -p" so that the hook can be re-executed without failing.

package/wolftpm/wolftpm.mk line 26

Quoted 3 lines
package/wolftpm/wolftpm.mk new file +3 -0
+    touch $(@D)/build-aux/config.rpath
+endef
+# Fix for autoconf bug with config.rconf

There is no autoreconf bug. The bug is in the code of wolftpm. In the configure.ac script line 165, it uses the AC_LIB_HAVE_LINKFLAGS m4 macro, which comes from gnulib. This macro is documented at, which specifies:

Example of using AC_LIB_LINKFLAGS

Suppose you want to use libz, the compression library.

(1) In configure.ac you add the line

AC_CONFIG_AUX_DIR([build-aux])
AC_LIB_LINKFLAGS([z])

Note that since the AC_LIB_LINKFLAGS invocation modifies the CPPFLAGS, it should precede all tests that check for header files, declarations, structures or types.

(2) To the package’s build-aux directory you add the file config.rpath, also part of the Gnulib havelib module. (gnulib-tool will usually do this for you automatically.)

(3) In Makefile.in you add @LIBZ@ to the link command line of your program. Or, if you are using Automake, you add $(LIBZ) to the LDADD variable that corresponds to your program.

See point (2) ? This is what wasn't done correctly in wolftpm when integrating this gnulib m4 macro.

Ideally this should be fixed in the upstream wolftpm code. However, to be honest, I'm not even sure why your configure.ac file is using AC_LIB_HAVE_LINKFLAGS(). You should probably just migrate to use pkg-config.

Thanks for your contribution!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author
#9 lore raw

Re: [Buildroot] [PATCH 1/1] package/wolftpm: new package

Hello Thomas,

I have this working on a STM32MP157F-DK2 board with a ST33 TPM.

https://gist.github.com/tomoveu/8f0519cb8d75a5374a999f29640cf45c

Could it be that because I am using $make wolftpm-rebuild is saving me from seeing the same errors?

ps: Do I need to submit v4?

Thanks,

Dimi

Quoted 171 lines · Thomas Petazzoni via buildroot

Hello Dimitar,

Quoted 7 lines · On Wed, 1 Jun 2022 22:47:46 +0300 Dimi Tomov <[email protected]> wrote:

From: Dimitar Tomov <[email protected]>

wolfTPM is an open-source TPM 2.0 stack with backward API compatibility, designed for embedded use. It is highly portable, and has native support for Linux. wolfTPM has a compact code size with low resource usage.

I've applied to our next branch, but after doing several additional fixes. Also, there is something to be fixed upstream, see below.

DEVELOPERS F: package/quazip/ · line 3077

Quoted 11 lines
DEVELOPERS +3 -0
index 71cc3da6d7..c123d1b915 100644
@@ -3072,3 +3072,6 @@ F:	package/quazip/
 F:	package/shapelib/
 F:	package/simple-mail/
 F:	package/tinc/
+
+N:	Dimi Tomov <[email protected]>
+F:	package/wolftpm/

Entries in this file are alphabetically sorted, so you shouldn't have added yourself at the end, but at the "right" place.

package/wolftpm/Config.in line 3

Quoted 9 lines
package/wolftpm/Config.in new file +3 -0
new file mode 100644
index 0000000000..23932a4170
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_WOLFTPM
+	bool "wolftpm"
+	depends on BR2_TOOLCHAIN_HAS_THREADS

You forgot:

depends on !BR2_STATIC_LIBS

which you need to replicate because you select BR2_PACKAGE_WOLFSSL_ALL.

package/wolftpm/Config.in line 5

Quoted 2 lines
package/wolftpm/Config.in new file +2 -0
+	select on BR2_PACKAGE_WOLFSSL
+	select on BR2_PACKAGE_WOLFSSL_ALL

I'm wondering if you tested this, because "select on" doesn't exist in Kconfig. It's either "select" or "depends on", but not a mix of both.

package/wolftpm/Config.in line 15

Quoted 10 lines
package/wolftpm/Config.in new file +10 -0
+	help
+	  wolfTPM is a portable, open-source TPM 2.0 stack with
+	  backward API compatibility, designed for embedded use.
+	  No external dependencies, compact code size with low
+	  resource usage.
+
+	  https://www.wolfssl.com/
+
+comment "wolftpm needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS

The comment had to be adjusted due to the !BR2_STATIC_LIBS dependency.

Quoted 10 lines
package/wolftpm/wolftpm.hash new file +1 -0
new file mode 100644
index 0000000000..6dbf143ffe
@@ -0,0 +1,2 @@
+# Hash from 

https://github.com/wolfSSL/wolfTPM/archive/refs/tags/v2.3.1.tar.gz
+sha256
f0d7c095491ac2cc9e44aa4ac3c22febf15942ef080431d8b43a9d0312ca6567 wolftpm-2.3.1.tar.gz

Gaah, I'm noticing now that the hash of the LICENSE file is missing, and I didn't realize before applying. I will fix this up.

Quoted 10 lines
package/wolftpm/wolftpm.mk new file +4 -0
new file mode 100644
index 0000000000..1e1ddc13e3
@@ -0,0 +1,29 @@
+################################################################################
+#
+# wolftpm
+#

package/wolftpm/wolftpm.mk line 14

Quoted 10 lines
package/wolftpm/wolftpm.mk new file +10 -0
+################################################################################
+
+WOLFTPM_VERSION = 2.3.1
+WOLFTPM_SITE = $(call github,wolfSSL,wolfTPM,v$(WOLFTPM_VERSION))
+WOLFTPM_INSTALL_STAGING = YES
+WOLFTPM_LICENSE = GPL-2.0+
+WOLFTPM_LICENSE_FILES = LICENSE
+WOLFTPM_CPE_ID_VENDOR = wolfssl
+
+WOLFTPM_DEPENDENCIES = host-pkgconf

I've added:

WOLFTPM_CONFIG_SCRIPTS = wolftpm-config

so that the wolftpm-config script installed in $(STAGING_DIR)/usr/bin returns correct results.

package/wolftpm/wolftpm.mk line 20

Quoted 5 lines
package/wolftpm/wolftpm.mk new file +5 -0
+# wolfTPM's source code is released without a configure script,
+# therefore we need autoreconf
+WOLFTPM_AUTORECONF = YES
+
+WOLFTPM_CONF_OPTS = --disable-examples --enable-devtpm

With just this, the build was failing for me, as wolftpm couldn't find wolfssl. I had to add:

        --with-wolfcrypt=$(STAGING_DIR)/usr

package/wolftpm/wolftpm.mk line 22

Quoted 1 line
package/wolftpm/wolftpm.mk new file +1 -0
+define WOLFTPM_CONFIG_RPATH

I renamed the hook to WOLFTPM_TOUCH_CONFIG_RPATH

package/wolftpm/wolftpm.mk line 23

Quoted 1 line
package/wolftpm/wolftpm.mk new file +1 -0
+    mkdir $(@D)/build-aux

Changed to "mkdir -p" so that the hook can be re-executed without failing.

package/wolftpm/wolftpm.mk line 26

Quoted 3 lines
package/wolftpm/wolftpm.mk new file +3 -0
+    touch $(@D)/build-aux/config.rpath
+endef
+# Fix for autoconf bug with config.rconf

There is no autoreconf bug. The bug is in the code of wolftpm. In the configure.ac script line 165, it uses the AC_LIB_HAVE_LINKFLAGS m4 macro, which comes from gnulib. This macro is documented at, which specifies:

Example of using AC_LIB_LINKFLAGS

Suppose you want to use libz, the compression library.

(1) In configure.ac you add the line

AC_CONFIG_AUX_DIR([build-aux])
AC_LIB_LINKFLAGS([z])

Note that since the AC_LIB_LINKFLAGS invocation modifies the CPPFLAGS, it should precede all tests that check for header files, declarations, structures or types.

(2) To the package’s build-aux directory you add the file config.rpath, also part of the Gnulib havelib module. (gnulib-tool will usually do this for you automatically.)

(3) In Makefile.in you add @LIBZ@ to the link command line of your program. Or, if you are using Automake, you add $(LIBZ) to the LDADD variable that corresponds to your program.

See point (2) ? This is what wasn't done correctly in wolftpm when integrating this gnulib m4 macro.

Ideally this should be fixed in the upstream wolftpm code. However, to be honest, I'm not even sure why your configure.ac file is using AC_LIB_HAVE_LINKFLAGS(). You should probably just migrate to use pkg-config.

Thanks for your contribution!

Thomas

Signature · 5 lines
Founder of TPM.dev
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw

Re: [Buildroot] [PATCH 1/1] package/wolftpm: new package

Hello,

Quoted 8 lines · On Thu, 02 Jun 2022 00:03:39 +0300 Dimi Tomov <[email protected]> wrote:

Hello Thomas,

I have this working on a STM32MP157F-DK2 board with a ST33 TPM.

https://gist.github.com/tomoveu/8f0519cb8d75a5374a999f29640cf45c

Could it be that because I am using $make wolftpm-rebuild is saving me from seeing the same errors?

I am not sure why you don't have the error about wolfssl being unavailable. It was clearly failing to build here. I would need access to your complete build log + output/build/wolftpm-<version>/config.log to be able to (perhaps) say what's going on.

Quoted 1 line

ps: Do I need to submit v4?

No, I said the patch was applied. It's in our next branch, see:

https://git.buildroot.org/buildroot/commit/?h=next&id=4bb884a3c61c6b71e33f69453a90eb2a367f64b7

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
author
#11 lore raw

Re: [Buildroot] [PATCH 1/1] package/wolftpm: new package

Thank you Thomas. This is awesome.

Only FYI - I had no issues with wolfssl building from latest buildroot master. My only issue was with the config.rpath autoconf file while building wolftpm.

Best Regards,
Dimi

Quoted 29 lines · Thomas Petazzoni via buildroot

Hello,

Quoted 8 lines · On Thu, 02 Jun 2022 00:03:39 +0300 Dimi Tomov <[email protected]> wrote:

Hello Thomas,

I have this working on a STM32MP157F-DK2 board with a ST33 TPM.

https://gist.github.com/tomoveu/8f0519cb8d75a5374a999f29640cf45c

Could it be that because I am using $make wolftpm-rebuild is saving me from seeing the same errors?

I am not sure why you don't have the error about wolfssl being unavailable. It was clearly failing to build here. I would need access to your complete build log + output/build/wolftpm-<version>/config.log to be able to (perhaps) say what's going on.

Quoted 1 line

ps: Do I need to submit v4?

No, I said the patch was applied. It's in our next branch, see:

https://git.buildroot.org/buildroot/commit/?h=next&id=4bb884a3c61c6b71e33f69453a90eb2a367f64b7

Thanks!

Thomas

Signature · 5 lines
Founder of TPM.dev
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot