diff --git a/ChangeLog b/ChangeLog index 3844803b4be608e67dd4d42e9371d1391d79fe4d..17b181ac9d916ca52b198dfe19135ec7929213a5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2012-11-12 Niels Möller + + * serpent-internal.h [HAVE_NATIVE_64_BIT] (DROTL32): Renamed from... + (ROTL64): ... old name. + (DRSHIFT32): Renamed from ... + (RSHIFT64): ... old name. + * serpent-encrypt.c (LINEAR_TRANSFORMATION64): Updated for above + renames. + * serpent-decrypt.c (LINEAR_TRANSFORMATION64_INVERSE): Likewise. + 2012-11-11 Niels Möller From Nikos Mavrogiannopoulos: diff --git a/serpent-decrypt.c b/serpent-decrypt.c index a991255e86d05831128b9977df324a9dc76abeb8..a7ae661cb3096a203d92a9c045de5a2502a5a9da 100644 --- a/serpent-decrypt.c +++ b/serpent-decrypt.c @@ -438,16 +438,16 @@ /* In-place inverse linear transformation. */ #define LINEAR_TRANSFORMATION64_INVERSE(x0,x1,x2,x3) \ do { \ - x2 = ROTL64 (10, x2); \ - x0 = ROTL64 (27, x0); \ - x2 = x2 ^ x3 ^ RSHIFT64(7, x1); \ + x2 = DROTL32 (10, x2); \ + x0 = DROTL32 (27, x0); \ + x2 = x2 ^ x3 ^ DRSHIFT32(7, x1); \ x0 = x0 ^ x1 ^ x3; \ - x3 = ROTL64 (25, x3); \ - x1 = ROTL64 (31, x1); \ - x3 = x3 ^ x2 ^ RSHIFT64(3, x0); \ + x3 = DROTL32 (25, x3); \ + x1 = DROTL32 (31, x1); \ + x3 = x3 ^ x2 ^ DRSHIFT32(3, x0); \ x1 = x1 ^ x0 ^ x2; \ - x2 = ROTL64 (29, x2); \ - x0 = ROTL64 (19, x0); \ + x2 = DROTL32 (29, x2); \ + x0 = DROTL32 (19, x0); \ } while (0) #define ROUND64_INVERSE(which, subkey, x0,x1,x2,x3, y0,y1,y2,y3) \ diff --git a/serpent-encrypt.c b/serpent-encrypt.c index e82efea098c6f36536eb5b4b848ef352eb03d966..2c77f12da592efdb985ddb8691b26989e7547450 100644 --- a/serpent-encrypt.c +++ b/serpent-encrypt.c @@ -411,16 +411,16 @@ #define LINEAR_TRANSFORMATION64(x0,x1,x2,x3) \ do { \ - x0 = ROTL64 (13, x0); \ - x2 = ROTL64 (3, x2); \ + x0 = DROTL32 (13, x0); \ + x2 = DROTL32 (3, x2); \ x1 = x1 ^ x0 ^ x2; \ - x3 = x3 ^ x2 ^ RSHIFT64(3, x0); \ - x1 = ROTL64 (1, x1); \ - x3 = ROTL64 (7, x3); \ + x3 = x3 ^ x2 ^ DRSHIFT32(3, x0); \ + x1 = DROTL32 (1, x1); \ + x3 = DROTL32 (7, x3); \ x0 = x0 ^ x1 ^ x3; \ - x2 = x2 ^ x3 ^ RSHIFT64(7, x1); \ - x0 = ROTL64 (5, x0); \ - x2 = ROTL64 (22, x2); \ + x2 = x2 ^ x3 ^ DRSHIFT32(7, x1); \ + x0 = DROTL32 (5, x0); \ + x2 = DROTL32 (22, x2); \ } while (0) #define ROUND64(which, subkey, x0,x1,x2,x3, y0,y1,y2,y3) \ diff --git a/serpent-internal.h b/serpent-internal.h index d99ee3c4f14b361e9bcc0335bf408bbdab67d690..abef47fcf97161a4020b0d58a7db6ab093bd47ec 100644 --- a/serpent-internal.h +++ b/serpent-internal.h @@ -51,7 +51,7 @@ #if HAVE_NATIVE_64_BIT /* Operate independently on both halves of a 64-bit word. */ -#define ROTL64(n,x) \ +#define DROTL32(n,x) \ (((x) << (n) & ~((((uint64_t) 1 << (n))-1) << 32)) \ |(((x) >> (32-(n))) & ~((((uint64_t) 1 << (32-(n)))-1) << (n)))) @@ -64,7 +64,7 @@ _sk = (subkey)[3]; _sk |= _sk << 32; (x3) ^= _sk; \ } while (0) -#define RSHIFT64(n,x) \ +#define DRSHIFT32(n,x) \ ( ((x) << (n)) & ~((((uint64_t) 1 << (n)) - 1) << 32)) #endif /* HAVE_NATIVE_64_BIT */