]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
(SBOX4): Renamed arguments. Eliminated temporaries.
authorNiels Möller <nisse@lysator.liu.se>
Thu, 9 Jun 2011 18:47:36 +0000 (20:47 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 9 Jun 2011 18:47:36 +0000 (20:47 +0200)
Rev: nettle/ChangeLog:1.183
Rev: nettle/serpent-encrypt.c:1.8

ChangeLog
serpent-encrypt.c

index ffb1109fb22a042bd86bbc447dab0656bd4fac29..bf273594bc46f4c18b30b26f8d58d8961dec516d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,13 @@
 2011-06-09  Niels Möller  <nisse@lysator.liu.se>
 
+       * serpent-encrypt.c (SBOX4): Renamed arguments. Eliminated
+       temporaries.
+
        * configure.ac (LIBNETTLE_LINK, LIBHOGWEED_LINK): Cygwin fix, from
        Vincent Torri.
 
 2011-06-08  Niels Möller  <nisse@lysator.liu.se>
 
-       * serpent-encrypt.c (SBOX4): Renamed arguments.
-
        * examples/eratosthenes.c (find_first_one): Fixed c99-style
        declaration. Reported by Sebastian Reitenbach.
        (find_first_one): Declare the lookup table as static const, and
index 78321912e7b33607fca9d52e07cfa4350611e23c..f86f8f958f7d9331a0bc3ff1ec32d36c3d5b71a4 100644 (file)
     y1  = t15 ^ t16;
     y0  =     ~ t14;
 */
-#define SBOX4(type, x0, x1, x2, x3, y0, y1, y2, y3) \
-  do { \
-    type t02, t03, t04, t05, t06, t08, t09; \
-    type t10, t11, t12, t13, t14, t15, t16, t01; \
-    t01 = x0  | x1; \
-    t02 = x1  | x2; \
-    t03 = x0  ^ t02; \
-    t04 = x1  ^ x3; \
-    t05 = x3  | t03; \
-    t06 = x3  & t01; \
-    y3  = t03 ^ t06; \
-    t08 = y3  & t04; \
-    t09 = t04 & t05; \
-    t10 = x2  ^ t06; \
-    t11 = x1  & x2; \
-    t12 = t04 ^ t08; \
-    t13 = t11 | t03; \
-    t14 = t10 ^ t09; \
-    t15 = x0  & t05; \
-    t16 = t11 | t12; \
-    y2  = t13 ^ t08; \
-    y1  = t15 ^ t16; \
-    y0  =     ~ t14; \
+#define SBOX4(type, x0, x1, x2, x3, y0, y1, y2, y3)    \
+  do {                                                 \
+    y3  = x0 | x1;                                     \
+    y2  = x1 | x2;                                     \
+    y2  = x0 ^ y2;                                     \
+    y3 &= x3;                                          \
+    y0  = x1 ^ x3;                                     \
+    x3 |= y2;                                          \
+    x0 &= x3;                                          \
+    x1 &= x2;                                          \
+    x2 ^= y3;                                          \
+    y3 ^= y2;                                          \
+    y2 |= x1;                                          \
+    y1  = y3 & y0;                                     \
+    y2 ^= y1;                                          \
+    y1 ^= y0;                                          \
+    y1 |= x1;                                          \
+    y1 ^= x0;                                          \
+    y0 &= x3;                                          \
+    y0 ^= x2;                                          \
+    y0  = ~y0;                                         \
   } while (0)
 
 /* S5: 15  5  2 11  4 10  9 12  0  3 14  8 13  6  7  1 */