tpm2-abrmd: update to the latest and code style fixup

Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
This commit is contained in:
Lans Zhang
2017-07-20 16:10:13 +08:00
parent c53a21104b
commit 17376a2062
2 changed files with 39 additions and 326 deletions

View File

@@ -1,293 +0,0 @@
From 034e9cd7e539e1feda2fbe9a3646e28156856594 Mon Sep 17 00:00:00 2001
From: Lans Zhang <jia.zhang@windriver.com>
Date: Thu, 15 Jun 2017 10:21:02 +0800
Subject: [PATCH] Fix build failure when searching tabrmd.h
Signed-off-by: Lans Zhang <jia.zhang@windriver.com>
---
Makefile.am | 2 +-
src/access-broker.c | 2 +-
src/include/tabrmd.h | 56 ---------------------------
src/include/tcti-tabrmd.h | 2 +-
src/include/tss2/tabrmd.h | 56 +++++++++++++++++++++++++++
src/resource-manager.c | 2 +-
src/tabrmd-error.c | 2 +-
src/tabrmd.c | 2 +-
src/tcti-tabrmd.c | 2 +-
test/integration/hash-sequence.int.c | 2 +-
test/integration/password-authorization.int.c | 2 +-
test/integration/tcti-cancel.int.c | 2 +-
test/integration/tcti-set-locality.int.c | 2 +-
13 files changed, 67 insertions(+), 67 deletions(-)
delete mode 100644 src/include/tabrmd.h
create mode 100644 src/include/tss2/tabrmd.h
diff --git a/Makefile.am b/Makefile.am
index 5f88429..4733d4f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -90,7 +90,7 @@ install-data-hook:
$(DESTDIR)$(mandir)/man3/tss2_tcti_tabrmd_init_full.3
tpm2_abrmddir = $(includedir)/tss2
-tpm2_abrmd_HEADERS = $(srcdir)/src/include/tabrmd.h
+tpm2_abrmd_HEADERS = $(srcdir)/src/include/tss2/tabrmd.h
libtcti_tabrmddir = $(includedir)/tcti
libtcti_tabrmd_HEADERS = $(srcdir)/src/include/tcti-tabrmd.h
diff --git a/src/access-broker.c b/src/access-broker.c
index d21113d..f357101 100644
--- a/src/access-broker.c
+++ b/src/access-broker.c
@@ -28,7 +28,7 @@
#include <inttypes.h>
#include <stdbool.h>
-#include "tabrmd.h"
+#include <tss2/tabrmd.h>
#include "access-broker.h"
#include "tcti.h"
diff --git a/src/include/tabrmd.h b/src/include/tabrmd.h
deleted file mode 100644
index 42d41a2..0000000
--- a/src/include/tabrmd.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2017, Intel Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef TSS2_TABD_H
-#define TSS2_TABD_H
-
-#include <gio/gio.h>
-#include <tpm20.h>
-
-#define TABRMD_DBUS_INTERFACE "com.intel.tss2.TctiTabrmd"
-#define TABRMD_DBUS_NAME_DEFAULT "com.intel.tss2.Tabrmd"
-#define TABRMD_DBUS_PATH "/com/intel/tss2/Tabrmd/Tcti"
-#define TABRMD_DBUS_METHOD_CREATE_CONNECTION "CreateConnection"
-#define TABRMD_DBUS_METHOD_CANCEL "Cancel"
-#define TABRMD_DBUS_TYPE_DEFAULT G_BUS_TYPE_SYSTEM
-
-/* implementation specific RCs */
-#define TSS2_RESMGR_RC_INTERNAL_ERROR (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | (1 << TSS2_LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT))
-#define TSS2_RESMGR_RC_SAPI_INIT (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | (2 << TSS2_LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT))
-#define TSS2_RESMGR_RC_OUT_OF_MEMORY (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | (3 << TSS2_LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT))
-/* RCs in the RESMGR layer */
-#define TSS2_RESMGR_RC_BAD_VALUE (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_BAD_VALUE)
-#define TSS2_RESMGR_RC_NOT_PERMITTED (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_NOT_PERMITTED)
-#define TSS2_RESMGR_RC_NOT_IMPLEMENTED (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_NOT_IMPLEMENTED)
-#define TSS2_RESMGR_RC_GENERAL_FAILURE (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_GENERAL_FAILURE)
-#define TSS2_RESMGR_RC_OBJECT_MEMORY (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TPM_RC_OBJECT_MEMORY)
-
-#define TABRMD_ERROR tabrmd_error_quark ()
-GQuark tabrmd_error_quark (void);
-
-TSS2_RC tss2_tcti_tabrmd_dump_trans_state (TSS2_TCTI_CONTEXT *tcti_context);
-
-#endif /* TSS2_TABD_H */
diff --git a/src/include/tcti-tabrmd.h b/src/include/tcti-tabrmd.h
index c145eb5..e8e0c7f 100644
--- a/src/include/tcti-tabrmd.h
+++ b/src/include/tcti-tabrmd.h
@@ -35,7 +35,7 @@ extern "C" {
#include <sapi/tpm20.h>
#include <sapi/tss2_tcti.h>
-#include "tabrmd.h"
+#include <tss2/tabrmd.h>
#define TCTI_TABRMD_DBUS_TYPE_DEFAULT TABRMD_DBUS_TYPE_DEFAULT
#define TCTI_TABRMD_DBUS_NAME_DEFAULT TABRMD_DBUS_NAME_DEFAULT
diff --git a/src/include/tss2/tabrmd.h b/src/include/tss2/tabrmd.h
new file mode 100644
index 0000000..42d41a2
--- /dev/null
+++ b/src/include/tss2/tabrmd.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef TSS2_TABD_H
+#define TSS2_TABD_H
+
+#include <gio/gio.h>
+#include <tpm20.h>
+
+#define TABRMD_DBUS_INTERFACE "com.intel.tss2.TctiTabrmd"
+#define TABRMD_DBUS_NAME_DEFAULT "com.intel.tss2.Tabrmd"
+#define TABRMD_DBUS_PATH "/com/intel/tss2/Tabrmd/Tcti"
+#define TABRMD_DBUS_METHOD_CREATE_CONNECTION "CreateConnection"
+#define TABRMD_DBUS_METHOD_CANCEL "Cancel"
+#define TABRMD_DBUS_TYPE_DEFAULT G_BUS_TYPE_SYSTEM
+
+/* implementation specific RCs */
+#define TSS2_RESMGR_RC_INTERNAL_ERROR (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | (1 << TSS2_LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT))
+#define TSS2_RESMGR_RC_SAPI_INIT (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | (2 << TSS2_LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT))
+#define TSS2_RESMGR_RC_OUT_OF_MEMORY (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | (3 << TSS2_LEVEL_IMPLEMENTATION_SPECIFIC_SHIFT))
+/* RCs in the RESMGR layer */
+#define TSS2_RESMGR_RC_BAD_VALUE (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_BAD_VALUE)
+#define TSS2_RESMGR_RC_NOT_PERMITTED (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_NOT_PERMITTED)
+#define TSS2_RESMGR_RC_NOT_IMPLEMENTED (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_NOT_IMPLEMENTED)
+#define TSS2_RESMGR_RC_GENERAL_FAILURE (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TSS2_BASE_RC_GENERAL_FAILURE)
+#define TSS2_RESMGR_RC_OBJECT_MEMORY (TSS2_RC)(TSS2_RESMGR_ERROR_LEVEL | TPM_RC_OBJECT_MEMORY)
+
+#define TABRMD_ERROR tabrmd_error_quark ()
+GQuark tabrmd_error_quark (void);
+
+TSS2_RC tss2_tcti_tabrmd_dump_trans_state (TSS2_TCTI_CONTEXT *tcti_context);
+
+#endif /* TSS2_TABD_H */
diff --git a/src/resource-manager.c b/src/resource-manager.c
index 6efdd82..8ad4e46 100644
--- a/src/resource-manager.c
+++ b/src/resource-manager.c
@@ -35,7 +35,7 @@
#include "resource-manager.h"
#include "sink-interface.h"
#include "source-interface.h"
-#include "tabrmd.h"
+#include <tss2/tabrmd.h>
#include "tpm2-header.h"
#include "tpm2-command.h"
#include "tpm2-response.h"
diff --git a/src/tabrmd-error.c b/src/tabrmd-error.c
index 5ff5a7d..41a561d 100644
--- a/src/tabrmd-error.c
+++ b/src/tabrmd-error.c
@@ -1,6 +1,6 @@
#include <gio/gio.h>
#include <glib.h>
-#include "tabrmd.h"
+#include <tss2/tabrmd.h>
static const GDBusErrorEntry tabrmd_error_entries[] = {
{
diff --git a/src/tabrmd.c b/src/tabrmd.c
index 2275aa5..7156cdf 100644
--- a/src/tabrmd.c
+++ b/src/tabrmd.c
@@ -34,7 +34,7 @@
#include <unistd.h>
#include <sapi/tpm20.h>
-#include "tabrmd.h"
+#include <tss2/tabrmd.h>
#include "access-broker.h"
#include "connection.h"
#include "connection-manager.h"
diff --git a/src/tcti-tabrmd.c b/src/tcti-tabrmd.c
index d6d78ea..52418de 100644
--- a/src/tcti-tabrmd.c
+++ b/src/tcti-tabrmd.c
@@ -35,7 +35,7 @@
#include <sapi/tpm20.h>
-#include "tabrmd.h"
+#include <tss2/tabrmd.h>
#include "tcti-tabrmd.h"
#include "tcti-tabrmd-priv.h"
#include "tpm2-header.h"
diff --git a/test/integration/hash-sequence.int.c b/test/integration/hash-sequence.int.c
index cf8331d..fd489f9 100644
--- a/test/integration/hash-sequence.int.c
+++ b/test/integration/hash-sequence.int.c
@@ -34,7 +34,7 @@
#include <sapi/tpm20.h>
-#include "tabrmd.h"
+#include <tss2/tabrmd.h>
#include "tcti-tabrmd.h"
#include "common.h"
diff --git a/test/integration/password-authorization.int.c b/test/integration/password-authorization.int.c
index e6298ef..5416eaa 100644
--- a/test/integration/password-authorization.int.c
+++ b/test/integration/password-authorization.int.c
@@ -32,7 +32,7 @@
#include <glib.h>
#include <inttypes.h>
-#include "tabrmd.h"
+#include <tss2/tabrmd.h>
#include "tcti-tabrmd.h"
#include "common.h"
diff --git a/test/integration/tcti-cancel.int.c b/test/integration/tcti-cancel.int.c
index 31f0f9a..c2a808b 100644
--- a/test/integration/tcti-cancel.int.c
+++ b/test/integration/tcti-cancel.int.c
@@ -27,7 +27,7 @@
#include <glib.h>
#include <inttypes.h>
-#include "tabrmd.h"
+#include <tss2/tabrmd.h>
#include "tcti-tabrmd.h"
#include "common.h"
diff --git a/test/integration/tcti-set-locality.int.c b/test/integration/tcti-set-locality.int.c
index 6b7509b..0a54b6a 100644
--- a/test/integration/tcti-set-locality.int.c
+++ b/test/integration/tcti-set-locality.int.c
@@ -27,7 +27,7 @@
#include <glib.h>
#include <inttypes.h>
-#include "tabrmd.h"
+#include <tss2/tabrmd.h>
#include "tcti-tabrmd.h"
#include "common.h"
--
2.7.5

View File

@@ -1,26 +1,26 @@
SUMMARY = ""
DESCRIPTION = ""
SECTION = "tpm"
SUMMARY = "TPM2 Access Broker & Resource Manager"
DESCRIPTION = "This is a system daemon implementing the TPM2 access \
broker (TAB) & Resource Manager (RM) spec from the TCG. The daemon (tpm2-abrmd) \
is implemented using Glib and the GObject system. In this documentation and \
in the code we use `tpm2-abrmd` and `tabrmd` interchangeably. \
"
SECTION = "security/tpm"
# This is a lie. The source for this project is covered by several licenses.
# We're currently working on a way to make this clear for those consuming the
# project. Till then I'm using 'BSD' as a place holder since the Intel license
# is "BSD-like".
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD;md5=3775480a712fc46a69647678acb234cb"
LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=500b2e742befc3da00684d8a1d5fd9da"
DEPENDS += "autoconf-archive dbus glib-2.0 pkgconfig tpm2.0-tss glib-2.0-native"
RDEPENDS_${PN} += "libgcc dbus-glib"
SRC_URI = " \
git://github.com/01org/tpm2-abrmd.git;branch=master;name=tpm2-abrmd;destsuffix=tpm2-abrmd \
file://tpm2-abrmd-init.sh \
file://tpm2-abrmd.default \
"
PV = "1.1.0+git${SRCPV}"
SRCREV = "4f0bd204d07176084b245d005df665fbfdf68db5"
PV = "1.0.0+git${SRCPV}"
S = "${WORKDIR}/${BPN}"
SRC_URI = "\
git://github.com/01org/tpm2-abrmd.git \
file://tpm2-abrmd-init.sh \
file://tpm2-abrmd.default \
"
SRCREV = "1003fcfaad39f5c27f75deb678f4fba253f38a82"
S = "${WORKDIR}/git"
inherit autotools pkgconfig systemd update-rc.d useradd
@@ -28,34 +28,40 @@ SYSTEMD_PACKAGES += "${PN}"
SYSTEMD_SERVICE_${PN} = "tpm2-abrmd.service"
SYSTEMD_AUTO_ENABLE_${PN} = "enable"
INITSCRIPT_NAME = "tpm2-abrmd"
INITSCRIPT_NAME = "${PN}"
INITSCRIPT_PARAMS = "start 99 2 3 4 5 . stop 19 0 1 6 ."
USERADD_PACKAGES = "${PN}"
GROUPADD_PARAM_${PN} = "tss"
USERADD_PARAM_${PN} = "-M -d /var/lib/tpm -s /bin/false -g tss tss"
USERADD_PARAM_${PN} = "--system -M -d /var/lib/tpm -s /bin/false -g tss tss"
# break out tcti into a package: libtcti-tabrmd
# package up the service file
EXTRA_OECONF += " \
--with-systemdsystemunitdir=${systemd_system_unitdir} \
--with-udevrulesdir=${sysconfdir}/udev/rules.d \
"
EXTRA_OECONF += "\
--with-systemdsystemunitdir=${systemd_system_unitdir} \
--with-udevrulesdir=${sysconfdir}/udev/rules.d \
"
do_configure_prepend() {
# execute the bootstrap script
currentdir=$(pwd)
cd "${S}"
ACLOCAL="aclocal --system-acdir=${STAGING_DATADIR}/aclocal" ./bootstrap --force
cd "${currentdir}"
# execute the bootstrap script
currentdir=$(pwd)
cd "${S}"
ACLOCAL="aclocal --system-acdir=${STAGING_DATADIR}/aclocal" \
./bootstrap --force
cd "${currentdir}"
}
do_install_append() {
install -d "${D}${sysconfdir}/init.d"
install -m 0755 "${WORKDIR}/tpm2-abrmd-init.sh" "${D}${sysconfdir}/init.d/tpm2-abrmd"
install -d "${D}${sysconfdir}/default"
install -m 0644 "${WORKDIR}/tpm2-abrmd.default" "${D}${sysconfdir}/default/tpm2-abrmd"
install -d "${D}${sysconfdir}/init.d"
install -m 0755 "${WORKDIR}/tpm2-abrmd-init.sh" "${D}${sysconfdir}/init.d/tpm2-abrmd"
install -d "${D}${sysconfdir}/default"
install -m 0644 "${WORKDIR}/tpm2-abrmd.default" "${D}${sysconfdir}/default/tpm2-abrmd"
}
RDEPENDS_${PN} += "\
libgcc dbus-glib libtss2 libtctidevice libtctisocket libmarshal \
"
BBCLASSEXTEND = "native"