Browse code

fix compile errors in srutils/sha256 on SunOS (SmartOS)

(cherry picked from commit fdb4c7758f0d6d6ebed8cf9d01a412ed024efb8b)

Jon Auer authored on 05/02/2015 23:34:59 • Daniel-Constantin Mierla committed on 10/02/2015 12:21:47
Showing 2 changed files
... ...
@@ -36,6 +36,12 @@
36 36
 #include <assert.h>	/* assert() */
37 37
 #include "sha256.h"
38 38
 
39
+/* discover byte order on solaris */
40
+#if defined(__SVR4) || defined(__sun)
41
+       #include <sys/isa_defs.h>
42
+       #define BYTE_ORDER _BYTE_ORDER
43
+#endif
44
+
39 45
 /*
40 46
  * ASSERT NOTE:
41 47
  * Some sanity checking code is included using assert().  On my FreeBSD
... ...
@@ -53,6 +53,12 @@ extern "C" {
53 53
 
54 54
 #endif /* SHA2_USE_INTTYPES_H */
55 55
 
56
+/* fix types for Sun Solaris */
57
+#if defined(__SVR4) || defined(__sun)
58
+    typedef uint8_t u_int8_t;
59
+    typedef uint32_t u_int32_t;
60
+    typedef uint64_t u_int64_t;
61
+#endif
56 62
 
57 63
 /*** SHA-256/384/512 Various Length Definitions ***********************/
58 64
 #define SHA256_BLOCK_LENGTH		64