add support for TCM devices

This commit is contained in:
chench00 2024-08-07 20:55:42 +08:00
parent a8992d6844
commit d600dfac77
2 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From a12832040ba73e44e0b04a662df05eedbe3614fd Mon Sep 17 00:00:00 2001
From: chench00 <chench@hygon.cn>
Date: Wed, 27 Mar 2024 15:56:35 +0800
Subject: [PATCH] [newfeature][all] Add support for TCM devices
---
dist/tpm2-abrmd.service.in | 5 +++--
src/tabrmd-defaults.h | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dist/tpm2-abrmd.service.in b/dist/tpm2-abrmd.service.in
index b0b562c..0effaa9 100644
--- a/dist/tpm2-abrmd.service.in
+++ b/dist/tpm2-abrmd.service.in
@@ -2,8 +2,9 @@
Description=TPM2 Access Broker and Resource Management Daemon
# These settings are needed when using the device TCTI. If the
# TCP mssim is used then the settings should be commented out.
-After=dev-tpm0.device
-Requires=dev-tpm0.device
+After=dev-tpm0.device dev-tcm0.device
+ConditionPathExists=|/dev/tpm0
+ConditionPathExists=|/dev/tcm0
[Service]
Type=dbus
diff --git a/src/tabrmd-defaults.h b/src/tabrmd-defaults.h
index 7387a47..0396189 100644
--- a/src/tabrmd-defaults.h
+++ b/src/tabrmd-defaults.h
@@ -16,7 +16,7 @@
#define TABRMD_ENTROPY_SRC_DEFAULT "/dev/urandom"
#define TABRMD_SESSIONS_MAX_DEFAULT 4
#define TABRMD_SESSIONS_MAX 64
-#define TABRMD_TCTI_CONF_DEFAULT "device:/dev/tpm0"
+#define TABRMD_TCTI_CONF_DEFAULT ((!access("/dev/tcm0", F_OK)) ? ("device:/dev/tcm0") : ("device:/dev/tpm0"))
#define TABRMD_TRANSIENT_MAX_DEFAULT 27
#define TABRMD_TRANSIENT_MAX 100
--
2.25.1

View File

@ -2,12 +2,14 @@
Name: tpm2-abrmd Name: tpm2-abrmd
Version: 3.0.0 Version: 3.0.0
Release: 2 Release: 3
Summary: A system daemon implementing the TPM2 access broker (TAB) & Resource Manager (RM) spec from the TCG Summary: A system daemon implementing the TPM2 access broker (TAB) & Resource Manager (RM) spec from the TCG
License: BSD License: BSD
URL: https://github.com/tpm2-software/tpm2-abrmd URL: https://github.com/tpm2-software/tpm2-abrmd
Source0: https://github.com/tpm2-software/tpm2-abrmd/releases/download/%{version}/%{name}-%{version}.tar.gz Source0: https://github.com/tpm2-software/tpm2-abrmd/releases/download/%{version}/%{name}-%{version}.tar.gz
Patch3001: Hygon-Add-support-for-TCM-devices.patch
BuildRequires: systemd pkgconfig(cmocka) pkgconfig(dbus-1) pkgconfig(gio-unix-2.0) pkgconfig(tss2-mu) pkgconfig(tss2-sys) BuildRequires: systemd pkgconfig(cmocka) pkgconfig(dbus-1) pkgconfig(gio-unix-2.0) pkgconfig(tss2-mu) pkgconfig(tss2-sys)
BuildRequires: tpm2-tss-devel >= 2.4.0 libtool autoconf-archive libgcrypt libgcrypt-devel BuildRequires: tpm2-tss-devel >= 2.4.0 libtool autoconf-archive libgcrypt libgcrypt-devel
BuildRequires: chrpath BuildRequires: chrpath
@ -136,6 +138,12 @@ fi
%{_datadir}/selinux/packages/tabrmd.pp.bz2 %{_datadir}/selinux/packages/tabrmd.pp.bz2
%changelog %changelog
* Tue Sep 10 2024 chench <chench@hygon.cn> - 3.0.0-3
- Type:enhancement
- ID:NA
- SUG:NA
- DESC: add support for TCM devices
* Wed Apr 10 2024 wangxiaomeng <wangxiaomeng@kylinos.cn> - 3.0.0-2 * Wed Apr 10 2024 wangxiaomeng <wangxiaomeng@kylinos.cn> - 3.0.0-2
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA