File 0001-Add-big-endian-detection.patch of Package swtpm2

From 2064b3084dd6820851d9e0587ef3f017fc2afde4 Mon Sep 17 00:00:00 2001
From: James Bottomley <James.Bottomley@HansenPartnership.com>
Date: Fri, 9 Feb 2018 13:03:39 -0800
Subject: [PATCH] Add big endian detection

Using endian.h

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 src/Implementation.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/Implementation.h b/src/Implementation.h
index ac5435d..cd66de9 100644
--- a/src/Implementation.h
+++ b/src/Implementation.h
@@ -63,6 +63,8 @@
 #ifndef _IMPLEMENTATION_H_
 #define _IMPLEMENTATION_H_
 
+#include <endian.h>
+
 #include    "TpmBuildSwitches.h"
 #include    "BaseTypes.h"
 #include    "TPMB.h"
@@ -82,8 +84,12 @@
 #define  SET      1
 #define  CLEAR    0
 /* From Vendor-Specific: Table 1 - Defines for Processor Values */
-#ifndef  BIG_ENDIAN_TPM       
+#if __BYTE_ORDER == __LITTLE_ENDIAN
 #define  BIG_ENDIAN_TPM       NO
+#elif  __BYTE_ORDER == __BIG_ENDIAN
+#define	 BIG_ENDIAN_TPM	      YES
+#else
+#error Undefined endianness
 #endif
 #define  LITTLE_ENDIAN_TPM          !BIG_ENDIAN_TPM
 #define  MOST_SIGNIFICANT_BIT_0     NO
-- 
2.16.4
openSUSE Build Service is sponsored by