diff options
author | Niels Möller <nisse@lysator.liu.se> | 2011-06-07 22:33:05 +0200 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2011-06-07 22:33:05 +0200 |
commit | d778b2da522f459118a98faff7f9d57918b7986c (patch) | |
tree | 256a2d1c7a5bdf8b94a8ccddb617964bf0ef46c7 /serpent-encrypt.c | |
parent | 2c32cfc7b71e859f6f64fd2eaf936fb2d92522d7 (diff) | |
download | nettle-d778b2da522f459118a98faff7f9d57918b7986c.tar.gz |
(SBOX3): Renamed arguments. Eliminated temporaries.
Rev: nettle/ChangeLog:1.180
Rev: nettle/serpent-encrypt.c:1.5
Diffstat (limited to 'serpent-encrypt.c')
-rw-r--r-- | serpent-encrypt.c | 42 |
1 files changed, 20 insertions, 22 deletions
diff --git a/serpent-encrypt.c b/serpent-encrypt.c index 634b883d..4ce869fd 100644 --- a/serpent-encrypt.c +++ b/serpent-encrypt.c @@ -141,28 +141,26 @@ } 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 */ |