From c059dbfb3134d5d9fee6ba8b1538255b586c5cad Mon Sep 17 00:00:00 2001 From: Zheng Ruoqin Date: Mon, 10 Dec 2018 08:08:21 -0700 Subject: [PATCH] Bug 1512923 - Fix SHA_HTONL bug for arm 32be r=jcj Rpm use nss as digest crypto library and which will cause an error on arm 32be platform as follows: error: test-manual-1.2.3-20181012.noarch.rpm: Header SHA1 digest: BAD (Expected f1deb7dc4a10742d88ccd1e967dbc62ae45095a5 !=4ad9d7dad6d70d6086eefec62612ad5d77f2fe81) => this value is wrong error: test-manual-1.2.3-20181012.noarch.rpm: not an rpm package (or package manifest) The error is caused by SHA_HTONL in nss, for there is no need to reverse the host value for arm 32be as it is originally big endian, so fix it. Signed-off-by: Zheng Ruoqin --HG-- extra : rebase_source : f42990c833b0d5c8d4ba08e20d13f96b2708de33 extra : amend_source : 2781c572e071400f6c9da1cee87f49d4e0890ea9 --- lib/freebl/sha_fast.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/freebl/sha_fast.h b/lib/freebl/sha_fast.h index 4f37d13d05..1780ca8f4e 100644 --- a/lib/freebl/sha_fast.h +++ b/lib/freebl/sha_fast.h @@ -99,6 +99,7 @@ swap4b(PRUint32 value) defined(__ARM_ARCH_7__) || \ defined(__ARM_ARCH_7A__) || \ defined(__ARM_ARCH_7R__))) +#if defined(IS_LITTLE_ENDIAN) static __inline__ PRUint32 swap4b(PRUint32 value) { @@ -109,6 +110,7 @@ swap4b(PRUint32 value) return ret; } #define SHA_HTONL(x) swap4b(x) +#endif #endif /* x86 family */