From dae705f56224540b60f902d6644032654d3c0440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Tue, 7 Jun 2011 21:00:16 +0200 Subject: [PATCH] (SBOX1): Renamed arguments. Eliminated temporaries. Rev: nettle/ChangeLog:1.178 Rev: nettle/serpent-encrypt.c:1.3 --- ChangeLog | 1 + serpent-encrypt.c | 42 ++++++++++++++++++++---------------------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab97fb63..f316ae18 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 dda821d8..30923a7d 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 */ -- GitLab