]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
(SBOX3): Renamed arguments. Eliminated temporaries.
authorNiels Möller <nisse@lysator.liu.se>
Tue, 7 Jun 2011 20:33:05 +0000 (22:33 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Tue, 7 Jun 2011 20:33:05 +0000 (22:33 +0200)
Rev: nettle/ChangeLog:1.180
Rev: nettle/serpent-encrypt.c:1.5

ChangeLog
serpent-encrypt.c

index 9ae8bd7d5dd3367952104bc46e16c179cfafd1ff..5a4873a40af1824017d225dd4c8345333c333d5e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
        temporaries.
        (SBOX1): Likewise.
        (SBOX2): Likewise.
+       (SBOX3): Likewise.
 
 2011-06-06  Niels Möller  <nisse@lysator.liu.se>
 
index 634b883d67505c4b009accec9ee842067555b370..4ce869fd85495949058c339cd2499e176974d6cc 100644 (file)
   } while (0)
 
 /* S3:  0 15 11  8 12  9  6  3 13  1  2  4 10  7  5 14 */
-#define SBOX3(type, a, b, c, d, w, x, y, z) \
-  do {                                         \
-    type t02, t03, t04, t05, t06, t07, t08; \
-    type t09, t10, t11, t13, t14, t15, t01; \
-    t01 = a   ^ c  ; \
-    t02 = a   | d  ; \
-    t03 = a   & d  ; \
-    t04 = t01 & t02; \
-    t05 = b   | t03; \
-    t06 = a   & b  ; \
-    t07 = d   ^ t04; \
-    t08 = c   | t06; \
-    t09 = b   ^ t07; \
-    t10 = d   & t05; \
-    t11 = t02 ^ t10; \
-    z   = t08 ^ t09; \
-    t13 = d   | z  ; \
-    t14 = a   | t07; \
-    t15 = b   & t13; \
-    y   = t08 ^ t11; \
-    w   = t14 ^ t15; \
-    x   = t05 ^ t04; \
+#define SBOX3(type, x0, x1, x2, x3, y0, y1, y2, y3)    \
+  do {                                                 \
+    y2  = x0 ^ x2;                                     \
+    y0  = x0 | x3;                                     \
+    y3  = x0 & x3;                                     \
+    y1  = y2 & y0;                                     \
+    y3 |= x1;                                          \
+    y2  = x0   & x1;                                   \
+    y2 |= x2;                                          \
+    x2  = x3   ^ y1;                                   \
+    y1 ^= y3;                                          \
+    x0 |= x2;                                          \
+    x2 ^= x1;                                          \
+    y3 &= x3;                                          \
+    y0 ^= y3;                                          \
+    y3  = y2 ^ x2;                                     \
+    y2 ^= y0;                                          \
+    x3 |= y3;                                          \
+    x1 &= x3;                                          \
+    y0  = x0 ^ x1;                                     \
   } while (0)
 
 /* S4:  1 15  8  3 12  0 11  6  2  5  4 10  9 14  7 13 */