serpent fix for sparc64

Nikolay Sturm sturm at sec.informatik.tu-darmstadt.de
Tue Jun 22 05:14:38 CEST 2004


Hi!

Following diff fixes serpent on sparc64/OpenBSD. (please cc me in
answers, as I am not subscribed)

--- cipher/serpent.c.orig	Mon Jun 21 17:49:22 2004
+++ cipher/serpent.c	Mon Jun 21 17:50:05 2004
@@ -78,8 +78,8 @@ typedef struct serpent_context
 
 #define SBOX0(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t05, t06, t07, t08, t09; \
-    register unsigned long t11, t12, t13, t14, t15, t17, t01; \
+    register u32_t t02, t03, t05, t06, t07, t08, t09; \
+    register u32_t t11, t12, t13, t14, t15, t17, t01; \
     t01 = b   ^ c  ; \
     t02 = a   | d  ; \
     t03 = a   ^ b  ; \
@@ -102,8 +102,8 @@ typedef struct serpent_context
 
 #define SBOX0_INVERSE(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t05, t06, t08, t09, t10; \
-    register unsigned long t12, t13, t14, t15, t17, t18, t01; \
+    register u32_t t02, t03, t04, t05, t06, t08, t09, t10; \
+    register u32_t t12, t13, t14, t15, t17, t18, t01; \
     t01 = c   ^ d  ; \
     t02 = a   | b  ; \
     t03 = b   | c  ; \
@@ -127,8 +127,8 @@ typedef struct serpent_context
 
 #define SBOX1(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t05, t06, t07, t08; \
-    register unsigned long t10, t11, t12, t13, t16, t17, t01; \
+    register u32_t t02, t03, t04, t05, t06, t07, t08; \
+    register u32_t t10, t11, t12, t13, t16, t17, t01; \
     t01 = a   | d  ; \
     t02 = c   ^ d  ; \
     t03 =     ~ b  ; \
@@ -151,8 +151,8 @@ typedef struct serpent_context
 
 #define SBOX1_INVERSE(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t05, t06, t07, t08; \
-    register unsigned long t09, t10, t11, t14, t15, t17, t01; \
+    register u32_t t02, t03, t04, t05, t06, t07, t08; \
+    register u32_t t09, t10, t11, t14, t15, t17, t01; \
     t01 = a   ^ b  ; \
     t02 = b   | d  ; \
     t03 = a   & c  ; \
@@ -175,8 +175,8 @@ typedef struct serpent_context
 
 #define SBOX2(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t05, t06, t07, t08; \
-    register unsigned long t09, t10, t12, t13, t14, t01; \
+    register u32_t t02, t03, t05, t06, t07, t08; \
+    register u32_t t09, t10, t12, t13, t14, t01; \
     t01 = a   | c  ; \
     t02 = a   ^ b  ; \
     t03 = d   ^ t01; \
@@ -197,8 +197,8 @@ typedef struct serpent_context
 
 #define SBOX2_INVERSE(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t06, t07, t08, t09; \
-    register unsigned long t10, t11, t12, t15, t16, t17, t01; \
+    register u32_t t02, t03, t04, t06, t07, t08, t09; \
+    register u32_t t10, t11, t12, t15, t16, t17, t01; \
     t01 = a   ^ d  ; \
     t02 = c   ^ d  ; \
     t03 = a   & c  ; \
@@ -221,8 +221,8 @@ typedef struct serpent_context
 
 #define SBOX3(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t05, t06, t07, t08; \
-    register unsigned long t09, t10, t11, t13, t14, t15, t01; \
+    register u32_t t02, t03, t04, t05, t06, t07, t08; \
+    register u32_t t09, t10, t11, t13, t14, t15, t01; \
     t01 = a   ^ c  ; \
     t02 = a   | d  ; \
     t03 = a   & d  ; \
@@ -245,8 +245,8 @@ typedef struct serpent_context
 
 #define SBOX3_INVERSE(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t05, t06, t07, t09; \
-    register unsigned long t11, t12, t13, t14, t16, t01; \
+    register u32_t t02, t03, t04, t05, t06, t07, t09; \
+    register u32_t t11, t12, t13, t14, t16, t01; \
     t01 = c   | d  ; \
     t02 = a   | d  ; \
     t03 = c   ^ t02; \
