Browse Source

fix multi2 as proposed by kmx

Steffen Jaeckel 13 years ago
parent
commit
21ddcf3568
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/ciphers/multi2.c

+ 2 - 2
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)
 static void decrypt(ulong32 *p, int N, ulong32 *uk)
 {
 {
    int n, t;
    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 4: pi4(p, uk+t); --n;
          case 3: pi3(p, uk+t); --n;
          case 3: pi3(p, uk+t); --n;
          case 2: pi2(p, uk+t); --n;
          case 2: pi2(p, uk+t); --n;