Przeglądaj źródła

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

Jon Auer 10 lat temu
rodzic
commit
fdb4c7758f
2 zmienionych plików z 12 dodań i 0 usunięć
  1. 6 0
      lib/srutils/sha256.c
  2. 6 0
      lib/srutils/sha256.h

+ 6 - 0
lib/srutils/sha256.c

@@ -36,6 +36,12 @@
 #include <assert.h>	/* assert() */
 #include <assert.h>	/* assert() */
 #include "sha256.h"
 #include "sha256.h"
 
 
+/* discover byte order on solaris */
+#if defined(__SVR4) || defined(__sun)
+       #include <sys/isa_defs.h>
+       #define BYTE_ORDER _BYTE_ORDER
+#endif
+
 /*
 /*
  * ASSERT NOTE:
  * ASSERT NOTE:
  * Some sanity checking code is included using assert().  On my FreeBSD
  * Some sanity checking code is included using assert().  On my FreeBSD

+ 6 - 0
lib/srutils/sha256.h

@@ -53,6 +53,12 @@ extern "C" {
 
 
 #endif /* SHA2_USE_INTTYPES_H */
 #endif /* SHA2_USE_INTTYPES_H */
 
 
+/* fix types for Sun Solaris */
+#if defined(__SVR4) || defined(__sun)
+    typedef uint8_t u_int8_t;
+    typedef uint32_t u_int32_t;
+    typedef uint64_t u_int64_t;
+#endif
 
 
 /*** SHA-256/384/512 Various Length Definitions ***********************/
 /*** SHA-256/384/512 Various Length Definitions ***********************/
 #define SHA256_BLOCK_LENGTH		64
 #define SHA256_BLOCK_LENGTH		64