The crypto code was using a typedef unsigned long to represent a 32 bit
value.  On all 64 bit platforms I have available to me to test, unsigned
long evaluates to 32 bits.  On s390x it evaluates to 64 bits.  This
naturally causes all kinds of chaos with the encryption system.

Also this patch will use the proper set of macros when executing the
crypto algorithms, although they are just performance enhancements and
have no compatability changing values.

Regards
-steve

Index: exec/crypto.c
===================================================================
--- exec/crypto.c	(revision 1680)
+++ exec/crypto.c	(working copy)
@@ -20,13 +20,14 @@
 #endif
 #include <fcntl.h>
 #include <unistd.h>
+#include <stdint.h>
 
 #include "crypto.h"
 
 #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
 #define ENDIAN_LITTLE
@@ -41,10 +42,10 @@
 #endif
 
 #if defined(OPENAIS_LINUX)
-#if __WORDIZE == 64
+#if __WORDSIZE == 64
 #define ENDIAN_64BITWORD
 #endif
-#if __WORDIZE == 32
+#if __WORDSIZE == 32
 #define ENDIAN_32BITWORD
 #endif
 #else
Index: exec/crypto.h
===================================================================
--- exec/crypto.h	(revision 1680)
+++ exec/crypto.h	(working copy)
@@ -1,6 +1,8 @@
 #ifndef CRYPTO_H_DEFINED
 #define CRYPTO_H_DEFINED
 
+#include <stdint.h>
+
 #define DIGEST_SHA1     0
 #define PRNG_SOBER      0
 
@@ -88,7 +90,7 @@
                        unsigned char *dst, unsigned long *dstlen);
 
 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 */ 
                  konst,          /* key dependent constant */
                  sbuf;           /* partial word encryption buffer */
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to