From 4bb884a3c61c6b71e33f69453a90eb2a367f64b7 Mon Sep 17 00:00:00 2001 From: Dimitar Tomov Date: Wed, 1 Jun 2022 22:47:46 +0300 Subject: [PATCH] package/wolftpm: new package 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. Signed-off-by: Dimitar Tomov [Thomas: - Fix ordering in the DEVELOPERS file, use full name - Add missing !BR2_STATIC_LIBS dependency - Use "select" and not "select on" - Make sure wolftpm-config script gets post-processed by using _CONFIG_SCRIPTS - Add missing --with-wolfcrypt option. - Rename WOLFTPM_CONFIG_RPATH to WOLFTPM_TOUCH_CONFIG_RPATH and use mkdir -p to make the hook re-executable] Signed-off-by: Thomas Petazzoni --- DEVELOPERS | 3 +++ package/Config.in | 1 + package/wolftpm/Config.in | 16 ++++++++++++++++ package/wolftpm/wolftpm.hash | 2 ++ package/wolftpm/wolftpm.mk | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+) create mode 100644 package/wolftpm/Config.in create mode 100644 package/wolftpm/wolftpm.hash create mode 100644 package/wolftpm/wolftpm.mk diff --git a/DEVELOPERS b/DEVELOPERS index fe840f33f5..7bc0e0632c 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -729,6 +729,9 @@ F: package/s6/ F: package/skalibs/ F: support/testing/tests/boot/test_edk2.py +N: Dimitar Tomov +F: package/wolftpm/ + N: Dimitrios Siganos F: package/wireless-regdb/ diff --git a/package/Config.in b/package/Config.in index 4ab61713e0..8f1a7d4e9f 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1433,6 +1433,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" diff --git a/package/wolftpm/Config.in b/package/wolftpm/Config.in new file mode 100644 index 0000000000..0fe094f277 --- /dev/null +++ b/package/wolftpm/Config.in @@ -0,0 +1,16 @@ +config BR2_PACKAGE_WOLFTPM + bool "wolftpm" + depends on BR2_TOOLCHAIN_HAS_THREADS + depends on !BR2_STATIC_LIBS + select 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 a toolchain w/ threads, dynamic library" + depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS diff --git a/package/wolftpm/wolftpm.hash b/package/wolftpm/wolftpm.hash new file mode 100644 index 0000000000..6dbf143ffe --- /dev/null +++ b/package/wolftpm/wolftpm.hash @@ -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 diff --git a/package/wolftpm/wolftpm.mk b/package/wolftpm/wolftpm.mk new file mode 100644 index 0000000000..ea01eaad6b --- /dev/null +++ b/package/wolftpm/wolftpm.mk @@ -0,0 +1,32 @@ +################################################################################ +# +# 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_CONFIG_SCRIPTS = wolftpm-config + +# 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=$(STAGING_DIR)/usr + +# Fix for missing config.rpath in the codebase +define WOLFTPM_TOUCH_CONFIG_RPATH + mkdir -p $(@D)/build-aux + touch $(@D)/build-aux/config.rpath +endef +WOLFTPM_PRE_CONFIGURE_HOOKS += WOLFTPM_TOUCH_CONFIG_RPATH + +$(eval $(autotools-package))