From: Niels Möller Date: Thu, 9 Jun 2011 18:47:36 +0000 (+0200) Subject: (SBOX4): Renamed arguments. Eliminated temporaries. X-Git-Tag: nettle_2.2_release_20110711~70 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b44a75d00f9700ac79eca2a4a821651722de4608;p=thirdparty%2Fnettle.git (SBOX4): Renamed arguments. Eliminated temporaries. Rev: nettle/ChangeLog:1.183 Rev: nettle/serpent-encrypt.c:1.8 --- diff --git a/ChangeLog b/ChangeLog index ffb1109f..bf273594 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,13 @@ 2011-06-09 Niels Möller + * 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 - * 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 diff --git a/serpent-encrypt.c b/serpent-encrypt.c index 78321912..f86f8f95 100644 --- a/serpent-encrypt.c +++ b/serpent-encrypt.c @@ -207,29 +207,27 @@ 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 */