[2/3] libtpms: New package

Message ID 20250708150509.8131-2-daniel.weismueller@ipfire.org
State Staged
Commit 63dbb72ac40954d50946c30fea123c8c66b47215
Headers
Series [1/3] json-glib: New package |

Commit Message

Daniel Weismüller July 8, 2025, 3:04 p.m. UTC
  This package is required for libvirt to emulate TPM devices.

Signed-off-by: Daniel Weismüller <daniel.weismueller@ipfire.org>
---
 config/rootfiles/packages/libtpms | 41 ++++++++++++++
 lfs/libtpms                       | 91 +++++++++++++++++++++++++++++++
 make.sh                           |  1 +
 3 files changed, 133 insertions(+)
 create mode 100644 config/rootfiles/packages/libtpms
 create mode 100644 lfs/libtpms
  

Patch

diff --git a/config/rootfiles/packages/libtpms b/config/rootfiles/packages/libtpms
new file mode 100644
index 000000000..6fce3ebd8
--- /dev/null
+++ b/config/rootfiles/packages/libtpms
@@ -0,0 +1,41 @@ 
+#usr/include/libtpms
+#usr/include/libtpms/tpm_error.h
+#usr/include/libtpms/tpm_library.h
+#usr/include/libtpms/tpm_memory.h
+#usr/include/libtpms/tpm_nvfilename.h
+#usr/include/libtpms/tpm_tis.h
+#usr/include/libtpms/tpm_types.h
+#usr/lib/libtpms.a
+#usr/lib/libtpms.la
+#usr/lib/libtpms.so
+usr/lib/libtpms.so.0
+usr/lib/libtpms.so.0.10.1
+#usr/lib/pkgconfig/libtpms.pc
+#usr/share/man/man3/TPMLIB_CancelCommand.3
+#usr/share/man/man3/TPMLIB_ChooseTPMVersion.3
+#usr/share/man/man3/TPMLIB_DecodeBlob.3
+#usr/share/man/man3/TPMLIB_GetInfo.3
+#usr/share/man/man3/TPMLIB_GetState.3
+#usr/share/man/man3/TPMLIB_GetTPMProperty.3
+#usr/share/man/man3/TPMLIB_GetVersion.3
+#usr/share/man/man3/TPMLIB_MainInit.3
+#usr/share/man/man3/TPMLIB_Process.3
+#usr/share/man/man3/TPMLIB_RegisterCallbacks.3
+#usr/share/man/man3/TPMLIB_SetBufferSize.3
+#usr/share/man/man3/TPMLIB_SetDebugFD.3
+#usr/share/man/man3/TPMLIB_SetDebugLevel.3
+#usr/share/man/man3/TPMLIB_SetDebugPrefix.3
+#usr/share/man/man3/TPMLIB_SetProfile.3
+#usr/share/man/man3/TPMLIB_SetState.3
+#usr/share/man/man3/TPMLIB_Terminate.3
+#usr/share/man/man3/TPMLIB_ValidateState.3
+#usr/share/man/man3/TPMLIB_VolatileAll_Store.3
+#usr/share/man/man3/TPMLIB_WasManufactured.3
+#usr/share/man/man3/TPM_Free.3
+#usr/share/man/man3/TPM_IO_Hash_Data.3
+#usr/share/man/man3/TPM_IO_Hash_End.3
+#usr/share/man/man3/TPM_IO_Hash_Start.3
+#usr/share/man/man3/TPM_IO_TpmEstablished_Get.3
+#usr/share/man/man3/TPM_IO_TpmEstablished_Reset.3
+#usr/share/man/man3/TPM_Malloc.3
+#usr/share/man/man3/TPM_Realloc.3
diff --git a/lfs/libtpms b/lfs/libtpms
new file mode 100644
index 000000000..1f87a236c
--- /dev/null
+++ b/lfs/libtpms
@@ -0,0 +1,91 @@ 
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007-2025  IPFire Team  <info@ipfire.org>                     #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+SUMMARY	   = This library provides software emulation of a Trusted Platform Module (TPM 1.2 and TPM 2.0).
+
+VER        = 0.10.1
+
+THISAPP    = libtpms-$(VER)
+DL_FILE    = $(THISAPP).tar.gz
+DL_FROM    = $(URL_IPFIRE)
+DIR_APP    = $(DIR_SRC)/$(THISAPP)
+TARGET     = $(DIR_INFO)/$(THISAPP)
+PROG       = libtpms
+PAK_VER    = 1
+
+DEPS       =
+
+SERVICES   =
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE)
+
+$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
+
+$(DL_FILE)_BLAKE2 = 39feead951a84b715e8e4db8cd6eab7f19728c00423df16150c99004230061691cde90fcf7aafc6a5748647ac58cb696b89a709368da4b8f0c684b22321ff1ea
+
+install : $(TARGET)
+
+check : $(patsubst %,$(DIR_CHK)/%,$(objects))
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+b2 : $(subst %,%_BLAKE2,$(objects))
+
+###############################################################################
+# Downloading, checking, b2sum
+###############################################################################
+
+$(patsubst %,$(DIR_CHK)/%,$(objects)) :
+	@$(CHECK)
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+	@$(LOAD)
+
+$(subst %,%_BLAKE2,$(objects)) :
+	@$(B2SUM)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+	@$(PREBUILD)
+	@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
+	-mkdir -pv $(DIR_APP)
+	cd $(DIR_APP) && autoreconf -vfi
+	cd $(DIR_APP) && ./configure \
+		--prefix=/usr \
+		--with-tpm2 \
+		--with-openssl \
+		--disable-hardening
+	cd $(DIR_APP) && make $(MAKETUNING)
+	cd $(DIR_APP) && make install
+	@rm -rf $(DIR_APP)
+	@$(POSTBUILD)
diff --git a/make.sh b/make.sh
index 3412c8f5a..384c09407 100755
--- a/make.sh
+++ b/make.sh
@@ -2032,6 +2032,7 @@  build_system() {
 	lfsmake2 frr
 	lfsmake2 dmidecode
 	lfsmake2 mcelog
+	lfsmake2 libtpms
 	lfsmake2 libpciaccess
 	lfsmake2 ovmf
 	lfsmake2 libvirt