Commit 66b7bda5 authored by Niels Möller's avatar Niels Möller
Browse files

(SBOX0): Renamed arguments. Eliminated temporaries.

Rev: nettle/ChangeLog:1.177
Rev: nettle/serpent-encrypt.c:1.2
parent 00a6c2d1
2011-06-07 Niels Mller <nisse@lysator.liu.se>
* serpent-encrypt.c (SBOX0): Renamed arguments. Eliminated
temporaries.
2011-06-06 Niels Mller <nisse@lysator.liu.se> 2011-06-06 Niels Mller <nisse@lysator.liu.se>
* Makefile.in (DISTFILES): Added serpent-internal.h. * Makefile.in (DISTFILES): Added serpent-internal.h.
......
...@@ -71,28 +71,27 @@ ...@@ -71,28 +71,27 @@
destroyed. Can this freedom be used to optimize the sboxes? */ destroyed. Can this freedom be used to optimize the sboxes? */
/* S0: 3 8 15 1 10 6 5 11 14 13 4 2 7 0 9 12 */ /* S0: 3 8 15 1 10 6 5 11 14 13 4 2 7 0 9 12 */
#define SBOX0(type, a, b, c, d, w, x, y, z) \ /* Could easily let y0, y1 overlap with x0, x1, and possibly also x2 and y2 */
do { \ #define SBOX0(type, x0, x1, x2, x3, y0, y1, y2, y3) \
type t02, t03, t05, t06, t07, t08, t09; \ do { \
type t11, t12, t13, t14, t15, t17, t01; \ y3 = x1 ^ x2; \
t01 = b ^ c ; \ y0 = x0 | x3; \
t02 = a | d ; \ y1 = x0 ^ x1; \
t03 = a ^ b ; \ y3 ^= y0; \
z = t02 ^ t01; \ y2 = x2 | y3; \
t05 = c | z ; \ x0 ^= x3; \
t06 = a ^ d ; \ y2 &= x3; \
t07 = b | c ; \ x3 ^= x2; \
t08 = d & t05; \ x2 |= x1; \
t09 = t03 & t07; \ y0 = y1 & x2; \
y = t09 ^ t08; \ y2 ^= y0; \
t11 = t09 & y ; \ y0 &= y2; \
t12 = c ^ d ; \ y0 ^= x2; \
t13 = t07 ^ t11; \ x1 &= x0; \
t14 = b & t06; \ y0 ^= x0; \
t15 = t06 ^ t13; \ y0 = ~ y0; \
w = ~ t15; \ y1 = y0 ^ x1; \
t17 = w ^ t14; \ y1 ^= x3; \
x = t12 ^ t17; \
} while (0) } while (0)
/* S1: 15 12 2 7 9 0 5 10 1 11 14 8 6 13 3 4 */ /* S1: 15 12 2 7 9 0 5 10 1 11 14 8 6 13 3 4 */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment