Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cr-marcstevens/sha1collisiondetection.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sha1.c')
-rw-r--r--lib/sha1.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/sha1.c b/lib/sha1.c
index facea1b..3f01599 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -36,6 +36,28 @@
#undef SHA1DC_BIGENDIAN
#endif
+#ifdef sun
+
+#ifdef __sparc
+/*
+ * Why not do this generically? Because Linux at least will define
+ * __BIG_ENDIAN but we're only Big Endian if __BYTE_ORDER is
+ * equivalent to __BIG_ENDIAN, but on Solaris SPARC _BIG_ENDIAN is
+ * defined without any value. Thus just checking if _BIG_ENDIAN is
+ * defined on Solaris SPARC works, but we can't just check if it's
+ * defined because on Linux x86 it'll be defined, just as
+ * __BIG_ENDIAN.
+ *
+ * There's probably some easy way out of this, but let's just take the
+ * easy way out here and treat Solaris specially. This is the Oracle
+ * documented way to check for Solaris SPARC. See
+ * http://www.oracle.com/technetwork/server-storage/solaris/portingtosolaris-138514.html
+ */
+#define SHA1DC_BIGENDIAN
+#endif
+
+#else
+
#if (defined(_BYTE_ORDER) || defined(__BYTE_ORDER) || defined(__BYTE_ORDER__))
#if ((defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)) || \
@@ -55,6 +77,8 @@
#endif
+#endif
+
#if (defined(SHA1DC_FORCE_LITTLEENDIAN) && defined(SHA1DC_BIGENDIAN))
#undef SHA1DC_BIGENDIAN
#endif