tpm2-abrmd/Hygon-Add-support-for-TCM-devices.patch

43 lines
1.4 KiB
Diff
Raw Normal View History

2024-08-07 20:55:42 +08:00
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