[packages/tpm_emulator] - fix building with gcc 8.x - rel 16

baggins baggins at pld-linux.org
Sat Jul 28 21:28:44 CEST 2018


commit 4db5a903a145ca5b59c29a8f7af78a3114821932
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sat Jul 28 21:28:24 2018 +0200

    - fix building with gcc 8.x
    - rel 16

 gcc8.patch        | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 tpm_emulator.spec |  4 +++-
 2 files changed, 49 insertions(+), 1 deletion(-)
---
diff --git a/tpm_emulator.spec b/tpm_emulator.spec
index 0e18a42..1159cc6 100644
--- a/tpm_emulator.spec
+++ b/tpm_emulator.spec
@@ -21,7 +21,7 @@ exit 1
 %define		_duplicate_files_terminate_build	0
 
 %define	pname	tpm_emulator
-%define	rel	15
+%define	rel	16
 Summary:	Software-based TPM and MTM Emulator
 Summary(pl.UTF-8):	Programowy emulator TPM i MTM
 Name:		%{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
@@ -35,6 +35,7 @@ Patch0:		%{pname}-libdir.patch
 Patch1:		linux-3.19.patch
 Patch2:		linux-4.1.patch
 Patch3:		linux-4.7.patch
+Patch4:		gcc8.patch
 URL:		http://tpm-emulator.berlios.de/
 BuildRequires:	cmake >= 2.4
 BuildRequires:	gmp-devel
@@ -128,6 +129,7 @@ przekazujący odebrane polecenia do tpmd.\
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 # separate kernel module from userspace build
 echo > tpmd_dev/CMakeLists.txt
diff --git a/gcc8.patch b/gcc8.patch
new file mode 100644
index 0000000..24be0c5
--- /dev/null
+++ b/gcc8.patch
@@ -0,0 +1,46 @@
+diff -ur tpm_emulator-0.7.4/mtm/CMakeLists.txt tpm_emulator-0.7.4-gcc8/mtm/CMakeLists.txt
+--- tpm_emulator-0.7.4/mtm/CMakeLists.txt	2011-12-20 19:30:06.000000000 +0100
++++ tpm_emulator-0.7.4-gcc8/mtm/CMakeLists.txt	2018-07-28 21:23:13.044547064 +0200
+@@ -3,6 +3,7 @@
+ #
+ # $Id: CMakeLists.txt 376 2010-02-16 14:51:42Z mast $
+ 
++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-fallthrough")
+ add_definitions(-DMTM_EMULATOR)
+ file(GLOB tpm_SRCS ../tpm/tpm_cmd_handler.c ../tpm/tpm_data.c)
+ file(GLOB mtm_SRCS "*.[h|c]")
+diff -ur tpm_emulator-0.7.4/tpm/tpm_cmd_handler.c tpm_emulator-0.7.4-gcc8/tpm/tpm_cmd_handler.c
+--- tpm_emulator-0.7.4/tpm/tpm_cmd_handler.c	2011-12-20 19:30:06.000000000 +0100
++++ tpm_emulator-0.7.4-gcc8/tpm/tpm_cmd_handler.c	2018-07-28 21:17:04.576693746 +0200
+@@ -3330,6 +3330,7 @@
+                   sizeof(rsp->auth2->nonceOdd.nonce));
+       tpm_hmac_update(&hmac, (BYTE*)&rsp->auth2->continueAuthSession, 1);
+       tpm_hmac_final(&hmac, rsp->auth2->auth);
++      break;
+     case TPM_TAG_RSP_AUTH1_COMMAND:
+       tpm_hmac_init(&hmac, rsp->auth1->secret, sizeof(rsp->auth1->secret));
+       tpm_hmac_update(&hmac, rsp->auth1->digest, sizeof(rsp->auth1->digest));
+diff -ur tpm_emulator-0.7.4/tpm/tpm_deprecated.c tpm_emulator-0.7.4-gcc8/tpm/tpm_deprecated.c
+--- tpm_emulator-0.7.4/tpm/tpm_deprecated.c	2011-12-20 19:30:06.000000000 +0100
++++ tpm_emulator-0.7.4-gcc8/tpm/tpm_deprecated.c	2018-07-28 21:14:33.244844366 +0200
+@@ -434,7 +434,7 @@
+   tpm_hmac_final(&hmac_ctx, b1.digest);
+   /* 6. The TPM SHALL compare b1 with newAuthLink. The TPM SHALL
+         indicate a failure if the values do not match. */
+-  if (memcmp(&b1, &newAuthLink, sizeof(TPM_HMAC))) {
++  if (memcmp(&b1, newAuthLink, sizeof(TPM_HMAC))) {
+     debug("TPM_ChangeAuthAsymFinish(): newAuthLink value does not match.");
+     return TPM_FAIL;
+   }
+diff -ur tpm_emulator-0.7.4/tpmd_dev/linux/tpmd_dev.c tpm_emulator-0.7.4-gcc8/tpmd_dev/linux/tpmd_dev.c
+--- tpm_emulator-0.7.4/tpmd_dev/linux/tpmd_dev.c	2018-07-28 21:27:33.331082169 +0200
++++ tpm_emulator-0.7.4-gcc8/tpmd_dev/linux/tpmd_dev.c	2018-07-28 21:26:55.750619594 +0200
+@@ -82,7 +82,7 @@
+     return res;
+   }
+   addr.sun_family = AF_UNIX;
+-  strncpy(addr.sun_path, socket_name, sizeof(addr.sun_path));
++  strncpy(addr.sun_path, socket_name, sizeof(addr.sun_path)-1);
+   res = tpmd_sock->ops->connect(tpmd_sock, 
+     (struct sockaddr*)&addr, sizeof(struct sockaddr_un), 0);
+   if (res != 0) {
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/tpm_emulator.git/commitdiff/4db5a903a145ca5b59c29a8f7af78a3114821932



More information about the pld-cvs-commit mailing list