From 21ddcf35681916c091ae91e7e8e5bd6bdf8ab51d Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Sun, 18 Nov 2012 18:44:14 +0100 Subject: [PATCH] fix multi2 as proposed by kmx --- src/ciphers/multi2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ciphers/multi2.c b/src/ciphers/multi2.c index feea287..78a3eac 100644 --- a/src/ciphers/multi2.c +++ b/src/ciphers/multi2.c @@ -94,8 +94,8 @@ static void encrypt(ulong32 *p, int N, ulong32 *uk) static void decrypt(ulong32 *p, int N, ulong32 *uk) { int n, t; - for (t = 4*((N&1)^1), n = N; ; ) { - switch (n >= 4 ? 4 : 0) { + for (t = 4*(((N-1)>>2)&1), n = N; ; ) { + switch (n<=4 ? n : ((n-1)%4)+1) { case 4: pi4(p, uk+t); --n; case 3: pi3(p, uk+t); --n; case 2: pi2(p, uk+t); --n;