@@ -268,8 +268,8 @@ typedef struct serpent_context
 
 #define SBOX4(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t05, t06, t08, t09; \
-    register unsigned long t10, t11, t12, t13, t14, t15, t16, t01; \
+    register u32_t t02, t03, t04, t05, t06, t08, t09; \
+    register u32_t t10, t11, t12, t13, t14, t15, t16, t01; \
     t01 = a   | b  ; \
     t02 = b   | c  ; \
     t03 = a   ^ t02; \
@@ -293,8 +293,8 @@ typedef struct serpent_context
 
 #define SBOX4_INVERSE(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t05, t06, t07, t09; \
-    register unsigned long t10, t11, t12, t13, t15, t01; \
+    register u32_t t02, t03, t04, t05, t06, t07, t09; \
+    register u32_t t10, t11, t12, t13, t15, t01; \
     t01 = b   | d  ; \
     t02 = c   | d  ; \
     t03 = a   & t01; \
@@ -316,8 +316,8 @@ typedef struct serpent_context
 
 #define SBOX5(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t05, t07, t08, t09; \
-    register unsigned long t10, t11, t12, t13, t14, t01; \
+    register u32_t t02, t03, t04, t05, t07, t08, t09; \
+    register u32_t t10, t11, t12, t13, t14, t01; \
     t01 = b   ^ d  ; \
     t02 = b   | d  ; \
     t03 = a   & t01; \
@@ -339,8 +339,8 @@ typedef struct serpent_context
 
 #define SBOX5_INVERSE(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t05, t07, t08, t09; \
-    register unsigned long t10, t12, t13, t15, t16, t01; \
+    register u32_t t02, t03, t04, t05, t07, t08, t09; \
+    register u32_t t10, t12, t13, t15, t16, t01; \
     t01 = a   & d  ; \
     t02 = c   ^ t01; \
     t03 = a   ^ d  ; \
@@ -362,8 +362,8 @@ typedef struct serpent_context
 
 #define SBOX6(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t05, t07, t08, t09, t10; \
-    register unsigned long t11, t12, t13, t15, t17, t18, t01; \
+    register u32_t t02, t03, t04, t05, t07, t08, t09, t10; \
+    register u32_t t11, t12, t13, t15, t17, t18, t01; \
     t01 = a   & d  ; \
     t02 = b   ^ c  ; \
     t03 = a   ^ d  ; \
@@ -387,8 +387,8 @@ typedef struct serpent_context
 
 #define SBOX6_INVERSE(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t05, t06, t07, t08, t09; \
-    register unsigned long t12, t13, t14, t15, t16, t17, t01; \
+    register u32_t t02, t03, t04, t05, t06, t07, t08, t09; \
+    register u32_t t12, t13, t14, t15, t16, t17, t01; \
     t01 = a   ^ c  ; \
     t02 =     ~ c  ; \
     t03 = b   & t01; \
@@ -412,8 +412,8 @@ typedef struct serpent_context
 
 #define SBOX7(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t05, t06, t08, t09, t10; \
-    register unsigned long t11, t13, t14, t15, t16, t17, t01; \
+    register u32_t t02, t03, t04, t05, t06, t08, t09, t10; \
+    register u32_t t11, t13, t14, t15, t16, t17, t01; \
     t01 = a   & c  ; \
     t02 =     ~ d  ; \
     t03 = a   & t02; \
@@ -437,8 +437,8 @@ typedef struct serpent_context
 
 #define SBOX7_INVERSE(a, b, c, d, w, x, y, z) \
   { \
-    register unsigned long t02, t03, t04, t06, t07, t08, t09; \
-    register unsigned long t10, t11, t13, t14, t15, t16, t01; \
+    register u32_t t02, t03, t04, t06, t07, t08, t09; \
+    register u32_t t10, t11, t13, t14, t15, t16, t01; \
     t01 = a   & b  ; \
     t02 = a   | b  ; \
     t03 = c   | t01; \



More information about the Gcrypt-devel mailing list