From d20990fd971a18fab36df5d578647b1d9559574b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Mon, 12 Nov 2012 20:55:19 +0100 Subject: [PATCH] Renamed serpent-internal.h macros. --- ChangeLog | 10 ++++++++++ serpent-decrypt.c | 16 ++++++++-------- serpent-encrypt.c | 16 ++++++++-------- serpent-internal.h | 4 ++-- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3844803b..17b181ac 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 a991255e..a7ae661c 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 e82efea0..2c77f12d 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 d99ee3c4..abef47fc 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 */ -- GitLab