Commit 9474fe42 authored by Niels Möller's avatar Niels Möller

(SBOX5): Renamed arguments. Eliminated temporaries.

Rev: nettle/ChangeLog:1.184
Rev: nettle/serpent-encrypt.c:1.9
parent e7584b8b
2011-06-10 Niels Mller <nisse@lysator.liu.se>
* serpent-encrypt.c (SBOX5): Renamed arguments. Eliminated
temporaries.
2011-06-09 Niels Mller <nisse@lysator.liu.se>
* serpent-encrypt.c (SBOX4): Renamed arguments. Eliminated
......
......@@ -231,27 +231,44 @@
} while (0)
/* S5: 15 5 2 11 4 10 9 12 0 3 14 8 13 6 7 1 */
#define SBOX5(type, a, b, c, d, w, x, y, z) \
do { \
type t02, t03, t04, t05, t07, t08, t09; \
type t10, t11, t12, t13, t14, t01; \
t01 = b ^ d ; \
t02 = b | d ; \
t03 = a & t01; \
t04 = c ^ t02; \
t05 = t03 ^ t04; \
w = ~ t05; \
t07 = a ^ t01; \
t08 = d | w ; \
t09 = b | t05; \
t10 = d ^ t08; \
t11 = b | t07; \
t12 = t03 | w ; \
t13 = t07 | t10; \
t14 = t01 ^ t11; \
y = t09 ^ t13; \
x = t07 ^ t08; \
z = t12 ^ t14; \
/* Original single-assignment form:
t01 = x1 ^ x3;
t02 = x1 | x3;
t03 = x0 & t01;
t04 = x2 ^ t02;
t05 = t03 ^ t04;
y0 = ~ t05;
t07 = x0 ^ t01;
t08 = x3 | y0;
t09 = x1 | t05;
t10 = x3 ^ t08;
t11 = x1 | t07;
t12 = t03 | y0;
t13 = t07 | t10;
t14 = t01 ^ t11;
y2 = t09 ^ t13;
y1 = t07 ^ t08;
y3 = t12 ^ t14;
*/
#define SBOX5(type, x0, x1, x2, x3, y0, y1, y2, y3) \
do { \
y0 = x1 | x3; \
y0 ^= x2; \
x2 = x1 ^ x3; \
y2 = x0 ^ x2; \
x0 &= x2; \
y0 ^= x0; \
y3 = x1 | y2; \
x1 |= y0; \
y0 = ~y0; \
x0 |= y0; \
y3 ^= x2; \
y3 ^= x0; \
y1 = x3 | y0; \
x3 ^= y1; \
y1 ^= y2; \
y2 |= x3; \
y2 ^= x1; \
} while (0)
/* S6: 7 2 12 5 8 4 6 11 14 9 1 15 13 3 10 0 */
......
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