diff --git a/ChangeLog b/ChangeLog index ab97fb63ece3c77fe57d66b58604f75d087e06c7..f316ae18d2575a26afdadb8a5db0919171e25bfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ * serpent-encrypt.c (SBOX0): Renamed arguments. Eliminated temporaries. + (SBOX1): Likewise. 2011-06-06 Niels M�ller <nisse@lysator.liu.se> diff --git a/serpent-encrypt.c b/serpent-encrypt.c index dda821d8a7ee6209d11f40f68ec10dc907ee1f06..30923a7d82a9b77105a4d683e166c7cdc2f547df 100644 --- a/serpent-encrypt.c +++ b/serpent-encrypt.c @@ -95,28 +95,26 @@ } while (0) /* S1: 15 12 2 7 9 0 5 10 1 11 14 8 6 13 3 4 */ -#define SBOX1(type, a, b, c, d, w, x, y, z) \ - do { \ - type t02, t03, t04, t05, t06, t07, t08; \ - type t10, t11, t12, t13, t16, t17, t01; \ - t01 = a | d ; \ - t02 = c ^ d ; \ - t03 = ~ b ; \ - t04 = a ^ c ; \ - t05 = a | t03; \ - t06 = d & t04; \ - t07 = t01 & t02; \ - t08 = b | t06; \ - y = t02 ^ t05; \ - t10 = t07 ^ t08; \ - t11 = t01 ^ t10; \ - t12 = y ^ t11; \ - t13 = b & d ; \ - z = ~ t10; \ - x = t13 ^ t12; \ - t16 = t10 | x ; \ - t17 = t05 & t16; \ - w = c ^ t17; \ +#define SBOX1(type, x0, x1, x2, x3, y0, y1, y2, y3) \ + do { \ + y1 = x0 | x3; \ + y2 = x2 ^ x3; \ + y0 = ~ x1; \ + y3 = x0 ^ x2; \ + y0 |= x0; \ + y3 &= x3; \ + x0 = y1 & y2; \ + y3 |= x1; \ + y2 ^= y0; \ + y3 ^= x0; \ + x0 = y1 ^ y3; \ + x0 ^= y2; \ + y1 = x1 & x3; \ + y1 ^= x0; \ + x3 = y3 | y1; \ + y3 = ~ y3; \ + y0 &= x3; \ + y0 ^= x2; \ } while (0) /* S2: 8 6 7 9 3 12 10 15 13 1 14 4 0 11 5 2 */