4
0
Эх сурвалжийг харах

Allow crypto to work on systems where unsigned long evaluates to 8 bytes. (s390x).

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1746 fd59a12c-fef9-0310-b244-a6a79926bd2f
Steven Dake 17 жил өмнө
parent
commit
ff76864918
2 өөрчлөгдсөн 8 нэмэгдсэн , 5 устгасан
  1. 5 4
      exec/crypto.c
  2. 3 1
      exec/crypto.h

+ 5 - 4
exec/crypto.c

@@ -20,13 +20,14 @@
 #endif
 #endif
 #include <fcntl.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <unistd.h>
+#include <stdint.h>
 
 
 #include "crypto.h"
 #include "crypto.h"
 
 
 #define CONST64(n) n ## ULL
 #define CONST64(n) n ## ULL
 
 
-typedef unsigned long ulong32;
-typedef unsigned long long ulong64;
+typedef uint32_t ulong32;
+typedef uint64_t ulong64;
 
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #if __BYTE_ORDER == __LITTLE_ENDIAN
 #define ENDIAN_LITTLE
 #define ENDIAN_LITTLE
@@ -41,10 +42,10 @@ typedef unsigned long long ulong64;
 #endif
 #endif
 
 
 #if defined(COROSYNC_LINUX)
 #if defined(COROSYNC_LINUX)
-#if __WORDIZE == 64
+#if __WORDSIZE == 64
 #define ENDIAN_64BITWORD
 #define ENDIAN_64BITWORD
 #endif
 #endif
-#if __WORDIZE == 32
+#if __WORDSIZE == 32
 #define ENDIAN_32BITWORD
 #define ENDIAN_32BITWORD
 #endif
 #endif
 #else
 #else

+ 3 - 1
exec/crypto.h

@@ -1,6 +1,8 @@
 #ifndef CRYPTO_H_DEFINED
 #ifndef CRYPTO_H_DEFINED
 #define CRYPTO_H_DEFINED
 #define CRYPTO_H_DEFINED
 
 
+#include <stdint.h>
+
 #define DIGEST_SHA1     0
 #define DIGEST_SHA1     0
 #define PRNG_SOBER      0
 #define PRNG_SOBER      0
 
 
@@ -88,7 +90,7 @@ int hmac_memory(int hash, const unsigned char *key, unsigned long keylen,
                        unsigned char *dst, unsigned long *dstlen);
                        unsigned char *dst, unsigned long *dstlen);
 
 
 struct sober128_prng {
 struct sober128_prng {
-    unsigned long      R[17],          /* Working storage for the shift register */
+    uint32_t      R[17],          /* Working storage for the shift register */
                  initR[17],      /* saved register contents */ 
                  initR[17],      /* saved register contents */ 
                  konst,          /* key dependent constant */
                  konst,          /* key dependent constant */
                  sbuf;           /* partial word encryption buffer */
                  sbuf;           /* partial word encryption buffer */