summaryrefslogtreecommitdiff
path: root/lib/freebl/sha512.c
diff options
context:
space:
mode:
authorMartin Thomson <martin.thomson@gmail.com>2015-08-20 10:54:54 -0700
committerMartin Thomson <martin.thomson@gmail.com>2015-08-20 10:54:54 -0700
commit9078205b70d54dc31970adfbc82cba62cf97b932 (patch)
tree4ddebf3f1d52370f589d3c86df7dd6f289ae79ee /lib/freebl/sha512.c
parent488a16421c66473164bb8ff1ebe20ed5b87a081d (diff)
downloadnss-hg-9078205b70d54dc31970adfbc82cba62cf97b932.tar.gz
Bug 1182667 - Fixing unoptimized byteswap
Diffstat (limited to 'lib/freebl/sha512.c')
-rw-r--r--lib/freebl/sha512.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/freebl/sha512.c b/lib/freebl/sha512.c
index 09beed698..fb7ce5974 100644
--- a/lib/freebl/sha512.c
+++ b/lib/freebl/sha512.c
@@ -72,7 +72,6 @@ static const PRUint32 H256[8] = {
#include <stdlib.h>
#pragma intrinsic(_byteswap_ulong)
#define SHA_HTONL(x) _byteswap_ulong(x)
-#define BYTESWAP4(x) x = SHA_HTONL(x)
#elif defined(_MSC_VER) && defined(NSS_X86_OR_X64)
#ifndef FORCEINLINE
#if (_MSC_VER >= 1200)
@@ -93,7 +92,6 @@ swap4b(PRUint32 dwd)
}
#define SHA_HTONL(x) swap4b(x)
-#define BYTESWAP4(x) x = SHA_HTONL(x)
#elif defined(__GNUC__) && defined(NSS_X86_OR_X64)
static __inline__ PRUint32 swap4b(PRUint32 value)
@@ -102,7 +100,6 @@ static __inline__ PRUint32 swap4b(PRUint32 value)
return (value);
}
#define SHA_HTONL(x) swap4b(x)
-#define BYTESWAP4(x) x = SHA_HTONL(x)
#elif defined(__GNUC__) && (defined(__thumb2__) || \
(!defined(__thumb__) && \
@@ -122,18 +119,17 @@ static __inline__ PRUint32 swap4b(PRUint32 value)
return ret;
}
#define SHA_HTONL(x) swap4b(x)
-#define BYTESWAP4(x) x = SHA_HTONL(x)
#else
#define SWAP4MASK 0x00FF00FF
static PRUint32 swap4b(PRUint32 value)
{
- PRUint32 t1 = (x << 16) | (x >> 16);
+ PRUint32 t1 = (value << 16) | (value >> 16);
return ((t1 & SWAP4MASK) << 8) | ((t1 >> 8) & SWAP4MASK);
}
#define SHA_HTONL(x) swap4b
-#define BYTESWAP4(x) x = SHA_HTONL(x)
#endif
+#define BYTESWAP4(x) x = SHA_HTONL(x)
#endif /* defined(IS_LITTLE_ENDIAN) */
#if defined(_MSC_VER)